@inpageedit/core 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +55 -55
  3. package/dist/ActionButton-BgbTKTg7.js.map +1 -1
  4. package/dist/CheckBox-D3rHnX7I.js.map +1 -1
  5. package/dist/IconQuickEdit-CAL1HXIb.js.map +1 -1
  6. package/dist/InputBox-BV4m05Xs.js.map +1 -1
  7. package/dist/Preferences-Bg3J5Ur9.js.map +1 -1
  8. package/dist/RadioBox-nJqWsxW2.js.map +1 -1
  9. package/dist/components/index.js.map +1 -1
  10. package/dist/{index-COlXHFRg.js → index-9Z4ds-WM.js} +281 -268
  11. package/dist/index-9Z4ds-WM.js.map +1 -0
  12. package/dist/{index-DwyuBkCK.js → index-BB9MXkUv.js} +3 -3
  13. package/dist/index-BB9MXkUv.js.map +1 -0
  14. package/dist/{index-DBV8FBjA.js → index-BDVcDlsf.js} +2 -2
  15. package/dist/index-BDVcDlsf.js.map +1 -0
  16. package/dist/index-Bh70Udzi.js.map +1 -1
  17. package/dist/{index-C8dOYIIz.js → index-CADkQBg0.js} +2 -2
  18. package/dist/{index-C8dOYIIz.js.map → index-CADkQBg0.js.map} +1 -1
  19. package/dist/{index-CeXR4lOu.js → index-CBQsBfc2.js} +32 -34
  20. package/dist/{index-CeXR4lOu.js.map → index-CBQsBfc2.js.map} +1 -1
  21. package/dist/{index-mntCdHRr.js → index-CNsB3Vcb.js} +3 -3
  22. package/dist/{index-mntCdHRr.js.map → index-CNsB3Vcb.js.map} +1 -1
  23. package/dist/{index-9M1QcjCN.js → index-CYdxWw9g.js} +124 -123
  24. package/dist/index-CYdxWw9g.js.map +1 -0
  25. package/dist/index-CvhkVj_L.js.map +1 -1
  26. package/dist/{index-Ba7Wkale.js → index-D7SQwFxl.js} +2 -2
  27. package/dist/{index-Ba7Wkale.js.map → index-D7SQwFxl.js.map} +1 -1
  28. package/dist/{index-kRdAN8h3.js → index-DMNUP3fg.js} +2 -2
  29. package/dist/{index-kRdAN8h3.js.map → index-DMNUP3fg.js.map} +1 -1
  30. package/dist/{index-Tn22YSmW.js → index-G3k3kjCU.js} +2 -2
  31. package/dist/index-G3k3kjCU.js.map +1 -0
  32. package/dist/{index-OBerV4GU.js → index-dp6_MU68.js} +2 -2
  33. package/dist/index-dp6_MU68.js.map +1 -0
  34. package/dist/index-lZkYoUca.js.map +1 -1
  35. package/dist/index.js +1 -1
  36. package/dist/makeCallable-LDU0xZMJ.js.map +1 -1
  37. package/dist/noop-ClDc6zv4.js.map +1 -1
  38. package/dist/services/CurrentPageService.d.ts +1 -0
  39. package/dist/services/WikiMetadataService.d.ts +1 -1
  40. package/dist/style.css +1 -1
  41. package/lib/index.umd.js +26 -24
  42. package/lib/index.umd.js.map +1 -1
  43. package/lib/style.css +1 -1
  44. package/package.json +3 -3
  45. package/dist/index-9M1QcjCN.js.map +0 -1
  46. package/dist/index-COlXHFRg.js.map +0 -1
  47. package/dist/index-DBV8FBjA.js.map +0 -1
  48. package/dist/index-DwyuBkCK.js.map +0 -1
  49. package/dist/index-OBerV4GU.js.map +0 -1
  50. package/dist/index-Tn22YSmW.js.map +0 -1
package/lib/index.umd.js CHANGED
@@ -1,13 +1,13 @@
1
- (function(le,ge){typeof exports=="object"&&typeof module<"u"?ge(exports):typeof define=="function"&&define.amd?define(["exports"],ge):(le=typeof globalThis<"u"?globalThis:le||self,ge(le.InPageEditBundle={}))})(this,function(le){"use strict";var Aw=Object.defineProperty;var td=le=>{throw TypeError(le)};var Ow=(le,ge,Ne)=>ge in le?Aw(le,ge,{enumerable:!0,configurable:!0,writable:!0,value:Ne}):le[ge]=Ne;var te=(le,ge,Ne)=>Ow(le,typeof ge!="symbol"?ge+"":ge,Ne),Pa=(le,ge,Ne)=>ge.has(le)||td("Cannot "+Ne);var me=(le,ge,Ne)=>(Pa(le,ge,"read from private field"),Ne?Ne.call(le):ge.get(le)),ir=(le,ge,Ne)=>ge.has(le)?td("Cannot add the same private member more than once"):ge instanceof WeakSet?ge.add(le):ge.set(le,Ne),bt=(le,ge,Ne,ne)=>(Pa(le,ge,"write to private field"),ne?ne.call(le,Ne):ge.set(le,Ne),Ne),ht=(le,ge,Ne)=>(Pa(le,ge,"access private method"),Ne);var gt,Vn,Sn,Yn,Gn,Qn,Jn,Oe,ct,Ve,$a,nd,Ca,rd,id,sd,Mt,ad,ld,cd,ud,qr;const ge=()=>{let t,e;return{promise:new Promise((r,i)=>{t=r,e=i}),resolve:t,reject:e}};Promise.withResolvers||(Promise.withResolvers=ge);var Ne=Object.defineProperty,ne=(t,e)=>Ne(t,"name",{value:e,configurable:!0});function fd(){}ne(fd,"noop");function $e(t){return t==null}ne($e,"isNullable");function dd(t){return!$e(t)}ne(dd,"isNonNullable");function Vr(t){return t&&typeof t=="object"&&!Array.isArray(t)}ne(Vr,"isPlainObject");function Ta(t,e){return Object.fromEntries(Object.entries(t).filter(([n,r])=>e(n,r)))}ne(Ta,"filterKeys");function jt(t,e){return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,e(r,n)]))}ne(jt,"mapValues");function Ia(t,e,n){if(!e)return{...t};const r={};for(const i of e)(n||t[i]!==void 0)&&(r[i]=t[i]);return r}ne(Ia,"pick");function hd(t,e){if(!e)return{...t};const n={...t};for(const r of e)Reflect.deleteProperty(n,r);return n}ne(hd,"omit");function He(t,e,n){return Object.defineProperty(t,e,{writable:!0,value:n,enumerable:!1})}ne(He,"defineProperty");function pd(t,e){return e.every(n=>t.includes(n))}ne(pd,"contain");function md(t,e){return t.filter(n=>e.includes(n))}ne(md,"intersection");function gd(t,e){return t.filter(n=>!e.includes(n))}ne(gd,"difference");function vd(t,e){return Array.from(new Set([...t,...e]))}ne(vd,"union");function yd(t){return[...new Set(t)]}ne(yd,"deduplicate");function Gt(t,e){const n=t?.indexOf(e);return n>=0?(t.splice(n,1),!0):!1}ne(Gt,"remove");function bd(t){return Array.isArray(t)?t:$e(t)?[]:[t]}ne(bd,"makeArray");function Qt(t,e){return arguments.length===1?n=>Qt(t,n):t in globalThis&&e instanceof globalThis[t]||Object.prototype.toString.call(e).slice(8,-1)===t}ne(Qt,"is");function sr(t){return Qt("ArrayBuffer",t)||Qt("SharedArrayBuffer",t)}ne(sr,"isArrayBufferLike");function Aa(t){return sr(t)||ArrayBuffer.isView(t)}ne(Aa,"isArrayBufferSource");var Et;(t=>{t.is=sr,t.isSource=Aa;function e(o){return ArrayBuffer.isView(o)?o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength):o}t.fromSource=e,ne(e,"fromSource");function n(o){if(typeof Buffer<"u")return Buffer.from(o).toString("base64");let a="";const l=new Uint8Array(o);for(let c=0;c<l.byteLength;c++)a+=String.fromCharCode(l[c]);return btoa(a)}t.toBase64=n,ne(n,"toBase64");function r(o){return typeof Buffer<"u"?e(Buffer.from(o,"base64")):Uint8Array.from(atob(o),a=>a.charCodeAt(0))}t.fromBase64=r,ne(r,"fromBase64");function i(o){return typeof Buffer<"u"?Buffer.from(o).toString("hex"):Array.from(new Uint8Array(o),a=>a.toString(16).padStart(2,"0")).join("")}t.toHex=i,ne(i,"toHex");function s(o){if(typeof Buffer<"u")return e(Buffer.from(o,"hex"));const a=o.length%2===0?o:o.slice(0,o.length-1),l=[];for(let c=0;c<a.length;c+=2)l.push(parseInt(`${a[c]}${a[c+1]}`,16));return Uint8Array.from(l).buffer}t.fromHex=s,ne(s,"fromHex")})(Et||(Et={})),Et.fromBase64,Et.toBase64,Et.fromHex,Et.toHex;function Yr(t,e=new Map){if(!t||typeof t!="object")return t;if(Qt("Date",t))return new Date(t.valueOf());if(Qt("RegExp",t))return new RegExp(t.source,t.flags);if(sr(t))return t.slice(0);if(ArrayBuffer.isView(t))return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);const n=e.get(t);if(n)return n;if(Array.isArray(t)){const i=[];return e.set(t,i),t.forEach((s,o)=>{i[o]=Reflect.apply(Yr,null,[s,e])}),i}const r=Object.create(Object.getPrototypeOf(t));e.set(t,r);for(const i of Reflect.ownKeys(t)){const s={...Reflect.getOwnPropertyDescriptor(t,i)};"value"in s&&(s.value=Reflect.apply(Yr,null,[s.value,e])),Reflect.defineProperty(r,i,s)}return r}ne(Yr,"clone");function dn(t,e,n){if(t===e||!n&&$e(t)&&$e(e))return!0;if(typeof t!=typeof e||typeof t!="object"||!t||!e)return!1;function r(i,s){return i(t)?i(e)?s(t,e):!1:i(e)?!1:void 0}return ne(r,"check"),r(Array.isArray,(i,s)=>i.length===s.length&&i.every((o,a)=>dn(o,s[a])))??r(Qt("Date"),(i,s)=>i.valueOf()===s.valueOf())??r(Qt("RegExp"),(i,s)=>i.source===s.source&&i.flags===s.flags)??r(sr,(i,s)=>{if(i.byteLength!==s.byteLength)return!1;const o=new Uint8Array(i),a=new Uint8Array(s);for(let l=0;l<o.length;l++)if(o[l]!==a[l])return!1;return!0})??Object.keys({...t,...e}).every(i=>dn(t[i],e[i],n))}ne(dn,"deepEqual");function wd(t){return t.charAt(0).toUpperCase()+t.slice(1)}ne(wd,"capitalize");function _d(t){return t.charAt(0).toLowerCase()+t.slice(1)}ne(_d,"uncapitalize");function xd(t){return t.replace(/[_-][a-z]/g,e=>e.slice(1).toUpperCase())}ne(xd,"camelCase");function ps(t,e,n){const r=[];let i=0;for(let s=0;s<t.length;s++){const o=t.charCodeAt(s);if(o>=65&&o<=90){if(i===1){const a=t.charCodeAt(s+1);a>=97&&a<=122&&r.push(n),r.push(o+32)}else i!==0&&r.push(n),r.push(o+32);i=1}else o>=97&&o<=122?(r.push(o),i=2):e.includes(o)?(i!==0&&r.push(n),i=0):r.push(o)}return String.fromCharCode(...r)}ne(ps,"tokenize");function Sd(t){return ps(t,[45,95],45)}ne(Sd,"paramCase");function Ed(t){return ps(t,[45,95],95)}ne(Ed,"snakeCase");function kd(t){return typeof t!="string"?`[${t.toString()}]`:/^[a-z_$][\w$]*$/i.test(t)?`.${t}`:`[${JSON.stringify(t)}]`}ne(kd,"formatProperty");function Oa(t){return t.replace(/\/$/,"")}ne(Oa,"trimSlash");function Pd(t){return t.startsWith("/")||(t="/"+t),Oa(t)}ne(Pd,"sanitize");var Ra;(t=>{t.millisecond=1,t.second=1e3,t.minute=t.second*60,t.hour=t.minute*60,t.day=t.hour*24,t.week=t.day*7;let e=new Date().getTimezoneOffset();function n(v){e=v}t.setTimezoneOffset=n,ne(n,"setTimezoneOffset");function r(){return e}t.getTimezoneOffset=r,ne(r,"getTimezoneOffset");function i(v=new Date,b){return typeof v=="number"&&(v=new Date(v)),b===void 0&&(b=e),Math.floor((v.valueOf()/t.minute-b)/1440)}t.getDateNumber=i,ne(i,"getDateNumber");function s(v,b){const I=new Date(v*t.day);return b===void 0&&(b=e),new Date(+I+b*t.minute)}t.fromDateNumber=s,ne(s,"fromDateNumber");const o=/\d+(?:\.\d+)?/.source,a=new RegExp(`^${["w(?:eek(?:s)?)?","d(?:ay(?:s)?)?","h(?:our(?:s)?)?","m(?:in(?:ute)?(?:s)?)?","s(?:ec(?:ond)?(?:s)?)?"].map(v=>`(${o}${v})?`).join("")}$`);function l(v){const b=a.exec(v);return b?(parseFloat(b[1])*t.week||0)+(parseFloat(b[2])*t.day||0)+(parseFloat(b[3])*t.hour||0)+(parseFloat(b[4])*t.minute||0)+(parseFloat(b[5])*t.second||0):0}t.parseTime=l,ne(l,"parseTime");function c(v){const b=l(v);return b?v=Date.now()+b:/^\d{1,2}(:\d{1,2}){1,2}$/.test(v)?v=`${new Date().toLocaleDateString()}-${v}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(v)&&(v=`${new Date().getFullYear()}-${v}`),v?new Date(v):new Date}t.parseDate=c,ne(c,"parseDate");function u(v){const b=Math.abs(v);return b>=t.day-t.hour/2?Math.round(v/t.day)+"d":b>=t.hour-t.minute/2?Math.round(v/t.hour)+"h":b>=t.minute-t.second/2?Math.round(v/t.minute)+"m":b>=t.second?Math.round(v/t.second)+"s":v+"ms"}t.format=u,ne(u,"format");function f(v,b=2){return v.toString().padStart(b,"0")}t.toDigits=f,ne(f,"toDigits");function p(v,b=new Date){return v.replace("yyyy",b.getFullYear().toString()).replace("yy",b.getFullYear().toString().slice(2)).replace("MM",f(b.getMonth()+1)).replace("dd",f(b.getDate())).replace("hh",f(b.getHours())).replace("mm",f(b.getMinutes())).replace("ss",f(b.getSeconds())).replace("SSS",f(b.getMilliseconds(),3))}t.template=p,ne(p,"template")})(Ra||(Ra={}));var $d=Object.defineProperty,ie=(t,e)=>$d(t,"name",{value:e,configurable:!0}),Y={shadow:Symbol.for("cordis.shadow"),receiver:Symbol.for("cordis.receiver"),original:Symbol.for("cordis.original"),store:Symbol.for("cordis.store"),events:Symbol.for("cordis.events"),static:Symbol.for("cordis.static"),filter:Symbol.for("cordis.filter"),expose:Symbol.for("cordis.expose"),isolate:Symbol.for("cordis.isolate"),internal:Symbol.for("cordis.internal"),intercept:Symbol.for("cordis.intercept"),setup:Symbol.for("cordis.setup"),invoke:Symbol.for("cordis.invoke"),extend:Symbol.for("cordis.extend"),tracker:Symbol.for("cordis.tracker"),provide:Symbol.for("cordis.provide"),immediate:Symbol.for("cordis.immediate")},Cd=function*(){}.constructor,Na=async function*(){}.constructor;function ms(t){return!(!t.prototype||t instanceof Cd||Na!==Function&&t instanceof Na)}ie(ms,"isConstructor");function or(t,e){const n=t.Config||t.schema;return n&&t.schema!==!1&&(e=n(e)),e??{}}ie(or,"resolveConfig");function Da(t){return[Map,Set,Date,Promise].some(e=>t instanceof e)}ie(Da,"isUnproxyable");function gs(t,e){if(t===Object.prototype)return e;const n=Object.create(gs(Object.getPrototypeOf(t),e));for(const r of Reflect.ownKeys(t))Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r));return n}ie(gs,"joinPrototype");function vs(t){return t&&(typeof t=="object"||typeof t=="function")}ie(vs,"isObject");function kt(t,e,n){if(!vs(e))return e;if(Object.hasOwn(e,Y.shadow))return Object.getPrototypeOf(e);const r=e[Y.tracker];return r?Qr(t,e,r,n):e}ie(kt,"getTraceable");function ar(t,e){return e?new Proxy(t,{get:ie((n,r,i)=>r in e&&r!=="constructor"?Reflect.get(e,r,i):Reflect.get(n,r,i),"get"),set:ie((n,r,i,s)=>r in e&&r!=="constructor"?Reflect.set(e,r,i,s):Reflect.set(n,r,i,s),"set")}):t}ie(ar,"withProps");function Gr(t,e,n){return ar(t,Object.defineProperty(Object.create(null),e,{value:n,writable:!1}))}ie(Gr,"withProp");function ys(t,e,n,r){if(!n)return r;const i=Reflect.getOwnPropertyDescriptor(e,n)?.value;return i?Gr(r,n,t.extend({[Y.shadow]:i})):r}ie(ys,"createShadow");function La(t,e,n,r){return new Proxy(e,{apply:ie((i,s,o)=>(s===n&&(s=r),o=o.map(a=>typeof a!="function"||a[Y.original]?a:new Proxy(a,{get:ie((l,c,u)=>{if(c===Y.original)return l;const f=Reflect.get(l,c,u);return c==="toString"&&f===Function.prototype.toString?function(...p){return Reflect.apply(f,this===u?l:this,p)}:f},"get"),apply:ie((l,c,u)=>Reflect.apply(l,kt(t,c),u.map(f=>kt(t,f))),"apply"),construct:ie((l,c,u)=>Reflect.construct(l,c.map(f=>kt(t,f)),u),"construct")})),kt(t,Reflect.apply(i,s,o))),"apply")})}ie(La,"createShadowMethod");function Qr(t,e,n,r){t[Y.shadow]&&(t=Object.getPrototypeOf(t));const i=new Proxy(e,{get:ie((s,o,a)=>{if(o===Y.original)return s;if(o===n.property)return t;if(typeof o=="symbol")return Reflect.get(s,o,a);if(n.associate&&t[Y.internal][`${n.associate}.${o}`])return Reflect.get(t,`${n.associate}.${o}`,Gr(t,Y.receiver,a));const l=ys(t,s,n.property,a),c=Reflect.get(s,o,l),u=c?.[Y.tracker];return u?Qr(t,c,u):!r&&typeof c=="function"?La(t,c,a,l):c},"get"),set:ie((s,o,a,l)=>{if(o===Y.original||o===n.property)return!1;if(typeof o=="symbol")return Reflect.set(s,o,a,l);if(n.associate&&t[Y.internal][`${n.associate}.${o}`])return Reflect.set(t,`${n.associate}.${o}`,a,Gr(t,Y.receiver,l));const c=ys(t,s,n.property,l);return Reflect.set(s,o,a,c)},"set"),apply:ie((s,o,a)=>bs(i,s,o,a),"apply")});return i}ie(Qr,"createTraceable");function bs(t,e,n,r){return e[Y.invoke]?e[Y.invoke].apply(t,r):Reflect.apply(e,n,r)}ie(bs,"applyTraceable");function ws(t,e,n){const r=ie(function(...i){const s=Qr(r.ctx,r,n);return bs(s,r,this,i)},"self");return He(r,"name",t),Object.setPrototypeOf(r,e)}ie(ws,"createCallable");var Td=(gt=class{constructor(e){this.ctx=e,He(this,Y.tracker,{associate:"reflect",property:"ctx"}),this._mixin("reflect",["get","set","provide","accessor","mixin","alias"]),this._mixin("scope",["config","runtime","effect","collect","accept","decline"]),this._mixin("registry",["using","inject","plugin"]),this._mixin("lifecycle",["on","once","parallel","emit","serial","bail","start","stop"])}static resolveInject(e,n){let r=e[Y.internal][n];for(;r?.type==="alias";)n=r.name,r=e[Y.internal][n];return[n,r]}static checkInject(e,n,r){if(e=e[Y.shadow]??e,["prototype","then","registry","lifecycle"].includes(n)||n[0]==="$"||n[0]==="_"||!e.runtime.plugin||e.bail(e,"internal/inject",n))return;const i=r.stack.split(`
1
+ (function(le,ge){typeof exports=="object"&&typeof module<"u"?ge(exports):typeof define=="function"&&define.amd?define(["exports"],ge):(le=typeof globalThis<"u"?globalThis:le||self,ge(le.InPageEditBundle={}))})(this,function(le){"use strict";var Ow=Object.defineProperty;var td=le=>{throw TypeError(le)};var Aw=(le,ge,Ne)=>ge in le?Ow(le,ge,{enumerable:!0,configurable:!0,writable:!0,value:Ne}):le[ge]=Ne;var te=(le,ge,Ne)=>Aw(le,typeof ge!="symbol"?ge+"":ge,Ne),Pa=(le,ge,Ne)=>ge.has(le)||td("Cannot "+Ne);var he=(le,ge,Ne)=>(Pa(le,ge,"read from private field"),Ne?Ne.call(le):ge.get(le)),ir=(le,ge,Ne)=>ge.has(le)?td("Cannot add the same private member more than once"):ge instanceof WeakSet?ge.add(le):ge.set(le,Ne),bt=(le,ge,Ne,ne)=>(Pa(le,ge,"write to private field"),ne?ne.call(le,Ne):ge.set(le,Ne),Ne),ht=(le,ge,Ne)=>(Pa(le,ge,"access private method"),Ne);var gt,Vn,Sn,Yn,Gn,Qn,Jn,Ae,ct,Ve,$a,nd,Ca,rd,id,sd,Mt,ad,ld,cd,ud,qr;const ge=()=>{let t,e;return{promise:new Promise((r,i)=>{t=r,e=i}),resolve:t,reject:e}};Promise.withResolvers||(Promise.withResolvers=ge);var Ne=Object.defineProperty,ne=(t,e)=>Ne(t,"name",{value:e,configurable:!0});function fd(){}ne(fd,"noop");function $e(t){return t==null}ne($e,"isNullable");function dd(t){return!$e(t)}ne(dd,"isNonNullable");function Vr(t){return t&&typeof t=="object"&&!Array.isArray(t)}ne(Vr,"isPlainObject");function Ta(t,e){return Object.fromEntries(Object.entries(t).filter(([n,r])=>e(n,r)))}ne(Ta,"filterKeys");function jt(t,e){return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,e(r,n)]))}ne(jt,"mapValues");function Ia(t,e,n){if(!e)return{...t};const r={};for(const i of e)(n||t[i]!==void 0)&&(r[i]=t[i]);return r}ne(Ia,"pick");function hd(t,e){if(!e)return{...t};const n={...t};for(const r of e)Reflect.deleteProperty(n,r);return n}ne(hd,"omit");function He(t,e,n){return Object.defineProperty(t,e,{writable:!0,value:n,enumerable:!1})}ne(He,"defineProperty");function pd(t,e){return e.every(n=>t.includes(n))}ne(pd,"contain");function md(t,e){return t.filter(n=>e.includes(n))}ne(md,"intersection");function gd(t,e){return t.filter(n=>!e.includes(n))}ne(gd,"difference");function vd(t,e){return Array.from(new Set([...t,...e]))}ne(vd,"union");function yd(t){return[...new Set(t)]}ne(yd,"deduplicate");function Gt(t,e){const n=t?.indexOf(e);return n>=0?(t.splice(n,1),!0):!1}ne(Gt,"remove");function bd(t){return Array.isArray(t)?t:$e(t)?[]:[t]}ne(bd,"makeArray");function Qt(t,e){return arguments.length===1?n=>Qt(t,n):t in globalThis&&e instanceof globalThis[t]||Object.prototype.toString.call(e).slice(8,-1)===t}ne(Qt,"is");function sr(t){return Qt("ArrayBuffer",t)||Qt("SharedArrayBuffer",t)}ne(sr,"isArrayBufferLike");function Oa(t){return sr(t)||ArrayBuffer.isView(t)}ne(Oa,"isArrayBufferSource");var Et;(t=>{t.is=sr,t.isSource=Oa;function e(o){return ArrayBuffer.isView(o)?o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength):o}t.fromSource=e,ne(e,"fromSource");function n(o){if(typeof Buffer<"u")return Buffer.from(o).toString("base64");let a="";const l=new Uint8Array(o);for(let c=0;c<l.byteLength;c++)a+=String.fromCharCode(l[c]);return btoa(a)}t.toBase64=n,ne(n,"toBase64");function r(o){return typeof Buffer<"u"?e(Buffer.from(o,"base64")):Uint8Array.from(atob(o),a=>a.charCodeAt(0))}t.fromBase64=r,ne(r,"fromBase64");function i(o){return typeof Buffer<"u"?Buffer.from(o).toString("hex"):Array.from(new Uint8Array(o),a=>a.toString(16).padStart(2,"0")).join("")}t.toHex=i,ne(i,"toHex");function s(o){if(typeof Buffer<"u")return e(Buffer.from(o,"hex"));const a=o.length%2===0?o:o.slice(0,o.length-1),l=[];for(let c=0;c<a.length;c+=2)l.push(parseInt(`${a[c]}${a[c+1]}`,16));return Uint8Array.from(l).buffer}t.fromHex=s,ne(s,"fromHex")})(Et||(Et={})),Et.fromBase64,Et.toBase64,Et.fromHex,Et.toHex;function Yr(t,e=new Map){if(!t||typeof t!="object")return t;if(Qt("Date",t))return new Date(t.valueOf());if(Qt("RegExp",t))return new RegExp(t.source,t.flags);if(sr(t))return t.slice(0);if(ArrayBuffer.isView(t))return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);const n=e.get(t);if(n)return n;if(Array.isArray(t)){const i=[];return e.set(t,i),t.forEach((s,o)=>{i[o]=Reflect.apply(Yr,null,[s,e])}),i}const r=Object.create(Object.getPrototypeOf(t));e.set(t,r);for(const i of Reflect.ownKeys(t)){const s={...Reflect.getOwnPropertyDescriptor(t,i)};"value"in s&&(s.value=Reflect.apply(Yr,null,[s.value,e])),Reflect.defineProperty(r,i,s)}return r}ne(Yr,"clone");function dn(t,e,n){if(t===e||!n&&$e(t)&&$e(e))return!0;if(typeof t!=typeof e||typeof t!="object"||!t||!e)return!1;function r(i,s){return i(t)?i(e)?s(t,e):!1:i(e)?!1:void 0}return ne(r,"check"),r(Array.isArray,(i,s)=>i.length===s.length&&i.every((o,a)=>dn(o,s[a])))??r(Qt("Date"),(i,s)=>i.valueOf()===s.valueOf())??r(Qt("RegExp"),(i,s)=>i.source===s.source&&i.flags===s.flags)??r(sr,(i,s)=>{if(i.byteLength!==s.byteLength)return!1;const o=new Uint8Array(i),a=new Uint8Array(s);for(let l=0;l<o.length;l++)if(o[l]!==a[l])return!1;return!0})??Object.keys({...t,...e}).every(i=>dn(t[i],e[i],n))}ne(dn,"deepEqual");function wd(t){return t.charAt(0).toUpperCase()+t.slice(1)}ne(wd,"capitalize");function _d(t){return t.charAt(0).toLowerCase()+t.slice(1)}ne(_d,"uncapitalize");function xd(t){return t.replace(/[_-][a-z]/g,e=>e.slice(1).toUpperCase())}ne(xd,"camelCase");function ms(t,e,n){const r=[];let i=0;for(let s=0;s<t.length;s++){const o=t.charCodeAt(s);if(o>=65&&o<=90){if(i===1){const a=t.charCodeAt(s+1);a>=97&&a<=122&&r.push(n),r.push(o+32)}else i!==0&&r.push(n),r.push(o+32);i=1}else o>=97&&o<=122?(r.push(o),i=2):e.includes(o)?(i!==0&&r.push(n),i=0):r.push(o)}return String.fromCharCode(...r)}ne(ms,"tokenize");function Sd(t){return ms(t,[45,95],45)}ne(Sd,"paramCase");function Ed(t){return ms(t,[45,95],95)}ne(Ed,"snakeCase");function kd(t){return typeof t!="string"?`[${t.toString()}]`:/^[a-z_$][\w$]*$/i.test(t)?`.${t}`:`[${JSON.stringify(t)}]`}ne(kd,"formatProperty");function Aa(t){return t.replace(/\/$/,"")}ne(Aa,"trimSlash");function Pd(t){return t.startsWith("/")||(t="/"+t),Aa(t)}ne(Pd,"sanitize");var Ra;(t=>{t.millisecond=1,t.second=1e3,t.minute=t.second*60,t.hour=t.minute*60,t.day=t.hour*24,t.week=t.day*7;let e=new Date().getTimezoneOffset();function n(v){e=v}t.setTimezoneOffset=n,ne(n,"setTimezoneOffset");function r(){return e}t.getTimezoneOffset=r,ne(r,"getTimezoneOffset");function i(v=new Date,b){return typeof v=="number"&&(v=new Date(v)),b===void 0&&(b=e),Math.floor((v.valueOf()/t.minute-b)/1440)}t.getDateNumber=i,ne(i,"getDateNumber");function s(v,b){const I=new Date(v*t.day);return b===void 0&&(b=e),new Date(+I+b*t.minute)}t.fromDateNumber=s,ne(s,"fromDateNumber");const o=/\d+(?:\.\d+)?/.source,a=new RegExp(`^${["w(?:eek(?:s)?)?","d(?:ay(?:s)?)?","h(?:our(?:s)?)?","m(?:in(?:ute)?(?:s)?)?","s(?:ec(?:ond)?(?:s)?)?"].map(v=>`(${o}${v})?`).join("")}$`);function l(v){const b=a.exec(v);return b?(parseFloat(b[1])*t.week||0)+(parseFloat(b[2])*t.day||0)+(parseFloat(b[3])*t.hour||0)+(parseFloat(b[4])*t.minute||0)+(parseFloat(b[5])*t.second||0):0}t.parseTime=l,ne(l,"parseTime");function c(v){const b=l(v);return b?v=Date.now()+b:/^\d{1,2}(:\d{1,2}){1,2}$/.test(v)?v=`${new Date().toLocaleDateString()}-${v}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(v)&&(v=`${new Date().getFullYear()}-${v}`),v?new Date(v):new Date}t.parseDate=c,ne(c,"parseDate");function u(v){const b=Math.abs(v);return b>=t.day-t.hour/2?Math.round(v/t.day)+"d":b>=t.hour-t.minute/2?Math.round(v/t.hour)+"h":b>=t.minute-t.second/2?Math.round(v/t.minute)+"m":b>=t.second?Math.round(v/t.second)+"s":v+"ms"}t.format=u,ne(u,"format");function f(v,b=2){return v.toString().padStart(b,"0")}t.toDigits=f,ne(f,"toDigits");function y(v,b=new Date){return v.replace("yyyy",b.getFullYear().toString()).replace("yy",b.getFullYear().toString().slice(2)).replace("MM",f(b.getMonth()+1)).replace("dd",f(b.getDate())).replace("hh",f(b.getHours())).replace("mm",f(b.getMinutes())).replace("ss",f(b.getSeconds())).replace("SSS",f(b.getMilliseconds(),3))}t.template=y,ne(y,"template")})(Ra||(Ra={}));var $d=Object.defineProperty,ie=(t,e)=>$d(t,"name",{value:e,configurable:!0}),Y={shadow:Symbol.for("cordis.shadow"),receiver:Symbol.for("cordis.receiver"),original:Symbol.for("cordis.original"),store:Symbol.for("cordis.store"),events:Symbol.for("cordis.events"),static:Symbol.for("cordis.static"),filter:Symbol.for("cordis.filter"),expose:Symbol.for("cordis.expose"),isolate:Symbol.for("cordis.isolate"),internal:Symbol.for("cordis.internal"),intercept:Symbol.for("cordis.intercept"),setup:Symbol.for("cordis.setup"),invoke:Symbol.for("cordis.invoke"),extend:Symbol.for("cordis.extend"),tracker:Symbol.for("cordis.tracker"),provide:Symbol.for("cordis.provide"),immediate:Symbol.for("cordis.immediate")},Cd=function*(){}.constructor,Na=async function*(){}.constructor;function gs(t){return!(!t.prototype||t instanceof Cd||Na!==Function&&t instanceof Na)}ie(gs,"isConstructor");function or(t,e){const n=t.Config||t.schema;return n&&t.schema!==!1&&(e=n(e)),e??{}}ie(or,"resolveConfig");function Da(t){return[Map,Set,Date,Promise].some(e=>t instanceof e)}ie(Da,"isUnproxyable");function vs(t,e){if(t===Object.prototype)return e;const n=Object.create(vs(Object.getPrototypeOf(t),e));for(const r of Reflect.ownKeys(t))Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r));return n}ie(vs,"joinPrototype");function ys(t){return t&&(typeof t=="object"||typeof t=="function")}ie(ys,"isObject");function kt(t,e,n){if(!ys(e))return e;if(Object.hasOwn(e,Y.shadow))return Object.getPrototypeOf(e);const r=e[Y.tracker];return r?Qr(t,e,r,n):e}ie(kt,"getTraceable");function ar(t,e){return e?new Proxy(t,{get:ie((n,r,i)=>r in e&&r!=="constructor"?Reflect.get(e,r,i):Reflect.get(n,r,i),"get"),set:ie((n,r,i,s)=>r in e&&r!=="constructor"?Reflect.set(e,r,i,s):Reflect.set(n,r,i,s),"set")}):t}ie(ar,"withProps");function Gr(t,e,n){return ar(t,Object.defineProperty(Object.create(null),e,{value:n,writable:!1}))}ie(Gr,"withProp");function bs(t,e,n,r){if(!n)return r;const i=Reflect.getOwnPropertyDescriptor(e,n)?.value;return i?Gr(r,n,t.extend({[Y.shadow]:i})):r}ie(bs,"createShadow");function La(t,e,n,r){return new Proxy(e,{apply:ie((i,s,o)=>(s===n&&(s=r),o=o.map(a=>typeof a!="function"||a[Y.original]?a:new Proxy(a,{get:ie((l,c,u)=>{if(c===Y.original)return l;const f=Reflect.get(l,c,u);return c==="toString"&&f===Function.prototype.toString?function(...y){return Reflect.apply(f,this===u?l:this,y)}:f},"get"),apply:ie((l,c,u)=>Reflect.apply(l,kt(t,c),u.map(f=>kt(t,f))),"apply"),construct:ie((l,c,u)=>Reflect.construct(l,c.map(f=>kt(t,f)),u),"construct")})),kt(t,Reflect.apply(i,s,o))),"apply")})}ie(La,"createShadowMethod");function Qr(t,e,n,r){t[Y.shadow]&&(t=Object.getPrototypeOf(t));const i=new Proxy(e,{get:ie((s,o,a)=>{if(o===Y.original)return s;if(o===n.property)return t;if(typeof o=="symbol")return Reflect.get(s,o,a);if(n.associate&&t[Y.internal][`${n.associate}.${o}`])return Reflect.get(t,`${n.associate}.${o}`,Gr(t,Y.receiver,a));const l=bs(t,s,n.property,a),c=Reflect.get(s,o,l),u=c?.[Y.tracker];return u?Qr(t,c,u):!r&&typeof c=="function"?La(t,c,a,l):c},"get"),set:ie((s,o,a,l)=>{if(o===Y.original||o===n.property)return!1;if(typeof o=="symbol")return Reflect.set(s,o,a,l);if(n.associate&&t[Y.internal][`${n.associate}.${o}`])return Reflect.set(t,`${n.associate}.${o}`,a,Gr(t,Y.receiver,l));const c=bs(t,s,n.property,l);return Reflect.set(s,o,a,c)},"set"),apply:ie((s,o,a)=>ws(i,s,o,a),"apply")});return i}ie(Qr,"createTraceable");function ws(t,e,n,r){return e[Y.invoke]?e[Y.invoke].apply(t,r):Reflect.apply(e,n,r)}ie(ws,"applyTraceable");function _s(t,e,n){const r=ie(function(...i){const s=Qr(r.ctx,r,n);return ws(s,r,this,i)},"self");return He(r,"name",t),Object.setPrototypeOf(r,e)}ie(_s,"createCallable");var Td=(gt=class{constructor(e){this.ctx=e,He(this,Y.tracker,{associate:"reflect",property:"ctx"}),this._mixin("reflect",["get","set","provide","accessor","mixin","alias"]),this._mixin("scope",["config","runtime","effect","collect","accept","decline"]),this._mixin("registry",["using","inject","plugin"]),this._mixin("lifecycle",["on","once","parallel","emit","serial","bail","start","stop"])}static resolveInject(e,n){let r=e[Y.internal][n];for(;r?.type==="alias";)n=r.name,r=e[Y.internal][n];return[n,r]}static checkInject(e,n,r){if(e=e[Y.shadow]??e,["prototype","then","registry","lifecycle"].includes(n)||n[0]==="$"||n[0]==="_"||!e.runtime.plugin||e.bail(e,"internal/inject",n))return;const i=r.stack.split(`
2
2
  `);i.splice(1,1),r.stack=i.join(`
3
- `),e.emit(e,"internal/warning",r)}get(e){if(this.ctx[Y.internal][e]?.type!=="service")return;const r=this.ctx[Y.isolate][e],i=this.ctx[Y.store][r]?.value;return kt(this.ctx,i)}set(e,n){this.provide(e);const r=this.ctx[Y.isolate][e],i=this.ctx[Y.store][r]?.value;n??(n=void 0);let s=ie(()=>{},"dispose");if(i===n)return s;if(!$e(n)&&!$e(i))throw new Error(`service ${e} has been registered`);const o=this.ctx;$e(n)||(s=o.effect(()=>()=>{o.set(e,void 0)})),Da(n)&&o.emit(o,"internal/warning",new Error(`service ${e} is an unproxyable object, which may lead to unexpected behavior`));const a=Object.create(o);return a[Y.filter]=l=>o[Y.isolate][e]===l[Y.isolate][e],o.emit(a,"internal/before-service",e,n),o[Y.store][r]={value:n,source:o},o.emit(a,"internal/service",e,i),s}provide(e,n,r){const i=this.ctx.root[Y.internal];if(e in i)return;const s=Symbol(e);i[e]={type:"service",builtin:r},this.ctx.root[Y.isolate][e]=s,vs(n)&&(this.ctx[Y.store][s]={value:n,source:null},He(n,Y.tracker,{associate:e,property:"ctx"}))}_accessor(e,n){const r=this.ctx.root[Y.internal];return e in r?()=>{}:(r[e]={type:"accessor",...n},()=>delete this.ctx.root[Y.isolate][e])}accessor(e,n){this.ctx.scope.effect(()=>this._accessor(e,n))}alias(e,n){const r=this.ctx.root[Y.internal];if(!(e in r))for(const i of n)r[i]||(r[i]={type:"alias",name:e})}_mixin(e,n){const r=Array.isArray(n)?n.map(o=>[o,o]):Object.entries(n),i=typeof e=="string"?o=>o[e]:()=>e,s=r.map(([o,a])=>this._accessor(a,{get(l){const c=i(this);if($e(c))return c;const u=l?ar(l,c):c,f=Reflect.get(c,o,u);return typeof f!="function"?f:f.bind(u??c)},set(l,c){const u=i(this),f=c?ar(c,u):u;return Reflect.set(u,o,l,f)}}));return()=>s.forEach(o=>o())}mixin(e,n){this.ctx.scope.effect(()=>this._mixin(e,n))}trace(e){return kt(this.ctx,e)}bind(e){return new Proxy(e,{apply:ie((n,r,i)=>n.apply(this.trace(r),i.map(s=>this.trace(s))),"apply")})}},ie(gt,"ReflectService"),te(gt,"handler",{get:ie((e,n,r)=>{if(typeof n!="string")return Reflect.get(e,n,r);if(Reflect.has(e,n))return kt(r,Reflect.get(e,n,r),!0);const[i,s]=gt.resolveInject(e,n),o=new Error(`property ${i} is not registered, declare it as \`inject\` to suppress this warning`);return s?s.type==="accessor"?s.get.call(r,r[Y.receiver]):(s.builtin||gt.checkInject(r,i,o),r.reflect.get(i)):(gt.checkInject(r,i,o),Reflect.get(e,i,r))},"get"),set:ie((e,n,r,i)=>{if(typeof n!="string")return Reflect.set(e,n,r,i);const[s,o]=gt.resolveInject(e,n);return o?o.type==="accessor"?o.set?o.set.call(i,r,i[Y.receiver]):!1:(i.reflect.set(s,r),!0):Reflect.set(e,s,r,i)},"set"),has:ie((e,n)=>{if(typeof n!="string")return Reflect.has(e,n);if(Reflect.has(e,n))return!0;const[,r]=gt.resolveInject(e,n);return!!r},"has")}),gt),_s=Td;function xs(t){return t!==null&&t!==!1&&t!==void 0}ie(xs,"isBailed");var Id=(Vn=class{constructor(e){te(this,"isActive",!1);te(this,"_tasks",new Set);te(this,"_hooks",{});this.ctx=e,He(this,Y.tracker,{associate:"lifecycle",property:"ctx"}),He(this.on("internal/listener",function(r,i,s){const o=s.prepend?"unshift":"push";if(r==="ready")return this.lifecycle.isActive?(this.scope.ensure(async()=>i()),()=>!1):void 0;if(r==="dispose")return this.scope.disposables[o](i),He(i,"name","event <dispose>"),()=>Gt(this.scope.disposables,i);if(r==="fork")return this.scope.runtime.forkables[o](i),this.scope.collect("event <fork>",()=>Gt(this.scope.runtime.forkables,i))}),Ze.static,e.scope);for(const r of["info","error","warning"])He(this.on(`internal/${r}`,(i,...s)=>{this._hooks[`internal/${r}`].length>1}),Ze.static,e.scope);He(this.on("internal/before-service",function(r){for(const i of this.registry.values()){if(!i.inject[r]?.required)continue;const s=i.isReusable?i.children:[i];for(const o of s)this[Y.filter](o.ctx)&&(o.updateStatus(),o.reset())}},{global:!0}),Ze.static,e.scope),He(this.on("internal/service",function(r){for(const i of this.registry.values()){if(!i.inject[r]?.required)continue;const s=i.isReusable?i.children:[i];for(const o of s)this[Y.filter](o.ctx)&&o.start()}},{global:!0}),Ze.static,e.scope);const n=ie((r,i)=>{if(!r.runtime.plugin)return!1;for(const s in r.runtime.inject)if(i===_s.resolveInject(r.ctx,s)[0])return!0;return n(r.parent.scope,i)},"checkInject");He(this.on("internal/inject",function(r){return n(this.scope,r)},{global:!0}),Ze.static,e.scope)}async flush(){for(;this._tasks.size;)await Promise.all(Array.from(this._tasks))}filterHooks(e,n){return n=kt(this.ctx,n),e.slice().filter(r=>{const i=n?.[Ze.filter];return r.global||!i||i.call(n,r.ctx)})}*dispatch(e,n){const r=typeof n[0]=="object"||typeof n[0]=="function"?n.shift():null,i=n.shift();i!=="internal/event"&&this.emit("internal/event",e,i,n,r);for(const s of this.filterHooks(this._hooks[i]||[],r))yield s.callback.apply(r,n)}async parallel(...e){await Promise.all(this.dispatch("emit",e))}emit(...e){Array.from(this.dispatch("emit",e))}async serial(...e){for await(const n of this.dispatch("serial",e))if(xs(n))return n}bail(...e){for(const n of this.dispatch("bail",e))if(xs(n))return n}register(e,n,r,i){const s=i.prepend?"unshift":"push";return n[s]({ctx:this.ctx,callback:r,...i}),this.ctx.state.collect(e,()=>this.unregister(n,r))}unregister(e,n){const r=e.findIndex(i=>i.callback===n);if(r>=0)return e.splice(r,1),!0}on(e,n,r){var a;typeof r!="object"&&(r={prepend:r}),this.ctx.scope.assertActive(),n=this.ctx.reflect.bind(n);const i=this.bail(this.ctx,"internal/listener",e,n,r);if(i)return i;const s=(a=this._hooks)[e]||(a[e]=[]),o=typeof e=="string"?`event <${e}>`:"event (Symbol)";return this.register(o,s,n,r)}once(e,n,r){const i=this.on(e,function(...s){return i(),n.apply(this,s)},r);return i}async start(){this.isActive=!0;const e=this._hooks.ready||[];for(;e.length;){const{ctx:n,callback:r}=e.shift();n.scope.ensure(async()=>r())}await this.flush()}async stop(){this.isActive=!1,this.ctx.scope.reset()}},ie(Vn,"Lifecycle"),Vn),Ad=Id,Ss=(Sn=class extends Error{constructor(e,n){super(n??Sn.Code[e]),this.code=e}},ie(Sn,"CordisError"),Sn);(t=>{t.Code={INACTIVE_EFFECT:"cannot create effect on inactive context"}})(Ss||(Ss={}));var Ma=(Yn=class{constructor(e,n){te(this,"uid");te(this,"ctx");te(this,"disposables",[]);te(this,"error");te(this,"status",0);te(this,"isActive",!1);te(this,"context");te(this,"proxy");te(this,"acceptors",[]);te(this,"tasks",new Set);te(this,"hasError",!1);this.parent=e,this.config=n,this.uid=e.registry?e.registry.counter:0,this.ctx=this.context=e.extend({scope:this}),this.proxy=new Proxy({},{get:ie((r,i)=>Reflect.get(this.config,i),"get")})}get _config(){return this.runtime.isReactive?this.proxy:this.config}assertActive(){if(!(this.uid!==null||this.isActive))throw new Ss("INACTIVE_EFFECT")}effect(e,n){this.assertActive();const r=ms(e)?new e(this.ctx,n):e(this.ctx,n);let i=!1;const s=typeof r=="function"?r:r.dispose.bind(r),o=ie((...a)=>{if(!i)return i=!0,Gt(this.disposables,o),s(...a)},"wrapped");return this.disposables.push(o),typeof r=="function"?o:(r.dispose=o,r)}collect(e,n){const r=He(()=>(Gt(this.disposables,r),n()),"name",e);return this.disposables.push(r),r}restart(){this.reset(),this.error=null,this.hasError=!1,this.status=0,this.start()}_getStatus(){return this.uid===null?4:this.hasError?3:this.tasks.size?1:this.ready?2:0}updateStatus(e){const n=this.status;e?.(),this.status=this._getStatus(),n!==this.status&&this.context.emit("internal/status",this,n)}ensure(e){const n=e().catch(r=>{this.context.emit(this.ctx,"internal/error",r),this.cancel(r)}).finally(()=>{this.updateStatus(()=>this.tasks.delete(n)),this.context.events._tasks.delete(n)});this.updateStatus(()=>this.tasks.add(n)),this.context.events._tasks.add(n)}cancel(e){this.error=e,this.updateStatus(()=>this.hasError=!0),this.reset()}get ready(){return Object.entries(this.runtime.inject).every(([e,n])=>!n.required||!$e(this.ctx.get(e)))}reset(){this.isActive=!1,this.disposables=this.disposables.splice(0).filter(e=>{if(this.uid!==null&&e[Ze.static]===this)return!0;(async()=>e())().catch(n=>{this.context.emit(this.ctx,"internal/error",n)})})}init(e){this.config?this.start():this.cancel(e)}start(){if(!this.ready||this.isActive||this.uid===null)return!0;this.isActive=!0,this.updateStatus(()=>this.hasError=!1)}accept(...e){const r={keys:Array.isArray(e[0])?e.shift():null,callback:e[0],...e[1]};return this.effect(()=>(this.acceptors.push(r),r.immediate&&r.callback?.(this.config),()=>Gt(this.acceptors,r)))}decline(e){return this.accept(e,()=>!0)}checkUpdate(e,n){if(n||!this.config)return[!0,!0];if(n===!1)return[!1,!1];const r=Object.create(null),i=ie(c=>{const u=r[c]??(r[c]=!dn(this.config[c],e[c]));return o||(o=u),u},"checkPropertyUpdate"),s=new Set;let o=!1,a=!1,l=this.runtime.isReactive||null;for(const{keys:c,callback:u,passive:f}of this.acceptors){if(!c)l||(l=!f);else if(f)c?.forEach(v=>s.add(v));else{let v=!1;for(const b of c)v||(v=i(b));if(!v)continue}u?.(e)&&(a=!0)}for(const c in{...this.config,...e})if(l!==!1&&!(c in r)&&!s.has(c)){const u=i(c);l===null&&(a||(a=u))}return[o,a]}},ie(Yn,"EffectScope"),Yn),Od=(Gn=class extends Ma{constructor(n,r,i,s){super(n,i);te(this,"dispose");this.runtime=r,this.dispose=He(n.scope.collect(`fork <${n.runtime.name}>`,()=>{this.uid=null,this.reset(),this.context.emit("internal/fork",this);const o=Gt(r.disposables,this.dispose);return Gt(r.children,this)&&!r.children.length&&n.registry.delete(r.plugin),o}),Ze.static,r),r.children.push(this),r.disposables.push(this.dispose),this.context.emit("internal/fork",this),this.init(s)}start(){if(super.start())return!0;for(const n of this.runtime.forkables)this.ensure(async()=>n(this.context,this._config))}update(n,r){const i=this.config,s=this.runtime.isForkable?this:this.runtime;if(s.config!==i)return;let o;try{o=or(this.runtime.plugin,n)}catch(c){return this.context.emit("internal/error",c),this.cancel(c)}const[a,l]=s.checkUpdate(o,r);this.context.emit("internal/before-update",this,n),this.config=o,s.config=o,a&&this.context.emit("internal/update",this,i),l&&s.restart()}},ie(Gn,"ForkScope"),Gn),ja=(Qn=class extends Ma{constructor(n,r,i,s){super(n,i);te(this,"value");te(this,"runtime",this);te(this,"schema");te(this,"name");te(this,"inject",Object.create(null));te(this,"forkables",[]);te(this,"children",[]);te(this,"isReusable",!1);te(this,"isReactive",!1);te(this,"apply",ie((n,r)=>{if(typeof this.plugin!="function")return this.plugin.apply(n,r);if(ms(this.plugin)){const i=new this.plugin(n,r),s=i[Ze.expose];return s&&n.set(s,i),i.fork&&this.forkables.push(i.fork.bind(i)),i}else return this.plugin(n,r)},"apply"));this.plugin=r,r?(this.setup(),this.init(s)):(this.name="root",this.isActive=!0)}get isForkable(){return this.forkables.length>0}fork(n,r,i){return new Od(n,this,r,i)}dispose(){return this.uid=null,this.reset(),this.context.emit("internal/runtime",this),!0}setup(){const{name:n}=this.plugin;n&&n!=="apply"&&(this.name=n),this.schema=this.plugin.Config||this.plugin.schema,this.inject=We.resolve(this.plugin.using||this.plugin.inject),this.isReusable=this.plugin.reusable,this.isReactive=this.plugin.reactive,this.context.emit("internal/runtime",this),this.isReusable&&this.forkables.push(this.apply)}reset(){super.reset();for(const n of this.children)n.reset()}start(){if(super.start())return!0;!this.isReusable&&this.plugin&&this.ensure(async()=>this.value=this.apply(this.ctx,this._config));for(const n of this.children)n.start()}update(n,r){if(this.isForkable){const c=new Error(`attempting to update forkable plugin "${this.plugin.name}", which may lead to unexpected behavior`);this.context.emit(this.ctx,"internal/warning",c)}const i=this.config;let s;try{s=or(this.runtime.plugin||this.context.constructor,n)}catch(c){return this.context.emit("internal/error",c),this.cancel(c)}const[o,a]=this.checkUpdate(s,r),l=this.children.find(c=>c.config===i);this.config=s,l&&(this.context.emit("internal/before-update",l,n),l.config=s,o&&this.context.emit("internal/update",l,i)),a&&this.restart()}},ie(Qn,"MainScope"),Qn);function Fa(t){return t&&typeof t=="object"&&typeof t.apply=="function"}ie(Fa,"isApplicable");function We(t){return function(e,n){if(n.kind==="class")e.inject=t;else if(n.kind==="method")n.addInitializer(function(){const r=this[Y.tracker]?.property;if(!r)throw new Error("missing context tracker");this[r].inject(t,i=>{e.call(ar(this,{[r]:i}))})});else throw new Error("@Inject can only be used on class or class methods")}}ie(We,"Inject"),(t=>{function e(n){if(!n)return{};if(Array.isArray(n))return Object.fromEntries(n.map(o=>[o,{required:!0}]));const{required:r,optional:i,...s}=n;return Array.isArray(r)&&Object.assign(s,Object.fromEntries(r.map(o=>[o,{required:!0}]))),Array.isArray(i)&&Object.assign(s,Object.fromEntries(i.map(o=>[o,{required:!1}]))),s}t.resolve=e,ie(e,"resolve")})(We||(We={}));var Rd=(Jn=class{constructor(e,n){te(this,"_counter",0);te(this,"_internal",new Map);te(this,"context");this.ctx=e,He(this,Y.tracker,{associate:"registry",property:"ctx"}),this.context=e;const r=new ja(e,null,n);e.scope=r,r.ctx=e,this.set(null,r)}get counter(){return++this._counter}get size(){return this._internal.size}resolve(e,n=!1){if(e===null||typeof e=="function")return e;if(Fa(e))return e.apply;if(n)throw new Error('invalid plugin, expect function or object with an "apply" method, received '+typeof e)}get(e){const n=this.resolve(e);return n&&this._internal.get(n)}has(e){const n=this.resolve(e);return!!n&&this._internal.has(n)}set(e,n){const r=this.resolve(e);this._internal.set(r,n)}delete(e){const n=this.resolve(e),r=n&&this._internal.get(n);if(r)return this._internal.delete(n),r.dispose(),r}keys(){return this._internal.keys()}values(){return this._internal.values()}entries(){return this._internal.entries()}forEach(e){return this._internal.forEach(e)}using(e,n){return this.inject(e,n)}inject(e,n){return this.plugin({inject:e,apply:n,name:n.name})}plugin(e,n,r){if(this.resolve(e,!0),this.ctx.scope.assertActive(),!r)try{n=or(e,n)}catch(s){this.context.emit(this.ctx,"internal/error",s),r=s,n=null}let i=this.get(e);return i?(i.isForkable||this.context.emit(this.ctx,"internal/warning",new Error(`duplicate plugin detected: ${e.name}`)),i.fork(this.ctx,n,r)):(i=new ja(this.ctx,e,n,r),this.set(e,i),i.fork(this.ctx,n,r))}},ie(Jn,"Registry"),Jn),Nd=Rd,Ze=(Oe=class{static is(e){return!!e?.[Oe.is]}static associate(e,n){return e}constructor(e){e=or(this.constructor,e),this[Y.store]=Object.create(null),this[Y.isolate]=Object.create(null),this[Y.internal]=Object.create(null),this[Y.intercept]=Object.create(null);const n=new Proxy(this,_s.handler);n.root=n,n.reflect=new _s(n),n.registry=new Nd(n,e),n.lifecycle=new Ad(n);const r=ie(i=>{if(i){r(Object.getPrototypeOf(i));for(const s of Object.getOwnPropertyNames(i)){const o=i[s].prototype?.constructor;o&&(n[i[s].key]=new o(n,e),He(n[i[s].key],"ctx",n))}}},"attach");return r(this[Y.internal]),n}[Symbol.for("nodejs.util.inspect.custom")](){return`Context <${this.name}>`}get name(){let e=this.runtime;for(;e&&!e.name;)e=e.parent.runtime;return e?.name}get events(){return this.lifecycle}get state(){return this.scope}extend(e={}){const n=Reflect.getOwnPropertyDescriptor(this,Y.shadow)?.value,r=Object.assign(Object.create(kt(this,this)),e);return n?Object.assign(Object.create(r),{[Y.shadow]:n}):r}isolate(e,n){const r=Object.create(this[Y.isolate]);return r[e]=n??Symbol(e),this.extend({[Y.isolate]:r})}intercept(e,n){const r=Object.create(this[Y.intercept]);return r[e]=n,this.extend({[Y.intercept]:r})}},ie(Oe,"Context"),te(Oe,"store",Y.store),te(Oe,"events",Y.events),te(Oe,"static",Y.static),te(Oe,"filter",Y.filter),te(Oe,"expose",Y.expose),te(Oe,"isolate",Y.isolate),te(Oe,"internal",Y.internal),te(Oe,"intercept",Y.intercept),te(Oe,"origin","ctx"),te(Oe,"current","ctx"),Oe.is[Symbol.toPrimitive]=()=>Symbol.for("cordis.is"),Oe.prototype[Oe.is]=!0,Oe);Ze.prototype[Ze.internal]=Object.create(null);var Jt=(ct=class{constructor(...e){te(this,"ctx");te(this,"name");te(this,"config");let n,r,i,s;Ze.is(e[0])?(n=e[0],typeof e[1]=="string"?(r=e[1],i=e[2]):s=e[1]):s=e[0],r??(r=this.constructor[Y.provide]),i??(i=this.constructor[Y.immediate]);let o=this;const a={associate:r,property:"ctx"};return o[Y.invoke]&&(o=ws(r,gs(Object.getPrototypeOf(this),Function.prototype),a)),n?o.ctx=n:o[Y.setup](),o.name=r,o.config=s,He(o,Y.tracker,a),o.ctx.provide(r),o.ctx.runtime.name=r,i&&(n?o[Y.expose]=r:o.ctx.set(r,o)),o.ctx.on("ready",async()=>{await Promise.resolve(),await o.start(),i||o.ctx.set(r,o)}),o.ctx.on("dispose",()=>o.stop()),o}start(){}stop(){}[Y.filter](e){return e[Y.isolate][this.name]===this.ctx[Y.isolate][this.name]}[Y.setup](){this.ctx=new Ze}[Y.extend](e){let n;return this[ct.invoke]?n=ws(this.name,this,this[Y.tracker]):n=Object.create(this),Object.assign(n,e)}static[Symbol.hasInstance](e){let n=e.constructor;for(;n;){if(n=n.prototype?.constructor,n===this)return!0;n=Object.getPrototypeOf(n)}return!1}},ie(ct,"Service"),te(ct,"setup",Y.setup),te(ct,"invoke",Y.invoke),te(ct,"extend",Y.extend),te(ct,"tracker",Y.tracker),te(ct,"provide",Y.provide),te(ct,"immediate",Y.immediate),ct),Dd=Object.defineProperty,Ld=Object.getOwnPropertyNames,ue=(t,e)=>Dd(t,"name",{value:e,configurable:!0}),Md=(t,e)=>function(){return e||(0,t[Ld(t)[0]])((e={exports:{}}).exports,e),e.exports},jd=Md({"src/index.ts"(t,e){var A;var n=Symbol.for("schemastery"),r=Symbol.for("ValidationError");globalThis.__schemastery_index__??(globalThis.__schemastery_index__=0);var i=(A=class extends TypeError{constructor(h,S){let T="$";for(const R of S.path||[])typeof R=="string"?T+="."+R:typeof R=="number"?T+="["+R+"]":typeof R=="symbol"&&(T+=`[Symbol(${R.toString()})]`);T.startsWith(".")&&(T=T.slice(1));super((T==="$"?"":`${T} `)+h);te(this,"name","ValidationError");this.options=S}static is(h){return!!h?.[r]}},ue(A,"ValidationError"),A);Object.defineProperty(i.prototype,r,{value:!0});var s=ue(function(y){const m=ue(function(h,S={}){return s.resolve(h,m,S)[0]},"schema");if(y.refs){const h=jt(y.refs,T=>new s(T)),S=ue(T=>h[T],"getRef");for(const T in h){const R=h[T];R.sKey=S(R.sKey),R.inner=S(R.inner),R.list=R.list&&R.list.map(S),R.dict=R.dict&&jt(R.dict,S)}return h[y.uid]}if(Object.assign(m,y),typeof m.callback=="string")try{m.callback=new Function("return "+m.callback)()}catch{}return Object.defineProperty(m,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(m,s.prototype),m.meta||(m.meta={}),m.toString=m.toString.bind(m),m},"Schema");s.prototype=Object.create(Function.prototype),s.prototype[n]=!0,s.ValidationError=i;var o;s.prototype.toJSON=ue(function(){var h;if(o)return o[h=this.uid]??(o[h]=JSON.parse(JSON.stringify({...this}))),this.uid;o={[this.uid]:{...this}},o[this.uid]=JSON.parse(JSON.stringify({...this}));const m={uid:this.uid,refs:o};return o=void 0,m},"toJSON"),s.prototype.set=ue(function(m,h){return this.dict[m]=h,this},"set"),s.prototype.push=ue(function(m){return this.list.push(m),this},"push");function a(y,m){const h=typeof y=="string"?{"":y}:{...y};for(const S in m){const T=m[S];T?.$description||T?.$desc?h[S]=T.$description||T.$desc:typeof T=="string"&&(h[S]=T)}return h}ue(a,"mergeDesc");function l(y){return y?.$value??y?.$inner}ue(l,"getInner");function c(y){return Ta(y??{},m=>!m.startsWith("$"))}ue(c,"extractKeys"),s.prototype.i18n=ue(function(m){const h=s(this),S=a(h.meta.description,m);return Object.keys(S).length&&(h.meta.description=S),h.dict&&(h.dict=jt(h.dict,(T,R)=>T.i18n(jt(m,H=>l(H)?.[R]??H?.[R])))),h.list&&(h.list=h.list.map((T,R)=>T.i18n(jt(m,(H={})=>Array.isArray(l(H))?l(H)[R]:Array.isArray(H)?H[R]:c(H))))),h.inner&&(h.inner=h.inner.i18n(jt(m,T=>l(T)?l(T):c(T)))),h.sKey&&(h.sKey=h.sKey.i18n(jt(m,T=>T?.$key))),h},"i18n"),s.prototype.extra=ue(function(m,h){const S=s(this);return S.meta={...S.meta,[m]:h},S},"extra");for(const y of["required","disabled","collapse","hidden","loose"])Object.assign(s.prototype,{[y](m=!0){const h=s(this);return h.meta={...h.meta,[y]:m},h}});s.prototype.deprecated=ue(function(){var h;const m=s(this);return(h=m.meta).badges||(h.badges=[]),m.meta.badges.push({text:"deprecated",type:"danger"}),m},"deprecated"),s.prototype.experimental=ue(function(){var h;const m=s(this);return(h=m.meta).badges||(h.badges=[]),m.meta.badges.push({text:"experimental",type:"warning"}),m},"experimental"),s.prototype.pattern=ue(function(m){const h=s(this),S=Ia(m,["source","flags"]);return h.meta={...h.meta,pattern:S},h},"pattern"),s.prototype.simplify=ue(function(m){if(dn(m,this.meta.default,this.type==="dict"))return null;if($e(m))return m;if(this.type==="object"||this.type==="dict"){const h={};for(const S in m){const R=(this.type==="object"?this.dict[S]:this.inner)?.simplify(m[S]);(this.type==="dict"||!$e(R))&&(h[S]=R)}return dn(h,this.meta.default,this.type==="dict")?null:h}else if(this.type==="array"||this.type==="tuple"){const h=[];return m.forEach((S,T)=>{const R=this.type==="array"?this.inner:this.list[T],H=R?R.simplify(S):S;h.push(H)}),h}else if(this.type==="intersect"){const h={};for(const S of this.list)Object.assign(h,S.simplify(m));return h}else if(this.type==="union")for(const h of this.list)try{return s.resolve(m,h,{}),h.simplify(m)}catch{}return m},"simplify"),s.prototype.toString=ue(function(m){return B[this.type]?.(this,m)??`Schema<${this.type}>`},"toString"),s.prototype.role=ue(function(y,m){const h=s(this);return h.meta={...h.meta,role:y,extra:m},h},"role");for(const y of["default","link","comment","description","max","min","step"])Object.assign(s.prototype,{[y](m){const h=s(this);return h.meta={...h.meta,[y]:m},h}});var u={};s.extend=ue(function(m,h){u[m]=h},"extend"),s.resolve=ue(function(m,h,S={},T=!1){if(!h)return[m];if(S.ignore?.(m,h))return[m];if($e(m)&&h.type!=="lazy"){if(h.meta.required)throw new i("missing required value",S);let H=h,X=h.meta.default;for(;H?.type==="intersect"&&$e(X);)H=H.list[0],X=H?.meta.default;if($e(X))return[m];m=Yr(X)}const R=u[h.type];if(!R)throw new i(`unsupported type "${h.type}"`,S);try{return R(m,h,S,T)}catch(H){if(!h.meta.loose)throw H;return[h.meta.default]}},"resolve"),s.from=ue(function(m){if($e(m))return s.any();if(["string","number","boolean"].includes(typeof m))return s.const(m).required();if(m[n])return m;if(typeof m=="function")switch(m){case String:return s.string().required();case Number:return s.number().required();case Boolean:return s.boolean().required();case Function:return s.function().required();default:return s.is(m).required()}else throw new TypeError(`cannot infer schema from ${m}`)},"from"),s.lazy=ue(function(m){const h=ue(()=>(S.inner[n]||(S.inner=S.builder(),S.inner.meta={...S.meta,...S.inner.meta}),S.inner.toJSON()),"toJSON"),S=new s({type:"lazy",builder:m,inner:{toJSON:h}});return S},"lazy"),s.natural=ue(function(){return s.number().step(1).min(0)},"natural"),s.percent=ue(function(){return s.number().step(.01).min(0).max(1).role("slider")},"percent"),s.date=ue(function(){return s.union([s.is(Date),s.transform(s.string().role("datetime"),(m,h)=>{const S=new Date(m);if(isNaN(+S))throw new i(`invalid date "${m}"`,h);return S},!0)])},"date"),s.regExp=ue(function(m=""){return s.union([s.is(RegExp),s.transform(s.string().role("regexp",{flag:m}),(h,S)=>{try{return new RegExp(h,m)}catch(T){throw new i(T.message,S)}},!0)])},"regExp"),s.arrayBuffer=ue(function(m){return s.union([s.is(ArrayBuffer),s.is(SharedArrayBuffer),s.transform(s.any(),(h,S)=>{if(Et.isSource(h))return Et.fromSource(h);throw new i(`expected ArrayBufferSource but got ${h}`,S)},!0),...m?[s.transform(s.string(),(h,S)=>{try{return m==="base64"?Et.fromBase64(h):Et.fromHex(h)}catch(T){throw new i(T.message,S)}},!0)]:[]])},"arrayBuffer"),s.extend("lazy",(y,m,h,S)=>(m.inner[n]||(m.inner=m.builder(),m.inner.meta={...m.meta,...m.inner.meta}),s.resolve(y,m.inner,h,S))),s.extend("any",y=>[y]),s.extend("never",(y,m,h)=>{throw new i(`expected nullable but got ${y}`,h)}),s.extend("const",(y,{value:m},h)=>{if(dn(y,m))return[m];throw new i(`expected ${m} but got ${y}`,h)});function f(y,m,h,S,T=!1){const{max:R=1/0,min:H=-1/0}=m;if(y>R)throw new i(`expected ${h} <= ${R} but got ${y}`,S);if(y<H&&!T)throw new i(`expected ${h} >= ${H} but got ${y}`,S)}ue(f,"checkWithinRange"),s.extend("string",(y,{meta:m},h)=>{if(typeof y!="string")throw new i(`expected string but got ${y}`,h);if(m.pattern){const S=new RegExp(m.pattern.source,m.pattern.flags);if(!S.test(y))throw new i(`expect string to match regexp ${S}`,h)}return f(y.length,m,"string length",h),[y]});function p(y,m){const h=y.toString();if(h.includes("e"))return y*Math.pow(10,m);const S=h.indexOf(".");if(S===-1)return y*Math.pow(10,m);const T=h.slice(S+1),R=h.slice(0,S);return T.length<=m?+(R+T.padEnd(m,"0")):+(R+T.slice(0,m)+"."+T.slice(m))}ue(p,"decimalShift");function v(y,m,h){if(h=Math.abs(h),!/^\d+\.\d+$/.test(h.toString()))return(y-m)%h===0;const S=h.toString().indexOf("."),T=h.toString().slice(S+1).length;return Math.abs(p(y,T)-p(m,T))%p(h,T)===0}ue(v,"isMultipleOf"),s.extend("number",(y,{meta:m},h)=>{if(typeof y!="number")throw new i(`expected number but got ${y}`,h);f(y,m,"number",h);const{step:S}=m;if(S&&!v(y,m.min??0,S))throw new i(`expected number multiple of ${S} but got ${y}`,h);return[y]}),s.extend("boolean",(y,m,h)=>{if(typeof y=="boolean")return[y];throw new i(`expected boolean but got ${y}`,h)}),s.extend("bitset",(y,{bits:m,meta:h},S)=>{let T=0,R=[];if(typeof y=="number"){T=y;for(const H in m)y&m[H]&&R.push(H)}else if(Array.isArray(y)){R=y;for(const H of R){if(typeof H!="string")throw new i(`expected string but got ${H}`,S);H in m&&(T|=m[H])}}else throw new i(`expected number or array but got ${y}`,S);return T===h.default?[T]:[T,R]}),s.extend("function",(y,m,h)=>{if(typeof y=="function")return[y];throw new i(`expected function but got ${y}`,h)}),s.extend("is",(y,{constructor:m},h)=>{if(typeof m=="function"){if(y instanceof m)return[y];throw new i(`expected ${m.name} but got ${y}`,h)}else{if($e(y))throw new i(`expected ${m} but got ${y}`,h);let S=Object.getPrototypeOf(y);for(;S;){if(S.constructor?.name===m)return[y];S=Object.getPrototypeOf(S)}throw new i(`expected ${m} but got ${y}`,h)}});function b(y,m,h,S){try{const[T,R]=s.resolve(y[m],h,{...S,path:[...S.path||[],m]});return R!==void 0&&(y[m]=R),T}catch(T){if(!S?.autofix)throw T;return delete y[m],h.meta.default}}ue(b,"property"),s.extend("array",(y,{inner:m,meta:h},S)=>{if(!Array.isArray(y))throw new i(`expected array but got ${y}`,S);return f(y.length,h,"array length",S,!$e(m.meta.default)),[y.map((T,R)=>b(y,R,m,S))]}),s.extend("dict",(y,{inner:m,sKey:h},S,T)=>{if(!Vr(y))throw new i(`expected object but got ${y}`,S);const R={};for(const H in y){let X;try{X=s.resolve(H,h,S)[0]}catch(Te){if(T)continue;throw Te}R[X]=b(y,H,m,S),y[X]=y[H],H!==X&&delete y[H]}return[R]}),s.extend("tuple",(y,{list:m},h,S)=>{if(!Array.isArray(y))throw new i(`expected array but got ${y}`,h);const T=m.map((R,H)=>b(y,H,R,h));return S?[T]:(T.push(...y.slice(m.length)),[T])});function I(y,m){for(const h in m)h in y||(y[h]=m[h])}ue(I,"merge"),s.extend("object",(y,{dict:m},h,S)=>{if(!Vr(y))throw new i(`expected object but got ${y}`,h);const T={};for(const R in m){const H=b(y,R,m[R],h);(!$e(H)||R in y)&&(T[R]=H)}return S||I(T,y),[T]}),s.extend("union",(y,{list:m,toString:h},S,T)=>{for(const R of m)try{return s.resolve(y,R,S,T)}catch{}throw new i(`expected ${h()} but got ${JSON.stringify(y)}`,S)}),s.extend("intersect",(y,{list:m,toString:h},S,T)=>{if(!m.length)return[y];let R;for(const H of m){const X=s.resolve(y,H,S,!0)[0];if(!$e(X))if($e(R))R=X;else{if(typeof R!=typeof X)throw new i(`expected ${h()} but got ${JSON.stringify(y)}`,S);if(typeof X=="object")I(R??(R={}),X);else if(R!==X)throw new i(`expected ${h()} but got ${JSON.stringify(y)}`,S)}}return!T&&Vr(y)&&I(R,y),[R]}),s.extend("transform",(y,{inner:m,callback:h,preserve:S},T)=>{const[R,H=y]=s.resolve(y,m,T,!0);return S?[h(R)]:[h(R),h(H)]});var B={};function D(y,m,h){B[y]=h,Object.assign(s,{[y](...S){const T=new s({type:y});return m.forEach((R,H)=>{switch(R){case"sKey":T.sKey=S[H]??s.string();break;case"inner":T.inner=s.from(S[H]);break;case"list":T.list=S[H].map(s.from);break;case"dict":T.dict=jt(S[H],s.from);break;case"bits":{T.bits={};for(const X in S[H])typeof S[H][X]=="number"&&(T.bits[X]=S[H][X]);break}case"callback":{const X=T.callback=S[H];X.toJSON||(X.toJSON=()=>X.toString());break}case"constructor":{const X=T.constructor=S[H];typeof X=="function"&&(X.toJSON||(X.toJSON=()=>X.name));break}default:T[R]=S[H]}}),y==="object"||y==="dict"?T.meta.default={}:y==="array"||y==="tuple"?T.meta.default=[]:y==="bitset"&&(T.meta.default=0),T}})}ue(D,"defineMethod"),D("is",["constructor"],({constructor:y})=>typeof y=="function"?y.name:y),D("any",[],()=>"any"),D("never",[],()=>"never"),D("const",["value"],({value:y})=>typeof y=="string"?JSON.stringify(y):y),D("string",[],()=>"string"),D("number",[],()=>"number"),D("boolean",[],()=>"boolean"),D("bitset",["bits"],()=>"bitset"),D("function",[],()=>"function"),D("array",["inner"],({inner:y})=>`${y.toString(!0)}[]`),D("dict",["inner","sKey"],({inner:y,sKey:m})=>`{ [key: ${m.toString()}]: ${y.toString()} }`),D("tuple",["list"],({list:y})=>`[${y.map(m=>m.toString()).join(", ")}]`),D("object",["dict"],({dict:y})=>Object.keys(y).length===0?"{}":`{ ${Object.entries(y).map(([m,h])=>`${m}${h.meta.required?"":"?"}: ${h.toString()}`).join(", ")} }`),D("union",["list"],({list:y},m)=>{const h=y.map(({toString:S})=>S()).join(" | ");return m?`(${h})`:h}),D("intersect",["list"],({list:y})=>`${y.map(m=>m.toString(!0)).join(" & ")}`),D("transform",["inner","callback","preserve"],({inner:y},m)=>y.toString(m)),e.exports=s}});const fe=jd();/**
3
+ `),e.emit(e,"internal/warning",r)}get(e){if(this.ctx[Y.internal][e]?.type!=="service")return;const r=this.ctx[Y.isolate][e],i=this.ctx[Y.store][r]?.value;return kt(this.ctx,i)}set(e,n){this.provide(e);const r=this.ctx[Y.isolate][e],i=this.ctx[Y.store][r]?.value;n??(n=void 0);let s=ie(()=>{},"dispose");if(i===n)return s;if(!$e(n)&&!$e(i))throw new Error(`service ${e} has been registered`);const o=this.ctx;$e(n)||(s=o.effect(()=>()=>{o.set(e,void 0)})),Da(n)&&o.emit(o,"internal/warning",new Error(`service ${e} is an unproxyable object, which may lead to unexpected behavior`));const a=Object.create(o);return a[Y.filter]=l=>o[Y.isolate][e]===l[Y.isolate][e],o.emit(a,"internal/before-service",e,n),o[Y.store][r]={value:n,source:o},o.emit(a,"internal/service",e,i),s}provide(e,n,r){const i=this.ctx.root[Y.internal];if(e in i)return;const s=Symbol(e);i[e]={type:"service",builtin:r},this.ctx.root[Y.isolate][e]=s,ys(n)&&(this.ctx[Y.store][s]={value:n,source:null},He(n,Y.tracker,{associate:e,property:"ctx"}))}_accessor(e,n){const r=this.ctx.root[Y.internal];return e in r?()=>{}:(r[e]={type:"accessor",...n},()=>delete this.ctx.root[Y.isolate][e])}accessor(e,n){this.ctx.scope.effect(()=>this._accessor(e,n))}alias(e,n){const r=this.ctx.root[Y.internal];if(!(e in r))for(const i of n)r[i]||(r[i]={type:"alias",name:e})}_mixin(e,n){const r=Array.isArray(n)?n.map(o=>[o,o]):Object.entries(n),i=typeof e=="string"?o=>o[e]:()=>e,s=r.map(([o,a])=>this._accessor(a,{get(l){const c=i(this);if($e(c))return c;const u=l?ar(l,c):c,f=Reflect.get(c,o,u);return typeof f!="function"?f:f.bind(u??c)},set(l,c){const u=i(this),f=c?ar(c,u):u;return Reflect.set(u,o,l,f)}}));return()=>s.forEach(o=>o())}mixin(e,n){this.ctx.scope.effect(()=>this._mixin(e,n))}trace(e){return kt(this.ctx,e)}bind(e){return new Proxy(e,{apply:ie((n,r,i)=>n.apply(this.trace(r),i.map(s=>this.trace(s))),"apply")})}},ie(gt,"ReflectService"),te(gt,"handler",{get:ie((e,n,r)=>{if(typeof n!="string")return Reflect.get(e,n,r);if(Reflect.has(e,n))return kt(r,Reflect.get(e,n,r),!0);const[i,s]=gt.resolveInject(e,n),o=new Error(`property ${i} is not registered, declare it as \`inject\` to suppress this warning`);return s?s.type==="accessor"?s.get.call(r,r[Y.receiver]):(s.builtin||gt.checkInject(r,i,o),r.reflect.get(i)):(gt.checkInject(r,i,o),Reflect.get(e,i,r))},"get"),set:ie((e,n,r,i)=>{if(typeof n!="string")return Reflect.set(e,n,r,i);const[s,o]=gt.resolveInject(e,n);return o?o.type==="accessor"?o.set?o.set.call(i,r,i[Y.receiver]):!1:(i.reflect.set(s,r),!0):Reflect.set(e,s,r,i)},"set"),has:ie((e,n)=>{if(typeof n!="string")return Reflect.has(e,n);if(Reflect.has(e,n))return!0;const[,r]=gt.resolveInject(e,n);return!!r},"has")}),gt),xs=Td;function Ss(t){return t!==null&&t!==!1&&t!==void 0}ie(Ss,"isBailed");var Id=(Vn=class{constructor(e){te(this,"isActive",!1);te(this,"_tasks",new Set);te(this,"_hooks",{});this.ctx=e,He(this,Y.tracker,{associate:"lifecycle",property:"ctx"}),He(this.on("internal/listener",function(r,i,s){const o=s.prepend?"unshift":"push";if(r==="ready")return this.lifecycle.isActive?(this.scope.ensure(async()=>i()),()=>!1):void 0;if(r==="dispose")return this.scope.disposables[o](i),He(i,"name","event <dispose>"),()=>Gt(this.scope.disposables,i);if(r==="fork")return this.scope.runtime.forkables[o](i),this.scope.collect("event <fork>",()=>Gt(this.scope.runtime.forkables,i))}),Ze.static,e.scope);for(const r of["info","error","warning"])He(this.on(`internal/${r}`,(i,...s)=>{this._hooks[`internal/${r}`].length>1}),Ze.static,e.scope);He(this.on("internal/before-service",function(r){for(const i of this.registry.values()){if(!i.inject[r]?.required)continue;const s=i.isReusable?i.children:[i];for(const o of s)this[Y.filter](o.ctx)&&(o.updateStatus(),o.reset())}},{global:!0}),Ze.static,e.scope),He(this.on("internal/service",function(r){for(const i of this.registry.values()){if(!i.inject[r]?.required)continue;const s=i.isReusable?i.children:[i];for(const o of s)this[Y.filter](o.ctx)&&o.start()}},{global:!0}),Ze.static,e.scope);const n=ie((r,i)=>{if(!r.runtime.plugin)return!1;for(const s in r.runtime.inject)if(i===xs.resolveInject(r.ctx,s)[0])return!0;return n(r.parent.scope,i)},"checkInject");He(this.on("internal/inject",function(r){return n(this.scope,r)},{global:!0}),Ze.static,e.scope)}async flush(){for(;this._tasks.size;)await Promise.all(Array.from(this._tasks))}filterHooks(e,n){return n=kt(this.ctx,n),e.slice().filter(r=>{const i=n?.[Ze.filter];return r.global||!i||i.call(n,r.ctx)})}*dispatch(e,n){const r=typeof n[0]=="object"||typeof n[0]=="function"?n.shift():null,i=n.shift();i!=="internal/event"&&this.emit("internal/event",e,i,n,r);for(const s of this.filterHooks(this._hooks[i]||[],r))yield s.callback.apply(r,n)}async parallel(...e){await Promise.all(this.dispatch("emit",e))}emit(...e){Array.from(this.dispatch("emit",e))}async serial(...e){for await(const n of this.dispatch("serial",e))if(Ss(n))return n}bail(...e){for(const n of this.dispatch("bail",e))if(Ss(n))return n}register(e,n,r,i){const s=i.prepend?"unshift":"push";return n[s]({ctx:this.ctx,callback:r,...i}),this.ctx.state.collect(e,()=>this.unregister(n,r))}unregister(e,n){const r=e.findIndex(i=>i.callback===n);if(r>=0)return e.splice(r,1),!0}on(e,n,r){var a;typeof r!="object"&&(r={prepend:r}),this.ctx.scope.assertActive(),n=this.ctx.reflect.bind(n);const i=this.bail(this.ctx,"internal/listener",e,n,r);if(i)return i;const s=(a=this._hooks)[e]||(a[e]=[]),o=typeof e=="string"?`event <${e}>`:"event (Symbol)";return this.register(o,s,n,r)}once(e,n,r){const i=this.on(e,function(...s){return i(),n.apply(this,s)},r);return i}async start(){this.isActive=!0;const e=this._hooks.ready||[];for(;e.length;){const{ctx:n,callback:r}=e.shift();n.scope.ensure(async()=>r())}await this.flush()}async stop(){this.isActive=!1,this.ctx.scope.reset()}},ie(Vn,"Lifecycle"),Vn),Od=Id,Es=(Sn=class extends Error{constructor(e,n){super(n??Sn.Code[e]),this.code=e}},ie(Sn,"CordisError"),Sn);(t=>{t.Code={INACTIVE_EFFECT:"cannot create effect on inactive context"}})(Es||(Es={}));var Ma=(Yn=class{constructor(e,n){te(this,"uid");te(this,"ctx");te(this,"disposables",[]);te(this,"error");te(this,"status",0);te(this,"isActive",!1);te(this,"context");te(this,"proxy");te(this,"acceptors",[]);te(this,"tasks",new Set);te(this,"hasError",!1);this.parent=e,this.config=n,this.uid=e.registry?e.registry.counter:0,this.ctx=this.context=e.extend({scope:this}),this.proxy=new Proxy({},{get:ie((r,i)=>Reflect.get(this.config,i),"get")})}get _config(){return this.runtime.isReactive?this.proxy:this.config}assertActive(){if(!(this.uid!==null||this.isActive))throw new Es("INACTIVE_EFFECT")}effect(e,n){this.assertActive();const r=gs(e)?new e(this.ctx,n):e(this.ctx,n);let i=!1;const s=typeof r=="function"?r:r.dispose.bind(r),o=ie((...a)=>{if(!i)return i=!0,Gt(this.disposables,o),s(...a)},"wrapped");return this.disposables.push(o),typeof r=="function"?o:(r.dispose=o,r)}collect(e,n){const r=He(()=>(Gt(this.disposables,r),n()),"name",e);return this.disposables.push(r),r}restart(){this.reset(),this.error=null,this.hasError=!1,this.status=0,this.start()}_getStatus(){return this.uid===null?4:this.hasError?3:this.tasks.size?1:this.ready?2:0}updateStatus(e){const n=this.status;e?.(),this.status=this._getStatus(),n!==this.status&&this.context.emit("internal/status",this,n)}ensure(e){const n=e().catch(r=>{this.context.emit(this.ctx,"internal/error",r),this.cancel(r)}).finally(()=>{this.updateStatus(()=>this.tasks.delete(n)),this.context.events._tasks.delete(n)});this.updateStatus(()=>this.tasks.add(n)),this.context.events._tasks.add(n)}cancel(e){this.error=e,this.updateStatus(()=>this.hasError=!0),this.reset()}get ready(){return Object.entries(this.runtime.inject).every(([e,n])=>!n.required||!$e(this.ctx.get(e)))}reset(){this.isActive=!1,this.disposables=this.disposables.splice(0).filter(e=>{if(this.uid!==null&&e[Ze.static]===this)return!0;(async()=>e())().catch(n=>{this.context.emit(this.ctx,"internal/error",n)})})}init(e){this.config?this.start():this.cancel(e)}start(){if(!this.ready||this.isActive||this.uid===null)return!0;this.isActive=!0,this.updateStatus(()=>this.hasError=!1)}accept(...e){const r={keys:Array.isArray(e[0])?e.shift():null,callback:e[0],...e[1]};return this.effect(()=>(this.acceptors.push(r),r.immediate&&r.callback?.(this.config),()=>Gt(this.acceptors,r)))}decline(e){return this.accept(e,()=>!0)}checkUpdate(e,n){if(n||!this.config)return[!0,!0];if(n===!1)return[!1,!1];const r=Object.create(null),i=ie(c=>{const u=r[c]??(r[c]=!dn(this.config[c],e[c]));return o||(o=u),u},"checkPropertyUpdate"),s=new Set;let o=!1,a=!1,l=this.runtime.isReactive||null;for(const{keys:c,callback:u,passive:f}of this.acceptors){if(!c)l||(l=!f);else if(f)c?.forEach(v=>s.add(v));else{let v=!1;for(const b of c)v||(v=i(b));if(!v)continue}u?.(e)&&(a=!0)}for(const c in{...this.config,...e})if(l!==!1&&!(c in r)&&!s.has(c)){const u=i(c);l===null&&(a||(a=u))}return[o,a]}},ie(Yn,"EffectScope"),Yn),Ad=(Gn=class extends Ma{constructor(n,r,i,s){super(n,i);te(this,"dispose");this.runtime=r,this.dispose=He(n.scope.collect(`fork <${n.runtime.name}>`,()=>{this.uid=null,this.reset(),this.context.emit("internal/fork",this);const o=Gt(r.disposables,this.dispose);return Gt(r.children,this)&&!r.children.length&&n.registry.delete(r.plugin),o}),Ze.static,r),r.children.push(this),r.disposables.push(this.dispose),this.context.emit("internal/fork",this),this.init(s)}start(){if(super.start())return!0;for(const n of this.runtime.forkables)this.ensure(async()=>n(this.context,this._config))}update(n,r){const i=this.config,s=this.runtime.isForkable?this:this.runtime;if(s.config!==i)return;let o;try{o=or(this.runtime.plugin,n)}catch(c){return this.context.emit("internal/error",c),this.cancel(c)}const[a,l]=s.checkUpdate(o,r);this.context.emit("internal/before-update",this,n),this.config=o,s.config=o,a&&this.context.emit("internal/update",this,i),l&&s.restart()}},ie(Gn,"ForkScope"),Gn),ja=(Qn=class extends Ma{constructor(n,r,i,s){super(n,i);te(this,"value");te(this,"runtime",this);te(this,"schema");te(this,"name");te(this,"inject",Object.create(null));te(this,"forkables",[]);te(this,"children",[]);te(this,"isReusable",!1);te(this,"isReactive",!1);te(this,"apply",ie((n,r)=>{if(typeof this.plugin!="function")return this.plugin.apply(n,r);if(gs(this.plugin)){const i=new this.plugin(n,r),s=i[Ze.expose];return s&&n.set(s,i),i.fork&&this.forkables.push(i.fork.bind(i)),i}else return this.plugin(n,r)},"apply"));this.plugin=r,r?(this.setup(),this.init(s)):(this.name="root",this.isActive=!0)}get isForkable(){return this.forkables.length>0}fork(n,r,i){return new Ad(n,this,r,i)}dispose(){return this.uid=null,this.reset(),this.context.emit("internal/runtime",this),!0}setup(){const{name:n}=this.plugin;n&&n!=="apply"&&(this.name=n),this.schema=this.plugin.Config||this.plugin.schema,this.inject=We.resolve(this.plugin.using||this.plugin.inject),this.isReusable=this.plugin.reusable,this.isReactive=this.plugin.reactive,this.context.emit("internal/runtime",this),this.isReusable&&this.forkables.push(this.apply)}reset(){super.reset();for(const n of this.children)n.reset()}start(){if(super.start())return!0;!this.isReusable&&this.plugin&&this.ensure(async()=>this.value=this.apply(this.ctx,this._config));for(const n of this.children)n.start()}update(n,r){if(this.isForkable){const c=new Error(`attempting to update forkable plugin "${this.plugin.name}", which may lead to unexpected behavior`);this.context.emit(this.ctx,"internal/warning",c)}const i=this.config;let s;try{s=or(this.runtime.plugin||this.context.constructor,n)}catch(c){return this.context.emit("internal/error",c),this.cancel(c)}const[o,a]=this.checkUpdate(s,r),l=this.children.find(c=>c.config===i);this.config=s,l&&(this.context.emit("internal/before-update",l,n),l.config=s,o&&this.context.emit("internal/update",l,i)),a&&this.restart()}},ie(Qn,"MainScope"),Qn);function Fa(t){return t&&typeof t=="object"&&typeof t.apply=="function"}ie(Fa,"isApplicable");function We(t){return function(e,n){if(n.kind==="class")e.inject=t;else if(n.kind==="method")n.addInitializer(function(){const r=this[Y.tracker]?.property;if(!r)throw new Error("missing context tracker");this[r].inject(t,i=>{e.call(ar(this,{[r]:i}))})});else throw new Error("@Inject can only be used on class or class methods")}}ie(We,"Inject"),(t=>{function e(n){if(!n)return{};if(Array.isArray(n))return Object.fromEntries(n.map(o=>[o,{required:!0}]));const{required:r,optional:i,...s}=n;return Array.isArray(r)&&Object.assign(s,Object.fromEntries(r.map(o=>[o,{required:!0}]))),Array.isArray(i)&&Object.assign(s,Object.fromEntries(i.map(o=>[o,{required:!1}]))),s}t.resolve=e,ie(e,"resolve")})(We||(We={}));var Rd=(Jn=class{constructor(e,n){te(this,"_counter",0);te(this,"_internal",new Map);te(this,"context");this.ctx=e,He(this,Y.tracker,{associate:"registry",property:"ctx"}),this.context=e;const r=new ja(e,null,n);e.scope=r,r.ctx=e,this.set(null,r)}get counter(){return++this._counter}get size(){return this._internal.size}resolve(e,n=!1){if(e===null||typeof e=="function")return e;if(Fa(e))return e.apply;if(n)throw new Error('invalid plugin, expect function or object with an "apply" method, received '+typeof e)}get(e){const n=this.resolve(e);return n&&this._internal.get(n)}has(e){const n=this.resolve(e);return!!n&&this._internal.has(n)}set(e,n){const r=this.resolve(e);this._internal.set(r,n)}delete(e){const n=this.resolve(e),r=n&&this._internal.get(n);if(r)return this._internal.delete(n),r.dispose(),r}keys(){return this._internal.keys()}values(){return this._internal.values()}entries(){return this._internal.entries()}forEach(e){return this._internal.forEach(e)}using(e,n){return this.inject(e,n)}inject(e,n){return this.plugin({inject:e,apply:n,name:n.name})}plugin(e,n,r){if(this.resolve(e,!0),this.ctx.scope.assertActive(),!r)try{n=or(e,n)}catch(s){this.context.emit(this.ctx,"internal/error",s),r=s,n=null}let i=this.get(e);return i?(i.isForkable||this.context.emit(this.ctx,"internal/warning",new Error(`duplicate plugin detected: ${e.name}`)),i.fork(this.ctx,n,r)):(i=new ja(this.ctx,e,n,r),this.set(e,i),i.fork(this.ctx,n,r))}},ie(Jn,"Registry"),Jn),Nd=Rd,Ze=(Ae=class{static is(e){return!!e?.[Ae.is]}static associate(e,n){return e}constructor(e){e=or(this.constructor,e),this[Y.store]=Object.create(null),this[Y.isolate]=Object.create(null),this[Y.internal]=Object.create(null),this[Y.intercept]=Object.create(null);const n=new Proxy(this,xs.handler);n.root=n,n.reflect=new xs(n),n.registry=new Nd(n,e),n.lifecycle=new Od(n);const r=ie(i=>{if(i){r(Object.getPrototypeOf(i));for(const s of Object.getOwnPropertyNames(i)){const o=i[s].prototype?.constructor;o&&(n[i[s].key]=new o(n,e),He(n[i[s].key],"ctx",n))}}},"attach");return r(this[Y.internal]),n}[Symbol.for("nodejs.util.inspect.custom")](){return`Context <${this.name}>`}get name(){let e=this.runtime;for(;e&&!e.name;)e=e.parent.runtime;return e?.name}get events(){return this.lifecycle}get state(){return this.scope}extend(e={}){const n=Reflect.getOwnPropertyDescriptor(this,Y.shadow)?.value,r=Object.assign(Object.create(kt(this,this)),e);return n?Object.assign(Object.create(r),{[Y.shadow]:n}):r}isolate(e,n){const r=Object.create(this[Y.isolate]);return r[e]=n??Symbol(e),this.extend({[Y.isolate]:r})}intercept(e,n){const r=Object.create(this[Y.intercept]);return r[e]=n,this.extend({[Y.intercept]:r})}},ie(Ae,"Context"),te(Ae,"store",Y.store),te(Ae,"events",Y.events),te(Ae,"static",Y.static),te(Ae,"filter",Y.filter),te(Ae,"expose",Y.expose),te(Ae,"isolate",Y.isolate),te(Ae,"internal",Y.internal),te(Ae,"intercept",Y.intercept),te(Ae,"origin","ctx"),te(Ae,"current","ctx"),Ae.is[Symbol.toPrimitive]=()=>Symbol.for("cordis.is"),Ae.prototype[Ae.is]=!0,Ae);Ze.prototype[Ze.internal]=Object.create(null);var Jt=(ct=class{constructor(...e){te(this,"ctx");te(this,"name");te(this,"config");let n,r,i,s;Ze.is(e[0])?(n=e[0],typeof e[1]=="string"?(r=e[1],i=e[2]):s=e[1]):s=e[0],r??(r=this.constructor[Y.provide]),i??(i=this.constructor[Y.immediate]);let o=this;const a={associate:r,property:"ctx"};return o[Y.invoke]&&(o=_s(r,vs(Object.getPrototypeOf(this),Function.prototype),a)),n?o.ctx=n:o[Y.setup](),o.name=r,o.config=s,He(o,Y.tracker,a),o.ctx.provide(r),o.ctx.runtime.name=r,i&&(n?o[Y.expose]=r:o.ctx.set(r,o)),o.ctx.on("ready",async()=>{await Promise.resolve(),await o.start(),i||o.ctx.set(r,o)}),o.ctx.on("dispose",()=>o.stop()),o}start(){}stop(){}[Y.filter](e){return e[Y.isolate][this.name]===this.ctx[Y.isolate][this.name]}[Y.setup](){this.ctx=new Ze}[Y.extend](e){let n;return this[ct.invoke]?n=_s(this.name,this,this[Y.tracker]):n=Object.create(this),Object.assign(n,e)}static[Symbol.hasInstance](e){let n=e.constructor;for(;n;){if(n=n.prototype?.constructor,n===this)return!0;n=Object.getPrototypeOf(n)}return!1}},ie(ct,"Service"),te(ct,"setup",Y.setup),te(ct,"invoke",Y.invoke),te(ct,"extend",Y.extend),te(ct,"tracker",Y.tracker),te(ct,"provide",Y.provide),te(ct,"immediate",Y.immediate),ct),Dd=Object.defineProperty,Ld=Object.getOwnPropertyNames,ue=(t,e)=>Dd(t,"name",{value:e,configurable:!0}),Md=(t,e)=>function(){return e||(0,t[Ld(t)[0]])((e={exports:{}}).exports,e),e.exports},jd=Md({"src/index.ts"(t,e){var A;var n=Symbol.for("schemastery"),r=Symbol.for("ValidationError");globalThis.__schemastery_index__??(globalThis.__schemastery_index__=0);var i=(A=class extends TypeError{constructor(h,S){let T="$";for(const N of S.path||[])typeof N=="string"?T+="."+N:typeof N=="number"?T+="["+N+"]":typeof N=="symbol"&&(T+=`[Symbol(${N.toString()})]`);T.startsWith(".")&&(T=T.slice(1));super((T==="$"?"":`${T} `)+h);te(this,"name","ValidationError");this.options=S}static is(h){return!!h?.[r]}},ue(A,"ValidationError"),A);Object.defineProperty(i.prototype,r,{value:!0});var s=ue(function(g){const p=ue(function(h,S={}){return s.resolve(h,p,S)[0]},"schema");if(g.refs){const h=jt(g.refs,T=>new s(T)),S=ue(T=>h[T],"getRef");for(const T in h){const N=h[T];N.sKey=S(N.sKey),N.inner=S(N.inner),N.list=N.list&&N.list.map(S),N.dict=N.dict&&jt(N.dict,S)}return h[g.uid]}if(Object.assign(p,g),typeof p.callback=="string")try{p.callback=new Function("return "+p.callback)()}catch{}return Object.defineProperty(p,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(p,s.prototype),p.meta||(p.meta={}),p.toString=p.toString.bind(p),p},"Schema");s.prototype=Object.create(Function.prototype),s.prototype[n]=!0,s.ValidationError=i;var o;s.prototype.toJSON=ue(function(){var h;if(o)return o[h=this.uid]??(o[h]=JSON.parse(JSON.stringify({...this}))),this.uid;o={[this.uid]:{...this}},o[this.uid]=JSON.parse(JSON.stringify({...this}));const p={uid:this.uid,refs:o};return o=void 0,p},"toJSON"),s.prototype.set=ue(function(p,h){return this.dict[p]=h,this},"set"),s.prototype.push=ue(function(p){return this.list.push(p),this},"push");function a(g,p){const h=typeof g=="string"?{"":g}:{...g};for(const S in p){const T=p[S];T?.$description||T?.$desc?h[S]=T.$description||T.$desc:typeof T=="string"&&(h[S]=T)}return h}ue(a,"mergeDesc");function l(g){return g?.$value??g?.$inner}ue(l,"getInner");function c(g){return Ta(g??{},p=>!p.startsWith("$"))}ue(c,"extractKeys"),s.prototype.i18n=ue(function(p){const h=s(this),S=a(h.meta.description,p);return Object.keys(S).length&&(h.meta.description=S),h.dict&&(h.dict=jt(h.dict,(T,N)=>T.i18n(jt(p,H=>l(H)?.[N]??H?.[N])))),h.list&&(h.list=h.list.map((T,N)=>T.i18n(jt(p,(H={})=>Array.isArray(l(H))?l(H)[N]:Array.isArray(H)?H[N]:c(H))))),h.inner&&(h.inner=h.inner.i18n(jt(p,T=>l(T)?l(T):c(T)))),h.sKey&&(h.sKey=h.sKey.i18n(jt(p,T=>T?.$key))),h},"i18n"),s.prototype.extra=ue(function(p,h){const S=s(this);return S.meta={...S.meta,[p]:h},S},"extra");for(const g of["required","disabled","collapse","hidden","loose"])Object.assign(s.prototype,{[g](p=!0){const h=s(this);return h.meta={...h.meta,[g]:p},h}});s.prototype.deprecated=ue(function(){var h;const p=s(this);return(h=p.meta).badges||(h.badges=[]),p.meta.badges.push({text:"deprecated",type:"danger"}),p},"deprecated"),s.prototype.experimental=ue(function(){var h;const p=s(this);return(h=p.meta).badges||(h.badges=[]),p.meta.badges.push({text:"experimental",type:"warning"}),p},"experimental"),s.prototype.pattern=ue(function(p){const h=s(this),S=Ia(p,["source","flags"]);return h.meta={...h.meta,pattern:S},h},"pattern"),s.prototype.simplify=ue(function(p){if(dn(p,this.meta.default,this.type==="dict"))return null;if($e(p))return p;if(this.type==="object"||this.type==="dict"){const h={};for(const S in p){const N=(this.type==="object"?this.dict[S]:this.inner)?.simplify(p[S]);(this.type==="dict"||!$e(N))&&(h[S]=N)}return dn(h,this.meta.default,this.type==="dict")?null:h}else if(this.type==="array"||this.type==="tuple"){const h=[];return p.forEach((S,T)=>{const N=this.type==="array"?this.inner:this.list[T],H=N?N.simplify(S):S;h.push(H)}),h}else if(this.type==="intersect"){const h={};for(const S of this.list)Object.assign(h,S.simplify(p));return h}else if(this.type==="union")for(const h of this.list)try{return s.resolve(p,h,{}),h.simplify(p)}catch{}return p},"simplify"),s.prototype.toString=ue(function(p){return F[this.type]?.(this,p)??`Schema<${this.type}>`},"toString"),s.prototype.role=ue(function(g,p){const h=s(this);return h.meta={...h.meta,role:g,extra:p},h},"role");for(const g of["default","link","comment","description","max","min","step"])Object.assign(s.prototype,{[g](p){const h=s(this);return h.meta={...h.meta,[g]:p},h}});var u={};s.extend=ue(function(p,h){u[p]=h},"extend"),s.resolve=ue(function(p,h,S={},T=!1){if(!h)return[p];if(S.ignore?.(p,h))return[p];if($e(p)&&h.type!=="lazy"){if(h.meta.required)throw new i("missing required value",S);let H=h,X=h.meta.default;for(;H?.type==="intersect"&&$e(X);)H=H.list[0],X=H?.meta.default;if($e(X))return[p];p=Yr(X)}const N=u[h.type];if(!N)throw new i(`unsupported type "${h.type}"`,S);try{return N(p,h,S,T)}catch(H){if(!h.meta.loose)throw H;return[h.meta.default]}},"resolve"),s.from=ue(function(p){if($e(p))return s.any();if(["string","number","boolean"].includes(typeof p))return s.const(p).required();if(p[n])return p;if(typeof p=="function")switch(p){case String:return s.string().required();case Number:return s.number().required();case Boolean:return s.boolean().required();case Function:return s.function().required();default:return s.is(p).required()}else throw new TypeError(`cannot infer schema from ${p}`)},"from"),s.lazy=ue(function(p){const h=ue(()=>(S.inner[n]||(S.inner=S.builder(),S.inner.meta={...S.meta,...S.inner.meta}),S.inner.toJSON()),"toJSON"),S=new s({type:"lazy",builder:p,inner:{toJSON:h}});return S},"lazy"),s.natural=ue(function(){return s.number().step(1).min(0)},"natural"),s.percent=ue(function(){return s.number().step(.01).min(0).max(1).role("slider")},"percent"),s.date=ue(function(){return s.union([s.is(Date),s.transform(s.string().role("datetime"),(p,h)=>{const S=new Date(p);if(isNaN(+S))throw new i(`invalid date "${p}"`,h);return S},!0)])},"date"),s.regExp=ue(function(p=""){return s.union([s.is(RegExp),s.transform(s.string().role("regexp",{flag:p}),(h,S)=>{try{return new RegExp(h,p)}catch(T){throw new i(T.message,S)}},!0)])},"regExp"),s.arrayBuffer=ue(function(p){return s.union([s.is(ArrayBuffer),s.is(SharedArrayBuffer),s.transform(s.any(),(h,S)=>{if(Et.isSource(h))return Et.fromSource(h);throw new i(`expected ArrayBufferSource but got ${h}`,S)},!0),...p?[s.transform(s.string(),(h,S)=>{try{return p==="base64"?Et.fromBase64(h):Et.fromHex(h)}catch(T){throw new i(T.message,S)}},!0)]:[]])},"arrayBuffer"),s.extend("lazy",(g,p,h,S)=>(p.inner[n]||(p.inner=p.builder(),p.inner.meta={...p.meta,...p.inner.meta}),s.resolve(g,p.inner,h,S))),s.extend("any",g=>[g]),s.extend("never",(g,p,h)=>{throw new i(`expected nullable but got ${g}`,h)}),s.extend("const",(g,{value:p},h)=>{if(dn(g,p))return[p];throw new i(`expected ${p} but got ${g}`,h)});function f(g,p,h,S,T=!1){const{max:N=1/0,min:H=-1/0}=p;if(g>N)throw new i(`expected ${h} <= ${N} but got ${g}`,S);if(g<H&&!T)throw new i(`expected ${h} >= ${H} but got ${g}`,S)}ue(f,"checkWithinRange"),s.extend("string",(g,{meta:p},h)=>{if(typeof g!="string")throw new i(`expected string but got ${g}`,h);if(p.pattern){const S=new RegExp(p.pattern.source,p.pattern.flags);if(!S.test(g))throw new i(`expect string to match regexp ${S}`,h)}return f(g.length,p,"string length",h),[g]});function y(g,p){const h=g.toString();if(h.includes("e"))return g*Math.pow(10,p);const S=h.indexOf(".");if(S===-1)return g*Math.pow(10,p);const T=h.slice(S+1),N=h.slice(0,S);return T.length<=p?+(N+T.padEnd(p,"0")):+(N+T.slice(0,p)+"."+T.slice(p))}ue(y,"decimalShift");function v(g,p,h){if(h=Math.abs(h),!/^\d+\.\d+$/.test(h.toString()))return(g-p)%h===0;const S=h.toString().indexOf("."),T=h.toString().slice(S+1).length;return Math.abs(y(g,T)-y(p,T))%y(h,T)===0}ue(v,"isMultipleOf"),s.extend("number",(g,{meta:p},h)=>{if(typeof g!="number")throw new i(`expected number but got ${g}`,h);f(g,p,"number",h);const{step:S}=p;if(S&&!v(g,p.min??0,S))throw new i(`expected number multiple of ${S} but got ${g}`,h);return[g]}),s.extend("boolean",(g,p,h)=>{if(typeof g=="boolean")return[g];throw new i(`expected boolean but got ${g}`,h)}),s.extend("bitset",(g,{bits:p,meta:h},S)=>{let T=0,N=[];if(typeof g=="number"){T=g;for(const H in p)g&p[H]&&N.push(H)}else if(Array.isArray(g)){N=g;for(const H of N){if(typeof H!="string")throw new i(`expected string but got ${H}`,S);H in p&&(T|=p[H])}}else throw new i(`expected number or array but got ${g}`,S);return T===h.default?[T]:[T,N]}),s.extend("function",(g,p,h)=>{if(typeof g=="function")return[g];throw new i(`expected function but got ${g}`,h)}),s.extend("is",(g,{constructor:p},h)=>{if(typeof p=="function"){if(g instanceof p)return[g];throw new i(`expected ${p.name} but got ${g}`,h)}else{if($e(g))throw new i(`expected ${p} but got ${g}`,h);let S=Object.getPrototypeOf(g);for(;S;){if(S.constructor?.name===p)return[g];S=Object.getPrototypeOf(S)}throw new i(`expected ${p} but got ${g}`,h)}});function b(g,p,h,S){try{const[T,N]=s.resolve(g[p],h,{...S,path:[...S.path||[],p]});return N!==void 0&&(g[p]=N),T}catch(T){if(!S?.autofix)throw T;return delete g[p],h.meta.default}}ue(b,"property"),s.extend("array",(g,{inner:p,meta:h},S)=>{if(!Array.isArray(g))throw new i(`expected array but got ${g}`,S);return f(g.length,h,"array length",S,!$e(p.meta.default)),[g.map((T,N)=>b(g,N,p,S))]}),s.extend("dict",(g,{inner:p,sKey:h},S,T)=>{if(!Vr(g))throw new i(`expected object but got ${g}`,S);const N={};for(const H in g){let X;try{X=s.resolve(H,h,S)[0]}catch(Te){if(T)continue;throw Te}N[X]=b(g,H,p,S),g[X]=g[H],H!==X&&delete g[H]}return[N]}),s.extend("tuple",(g,{list:p},h,S)=>{if(!Array.isArray(g))throw new i(`expected array but got ${g}`,h);const T=p.map((N,H)=>b(g,H,N,h));return S?[T]:(T.push(...g.slice(p.length)),[T])});function I(g,p){for(const h in p)h in g||(g[h]=p[h])}ue(I,"merge"),s.extend("object",(g,{dict:p},h,S)=>{if(!Vr(g))throw new i(`expected object but got ${g}`,h);const T={};for(const N in p){const H=b(g,N,p[N],h);(!$e(H)||N in g)&&(T[N]=H)}return S||I(T,g),[T]}),s.extend("union",(g,{list:p,toString:h},S,T)=>{for(const N of p)try{return s.resolve(g,N,S,T)}catch{}throw new i(`expected ${h()} but got ${JSON.stringify(g)}`,S)}),s.extend("intersect",(g,{list:p,toString:h},S,T)=>{if(!p.length)return[g];let N;for(const H of p){const X=s.resolve(g,H,S,!0)[0];if(!$e(X))if($e(N))N=X;else{if(typeof N!=typeof X)throw new i(`expected ${h()} but got ${JSON.stringify(g)}`,S);if(typeof X=="object")I(N??(N={}),X);else if(N!==X)throw new i(`expected ${h()} but got ${JSON.stringify(g)}`,S)}}return!T&&Vr(g)&&I(N,g),[N]}),s.extend("transform",(g,{inner:p,callback:h,preserve:S},T)=>{const[N,H=g]=s.resolve(g,p,T,!0);return S?[h(N)]:[h(N),h(H)]});var F={};function O(g,p,h){F[g]=h,Object.assign(s,{[g](...S){const T=new s({type:g});return p.forEach((N,H)=>{switch(N){case"sKey":T.sKey=S[H]??s.string();break;case"inner":T.inner=s.from(S[H]);break;case"list":T.list=S[H].map(s.from);break;case"dict":T.dict=jt(S[H],s.from);break;case"bits":{T.bits={};for(const X in S[H])typeof S[H][X]=="number"&&(T.bits[X]=S[H][X]);break}case"callback":{const X=T.callback=S[H];X.toJSON||(X.toJSON=()=>X.toString());break}case"constructor":{const X=T.constructor=S[H];typeof X=="function"&&(X.toJSON||(X.toJSON=()=>X.name));break}default:T[N]=S[H]}}),g==="object"||g==="dict"?T.meta.default={}:g==="array"||g==="tuple"?T.meta.default=[]:g==="bitset"&&(T.meta.default=0),T}})}ue(O,"defineMethod"),O("is",["constructor"],({constructor:g})=>typeof g=="function"?g.name:g),O("any",[],()=>"any"),O("never",[],()=>"never"),O("const",["value"],({value:g})=>typeof g=="string"?JSON.stringify(g):g),O("string",[],()=>"string"),O("number",[],()=>"number"),O("boolean",[],()=>"boolean"),O("bitset",["bits"],()=>"bitset"),O("function",[],()=>"function"),O("array",["inner"],({inner:g})=>`${g.toString(!0)}[]`),O("dict",["inner","sKey"],({inner:g,sKey:p})=>`{ [key: ${p.toString()}]: ${g.toString()} }`),O("tuple",["list"],({list:g})=>`[${g.map(p=>p.toString()).join(", ")}]`),O("object",["dict"],({dict:g})=>Object.keys(g).length===0?"{}":`{ ${Object.entries(g).map(([p,h])=>`${p}${h.meta.required?"":"?"}: ${h.toString()}`).join(", ")} }`),O("union",["list"],({list:g},p)=>{const h=g.map(({toString:S})=>S()).join(" | ");return p?`(${h})`:h}),O("intersect",["list"],({list:g})=>`${g.map(p=>p.toString(!0)).join(" & ")}`),O("transform",["inner","callback","preserve"],({inner:g},p)=>g.toString(p)),e.exports=s}});const fe=jd();/**
4
4
  * @inpageedit/logger
5
5
  *
6
6
  * Flexible, Extensible Console Logger with Colored Labels and Hierarchical Loggers
7
7
  *
8
8
  * @author dragon-fish <dragon-fish@qq.com>
9
9
  * @license MIT
10
- */var Es=(t=>(t[t.debug=-1]="debug",t[t.log=0]="log",t[t.info=1]="info",t[t.warn=2]="warn",t[t.error=3]="error",t[t.silent=4]="silent",t))(Es||{});const ks=globalThis||window,Ps=Symbol.for("__IPE_LOGGER_COLOR_MAP__");ks[Ps]||(ks[Ps]=new Map);const $s=ks[Ps];function Jr(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=(e>>>0)*16777619;return e>>>0}const Ba=[[350,360],[0,15],[15,30],[200,230],[230,250],[250,280],[280,310],[310,330],[140,160],[160,180]];function Fd(t,e){const n=Ba.length,r=Jr(t)%n,[i,s]=Ba[r],o=s-i,a=Jr(t+":"+e),l=i+a%(o||1),c=Jr(t+":s"),u=Jr(t+":l");let f,p;if(e==="name")f=62+c%18,p=30+u%12;else{const v=l>=0&&l<50||l>330&&l<360,b=l>=200&&l<=300;f=55+c%20,b?p=55+u%8:v?p=48+u%6:p=50+u%8,f<60&&(f+=5)}return`hsl(${l}, ${f}%, ${p}%)`}function Xr(t,e){if(e)return $s.set(t,e),e;const n=$s.get(t);if(n)return n;const r=t.startsWith("name:")?"name":"group",i=Fd(t,r);return $s.set(t,i),i}/**
10
+ */var ks=(t=>(t[t.debug=-1]="debug",t[t.log=0]="log",t[t.info=1]="info",t[t.warn=2]="warn",t[t.error=3]="error",t[t.silent=4]="silent",t))(ks||{});const Ps=globalThis||window,$s=Symbol.for("__IPE_LOGGER_COLOR_MAP__");Ps[$s]||(Ps[$s]=new Map);const Cs=Ps[$s];function Jr(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=(e>>>0)*16777619;return e>>>0}const Ba=[[350,360],[0,15],[15,30],[200,230],[230,250],[250,280],[280,310],[310,330],[140,160],[160,180]];function Fd(t,e){const n=Ba.length,r=Jr(t)%n,[i,s]=Ba[r],o=s-i,a=Jr(t+":"+e),l=i+a%(o||1),c=Jr(t+":s"),u=Jr(t+":l");let f,y;if(e==="name")f=62+c%18,y=30+u%12;else{const v=l>=0&&l<50||l>330&&l<360,b=l>=200&&l<=300;f=55+c%20,b?y=55+u%8:v?y=48+u%6:y=50+u%8,f<60&&(f+=5)}return`hsl(${l}, ${f}%, ${y}%)`}function Xr(t,e){if(e)return Cs.set(t,e),e;const n=Cs.get(t);if(n)return n;const r=t.startsWith("name:")?"name":"group",i=Fd(t,r);return Cs.set(t,i),i}/**
11
11
  * @inpageedit/logger
12
12
  * Flexible, Extensible Console Logger with Colored Labels and Hierarchical Loggers
13
13
  *
@@ -26,7 +26,7 @@
26
26
  * logger.defineLevel('success', { level: LoggerLevel.info, label: '✅', method: 'info' })
27
27
  * logger.success('User created successfully')
28
28
  * ```
29
- */class Zr{constructor(e={}){this._custom=n=>{if(!this._enabled(n.level))return Ua;const[r,i]=this._prefix(n.label);return this._consoleMethod(n.method).bind(console,r,...i)},this._name=e.name,this._nameColor=e.color,this._groupPath=e._groupPath?[...e._groupPath]:[],this._dynamicLevels={...e._dynamicLevels},this._levelRef=e._levelRef??{value:e.level??1},this._name&&Xr(`name:${this._name}`,this._nameColor),this._installBuiltinLevels();for(const n of Object.keys(this._dynamicLevels))this._installLevelGetter(n,this._dynamicLevels[n]);return Ud(this)}get level(){return this._levelRef.value}set level(e){this._levelRef.value=e}group(e,n){return e&&Xr(`group:${e}`,n?.color),new Zr({name:this._name,color:this._nameColor,_groupPath:[...this._groupPath,e],_dynamicLevels:this._dynamicLevels,_levelRef:this._levelRef})}defineLevel(e,n){this._dynamicLevels[e]={...n},this._installLevelGetter(e,n)}get debug(){return this._method("debug")}get log(){return this._method("log")}get info(){return this._method("info")}get warn(){return this._method("warn")}get error(){return this._method("error")}_installBuiltinLevels(){}_installLevelGetter(e,n){Object.defineProperty(this,e,{configurable:!0,enumerable:!1,get:()=>this._custom(n)})}_method(e){const n=Bd[e];if(!this._enabled(n.level))return Ua;const[r,i]=this._prefix(n.label);return this._consoleMethod(e).bind(console,r,...i)}_consoleMethod(e){return(console[e]||console.log).bind(console)}_enabled(e){return e>=this._levelRef.value&&this._levelRef.value!==4}_prefix(e){const n=[];let r="";if(this._name){const i=Xr(`name:${this._name}`,this._nameColor);r+=`%c${this._name}%c`,n.push(`background:${i}; color:#fff; padding:1px 4px; border-radius:2px; font-weight:700;`,qa)}if(e&&(r+=` ${e}`),this._groupPath.length){const i=this._groupPath.join("/"),s=Xr(`group:${i}`);r+=` %c${i}%c`,n.push(`color:${s}; text-decoration: underline;`,qa)}return[r,n]}}const Ua=()=>{},qa="color:inherit; background:transparent; text-decoration:none;",Bd={debug:{level:-1,label:"",method:"debug"},log:{level:0,label:"",method:"log"},info:{level:1,label:"[I]",method:"info"},warn:{level:2,label:"[W]",method:"warn"},error:{level:3,label:"[E]",method:"error"}};function Ud(t){const e=function(n,r){return t.group(n,r)};return new Proxy(e,{get(n,r,i){return t[r]},set(n,r,i){return t[r]=i,!0},apply(n,r,i){return t.group(i[0],i[1])},has(n,r){return r in t}})}function za(t){return new Zr(t)}var st=(t=>(t.BODY_USED="BODY_USED",t.NO_BODY_READER="NO_BODY_READER",t.TIMEOUT="TIMEOUT",t.NETWORK_ERROR="NETWORK_ERROR",t.BODY_NOT_ALLOWED="BODY_NOT_ALLOWED",t.HOOK_CONTEXT_CHANGED="HOOK_CONTEXT_CHANGED",t.ABORTED_BY_HOOK="ABORTED_BY_HOOK",t.INVALID_HOOK_CALLBACK="INVALID_HOOK_CALLBACK",t.UNEXPECTED_HOOK_RETURN="UNEXPECTED_HOOK_RETURN",t))(st||{});let et=class extends Error{constructor(e,n,r,i){super(n,i),this.code=e,this.context=r,this.name="FexiosError"}},qd=class extends et{constructor(e,n,r){super(n.statusText,e,void 0,r),this.response=n,this.name="FexiosResponseError"}};function zd(t,e=2048){if(!(t instanceof Uint8Array))throw new TypeError("Input must be a Uint8Array");if(t.length===0)return!0;const n=Math.min(Math.max(t.length,256),e),r=t.slice(0,n);if(Hd(r))return!1;const i=Wd(r);if(i.nullByteRatio>.05||i.highByteRatio>.95)return!1;const s=["utf-8","utf-16le","utf-16be","iso-8859-1"];let o=-1,a=!1;for(const l of s)try{const c=new TextDecoder(l,{fatal:!0}).decode(r),u=Kd(c);u>o&&(o=u,a=u>.7)}catch{continue}return a}function Hd(t){if(t.length<4)return!1;const e=[[137,80,78,71],[255,216,255],[71,73,70],[37,80,68,70],[80,75,3,4],[80,75,5,6],[80,75,7,8],[127,69,76,70],[77,90],[202,254,186,190],[0,0,1,0],[82,73,70,70]];for(const n of e)if(t.length>=n.length){let r=!0;for(let i=0;i<n.length;i++)if(t[i]!==n[i]){r=!1;break}if(r)return!0}return!1}function Wd(t){let e=0,n=0,r=0;for(const i of t)i===0&&e++,i>127&&n++,(i<32&&i!==9&&i!==10&&i!==13||i===127)&&r++;return{nullByteRatio:e/t.length,highByteRatio:n/t.length,controlCharRatio:r/t.length}}function Kd(t){if(t.length===0)return 1;let e=1,n=0;for(let i=0;i<t.length;i++){const s=t[i].charCodeAt(0);s>=32&&s<=126||s===9||s===10||s===13||s===32?n++:s>127&&s<65534?!Vd(s)&&!Yd(s)&&n++:e-=.1}const r=n/t.length;return e*=r,Gd(t)&&(e*=1.1),Math.max(0,Math.min(1,e))}function Vd(t){return t>=0&&t<=31||t>=127&&t<=159}function Yd(t){return t>=57344&&t<=63743||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function Gd(t){return[/\b\w+\b/,/[.!?]+\s/,/\s+/,/[a-zA-Z]{3,}/,/[\u4e00-\u9fa5]+/,/\d+/].some(e=>e.test(t))}function ei(t){if(typeof t!="object"||t===null||Object.prototype.toString.call(t)!=="[object Object]")return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}function Ha(t,e={}){const n={};return Object.entries(t).forEach(([r,i])=>{i!=null&&(e.dropEmptyString&&i===""||(n[r]=i))}),n}let lr=class{constructor(e,n,r){this.rawResponse=e,this.data=n,this.ok=e.ok,this.status=e.status,this.statusText=e.statusText,this.headers=e.headers,Object.entries(r||{}).forEach(([i,s])=>{this[i]=s})}};async function Qd(t,e,n){var r;if(t.bodyUsed)throw new et(st.BODY_USED,"Response body has already been used or locked");const i=t.headers.get("content-type")||"",s=Number(t.headers.get("content-length"))||0,o=(l,c)=>c==="json"||l.startsWith("application/json"),a=(l,c,u)=>u==="blob"||l.startsWith("image/")&&!l.startsWith("image/svg")||l.startsWith("video/")||l.startsWith("audio/")||!zd(c);if((t.status===101||t.status===426||t.headers.get("upgrade"))&&typeof globalThis.WebSocket<"u"){const l=new WebSocket(t.url);return await new Promise((c,u)=>{l.onopen=c,l.onerror=u}),new lr(t,l,{ok:!0,status:101,statusText:"Switching Protocols"})}else if(i.startsWith("text/event-stream")&&!["text","json"].includes(e||"")&&typeof globalThis.EventSource<"u"){const l=new EventSource(t.url);return await new Promise((c,u)=>{l.onopen=c,l.onerror=u}),new lr(t,l)}else{if(e==="stream")return new lr(t,t.body);{const l=(r=t.clone().body)==null?void 0:r.getReader();if(!l)throw new et(st.NO_BODY_READER,"Failed to get ReadableStream from response body");let c=new Uint8Array;for(;;){const{done:f,value:p}=await l.read();if(f)break;if(p&&(c=new Uint8Array([...c,...p]),n&&s>0)){const v=Math.min(c.length/s,1);n(v,c)}}const u=new lr(t,void 0);if(e==="arrayBuffer")return u.data=c.buffer,u;if(o(i,e))try{const f=new TextDecoder().decode(c);u.data=JSON.parse(f)}catch{}if(typeof u.data!="string"&&a(i,c,e)?u.data=new Blob([c],{type:t.headers.get("content-type")||void 0}):u.data=new TextDecoder().decode(c),typeof u.data=="string"&&e!=="text"){const f=u.data.trim(),p=f[0],v=f[f.length-1];if(p==="{"&&v==="}"||p==="["&&v==="]")try{u.data=JSON.parse(u.data)}catch{}}if(typeof u.data>"u"&&(u.data=c.length>0?c:void 0),u.ok)return u;throw new qd(`Request failed with status code ${t.status}`,u)}}}let Jd=class{static makeSearchParams(e){const n=new URLSearchParams;return Object.entries(e).forEach(([r,i])=>{Array.isArray(i)?i.forEach(s=>n.append(r,String(s))):n.set(r,String(i))}),n}static makeQueryString(e){return this.makeSearchParams(e).toString()}};function Xd(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Cs,Wa;function Zd(){if(Wa)return Cs;Wa=1;function t(e){var n=this.constructor.prototype[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,this.constructor.prototype),Object.getOwnPropertyNames(n).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(n,i))}),r}return t.prototype=Object.create(Function.prototype),Cs=t,Cs}var eh=Zd();const th=Xd(eh),ti=class fn extends th{constructor(e={}){super("request"),this.baseConfigs=e,this.hooks=[],this.interceptors={request:this.createInterceptor("beforeRequest"),response:this.createInterceptor("afterResponse")},this.create=fn.create,this.dropUndefinedAndNull=Ha,this.checkIsPlainObject=ei,e={...fn.DEFAULT_CONFIGS,...e},fn.ALL_METHODS.forEach(this.createMethodShortcut.bind(this))}async request(e,n){var r,i,s,o;let a=n=n||{};typeof e=="string"||e instanceof URL?a.url=e.toString():typeof e=="object"&&(a={...e,...a}),a=await this.emit("beforeInit",a);const l=n.baseURL||this.baseConfigs.baseURL||((r=globalThis.location)==null?void 0:r.href),c=l?new URL(l,(i=globalThis.location)==null?void 0:i.href):void 0,u=new URL(a.url.toString(),c);a.url=u.href,a.baseURL=c?c.href:u.origin,a.headers=this.mergeHeaders(this.baseConfigs.headers,n.headers);const f=c?.searchParams,p=new URLSearchParams(u.searchParams);if(u.search="",a.url=u.href,a.query=this.mergeQuery(f,this.baseConfigs.query,p,n.query),u.search=Jd.makeQueryString(a.query),a.url=u.toString(),fn.METHODS_WITHOUT_BODY.includes((s=a.method)==null?void 0:s.toLocaleLowerCase())&&a.body)throw new et(st.BODY_NOT_ALLOWED,`Request method "${a.method}" does not allow body`);a=await this.emit("beforeRequest",a);let v;typeof a.body<"u"&&a.body!==null&&(a.body instanceof Blob||a.body instanceof FormData||a.body instanceof URLSearchParams?v=a.body:typeof a.body=="object"&&a.body!==null?(v=JSON.stringify(a.body),a.headers["content-type"]="application/json"):v=a.body),!((o=n.headers)!=null&&o["content-type"])&&v&&(v instanceof FormData||v instanceof URLSearchParams?delete a.headers["content-type"]:typeof v=="string"&&typeof a.body=="object"?a.headers["content-type"]="application/json":v instanceof Blob&&(a.headers["content-type"]=v.type)),a.body=v,a=await this.emit("afterBodyTransformed",a);const b=a.abortController||globalThis.AbortController?new AbortController:void 0,I=new Request(a.url,{method:a.method||"GET",credentials:a.credentials,cache:a.cache,mode:a.mode,headers:a.headers,body:a.body,signal:b?.signal});a.rawRequest=I,a=await this.emit("beforeActualFetch",a);const B=a.timeout||this.baseConfigs.timeout||60*1e3;if(a.url.startsWith("ws"))try{const A=new WebSocket(a.url);return await new Promise((y,m)=>{const h=setTimeout(()=>{m(new et(st.TIMEOUT,`WebSocket connection timed out after ${B}ms`,a))},B);A.onopen=()=>{clearTimeout(h),y()},A.onerror=S=>{clearTimeout(h),m(new et(st.NETWORK_ERROR,"WebSocket connection failed",a))},A.onclose=S=>{S.code!==1e3&&(clearTimeout(h),m(new et(st.NETWORK_ERROR,`WebSocket closed with code ${S.code}`,a)))}}),a.rawResponse=new Response,a.response=new lr(a.rawResponse,A,{ok:!0,status:101,statusText:"Switching Protocols"}),a.data=A,a.headers=new Headers,this.emit("afterResponse",a)}catch(A){throw A instanceof et?A:new et(st.NETWORK_ERROR,`WebSocket creation failed: ${A}`,a)}let D;try{b&&(D=setTimeout(()=>{b.abort()},B));const A=await(n.fetch||this.baseConfigs.fetch||globalThis.fetch)(a.rawRequest).catch(y=>{throw D&&clearTimeout(D),b!=null&&b.signal.aborted?new et(st.TIMEOUT,`Request timed out after ${B}ms`,a):new et(st.NETWORK_ERROR,y.message,a)});return D&&clearTimeout(D),a.rawResponse=A,a.response=await Qd(A,a.responseType,(y,m)=>{var h;(h=n?.onProgress)==null||h.call(n,y,m)}),a.data=a.response.data,a.headers=a.response.headers,this.emit("afterResponse",a)}catch(A){throw D&&clearTimeout(D),A}}mergeQuery(e,...n){const r={},i=s=>{s&&(ei(s)?Object.entries(s).forEach(([o,a])=>{a==null?delete r[o]:Array.isArray(a)?(o.endsWith("[]"),r[o]=a.map(String)):r[o]=String(a)}):new URLSearchParams(s).forEach((o,a)=>{r[a]=o}))};return i(e),n.forEach(i),r}mergeHeaders(e,...n){const r={},i=new Headers(e);for(const s of n)if(s!=null)if(ei(s)){const o=Ha(s);if(Object.keys(o).length===0)continue;new Headers(o).forEach((a,l)=>{i.set(l,a)})}else new Headers(s).forEach((o,a)=>{i.set(a,o)});return i.forEach((s,o)=>{r[o]=s}),r}async emit(e,n){const r=this.hooks.filter(i=>i.event===e);try{let i=0;for(const s of r){const o=`${e}#${s.action.name||`anonymous#${i}`}`,a=Symbol("FexiosHookContext");n[a]=a;let l=await s.action.call(this,n);if(l===void 0&&(l=n),l===!1)throw new et(st.ABORTED_BY_HOOK,`Request aborted by hook "${o}"`,n);if(typeof l=="object"&&l[a]===a)n=l;else{const c=globalThis["".concat("console")];try{throw new et(st.HOOK_CONTEXT_CHANGED,`Hook "${o}" should return the original FexiosContext or return false to abort the request, but got "${l}".`)}catch(u){c.warn(u.stack||u)}}delete n[a],i++}}catch(i){return Promise.reject(i)}return n}on(e,n,r=!1){if(typeof n!="function")throw new et(st.INVALID_HOOK_CALLBACK,`Hook should be a function, but got "${typeof n}"`);return this.hooks[r?"unshift":"push"]({event:e,action:n}),this}off(e,n){return e==="*"||!e?this.hooks=this.hooks.filter(r=>r.action!==n):this.hooks=this.hooks.filter(r=>r.event!==e||r.action!==n),this}createInterceptor(e){return{handlers:()=>this.hooks.filter(n=>n.event===e).map(n=>n.action),use:(n,r=!1)=>this.on(e,n,r),clear:()=>{this.hooks=this.hooks.filter(n=>n.event!==e)}}}createMethodShortcut(e){return Object.defineProperty(this,e,{value:(n,r,i)=>(fn.METHODS_WITHOUT_BODY.includes(e.toLocaleLowerCase())?i=r:(i=i||{},i.body=r),this.request(n,{...i,method:e}))}),this}extends(e){const n=new fn({...this.baseConfigs,...e});return n.hooks=[...this.hooks],n}static create(e){return new fn(e)}};ti.DEFAULT_CONFIGS={baseURL:"",timeout:60*1e3,credentials:"same-origin",headers:{},query:{},responseType:void 0,fetch:globalThis.fetch},ti.ALL_METHODS=["get","post","put","patch","delete","head","options","trace"],ti.METHODS_WITHOUT_BODY=["get","head","options","trace"];let Ka=ti;/**
29
+ */class Zr{constructor(e={}){this._custom=n=>{if(!this._enabled(n.level))return Ua;const[r,i]=this._prefix(n.label);return this._consoleMethod(n.method).bind(console,r,...i)},this._name=e.name,this._nameColor=e.color,this._groupPath=e._groupPath?[...e._groupPath]:[],this._dynamicLevels={...e._dynamicLevels},this._levelRef=e._levelRef??{value:e.level??1},this._name&&Xr(`name:${this._name}`,this._nameColor),this._installBuiltinLevels();for(const n of Object.keys(this._dynamicLevels))this._installLevelGetter(n,this._dynamicLevels[n]);return Ud(this)}get level(){return this._levelRef.value}set level(e){this._levelRef.value=e}group(e,n){return e&&Xr(`group:${e}`,n?.color),new Zr({name:this._name,color:this._nameColor,_groupPath:[...this._groupPath,e],_dynamicLevels:this._dynamicLevels,_levelRef:this._levelRef})}defineLevel(e,n){this._dynamicLevels[e]={...n},this._installLevelGetter(e,n)}get debug(){return this._method("debug")}get log(){return this._method("log")}get info(){return this._method("info")}get warn(){return this._method("warn")}get error(){return this._method("error")}_installBuiltinLevels(){}_installLevelGetter(e,n){Object.defineProperty(this,e,{configurable:!0,enumerable:!1,get:()=>this._custom(n)})}_method(e){const n=Bd[e];if(!this._enabled(n.level))return Ua;const[r,i]=this._prefix(n.label);return this._consoleMethod(e).bind(console,r,...i)}_consoleMethod(e){return(console[e]||console.log).bind(console)}_enabled(e){return e>=this._levelRef.value&&this._levelRef.value!==4}_prefix(e){const n=[];let r="";if(this._name){const i=Xr(`name:${this._name}`,this._nameColor);r+=`%c${this._name}%c`,n.push(`background:${i}; color:#fff; padding:1px 4px; border-radius:2px; font-weight:700;`,qa)}if(e&&(r+=` ${e}`),this._groupPath.length){const i=this._groupPath.join("/"),s=Xr(`group:${i}`);r+=` %c${i}%c`,n.push(`color:${s}; text-decoration: underline;`,qa)}return[r,n]}}const Ua=()=>{},qa="color:inherit; background:transparent; text-decoration:none;",Bd={debug:{level:-1,label:"",method:"debug"},log:{level:0,label:"",method:"log"},info:{level:1,label:"[I]",method:"info"},warn:{level:2,label:"[W]",method:"warn"},error:{level:3,label:"[E]",method:"error"}};function Ud(t){const e=function(n,r){return t.group(n,r)};return new Proxy(e,{get(n,r,i){return t[r]},set(n,r,i){return t[r]=i,!0},apply(n,r,i){return t.group(i[0],i[1])},has(n,r){return r in t}})}function za(t){return new Zr(t)}var st=(t=>(t.BODY_USED="BODY_USED",t.NO_BODY_READER="NO_BODY_READER",t.TIMEOUT="TIMEOUT",t.NETWORK_ERROR="NETWORK_ERROR",t.BODY_NOT_ALLOWED="BODY_NOT_ALLOWED",t.HOOK_CONTEXT_CHANGED="HOOK_CONTEXT_CHANGED",t.ABORTED_BY_HOOK="ABORTED_BY_HOOK",t.INVALID_HOOK_CALLBACK="INVALID_HOOK_CALLBACK",t.UNEXPECTED_HOOK_RETURN="UNEXPECTED_HOOK_RETURN",t))(st||{});let et=class extends Error{constructor(e,n,r,i){super(n,i),this.code=e,this.context=r,this.name="FexiosError"}},qd=class extends et{constructor(e,n,r){super(n.statusText,e,void 0,r),this.response=n,this.name="FexiosResponseError"}};function zd(t,e=2048){if(!(t instanceof Uint8Array))throw new TypeError("Input must be a Uint8Array");if(t.length===0)return!0;const n=Math.min(Math.max(t.length,256),e),r=t.slice(0,n);if(Hd(r))return!1;const i=Wd(r);if(i.nullByteRatio>.05||i.highByteRatio>.95)return!1;const s=["utf-8","utf-16le","utf-16be","iso-8859-1"];let o=-1,a=!1;for(const l of s)try{const c=new TextDecoder(l,{fatal:!0}).decode(r),u=Kd(c);u>o&&(o=u,a=u>.7)}catch{continue}return a}function Hd(t){if(t.length<4)return!1;const e=[[137,80,78,71],[255,216,255],[71,73,70],[37,80,68,70],[80,75,3,4],[80,75,5,6],[80,75,7,8],[127,69,76,70],[77,90],[202,254,186,190],[0,0,1,0],[82,73,70,70]];for(const n of e)if(t.length>=n.length){let r=!0;for(let i=0;i<n.length;i++)if(t[i]!==n[i]){r=!1;break}if(r)return!0}return!1}function Wd(t){let e=0,n=0,r=0;for(const i of t)i===0&&e++,i>127&&n++,(i<32&&i!==9&&i!==10&&i!==13||i===127)&&r++;return{nullByteRatio:e/t.length,highByteRatio:n/t.length,controlCharRatio:r/t.length}}function Kd(t){if(t.length===0)return 1;let e=1,n=0;for(let i=0;i<t.length;i++){const s=t[i].charCodeAt(0);s>=32&&s<=126||s===9||s===10||s===13||s===32?n++:s>127&&s<65534?!Vd(s)&&!Yd(s)&&n++:e-=.1}const r=n/t.length;return e*=r,Gd(t)&&(e*=1.1),Math.max(0,Math.min(1,e))}function Vd(t){return t>=0&&t<=31||t>=127&&t<=159}function Yd(t){return t>=57344&&t<=63743||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function Gd(t){return[/\b\w+\b/,/[.!?]+\s/,/\s+/,/[a-zA-Z]{3,}/,/[\u4e00-\u9fa5]+/,/\d+/].some(e=>e.test(t))}function ei(t){if(typeof t!="object"||t===null||Object.prototype.toString.call(t)!=="[object Object]")return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}function Ha(t,e={}){const n={};return Object.entries(t).forEach(([r,i])=>{i!=null&&(e.dropEmptyString&&i===""||(n[r]=i))}),n}let lr=class{constructor(e,n,r){this.rawResponse=e,this.data=n,this.ok=e.ok,this.status=e.status,this.statusText=e.statusText,this.headers=e.headers,Object.entries(r||{}).forEach(([i,s])=>{this[i]=s})}};async function Qd(t,e,n){var r;if(t.bodyUsed)throw new et(st.BODY_USED,"Response body has already been used or locked");const i=t.headers.get("content-type")||"",s=Number(t.headers.get("content-length"))||0,o=(l,c)=>c==="json"||l.startsWith("application/json"),a=(l,c,u)=>u==="blob"||l.startsWith("image/")&&!l.startsWith("image/svg")||l.startsWith("video/")||l.startsWith("audio/")||!zd(c);if((t.status===101||t.status===426||t.headers.get("upgrade"))&&typeof globalThis.WebSocket<"u"){const l=new WebSocket(t.url);return await new Promise((c,u)=>{l.onopen=c,l.onerror=u}),new lr(t,l,{ok:!0,status:101,statusText:"Switching Protocols"})}else if(i.startsWith("text/event-stream")&&!["text","json"].includes(e||"")&&typeof globalThis.EventSource<"u"){const l=new EventSource(t.url);return await new Promise((c,u)=>{l.onopen=c,l.onerror=u}),new lr(t,l)}else{if(e==="stream")return new lr(t,t.body);{const l=(r=t.clone().body)==null?void 0:r.getReader();if(!l)throw new et(st.NO_BODY_READER,"Failed to get ReadableStream from response body");let c=new Uint8Array;for(;;){const{done:f,value:y}=await l.read();if(f)break;if(y&&(c=new Uint8Array([...c,...y]),n&&s>0)){const v=Math.min(c.length/s,1);n(v,c)}}const u=new lr(t,void 0);if(e==="arrayBuffer")return u.data=c.buffer,u;if(o(i,e))try{const f=new TextDecoder().decode(c);u.data=JSON.parse(f)}catch{}if(typeof u.data!="string"&&a(i,c,e)?u.data=new Blob([c],{type:t.headers.get("content-type")||void 0}):u.data=new TextDecoder().decode(c),typeof u.data=="string"&&e!=="text"){const f=u.data.trim(),y=f[0],v=f[f.length-1];if(y==="{"&&v==="}"||y==="["&&v==="]")try{u.data=JSON.parse(u.data)}catch{}}if(typeof u.data>"u"&&(u.data=c.length>0?c:void 0),u.ok)return u;throw new qd(`Request failed with status code ${t.status}`,u)}}}let Jd=class{static makeSearchParams(e){const n=new URLSearchParams;return Object.entries(e).forEach(([r,i])=>{Array.isArray(i)?i.forEach(s=>n.append(r,String(s))):n.set(r,String(i))}),n}static makeQueryString(e){return this.makeSearchParams(e).toString()}};function Xd(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ts,Wa;function Zd(){if(Wa)return Ts;Wa=1;function t(e){var n=this.constructor.prototype[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,this.constructor.prototype),Object.getOwnPropertyNames(n).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(n,i))}),r}return t.prototype=Object.create(Function.prototype),Ts=t,Ts}var eh=Zd();const th=Xd(eh),ti=class fn extends th{constructor(e={}){super("request"),this.baseConfigs=e,this.hooks=[],this.interceptors={request:this.createInterceptor("beforeRequest"),response:this.createInterceptor("afterResponse")},this.create=fn.create,this.dropUndefinedAndNull=Ha,this.checkIsPlainObject=ei,e={...fn.DEFAULT_CONFIGS,...e},fn.ALL_METHODS.forEach(this.createMethodShortcut.bind(this))}async request(e,n){var r,i,s,o;let a=n=n||{};typeof e=="string"||e instanceof URL?a.url=e.toString():typeof e=="object"&&(a={...e,...a}),a=await this.emit("beforeInit",a);const l=n.baseURL||this.baseConfigs.baseURL||((r=globalThis.location)==null?void 0:r.href),c=l?new URL(l,(i=globalThis.location)==null?void 0:i.href):void 0,u=new URL(a.url.toString(),c);a.url=u.href,a.baseURL=c?c.href:u.origin,a.headers=this.mergeHeaders(this.baseConfigs.headers,n.headers);const f=c?.searchParams,y=new URLSearchParams(u.searchParams);if(u.search="",a.url=u.href,a.query=this.mergeQuery(f,this.baseConfigs.query,y,n.query),u.search=Jd.makeQueryString(a.query),a.url=u.toString(),fn.METHODS_WITHOUT_BODY.includes((s=a.method)==null?void 0:s.toLocaleLowerCase())&&a.body)throw new et(st.BODY_NOT_ALLOWED,`Request method "${a.method}" does not allow body`);a=await this.emit("beforeRequest",a);let v;typeof a.body<"u"&&a.body!==null&&(a.body instanceof Blob||a.body instanceof FormData||a.body instanceof URLSearchParams?v=a.body:typeof a.body=="object"&&a.body!==null?(v=JSON.stringify(a.body),a.headers["content-type"]="application/json"):v=a.body),!((o=n.headers)!=null&&o["content-type"])&&v&&(v instanceof FormData||v instanceof URLSearchParams?delete a.headers["content-type"]:typeof v=="string"&&typeof a.body=="object"?a.headers["content-type"]="application/json":v instanceof Blob&&(a.headers["content-type"]=v.type)),a.body=v,a=await this.emit("afterBodyTransformed",a);const b=a.abortController||globalThis.AbortController?new AbortController:void 0,I=new Request(a.url,{method:a.method||"GET",credentials:a.credentials,cache:a.cache,mode:a.mode,headers:a.headers,body:a.body,signal:b?.signal});a.rawRequest=I,a=await this.emit("beforeActualFetch",a);const F=a.timeout||this.baseConfigs.timeout||60*1e3;if(a.url.startsWith("ws"))try{const A=new WebSocket(a.url);return await new Promise((g,p)=>{const h=setTimeout(()=>{p(new et(st.TIMEOUT,`WebSocket connection timed out after ${F}ms`,a))},F);A.onopen=()=>{clearTimeout(h),g()},A.onerror=S=>{clearTimeout(h),p(new et(st.NETWORK_ERROR,"WebSocket connection failed",a))},A.onclose=S=>{S.code!==1e3&&(clearTimeout(h),p(new et(st.NETWORK_ERROR,`WebSocket closed with code ${S.code}`,a)))}}),a.rawResponse=new Response,a.response=new lr(a.rawResponse,A,{ok:!0,status:101,statusText:"Switching Protocols"}),a.data=A,a.headers=new Headers,this.emit("afterResponse",a)}catch(A){throw A instanceof et?A:new et(st.NETWORK_ERROR,`WebSocket creation failed: ${A}`,a)}let O;try{b&&(O=setTimeout(()=>{b.abort()},F));const A=await(n.fetch||this.baseConfigs.fetch||globalThis.fetch)(a.rawRequest).catch(g=>{throw O&&clearTimeout(O),b!=null&&b.signal.aborted?new et(st.TIMEOUT,`Request timed out after ${F}ms`,a):new et(st.NETWORK_ERROR,g.message,a)});return O&&clearTimeout(O),a.rawResponse=A,a.response=await Qd(A,a.responseType,(g,p)=>{var h;(h=n?.onProgress)==null||h.call(n,g,p)}),a.data=a.response.data,a.headers=a.response.headers,this.emit("afterResponse",a)}catch(A){throw O&&clearTimeout(O),A}}mergeQuery(e,...n){const r={},i=s=>{s&&(ei(s)?Object.entries(s).forEach(([o,a])=>{a==null?delete r[o]:Array.isArray(a)?(o.endsWith("[]"),r[o]=a.map(String)):r[o]=String(a)}):new URLSearchParams(s).forEach((o,a)=>{r[a]=o}))};return i(e),n.forEach(i),r}mergeHeaders(e,...n){const r={},i=new Headers(e);for(const s of n)if(s!=null)if(ei(s)){const o=Ha(s);if(Object.keys(o).length===0)continue;new Headers(o).forEach((a,l)=>{i.set(l,a)})}else new Headers(s).forEach((o,a)=>{i.set(a,o)});return i.forEach((s,o)=>{r[o]=s}),r}async emit(e,n){const r=this.hooks.filter(i=>i.event===e);try{let i=0;for(const s of r){const o=`${e}#${s.action.name||`anonymous#${i}`}`,a=Symbol("FexiosHookContext");n[a]=a;let l=await s.action.call(this,n);if(l===void 0&&(l=n),l===!1)throw new et(st.ABORTED_BY_HOOK,`Request aborted by hook "${o}"`,n);if(typeof l=="object"&&l[a]===a)n=l;else{const c=globalThis["".concat("console")];try{throw new et(st.HOOK_CONTEXT_CHANGED,`Hook "${o}" should return the original FexiosContext or return false to abort the request, but got "${l}".`)}catch(u){c.warn(u.stack||u)}}delete n[a],i++}}catch(i){return Promise.reject(i)}return n}on(e,n,r=!1){if(typeof n!="function")throw new et(st.INVALID_HOOK_CALLBACK,`Hook should be a function, but got "${typeof n}"`);return this.hooks[r?"unshift":"push"]({event:e,action:n}),this}off(e,n){return e==="*"||!e?this.hooks=this.hooks.filter(r=>r.action!==n):this.hooks=this.hooks.filter(r=>r.event!==e||r.action!==n),this}createInterceptor(e){return{handlers:()=>this.hooks.filter(n=>n.event===e).map(n=>n.action),use:(n,r=!1)=>this.on(e,n,r),clear:()=>{this.hooks=this.hooks.filter(n=>n.event!==e)}}}createMethodShortcut(e){return Object.defineProperty(this,e,{value:(n,r,i)=>(fn.METHODS_WITHOUT_BODY.includes(e.toLocaleLowerCase())?i=r:(i=i||{},i.body=r),this.request(n,{...i,method:e}))}),this}extends(e){const n=new fn({...this.baseConfigs,...e});return n.hooks=[...this.hooks],n}static create(e){return new fn(e)}};ti.DEFAULT_CONFIGS={baseURL:"",timeout:60*1e3,credentials:"same-origin",headers:{},query:{},responseType:void 0,fetch:globalThis.fetch},ti.ALL_METHODS=["get","post","put","patch","delete","head","options","trace"],ti.METHODS_WITHOUT_BODY=["get","head","options","trace"];let Ka=ti;/**
30
30
  * Fexios
31
31
  * @desc Fetch based HTTP client with similar API to axios for browser and Node.js
32
32
  *
@@ -37,18 +37,18 @@
37
37
  * @internal You **SHOULD NOT** use this class directly, instead, use the `MediaWikiApi` class.
38
38
  * @author dragon-fish <dragon-fish@qq.com>
39
39
  * @license MIT
40
- */const ni=class Ae{constructor(e,n,r){this.version="6.1.1",this.tokens=new Map,this.normalizeParamValue=Ae.normalizeParamValue,this.normalizeBody=Ae.normalizeBody,this.token=this.getToken,this.includesMediaWikiApiError=Ae.includesMediaWikiApiError,this.extractMediaWikiApiErrors=Ae.extractMediaWikiApiErrors,this.isBadTokenError=Ae.isBadTokenError;const i=this.config=rh(e,n,r);this.request=Ae.createRequestHandler(i.baseURL)}get baseURL(){return this.config.baseURL}get defaultParams(){return this.config.defaultParams}get defaultOptions(){return this.config.fexiosConfigs}setBaseURL(e){return this.config.baseURL=e,this.request.baseConfigs.baseURL=e,this}static normalizeParamValue(e){return Array.isArray(e)?e.join("|"):typeof e=="boolean"||e===null?e?"1":void 0:typeof e=="number"?""+e:e}static normalizeBody(e){const n=i=>i&&(i instanceof URLSearchParams||i instanceof FormData);if(e==null)return;const r=new FormData;if(n(e))return e.forEach((i,s)=>{const o=Ae.normalizeParamValue(i);o!=null&&r.append(s,o)}),r;if(ei(e))return Object.entries(e).forEach(([i,s])=>{const o=Ae.normalizeParamValue(s);o!=null&&r.append(i,o)}),r}static createRequestHandler(e){const n=new Ka({baseURL:e,responseType:"json"});return n.on("beforeInit",r=>{if(r.method?.toLowerCase()!=="post")return r;if(r.body===void 0||r.body===null)return r.body=void 0,r;const i=r.body=Ae.normalizeBody(r.body),s=new URLSearchParams(r.query);return i.has("format")&&s.delete("format"),i.has("formatversion")&&s.delete("formatversion"),i.has("action")&&s.delete("action"),i.has("origin")&&(s.set("origin",""+i.get("origin")),i.delete("origin")),r.query=Object.fromEntries(s.entries()),r}),n.on("beforeInit",r=>(r.query=Ae.normalizeBody(r.query)||{},r)),n.on("beforeRequest",r=>{const i=new URL(r.url),s=i.searchParams;if(globalThis.location&&(!s.has("origin")&&location.origin!==new URL(e).origin?(s.set("origin",location.origin),n.baseConfigs.credentials="include",n.baseConfigs.mode="cors"):location.origin===new URL(e).origin&&(s.delete("origin"),n.baseConfigs.credentials=void 0,n.baseConfigs.mode=void 0)),i.searchParams.has("origin")){const o=encodeURIComponent(i.searchParams.get("origin")||"").replace(/\./g,"%2E");r.query={},i.searchParams.delete("origin"),r.url=`${i}${i.search?"&":"?"}origin=${o}`}return r}),n}async get(e,n){return this.runRequestWithApiErrorMapping(()=>this.request.get("",$n(this.config.fexiosConfigs,{query:$n(this.config.defaultParams,e)},n)))}async post(e,n){return this.runRequestWithApiErrorMapping(()=>this.request.post("",e,$n(this.config.fexiosConfigs,{query:this.config.defaultParams},n)))}async runRequestWithApiErrorMapping(e){try{const n=await e();return this.handleApiResponse(n)}catch(n){throw this.config.throwOnApiError&&Ae.includesMediaWikiApiError(n)?new cr(Ae.extractMediaWikiApiErrors(n),n):n}}throwIfApiError(e){const n=Ae.extractMediaWikiApiErrors(e);if(n.length>0)throw new cr(n,e)}handleApiResponse(e){return this.config.throwOnApiError&&this.throwIfApiError(e.data),e}async getUserInfo(){const{data:e}=await this.get({action:"query",meta:"userinfo",uiprop:["groups","rights","blockinfo"]});return e?.query?.userinfo}async fetchTokens(e=["csrf"]){this.config.fexiosConfigs.credentials="include";const{data:n}=await this.get({action:"query",meta:"tokens",type:e});return Object.entries(n.query.tokens).forEach(([r,i])=>{this.tokens.set(r,i)}),this.tokens}async getToken(e="csrf",n=!1){return(!this.tokens.get(`${e}token`)||n)&&(this.tokens.delete(`${e}token`),await this.fetchTokens([e])),this.tokens.get(`${e}token`)}badToken(e){return this.tokens.delete(`${e}token`),this.tokens}async postWithToken(e,n,r){const{tokenName:i="token",retry:s=3,noCache:o=!1}=r||{};if(s<1)throw new ri("TOKEN_RETRY_LIMIT_EXCEEDED","The limit of the number of times to automatically re-acquire the token has been exceeded");let a=0;return sh(async()=>{const l=await this.getToken(e,o||a>0);try{const c=await this.post({[i]:l,...n},void 0);if(Ae.isBadTokenError(c.data))throw this.badToken(e),c;return c}catch(c){throw Ae.isBadTokenError(c)||c?.ok===!1?(this.badToken(e),c):cr.is(c)?c:new ri("HTTP_ERROR","Network/transport or SDK-internal error (not a MediaWiki API error)",c)}},{retry:s,onRetry:(l,c)=>{a=c+1},shouldRetry:l=>Ae.isBadTokenError(l)||l?.ok===!1}).catch(l=>{throw Ae.isBadTokenError(l)||l?.ok===!1?new ri("TOKEN_RETRY_LIMIT_EXCEEDED","Retry attempts for acquiring/using token exhausted",l):l})}postWithEditToken(e){return this.postWithToken("csrf",e)}static extractResponseDataFromAny(e){return e?.response?.data||e?.data||e||void 0}static includesMediaWikiApiError(e){return Ae.extractMediaWikiApiErrors(e).length>0}static extractMediaWikiApiErrors(e){const n=Ae.extractResponseDataFromAny(e);if(typeof n!="object"||n===null)return[];const r=n?.error,i=n?.errors,s=[];return r&&s.push(r),Array.isArray(i)&&s.push(...i),s.forEach(o=>{o.text||(o.info?o.text=o.info:o["*"]?o.text=o["*"]:o.text="")}),s}static isBadTokenError(e){if(cr.is(e))return e.isBadTokenError();{const n=Ae.extractMediaWikiApiErrors(e);return new cr(n).isBadTokenError()}}};ni.INIT_DEFAULT_PARAMS={action:"query",errorformat:"plaintext",format:"json",formatversion:2},ni.DEFAULT_CONFIGS={baseURL:void 0,fexiosConfigs:{responseType:"json"},defaultParams:ni.INIT_DEFAULT_PARAMS,throwOnApiError:!1};let Ya=ni;var Ga=(t=>(t.HTTP_ERROR="HTTP_ERROR",t.LOGIN_FAILED="LOGIN_FAILED",t.LOGIN_RETRY_LIMIT_EXCEEDED="LOGIN_RETRY_LIMIT_EXCEEDED",t.TOKEN_RETRY_LIMIT_EXCEEDED="TOKEN_RETRY_LIMIT_EXCEEDED",t))(Ga||{});let ri=class extends Error{constructor(e,n="",r){super(),this.code=e,this.message=n,this.cause=r,this.name="WikiSaikouError"}static is(e,n){return e instanceof this&&(n===void 0||e.code===n)}},cr=class extends Error{constructor(e,n){super(),this.errors=e,this.cause=n,this.name="MediaWikiApiError",this.message=e.map(r=>r.text).filter(Boolean).join(`
40
+ */const ni=class Oe{constructor(e,n,r){this.version="6.1.1",this.tokens=new Map,this.normalizeParamValue=Oe.normalizeParamValue,this.normalizeBody=Oe.normalizeBody,this.token=this.getToken,this.includesMediaWikiApiError=Oe.includesMediaWikiApiError,this.extractMediaWikiApiErrors=Oe.extractMediaWikiApiErrors,this.isBadTokenError=Oe.isBadTokenError;const i=this.config=rh(e,n,r);this.request=Oe.createRequestHandler(i.baseURL)}get baseURL(){return this.config.baseURL}get defaultParams(){return this.config.defaultParams}get defaultOptions(){return this.config.fexiosConfigs}setBaseURL(e){return this.config.baseURL=e,this.request.baseConfigs.baseURL=e,this}static normalizeParamValue(e){return Array.isArray(e)?e.join("|"):typeof e=="boolean"||e===null?e?"1":void 0:typeof e=="number"?""+e:e}static normalizeBody(e){const n=i=>i&&(i instanceof URLSearchParams||i instanceof FormData);if(e==null)return;const r=new FormData;if(n(e))return e.forEach((i,s)=>{const o=Oe.normalizeParamValue(i);o!=null&&r.append(s,o)}),r;if(ei(e))return Object.entries(e).forEach(([i,s])=>{const o=Oe.normalizeParamValue(s);o!=null&&r.append(i,o)}),r}static createRequestHandler(e){const n=new Ka({baseURL:e,responseType:"json"});return n.on("beforeInit",r=>{if(r.method?.toLowerCase()!=="post")return r;if(r.body===void 0||r.body===null)return r.body=void 0,r;const i=r.body=Oe.normalizeBody(r.body),s=new URLSearchParams(r.query);return i.has("format")&&s.delete("format"),i.has("formatversion")&&s.delete("formatversion"),i.has("action")&&s.delete("action"),i.has("origin")&&(s.set("origin",""+i.get("origin")),i.delete("origin")),r.query=Object.fromEntries(s.entries()),r}),n.on("beforeInit",r=>(r.query=Oe.normalizeBody(r.query)||{},r)),n.on("beforeRequest",r=>{const i=new URL(r.url),s=i.searchParams;if(globalThis.location&&(!s.has("origin")&&location.origin!==new URL(e).origin?(s.set("origin",location.origin),n.baseConfigs.credentials="include",n.baseConfigs.mode="cors"):location.origin===new URL(e).origin&&(s.delete("origin"),n.baseConfigs.credentials=void 0,n.baseConfigs.mode=void 0)),i.searchParams.has("origin")){const o=encodeURIComponent(i.searchParams.get("origin")||"").replace(/\./g,"%2E");r.query={},i.searchParams.delete("origin"),r.url=`${i}${i.search?"&":"?"}origin=${o}`}return r}),n}async get(e,n){return this.runRequestWithApiErrorMapping(()=>this.request.get("",$n(this.config.fexiosConfigs,{query:$n(this.config.defaultParams,e)},n)))}async post(e,n){return this.runRequestWithApiErrorMapping(()=>this.request.post("",e,$n(this.config.fexiosConfigs,{query:this.config.defaultParams},n)))}async runRequestWithApiErrorMapping(e){try{const n=await e();return this.handleApiResponse(n)}catch(n){throw this.config.throwOnApiError&&Oe.includesMediaWikiApiError(n)?new cr(Oe.extractMediaWikiApiErrors(n),n):n}}throwIfApiError(e){const n=Oe.extractMediaWikiApiErrors(e);if(n.length>0)throw new cr(n,e)}handleApiResponse(e){return this.config.throwOnApiError&&this.throwIfApiError(e.data),e}async getUserInfo(){const{data:e}=await this.get({action:"query",meta:"userinfo",uiprop:["groups","rights","blockinfo"]});return e?.query?.userinfo}async fetchTokens(e=["csrf"]){this.config.fexiosConfigs.credentials="include";const{data:n}=await this.get({action:"query",meta:"tokens",type:e});return Object.entries(n.query.tokens).forEach(([r,i])=>{this.tokens.set(r,i)}),this.tokens}async getToken(e="csrf",n=!1){return(!this.tokens.get(`${e}token`)||n)&&(this.tokens.delete(`${e}token`),await this.fetchTokens([e])),this.tokens.get(`${e}token`)}badToken(e){return this.tokens.delete(`${e}token`),this.tokens}async postWithToken(e,n,r){const{tokenName:i="token",retry:s=3,noCache:o=!1}=r||{};if(s<1)throw new ri("TOKEN_RETRY_LIMIT_EXCEEDED","The limit of the number of times to automatically re-acquire the token has been exceeded");let a=0;return sh(async()=>{const l=await this.getToken(e,o||a>0);try{const c=await this.post({[i]:l,...n},void 0);if(Oe.isBadTokenError(c.data))throw this.badToken(e),c;return c}catch(c){throw Oe.isBadTokenError(c)||c?.ok===!1?(this.badToken(e),c):cr.is(c)?c:new ri("HTTP_ERROR","Network/transport or SDK-internal error (not a MediaWiki API error)",c)}},{retry:s,onRetry:(l,c)=>{a=c+1},shouldRetry:l=>Oe.isBadTokenError(l)||l?.ok===!1}).catch(l=>{throw Oe.isBadTokenError(l)||l?.ok===!1?new ri("TOKEN_RETRY_LIMIT_EXCEEDED","Retry attempts for acquiring/using token exhausted",l):l})}postWithEditToken(e){return this.postWithToken("csrf",e)}static extractResponseDataFromAny(e){return e?.response?.data||e?.data||e||void 0}static includesMediaWikiApiError(e){return Oe.extractMediaWikiApiErrors(e).length>0}static extractMediaWikiApiErrors(e){const n=Oe.extractResponseDataFromAny(e);if(typeof n!="object"||n===null)return[];const r=n?.error,i=n?.errors,s=[];return r&&s.push(r),Array.isArray(i)&&s.push(...i),s.forEach(o=>{o.text||(o.info?o.text=o.info:o["*"]?o.text=o["*"]:o.text="")}),s}static isBadTokenError(e){if(cr.is(e))return e.isBadTokenError();{const n=Oe.extractMediaWikiApiErrors(e);return new cr(n).isBadTokenError()}}};ni.INIT_DEFAULT_PARAMS={action:"query",errorformat:"plaintext",format:"json",formatversion:2},ni.DEFAULT_CONFIGS={baseURL:void 0,fexiosConfigs:{responseType:"json"},defaultParams:ni.INIT_DEFAULT_PARAMS,throwOnApiError:!1};let Ya=ni;var Ga=(t=>(t.HTTP_ERROR="HTTP_ERROR",t.LOGIN_FAILED="LOGIN_FAILED",t.LOGIN_RETRY_LIMIT_EXCEEDED="LOGIN_RETRY_LIMIT_EXCEEDED",t.TOKEN_RETRY_LIMIT_EXCEEDED="TOKEN_RETRY_LIMIT_EXCEEDED",t))(Ga||{});let ri=class extends Error{constructor(e,n="",r){super(),this.code=e,this.message=n,this.cause=r,this.name="WikiSaikouError"}static is(e,n){return e instanceof this&&(n===void 0||e.code===n)}},cr=class extends Error{constructor(e,n){super(),this.errors=e,this.cause=n,this.name="MediaWikiApiError",this.message=e.map(r=>r.text).filter(Boolean).join(`
41
41
  `),this.code=this.isBadTokenError()?"badtoken":this.errors[0]?.code||"Unknown Error"}get firstError(){return this.errors[0]}isBadTokenError(){return this.errors.some(e=>e.code==="badtoken")||["NeedToken","WrongToken"].includes(this.cause?.data?.login?.result)}toString(){return`[${this.name} ${this.code}]`}static is(e){return e instanceof this}};/**
42
42
  * WikiSaikou
43
43
  * @description Standalone MediaWiki API SDK with `mw.Api`-like API in any environments
44
44
  * @author Dragon-Fish <dragon-fish@qq.com>
45
45
  * @license MIT
46
- */class oh extends Ya{async clientLogin(e,n,r){r||(r={}),!r.logincontinue&&!r.loginreturnurl&&(r.loginreturnurl=location?.origin);const i=await this.postWithToken("login",{action:"clientlogin",username:e,password:n,...r},{tokenName:"logintoken"});if(i?.data?.clientlogin?.status==="PASS")return i.data.clientlogin;throw new ri(Ga.LOGIN_FAILED,i.data.clientlogin.message,i)}}class ah{constructor(e,n={}){this.ctx=e,n?.baseURL?.startsWith("/")&&(n.baseURL=new URL(n.baseURL,location.origin).href);const r=new oh({baseURL:n.baseURL,fexiosConfigs:{headers:{"x-api-user-agent":`InPageEdit-NEXT ${e.version}`,...n.headers},...n},throwOnApiError:!0});e.set("api",r)}}var lh=Object.create,Ts=Object.defineProperty,ch=Object.getOwnPropertyDescriptor,Qa=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ja=t=>{throw TypeError(t)},uh=(t,e,n)=>e in t?Ts(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,fh=(t,e)=>Ts(t,"name",{value:e,configurable:!0}),dh=t=>[,,,lh(t?.[Qa("metadata")]??null)],hh=["class","method","getter","setter","accessor","field","value","get","set"],Xa=t=>t!==void 0&&typeof t!="function"?Ja("Function expected"):t,ph=(t,e,n,r,i)=>({kind:hh[t],name:e,metadata:r,addInitializer:s=>n._?Ja("Already initialized"):i.push(Xa(s||null))}),mh=(t,e)=>uh(e,Qa("metadata"),t[3]),gh=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},vh=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,p=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&ch(i,n));fh(i,n);for(var b=r.length-1;b>=0;b--)l=ph(c,n,a={},t[3],p),o=(0,r[b])(i,l),a._=1,Xa(o)&&(i=o);return mh(t,i),v&&Ts(i,n,v),u?c^4?s:v:i},Za,Is,el;Za=[We(["wiki","wikiTitle"])];class ii extends(el=Jt){constructor(n){super(n,"currentPage",!1);ir(this,Ve);this.ctx=n,this.logger=this.ctx.logger("CURRENT_PAGE"),this.url=new URL(window.location.href),this.isMainPage=void 0,this.wikiTitle=void 0,this.wikiAction=void 0}async start(){await ht(this,Ve,$a).call(this),ht(this,Ve,nd).call(this),window.addEventListener("popstate",ht(this,Ve,Ca).bind(this)),this.logger.info("initialized",this.wikiTitle)}stop(){window.removeEventListener("popstate",ht(this,Ve,Ca).bind(this))}get params(){return this.url.searchParams}}Ve=new WeakSet,$a=async function(){await ht(this,Ve,rd).call(this),await ht(this,Ve,id).call(this),await ht(this,Ve,sd).call(this)},nd=function(){const n=Symbol.for("InPageEdit.CurrentPageService.UrlChangeListenerInstalled");if(window[n])return;const r=history.pushState,i=history.replaceState;history.pushState=function(s,o,a){r.apply(this,[s,o,a]),window.dispatchEvent(new PopStateEvent("popstate",{state:s}))},history.replaceState=function(s,o,a){i.apply(this,[s,o,a]),window.dispatchEvent(new PopStateEvent("popstate",{state:s}))},window[n]=!0},Ca=async function(n){const r=this.url,i=new URL(window.location.href);this.url=i,(r.pathname!==i.pathname||r.searchParams.get("title")!==i.searchParams.get("title")||r.searchParams.get("curid")!==i.searchParams.get("curid"))&&(await ht(this,Ve,$a).call(this),this.logger.info("location changed",i,this.wikiTitle))},rd=async function(){let n=!1;const r=this.url.origin+this.url.pathname;let i=this.params.get("title")||"";const s=parseInt(this.params.get("curid")||"0",10);return s?i=(await this.ctx.wikiPage.newFromPageId(s))?.title||"":i&&(i=i[0].toUpperCase()+i.slice(1),i=i.replace(/_/g," ")),r===this.ctx.wiki.getSciprtUrl("index.php")&&i===this.ctx.wiki.mainPageName&&(n=!0),n=[this.ctx.wiki.mainPageUrl,this.ctx.wiki.landingPageUrl].includes(r)&&!i,Reflect.defineProperty(this,"isMainPage",{get:()=>n}),n},id=async function(){let n=null;return this.isMainPage?n=this.ctx.wikiTitle.newTitle(this.ctx.wiki.mainPageName):n=await this.ctx.wikiTitle.newTitleFromUrl(this.url),Object.freeze(n),Reflect.defineProperty(this,"wikiTitle",{get:()=>n}),n},sd=async function(){const n=this.params.get("action")||"view";return Reflect.defineProperty(this,"wikiAction",{get:()=>n}),this.wikiAction},Is=dh(el),ii=vh(Is,0,"CurrentPageService",Za,ii),gh(Is,1,ii);class yh extends Jt{constructor(e){super(e,"resourceLoader",!0),this.ctx=e}stop(){}loadScript(e,n){if(!e)return Promise.resolve(null);const r=`script:${e}`,i=document.querySelector(`[data-ipe="${r}"]`);return i?Promise.resolve(i):new Promise((o,a)=>{const l=document.createElement("script");l.src=e,l.dataset.ipe=r,n&&Object.entries(n).forEach(([c,u])=>{typeof u>"u"||u===!1||u===null?l.removeAttribute(c):l.setAttribute(c,u)}),document.body.appendChild(l),l.onload=()=>o(l),l.onerror=c=>a(c)})}loadStyle(e,n){if(!e)return Promise.resolve(null);const r=`style:${e}`,i=document.querySelector(`[data-ipe="${r}"]`);return i?Promise.resolve(i):new Promise((o,a)=>{const l=document.createElement("link");l.rel="stylesheet",l.href=e,l.dataset.ipe=r,n&&Object.entries(n).forEach(([u,f])=>{typeof f>"u"||f===!1||f===null?l.removeAttribute(u):l.setAttribute(u,f)}),(document.querySelector('meta[name="ipe-styles"]')||(()=>{const u=document.createElement("meta");return u.id="ipe-styles",u.name="ipe-styles",document.head.insertAdjacentElement("afterbegin",u),u})()).before(l),l.onload=()=>o(l),l.onerror=u=>a(u)})}resolveImportPath(e){if(e.startsWith("http")||e.startsWith("//"))return e;const n=document.currentScript?.src;if(!n)return`https://unpkg.com/mediawiki-inpageedit@latest/dist/${e}`;const r=new URL(n);return r.pathname.endsWith(".js")||(r.pathname=r.pathname+"/"),new URL(e,r.toString()).toString()}}const si=Object.keys;function bh(t){return typeof t=="boolean"}function wh(t){return t&&typeof t.nodeType=="number"}function oi(t){return typeof t=="string"}function tl(t){return typeof t=="number"}function hn(t){return typeof t=="object"?t!==null:ur(t)}function ur(t){return typeof t=="function"}function _h(t){return!!(t&&t.isComponent)}function xh(t){return hn(t)&&typeof t.length=="number"&&typeof t.nodeType!="number"}function As(t,e){if(t)for(const n of si(t))e(t[n],n)}function Sh(t){return hn(t)&&"current"in t}const Os={animationIterationCount:0,borderImageOutset:0,borderImageSlice:0,borderImageWidth:0,boxFlex:0,boxFlexGroup:0,boxOrdinalGroup:0,columnCount:0,columns:0,flex:0,flexGrow:0,flexPositive:0,flexShrink:0,flexNegative:0,flexOrder:0,gridArea:0,gridRow:0,gridRowEnd:0,gridRowSpan:0,gridRowStart:0,gridColumn:0,gridColumnEnd:0,gridColumnSpan:0,gridColumnStart:0,fontWeight:0,lineClamp:0,lineHeight:0,opacity:0,order:0,orphans:0,tabSize:0,widows:0,zIndex:0,zoom:0,fillOpacity:0,floodOpacity:0,stopOpacity:0,strokeDasharray:0,strokeDashoffset:0,strokeMiterlimit:0,strokeOpacity:0,strokeWidth:0};function Eh(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}const kh=["Webkit","ms","Moz","O"];si(Os).forEach(t=>{kh.forEach(e=>{Os[Eh(e,t)]=0})});const Ph=Symbol.for("jsx-dom:type");var nl=function(t){return t.ShadowRoot="ShadowRoot",t}(nl||{});function $h(t){return t!=null&&t[Ph]===nl.ShadowRoot}const Ch="http://www.w3.org/2000/svg",Th="http://www.w3.org/1999/xlink",Ih="http://www.w3.org/XML/1998/namespace";function rl(t){return!bh(t)&&t!=null}function Rs(t){return Array.isArray(t)?t.map(Rs).filter(Boolean).join(" "):hn(t)?Symbol.iterator in t?Rs(Array.from(t)):si(t).filter(e=>t[e]).join(" "):rl(t)?""+t:""}const Ah={animate:0,circle:0,clipPath:0,defs:0,desc:0,ellipse:0,feBlend:0,feColorMatrix:0,feComponentTransfer:0,feComposite:0,feConvolveMatrix:0,feDiffuseLighting:0,feDisplacementMap:0,feDistantLight:0,feFlood:0,feFuncA:0,feFuncB:0,feFuncG:0,feFuncR:0,feGaussianBlur:0,feImage:0,feMerge:0,feMergeNode:0,feMorphology:0,feOffset:0,fePointLight:0,feSpecularLighting:0,feSpotLight:0,feTile:0,feTurbulence:0,filter:0,foreignObject:0,g:0,image:0,line:0,linearGradient:0,marker:0,mask:0,metadata:0,path:0,pattern:0,polygon:0,polyline:0,radialGradient:0,rect:0,stop:0,svg:0,switch:0,symbol:0,text:0,textPath:0,tspan:0,use:0,view:0},Oh=/^(a(ll|t|u)|base[FP]|c(al|lipPathU|on)|di|ed|ex|filter[RU]|g(lyphR|r)|ke|l(en|im)|ma(rker[HUW]|s)|n|pat|pr|point[^e]|re[^n]|s[puy]|st[^or]|ta|textL|vi|xC|y|z)/;function Ft(t){const e=document.createDocumentFragment();return ai(t.children,e),e}function Rh(t,e,n){e={...e,children:n};const r=new t(e),i=r.render();return"ref"in e&&Ns(e.ref,r),i}function w(t,e){let{children:n,...r}=e;!r.namespaceURI&&Ah[t]===0&&(r={...r,namespaceURI:Ch});let i;if(oi(t)){if(i=r.namespaceURI?document.createElementNS(r.namespaceURI,t):document.createElement(t),Mh(r,i),ai(n,i),i instanceof window.HTMLSelectElement&&r.value!=null)if(r.multiple===!0&&Array.isArray(r.value)){const s=r.value.map(o=>String(o));i.querySelectorAll("option").forEach(o=>o.selected=s.includes(o.value))}else i.value=r.value;Ns(r.ref,i)}else if(ur(t))hn(t.defaultProps)&&(r={...t.defaultProps,...r}),i=_h(t)?Rh(t,r,n):t({...r,children:n});else throw new TypeError(`Invalid JSX element type: ${t}`);return i}function Nh(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return(oi(e)||Array.isArray(e))&&(r.unshift(e),e={}),e=e||{},e.children!=null&&!r.length&&({children:r,...e}=e),w(t,{...e,children:r},e.key)}function Ns(t,e){Sh(t)?t.current=e:ur(t)&&t(e)}function ai(t,e){if(xh(t))Dh(t,e);else if(oi(t)||tl(t))Ds(document.createTextNode(t),e);else if(t===null)Ds(document.createComment(""),e);else if(wh(t))Ds(t,e);else if($h(t)){const n=e.attachShadow(t.attr);ai(t.children,n),Ns(t.ref,n)}}function Dh(t,e){for(const n of[...t])ai(n,e);return e}function Ds(t,e){e instanceof window.HTMLTemplateElement?e.content.appendChild(t):e.appendChild(t)}function li(t,e){return t.replace(/[A-Z]/g,n=>e+n.toLowerCase())}function il(t,e){e==null||e===!1||(Array.isArray(e)?e.forEach(n=>il(t,n)):oi(e)?t.setAttribute("style",e):hn(e)&&As(e,(n,r)=>{r.indexOf("-")===0?t.style.setProperty(r,n):tl(n)&&Os[r]!==0?t.style[r]=n+"px":t.style[r]=n}))}function Lh(t,e,n){switch(t){case"xlinkActuate":case"xlinkArcrole":case"xlinkHref":case"xlinkRole":case"xlinkShow":case"xlinkTitle":case"xlinkType":sl(n,Th,li(t,":"),e);return;case"xmlnsXlink":Cn(n,li(t,":"),e);return;case"xmlBase":case"xmlLang":case"xmlSpace":sl(n,Ih,li(t,":"),e);return}switch(t){case"htmlFor":Cn(n,"for",e);return;case"dataset":As(e,(r,i)=>{r!=null&&(n.dataset[i]=r)});return;case"innerHTML":case"innerText":case"textContent":rl(e)&&(n[t]=e);return;case"dangerouslySetInnerHTML":hn(e)&&(n.innerHTML=e.__html);return;case"value":if(e==null||n instanceof window.HTMLSelectElement)return;if(n instanceof window.HTMLTextAreaElement){n.value=e;return}break;case"spellCheck":n.spellcheck=e;return;case"class":case"className":ur(e)?e(n):Cn(n,"class",Rs(e));return;case"ref":case"namespaceURI":return;case"style":il(n,e);return;case"on":case"onCapture":As(e,(r,i)=>{n.addEventListener(i,r,t==="onCapture")});return}if(ur(e)){if(t[0]==="o"&&t[1]==="n"){let r=t.toLowerCase();const i=r.endsWith("capture");if(r==="ondoubleclick"?r="ondblclick":i&&r==="ondoubleclickcapture"&&(r="ondblclickcapture"),!i&&n[r]===null)n[r]=e;else if(i)n.addEventListener(r.substring(2,r.length-7),e,!0);else{let s;r in window?s=r.substring(2):s=r[2]+t.slice(3),n.addEventListener(s,e)}}}else hn(e)?n[t]=e:e===!0?Cn(n,t,""):e!==!1&&e!=null&&(n instanceof SVGElement&&!Oh.test(t)?Cn(n,li(t,"-"),e):Cn(n,t,e))}function Cn(t,e,n){t.setAttribute(e,n)}function sl(t,e,n,r){t.setAttributeNS(e,n,r)}function Mh(t,e){for(const n of si(t))Lh(n,t[n],e);return e}const ci=Object.keys;function jh(t){return typeof t=="boolean"}function Fh(t){return t&&typeof t.nodeType=="number"}function Ls(t){return typeof t=="string"}function ol(t){return typeof t=="number"}function pn(t){return typeof t=="object"?t!==null:fr(t)}function fr(t){return typeof t=="function"}function Bh(t){return!!(t&&t.isComponent)}function Uh(t){return pn(t)&&typeof t.length=="number"&&typeof t.nodeType!="number"}function Ms(t,e){if(t)for(const n of ci(t))e(t[n],n)}function qh(t){return pn(t)&&"current"in t}const js={animationIterationCount:0,borderImageOutset:0,borderImageSlice:0,borderImageWidth:0,boxFlex:0,boxFlexGroup:0,boxOrdinalGroup:0,columnCount:0,columns:0,flex:0,flexGrow:0,flexPositive:0,flexShrink:0,flexNegative:0,flexOrder:0,gridArea:0,gridRow:0,gridRowEnd:0,gridRowSpan:0,gridRowStart:0,gridColumn:0,gridColumnEnd:0,gridColumnSpan:0,gridColumnStart:0,fontWeight:0,lineClamp:0,lineHeight:0,opacity:0,order:0,orphans:0,tabSize:0,widows:0,zIndex:0,zoom:0,fillOpacity:0,floodOpacity:0,stopOpacity:0,strokeDasharray:0,strokeDashoffset:0,strokeMiterlimit:0,strokeOpacity:0,strokeWidth:0};function zh(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}const Hh=["Webkit","ms","Moz","O"];ci(js).forEach(t=>{Hh.forEach(e=>{js[zh(e,t)]=0})});const Wh=Symbol.for("jsx-dom:type");var al=function(t){return t.ShadowRoot="ShadowRoot",t}(al||{});function Kh(t){return t!=null&&t[Wh]===al.ShadowRoot}const Vh="http://www.w3.org/2000/svg",Yh="http://www.w3.org/1999/xlink",Gh="http://www.w3.org/XML/1998/namespace";function ll(t){return!jh(t)&&t!=null}function Fs(t){return Array.isArray(t)?t.map(Fs).filter(Boolean).join(" "):pn(t)?Symbol.iterator in t?Fs(Array.from(t)):ci(t).filter(e=>t[e]).join(" "):ll(t)?""+t:""}const Qh={animate:0,circle:0,clipPath:0,defs:0,desc:0,ellipse:0,feBlend:0,feColorMatrix:0,feComponentTransfer:0,feComposite:0,feConvolveMatrix:0,feDiffuseLighting:0,feDisplacementMap:0,feDistantLight:0,feFlood:0,feFuncA:0,feFuncB:0,feFuncG:0,feFuncR:0,feGaussianBlur:0,feImage:0,feMerge:0,feMergeNode:0,feMorphology:0,feOffset:0,fePointLight:0,feSpecularLighting:0,feSpotLight:0,feTile:0,feTurbulence:0,filter:0,foreignObject:0,g:0,image:0,line:0,linearGradient:0,marker:0,mask:0,metadata:0,path:0,pattern:0,polygon:0,polyline:0,radialGradient:0,rect:0,stop:0,svg:0,switch:0,symbol:0,text:0,textPath:0,tspan:0,use:0,view:0},Jh=/^(a(ll|t|u)|base[FP]|c(al|lipPathU|on)|di|ed|ex|filter[RU]|g(lyphR|r)|ke|l(en|im)|ma(rker[HUW]|s)|n|pat|pr|point[^e]|re[^n]|s[puy]|st[^or]|ta|textL|vi|xC|y|z)/;function Xh(t){const e=document.createDocumentFragment();return ui(t.children,e),e}function Zh(t,e,n){e={...e,children:n};const r=new t(e),i=r.render();return"ref"in e&&Bs(e.ref,r),i}function ke(t,e){let{children:n,...r}=e;!r.namespaceURI&&Qh[t]===0&&(r={...r,namespaceURI:Vh});let i;if(Ls(t)){if(i=r.namespaceURI?document.createElementNS(r.namespaceURI,t):document.createElement(t),np(r,i),ui(n,i),i instanceof window.HTMLSelectElement&&r.value!=null)if(r.multiple===!0&&Array.isArray(r.value)){const s=r.value.map(o=>String(o));i.querySelectorAll("option").forEach(o=>o.selected=s.includes(o.value))}else i.value=r.value;Bs(r.ref,i)}else if(fr(t))pn(t.defaultProps)&&(r={...t.defaultProps,...r}),i=Bh(t)?Zh(t,r,n):t({...r,children:n});else throw new TypeError(`Invalid JSX element type: ${t}`);return i}function Bs(t,e){qh(t)?t.current=e:fr(t)&&t(e)}function ui(t,e){if(Uh(t))ep(t,e);else if(Ls(t)||ol(t))Us(document.createTextNode(t),e);else if(t===null)Us(document.createComment(""),e);else if(Fh(t))Us(t,e);else if(Kh(t)){const n=e.attachShadow(t.attr);ui(t.children,n),Bs(t.ref,n)}}function ep(t,e){for(const n of[...t])ui(n,e);return e}function Us(t,e){e instanceof window.HTMLTemplateElement?e.content.appendChild(t):e.appendChild(t)}function fi(t,e){return t.replace(/[A-Z]/g,n=>e+n.toLowerCase())}function cl(t,e){e==null||e===!1||(Array.isArray(e)?e.forEach(n=>cl(t,n)):Ls(e)?t.setAttribute("style",e):pn(e)&&Ms(e,(n,r)=>{r.indexOf("-")===0?t.style.setProperty(r,n):ol(n)&&js[r]!==0?t.style[r]=n+"px":t.style[r]=n}))}function tp(t,e,n){switch(t){case"xlinkActuate":case"xlinkArcrole":case"xlinkHref":case"xlinkRole":case"xlinkShow":case"xlinkTitle":case"xlinkType":ul(n,Yh,fi(t,":"),e);return;case"xmlnsXlink":Tn(n,fi(t,":"),e);return;case"xmlBase":case"xmlLang":case"xmlSpace":ul(n,Gh,fi(t,":"),e);return}switch(t){case"htmlFor":Tn(n,"for",e);return;case"dataset":Ms(e,(r,i)=>{r!=null&&(n.dataset[i]=r)});return;case"innerHTML":case"innerText":case"textContent":ll(e)&&(n[t]=e);return;case"dangerouslySetInnerHTML":pn(e)&&(n.innerHTML=e.__html);return;case"value":if(e==null||n instanceof window.HTMLSelectElement)return;if(n instanceof window.HTMLTextAreaElement){n.value=e;return}break;case"spellCheck":n.spellcheck=e;return;case"class":case"className":fr(e)?e(n):Tn(n,"class",Fs(e));return;case"ref":case"namespaceURI":return;case"style":cl(n,e);return;case"on":case"onCapture":Ms(e,(r,i)=>{n.addEventListener(i,r,t==="onCapture")});return}if(fr(e)){if(t[0]==="o"&&t[1]==="n"){let r=t.toLowerCase();const i=r.endsWith("capture");if(r==="ondoubleclick"?r="ondblclick":i&&r==="ondoubleclickcapture"&&(r="ondblclickcapture"),!i&&n[r]===null)n[r]=e;else if(i)n.addEventListener(r.substring(2,r.length-7),e,!0);else{let s;r in window?s=r.substring(2):s=r[2]+t.slice(3),n.addEventListener(s,e)}}}else pn(e)?n[t]=e:e===!0?Tn(n,t,""):e!==!1&&e!=null&&(n instanceof SVGElement&&!Jh.test(t)?Tn(n,fi(t,"-"),e):Tn(n,t,e))}function Tn(t,e,n){t.setAttribute(e,n)}function ul(t,e,n,r){t.setAttributeNS(e,n,r)}function np(t,e){for(const n of ci(t))tp(n,t[n],e);return e}var qs=(t=>(t.Init="modal.init",t.BeforeShow="modal.beforeShow",t.Show="modal.show",t.BeforeClose="modal.beforeClose",t.Close="modal.close",t.Destroy="modal.destroy",t.ToastShow="toast.show",t.ToastClose="toast.close",t))(qs||{});let rp=0;const fl=t=>`${t}-${++rp}`;function dr(t){return t instanceof Node?t:document.createTextNode(String(t))}function Bt(t,e){if(!t)throw new Error(`${e??"Element"} not found`);return t}function dl(t){const e=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(t.querySelectorAll(e)).filter(n=>!!(n.offsetWidth||n.offsetHeight||n.getClientRects().length))}function Ye(t,e={}){const n=document.createElement(t);if(e.className&&(n.className=e.className),e.html!=null&&(n.innerHTML=e.html),e.text!=null&&(n.textContent=e.text),e.attrs)for(const[r,i]of Object.entries(e.attrs))n.setAttribute(r,i);return n}const ip=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/i.test(navigator.platform),hl=["ctrl","alt","shift","meta"];function sp(t){if(!t)return null;const e=String(t).trim().toLowerCase().split(/[+\-\s]+/g).filter(Boolean),n=[];let r=null;const i=o=>{n.includes(o)||n.push(o)};for(const o of e){let a=o;if(a==="control"||a==="ctrl"){i("ctrl");continue}if(a==="alt"||a==="option"){i("alt");continue}if(a==="shift"){i("shift");continue}if(a==="meta"||a==="cmd"||a==="command"||a==="super"){i("meta");continue}if(a==="mod"){i(ip?"meta":"ctrl");continue}a==="esc"&&(a="escape"),a==="return"&&(a="enter"),(a==="space"||a==="spacebar")&&(a="space"),r=a}const s=hl.filter(o=>n.includes(o));return!r||r===""?s.length?s.join("+"):null:s.length?`${s.join("+")}+${r}`:r}function op(t){const e=[];t.ctrlKey&&e.push("ctrl"),t.altKey&&e.push("alt"),t.shiftKey&&e.push("shift"),t.metaKey&&e.push("meta");let n=t.key;n===" "&&(n="space");const r=(n.length,n.toLowerCase()),i=hl.filter(s=>e.includes(s));return i.length?`${i.join("+")}+${r}`:r}class ap{constructor(){this.zBase=1e3,this.stack=[]}push(e){this.stack.push(e),this.syncZ()}remove(e){this.stack=this.stack.filter(n=>n!==e),this.syncZ()}top(){return this.stack[this.stack.length-1]}closeAll(e,n){const r=new Set((Array.isArray(n)?n:n?[n]:[]).map(String)),i=new Set((Array.isArray(e)?e:e?[e]:[]).map(String));[...this.stack].reverse().forEach(s=>{const o=s.modalId,a=i.size?i.has(s.pluginName):!0,l=r.has(o);a&&!l&&s.close()})}removeAll(){[...this.stack].forEach(e=>e.destroy()),this.stack=[]}syncZ(){this.stack.forEach((e,n)=>e.setZIndex(this.zBase+n*2))}lockBodyScroll(){document.body.classList.add("ipe-modal-no-scroll")}unlockBodyScroll(){document.body.classList.remove("ipe-modal-no-scroll")}}const tt=new ap;let lp=class od{constructor(e={}){this.backdropId=fl("ipe-modal-backdrop"),this.modalId=fl("ipe-modal"),this.numberId=this.modalId.split("-")[1],this._isDestroyed=!1,this.pluginName="normalModal",this.buttonElsLeft=[],this.buttonElsRight=[],this.keyMap=new Map,this.isOpen=!1,this.isToast=!1,this.isDragging=!1,this.dragStartX=0,this.dragStartY=0,this.modalStartX=0,this.modalStartY=0,this.Event=qs,this.DEFAULT_OPTIONS={className:"",sizeClass:"auto",center:!0,fitScreen:!1,closeIcon:!0,bodyScroll:!1,outSideClose:!0,backdrop:!0,animation:!1,animationSpeed:200},this._hooks=[],this.startCloseTimer=n=>{this.stopCloseTimer(),this.closeTimer=window.setTimeout(()=>this.close(),n)},this.stopCloseTimer=()=>{this.closeTimer&&window.clearTimeout(this.closeTimer),this.closeTimer=void 0},this.onDragMove=n=>{if(!this.isDragging)return;n.preventDefault();const r=n.clientX-this.dragStartX,i=n.clientY-this.dragStartY,s=this.get$modal(),o=this.modalStartX+r,a=this.modalStartY+i;s.style.left=`${o}px`,s.style.top=`${a}px`},this.onDragEnd=()=>{if(!this.isDragging)return;this.isDragging=!1,document.removeEventListener("pointermove",this.onDragMove),document.removeEventListener("pointerup",this.onDragEnd);const n=this.get$modal(),r=this.get$window();n.classList.remove("is-dragging"),r.style.animation="none",requestAnimationFrame(()=>{this.applyAnimation(!0)})},this.options={...this.DEFAULT_OPTIONS,...e},this.options.backdrop===!1&&e.bodyScroll===void 0&&(this.options.bodyScroll=!0)}get isDestroyed(){return this._isDestroyed}init(){if(this.$modal)return this;const e=this.options.backdrop!==!1;let n;e&&(n=Ye("div",{className:"ipe-modal-backdrop",attrs:{id:this.backdropId,"data-modal-id":this.modalId}}));const r=Ye("div",{className:"ipe-modal-modal",attrs:{id:this.modalId,role:"dialog","aria-modal":"true",tabindex:"-1"}});if(r.modal=this,!e){r.classList.add("no-backdrop");const v=window.pageYOffset||document.documentElement.scrollTop,b=window.pageXOffset||document.documentElement.scrollLeft,I=window.innerWidth;r.style.top=`${v+60}px`,this.once("modal.show",()=>{r.style.left=`${b+I/2-r.offsetWidth/2}px`})}const i=Ye("div",{className:`ipe-modal-modal__window size--${this.options.sizeClass||"auto"} plugin--${this.pluginName}`});i.modal=this;const s=Ye("div",{className:"ipe-modal-modal__header"}),o=`${this.modalId}-title`,a=Ye("h2",{className:"ipe-modal-modal__title",attrs:{id:o,role:"heading","aria-level":"2"}});r.setAttribute("aria-labelledby",o);const l=Ye("div",{className:"ipe-modal-modal__icons"});if(this.options.closeIcon){const v=Ye("button",{className:"ipe-modal-modal__close",attrs:{type:"button","aria-label":"Close"},html:"&times;"});v.addEventListener("click",()=>{let b=!0;typeof this.options.onClickClose=="function"?this.options.onClickClose(this)===!1&&(b=!1):this.options.onClickClose===!1&&(b=!1),b&&this.close()}),l.appendChild(v)}s.append(a,l),!e&&this.options.draggable&&(s.style.cursor="move",s.style.userSelect="none",s.addEventListener("pointerdown",this.onDragStart.bind(this)));const c=Ye("div",{className:"ipe-modal-modal__content"}),u=Ye("div",{className:"ipe-modal-modal__footer"}),f=Ye("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--left"}),p=Ye("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--right"});return u.append(f,p),i.append(s,c,u),r.appendChild(i),this.$backdrop=n,this.$modal=r,this.$window=i,this.$header=s,this.$title=a,this.$icons=l,this.$content=c,this.$footer=u,this.$buttonsLeft=f,this.$buttonsRight=p,this.options.title&&this.setTitle(this.options.title),this.options.content&&this.setContent(this.options.content),this.options.buttons?.length?this.setButtons(this.options.buttons):u.style.display="none",this.options.center&&this.$modal.classList.add("is-centered"),this.options.fitScreen&&this.$modal.classList.add("is-fullscreen"),this.options.iconButtons&&this.$header.classList.add("has-icon-buttons"),this.options.className&&this.$window.classList.add(...this.options.className.split(/[\s\.#+]+/g).filter(Boolean)),typeof this.options.fixedHeight=="number"?this.$window.style.height=`${Math.max(0,this.options.fixedHeight)}px`:this.options.fixedHeight===!0&&this.$window.classList.add("is-fixed-height"),n&&n.addEventListener("pointerdown",v=>{this.options.outSideClose&&v.target===n&&this.close()}),this.onKeyDown=this.onKeyDown.bind(this),this.emit("modal.init"),this}show(){if(this.$modal||this.init(),!this.$modal)throw new Error("Failed to initialize modal");if(this.isOpen)return this;{const r=this.emit("modal.beforeShow",!0),i=this.options.beforeShow?this.options.beforeShow(this)!==!1:!0;if(!r||!i)return this}this.lastFocused=document.activeElement??null,this.$backdrop&&document.body.appendChild(this.$backdrop),document.body.appendChild(this.$modal),this.shouldLockBodyOnOpen()&&tt.lockBodyScroll(),requestAnimationFrame(()=>{this.$backdrop?.classList.add("is-open"),this.$modal.classList.add("is-open"),this.applyAnimation(!0),this.focusFirst()}),document.addEventListener("keydown",this.onKeyDown),tt.push(this),this.isOpen=!0,this.options.onShow?.(this),this.emit("modal.show");const e=typeof this.options.closeAfter=="number"?this.options.closeAfter:this.options.closeAfter?.time,n=typeof this.options.closeAfter=="number"?!0:this.options.closeAfter?.resetOnHover;return e&&(this.startCloseTimer(e),n&&(this.$window?.addEventListener("mouseenter",this.stopCloseTimer),this.$window?.addEventListener("mouseleave",()=>this.startCloseTimer(e)))),this}close(){if(!this.isOpen)return this;{const s=this.emit("modal.beforeClose",!0),o=this.options.beforeClose?this.options.beforeClose(this)!==!1:!0;if(!s||!o)return this}if(this.isToast){this.applyAnimation(!1),this.emit("modal.close"),this.emit("toast.close");const s=this.isAnimationDisabled()?0:this.options.animationSpeed??200;let o=!1;const a=()=>{o||(o=!0,this.destroy(),this.options.onClose?.(this))},l=(c,u)=>{const f=()=>{c.removeEventListener(u,f),a()};c.addEventListener(u,f,{once:!0})};return s>0&&this.$window?(l(this.$window,"transitionend"),l(this.$window,"animationend"),window.setTimeout(a,s+20)):window.setTimeout(a,s),this}this.applyAnimation(!1),this.$backdrop?.classList.remove("is-open"),this.$modal?.classList.remove("is-open"),this.emit("modal.close");const e=this.isAnimationDisabled()?0:this.options.animationSpeed??200;let n=!1;const r=()=>{n||(n=!0,this.destroy(),this.options.onClose?.(this))},i=(s,o)=>{const a=()=>{s.removeEventListener(o,a),r()};s.addEventListener(o,a,{once:!0})};return e>0&&this.$window?(i(this.$window,"transitionend"),i(this.$window,"animationend"),window.setTimeout(r,e+20)):window.setTimeout(r,e),this}destroy(){if(this._isDestroyed)return this;if(this.stopCloseTimer(),document.removeEventListener("keydown",this.onKeyDown),this.isDragging&&this.onDragEnd(),this.$window?.removeEventListener("mouseenter",this.stopCloseTimer),this.isToast){this.$window?.parentElement&&this.$window.parentElement.removeChild(this.$window);const e=mn.indexOf(this);e!==-1&&mn.splice(e,1)}else this.$backdrop?.parentElement&&this.$backdrop.parentElement.removeChild(this.$backdrop),this.$modal?.parentElement&&this.$modal.parentElement.removeChild(this.$modal),tt.remove(this),this.shouldUnlockBodyOnClose()&&tt.unlockBodyScroll();return this.isOpen=!1,this.lastFocused?.focus?.(),this.emit("modal.destroy"),this._isDestroyed=!0,this}get$backdrop(){return this.$backdrop}get$modal(){return Bt(this.$modal,"modal")}get$window(){return Bt(this.$window,"window")}get$header(){return Bt(this.$header,"header")}get$title(){return Bt(this.$title,"title")}get$content(){return Bt(this.$content,"content")}get$icons(){return Bt(this.$icons,"icons")}get$buttons(e){return e==="leftButtons"?Bt(this.$buttonsLeft,"leftButtons"):e==="rightButtons"?Bt(this.$buttonsRight,"rightButtons"):Bt(this.$footer,"buttons")}setTitle(e){const n=this.get$title();return n.innerHTML="",n.append(dr(e)),this}setContent(e,n="replace"){const r=this.get$content();return n==="replace"?(r.innerHTML="",r.append(dr(e))):n==="append"?r.append(dr(e)):r.prepend(dr(e)),this}setIcons(e){const n=this.get$icons();n.innerHTML="";for(const r of e){const i=Ye("button",{className:`ipe-modal-modal__icon ${r.className}`,attrs:{type:"button"}});i.addEventListener("click",r.method),n.appendChild(i)}return this}setButtons(e,n){const r=this.$buttonsLeft,i=this.$buttonsRight;[r,i].forEach(o=>o.innerHTML=""),this.buttonElsLeft=[],this.buttonElsRight=[],this.keyMap.clear();const s=n??this.$footer;if(s===this.$footer)e.forEach(o=>this.addButton(o)),e.length===0&&(this.$footer.style.display="none");else{s.innerHTML="";for(const o of e){const a=this.generateButton(o);s.appendChild(a)}}return this}generateButton(e){const n=e.type??"button",r=n==="link"?Ye("a"):Ye("button",{attrs:{type:"button"}});e.id&&(r.id=e.id),r.className=`ipe-modal-btn ${e.className??""}`.trim();const i=dr(e.label??"OK");if(r.append(i),n==="link"&&e.href&&(r.href=e.href),e.method&&r.addEventListener("click",s=>{if(r._ipe_tmpDisabled){s.preventDefault(),s.stopPropagation();return}e.method.call(r,s,this)}),typeof e.closeAfter=="number"&&e.closeAfter>=0&&r.addEventListener("click",()=>{window.setTimeout(()=>this.close(),e.closeAfter)}),typeof e.enableAfter=="number"&&e.enableAfter>0){n==="button"&&r.setAttribute("disabled","true"),r._ipe_tmpDisabled=!0,r.setAttribute("aria-disabled","true");const s=()=>{n==="button"&&r.removeAttribute("disabled"),delete r._ipe_tmpDisabled,r.removeAttribute("aria-disabled")};window.setTimeout(s,e.enableAfter)}if(e.keyPress){const s=String(e.keyPress).split(/[\,\|]+/g).map(o=>o.trim()).filter(Boolean);for(const o of s){const a=sp(o);a&&this.keyMap.set(a,r)}}return r}addButton(e,n){this.$footer&&(this.$footer.style.display="");const r=e.side??"right",i=r==="left"?this.$buttonsLeft:this.$buttonsRight,s=r==="left"?this.buttonElsLeft:this.buttonElsRight,o=this.generateButton(e),a=Math.max(0,Math.min(n??s.length,s.length));return a>=i.children.length?i.appendChild(o):i.insertBefore(o,i.children[a]),s.splice(a,0,o),this}removeButton(e){const n=this.buttonElsLeft,r=this.buttonElsRight,i=[...n,...r];let s=null;if(e==="*")return i.forEach(a=>{this.keyMap.delete(a.id),a.parentElement?.removeChild(a)}),this.$footer&&(this.$footer.style.display="none"),this;if(typeof e=="number"?s=i[e]??null:typeof e=="string"?s=i.find(a=>a.id===e)??null:e instanceof HTMLElement&&(s=i.find(a=>a===e)??null),!s)return this;for(const[a,l]of this.keyMap.entries())l===s&&this.keyMap.delete(a);let o=n.indexOf(s);return o!==-1?(n.splice(o,1),s.parentElement?.removeChild(s)):(o=r.indexOf(s),o!==-1&&(r.splice(o,1),s.parentElement?.removeChild(s))),n.length===0&&r.length===0&&this.$footer&&(this.$footer.style.display="none"),this}changePreviewState(){return this.get$modal().classList.toggle("is-fullscreen"),this}setModalHeight(e,n="height"){const r=this.get$window(),i=Math.max(0,window.innerHeight-e);return r.style[n]=`${i}px`,i}setOptions(e,n){return typeof e=="string"?this.options[e]=n:Object.assign(this.options,e),this}setPluginName(e){return this.$window&&(this.$window.className=this.$window.className.replace(`plugin--${this.pluginName}`,`plugin--${e}`)),this.pluginName=e,this}applyAnimation(e){const n=this.get$modal(),r=this.get$window(),i=this.$backdrop,s=this.options.modalAnimation??this.options.animation,o=typeof s=="string"?s:s&&(e?s.show:s.hide),a=this.options.backdropAnimation??this.options.animation,l=typeof a=="string"?a:a&&(e?a.show:a.hide);!o||o===!1?(n.style.transition="none",r.style.animation="none",r.style.removeProperty("--ipe-modal-anim")):(n.style.removeProperty("transition"),r.style.setProperty("--ipe-modal-anim",o)),i&&(!l||l===!1?i.style.transition="none":i.style.removeProperty("transition"))}on(e,n){return this._hooks.push({type:e,listener:n}),()=>this.off(e,n)}off(e,n){return this._hooks=this._hooks.filter(r=>r.type!==e&&(n?r.listener!==n:!0)),this}once(e,n){const r=this.on(e,i=>(r(),n(i)));return r}emit(e,n){const r=this._hooks.filter(a=>a.type===e);let i=!0;for(const a of r){const l=new CustomEvent(e,{detail:this,cancelable:n}),c=a.listener(l);if(l.defaultPrevented&&(i=!1),c===!1&&(i=!1),!i)break}const s=this.$modal??document.body,o=new CustomEvent(e,{detail:this,cancelable:n});return(!s.dispatchEvent(o)||o.defaultPrevented)&&(i=!1),i}focusFirst(){const e=this.get$modal(),n=dl(e);n.length?n[0].focus():e.focus({preventScroll:!0})}onKeyDown(e){if(tt.top()!==this)return;if(e.key==="Escape"){e.preventDefault(),this.close();return}const n=this.get$modal();if(!n.contains(document.activeElement))return;if(e.key==="Tab"){const a=dl(n);if(!a.length)return;const l=a[0],c=a[a.length-1],u=document.activeElement;e.shiftKey&&u===l?(e.preventDefault(),c.focus()):!e.shiftKey&&u===c&&(e.preventDefault(),l.focus())}const r=e.ctrlKey||e.altKey||e.metaKey,i=e.target;if(!r&&(i&&["INPUT","TEXTAREA"].includes(i.tagName)||i.contentEditable==="true"))return;const s=op(e),o=this.keyMap.get(s);if(o){e.preventDefault(),o.click();return}}setZIndex(e){this.$backdrop&&(this.$backdrop.style.zIndex=String(e)),this.$modal&&(this.$modal.style.zIndex=String(e+1))}bringToFront(){return tt.remove(this),tt.push(this),this}isAnimationDisabled(){const e=this.options.modalAnimation??this.options.animation;return e===!1||e==null}shouldLockBodyOnOpen(){return this.options.backdrop===!1||this.options.bodyScroll!==!1?!1:!tt.stack.some(e=>e!==this&&e.options.backdrop!==!1&&e.options.bodyScroll===!1)}shouldUnlockBodyOnClose(){return this.options.backdrop===!1||this.options.bodyScroll!==!1?!1:!tt.stack.some(e=>e!==this&&e.options.backdrop!==!1&&e.options.bodyScroll===!1)}onDragStart(e){if(this.options.backdrop!==!1||!this.options.draggable)return;e.preventDefault(),this.isDragging=!0,this.bringToFront(),this.dragStartX=e.clientX,this.dragStartY=e.clientY;const n=this.get$modal(),r=n.getBoundingClientRect();this.modalStartX=r.left+window.pageXOffset,this.modalStartY=r.top+window.pageYOffset,n.style.transform="none",n.style.left=`${this.modalStartX}px`,n.style.top=`${this.modalStartY}px`,document.addEventListener("pointermove",this.onDragMove),document.addEventListener("pointerup",this.onDragEnd),n.classList.add("is-dragging")}showToast(e){this.$window||this.init();const n=cp(e.position??"top right"),r=this.get$window();this.isToast=!0,r.style.pointerEvents="auto",this.applyAnimation(!0),n.appendChild(r);const i=(typeof this.options.closeAfter=="number"?this.options.closeAfter:this.options.closeAfter?.time)??3e3,s=(typeof this.options.closeAfter=="number"?!0:this.options.closeAfter?.resetOnHover)??!0;return i>0&&(this.startCloseTimer(i),s&&(r.addEventListener("mouseenter",this.stopCloseTimer),r.addEventListener("mouseleave",()=>this.startCloseTimer(i)))),this.isOpen=!0,this.options.onShow?.(this),mn.push(this),this.emit("toast.show"),this.emit("modal.show"),this}static show(e,n){return new this(e).init().show()}static createObject(e,n){return new this(e)}static close(e){if(!e){const s=tt.top();return s?.close(),s}const n=typeof e=="string"?e:e.id,r=tt.stack.find(s=>s.modalId===n);if(r)return r.close(),r;const i=mn.find(s=>s.modalId===n);return i?.close(),i}static closeAll(e,n){const r=new Set((Array.isArray(n)?n:n?[n]:[]).map(String)),i=new Set((Array.isArray(e)?e:e?[e]:[]).map(String));return tt.closeAll(e,n),[...mn].forEach(s=>{const o=s.modalId,a=i.size?i.has(s.pluginName):!0,l=r.has(o);a&&!l&&s.close()}),tt.top()??new od}static removeAll(){tt.removeAll(),[...mn].forEach(e=>e.destroy())}static dialog(e,n){const r=new this({sizeClass:"dialog",buttons:[{label:"OK",className:"is-primary is-ghost",method:(i,s)=>{n?.(i,s),i.defaultPrevented||r.close()},keyPress:"Enter"}],...e});return r.init().show()}static confirm(e,n){e.title??(e.title="Confirm"),e.content??(e.content="Are you sure you want to perform this action?");const r=e.okBtn??{label:"OK",className:"is-primary is-ghost"},i=e.cancelBtn??{label:"Cancel",className:"is-danger is-ghost"},s=new this({sizeClass:"dialog",...e,buttons:[{label:i.label,className:i.className,keyPress:"n",method:()=>s.close()},{label:r.label,className:r.className,keyPress:"y",method:o=>{n?.(o,s),o.defaultPrevented||s.close()}}]});return s.init().show()}static getDefaultNotifyIcon(e){switch(e){case"success":return ke("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-circle-check",children:[ke("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ke("path",{d:"M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z"})]});case"error":return ke("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-alert-triangle",children:[ke("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ke("path",{d:"M12 1.67c.955 0 1.845 .467 2.39 1.247l.105 .16l8.114 13.548a2.914 2.914 0 0 1 -2.307 4.363l-.195 .008h-16.225a2.914 2.914 0 0 1 -2.582 -4.2l.099 -.185l8.11 -13.538a2.914 2.914 0 0 1 2.491 -1.403zm.01 13.33l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -7a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z"})]});case"warning":return ke("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-alert-circle",children:[ke("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ke("path",{d:"M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm.01 13l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -8a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z"})]});case"info":return ke("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-info-circle",children:[ke("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ke("path",{d:"M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm0 9h-1l-.117 .007a1 1 0 0 0 0 1.986l.117 .007v3l.007 .117a1 1 0 0 0 .876 .876l.117 .007h1l.117 -.007a1 1 0 0 0 .876 -.876l.007 -.117l-.007 -.117a1 1 0 0 0 -.764 -.857l-.112 -.02l-.117 -.006v-3l-.007 -.117a1 1 0 0 0 -.876 -.876l-.117 -.007zm.01 -3l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007z"})]});case"dialog":return ke("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-message-dots",children:[ke("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ke("path",{d:"M12 11v.01"}),ke("path",{d:"M8 11v.01"}),ke("path",{d:"M16 11v.01"}),ke("path",{d:"M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3z"})]});case"confirm":return ke("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-copy-check",children:[ke("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ke("path",{d:"M18.333 6a3.667 3.667 0 0 1 3.667 3.667v8.666a3.667 3.667 0 0 1 -3.667 3.667h-8.666a3.667 3.667 0 0 1 -3.667 -3.667v-8.666a3.667 3.667 0 0 1 3.667 -3.667zm-3.333 -4c1.094 0 1.828 .533 2.374 1.514a1 1 0 1 1 -1.748 .972c-.221 -.398 -.342 -.486 -.626 -.486h-10c-.548 0 -1 .452 -1 1v9.998c0 .32 .154 .618 .407 .805l.1 .065a1 1 0 1 1 -.99 1.738a3 3 0 0 1 -1.517 -2.606v-10c0 -1.652 1.348 -3 3 -3zm1.293 9.293l-3.293 3.292l-1.293 -1.292a1 1 0 0 0 -1.414 1.414l2 2a1 1 0 0 0 1.414 0l4 -4a1 1 0 0 0 -1.414 -1.414"})]});default:return null}}static notify(e,n,r){var a,l,c,u;if(n?.overrideOther&&[...mn].forEach(f=>f.close()),typeof n.title>"u"){const f=e||"Notification";n.title=f[0].toUpperCase()+f.slice(1).toLowerCase()}const i=n.icon??this.getDefaultNotifyIcon(e);i&&(i instanceof Element&&i.classList.add("ipe-modal-notify-icon"),n.title=ke(Xh,{children:[i,n.title]})),n.okBtn&&((a=n.okBtn).label??(a.label="OK"),(l=n.okBtn).className??(l.className="is-primary is-ghost ok-btn"),n.okBtn.method=()=>{r?.(!0),o.close()}),n.cancelBtn&&((c=n.cancelBtn).label??(c.label="Cancel"),(u=n.cancelBtn).className??(u.className="is-danger is-ghost cancel-btn"),n.cancelBtn.method=()=>{r?.(!1),o.close()}),n.buttons=[n.cancelBtn,n.okBtn,...n.buttons??[]].filter(Boolean);const s=`is-notify type-${e||"default"} ${n.className??""}`,o=new this({...n,className:s,sizeClass:"auto",center:!1,fitScreen:!1,closeIcon:!0,outSideClose:!1,bodyScroll:!0,animation:n.animation??{show:"fadeIn",hide:"fadeOut"},buttons:n.buttons??[]});return o.setPluginName("toast"),o.showToast({position:n.position??"top right"})}};const mn=[];function cp(t="top right"){const e="ipe-modal-toast-container",n=`${e}-${t.replace(/[\s-\.|\/]+/g,"-")}`;let r=document.getElementById(n);return r||(r=Ye("div",{className:`${e} ${t}`,attrs:{id:n,"data-position":t}}),document.body.appendChild(r)),r}const up={ipe_progress:"_ipe_progress_so6hn_1"},Xt=t=>{const e=t.indeterminate??!0,n=w("div",{class:`${up.ipe_progress}`,"data-indeterminate":`${e}`,style:{width:"100%","--progress":t.progress?`${t.progress}%`:"0%"},...t});return n.setProgress=r=>{typeof r=="number"?(n.dataset.indeterminate="false",n.style.setProperty("--progress",`${r}%`)):(n.dataset.indeterminate="true",n.style.setProperty("--progress","0%"))},n};class je extends lp{constructor(e={}){e.className||(e.className=""),e.className+=" theme-ipe",e.modalAnimation||(e.modalAnimation={show:"ipe-modal-fade-in",hide:"ipe-modal-fade-out"}),super(e)}setLoadingState(e){if(this.get$window().classList.toggle("loading",e),e){const n=this.get$window().querySelectorAll("input:not([disabled]),button:not([disabled])");this._tmpDisabledActiveInputs=n,n.forEach(r=>{r.disabled=!0}),this.get$content().append(w("div",{id:"ipe-modalLoadingWrapper",style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"rgba(255, 255, 255, 0.5)",zIndex:2e3},children:w(Xt,{style:{width:"80%",maxWidth:"800px"}})}))}else{this.get$window().querySelector("#ipe-modalLoadingWrapper")?.remove();const n=this._tmpDisabledActiveInputs;n&&n.forEach(r=>{r.disabled=!1})}}}class fp{constructor(e){this.ctx=e,this.IPEModal=je,this.IPEModalEvent=qs,this.show=je.show.bind(je),this.createObject=je.createObject.bind(je),this.close=je.close.bind(je),this.closeAll=je.closeAll.bind(je),this.removeAll=je.removeAll.bind(je),this.dialog=je.dialog.bind(je),this.confirm=je.confirm.bind(je),this.notify=je.notify.bind(je),e.set("modal",this)}}const pl=t=>{if(!t)return new URLSearchParams;if(t instanceof URLSearchParams)return t;if(typeof t!="object"||t?.constructor!==Object)throw new TypeError("only plain object is supported");const e=new URLSearchParams;for(const[n,r]of Object.entries(t))if(r!=null){if(Array.isArray(r)){for(const i of r)e.append(n,i?.toString());continue}if(typeof r=="object"&&r!==null&&r.constructor===Object){for(const[i,s]of Object.entries(r))s!=null&&e.set(`${n}[${i}]`,s?.toString());continue}e.set(n,r?.toString())}return e},ml=(t,e,n)=>{const r=typeof t=="string"?new URL(t,window?.location?.origin):new URL(t),i=new URLSearchParams(r.search),s=pl(e);for(const[o,a]of s.entries())i.set(o,a);return r.search=i.toString(),r.hash="",r};var dp=Object.create,zs=Object.defineProperty,hp=Object.getOwnPropertyDescriptor,gl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),vl=t=>{throw TypeError(t)},pp=(t,e,n)=>e in t?zs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,mp=(t,e)=>zs(t,"name",{value:e,configurable:!0}),gp=t=>[,,,dp(t?.[gl("metadata")]??null)],vp=["class","method","getter","setter","accessor","field","value","get","set"],yl=t=>t!==void 0&&typeof t!="function"?vl("Function expected"):t,yp=(t,e,n,r,i)=>({kind:vp[t],name:e,metadata:r,addInitializer:s=>n._?vl("Already initialized"):i.push(yl(s||null))}),bp=(t,e)=>pp(e,gl("metadata"),t[3]),wp=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},_p=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,p=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&hp(i,n));mp(i,n);for(var b=r.length-1;b>=0;b--)l=yp(c,n,a={},t[3],p),o=(0,r[b])(i,l),a._=1,yl(o)&&(i=o);return bp(t,i),v&&zs(i,n,v),u?c^4?s:v:i},bl,Hs,wl;bl=[We(["api","storage"])];class di extends(wl=Jt){constructor(e){super(e,"wiki",!1),this.ctx=e,this._data=void 0,this.CACHE_TTL=1e3*60*60*24,this.VERSION=2,this.db=void 0,this.logger=void 0,this.queryData={meta:"siteinfo|userinfo",siprop:"general|specialpagealiases|namespacealiases|namespaces|magicwords",uiprop:"groups|rights|blockinfo|options"},this.mwConfig={get:(n,r)=>window?.mw?.config?.get?.(n,r)??r,has:n=>window?.mw?.config?.exists?.(n)??!1,get values(){return window?.mw?.config?.values||{}}},this.db=e.storage.createDatabse("wiki-metadata",this.CACHE_TTL,this.VERSION),this.logger=e.logger("WIKI_METADATA")}get api(){return this.ctx.api}async start(){const e=await this.fetchFromCache();if(e)this._data=e,this.logger.debug("Using cached");else{const n=await this.fetchFromApi();this.saveToCache(n),this._data=n,this.logger.debug("Fetched from API")}this.logger.info("loaded",this._data),this.ctx.set("getUrl",this.getUrl.bind(this)),this.ctx.set("getSciprtUrl",this.getSciprtUrl.bind(this)),this.ctx.set("getMainpageUrl",this.getMainpageUrl.bind(this)),this.ctx.inject(["preferences"],n=>{n.preferences.registerCustomConfig("WikiMetadataService",fe.object({WikiMetadataService:fe.const(w("div",{children:[w("h3",{children:"Wiki Informations"}),w("ul",{children:[w("li",{children:[w("strong",{children:"Site:"})," ",this.general.sitename," (",this.landingPageUrl,")"]}),w("li",{children:[w("strong",{children:"User"}),": ",this.userInfo.name," (ID: ",this.userInfo.id,")"]}),w("li",{children:[w("strong",{children:"Groups"}),": ",this.userGroups.join(", ")||"None"]})]}),w("p",{children:w("button",{onClick:r=>{r.preventDefault(),this.invalidateCache().then(()=>{window.location.reload()})},children:"Clear caches and reload page"})})]})).role("raw-html")}).description("WikiMetadataService"),"general",{})})}computeSiteIdentity(){let e;if(!window.mw?.config)e=new URL(location.href).origin;else{const{wgServer:n,wgArticlePath:r}=window.mw.config.get();e=`${n}${r}`}return Reflect.defineProperty(this,"computeSiteIdentity",{get:()=>e}),e}async fetchFromApi(){return this.api.get({action:"query",...this.queryData}).then(({data:e})=>{if(typeof e?.query?.general>"u")throw new Error("Invalid siteinfo");return e.query}).catch(e=>(this.logger.error("Failed to fetch metadata",e),Promise.reject(e)))}async fetchFromCache(){const e=this.computeSiteIdentity(),n=this.mwConfig.get("wgUserId",0),r=await this.db.get(e);return r&&typeof r=="object"&&r.general&&r.userinfo.id===n?r:(this.logger.info(r?"Cache mis-match":"Missing cache"),this.invalidateCache(),null)}async saveToCache(e){const n=this.computeSiteIdentity();return this.db.set(n,e)}async invalidateCache(){const e=this.computeSiteIdentity();return this.db.delete(e)}get _raw(){return this._data}get general(){return this._data.general}get specialPageAliases(){return this._data.specialpagealiases}get namespaceAliases(){return this._data.namespacealiases}get namespaces(){return this._data.namespaces}get namespaceMap(){const e=Object.values(this.namespaces).map(n=>({id:n.id,canonical:n.canonical,aliases:this.namespaceAliases.filter(r=>r.id===n.id).map(r=>r.alias)})).sort((n,r)=>n.id-r.id);return Reflect.defineProperty(this,"namespaceMap",{get:()=>e}),e}get magicWords(){return this._data.magicwords}get userInfo(){return this._data.userinfo}get userOptions(){return this.userInfo.options}get isUserBlocked(){return this.userInfo.blockedbyid&&this.userInfo.blockexpiry&&new Date(this.userInfo.blockexpiry).getTime()>Date.now()}get userGroups(){return this.userInfo.groups}get userRights(){return this.userInfo.rights}get baseUrl(){const e=this.general.server;return e.startsWith("//")?`${window?.location?.protocol||"https:"}//${e.slice(2)}`:e}get landingPageUrl(){return this.general.base}get mainPageName(){return this.general.mainpage}get mainPageUrl(){return this.getUrl(this.mainPageName)}get articlePath(){return this.general.articlepath}get scriptPath(){return this.general.scriptpath}get articleBaseUrl(){return`${this.baseUrl}${this.articlePath}`}get scriptBaseUrl(){return`${this.baseUrl}${this.scriptPath}`}getSciprtUrl(e="index"){return`${this.scriptBaseUrl}/${e.replace(/\.php$/,"")}.php`}getMainpageUrl(e){return ml(this._data.general.base,e).toString()}getUrl(e,n){const r=pl(n);let i;return typeof e=="string"&&e!==""?i=new URL(`${this.articleBaseUrl.replace("$1",e)}`):typeof e=="number"?(r.set("curid",e.toString()),i=new URL(this.getSciprtUrl("index"))):i=new URL(this.getSciprtUrl("index")),i.search=r.toString(),i.toString()}hasRight(e){return this.userRights.includes(e)}hasAnyRight(...e){return e.some(n=>this.hasRight(n))}hasEveryRights(...e){return e.every(n=>this.hasRight(n))}inGroup(e){return this.userGroups.includes(e)}inAnyGroup(...e){return this.userGroups.some(n=>e.includes(n))}getBlockInfo(){return this.isUserBlocked?{blockid:this.userInfo.blockid,blockedby:this.userInfo.blockedbyid,blockedbyid:this.userInfo.blockedbyid,blockreason:this.userInfo.blockreason,blockedtimestamp:this.userInfo.blockedtimestamp,blockexpiry:this.userInfo.blockexpiry}:null}}Hs=gp(wl),di=_p(Hs,0,"WikiMetadataService",bl,di),wp(Hs,1,di);var hi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xp(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function pi(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ws={exports:{}};/*!
46
+ */class oh extends Ya{async clientLogin(e,n,r){r||(r={}),!r.logincontinue&&!r.loginreturnurl&&(r.loginreturnurl=location?.origin);const i=await this.postWithToken("login",{action:"clientlogin",username:e,password:n,...r},{tokenName:"logintoken"});if(i?.data?.clientlogin?.status==="PASS")return i.data.clientlogin;throw new ri(Ga.LOGIN_FAILED,i.data.clientlogin.message,i)}}class ah{constructor(e,n={}){this.ctx=e,n?.baseURL?.startsWith("/")&&(n.baseURL=new URL(n.baseURL,location.origin).href);const r=new oh({baseURL:n.baseURL,fexiosConfigs:{headers:{"x-api-user-agent":`InPageEdit-NEXT ${e.version}`,...n.headers},...n},throwOnApiError:!0});e.set("api",r)}}var lh=Object.create,Is=Object.defineProperty,ch=Object.getOwnPropertyDescriptor,Qa=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ja=t=>{throw TypeError(t)},uh=(t,e,n)=>e in t?Is(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,fh=(t,e)=>Is(t,"name",{value:e,configurable:!0}),dh=t=>[,,,lh(t?.[Qa("metadata")]??null)],hh=["class","method","getter","setter","accessor","field","value","get","set"],Xa=t=>t!==void 0&&typeof t!="function"?Ja("Function expected"):t,ph=(t,e,n,r,i)=>({kind:hh[t],name:e,metadata:r,addInitializer:s=>n._?Ja("Already initialized"):i.push(Xa(s||null))}),mh=(t,e)=>uh(e,Qa("metadata"),t[3]),gh=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},vh=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,y=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&ch(i,n));fh(i,n);for(var b=r.length-1;b>=0;b--)l=ph(c,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,Xa(o)&&(i=o);return mh(t,i),v&&Is(i,n,v),u?c^4?s:v:i},Za,Os,el;Za=[We(["wiki","wikiTitle"])];class ii extends(el=Jt){constructor(n){super(n,"currentPage",!1);ir(this,Ve);this.ctx=n,this.logger=this.ctx.logger("CURRENT_PAGE"),this.url=new URL(window.location.href),this.isMainPage=void 0,this.wikiTitle=void 0,this.wikiAction=void 0}async start(){await ht(this,Ve,$a).call(this),ht(this,Ve,nd).call(this),window.addEventListener("popstate",ht(this,Ve,Ca).bind(this)),this.logger.info("initialized",this.wikiTitle)}stop(){window.removeEventListener("popstate",ht(this,Ve,Ca).bind(this))}get params(){return this.url.searchParams}get canonicalUrl(){const n=document.querySelector('link[rel="canonical"]')?.href;let r=null;return n&&(r=new URL(n,location.origin)),Reflect.defineProperty(this,"canonicalUrl",{get:()=>r}),r}}Ve=new WeakSet,$a=async function(){await ht(this,Ve,id).call(this),await ht(this,Ve,sd).call(this),await ht(this,Ve,rd).call(this)},nd=function(){const n=Symbol.for("InPageEdit.CurrentPageService.UrlChangeListenerInstalled");if(window[n])return;const r=history.pushState,i=history.replaceState;history.pushState=function(s,o,a){r.apply(this,[s,o,a]),window.dispatchEvent(new PopStateEvent("popstate",{state:s}))},history.replaceState=function(s,o,a){i.apply(this,[s,o,a]),window.dispatchEvent(new PopStateEvent("popstate",{state:s}))},window[n]=!0},Ca=async function(n){const r=this.url,i=new URL(window.location.href);this.url=i,(r.pathname!==i.pathname||r.searchParams.get("title")!==i.searchParams.get("title")||r.searchParams.get("curid")!==i.searchParams.get("curid"))&&(await ht(this,Ve,$a).call(this),this.logger.info("location changed",i,this.wikiTitle))},rd=async function(){const r=this.wikiTitle?.getMainDBKey()===this.ctx.wiki.mainPageName;return Reflect.defineProperty(this,"isMainPage",{get:()=>r}),r},id=async function(){let n=null;return this.canonicalUrl?n=await this.ctx.wikiTitle.newTitleFromUrl(this.canonicalUrl):n=await this.ctx.wikiTitle.newTitleFromUrl(this.url),Object.freeze(n),Reflect.defineProperty(this,"wikiTitle",{get:()=>n}),n},sd=async function(){const n=this.params.get("action")||"view";return Reflect.defineProperty(this,"wikiAction",{get:()=>n}),this.wikiAction},Os=dh(el),ii=vh(Os,0,"CurrentPageService",Za,ii),gh(Os,1,ii);class yh extends Jt{constructor(e){super(e,"resourceLoader",!0),this.ctx=e}stop(){}loadScript(e,n){if(!e)return Promise.resolve(null);const r=`script:${e}`,i=document.querySelector(`[data-ipe="${r}"]`);return i?Promise.resolve(i):new Promise((o,a)=>{const l=document.createElement("script");l.src=e,l.dataset.ipe=r,n&&Object.entries(n).forEach(([c,u])=>{typeof u>"u"||u===!1||u===null?l.removeAttribute(c):l.setAttribute(c,u)}),document.body.appendChild(l),l.onload=()=>o(l),l.onerror=c=>a(c)})}loadStyle(e,n){if(!e)return Promise.resolve(null);const r=`style:${e}`,i=document.querySelector(`[data-ipe="${r}"]`);return i?Promise.resolve(i):new Promise((o,a)=>{const l=document.createElement("link");l.rel="stylesheet",l.href=e,l.dataset.ipe=r,n&&Object.entries(n).forEach(([u,f])=>{typeof f>"u"||f===!1||f===null?l.removeAttribute(u):l.setAttribute(u,f)}),(document.querySelector('meta[name="ipe-styles"]')||(()=>{const u=document.createElement("meta");return u.id="ipe-styles",u.name="ipe-styles",document.head.insertAdjacentElement("afterbegin",u),u})()).before(l),l.onload=()=>o(l),l.onerror=u=>a(u)})}resolveImportPath(e){if(e.startsWith("http")||e.startsWith("//"))return e;const n=document.currentScript?.src;if(!n)return`https://unpkg.com/mediawiki-inpageedit@latest/dist/${e}`;const r=new URL(n);return r.pathname.endsWith(".js")||(r.pathname=r.pathname+"/"),new URL(e,r.toString()).toString()}}const si=Object.keys;function bh(t){return typeof t=="boolean"}function wh(t){return t&&typeof t.nodeType=="number"}function oi(t){return typeof t=="string"}function tl(t){return typeof t=="number"}function hn(t){return typeof t=="object"?t!==null:ur(t)}function ur(t){return typeof t=="function"}function _h(t){return!!(t&&t.isComponent)}function xh(t){return hn(t)&&typeof t.length=="number"&&typeof t.nodeType!="number"}function As(t,e){if(t)for(const n of si(t))e(t[n],n)}function Sh(t){return hn(t)&&"current"in t}const Rs={animationIterationCount:0,borderImageOutset:0,borderImageSlice:0,borderImageWidth:0,boxFlex:0,boxFlexGroup:0,boxOrdinalGroup:0,columnCount:0,columns:0,flex:0,flexGrow:0,flexPositive:0,flexShrink:0,flexNegative:0,flexOrder:0,gridArea:0,gridRow:0,gridRowEnd:0,gridRowSpan:0,gridRowStart:0,gridColumn:0,gridColumnEnd:0,gridColumnSpan:0,gridColumnStart:0,fontWeight:0,lineClamp:0,lineHeight:0,opacity:0,order:0,orphans:0,tabSize:0,widows:0,zIndex:0,zoom:0,fillOpacity:0,floodOpacity:0,stopOpacity:0,strokeDasharray:0,strokeDashoffset:0,strokeMiterlimit:0,strokeOpacity:0,strokeWidth:0};function Eh(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}const kh=["Webkit","ms","Moz","O"];si(Rs).forEach(t=>{kh.forEach(e=>{Rs[Eh(e,t)]=0})});const Ph=Symbol.for("jsx-dom:type");var nl=function(t){return t.ShadowRoot="ShadowRoot",t}(nl||{});function $h(t){return t!=null&&t[Ph]===nl.ShadowRoot}const Ch="http://www.w3.org/2000/svg",Th="http://www.w3.org/1999/xlink",Ih="http://www.w3.org/XML/1998/namespace";function rl(t){return!bh(t)&&t!=null}function Ns(t){return Array.isArray(t)?t.map(Ns).filter(Boolean).join(" "):hn(t)?Symbol.iterator in t?Ns(Array.from(t)):si(t).filter(e=>t[e]).join(" "):rl(t)?""+t:""}const Oh={animate:0,circle:0,clipPath:0,defs:0,desc:0,ellipse:0,feBlend:0,feColorMatrix:0,feComponentTransfer:0,feComposite:0,feConvolveMatrix:0,feDiffuseLighting:0,feDisplacementMap:0,feDistantLight:0,feFlood:0,feFuncA:0,feFuncB:0,feFuncG:0,feFuncR:0,feGaussianBlur:0,feImage:0,feMerge:0,feMergeNode:0,feMorphology:0,feOffset:0,fePointLight:0,feSpecularLighting:0,feSpotLight:0,feTile:0,feTurbulence:0,filter:0,foreignObject:0,g:0,image:0,line:0,linearGradient:0,marker:0,mask:0,metadata:0,path:0,pattern:0,polygon:0,polyline:0,radialGradient:0,rect:0,stop:0,svg:0,switch:0,symbol:0,text:0,textPath:0,tspan:0,use:0,view:0},Ah=/^(a(ll|t|u)|base[FP]|c(al|lipPathU|on)|di|ed|ex|filter[RU]|g(lyphR|r)|ke|l(en|im)|ma(rker[HUW]|s)|n|pat|pr|point[^e]|re[^n]|s[puy]|st[^or]|ta|textL|vi|xC|y|z)/;function Ft(t){const e=document.createDocumentFragment();return ai(t.children,e),e}function Rh(t,e,n){e={...e,children:n};const r=new t(e),i=r.render();return"ref"in e&&Ds(e.ref,r),i}function w(t,e){let{children:n,...r}=e;!r.namespaceURI&&Oh[t]===0&&(r={...r,namespaceURI:Ch});let i;if(oi(t)){if(i=r.namespaceURI?document.createElementNS(r.namespaceURI,t):document.createElement(t),Mh(r,i),ai(n,i),i instanceof window.HTMLSelectElement&&r.value!=null)if(r.multiple===!0&&Array.isArray(r.value)){const s=r.value.map(o=>String(o));i.querySelectorAll("option").forEach(o=>o.selected=s.includes(o.value))}else i.value=r.value;Ds(r.ref,i)}else if(ur(t))hn(t.defaultProps)&&(r={...t.defaultProps,...r}),i=_h(t)?Rh(t,r,n):t({...r,children:n});else throw new TypeError(`Invalid JSX element type: ${t}`);return i}function Nh(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return(oi(e)||Array.isArray(e))&&(r.unshift(e),e={}),e=e||{},e.children!=null&&!r.length&&({children:r,...e}=e),w(t,{...e,children:r},e.key)}function Ds(t,e){Sh(t)?t.current=e:ur(t)&&t(e)}function ai(t,e){if(xh(t))Dh(t,e);else if(oi(t)||tl(t))Ls(document.createTextNode(t),e);else if(t===null)Ls(document.createComment(""),e);else if(wh(t))Ls(t,e);else if($h(t)){const n=e.attachShadow(t.attr);ai(t.children,n),Ds(t.ref,n)}}function Dh(t,e){for(const n of[...t])ai(n,e);return e}function Ls(t,e){e instanceof window.HTMLTemplateElement?e.content.appendChild(t):e.appendChild(t)}function li(t,e){return t.replace(/[A-Z]/g,n=>e+n.toLowerCase())}function il(t,e){e==null||e===!1||(Array.isArray(e)?e.forEach(n=>il(t,n)):oi(e)?t.setAttribute("style",e):hn(e)&&As(e,(n,r)=>{r.indexOf("-")===0?t.style.setProperty(r,n):tl(n)&&Rs[r]!==0?t.style[r]=n+"px":t.style[r]=n}))}function Lh(t,e,n){switch(t){case"xlinkActuate":case"xlinkArcrole":case"xlinkHref":case"xlinkRole":case"xlinkShow":case"xlinkTitle":case"xlinkType":sl(n,Th,li(t,":"),e);return;case"xmlnsXlink":Cn(n,li(t,":"),e);return;case"xmlBase":case"xmlLang":case"xmlSpace":sl(n,Ih,li(t,":"),e);return}switch(t){case"htmlFor":Cn(n,"for",e);return;case"dataset":As(e,(r,i)=>{r!=null&&(n.dataset[i]=r)});return;case"innerHTML":case"innerText":case"textContent":rl(e)&&(n[t]=e);return;case"dangerouslySetInnerHTML":hn(e)&&(n.innerHTML=e.__html);return;case"value":if(e==null||n instanceof window.HTMLSelectElement)return;if(n instanceof window.HTMLTextAreaElement){n.value=e;return}break;case"spellCheck":n.spellcheck=e;return;case"class":case"className":ur(e)?e(n):Cn(n,"class",Ns(e));return;case"ref":case"namespaceURI":return;case"style":il(n,e);return;case"on":case"onCapture":As(e,(r,i)=>{n.addEventListener(i,r,t==="onCapture")});return}if(ur(e)){if(t[0]==="o"&&t[1]==="n"){let r=t.toLowerCase();const i=r.endsWith("capture");if(r==="ondoubleclick"?r="ondblclick":i&&r==="ondoubleclickcapture"&&(r="ondblclickcapture"),!i&&n[r]===null)n[r]=e;else if(i)n.addEventListener(r.substring(2,r.length-7),e,!0);else{let s;r in window?s=r.substring(2):s=r[2]+t.slice(3),n.addEventListener(s,e)}}}else hn(e)?n[t]=e:e===!0?Cn(n,t,""):e!==!1&&e!=null&&(n instanceof SVGElement&&!Ah.test(t)?Cn(n,li(t,"-"),e):Cn(n,t,e))}function Cn(t,e,n){t.setAttribute(e,n)}function sl(t,e,n,r){t.setAttributeNS(e,n,r)}function Mh(t,e){for(const n of si(t))Lh(n,t[n],e);return e}const ci=Object.keys;function jh(t){return typeof t=="boolean"}function Fh(t){return t&&typeof t.nodeType=="number"}function Ms(t){return typeof t=="string"}function ol(t){return typeof t=="number"}function pn(t){return typeof t=="object"?t!==null:fr(t)}function fr(t){return typeof t=="function"}function Bh(t){return!!(t&&t.isComponent)}function Uh(t){return pn(t)&&typeof t.length=="number"&&typeof t.nodeType!="number"}function js(t,e){if(t)for(const n of ci(t))e(t[n],n)}function qh(t){return pn(t)&&"current"in t}const Fs={animationIterationCount:0,borderImageOutset:0,borderImageSlice:0,borderImageWidth:0,boxFlex:0,boxFlexGroup:0,boxOrdinalGroup:0,columnCount:0,columns:0,flex:0,flexGrow:0,flexPositive:0,flexShrink:0,flexNegative:0,flexOrder:0,gridArea:0,gridRow:0,gridRowEnd:0,gridRowSpan:0,gridRowStart:0,gridColumn:0,gridColumnEnd:0,gridColumnSpan:0,gridColumnStart:0,fontWeight:0,lineClamp:0,lineHeight:0,opacity:0,order:0,orphans:0,tabSize:0,widows:0,zIndex:0,zoom:0,fillOpacity:0,floodOpacity:0,stopOpacity:0,strokeDasharray:0,strokeDashoffset:0,strokeMiterlimit:0,strokeOpacity:0,strokeWidth:0};function zh(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}const Hh=["Webkit","ms","Moz","O"];ci(Fs).forEach(t=>{Hh.forEach(e=>{Fs[zh(e,t)]=0})});const Wh=Symbol.for("jsx-dom:type");var al=function(t){return t.ShadowRoot="ShadowRoot",t}(al||{});function Kh(t){return t!=null&&t[Wh]===al.ShadowRoot}const Vh="http://www.w3.org/2000/svg",Yh="http://www.w3.org/1999/xlink",Gh="http://www.w3.org/XML/1998/namespace";function ll(t){return!jh(t)&&t!=null}function Bs(t){return Array.isArray(t)?t.map(Bs).filter(Boolean).join(" "):pn(t)?Symbol.iterator in t?Bs(Array.from(t)):ci(t).filter(e=>t[e]).join(" "):ll(t)?""+t:""}const Qh={animate:0,circle:0,clipPath:0,defs:0,desc:0,ellipse:0,feBlend:0,feColorMatrix:0,feComponentTransfer:0,feComposite:0,feConvolveMatrix:0,feDiffuseLighting:0,feDisplacementMap:0,feDistantLight:0,feFlood:0,feFuncA:0,feFuncB:0,feFuncG:0,feFuncR:0,feGaussianBlur:0,feImage:0,feMerge:0,feMergeNode:0,feMorphology:0,feOffset:0,fePointLight:0,feSpecularLighting:0,feSpotLight:0,feTile:0,feTurbulence:0,filter:0,foreignObject:0,g:0,image:0,line:0,linearGradient:0,marker:0,mask:0,metadata:0,path:0,pattern:0,polygon:0,polyline:0,radialGradient:0,rect:0,stop:0,svg:0,switch:0,symbol:0,text:0,textPath:0,tspan:0,use:0,view:0},Jh=/^(a(ll|t|u)|base[FP]|c(al|lipPathU|on)|di|ed|ex|filter[RU]|g(lyphR|r)|ke|l(en|im)|ma(rker[HUW]|s)|n|pat|pr|point[^e]|re[^n]|s[puy]|st[^or]|ta|textL|vi|xC|y|z)/;function Xh(t){const e=document.createDocumentFragment();return ui(t.children,e),e}function Zh(t,e,n){e={...e,children:n};const r=new t(e),i=r.render();return"ref"in e&&Us(e.ref,r),i}function ke(t,e){let{children:n,...r}=e;!r.namespaceURI&&Qh[t]===0&&(r={...r,namespaceURI:Vh});let i;if(Ms(t)){if(i=r.namespaceURI?document.createElementNS(r.namespaceURI,t):document.createElement(t),np(r,i),ui(n,i),i instanceof window.HTMLSelectElement&&r.value!=null)if(r.multiple===!0&&Array.isArray(r.value)){const s=r.value.map(o=>String(o));i.querySelectorAll("option").forEach(o=>o.selected=s.includes(o.value))}else i.value=r.value;Us(r.ref,i)}else if(fr(t))pn(t.defaultProps)&&(r={...t.defaultProps,...r}),i=Bh(t)?Zh(t,r,n):t({...r,children:n});else throw new TypeError(`Invalid JSX element type: ${t}`);return i}function Us(t,e){qh(t)?t.current=e:fr(t)&&t(e)}function ui(t,e){if(Uh(t))ep(t,e);else if(Ms(t)||ol(t))qs(document.createTextNode(t),e);else if(t===null)qs(document.createComment(""),e);else if(Fh(t))qs(t,e);else if(Kh(t)){const n=e.attachShadow(t.attr);ui(t.children,n),Us(t.ref,n)}}function ep(t,e){for(const n of[...t])ui(n,e);return e}function qs(t,e){e instanceof window.HTMLTemplateElement?e.content.appendChild(t):e.appendChild(t)}function fi(t,e){return t.replace(/[A-Z]/g,n=>e+n.toLowerCase())}function cl(t,e){e==null||e===!1||(Array.isArray(e)?e.forEach(n=>cl(t,n)):Ms(e)?t.setAttribute("style",e):pn(e)&&js(e,(n,r)=>{r.indexOf("-")===0?t.style.setProperty(r,n):ol(n)&&Fs[r]!==0?t.style[r]=n+"px":t.style[r]=n}))}function tp(t,e,n){switch(t){case"xlinkActuate":case"xlinkArcrole":case"xlinkHref":case"xlinkRole":case"xlinkShow":case"xlinkTitle":case"xlinkType":ul(n,Yh,fi(t,":"),e);return;case"xmlnsXlink":Tn(n,fi(t,":"),e);return;case"xmlBase":case"xmlLang":case"xmlSpace":ul(n,Gh,fi(t,":"),e);return}switch(t){case"htmlFor":Tn(n,"for",e);return;case"dataset":js(e,(r,i)=>{r!=null&&(n.dataset[i]=r)});return;case"innerHTML":case"innerText":case"textContent":ll(e)&&(n[t]=e);return;case"dangerouslySetInnerHTML":pn(e)&&(n.innerHTML=e.__html);return;case"value":if(e==null||n instanceof window.HTMLSelectElement)return;if(n instanceof window.HTMLTextAreaElement){n.value=e;return}break;case"spellCheck":n.spellcheck=e;return;case"class":case"className":fr(e)?e(n):Tn(n,"class",Bs(e));return;case"ref":case"namespaceURI":return;case"style":cl(n,e);return;case"on":case"onCapture":js(e,(r,i)=>{n.addEventListener(i,r,t==="onCapture")});return}if(fr(e)){if(t[0]==="o"&&t[1]==="n"){let r=t.toLowerCase();const i=r.endsWith("capture");if(r==="ondoubleclick"?r="ondblclick":i&&r==="ondoubleclickcapture"&&(r="ondblclickcapture"),!i&&n[r]===null)n[r]=e;else if(i)n.addEventListener(r.substring(2,r.length-7),e,!0);else{let s;r in window?s=r.substring(2):s=r[2]+t.slice(3),n.addEventListener(s,e)}}}else pn(e)?n[t]=e:e===!0?Tn(n,t,""):e!==!1&&e!=null&&(n instanceof SVGElement&&!Jh.test(t)?Tn(n,fi(t,"-"),e):Tn(n,t,e))}function Tn(t,e,n){t.setAttribute(e,n)}function ul(t,e,n,r){t.setAttributeNS(e,n,r)}function np(t,e){for(const n of ci(t))tp(n,t[n],e);return e}var zs=(t=>(t.Init="modal.init",t.BeforeShow="modal.beforeShow",t.Show="modal.show",t.BeforeClose="modal.beforeClose",t.Close="modal.close",t.Destroy="modal.destroy",t.ToastShow="toast.show",t.ToastClose="toast.close",t))(zs||{});let rp=0;const fl=t=>`${t}-${++rp}`;function dr(t){return t instanceof Node?t:document.createTextNode(String(t))}function Bt(t,e){if(!t)throw new Error(`${e??"Element"} not found`);return t}function dl(t){const e=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(t.querySelectorAll(e)).filter(n=>!!(n.offsetWidth||n.offsetHeight||n.getClientRects().length))}function Ye(t,e={}){const n=document.createElement(t);if(e.className&&(n.className=e.className),e.html!=null&&(n.innerHTML=e.html),e.text!=null&&(n.textContent=e.text),e.attrs)for(const[r,i]of Object.entries(e.attrs))n.setAttribute(r,i);return n}const ip=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/i.test(navigator.platform),hl=["ctrl","alt","shift","meta"];function sp(t){if(!t)return null;const e=String(t).trim().toLowerCase().split(/[+\-\s]+/g).filter(Boolean),n=[];let r=null;const i=o=>{n.includes(o)||n.push(o)};for(const o of e){let a=o;if(a==="control"||a==="ctrl"){i("ctrl");continue}if(a==="alt"||a==="option"){i("alt");continue}if(a==="shift"){i("shift");continue}if(a==="meta"||a==="cmd"||a==="command"||a==="super"){i("meta");continue}if(a==="mod"){i(ip?"meta":"ctrl");continue}a==="esc"&&(a="escape"),a==="return"&&(a="enter"),(a==="space"||a==="spacebar")&&(a="space"),r=a}const s=hl.filter(o=>n.includes(o));return!r||r===""?s.length?s.join("+"):null:s.length?`${s.join("+")}+${r}`:r}function op(t){const e=[];t.ctrlKey&&e.push("ctrl"),t.altKey&&e.push("alt"),t.shiftKey&&e.push("shift"),t.metaKey&&e.push("meta");let n=t.key;n===" "&&(n="space");const r=(n.length,n.toLowerCase()),i=hl.filter(s=>e.includes(s));return i.length?`${i.join("+")}+${r}`:r}class ap{constructor(){this.zBase=1e3,this.stack=[]}push(e){this.stack.push(e),this.syncZ()}remove(e){this.stack=this.stack.filter(n=>n!==e),this.syncZ()}top(){return this.stack[this.stack.length-1]}closeAll(e,n){const r=new Set((Array.isArray(n)?n:n?[n]:[]).map(String)),i=new Set((Array.isArray(e)?e:e?[e]:[]).map(String));[...this.stack].reverse().forEach(s=>{const o=s.modalId,a=i.size?i.has(s.pluginName):!0,l=r.has(o);a&&!l&&s.close()})}removeAll(){[...this.stack].forEach(e=>e.destroy()),this.stack=[]}syncZ(){this.stack.forEach((e,n)=>e.setZIndex(this.zBase+n*2))}lockBodyScroll(){document.body.classList.add("ipe-modal-no-scroll")}unlockBodyScroll(){document.body.classList.remove("ipe-modal-no-scroll")}}const tt=new ap;let lp=class od{constructor(e={}){this.backdropId=fl("ipe-modal-backdrop"),this.modalId=fl("ipe-modal"),this.numberId=this.modalId.split("-")[1],this._isDestroyed=!1,this.pluginName="normalModal",this.buttonElsLeft=[],this.buttonElsRight=[],this.keyMap=new Map,this.isOpen=!1,this.isToast=!1,this.isDragging=!1,this.dragStartX=0,this.dragStartY=0,this.modalStartX=0,this.modalStartY=0,this.Event=zs,this.DEFAULT_OPTIONS={className:"",sizeClass:"auto",center:!0,fitScreen:!1,closeIcon:!0,bodyScroll:!1,outSideClose:!0,backdrop:!0,animation:!1,animationSpeed:200},this._hooks=[],this.startCloseTimer=n=>{this.stopCloseTimer(),this.closeTimer=window.setTimeout(()=>this.close(),n)},this.stopCloseTimer=()=>{this.closeTimer&&window.clearTimeout(this.closeTimer),this.closeTimer=void 0},this.onDragMove=n=>{if(!this.isDragging)return;n.preventDefault();const r=n.clientX-this.dragStartX,i=n.clientY-this.dragStartY,s=this.get$modal(),o=this.modalStartX+r,a=this.modalStartY+i;s.style.left=`${o}px`,s.style.top=`${a}px`},this.onDragEnd=()=>{if(!this.isDragging)return;this.isDragging=!1,document.removeEventListener("pointermove",this.onDragMove),document.removeEventListener("pointerup",this.onDragEnd);const n=this.get$modal(),r=this.get$window();n.classList.remove("is-dragging"),r.style.animation="none",requestAnimationFrame(()=>{this.applyAnimation(!0)})},this.options={...this.DEFAULT_OPTIONS,...e},this.options.backdrop===!1&&e.bodyScroll===void 0&&(this.options.bodyScroll=!0)}get isDestroyed(){return this._isDestroyed}init(){if(this.$modal)return this;const e=this.options.backdrop!==!1;let n;e&&(n=Ye("div",{className:"ipe-modal-backdrop",attrs:{id:this.backdropId,"data-modal-id":this.modalId}}));const r=Ye("div",{className:"ipe-modal-modal",attrs:{id:this.modalId,role:"dialog","aria-modal":"true",tabindex:"-1"}});if(r.modal=this,!e){r.classList.add("no-backdrop");const v=window.pageYOffset||document.documentElement.scrollTop,b=window.pageXOffset||document.documentElement.scrollLeft,I=window.innerWidth;r.style.top=`${v+60}px`,this.once("modal.show",()=>{r.style.left=`${b+I/2-r.offsetWidth/2}px`})}const i=Ye("div",{className:`ipe-modal-modal__window size--${this.options.sizeClass||"auto"} plugin--${this.pluginName}`});i.modal=this;const s=Ye("div",{className:"ipe-modal-modal__header"}),o=`${this.modalId}-title`,a=Ye("h2",{className:"ipe-modal-modal__title",attrs:{id:o,role:"heading","aria-level":"2"}});r.setAttribute("aria-labelledby",o);const l=Ye("div",{className:"ipe-modal-modal__icons"});if(this.options.closeIcon){const v=Ye("button",{className:"ipe-modal-modal__close",attrs:{type:"button","aria-label":"Close"},html:"&times;"});v.addEventListener("click",()=>{let b=!0;typeof this.options.onClickClose=="function"?this.options.onClickClose(this)===!1&&(b=!1):this.options.onClickClose===!1&&(b=!1),b&&this.close()}),l.appendChild(v)}s.append(a,l),!e&&this.options.draggable&&(s.style.cursor="move",s.style.userSelect="none",s.addEventListener("pointerdown",this.onDragStart.bind(this)));const c=Ye("div",{className:"ipe-modal-modal__content"}),u=Ye("div",{className:"ipe-modal-modal__footer"}),f=Ye("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--left"}),y=Ye("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--right"});return u.append(f,y),i.append(s,c,u),r.appendChild(i),this.$backdrop=n,this.$modal=r,this.$window=i,this.$header=s,this.$title=a,this.$icons=l,this.$content=c,this.$footer=u,this.$buttonsLeft=f,this.$buttonsRight=y,this.options.title&&this.setTitle(this.options.title),this.options.content&&this.setContent(this.options.content),this.options.buttons?.length?this.setButtons(this.options.buttons):u.style.display="none",this.options.center&&this.$modal.classList.add("is-centered"),this.options.fitScreen&&this.$modal.classList.add("is-fullscreen"),this.options.iconButtons&&this.$header.classList.add("has-icon-buttons"),this.options.className&&this.$window.classList.add(...this.options.className.split(/[\s\.#+]+/g).filter(Boolean)),typeof this.options.fixedHeight=="number"?this.$window.style.height=`${Math.max(0,this.options.fixedHeight)}px`:this.options.fixedHeight===!0&&this.$window.classList.add("is-fixed-height"),n&&n.addEventListener("pointerdown",v=>{this.options.outSideClose&&v.target===n&&this.close()}),this.onKeyDown=this.onKeyDown.bind(this),this.emit("modal.init"),this}show(){if(this.$modal||this.init(),!this.$modal)throw new Error("Failed to initialize modal");if(this.isOpen)return this;{const r=this.emit("modal.beforeShow",!0),i=this.options.beforeShow?this.options.beforeShow(this)!==!1:!0;if(!r||!i)return this}this.lastFocused=document.activeElement??null,this.$backdrop&&document.body.appendChild(this.$backdrop),document.body.appendChild(this.$modal),this.shouldLockBodyOnOpen()&&tt.lockBodyScroll(),requestAnimationFrame(()=>{this.$backdrop?.classList.add("is-open"),this.$modal.classList.add("is-open"),this.applyAnimation(!0),this.focusFirst()}),document.addEventListener("keydown",this.onKeyDown),tt.push(this),this.isOpen=!0,this.options.onShow?.(this),this.emit("modal.show");const e=typeof this.options.closeAfter=="number"?this.options.closeAfter:this.options.closeAfter?.time,n=typeof this.options.closeAfter=="number"?!0:this.options.closeAfter?.resetOnHover;return e&&(this.startCloseTimer(e),n&&(this.$window?.addEventListener("mouseenter",this.stopCloseTimer),this.$window?.addEventListener("mouseleave",()=>this.startCloseTimer(e)))),this}close(){if(!this.isOpen)return this;{const s=this.emit("modal.beforeClose",!0),o=this.options.beforeClose?this.options.beforeClose(this)!==!1:!0;if(!s||!o)return this}if(this.isToast){this.applyAnimation(!1),this.emit("modal.close"),this.emit("toast.close");const s=this.isAnimationDisabled()?0:this.options.animationSpeed??200;let o=!1;const a=()=>{o||(o=!0,this.destroy(),this.options.onClose?.(this))},l=(c,u)=>{const f=()=>{c.removeEventListener(u,f),a()};c.addEventListener(u,f,{once:!0})};return s>0&&this.$window?(l(this.$window,"transitionend"),l(this.$window,"animationend"),window.setTimeout(a,s+20)):window.setTimeout(a,s),this}this.applyAnimation(!1),this.$backdrop?.classList.remove("is-open"),this.$modal?.classList.remove("is-open"),this.emit("modal.close");const e=this.isAnimationDisabled()?0:this.options.animationSpeed??200;let n=!1;const r=()=>{n||(n=!0,this.destroy(),this.options.onClose?.(this))},i=(s,o)=>{const a=()=>{s.removeEventListener(o,a),r()};s.addEventListener(o,a,{once:!0})};return e>0&&this.$window?(i(this.$window,"transitionend"),i(this.$window,"animationend"),window.setTimeout(r,e+20)):window.setTimeout(r,e),this}destroy(){if(this._isDestroyed)return this;if(this.stopCloseTimer(),document.removeEventListener("keydown",this.onKeyDown),this.isDragging&&this.onDragEnd(),this.$window?.removeEventListener("mouseenter",this.stopCloseTimer),this.isToast){this.$window?.parentElement&&this.$window.parentElement.removeChild(this.$window);const e=mn.indexOf(this);e!==-1&&mn.splice(e,1)}else this.$backdrop?.parentElement&&this.$backdrop.parentElement.removeChild(this.$backdrop),this.$modal?.parentElement&&this.$modal.parentElement.removeChild(this.$modal),tt.remove(this),this.shouldUnlockBodyOnClose()&&tt.unlockBodyScroll();return this.isOpen=!1,this.lastFocused?.focus?.(),this.emit("modal.destroy"),this._isDestroyed=!0,this}get$backdrop(){return this.$backdrop}get$modal(){return Bt(this.$modal,"modal")}get$window(){return Bt(this.$window,"window")}get$header(){return Bt(this.$header,"header")}get$title(){return Bt(this.$title,"title")}get$content(){return Bt(this.$content,"content")}get$icons(){return Bt(this.$icons,"icons")}get$buttons(e){return e==="leftButtons"?Bt(this.$buttonsLeft,"leftButtons"):e==="rightButtons"?Bt(this.$buttonsRight,"rightButtons"):Bt(this.$footer,"buttons")}setTitle(e){const n=this.get$title();return n.innerHTML="",n.append(dr(e)),this}setContent(e,n="replace"){const r=this.get$content();return n==="replace"?(r.innerHTML="",r.append(dr(e))):n==="append"?r.append(dr(e)):r.prepend(dr(e)),this}setIcons(e){const n=this.get$icons();n.innerHTML="";for(const r of e){const i=Ye("button",{className:`ipe-modal-modal__icon ${r.className}`,attrs:{type:"button"}});i.addEventListener("click",r.method),n.appendChild(i)}return this}setButtons(e,n){const r=this.$buttonsLeft,i=this.$buttonsRight;[r,i].forEach(o=>o.innerHTML=""),this.buttonElsLeft=[],this.buttonElsRight=[],this.keyMap.clear();const s=n??this.$footer;if(s===this.$footer)e.forEach(o=>this.addButton(o)),e.length===0&&(this.$footer.style.display="none");else{s.innerHTML="";for(const o of e){const a=this.generateButton(o);s.appendChild(a)}}return this}generateButton(e){const n=e.type??"button",r=n==="link"?Ye("a"):Ye("button",{attrs:{type:"button"}});e.id&&(r.id=e.id),r.className=`ipe-modal-btn ${e.className??""}`.trim();const i=dr(e.label??"OK");if(r.append(i),n==="link"&&e.href&&(r.href=e.href),e.method&&r.addEventListener("click",s=>{if(r._ipe_tmpDisabled){s.preventDefault(),s.stopPropagation();return}e.method.call(r,s,this)}),typeof e.closeAfter=="number"&&e.closeAfter>=0&&r.addEventListener("click",()=>{window.setTimeout(()=>this.close(),e.closeAfter)}),typeof e.enableAfter=="number"&&e.enableAfter>0){n==="button"&&r.setAttribute("disabled","true"),r._ipe_tmpDisabled=!0,r.setAttribute("aria-disabled","true");const s=()=>{n==="button"&&r.removeAttribute("disabled"),delete r._ipe_tmpDisabled,r.removeAttribute("aria-disabled")};window.setTimeout(s,e.enableAfter)}if(e.keyPress){const s=String(e.keyPress).split(/[\,\|]+/g).map(o=>o.trim()).filter(Boolean);for(const o of s){const a=sp(o);a&&this.keyMap.set(a,r)}}return r}addButton(e,n){this.$footer&&(this.$footer.style.display="");const r=e.side??"right",i=r==="left"?this.$buttonsLeft:this.$buttonsRight,s=r==="left"?this.buttonElsLeft:this.buttonElsRight,o=this.generateButton(e),a=Math.max(0,Math.min(n??s.length,s.length));return a>=i.children.length?i.appendChild(o):i.insertBefore(o,i.children[a]),s.splice(a,0,o),this}removeButton(e){const n=this.buttonElsLeft,r=this.buttonElsRight,i=[...n,...r];let s=null;if(e==="*")return i.forEach(a=>{this.keyMap.delete(a.id),a.parentElement?.removeChild(a)}),this.$footer&&(this.$footer.style.display="none"),this;if(typeof e=="number"?s=i[e]??null:typeof e=="string"?s=i.find(a=>a.id===e)??null:e instanceof HTMLElement&&(s=i.find(a=>a===e)??null),!s)return this;for(const[a,l]of this.keyMap.entries())l===s&&this.keyMap.delete(a);let o=n.indexOf(s);return o!==-1?(n.splice(o,1),s.parentElement?.removeChild(s)):(o=r.indexOf(s),o!==-1&&(r.splice(o,1),s.parentElement?.removeChild(s))),n.length===0&&r.length===0&&this.$footer&&(this.$footer.style.display="none"),this}changePreviewState(){return this.get$modal().classList.toggle("is-fullscreen"),this}setModalHeight(e,n="height"){const r=this.get$window(),i=Math.max(0,window.innerHeight-e);return r.style[n]=`${i}px`,i}setOptions(e,n){return typeof e=="string"?this.options[e]=n:Object.assign(this.options,e),this}setPluginName(e){return this.$window&&(this.$window.className=this.$window.className.replace(`plugin--${this.pluginName}`,`plugin--${e}`)),this.pluginName=e,this}applyAnimation(e){const n=this.get$modal(),r=this.get$window(),i=this.$backdrop,s=this.options.modalAnimation??this.options.animation,o=typeof s=="string"?s:s&&(e?s.show:s.hide),a=this.options.backdropAnimation??this.options.animation,l=typeof a=="string"?a:a&&(e?a.show:a.hide);!o||o===!1?(n.style.transition="none",r.style.animation="none",r.style.removeProperty("--ipe-modal-anim")):(n.style.removeProperty("transition"),r.style.setProperty("--ipe-modal-anim",o)),i&&(!l||l===!1?i.style.transition="none":i.style.removeProperty("transition"))}on(e,n){return this._hooks.push({type:e,listener:n}),()=>this.off(e,n)}off(e,n){return this._hooks=this._hooks.filter(r=>r.type!==e&&(n?r.listener!==n:!0)),this}once(e,n){const r=this.on(e,i=>(r(),n(i)));return r}emit(e,n){const r=this._hooks.filter(a=>a.type===e);let i=!0;for(const a of r){const l=new CustomEvent(e,{detail:this,cancelable:n}),c=a.listener(l);if(l.defaultPrevented&&(i=!1),c===!1&&(i=!1),!i)break}const s=this.$modal??document.body,o=new CustomEvent(e,{detail:this,cancelable:n});return(!s.dispatchEvent(o)||o.defaultPrevented)&&(i=!1),i}focusFirst(){const e=this.get$modal(),n=dl(e);n.length?n[0].focus():e.focus({preventScroll:!0})}onKeyDown(e){if(tt.top()!==this)return;if(e.key==="Escape"){e.preventDefault(),this.close();return}const n=this.get$modal();if(!n.contains(document.activeElement))return;if(e.key==="Tab"){const a=dl(n);if(!a.length)return;const l=a[0],c=a[a.length-1],u=document.activeElement;e.shiftKey&&u===l?(e.preventDefault(),c.focus()):!e.shiftKey&&u===c&&(e.preventDefault(),l.focus())}const r=e.ctrlKey||e.altKey||e.metaKey,i=e.target;if(!r&&(i&&["INPUT","TEXTAREA"].includes(i.tagName)||i.contentEditable==="true"))return;const s=op(e),o=this.keyMap.get(s);if(o){e.preventDefault(),o.click();return}}setZIndex(e){this.$backdrop&&(this.$backdrop.style.zIndex=String(e)),this.$modal&&(this.$modal.style.zIndex=String(e+1))}bringToFront(){return tt.remove(this),tt.push(this),this}isAnimationDisabled(){const e=this.options.modalAnimation??this.options.animation;return e===!1||e==null}shouldLockBodyOnOpen(){return this.options.backdrop===!1||this.options.bodyScroll!==!1?!1:!tt.stack.some(e=>e!==this&&e.options.backdrop!==!1&&e.options.bodyScroll===!1)}shouldUnlockBodyOnClose(){return this.options.backdrop===!1||this.options.bodyScroll!==!1?!1:!tt.stack.some(e=>e!==this&&e.options.backdrop!==!1&&e.options.bodyScroll===!1)}onDragStart(e){if(this.options.backdrop!==!1||!this.options.draggable)return;e.preventDefault(),this.isDragging=!0,this.bringToFront(),this.dragStartX=e.clientX,this.dragStartY=e.clientY;const n=this.get$modal(),r=n.getBoundingClientRect();this.modalStartX=r.left+window.pageXOffset,this.modalStartY=r.top+window.pageYOffset,n.style.transform="none",n.style.left=`${this.modalStartX}px`,n.style.top=`${this.modalStartY}px`,document.addEventListener("pointermove",this.onDragMove),document.addEventListener("pointerup",this.onDragEnd),n.classList.add("is-dragging")}showToast(e){this.$window||this.init();const n=cp(e.position??"top right"),r=this.get$window();this.isToast=!0,r.style.pointerEvents="auto",this.applyAnimation(!0),n.appendChild(r);const i=(typeof this.options.closeAfter=="number"?this.options.closeAfter:this.options.closeAfter?.time)??3e3,s=(typeof this.options.closeAfter=="number"?!0:this.options.closeAfter?.resetOnHover)??!0;return i>0&&(this.startCloseTimer(i),s&&(r.addEventListener("mouseenter",this.stopCloseTimer),r.addEventListener("mouseleave",()=>this.startCloseTimer(i)))),this.isOpen=!0,this.options.onShow?.(this),mn.push(this),this.emit("toast.show"),this.emit("modal.show"),this}static show(e,n){return new this(e).init().show()}static createObject(e,n){return new this(e)}static close(e){if(!e){const s=tt.top();return s?.close(),s}const n=typeof e=="string"?e:e.id,r=tt.stack.find(s=>s.modalId===n);if(r)return r.close(),r;const i=mn.find(s=>s.modalId===n);return i?.close(),i}static closeAll(e,n){const r=new Set((Array.isArray(n)?n:n?[n]:[]).map(String)),i=new Set((Array.isArray(e)?e:e?[e]:[]).map(String));return tt.closeAll(e,n),[...mn].forEach(s=>{const o=s.modalId,a=i.size?i.has(s.pluginName):!0,l=r.has(o);a&&!l&&s.close()}),tt.top()??new od}static removeAll(){tt.removeAll(),[...mn].forEach(e=>e.destroy())}static dialog(e,n){const r=new this({sizeClass:"dialog",buttons:[{label:"OK",className:"is-primary is-ghost",method:(i,s)=>{n?.(i,s),i.defaultPrevented||r.close()},keyPress:"Enter"}],...e});return r.init().show()}static confirm(e,n){e.title??(e.title="Confirm"),e.content??(e.content="Are you sure you want to perform this action?");const r=e.okBtn??{label:"OK",className:"is-primary is-ghost"},i=e.cancelBtn??{label:"Cancel",className:"is-danger is-ghost"},s=new this({sizeClass:"dialog",...e,buttons:[{label:i.label,className:i.className,keyPress:"n",method:()=>s.close()},{label:r.label,className:r.className,keyPress:"y",method:o=>{n?.(o,s),o.defaultPrevented||s.close()}}]});return s.init().show()}static getDefaultNotifyIcon(e){switch(e){case"success":return ke("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-circle-check",children:[ke("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ke("path",{d:"M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z"})]});case"error":return ke("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-alert-triangle",children:[ke("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ke("path",{d:"M12 1.67c.955 0 1.845 .467 2.39 1.247l.105 .16l8.114 13.548a2.914 2.914 0 0 1 -2.307 4.363l-.195 .008h-16.225a2.914 2.914 0 0 1 -2.582 -4.2l.099 -.185l8.11 -13.538a2.914 2.914 0 0 1 2.491 -1.403zm.01 13.33l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -7a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z"})]});case"warning":return ke("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-alert-circle",children:[ke("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ke("path",{d:"M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm.01 13l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -8a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z"})]});case"info":return ke("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-info-circle",children:[ke("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ke("path",{d:"M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm0 9h-1l-.117 .007a1 1 0 0 0 0 1.986l.117 .007v3l.007 .117a1 1 0 0 0 .876 .876l.117 .007h1l.117 -.007a1 1 0 0 0 .876 -.876l.007 -.117l-.007 -.117a1 1 0 0 0 -.764 -.857l-.112 -.02l-.117 -.006v-3l-.007 -.117a1 1 0 0 0 -.876 -.876l-.117 -.007zm.01 -3l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007z"})]});case"dialog":return ke("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-message-dots",children:[ke("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ke("path",{d:"M12 11v.01"}),ke("path",{d:"M8 11v.01"}),ke("path",{d:"M16 11v.01"}),ke("path",{d:"M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3z"})]});case"confirm":return ke("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-copy-check",children:[ke("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ke("path",{d:"M18.333 6a3.667 3.667 0 0 1 3.667 3.667v8.666a3.667 3.667 0 0 1 -3.667 3.667h-8.666a3.667 3.667 0 0 1 -3.667 -3.667v-8.666a3.667 3.667 0 0 1 3.667 -3.667zm-3.333 -4c1.094 0 1.828 .533 2.374 1.514a1 1 0 1 1 -1.748 .972c-.221 -.398 -.342 -.486 -.626 -.486h-10c-.548 0 -1 .452 -1 1v9.998c0 .32 .154 .618 .407 .805l.1 .065a1 1 0 1 1 -.99 1.738a3 3 0 0 1 -1.517 -2.606v-10c0 -1.652 1.348 -3 3 -3zm1.293 9.293l-3.293 3.292l-1.293 -1.292a1 1 0 0 0 -1.414 1.414l2 2a1 1 0 0 0 1.414 0l4 -4a1 1 0 0 0 -1.414 -1.414"})]});default:return null}}static notify(e,n,r){var a,l,c,u;if(n?.overrideOther&&[...mn].forEach(f=>f.close()),typeof n.title>"u"){const f=e||"Notification";n.title=f[0].toUpperCase()+f.slice(1).toLowerCase()}const i=n.icon??this.getDefaultNotifyIcon(e);i&&(i instanceof Element&&i.classList.add("ipe-modal-notify-icon"),n.title=ke(Xh,{children:[i,n.title]})),n.okBtn&&((a=n.okBtn).label??(a.label="OK"),(l=n.okBtn).className??(l.className="is-primary is-ghost ok-btn"),n.okBtn.method=()=>{r?.(!0),o.close()}),n.cancelBtn&&((c=n.cancelBtn).label??(c.label="Cancel"),(u=n.cancelBtn).className??(u.className="is-danger is-ghost cancel-btn"),n.cancelBtn.method=()=>{r?.(!1),o.close()}),n.buttons=[n.cancelBtn,n.okBtn,...n.buttons??[]].filter(Boolean);const s=`is-notify type-${e||"default"} ${n.className??""}`,o=new this({...n,className:s,sizeClass:"auto",center:!1,fitScreen:!1,closeIcon:!0,outSideClose:!1,bodyScroll:!0,animation:n.animation??{show:"fadeIn",hide:"fadeOut"},buttons:n.buttons??[]});return o.setPluginName("toast"),o.showToast({position:n.position??"top right"})}};const mn=[];function cp(t="top right"){const e="ipe-modal-toast-container",n=`${e}-${t.replace(/[\s-\.|\/]+/g,"-")}`;let r=document.getElementById(n);return r||(r=Ye("div",{className:`${e} ${t}`,attrs:{id:n,"data-position":t}}),document.body.appendChild(r)),r}const up={ipe_progress:"_ipe_progress_so6hn_1"},Xt=t=>{const e=t.indeterminate??!0,n=w("div",{class:`${up.ipe_progress}`,"data-indeterminate":`${e}`,style:{width:"100%","--progress":t.progress?`${t.progress}%`:"0%"},...t});return n.setProgress=r=>{typeof r=="number"?(n.dataset.indeterminate="false",n.style.setProperty("--progress",`${r}%`)):(n.dataset.indeterminate="true",n.style.setProperty("--progress","0%"))},n};class je extends lp{constructor(e={}){e.className||(e.className=""),e.className+=" theme-ipe",e.modalAnimation||(e.modalAnimation={show:"ipe-modal-fade-in",hide:"ipe-modal-fade-out"}),super(e)}setLoadingState(e){if(this.get$window().classList.toggle("loading",e),e){const n=this.get$window().querySelectorAll("input:not([disabled]),button:not([disabled])");this._tmpDisabledActiveInputs=n,n.forEach(r=>{r.disabled=!0}),this.get$content().append(w("div",{id:"ipe-modalLoadingWrapper",style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"rgba(255, 255, 255, 0.5)",zIndex:2e3},children:w(Xt,{style:{width:"80%",maxWidth:"800px"}})}))}else{this.get$window().querySelector("#ipe-modalLoadingWrapper")?.remove();const n=this._tmpDisabledActiveInputs;n&&n.forEach(r=>{r.disabled=!1})}}}class fp{constructor(e){this.ctx=e,this.IPEModal=je,this.IPEModalEvent=zs,this.show=je.show.bind(je),this.createObject=je.createObject.bind(je),this.close=je.close.bind(je),this.closeAll=je.closeAll.bind(je),this.removeAll=je.removeAll.bind(je),this.dialog=je.dialog.bind(je),this.confirm=je.confirm.bind(je),this.notify=je.notify.bind(je),e.set("modal",this)}}const pl=t=>{if(!t)return new URLSearchParams;if(t instanceof URLSearchParams)return t;if(typeof t!="object"||t?.constructor!==Object)throw new TypeError("only plain object is supported");const e=new URLSearchParams;for(const[n,r]of Object.entries(t))if(r!=null){if(Array.isArray(r)){for(const i of r)e.append(n,i?.toString());continue}if(typeof r=="object"&&r!==null&&r.constructor===Object){for(const[i,s]of Object.entries(r))s!=null&&e.set(`${n}[${i}]`,s?.toString());continue}e.set(n,r?.toString())}return e},ml=(t,e,n)=>{const r=typeof t=="string"?new URL(t,window?.location?.origin):new URL(t),i=new URLSearchParams(r.search),s=pl(e);for(const[o,a]of s.entries())i.set(o,a);return r.search=i.toString(),r.hash="",r};var dp=Object.create,Hs=Object.defineProperty,hp=Object.getOwnPropertyDescriptor,gl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),vl=t=>{throw TypeError(t)},pp=(t,e,n)=>e in t?Hs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,mp=(t,e)=>Hs(t,"name",{value:e,configurable:!0}),gp=t=>[,,,dp(t?.[gl("metadata")]??null)],vp=["class","method","getter","setter","accessor","field","value","get","set"],yl=t=>t!==void 0&&typeof t!="function"?vl("Function expected"):t,yp=(t,e,n,r,i)=>({kind:vp[t],name:e,metadata:r,addInitializer:s=>n._?vl("Already initialized"):i.push(yl(s||null))}),bp=(t,e)=>pp(e,gl("metadata"),t[3]),wp=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},_p=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,y=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&hp(i,n));mp(i,n);for(var b=r.length-1;b>=0;b--)l=yp(c,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,yl(o)&&(i=o);return bp(t,i),v&&Hs(i,n,v),u?c^4?s:v:i},bl,Ws,wl;bl=[We(["api","storage"])];class di extends(wl=Jt){constructor(e){super(e,"wiki",!1),this.ctx=e,this._data=void 0,this.CACHE_TTL=1e3*60*60*24,this.VERSION=2,this.db=void 0,this.logger=void 0,this.queryData={meta:"siteinfo|userinfo",siprop:"general|specialpagealiases|namespacealiases|namespaces|magicwords",uiprop:"groups|rights|blockinfo|options"},this.mwConfig={get:(n,r)=>window?.mw?.config?.get?.(n,r)??r,has:n=>window?.mw?.config?.exists?.(n)??!1,get values(){return window?.mw?.config?.values||{}}},this.db=e.storage.createDatabse("wiki-metadata",this.CACHE_TTL,this.VERSION),this.logger=e.logger("WIKI_METADATA")}get api(){return this.ctx.api}async start(){const e=await this.fetchFromCache();if(e)this._data=e,this.logger.debug("Using cached");else{const n=await this.fetchFromApi();this.saveToCache(n),this._data=n,this.logger.debug("Fetched from API")}this.logger.info("loaded",this._data),this.ctx.set("getUrl",this.getUrl.bind(this)),this.ctx.set("getSciprtUrl",this.getSciprtUrl.bind(this)),this.ctx.set("getMainpageUrl",this.getMainpageUrl.bind(this)),this.ctx.inject(["preferences"],n=>{n.preferences.registerCustomConfig("WikiMetadataService",fe.object({WikiMetadataService:fe.const(w("div",{children:[w("h3",{children:"Wiki Informations"}),w("ul",{children:[w("li",{children:[w("strong",{children:"Site:"})," ",this.general.sitename," (",this.landingPageUrl,")"]}),w("li",{children:[w("strong",{children:"User"}),": ",this.userInfo.name," (ID: ",this.userInfo.id,")"]}),w("li",{children:[w("strong",{children:"Groups"}),": ",this.userGroups.join(", ")||"None"]})]}),w("p",{children:w("button",{onClick:r=>{r.preventDefault(),this.invalidateCache().then(()=>{window.location.reload()})},children:"Clear caches and reload page"})})]})).role("raw-html")}).description("WikiMetadataService"),"general",{})})}get metadataCacheId(){return this.ctx.api.config.baseURL}async fetchFromApi(){return this.api.get({action:"query",...this.queryData}).then(({data:e})=>{if(typeof e?.query?.general>"u")throw new Error("Invalid siteinfo");return e.query}).catch(e=>(this.logger.error("Failed to fetch metadata",e),Promise.reject(e)))}async fetchFromCache(){const e=this.metadataCacheId,n=this.mwConfig.get("wgUserId",0),r=await this.db.get(e);return r&&typeof r=="object"&&r.general&&r.userinfo.id===n?r:(this.logger.info(r?"Cache mis-match":"Missing cache"),this.invalidateCache(),null)}async saveToCache(e){const n=this.metadataCacheId;return this.db.set(n,e)}async invalidateCache(){const e=this.metadataCacheId;return this.db.delete(e)}get _raw(){return this._data}get general(){return this._data.general}get specialPageAliases(){return this._data.specialpagealiases}get namespaceAliases(){return this._data.namespacealiases}get namespaces(){return this._data.namespaces}get namespaceMap(){const e=Object.values(this.namespaces).map(n=>({id:n.id,canonical:n.canonical,aliases:this.namespaceAliases.filter(r=>r.id===n.id).map(r=>r.alias)})).sort((n,r)=>n.id-r.id);return Reflect.defineProperty(this,"namespaceMap",{get:()=>e}),e}get magicWords(){return this._data.magicwords}get userInfo(){return this._data.userinfo}get userOptions(){return this.userInfo.options}get isUserBlocked(){return this.userInfo.blockedbyid&&this.userInfo.blockexpiry&&new Date(this.userInfo.blockexpiry).getTime()>Date.now()}get userGroups(){return this.userInfo.groups}get userRights(){return this.userInfo.rights}get baseUrl(){const e=this.general.server;return e.startsWith("//")?`${window?.location?.protocol||"https:"}//${e.slice(2)}`:e}get landingPageUrl(){return this.general.base}get mainPageName(){return this.general.mainpage}get mainPageUrl(){return this.getUrl(this.mainPageName)}get articlePath(){return this.general.articlepath}get scriptPath(){return this.general.scriptpath}get articleBaseUrl(){return`${this.baseUrl}${this.articlePath}`}get scriptBaseUrl(){return`${this.baseUrl}${this.scriptPath}`}getSciprtUrl(e="index"){return`${this.scriptBaseUrl}/${e.replace(/\.php$/,"")}.php`}getMainpageUrl(e){return ml(this._data.general.base,e).toString()}getUrl(e,n){const r=pl(n);let i;return typeof e=="string"&&e!==""?i=new URL(`${this.articleBaseUrl.replace("$1",e)}`):typeof e=="number"?(r.set("curid",e.toString()),i=new URL(this.getSciprtUrl("index"))):i=new URL(this.getSciprtUrl("index")),i.search=r.toString(),i.toString()}hasRight(e){return this.userRights.includes(e)}hasAnyRight(...e){return e.some(n=>this.hasRight(n))}hasEveryRights(...e){return e.every(n=>this.hasRight(n))}inGroup(e){return this.userGroups.includes(e)}inAnyGroup(...e){return this.userGroups.some(n=>e.includes(n))}getBlockInfo(){return this.isUserBlocked?{blockid:this.userInfo.blockid,blockedby:this.userInfo.blockedbyid,blockedbyid:this.userInfo.blockedbyid,blockreason:this.userInfo.blockreason,blockedtimestamp:this.userInfo.blockedtimestamp,blockexpiry:this.userInfo.blockexpiry}:null}}Ws=gp(wl),di=_p(Ws,0,"WikiMetadataService",bl,di),wp(Ws,1,di);var hi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xp(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function pi(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ks={exports:{}};/*!
47
47
  localForage -- Offline Storage, Improved
48
48
  Version 1.10.0
49
49
  https://localforage.github.io/localForage
50
50
  (c) 2013-2017 Mozilla, Apache License 2.0
51
- */var _l;function Sp(){return _l||(_l=1,function(t,e){(function(n){t.exports=n()})(function(){return function n(r,i,s){function o(c,u){if(!i[c]){if(!r[c]){var f=typeof pi=="function"&&pi;if(!u&&f)return f(c,!0);if(a)return a(c,!0);var p=new Error("Cannot find module '"+c+"'");throw p.code="MODULE_NOT_FOUND",p}var v=i[c]={exports:{}};r[c][0].call(v.exports,function(b){var I=r[c][1][b];return o(I||b)},v,v.exports,n,r,i,s)}return i[c].exports}for(var a=typeof pi=="function"&&pi,l=0;l<s.length;l++)o(s[l]);return o}({1:[function(n,r,i){(function(s){var o=s.MutationObserver||s.WebKitMutationObserver,a;if(o){var l=0,c=new o(b),u=s.document.createTextNode("");c.observe(u,{characterData:!0}),a=function(){u.data=l=++l%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var f=new s.MessageChannel;f.port1.onmessage=b,a=function(){f.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?a=function(){var B=s.document.createElement("script");B.onreadystatechange=function(){b(),B.onreadystatechange=null,B.parentNode.removeChild(B),B=null},s.document.documentElement.appendChild(B)}:a=function(){setTimeout(b,0)};var p,v=[];function b(){p=!0;for(var B,D,A=v.length;A;){for(D=v,v=[],B=-1;++B<A;)D[B]();A=v.length}p=!1}r.exports=I;function I(B){v.push(B)===1&&!p&&a()}}).call(this,typeof hi<"u"?hi:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,r,i){var s=n(1);function o(){}var a={},l=["REJECTED"],c=["FULFILLED"],u=["PENDING"];r.exports=f;function f(h){if(typeof h!="function")throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,h!==o&&I(this,h)}f.prototype.catch=function(h){return this.then(null,h)},f.prototype.then=function(h,S){if(typeof h!="function"&&this.state===c||typeof S!="function"&&this.state===l)return this;var T=new this.constructor(o);if(this.state!==u){var R=this.state===c?h:S;v(T,R,this.outcome)}else this.queue.push(new p(T,h,S));return T};function p(h,S,T){this.promise=h,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof T=="function"&&(this.onRejected=T,this.callRejected=this.otherCallRejected)}p.prototype.callFulfilled=function(h){a.resolve(this.promise,h)},p.prototype.otherCallFulfilled=function(h){v(this.promise,this.onFulfilled,h)},p.prototype.callRejected=function(h){a.reject(this.promise,h)},p.prototype.otherCallRejected=function(h){v(this.promise,this.onRejected,h)};function v(h,S,T){s(function(){var R;try{R=S(T)}catch(H){return a.reject(h,H)}R===h?a.reject(h,new TypeError("Cannot resolve promise with itself")):a.resolve(h,R)})}a.resolve=function(h,S){var T=B(b,S);if(T.status==="error")return a.reject(h,T.value);var R=T.value;if(R)I(h,R);else{h.state=c,h.outcome=S;for(var H=-1,X=h.queue.length;++H<X;)h.queue[H].callFulfilled(S)}return h},a.reject=function(h,S){h.state=l,h.outcome=S;for(var T=-1,R=h.queue.length;++T<R;)h.queue[T].callRejected(S);return h};function b(h){var S=h&&h.then;if(h&&(typeof h=="object"||typeof h=="function")&&typeof S=="function")return function(){S.apply(h,arguments)}}function I(h,S){var T=!1;function R(De){T||(T=!0,a.reject(h,De))}function H(De){T||(T=!0,a.resolve(h,De))}function X(){S(H,R)}var Te=B(X);Te.status==="error"&&R(Te.value)}function B(h,S){var T={};try{T.value=h(S),T.status="success"}catch(R){T.status="error",T.value=R}return T}f.resolve=D;function D(h){return h instanceof this?h:a.resolve(new this(o),h)}f.reject=A;function A(h){var S=new this(o);return a.reject(S,h)}f.all=y;function y(h){var S=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var T=h.length,R=!1;if(!T)return this.resolve([]);for(var H=new Array(T),X=0,Te=-1,De=new this(o);++Te<T;)it(h[Te],Te);return De;function it(Vt,En){S.resolve(Vt).then(Le,function(ye){R||(R=!0,a.reject(De,ye))});function Le(ye){H[En]=ye,++X===T&&!R&&(R=!0,a.resolve(De,H))}}}f.race=m;function m(h){var S=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var T=h.length,R=!1;if(!T)return this.resolve([]);for(var H=-1,X=new this(o);++H<T;)Te(h[H]);return X;function Te(De){S.resolve(De).then(function(it){R||(R=!0,a.resolve(X,it))},function(it){R||(R=!0,a.reject(X,it))})}}},{1:1}],3:[function(n,r,i){(function(s){typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof hi<"u"?hi:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,r,i){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d};function o(d,x){if(!(d instanceof x))throw new TypeError("Cannot call a class as a function")}function a(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var l=a();function c(){try{if(!l||!l.open)return!1;var d=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),x=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!d||x)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function u(d,x){d=d||[],x=x||{};try{return new Blob(d,x)}catch(E){if(E.name!=="TypeError")throw E;for(var g=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,P=new g,C=0;C<d.length;C+=1)P.append(d[C]);return P.getBlob(x.type)}}typeof Promise>"u"&&n(3);var f=Promise;function p(d,x){x&&d.then(function(g){x(null,g)},function(g){x(g)})}function v(d,x,g){typeof x=="function"&&d.then(x),typeof g=="function"&&d.catch(g)}function b(d){return typeof d!="string"&&(d=String(d)),d}function I(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var B="local-forage-detect-blob-support",D=void 0,A={},y=Object.prototype.toString,m="readonly",h="readwrite";function S(d){for(var x=d.length,g=new ArrayBuffer(x),P=new Uint8Array(g),C=0;C<x;C++)P[C]=d.charCodeAt(C);return g}function T(d){return new f(function(x){var g=d.transaction(B,h),P=u([""]);g.objectStore(B).put(P,"key"),g.onabort=function(C){C.preventDefault(),C.stopPropagation(),x(!1)},g.oncomplete=function(){var C=navigator.userAgent.match(/Chrome\/(\d+)/),E=navigator.userAgent.match(/Edge\//);x(E||!C||parseInt(C[1],10)>=43)}}).catch(function(){return!1})}function R(d){return typeof D=="boolean"?f.resolve(D):T(d).then(function(x){return D=x,D})}function H(d){var x=A[d.name],g={};g.promise=new f(function(P,C){g.resolve=P,g.reject=C}),x.deferredOperations.push(g),x.dbReady?x.dbReady=x.dbReady.then(function(){return g.promise}):x.dbReady=g.promise}function X(d){var x=A[d.name],g=x.deferredOperations.pop();if(g)return g.resolve(),g.promise}function Te(d,x){var g=A[d.name],P=g.deferredOperations.pop();if(P)return P.reject(x),P.promise}function De(d,x){return new f(function(g,P){if(A[d.name]=A[d.name]||ut(),d.db)if(x)H(d),d.db.close();else return g(d.db);var C=[d.name];x&&C.push(d.version);var E=l.open.apply(l,C);x&&(E.onupgradeneeded=function(N){var F=E.result;try{F.createObjectStore(d.storeName),N.oldVersion<=1&&F.createObjectStore(B)}catch(q){if(q.name!=="ConstraintError")throw q}}),E.onerror=function(N){N.preventDefault(),P(E.error)},E.onsuccess=function(){var N=E.result;N.onversionchange=function(F){F.target.close()},g(N),X(d)}})}function it(d){return De(d,!1)}function Vt(d){return De(d,!0)}function En(d,x){if(!d.db)return!0;var g=!d.db.objectStoreNames.contains(d.storeName),P=d.version<d.db.version,C=d.version>d.db.version;if(P&&(d.version,d.version=d.db.version),C||g){if(g){var E=d.db.version+1;E>d.version&&(d.version=E)}return!0}return!1}function Le(d){return new f(function(x,g){var P=new FileReader;P.onerror=g,P.onloadend=function(C){var E=btoa(C.target.result||"");x({__local_forage_encoded_blob:!0,data:E,type:d.type})},P.readAsBinaryString(d)})}function ye(d){var x=S(atob(d.data));return u([x],{type:d.type})}function we(d){return d&&d.__local_forage_encoded_blob}function Yt(d){var x=this,g=x._initReady().then(function(){var P=A[x._dbInfo.name];if(P&&P.dbReady)return P.dbReady});return v(g,d,d),g}function Zn(d){H(d);for(var x=A[d.name],g=x.forages,P=0;P<g.length;P++){var C=g[P];C._dbInfo.db&&(C._dbInfo.db.close(),C._dbInfo.db=null)}return d.db=null,it(d).then(function(E){return d.db=E,En(d)?Vt(d):E}).then(function(E){d.db=x.db=E;for(var N=0;N<g.length;N++)g[N]._dbInfo.db=E}).catch(function(E){throw Te(d,E),E})}function Ue(d,x,g,P){P===void 0&&(P=1);try{var C=d.db.transaction(d.storeName,x);g(null,C)}catch(E){if(P>0&&(!d.db||E.name==="InvalidStateError"||E.name==="NotFoundError"))return f.resolve().then(function(){if(!d.db||E.name==="NotFoundError"&&!d.db.objectStoreNames.contains(d.storeName)&&d.version<=d.db.version)return d.db&&(d.version=d.db.version+1),Vt(d)}).then(function(){return Zn(d).then(function(){Ue(d,x,g,P-1)})}).catch(g);g(E)}}function ut(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function fs(d){var x=this,g={db:null};if(d)for(var P in d)g[P]=d[P];var C=A[g.name];C||(C=ut(),A[g.name]=C),C.forages.push(x),x._initReady||(x._initReady=x.ready,x.ready=Yt);var E=[];function N(){return f.resolve()}for(var F=0;F<C.forages.length;F++){var q=C.forages[F];q!==x&&E.push(q._initReady().catch(N))}var z=C.forages.slice(0);return f.all(E).then(function(){return g.db=C.db,it(g)}).then(function(K){return g.db=K,En(g,x._defaultConfig.version)?Vt(g):K}).then(function(K){g.db=C.db=K,x._dbInfo=g;for(var J=0;J<z.length;J++){var ae=z[J];ae!==x&&(ae._dbInfo.db=g.db,ae._dbInfo.version=g.version)}})}function wa(d,x){var g=this;d=b(d);var P=new f(function(C,E){g.ready().then(function(){Ue(g._dbInfo,m,function(N,F){if(N)return E(N);try{var q=F.objectStore(g._dbInfo.storeName),z=q.get(d);z.onsuccess=function(){var K=z.result;K===void 0&&(K=null),we(K)&&(K=ye(K)),C(K)},z.onerror=function(){E(z.error)}}catch(K){E(K)}})}).catch(E)});return p(P,x),P}function _a(d,x){var g=this,P=new f(function(C,E){g.ready().then(function(){Ue(g._dbInfo,m,function(N,F){if(N)return E(N);try{var q=F.objectStore(g._dbInfo.storeName),z=q.openCursor(),K=1;z.onsuccess=function(){var J=z.result;if(J){var ae=J.value;we(ae)&&(ae=ye(ae));var be=d(ae,J.key,K++);be!==void 0?C(be):J.continue()}else C()},z.onerror=function(){E(z.error)}}catch(J){E(J)}})}).catch(E)});return p(P,x),P}function kn(d,x,g){var P=this;d=b(d);var C=new f(function(E,N){var F;P.ready().then(function(){return F=P._dbInfo,y.call(x)==="[object Blob]"?R(F.db).then(function(q){return q?x:Le(x)}):x}).then(function(q){Ue(P._dbInfo,h,function(z,K){if(z)return N(z);try{var J=K.objectStore(P._dbInfo.storeName);q===null&&(q=void 0);var ae=J.put(q,d);K.oncomplete=function(){q===void 0&&(q=null),E(q)},K.onabort=K.onerror=function(){var be=ae.error?ae.error:ae.transaction.error;N(be)}}catch(be){N(be)}})}).catch(N)});return p(C,g),C}function er(d,x){var g=this;d=b(d);var P=new f(function(C,E){g.ready().then(function(){Ue(g._dbInfo,h,function(N,F){if(N)return E(N);try{var q=F.objectStore(g._dbInfo.storeName),z=q.delete(d);F.oncomplete=function(){C()},F.onerror=function(){E(z.error)},F.onabort=function(){var K=z.error?z.error:z.transaction.error;E(K)}}catch(K){E(K)}})}).catch(E)});return p(P,x),P}function zr(d){var x=this,g=new f(function(P,C){x.ready().then(function(){Ue(x._dbInfo,h,function(E,N){if(E)return C(E);try{var F=N.objectStore(x._dbInfo.storeName),q=F.clear();N.oncomplete=function(){P()},N.onabort=N.onerror=function(){var z=q.error?q.error:q.transaction.error;C(z)}}catch(z){C(z)}})}).catch(C)});return p(g,d),g}function ds(d){var x=this,g=new f(function(P,C){x.ready().then(function(){Ue(x._dbInfo,m,function(E,N){if(E)return C(E);try{var F=N.objectStore(x._dbInfo.storeName),q=F.count();q.onsuccess=function(){P(q.result)},q.onerror=function(){C(q.error)}}catch(z){C(z)}})}).catch(C)});return p(g,d),g}function Pn(d,x){var g=this,P=new f(function(C,E){if(d<0){C(null);return}g.ready().then(function(){Ue(g._dbInfo,m,function(N,F){if(N)return E(N);try{var q=F.objectStore(g._dbInfo.storeName),z=!1,K=q.openKeyCursor();K.onsuccess=function(){var J=K.result;if(!J){C(null);return}d===0||z?C(J.key):(z=!0,J.advance(d))},K.onerror=function(){E(K.error)}}catch(J){E(J)}})}).catch(E)});return p(P,x),P}function Gf(d){var x=this,g=new f(function(P,C){x.ready().then(function(){Ue(x._dbInfo,m,function(E,N){if(E)return C(E);try{var F=N.objectStore(x._dbInfo.storeName),q=F.openKeyCursor(),z=[];q.onsuccess=function(){var K=q.result;if(!K){P(z);return}z.push(K.key),K.continue()},q.onerror=function(){C(q.error)}}catch(K){C(K)}})}).catch(C)});return p(g,d),g}function _(d,x){x=I.apply(this,arguments);var g=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||g.name,d.storeName=d.storeName||g.storeName);var P=this,C;if(!d.name)C=f.reject("Invalid arguments");else{var E=d.name===g.name&&P._dbInfo.db,N=E?f.resolve(P._dbInfo.db):it(d).then(function(F){var q=A[d.name],z=q.forages;q.db=F;for(var K=0;K<z.length;K++)z[K]._dbInfo.db=F;return F});d.storeName?C=N.then(function(F){if(F.objectStoreNames.contains(d.storeName)){var q=F.version+1;H(d);var z=A[d.name],K=z.forages;F.close();for(var J=0;J<K.length;J++){var ae=K[J];ae._dbInfo.db=null,ae._dbInfo.version=q}var be=new f(function(xe,Re){var Ie=l.open(d.name,q);Ie.onerror=function(yt){var Kr=Ie.result;Kr.close(),Re(yt)},Ie.onupgradeneeded=function(){var yt=Ie.result;yt.deleteObjectStore(d.storeName)},Ie.onsuccess=function(){var yt=Ie.result;yt.close(),xe(yt)}});return be.then(function(xe){z.db=xe;for(var Re=0;Re<K.length;Re++){var Ie=K[Re];Ie._dbInfo.db=xe,X(Ie._dbInfo)}}).catch(function(xe){throw(Te(d,xe)||f.resolve()).catch(function(){}),xe})}}):C=N.then(function(F){H(d);var q=A[d.name],z=q.forages;F.close();for(var K=0;K<z.length;K++){var J=z[K];J._dbInfo.db=null}var ae=new f(function(be,xe){var Re=l.deleteDatabase(d.name);Re.onerror=function(){var Ie=Re.result;Ie&&Ie.close(),xe(Re.error)},Re.onblocked=function(){},Re.onsuccess=function(){var Ie=Re.result;Ie&&Ie.close(),be(Ie)}});return ae.then(function(be){q.db=be;for(var xe=0;xe<z.length;xe++){var Re=z[xe];X(Re._dbInfo)}}).catch(function(be){throw(Te(d,be)||f.resolve()).catch(function(){}),be})})}return p(C,x),C}var k={_driver:"asyncStorage",_initStorage:fs,_support:c(),iterate:_a,getItem:wa,setItem:kn,removeItem:er,clear:zr,length:ds,key:Pn,keys:Gf,dropInstance:_};function O(){return typeof openDatabase=="function"}var L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M="~~local_forage_type~",j=/^~~local_forage_type~([^~]+)~/,G="__lfsc__:",V=G.length,W="arbf",U="blob",ee="si08",Q="ui08",Z="uic8",re="si16",ce="si32",_e="ur16",he="ui32",qe="fl32",ze="fl64",ft=V+W.length,dt=Object.prototype.toString;function cn(d){var x=d.length*.75,g=d.length,P,C=0,E,N,F,q;d[d.length-1]==="="&&(x--,d[d.length-2]==="="&&x--);var z=new ArrayBuffer(x),K=new Uint8Array(z);for(P=0;P<g;P+=4)E=L.indexOf(d[P]),N=L.indexOf(d[P+1]),F=L.indexOf(d[P+2]),q=L.indexOf(d[P+3]),K[C++]=E<<2|N>>4,K[C++]=(N&15)<<4|F>>2,K[C++]=(F&3)<<6|q&63;return z}function tr(d){var x=new Uint8Array(d),g="",P;for(P=0;P<x.length;P+=3)g+=L[x[P]>>2],g+=L[(x[P]&3)<<4|x[P+1]>>4],g+=L[(x[P+1]&15)<<2|x[P+2]>>6],g+=L[x[P+2]&63];return x.length%3===2?g=g.substring(0,g.length-1)+"=":x.length%3===1&&(g=g.substring(0,g.length-2)+"=="),g}function Xe(d,x){var g="";if(d&&(g=dt.call(d)),d&&(g==="[object ArrayBuffer]"||d.buffer&&dt.call(d.buffer)==="[object ArrayBuffer]")){var P,C=G;d instanceof ArrayBuffer?(P=d,C+=W):(P=d.buffer,g==="[object Int8Array]"?C+=ee:g==="[object Uint8Array]"?C+=Q:g==="[object Uint8ClampedArray]"?C+=Z:g==="[object Int16Array]"?C+=re:g==="[object Uint16Array]"?C+=_e:g==="[object Int32Array]"?C+=ce:g==="[object Uint32Array]"?C+=he:g==="[object Float32Array]"?C+=qe:g==="[object Float64Array]"?C+=ze:x(new Error("Failed to get type for BinaryArray"))),x(C+tr(P))}else if(g==="[object Blob]"){var E=new FileReader;E.onload=function(){var N=M+d.type+"~"+tr(this.result);x(G+U+N)},E.readAsArrayBuffer(d)}else try{x(JSON.stringify(d))}catch(N){x(null,N)}}function vt(d){if(d.substring(0,V)!==G)return JSON.parse(d);var x=d.substring(ft),g=d.substring(V,ft),P;if(g===U&&j.test(x)){var C=x.match(j);P=C[1],x=x.substring(C[0].length)}var E=cn(x);switch(g){case W:return E;case U:return u([E],{type:P});case ee:return new Int8Array(E);case Q:return new Uint8Array(E);case Z:return new Uint8ClampedArray(E);case re:return new Int16Array(E);case _e:return new Uint16Array(E);case ce:return new Int32Array(E);case he:return new Uint32Array(E);case qe:return new Float32Array(E);case ze:return new Float64Array(E);default:throw new Error("Unkown type: "+g)}}var nr={serialize:Xe,deserialize:vt,stringToBuffer:cn,bufferToString:tr};function Hr(d,x,g,P){d.executeSql("CREATE TABLE IF NOT EXISTS "+x.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],g,P)}function Yb(d){var x=this,g={db:null};if(d)for(var P in d)g[P]=typeof d[P]!="string"?d[P].toString():d[P];var C=new f(function(E,N){try{g.db=openDatabase(g.name,String(g.version),g.description,g.size)}catch(F){return N(F)}g.db.transaction(function(F){Hr(F,g,function(){x._dbInfo=g,E()},function(q,z){N(z)})},N)});return g.serializer=nr,C}function un(d,x,g,P,C,E){d.executeSql(g,P,C,function(N,F){F.code===F.SYNTAX_ERR?N.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[x.storeName],function(q,z){z.rows.length?E(q,F):Hr(q,x,function(){q.executeSql(g,P,C,E)},E)},E):E(N,F)},E)}function Gb(d,x){var g=this;d=b(d);var P=new f(function(C,E){g.ready().then(function(){var N=g._dbInfo;N.db.transaction(function(F){un(F,N,"SELECT * FROM "+N.storeName+" WHERE key = ? LIMIT 1",[d],function(q,z){var K=z.rows.length?z.rows.item(0).value:null;K&&(K=N.serializer.deserialize(K)),C(K)},function(q,z){E(z)})})}).catch(E)});return p(P,x),P}function Qb(d,x){var g=this,P=new f(function(C,E){g.ready().then(function(){var N=g._dbInfo;N.db.transaction(function(F){un(F,N,"SELECT * FROM "+N.storeName,[],function(q,z){for(var K=z.rows,J=K.length,ae=0;ae<J;ae++){var be=K.item(ae),xe=be.value;if(xe&&(xe=N.serializer.deserialize(xe)),xe=d(xe,be.key,ae+1),xe!==void 0){C(xe);return}}C()},function(q,z){E(z)})})}).catch(E)});return p(P,x),P}function Qf(d,x,g,P){var C=this;d=b(d);var E=new f(function(N,F){C.ready().then(function(){x===void 0&&(x=null);var q=x,z=C._dbInfo;z.serializer.serialize(x,function(K,J){J?F(J):z.db.transaction(function(ae){un(ae,z,"INSERT OR REPLACE INTO "+z.storeName+" (key, value) VALUES (?, ?)",[d,K],function(){N(q)},function(be,xe){F(xe)})},function(ae){if(ae.code===ae.QUOTA_ERR){if(P>0){N(Qf.apply(C,[d,q,g,P-1]));return}F(ae)}})})}).catch(F)});return p(E,g),E}function Jb(d,x,g){return Qf.apply(this,[d,x,g,1])}function Xb(d,x){var g=this;d=b(d);var P=new f(function(C,E){g.ready().then(function(){var N=g._dbInfo;N.db.transaction(function(F){un(F,N,"DELETE FROM "+N.storeName+" WHERE key = ?",[d],function(){C()},function(q,z){E(z)})})}).catch(E)});return p(P,x),P}function Zb(d){var x=this,g=new f(function(P,C){x.ready().then(function(){var E=x._dbInfo;E.db.transaction(function(N){un(N,E,"DELETE FROM "+E.storeName,[],function(){P()},function(F,q){C(q)})})}).catch(C)});return p(g,d),g}function ew(d){var x=this,g=new f(function(P,C){x.ready().then(function(){var E=x._dbInfo;E.db.transaction(function(N){un(N,E,"SELECT COUNT(key) as c FROM "+E.storeName,[],function(F,q){var z=q.rows.item(0).c;P(z)},function(F,q){C(q)})})}).catch(C)});return p(g,d),g}function tw(d,x){var g=this,P=new f(function(C,E){g.ready().then(function(){var N=g._dbInfo;N.db.transaction(function(F){un(F,N,"SELECT key FROM "+N.storeName+" WHERE id = ? LIMIT 1",[d+1],function(q,z){var K=z.rows.length?z.rows.item(0).key:null;C(K)},function(q,z){E(z)})})}).catch(E)});return p(P,x),P}function nw(d){var x=this,g=new f(function(P,C){x.ready().then(function(){var E=x._dbInfo;E.db.transaction(function(N){un(N,E,"SELECT key FROM "+E.storeName,[],function(F,q){for(var z=[],K=0;K<q.rows.length;K++)z.push(q.rows.item(K).key);P(z)},function(F,q){C(q)})})}).catch(C)});return p(g,d),g}function rw(d){return new f(function(x,g){d.transaction(function(P){P.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(C,E){for(var N=[],F=0;F<E.rows.length;F++)N.push(E.rows.item(F).name);x({db:d,storeNames:N})},function(C,E){g(E)})},function(P){g(P)})})}function iw(d,x){x=I.apply(this,arguments);var g=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||g.name,d.storeName=d.storeName||g.storeName);var P=this,C;return d.name?C=new f(function(E){var N;d.name===g.name?N=P._dbInfo.db:N=openDatabase(d.name,"","",0),d.storeName?E({db:N,storeNames:[d.storeName]}):E(rw(N))}).then(function(E){return new f(function(N,F){E.db.transaction(function(q){function z(be){return new f(function(xe,Re){q.executeSql("DROP TABLE IF EXISTS "+be,[],function(){xe()},function(Ie,yt){Re(yt)})})}for(var K=[],J=0,ae=E.storeNames.length;J<ae;J++)K.push(z(E.storeNames[J]));f.all(K).then(function(){N()}).catch(function(be){F(be)})},function(q){F(q)})})}):C=f.reject("Invalid arguments"),p(C,x),C}var sw={_driver:"webSQLStorage",_initStorage:Yb,_support:O(),iterate:Qb,getItem:Gb,setItem:Jb,removeItem:Xb,clear:Zb,length:ew,key:tw,keys:nw,dropInstance:iw};function ow(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Jf(d,x){var g=d.name+"/";return d.storeName!==x.storeName&&(g+=d.storeName+"/"),g}function aw(){var d="_localforage_support_test";try{return localStorage.setItem(d,!0),localStorage.removeItem(d),!1}catch{return!0}}function lw(){return!aw()||localStorage.length>0}function cw(d){var x=this,g={};if(d)for(var P in d)g[P]=d[P];return g.keyPrefix=Jf(d,x._defaultConfig),lw()?(x._dbInfo=g,g.serializer=nr,f.resolve()):f.reject()}function uw(d){var x=this,g=x.ready().then(function(){for(var P=x._dbInfo.keyPrefix,C=localStorage.length-1;C>=0;C--){var E=localStorage.key(C);E.indexOf(P)===0&&localStorage.removeItem(E)}});return p(g,d),g}function fw(d,x){var g=this;d=b(d);var P=g.ready().then(function(){var C=g._dbInfo,E=localStorage.getItem(C.keyPrefix+d);return E&&(E=C.serializer.deserialize(E)),E});return p(P,x),P}function dw(d,x){var g=this,P=g.ready().then(function(){for(var C=g._dbInfo,E=C.keyPrefix,N=E.length,F=localStorage.length,q=1,z=0;z<F;z++){var K=localStorage.key(z);if(K.indexOf(E)===0){var J=localStorage.getItem(K);if(J&&(J=C.serializer.deserialize(J)),J=d(J,K.substring(N),q++),J!==void 0)return J}}});return p(P,x),P}function hw(d,x){var g=this,P=g.ready().then(function(){var C=g._dbInfo,E;try{E=localStorage.key(d)}catch{E=null}return E&&(E=E.substring(C.keyPrefix.length)),E});return p(P,x),P}function pw(d){var x=this,g=x.ready().then(function(){for(var P=x._dbInfo,C=localStorage.length,E=[],N=0;N<C;N++){var F=localStorage.key(N);F.indexOf(P.keyPrefix)===0&&E.push(F.substring(P.keyPrefix.length))}return E});return p(g,d),g}function gw(d){var x=this,g=x.keys().then(function(P){return P.length});return p(g,d),g}function vw(d,x){var g=this;d=b(d);var P=g.ready().then(function(){var C=g._dbInfo;localStorage.removeItem(C.keyPrefix+d)});return p(P,x),P}function yw(d,x,g){var P=this;d=b(d);var C=P.ready().then(function(){x===void 0&&(x=null);var E=x;return new f(function(N,F){var q=P._dbInfo;q.serializer.serialize(x,function(z,K){if(K)F(K);else try{localStorage.setItem(q.keyPrefix+d,z),N(E)}catch(J){(J.name==="QuotaExceededError"||J.name==="NS_ERROR_DOM_QUOTA_REACHED")&&F(J),F(J)}})})});return p(C,g),C}function bw(d,x){if(x=I.apply(this,arguments),d=typeof d!="function"&&d||{},!d.name){var g=this.config();d.name=d.name||g.name,d.storeName=d.storeName||g.storeName}var P=this,C;return d.name?C=new f(function(E){d.storeName?E(Jf(d,P._defaultConfig)):E(d.name+"/")}).then(function(E){for(var N=localStorage.length-1;N>=0;N--){var F=localStorage.key(N);F.indexOf(E)===0&&localStorage.removeItem(F)}}):C=f.reject("Invalid arguments"),p(C,x),C}var ww={_driver:"localStorageWrapper",_initStorage:cw,_support:ow(),iterate:dw,getItem:fw,setItem:yw,removeItem:vw,clear:uw,length:gw,key:hw,keys:pw,dropInstance:bw},_w=function(x,g){return x===g||typeof x=="number"&&typeof g=="number"&&isNaN(x)&&isNaN(g)},xw=function(x,g){for(var P=x.length,C=0;C<P;){if(_w(x[C],g))return!0;C++}return!1},Xf=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"},Wr={},Zf={},rr={INDEXEDDB:k,WEBSQL:sw,LOCALSTORAGE:ww},Sw=[rr.INDEXEDDB._driver,rr.WEBSQL._driver,rr.LOCALSTORAGE._driver],hs=["dropInstance"],xa=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(hs),Ew={description:"",driver:Sw.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function kw(d,x){d[x]=function(){var g=arguments;return d.ready().then(function(){return d[x].apply(d,g)})}}function Sa(){for(var d=1;d<arguments.length;d++){var x=arguments[d];if(x)for(var g in x)x.hasOwnProperty(g)&&(Xf(x[g])?arguments[0][g]=x[g].slice():arguments[0][g]=x[g])}return arguments[0]}var Pw=function(){function d(x){o(this,d);for(var g in rr)if(rr.hasOwnProperty(g)){var P=rr[g],C=P._driver;this[g]=C,Wr[C]||this.defineDriver(P)}this._defaultConfig=Sa({},Ew),this._config=Sa({},this._defaultConfig,x),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return d.prototype.config=function(g){if((typeof g>"u"?"undefined":s(g))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var P in g){if(P==="storeName"&&(g[P]=g[P].replace(/\W/g,"_")),P==="version"&&typeof g[P]!="number")return new Error("Database version must be a number.");this._config[P]=g[P]}return"driver"in g&&g.driver?this.setDriver(this._config.driver):!0}else return typeof g=="string"?this._config[g]:this._config},d.prototype.defineDriver=function(g,P,C){var E=new f(function(N,F){try{var q=g._driver,z=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!g._driver){F(z);return}for(var K=xa.concat("_initStorage"),J=0,ae=K.length;J<ae;J++){var be=K[J],xe=!xw(hs,be);if((xe||g[be])&&typeof g[be]!="function"){F(z);return}}var Re=function(){for(var Kr=function(Tw){return function(){var Iw=new Error("Method "+Tw+" is not implemented by the current driver"),ed=f.reject(Iw);return p(ed,arguments[arguments.length-1]),ed}},Ea=0,Cw=hs.length;Ea<Cw;Ea++){var ka=hs[Ea];g[ka]||(g[ka]=Kr(ka))}};Re();var Ie=function(Kr){Wr[q],Wr[q]=g,Zf[q]=Kr,N()};"_support"in g?g._support&&typeof g._support=="function"?g._support().then(Ie,F):Ie(!!g._support):Ie(!0)}catch(yt){F(yt)}});return v(E,P,C),E},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(g,P,C){var E=Wr[g]?f.resolve(Wr[g]):f.reject(new Error("Driver not found."));return v(E,P,C),E},d.prototype.getSerializer=function(g){var P=f.resolve(nr);return v(P,g),P},d.prototype.ready=function(g){var P=this,C=P._driverSet.then(function(){return P._ready===null&&(P._ready=P._initDriver()),P._ready});return v(C,g,g),C},d.prototype.setDriver=function(g,P,C){var E=this;Xf(g)||(g=[g]);var N=this._getSupportedDrivers(g);function F(){E._config.driver=E.driver()}function q(J){return E._extend(J),F(),E._ready=E._initStorage(E._config),E._ready}function z(J){return function(){var ae=0;function be(){for(;ae<J.length;){var xe=J[ae];return ae++,E._dbInfo=null,E._ready=null,E.getDriver(xe).then(q).catch(be)}F();var Re=new Error("No available storage method found.");return E._driverSet=f.reject(Re),E._driverSet}return be()}}var K=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=K.then(function(){var J=N[0];return E._dbInfo=null,E._ready=null,E.getDriver(J).then(function(ae){E._driver=ae._driver,F(),E._wrapLibraryMethodsWithReady(),E._initDriver=z(N)})}).catch(function(){F();var J=new Error("No available storage method found.");return E._driverSet=f.reject(J),E._driverSet}),v(this._driverSet,P,C),this._driverSet},d.prototype.supports=function(g){return!!Zf[g]},d.prototype._extend=function(g){Sa(this,g)},d.prototype._getSupportedDrivers=function(g){for(var P=[],C=0,E=g.length;C<E;C++){var N=g[C];this.supports(N)&&P.push(N)}return P},d.prototype._wrapLibraryMethodsWithReady=function(){for(var g=0,P=xa.length;g<P;g++)kw(this,xa[g])},d.prototype.createInstance=function(g){return new d(g)},d}(),$w=new Pw;r.exports=$w},{3:3}]},{},[4])(4)})}(Ws)),Ws.exports}var Ep=Sp();const xl=xp(Ep);class kp extends Jt{constructor(e){super(e,"storage",!1),e.set("localforage",xl)}get StorageManager(){return mi}createDatabse(e,n,r){return new mi("InPageEdit",e,n,r)}}const Xn=class Xn{constructor(e,n,r=Xn.DEFAULT_TTL,i){this.dbName=e,this.storeName=n,this.ttl=r,this.version=i,this.db=Xn.createDatabase(e,n),this.keys=this.db.keys.bind(this.db)}static createDatabase(e,n){const r=`${e}:${n}`;if(this._cached_db_instances.has(r))return this._cached_db_instances.get(r);const i=xl.createInstance({name:e,storeName:n});return this._cached_db_instances.set(r,i),i}async get(e,n=this.ttl,r){const i=await this.loadFromDB(e),s=this.checkIfExpired(i,n);if(!i||s){if(typeof r=="function"){const o=await r();return this.set(e,o).then(()=>o)}return null}return i.value}async set(e,n){return n===null||typeof n>"u"?this.delete(e):this.db.setItem(e,{time:Date.now(),value:n,version:this.version})}async has(e,n=this.ttl){const r=await this.loadFromDB(e),i=this.checkIfExpired(r,n);return r!==null&&!i}async delete(e){return this.db.removeItem(e)}async iterate(e){return await this.db.iterate((n,r)=>{e(n.value,r)})}async loadFromDB(e){const n=await this.db.getItem(e);if(!n)return null;if(typeof n.time!="number"||typeof n.value>"u"){try{this.delete(e)}catch{}return null}if(typeof this.version=="number"&&n.version!==this.version){try{this.delete(e)}catch{}return null}return n}checkIfExpired(e,n=this.ttl){return e?Date.now()-e.time>n:!1}async clear(){return await this.db.clear(),this}};Xn.DEFAULT_TTL=1/0,Xn._cached_db_instances=new Map;let mi=Xn;var wt=(t=>(t.preferences="preferences",t.watch="watch",t.unwatch="unwatch",t.nochange="nochange",t))(wt||{});function Pp(t){const n=class n{constructor(i,s=!0){this._loaded=s,this.api=t,i.revisions?.forEach(o=>{typeof o?.slots?.main=="object"&&Object.assign(o,o.slots.main)}),this.pageInfo={...n.DEFAULT_PAGE_INFO,...i}}static async newFromApi(i){const{data:s}=await this.api.get({...n.DEFAULT_QUERY_PARAMS,...i}),o=s?.query?.pages?.[0];if(!o)throw new Error("Invalid page info",{cause:s});return new n(o,!0)}static newBlankPage(i={}){return new n(i,!1)}async parse(i){return this.api.post({action:"parse",page:this.pageInfo.title,prop:"text|langlinks|categories|links|templates|images|externallinks|sections|revid|displaytitle|iwlinks|properties|parsewarnings",...i})}async preview(i,s){return this.parse({action:"parse",page:void 0,title:this.title,text:i,pst:1,preview:1,disableeditsection:1,disablelimitreport:1,...s})}async edit(i,s){const{text:o,prependtext:a,appendtext:l,summary:c="",watchlist:u=wt.preferences,section:f}=i;return this.api.postWithEditToken({action:"edit",title:this.title,starttimestamp:this.pageInfo.touched,basetimestamp:this.revisions[0]?.timestamp,text:o,prependtext:a,appendtext:l,summary:c,watchlist:u,section:f,...s})}async createOnly(i,s){return this.edit(i,{createonly:1,...s})}async delete(i,s){return this.api.postWithEditToken({action:"delete",pageid:this.pageInfo.pageid,reason:i,...s})}async moveTo(i,s,o){return this.api.postWithEditToken({action:"move",from:this.pageInfo.title,to:i,reason:s,movetalk:1,movesubpages:1,...o})}userCan(i){return!!this.pageInfo?.actions?.[i]}userCanEdit(){return this.userCan("edit")}async reloadSelfInfo(){const i=await n.newFromApi({pageids:this.pageInfo.pageid,titles:this.pageInfo.title}),s=(this.pageInfo.revisions||[]).concat(i.revisions||[]).sort((o,a)=>o.revid-a.revid).reduce((o,a)=>(o.find(l=>l.revid===a.revid)||o.push(a),o),[]);return this.pageInfo=i.pageInfo,this.pageInfo.revisions=s,this._loaded=!0,this}get pageid(){return this.pageInfo.pageid}get title(){return this.pageInfo.title}get ns(){return this.pageInfo.ns}get contentmodel(){return this.pageInfo.contentmodel}get fullurl(){return this.pageInfo.fullurl}get canonicalurl(){return this.pageInfo.canonicalurl}get editurl(){return this.pageInfo.editurl}get revisions(){return this.pageInfo.revisions||[]}get lastrevid(){return this.pageInfo.lastrevid}get templates(){return this.pageInfo.templates||[]}get images(){return this.pageInfo.images||[]}};n.api=t,n.DEFAULT_QUERY_PARAMS={action:"query",prop:"info|templates|transcludedin|images|pageimages|revisions",inprop:"protection|url|varianttitles",intestactions:"edit|move|delete",tllimit:"max",tilimit:"max",imlimit:"max",piprop:"thumbnail|name|original",pithumbsize:"200",pilimit:"max",rvprop:"ids|timestamp|flags|comment|user|content",rvslots:"main"},n.DEFAULT_PAGE_INFO={pageid:0,ns:0,title:"",contentmodel:"wikitext",pagelanguage:"",pagelanguagehtmlcode:"",pagelanguagedir:"ltr",touched:new Date().toISOString(),lastrevid:0,length:0,protection:[],restrictiontypes:[],fullurl:"",canonicalurl:"",editurl:"",varianttitles:{},actions:{edit:!0,move:!1,delete:!1},revisions:[],templates:[],images:[]};let e=n;return e}const va=class va extends Jt{constructor(e){super(e,"wikiPage",!0),this.ctx=e,this.logger=this.ctx.logger("WIKI_PAGE"),this.WikiPage=Pp(this.ctx.api)}async createInstance(e,n=!1){return await this.WikiPage.newFromApi(e)}async newFromTitle(e,n=!1,r,i=!1){return this.createInstance({titles:e,converttitles:n,rvsection:r},i)}async newFromPageId(e,n,r=!1){return this.createInstance({pageids:e,rvsection:n},r)}async newFromRevision(e,n,r=!1){return await this.createInstance({revids:e,rvsection:n},r)}newBlankPage(e={}){return this.WikiPage.newBlankPage(e)}};va.inject=["api"];let Ks=va;const Sl=new WeakMap,Pt={toDBKey:t=>t.replace(/ /g,"_"),toNormalText:t=>t.replace(/_/g," "),ensureCase:(t,e)=>e==="first-letter"?t.charAt(0).toUpperCase()+t.slice(1):t},In={normalizeSpecialPageName:t=>t.toLowerCase(),buildSpecialPageIndex:t=>{const e=new Map,n=new Map,r=new Map;for(const i of t.specialpagealiases){const s=i.realname;e.set(s,s);const o=In.normalizeSpecialPageName(s);r.set(o,s);for(const a of i.aliases){n.set(a,s);const l=In.normalizeSpecialPageName(a);r.set(l,s)}}return{byRealName:e,byAlias:n,byNormalized:r}},findSpecialPageRealName:(t,e)=>{const n=t.split("/")[0];let r=e.byRealName.get(n)??e.byAlias.get(n);if(r!==void 0)return r;const i=In.normalizeSpecialPageName(n);return e.byNormalized.get(i)??null}},$t={normalizeNamespaceText:t=>t.replace(/[_\s]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),buildIndex:t=>{const e=new Map,n=new Map,r=new Map,i=new Map;for(const[s,o]of Object.entries(t.namespaces)){const a=parseInt(s);e.set(o.name,a),n.set(o.canonical??"",a);const l=$t.normalizeNamespaceText(o.name),c=$t.normalizeNamespaceText(o.canonical??"");i.set(l,a),i.set(c,a)}for(const s of t.namespacealiases){r.set(s.alias,s.id);const o=$t.normalizeNamespaceText(s.alias);i.set(o,s.id)}return{byName:e,byCanonical:n,byAlias:r,byNormalized:i}},findNamespaceId:(t,e)=>{let n=e.byName.get(t)??e.byCanonical.get(t)??e.byAlias.get(t);if(n!==void 0)return n;const r=$t.normalizeNamespaceText(t);return e.byNormalized.get(r)??null},isTalkPage:t=>t%2===1&&t>0,getDefaultNamespaceInfo:t=>({id:t,name:"",canonical:"",case:"first-letter",content:!1,nonincludable:!1,subpages:!1})};function $p(t){var s,o;const e=Sl.get(t);if(e)return e;const n=$t.buildIndex(t),r=In.buildSpecialPageIndex(t),a=class a{constructor(c,u){ir(this,s);ir(this,o);this.newTitle=a.create.bind(a),this.toText=this.getPrefixedText.bind(this),this.toString=this.getPrefixedDBKey.bind(this),bt(this,s,c||""),bt(this,o,u??0),u===void 0&&this.fixNSByTitle()}static create(c,u){return new a(c,u)}fixNSByTitle(){const c=me(this,s).indexOf(":");if(c===-1)return;if(c===0){bt(this,s,me(this,s).substring(1));return}const u=me(this,s).substring(0,c),f=me(this,s).substring(c+1),p=$t.findNamespaceId(u,a._namespaceIndex);p!==null&&(bt(this,s,f),bt(this,o,p))}getNamespaceInfo(){return a._meta.namespaces[me(this,o)]??$t.getDefaultNamespaceInfo(me(this,o))}getMainDBKey(){const c=this.getNamespaceInfo();if(me(this,o)===-1){const u=In.findSpecialPageRealName(me(this,s),a._specialPageIndex);if(u){const f=me(this,s).includes("/")?me(this,s).substring(me(this,s).indexOf("/")):"",p=u+f;return Pt.ensureCase(Pt.toDBKey(p),c.case)}}return Pt.ensureCase(Pt.toDBKey(me(this,s)),c.case)}getMainText(){const c=this.getNamespaceInfo();if(me(this,o)===-1){const u=In.findSpecialPageRealName(me(this,s),a._specialPageIndex);if(u){const f=me(this,s).includes("/")?me(this,s).substring(me(this,s).indexOf("/")):"",p=u+f;return Pt.ensureCase(Pt.toNormalText(p),c.case)}}return Pt.ensureCase(Pt.toNormalText(me(this,s)),c.case)}getMainRootText(){return this.getMainText().split("/")[0]}getPrefixedDBKey(){return me(this,o)===0?this.getMainDBKey():`${this.getNamespaceDBKey()}:${this.getMainDBKey()}`}getPrefixedText(){return me(this,o)===0?this.getMainText():`${this.getNamespaceText()}:${this.getMainText()}`}getNamespaceId(){return me(this,o)}getNamespaceText(){return this.getNamespaceInfo().name??""}getNamespaceDBKey(){const c=this.getNamespaceInfo();return Pt.ensureCase(Pt.toDBKey(this.getNamespaceText()),c.case)}getSubjectPage(){if($t.isTalkPage(me(this,o))){const c=me(this,o)-1;return new a(me(this,s),c)}return this}getTalkPage(){if($t.isTalkPage(me(this,o)))return this;if(me(this,o)<0)return null;const c=me(this,o)+1;return a._meta.namespaces[c.toString()]?new a(me(this,s),c):null}getURL(c){const u=a._meta.general.articlepath,f=this.getPrefixedDBKey(),p=u.replace("$1",f),v=new URL(p,a._meta.general.base);return c&&(c instanceof URLSearchParams?c:new URLSearchParams(c)).forEach((I,B)=>{v.searchParams.set(B,I)}),v}setTitle(c){return bt(this,s,c),bt(this,o,0),this.fixNSByTitle(),this}setMainText(c){return bt(this,s,c),this}setNamespaceText(c){const u=$t.findNamespaceId(c,a._namespaceIndex);return u!==null&&bt(this,o,u),this}setNamespaceId(c){return bt(this,o,c),this}equals(c){return typeof c=="string"&&(c=new a(c)),this.getPrefixedDBKey()===c.getPrefixedDBKey()}isSpecial(c){if(me(this,o)!==-1)return!1;const u=new a(c,-1);return this.getMainRootText()===u.getMainRootText()}};s=new WeakMap,o=new WeakMap,a._meta=t,a._namespaceIndex=n,a._specialPageIndex=r;let i=a;return Sl.set(t,i),i}const Br=class Br extends Jt{constructor(e){super(e,"wikiTitle",!0),this.ctx=e,this.logger=this.ctx.logger("WikiTitleService"),this._titleByPageId=new Map,this.wiki=this.ctx.wiki,this.wikiBaseUrl=this.wiki.baseUrl,this.wikiArticlePath=this.wiki.articlePath.replace("$1",""),this.wikiArticleBaseUrl=this.wiki.articleBaseUrl.replace("$1",""),this.wikiIndexPhpUrl=this.wiki.getSciprtUrl("index.php"),this.Title=$p(this.ctx.wiki._raw)}newTitle(e,n){return new this.Title(e,n)}async newTitleFromUrl(e){const n=this.parseWikiLink(e);return n?.title?n.title:n?.pageId?this.newTitleFromPageId(n.pageId):null}async newTitleFromPageId(e){if(e=parseInt(e,10),isNaN(e)||e<=0)return null;if(this._titleByPageId.has(e))return this._titleByPageId.get(e);const{promise:n,resolve:r,reject:i}=ge();return this._titleByPageId.set(e,n),this.ctx.inject(["wikiPage"],async s=>{try{const o=await s.wikiPage.newFromPageId(e);r(this.newTitle(o.title))}catch(o){this._titleByPageId.delete(e),i(o)}}),n}resolveSpecialPageTarget(e){const n=typeof e=="string"?this.newTitle(e):e;if(!n||n.getNamespaceId()!==-1)return null;let r,i,s="view";const o=n.getMainDBKey().split("/").slice(1).join("/")||"";if(n.isSpecial("edit")&&o)r=o,s="edit";else if(n.isSpecial("talkpage")&&o){const a=n.newTitle(o).getTalkPage();if(!a)return null;r=a.getPrefixedDBKey()}else if(n.isSpecial("mypage"))r=n.newTitle(this.ctx.wiki.userInfo.name,2).getPrefixedDBKey()+(o?`/${o}`:"");else if(n.isSpecial("mytalk"))r=n.newTitle(this.ctx.wiki.userInfo.name,3).getPrefixedDBKey()+(o?`/${o}`:"");else if(n.isSpecial("newsection")&&o)r=o,i="new",s="edit";else return null;return{title:new this.Title(r),section:i,action:s}}isWikiLink(e){return e.startsWith(this.wikiArticleBaseUrl)||e.startsWith(this.wikiIndexPhpUrl)||e.startsWith(`${this.wikiBaseUrl}/?`)}validateHrefAttr(e){return typeof e!="string"?!1:!Br.REG_SKIPPED_HREF.test(e)}parseWikiLink(e){if(!e||typeof e=="string"&&!this.validateHrefAttr(e))return null;const n=ml(e);if(!this.isWikiLink(n.toString()))return null;const r=n.searchParams,i=n.hash.replace("#",""),s=r.get("action")||"view",o=r.get("title")||"",a=parseInt(r.get("curid")||"0",10);let l=o||(()=>{try{return decodeURIComponent(n.pathname.substring(this.wikiArticlePath.length))}catch(f){return this.logger.error("parseLink",n,f),""}})();l.endsWith("index.php")&&(l="");let c=null,u=null;if(a)u=a;else if(l)c=this.newTitle(l);else return null;return{title:c,pageId:u,url:n,params:r,hash:i,action:s}}};Br.inject=["wiki"],Br.REG_SKIPPED_HREF=/^(#|javascript:|vbscript:|file:)/i;let Vs=Br;var Ys=(t=>(t.ANALYTICS_API_BASE="https://analytics.ipe.wiki/api",t.ANALYTICS_DASH_URL="https://analytics.ipe.wiki",t.GITHUB_URL="https://github.com/inpageedit/inpageedit-next",t.HOME_URL="https://www.ipe.wiki/",t.UPDATE_LOGS_URL="https://www.ipe.wiki/changelogs/",t))(Ys||{});/**
51
+ */var _l;function Sp(){return _l||(_l=1,function(t,e){(function(n){t.exports=n()})(function(){return function n(r,i,s){function o(c,u){if(!i[c]){if(!r[c]){var f=typeof pi=="function"&&pi;if(!u&&f)return f(c,!0);if(a)return a(c,!0);var y=new Error("Cannot find module '"+c+"'");throw y.code="MODULE_NOT_FOUND",y}var v=i[c]={exports:{}};r[c][0].call(v.exports,function(b){var I=r[c][1][b];return o(I||b)},v,v.exports,n,r,i,s)}return i[c].exports}for(var a=typeof pi=="function"&&pi,l=0;l<s.length;l++)o(s[l]);return o}({1:[function(n,r,i){(function(s){var o=s.MutationObserver||s.WebKitMutationObserver,a;if(o){var l=0,c=new o(b),u=s.document.createTextNode("");c.observe(u,{characterData:!0}),a=function(){u.data=l=++l%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var f=new s.MessageChannel;f.port1.onmessage=b,a=function(){f.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?a=function(){var F=s.document.createElement("script");F.onreadystatechange=function(){b(),F.onreadystatechange=null,F.parentNode.removeChild(F),F=null},s.document.documentElement.appendChild(F)}:a=function(){setTimeout(b,0)};var y,v=[];function b(){y=!0;for(var F,O,A=v.length;A;){for(O=v,v=[],F=-1;++F<A;)O[F]();A=v.length}y=!1}r.exports=I;function I(F){v.push(F)===1&&!y&&a()}}).call(this,typeof hi<"u"?hi:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,r,i){var s=n(1);function o(){}var a={},l=["REJECTED"],c=["FULFILLED"],u=["PENDING"];r.exports=f;function f(h){if(typeof h!="function")throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,h!==o&&I(this,h)}f.prototype.catch=function(h){return this.then(null,h)},f.prototype.then=function(h,S){if(typeof h!="function"&&this.state===c||typeof S!="function"&&this.state===l)return this;var T=new this.constructor(o);if(this.state!==u){var N=this.state===c?h:S;v(T,N,this.outcome)}else this.queue.push(new y(T,h,S));return T};function y(h,S,T){this.promise=h,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof T=="function"&&(this.onRejected=T,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(h){a.resolve(this.promise,h)},y.prototype.otherCallFulfilled=function(h){v(this.promise,this.onFulfilled,h)},y.prototype.callRejected=function(h){a.reject(this.promise,h)},y.prototype.otherCallRejected=function(h){v(this.promise,this.onRejected,h)};function v(h,S,T){s(function(){var N;try{N=S(T)}catch(H){return a.reject(h,H)}N===h?a.reject(h,new TypeError("Cannot resolve promise with itself")):a.resolve(h,N)})}a.resolve=function(h,S){var T=F(b,S);if(T.status==="error")return a.reject(h,T.value);var N=T.value;if(N)I(h,N);else{h.state=c,h.outcome=S;for(var H=-1,X=h.queue.length;++H<X;)h.queue[H].callFulfilled(S)}return h},a.reject=function(h,S){h.state=l,h.outcome=S;for(var T=-1,N=h.queue.length;++T<N;)h.queue[T].callRejected(S);return h};function b(h){var S=h&&h.then;if(h&&(typeof h=="object"||typeof h=="function")&&typeof S=="function")return function(){S.apply(h,arguments)}}function I(h,S){var T=!1;function N(De){T||(T=!0,a.reject(h,De))}function H(De){T||(T=!0,a.resolve(h,De))}function X(){S(H,N)}var Te=F(X);Te.status==="error"&&N(Te.value)}function F(h,S){var T={};try{T.value=h(S),T.status="success"}catch(N){T.status="error",T.value=N}return T}f.resolve=O;function O(h){return h instanceof this?h:a.resolve(new this(o),h)}f.reject=A;function A(h){var S=new this(o);return a.reject(S,h)}f.all=g;function g(h){var S=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var T=h.length,N=!1;if(!T)return this.resolve([]);for(var H=new Array(T),X=0,Te=-1,De=new this(o);++Te<T;)it(h[Te],Te);return De;function it(Vt,En){S.resolve(Vt).then(Le,function(ye){N||(N=!0,a.reject(De,ye))});function Le(ye){H[En]=ye,++X===T&&!N&&(N=!0,a.resolve(De,H))}}}f.race=p;function p(h){var S=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var T=h.length,N=!1;if(!T)return this.resolve([]);for(var H=-1,X=new this(o);++H<T;)Te(h[H]);return X;function Te(De){S.resolve(De).then(function(it){N||(N=!0,a.resolve(X,it))},function(it){N||(N=!0,a.reject(X,it))})}}},{1:1}],3:[function(n,r,i){(function(s){typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof hi<"u"?hi:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,r,i){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d};function o(d,x){if(!(d instanceof x))throw new TypeError("Cannot call a class as a function")}function a(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var l=a();function c(){try{if(!l||!l.open)return!1;var d=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),x=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!d||x)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function u(d,x){d=d||[],x=x||{};try{return new Blob(d,x)}catch(E){if(E.name!=="TypeError")throw E;for(var m=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,P=new m,C=0;C<d.length;C+=1)P.append(d[C]);return P.getBlob(x.type)}}typeof Promise>"u"&&n(3);var f=Promise;function y(d,x){x&&d.then(function(m){x(null,m)},function(m){x(m)})}function v(d,x,m){typeof x=="function"&&d.then(x),typeof m=="function"&&d.catch(m)}function b(d){return typeof d!="string"&&(d=String(d)),d}function I(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var F="local-forage-detect-blob-support",O=void 0,A={},g=Object.prototype.toString,p="readonly",h="readwrite";function S(d){for(var x=d.length,m=new ArrayBuffer(x),P=new Uint8Array(m),C=0;C<x;C++)P[C]=d.charCodeAt(C);return m}function T(d){return new f(function(x){var m=d.transaction(F,h),P=u([""]);m.objectStore(F).put(P,"key"),m.onabort=function(C){C.preventDefault(),C.stopPropagation(),x(!1)},m.oncomplete=function(){var C=navigator.userAgent.match(/Chrome\/(\d+)/),E=navigator.userAgent.match(/Edge\//);x(E||!C||parseInt(C[1],10)>=43)}}).catch(function(){return!1})}function N(d){return typeof O=="boolean"?f.resolve(O):T(d).then(function(x){return O=x,O})}function H(d){var x=A[d.name],m={};m.promise=new f(function(P,C){m.resolve=P,m.reject=C}),x.deferredOperations.push(m),x.dbReady?x.dbReady=x.dbReady.then(function(){return m.promise}):x.dbReady=m.promise}function X(d){var x=A[d.name],m=x.deferredOperations.pop();if(m)return m.resolve(),m.promise}function Te(d,x){var m=A[d.name],P=m.deferredOperations.pop();if(P)return P.reject(x),P.promise}function De(d,x){return new f(function(m,P){if(A[d.name]=A[d.name]||ut(),d.db)if(x)H(d),d.db.close();else return m(d.db);var C=[d.name];x&&C.push(d.version);var E=l.open.apply(l,C);x&&(E.onupgradeneeded=function(D){var B=E.result;try{B.createObjectStore(d.storeName),D.oldVersion<=1&&B.createObjectStore(F)}catch(q){if(q.name!=="ConstraintError")throw q}}),E.onerror=function(D){D.preventDefault(),P(E.error)},E.onsuccess=function(){var D=E.result;D.onversionchange=function(B){B.target.close()},m(D),X(d)}})}function it(d){return De(d,!1)}function Vt(d){return De(d,!0)}function En(d,x){if(!d.db)return!0;var m=!d.db.objectStoreNames.contains(d.storeName),P=d.version<d.db.version,C=d.version>d.db.version;if(P&&(d.version,d.version=d.db.version),C||m){if(m){var E=d.db.version+1;E>d.version&&(d.version=E)}return!0}return!1}function Le(d){return new f(function(x,m){var P=new FileReader;P.onerror=m,P.onloadend=function(C){var E=btoa(C.target.result||"");x({__local_forage_encoded_blob:!0,data:E,type:d.type})},P.readAsBinaryString(d)})}function ye(d){var x=S(atob(d.data));return u([x],{type:d.type})}function we(d){return d&&d.__local_forage_encoded_blob}function Yt(d){var x=this,m=x._initReady().then(function(){var P=A[x._dbInfo.name];if(P&&P.dbReady)return P.dbReady});return v(m,d,d),m}function Zn(d){H(d);for(var x=A[d.name],m=x.forages,P=0;P<m.length;P++){var C=m[P];C._dbInfo.db&&(C._dbInfo.db.close(),C._dbInfo.db=null)}return d.db=null,it(d).then(function(E){return d.db=E,En(d)?Vt(d):E}).then(function(E){d.db=x.db=E;for(var D=0;D<m.length;D++)m[D]._dbInfo.db=E}).catch(function(E){throw Te(d,E),E})}function Ue(d,x,m,P){P===void 0&&(P=1);try{var C=d.db.transaction(d.storeName,x);m(null,C)}catch(E){if(P>0&&(!d.db||E.name==="InvalidStateError"||E.name==="NotFoundError"))return f.resolve().then(function(){if(!d.db||E.name==="NotFoundError"&&!d.db.objectStoreNames.contains(d.storeName)&&d.version<=d.db.version)return d.db&&(d.version=d.db.version+1),Vt(d)}).then(function(){return Zn(d).then(function(){Ue(d,x,m,P-1)})}).catch(m);m(E)}}function ut(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function ds(d){var x=this,m={db:null};if(d)for(var P in d)m[P]=d[P];var C=A[m.name];C||(C=ut(),A[m.name]=C),C.forages.push(x),x._initReady||(x._initReady=x.ready,x.ready=Yt);var E=[];function D(){return f.resolve()}for(var B=0;B<C.forages.length;B++){var q=C.forages[B];q!==x&&E.push(q._initReady().catch(D))}var z=C.forages.slice(0);return f.all(E).then(function(){return m.db=C.db,it(m)}).then(function(K){return m.db=K,En(m,x._defaultConfig.version)?Vt(m):K}).then(function(K){m.db=C.db=K,x._dbInfo=m;for(var J=0;J<z.length;J++){var ae=z[J];ae!==x&&(ae._dbInfo.db=m.db,ae._dbInfo.version=m.version)}})}function wa(d,x){var m=this;d=b(d);var P=new f(function(C,E){m.ready().then(function(){Ue(m._dbInfo,p,function(D,B){if(D)return E(D);try{var q=B.objectStore(m._dbInfo.storeName),z=q.get(d);z.onsuccess=function(){var K=z.result;K===void 0&&(K=null),we(K)&&(K=ye(K)),C(K)},z.onerror=function(){E(z.error)}}catch(K){E(K)}})}).catch(E)});return y(P,x),P}function _a(d,x){var m=this,P=new f(function(C,E){m.ready().then(function(){Ue(m._dbInfo,p,function(D,B){if(D)return E(D);try{var q=B.objectStore(m._dbInfo.storeName),z=q.openCursor(),K=1;z.onsuccess=function(){var J=z.result;if(J){var ae=J.value;we(ae)&&(ae=ye(ae));var be=d(ae,J.key,K++);be!==void 0?C(be):J.continue()}else C()},z.onerror=function(){E(z.error)}}catch(J){E(J)}})}).catch(E)});return y(P,x),P}function kn(d,x,m){var P=this;d=b(d);var C=new f(function(E,D){var B;P.ready().then(function(){return B=P._dbInfo,g.call(x)==="[object Blob]"?N(B.db).then(function(q){return q?x:Le(x)}):x}).then(function(q){Ue(P._dbInfo,h,function(z,K){if(z)return D(z);try{var J=K.objectStore(P._dbInfo.storeName);q===null&&(q=void 0);var ae=J.put(q,d);K.oncomplete=function(){q===void 0&&(q=null),E(q)},K.onabort=K.onerror=function(){var be=ae.error?ae.error:ae.transaction.error;D(be)}}catch(be){D(be)}})}).catch(D)});return y(C,m),C}function er(d,x){var m=this;d=b(d);var P=new f(function(C,E){m.ready().then(function(){Ue(m._dbInfo,h,function(D,B){if(D)return E(D);try{var q=B.objectStore(m._dbInfo.storeName),z=q.delete(d);B.oncomplete=function(){C()},B.onerror=function(){E(z.error)},B.onabort=function(){var K=z.error?z.error:z.transaction.error;E(K)}}catch(K){E(K)}})}).catch(E)});return y(P,x),P}function zr(d){var x=this,m=new f(function(P,C){x.ready().then(function(){Ue(x._dbInfo,h,function(E,D){if(E)return C(E);try{var B=D.objectStore(x._dbInfo.storeName),q=B.clear();D.oncomplete=function(){P()},D.onabort=D.onerror=function(){var z=q.error?q.error:q.transaction.error;C(z)}}catch(z){C(z)}})}).catch(C)});return y(m,d),m}function hs(d){var x=this,m=new f(function(P,C){x.ready().then(function(){Ue(x._dbInfo,p,function(E,D){if(E)return C(E);try{var B=D.objectStore(x._dbInfo.storeName),q=B.count();q.onsuccess=function(){P(q.result)},q.onerror=function(){C(q.error)}}catch(z){C(z)}})}).catch(C)});return y(m,d),m}function Pn(d,x){var m=this,P=new f(function(C,E){if(d<0){C(null);return}m.ready().then(function(){Ue(m._dbInfo,p,function(D,B){if(D)return E(D);try{var q=B.objectStore(m._dbInfo.storeName),z=!1,K=q.openKeyCursor();K.onsuccess=function(){var J=K.result;if(!J){C(null);return}d===0||z?C(J.key):(z=!0,J.advance(d))},K.onerror=function(){E(K.error)}}catch(J){E(J)}})}).catch(E)});return y(P,x),P}function Gf(d){var x=this,m=new f(function(P,C){x.ready().then(function(){Ue(x._dbInfo,p,function(E,D){if(E)return C(E);try{var B=D.objectStore(x._dbInfo.storeName),q=B.openKeyCursor(),z=[];q.onsuccess=function(){var K=q.result;if(!K){P(z);return}z.push(K.key),K.continue()},q.onerror=function(){C(q.error)}}catch(K){C(K)}})}).catch(C)});return y(m,d),m}function _(d,x){x=I.apply(this,arguments);var m=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||m.name,d.storeName=d.storeName||m.storeName);var P=this,C;if(!d.name)C=f.reject("Invalid arguments");else{var E=d.name===m.name&&P._dbInfo.db,D=E?f.resolve(P._dbInfo.db):it(d).then(function(B){var q=A[d.name],z=q.forages;q.db=B;for(var K=0;K<z.length;K++)z[K]._dbInfo.db=B;return B});d.storeName?C=D.then(function(B){if(B.objectStoreNames.contains(d.storeName)){var q=B.version+1;H(d);var z=A[d.name],K=z.forages;B.close();for(var J=0;J<K.length;J++){var ae=K[J];ae._dbInfo.db=null,ae._dbInfo.version=q}var be=new f(function(xe,Re){var Ie=l.open(d.name,q);Ie.onerror=function(yt){var Kr=Ie.result;Kr.close(),Re(yt)},Ie.onupgradeneeded=function(){var yt=Ie.result;yt.deleteObjectStore(d.storeName)},Ie.onsuccess=function(){var yt=Ie.result;yt.close(),xe(yt)}});return be.then(function(xe){z.db=xe;for(var Re=0;Re<K.length;Re++){var Ie=K[Re];Ie._dbInfo.db=xe,X(Ie._dbInfo)}}).catch(function(xe){throw(Te(d,xe)||f.resolve()).catch(function(){}),xe})}}):C=D.then(function(B){H(d);var q=A[d.name],z=q.forages;B.close();for(var K=0;K<z.length;K++){var J=z[K];J._dbInfo.db=null}var ae=new f(function(be,xe){var Re=l.deleteDatabase(d.name);Re.onerror=function(){var Ie=Re.result;Ie&&Ie.close(),xe(Re.error)},Re.onblocked=function(){},Re.onsuccess=function(){var Ie=Re.result;Ie&&Ie.close(),be(Ie)}});return ae.then(function(be){q.db=be;for(var xe=0;xe<z.length;xe++){var Re=z[xe];X(Re._dbInfo)}}).catch(function(be){throw(Te(d,be)||f.resolve()).catch(function(){}),be})})}return y(C,x),C}var k={_driver:"asyncStorage",_initStorage:ds,_support:c(),iterate:_a,getItem:wa,setItem:kn,removeItem:er,clear:zr,length:hs,key:Pn,keys:Gf,dropInstance:_};function R(){return typeof openDatabase=="function"}var L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M="~~local_forage_type~",j=/^~~local_forage_type~([^~]+)~/,G="__lfsc__:",V=G.length,W="arbf",U="blob",ee="si08",Q="ui08",Z="uic8",re="si16",ce="si32",_e="ur16",pe="ui32",qe="fl32",ze="fl64",ft=V+W.length,dt=Object.prototype.toString;function cn(d){var x=d.length*.75,m=d.length,P,C=0,E,D,B,q;d[d.length-1]==="="&&(x--,d[d.length-2]==="="&&x--);var z=new ArrayBuffer(x),K=new Uint8Array(z);for(P=0;P<m;P+=4)E=L.indexOf(d[P]),D=L.indexOf(d[P+1]),B=L.indexOf(d[P+2]),q=L.indexOf(d[P+3]),K[C++]=E<<2|D>>4,K[C++]=(D&15)<<4|B>>2,K[C++]=(B&3)<<6|q&63;return z}function tr(d){var x=new Uint8Array(d),m="",P;for(P=0;P<x.length;P+=3)m+=L[x[P]>>2],m+=L[(x[P]&3)<<4|x[P+1]>>4],m+=L[(x[P+1]&15)<<2|x[P+2]>>6],m+=L[x[P+2]&63];return x.length%3===2?m=m.substring(0,m.length-1)+"=":x.length%3===1&&(m=m.substring(0,m.length-2)+"=="),m}function Xe(d,x){var m="";if(d&&(m=dt.call(d)),d&&(m==="[object ArrayBuffer]"||d.buffer&&dt.call(d.buffer)==="[object ArrayBuffer]")){var P,C=G;d instanceof ArrayBuffer?(P=d,C+=W):(P=d.buffer,m==="[object Int8Array]"?C+=ee:m==="[object Uint8Array]"?C+=Q:m==="[object Uint8ClampedArray]"?C+=Z:m==="[object Int16Array]"?C+=re:m==="[object Uint16Array]"?C+=_e:m==="[object Int32Array]"?C+=ce:m==="[object Uint32Array]"?C+=pe:m==="[object Float32Array]"?C+=qe:m==="[object Float64Array]"?C+=ze:x(new Error("Failed to get type for BinaryArray"))),x(C+tr(P))}else if(m==="[object Blob]"){var E=new FileReader;E.onload=function(){var D=M+d.type+"~"+tr(this.result);x(G+U+D)},E.readAsArrayBuffer(d)}else try{x(JSON.stringify(d))}catch(D){x(null,D)}}function vt(d){if(d.substring(0,V)!==G)return JSON.parse(d);var x=d.substring(ft),m=d.substring(V,ft),P;if(m===U&&j.test(x)){var C=x.match(j);P=C[1],x=x.substring(C[0].length)}var E=cn(x);switch(m){case W:return E;case U:return u([E],{type:P});case ee:return new Int8Array(E);case Q:return new Uint8Array(E);case Z:return new Uint8ClampedArray(E);case re:return new Int16Array(E);case _e:return new Uint16Array(E);case ce:return new Int32Array(E);case pe:return new Uint32Array(E);case qe:return new Float32Array(E);case ze:return new Float64Array(E);default:throw new Error("Unkown type: "+m)}}var nr={serialize:Xe,deserialize:vt,stringToBuffer:cn,bufferToString:tr};function Hr(d,x,m,P){d.executeSql("CREATE TABLE IF NOT EXISTS "+x.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],m,P)}function Yb(d){var x=this,m={db:null};if(d)for(var P in d)m[P]=typeof d[P]!="string"?d[P].toString():d[P];var C=new f(function(E,D){try{m.db=openDatabase(m.name,String(m.version),m.description,m.size)}catch(B){return D(B)}m.db.transaction(function(B){Hr(B,m,function(){x._dbInfo=m,E()},function(q,z){D(z)})},D)});return m.serializer=nr,C}function un(d,x,m,P,C,E){d.executeSql(m,P,C,function(D,B){B.code===B.SYNTAX_ERR?D.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[x.storeName],function(q,z){z.rows.length?E(q,B):Hr(q,x,function(){q.executeSql(m,P,C,E)},E)},E):E(D,B)},E)}function Gb(d,x){var m=this;d=b(d);var P=new f(function(C,E){m.ready().then(function(){var D=m._dbInfo;D.db.transaction(function(B){un(B,D,"SELECT * FROM "+D.storeName+" WHERE key = ? LIMIT 1",[d],function(q,z){var K=z.rows.length?z.rows.item(0).value:null;K&&(K=D.serializer.deserialize(K)),C(K)},function(q,z){E(z)})})}).catch(E)});return y(P,x),P}function Qb(d,x){var m=this,P=new f(function(C,E){m.ready().then(function(){var D=m._dbInfo;D.db.transaction(function(B){un(B,D,"SELECT * FROM "+D.storeName,[],function(q,z){for(var K=z.rows,J=K.length,ae=0;ae<J;ae++){var be=K.item(ae),xe=be.value;if(xe&&(xe=D.serializer.deserialize(xe)),xe=d(xe,be.key,ae+1),xe!==void 0){C(xe);return}}C()},function(q,z){E(z)})})}).catch(E)});return y(P,x),P}function Qf(d,x,m,P){var C=this;d=b(d);var E=new f(function(D,B){C.ready().then(function(){x===void 0&&(x=null);var q=x,z=C._dbInfo;z.serializer.serialize(x,function(K,J){J?B(J):z.db.transaction(function(ae){un(ae,z,"INSERT OR REPLACE INTO "+z.storeName+" (key, value) VALUES (?, ?)",[d,K],function(){D(q)},function(be,xe){B(xe)})},function(ae){if(ae.code===ae.QUOTA_ERR){if(P>0){D(Qf.apply(C,[d,q,m,P-1]));return}B(ae)}})})}).catch(B)});return y(E,m),E}function Jb(d,x,m){return Qf.apply(this,[d,x,m,1])}function Xb(d,x){var m=this;d=b(d);var P=new f(function(C,E){m.ready().then(function(){var D=m._dbInfo;D.db.transaction(function(B){un(B,D,"DELETE FROM "+D.storeName+" WHERE key = ?",[d],function(){C()},function(q,z){E(z)})})}).catch(E)});return y(P,x),P}function Zb(d){var x=this,m=new f(function(P,C){x.ready().then(function(){var E=x._dbInfo;E.db.transaction(function(D){un(D,E,"DELETE FROM "+E.storeName,[],function(){P()},function(B,q){C(q)})})}).catch(C)});return y(m,d),m}function ew(d){var x=this,m=new f(function(P,C){x.ready().then(function(){var E=x._dbInfo;E.db.transaction(function(D){un(D,E,"SELECT COUNT(key) as c FROM "+E.storeName,[],function(B,q){var z=q.rows.item(0).c;P(z)},function(B,q){C(q)})})}).catch(C)});return y(m,d),m}function tw(d,x){var m=this,P=new f(function(C,E){m.ready().then(function(){var D=m._dbInfo;D.db.transaction(function(B){un(B,D,"SELECT key FROM "+D.storeName+" WHERE id = ? LIMIT 1",[d+1],function(q,z){var K=z.rows.length?z.rows.item(0).key:null;C(K)},function(q,z){E(z)})})}).catch(E)});return y(P,x),P}function nw(d){var x=this,m=new f(function(P,C){x.ready().then(function(){var E=x._dbInfo;E.db.transaction(function(D){un(D,E,"SELECT key FROM "+E.storeName,[],function(B,q){for(var z=[],K=0;K<q.rows.length;K++)z.push(q.rows.item(K).key);P(z)},function(B,q){C(q)})})}).catch(C)});return y(m,d),m}function rw(d){return new f(function(x,m){d.transaction(function(P){P.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(C,E){for(var D=[],B=0;B<E.rows.length;B++)D.push(E.rows.item(B).name);x({db:d,storeNames:D})},function(C,E){m(E)})},function(P){m(P)})})}function iw(d,x){x=I.apply(this,arguments);var m=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||m.name,d.storeName=d.storeName||m.storeName);var P=this,C;return d.name?C=new f(function(E){var D;d.name===m.name?D=P._dbInfo.db:D=openDatabase(d.name,"","",0),d.storeName?E({db:D,storeNames:[d.storeName]}):E(rw(D))}).then(function(E){return new f(function(D,B){E.db.transaction(function(q){function z(be){return new f(function(xe,Re){q.executeSql("DROP TABLE IF EXISTS "+be,[],function(){xe()},function(Ie,yt){Re(yt)})})}for(var K=[],J=0,ae=E.storeNames.length;J<ae;J++)K.push(z(E.storeNames[J]));f.all(K).then(function(){D()}).catch(function(be){B(be)})},function(q){B(q)})})}):C=f.reject("Invalid arguments"),y(C,x),C}var sw={_driver:"webSQLStorage",_initStorage:Yb,_support:R(),iterate:Qb,getItem:Gb,setItem:Jb,removeItem:Xb,clear:Zb,length:ew,key:tw,keys:nw,dropInstance:iw};function ow(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Jf(d,x){var m=d.name+"/";return d.storeName!==x.storeName&&(m+=d.storeName+"/"),m}function aw(){var d="_localforage_support_test";try{return localStorage.setItem(d,!0),localStorage.removeItem(d),!1}catch{return!0}}function lw(){return!aw()||localStorage.length>0}function cw(d){var x=this,m={};if(d)for(var P in d)m[P]=d[P];return m.keyPrefix=Jf(d,x._defaultConfig),lw()?(x._dbInfo=m,m.serializer=nr,f.resolve()):f.reject()}function uw(d){var x=this,m=x.ready().then(function(){for(var P=x._dbInfo.keyPrefix,C=localStorage.length-1;C>=0;C--){var E=localStorage.key(C);E.indexOf(P)===0&&localStorage.removeItem(E)}});return y(m,d),m}function fw(d,x){var m=this;d=b(d);var P=m.ready().then(function(){var C=m._dbInfo,E=localStorage.getItem(C.keyPrefix+d);return E&&(E=C.serializer.deserialize(E)),E});return y(P,x),P}function dw(d,x){var m=this,P=m.ready().then(function(){for(var C=m._dbInfo,E=C.keyPrefix,D=E.length,B=localStorage.length,q=1,z=0;z<B;z++){var K=localStorage.key(z);if(K.indexOf(E)===0){var J=localStorage.getItem(K);if(J&&(J=C.serializer.deserialize(J)),J=d(J,K.substring(D),q++),J!==void 0)return J}}});return y(P,x),P}function hw(d,x){var m=this,P=m.ready().then(function(){var C=m._dbInfo,E;try{E=localStorage.key(d)}catch{E=null}return E&&(E=E.substring(C.keyPrefix.length)),E});return y(P,x),P}function pw(d){var x=this,m=x.ready().then(function(){for(var P=x._dbInfo,C=localStorage.length,E=[],D=0;D<C;D++){var B=localStorage.key(D);B.indexOf(P.keyPrefix)===0&&E.push(B.substring(P.keyPrefix.length))}return E});return y(m,d),m}function gw(d){var x=this,m=x.keys().then(function(P){return P.length});return y(m,d),m}function vw(d,x){var m=this;d=b(d);var P=m.ready().then(function(){var C=m._dbInfo;localStorage.removeItem(C.keyPrefix+d)});return y(P,x),P}function yw(d,x,m){var P=this;d=b(d);var C=P.ready().then(function(){x===void 0&&(x=null);var E=x;return new f(function(D,B){var q=P._dbInfo;q.serializer.serialize(x,function(z,K){if(K)B(K);else try{localStorage.setItem(q.keyPrefix+d,z),D(E)}catch(J){(J.name==="QuotaExceededError"||J.name==="NS_ERROR_DOM_QUOTA_REACHED")&&B(J),B(J)}})})});return y(C,m),C}function bw(d,x){if(x=I.apply(this,arguments),d=typeof d!="function"&&d||{},!d.name){var m=this.config();d.name=d.name||m.name,d.storeName=d.storeName||m.storeName}var P=this,C;return d.name?C=new f(function(E){d.storeName?E(Jf(d,P._defaultConfig)):E(d.name+"/")}).then(function(E){for(var D=localStorage.length-1;D>=0;D--){var B=localStorage.key(D);B.indexOf(E)===0&&localStorage.removeItem(B)}}):C=f.reject("Invalid arguments"),y(C,x),C}var ww={_driver:"localStorageWrapper",_initStorage:cw,_support:ow(),iterate:dw,getItem:fw,setItem:yw,removeItem:vw,clear:uw,length:gw,key:hw,keys:pw,dropInstance:bw},_w=function(x,m){return x===m||typeof x=="number"&&typeof m=="number"&&isNaN(x)&&isNaN(m)},xw=function(x,m){for(var P=x.length,C=0;C<P;){if(_w(x[C],m))return!0;C++}return!1},Xf=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"},Wr={},Zf={},rr={INDEXEDDB:k,WEBSQL:sw,LOCALSTORAGE:ww},Sw=[rr.INDEXEDDB._driver,rr.WEBSQL._driver,rr.LOCALSTORAGE._driver],ps=["dropInstance"],xa=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ps),Ew={description:"",driver:Sw.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function kw(d,x){d[x]=function(){var m=arguments;return d.ready().then(function(){return d[x].apply(d,m)})}}function Sa(){for(var d=1;d<arguments.length;d++){var x=arguments[d];if(x)for(var m in x)x.hasOwnProperty(m)&&(Xf(x[m])?arguments[0][m]=x[m].slice():arguments[0][m]=x[m])}return arguments[0]}var Pw=function(){function d(x){o(this,d);for(var m in rr)if(rr.hasOwnProperty(m)){var P=rr[m],C=P._driver;this[m]=C,Wr[C]||this.defineDriver(P)}this._defaultConfig=Sa({},Ew),this._config=Sa({},this._defaultConfig,x),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return d.prototype.config=function(m){if((typeof m>"u"?"undefined":s(m))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var P in m){if(P==="storeName"&&(m[P]=m[P].replace(/\W/g,"_")),P==="version"&&typeof m[P]!="number")return new Error("Database version must be a number.");this._config[P]=m[P]}return"driver"in m&&m.driver?this.setDriver(this._config.driver):!0}else return typeof m=="string"?this._config[m]:this._config},d.prototype.defineDriver=function(m,P,C){var E=new f(function(D,B){try{var q=m._driver,z=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!m._driver){B(z);return}for(var K=xa.concat("_initStorage"),J=0,ae=K.length;J<ae;J++){var be=K[J],xe=!xw(ps,be);if((xe||m[be])&&typeof m[be]!="function"){B(z);return}}var Re=function(){for(var Kr=function(Tw){return function(){var Iw=new Error("Method "+Tw+" is not implemented by the current driver"),ed=f.reject(Iw);return y(ed,arguments[arguments.length-1]),ed}},Ea=0,Cw=ps.length;Ea<Cw;Ea++){var ka=ps[Ea];m[ka]||(m[ka]=Kr(ka))}};Re();var Ie=function(Kr){Wr[q],Wr[q]=m,Zf[q]=Kr,D()};"_support"in m?m._support&&typeof m._support=="function"?m._support().then(Ie,B):Ie(!!m._support):Ie(!0)}catch(yt){B(yt)}});return v(E,P,C),E},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(m,P,C){var E=Wr[m]?f.resolve(Wr[m]):f.reject(new Error("Driver not found."));return v(E,P,C),E},d.prototype.getSerializer=function(m){var P=f.resolve(nr);return v(P,m),P},d.prototype.ready=function(m){var P=this,C=P._driverSet.then(function(){return P._ready===null&&(P._ready=P._initDriver()),P._ready});return v(C,m,m),C},d.prototype.setDriver=function(m,P,C){var E=this;Xf(m)||(m=[m]);var D=this._getSupportedDrivers(m);function B(){E._config.driver=E.driver()}function q(J){return E._extend(J),B(),E._ready=E._initStorage(E._config),E._ready}function z(J){return function(){var ae=0;function be(){for(;ae<J.length;){var xe=J[ae];return ae++,E._dbInfo=null,E._ready=null,E.getDriver(xe).then(q).catch(be)}B();var Re=new Error("No available storage method found.");return E._driverSet=f.reject(Re),E._driverSet}return be()}}var K=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=K.then(function(){var J=D[0];return E._dbInfo=null,E._ready=null,E.getDriver(J).then(function(ae){E._driver=ae._driver,B(),E._wrapLibraryMethodsWithReady(),E._initDriver=z(D)})}).catch(function(){B();var J=new Error("No available storage method found.");return E._driverSet=f.reject(J),E._driverSet}),v(this._driverSet,P,C),this._driverSet},d.prototype.supports=function(m){return!!Zf[m]},d.prototype._extend=function(m){Sa(this,m)},d.prototype._getSupportedDrivers=function(m){for(var P=[],C=0,E=m.length;C<E;C++){var D=m[C];this.supports(D)&&P.push(D)}return P},d.prototype._wrapLibraryMethodsWithReady=function(){for(var m=0,P=xa.length;m<P;m++)kw(this,xa[m])},d.prototype.createInstance=function(m){return new d(m)},d}(),$w=new Pw;r.exports=$w},{3:3}]},{},[4])(4)})}(Ks)),Ks.exports}var Ep=Sp();const xl=xp(Ep);class kp extends Jt{constructor(e){super(e,"storage",!1),e.set("localforage",xl)}get StorageManager(){return mi}createDatabse(e,n,r){return new mi("InPageEdit",e,n,r)}}const Xn=class Xn{constructor(e,n,r=Xn.DEFAULT_TTL,i){this.dbName=e,this.storeName=n,this.ttl=r,this.version=i,this.db=Xn.createDatabase(e,n),this.keys=this.db.keys.bind(this.db)}static createDatabase(e,n){const r=`${e}:${n}`;if(this._cached_db_instances.has(r))return this._cached_db_instances.get(r);const i=xl.createInstance({name:e,storeName:n});return this._cached_db_instances.set(r,i),i}async get(e,n=this.ttl,r){const i=await this.loadFromDB(e),s=this.checkIfExpired(i,n);if(!i||s){if(typeof r=="function"){const o=await r();return this.set(e,o).then(()=>o)}return null}return i.value}async set(e,n){return n===null||typeof n>"u"?this.delete(e):this.db.setItem(e,{time:Date.now(),value:n,version:this.version})}async has(e,n=this.ttl){const r=await this.loadFromDB(e),i=this.checkIfExpired(r,n);return r!==null&&!i}async delete(e){return this.db.removeItem(e)}async iterate(e){return await this.db.iterate((n,r)=>{e(n.value,r)})}async loadFromDB(e){const n=await this.db.getItem(e);if(!n)return null;if(typeof n.time!="number"||typeof n.value>"u"){try{this.delete(e)}catch{}return null}if(typeof this.version=="number"&&n.version!==this.version){try{this.delete(e)}catch{}return null}return n}checkIfExpired(e,n=this.ttl){return e?Date.now()-e.time>n:!1}async clear(){return await this.db.clear(),this}};Xn.DEFAULT_TTL=1/0,Xn._cached_db_instances=new Map;let mi=Xn;var wt=(t=>(t.preferences="preferences",t.watch="watch",t.unwatch="unwatch",t.nochange="nochange",t))(wt||{});function Pp(t){const n=class n{constructor(i,s=!0){this._loaded=s,this.api=t,i.revisions?.forEach(o=>{typeof o?.slots?.main=="object"&&Object.assign(o,o.slots.main)}),this.pageInfo={...n.DEFAULT_PAGE_INFO,...i}}static async newFromApi(i){const{data:s}=await this.api.get({...n.DEFAULT_QUERY_PARAMS,...i}),o=s?.query?.pages?.[0];if(!o)throw new Error("Invalid page info",{cause:s});return new n(o,!0)}static newBlankPage(i={}){return new n(i,!1)}async parse(i){return this.api.post({action:"parse",page:this.pageInfo.title,prop:"text|langlinks|categories|links|templates|images|externallinks|sections|revid|displaytitle|iwlinks|properties|parsewarnings",...i})}async preview(i,s){return this.parse({action:"parse",page:void 0,title:this.title,text:i,pst:1,preview:1,disableeditsection:1,disablelimitreport:1,...s})}async edit(i,s){const{text:o,prependtext:a,appendtext:l,summary:c="",watchlist:u=wt.preferences,section:f}=i;return this.api.postWithEditToken({action:"edit",title:this.title,starttimestamp:this.pageInfo.touched,basetimestamp:this.revisions[0]?.timestamp,text:o,prependtext:a,appendtext:l,summary:c,watchlist:u,section:f,...s})}async createOnly(i,s){return this.edit(i,{createonly:1,...s})}async delete(i,s){return this.api.postWithEditToken({action:"delete",pageid:this.pageInfo.pageid,reason:i,...s})}async moveTo(i,s,o){return this.api.postWithEditToken({action:"move",from:this.pageInfo.title,to:i,reason:s,movetalk:1,movesubpages:1,...o})}userCan(i){return!!this.pageInfo?.actions?.[i]}userCanEdit(){return this.userCan("edit")}async reloadSelfInfo(){const i=await n.newFromApi({pageids:this.pageInfo.pageid,titles:this.pageInfo.title}),s=(this.pageInfo.revisions||[]).concat(i.revisions||[]).sort((o,a)=>o.revid-a.revid).reduce((o,a)=>(o.find(l=>l.revid===a.revid)||o.push(a),o),[]);return this.pageInfo=i.pageInfo,this.pageInfo.revisions=s,this._loaded=!0,this}get pageid(){return this.pageInfo.pageid}get title(){return this.pageInfo.title}get ns(){return this.pageInfo.ns}get contentmodel(){return this.pageInfo.contentmodel}get fullurl(){return this.pageInfo.fullurl}get canonicalurl(){return this.pageInfo.canonicalurl}get editurl(){return this.pageInfo.editurl}get revisions(){return this.pageInfo.revisions||[]}get lastrevid(){return this.pageInfo.lastrevid}get templates(){return this.pageInfo.templates||[]}get images(){return this.pageInfo.images||[]}};n.api=t,n.DEFAULT_QUERY_PARAMS={action:"query",prop:"info|templates|transcludedin|images|pageimages|revisions",inprop:"protection|url|varianttitles",intestactions:"edit|move|delete",tllimit:"max",tilimit:"max",imlimit:"max",piprop:"thumbnail|name|original",pithumbsize:"200",pilimit:"max",rvprop:"ids|timestamp|flags|comment|user|content",rvslots:"main"},n.DEFAULT_PAGE_INFO={pageid:0,ns:0,title:"",contentmodel:"wikitext",pagelanguage:"",pagelanguagehtmlcode:"",pagelanguagedir:"ltr",touched:new Date().toISOString(),lastrevid:0,length:0,protection:[],restrictiontypes:[],fullurl:"",canonicalurl:"",editurl:"",varianttitles:{},actions:{edit:!0,move:!1,delete:!1},revisions:[],templates:[],images:[]};let e=n;return e}const va=class va extends Jt{constructor(e){super(e,"wikiPage",!0),this.ctx=e,this.logger=this.ctx.logger("WIKI_PAGE"),this.WikiPage=Pp(this.ctx.api)}async createInstance(e,n=!1){return await this.WikiPage.newFromApi(e)}async newFromTitle(e,n=!1,r,i=!1){return this.createInstance({titles:e,converttitles:n,rvsection:r},i)}async newFromPageId(e,n,r=!1){return this.createInstance({pageids:e,rvsection:n},r)}async newFromRevision(e,n,r=!1){return await this.createInstance({revids:e,rvsection:n},r)}newBlankPage(e={}){return this.WikiPage.newBlankPage(e)}};va.inject=["api"];let Vs=va;const Sl=new WeakMap,Pt={toDBKey:t=>t.replace(/ /g,"_"),toNormalText:t=>t.replace(/_/g," "),ensureCase:(t,e)=>e==="first-letter"?t.charAt(0).toUpperCase()+t.slice(1):t},In={normalizeSpecialPageName:t=>t.toLowerCase(),buildSpecialPageIndex:t=>{const e=new Map,n=new Map,r=new Map;for(const i of t.specialpagealiases){const s=i.realname;e.set(s,s);const o=In.normalizeSpecialPageName(s);r.set(o,s);for(const a of i.aliases){n.set(a,s);const l=In.normalizeSpecialPageName(a);r.set(l,s)}}return{byRealName:e,byAlias:n,byNormalized:r}},findSpecialPageRealName:(t,e)=>{const n=t.split("/")[0];let r=e.byRealName.get(n)??e.byAlias.get(n);if(r!==void 0)return r;const i=In.normalizeSpecialPageName(n);return e.byNormalized.get(i)??null}},$t={normalizeNamespaceText:t=>t.replace(/[_\s]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),buildIndex:t=>{const e=new Map,n=new Map,r=new Map,i=new Map;for(const[s,o]of Object.entries(t.namespaces)){const a=parseInt(s);e.set(o.name,a),n.set(o.canonical??"",a);const l=$t.normalizeNamespaceText(o.name),c=$t.normalizeNamespaceText(o.canonical??"");i.set(l,a),i.set(c,a)}for(const s of t.namespacealiases){r.set(s.alias,s.id);const o=$t.normalizeNamespaceText(s.alias);i.set(o,s.id)}return{byName:e,byCanonical:n,byAlias:r,byNormalized:i}},findNamespaceId:(t,e)=>{let n=e.byName.get(t)??e.byCanonical.get(t)??e.byAlias.get(t);if(n!==void 0)return n;const r=$t.normalizeNamespaceText(t);return e.byNormalized.get(r)??null},isTalkPage:t=>t%2===1&&t>0,getDefaultNamespaceInfo:t=>({id:t,name:"",canonical:"",case:"first-letter",content:!1,nonincludable:!1,subpages:!1})};function $p(t){var s,o;const e=Sl.get(t);if(e)return e;const n=$t.buildIndex(t),r=In.buildSpecialPageIndex(t),a=class a{constructor(c,u){ir(this,s);ir(this,o);this.newTitle=a.create.bind(a),this.toText=this.getPrefixedText.bind(this),this.toString=this.getPrefixedDBKey.bind(this),bt(this,s,c||""),bt(this,o,u??0),u===void 0&&this.fixNSByTitle()}static create(c,u){return new a(c,u)}fixNSByTitle(){const c=he(this,s).indexOf(":");if(c===-1)return;if(c===0){bt(this,s,he(this,s).substring(1));return}const u=he(this,s).substring(0,c),f=he(this,s).substring(c+1),y=$t.findNamespaceId(u,a._namespaceIndex);y!==null&&(bt(this,s,f),bt(this,o,y))}getNamespaceInfo(){return a._meta.namespaces[he(this,o)]??$t.getDefaultNamespaceInfo(he(this,o))}getMainDBKey(){const c=this.getNamespaceInfo();if(he(this,o)===-1){const u=In.findSpecialPageRealName(he(this,s),a._specialPageIndex);if(u){const f=he(this,s).includes("/")?he(this,s).substring(he(this,s).indexOf("/")):"",y=u+f;return Pt.ensureCase(Pt.toDBKey(y),c.case)}}return Pt.ensureCase(Pt.toDBKey(he(this,s)),c.case)}getMainText(){const c=this.getNamespaceInfo();if(he(this,o)===-1){const u=In.findSpecialPageRealName(he(this,s),a._specialPageIndex);if(u){const f=he(this,s).includes("/")?he(this,s).substring(he(this,s).indexOf("/")):"",y=u+f;return Pt.ensureCase(Pt.toNormalText(y),c.case)}}return Pt.ensureCase(Pt.toNormalText(he(this,s)),c.case)}getMainRootText(){return this.getMainText().split("/")[0]}getPrefixedDBKey(){return he(this,o)===0?this.getMainDBKey():`${this.getNamespaceDBKey()}:${this.getMainDBKey()}`}getPrefixedText(){return he(this,o)===0?this.getMainText():`${this.getNamespaceText()}:${this.getMainText()}`}getNamespaceId(){return he(this,o)}getNamespaceText(){return this.getNamespaceInfo().name??""}getNamespaceDBKey(){const c=this.getNamespaceInfo();return Pt.ensureCase(Pt.toDBKey(this.getNamespaceText()),c.case)}getSubjectPage(){if($t.isTalkPage(he(this,o))){const c=he(this,o)-1;return new a(he(this,s),c)}return this}getTalkPage(){if($t.isTalkPage(he(this,o)))return this;if(he(this,o)<0)return null;const c=he(this,o)+1;return a._meta.namespaces[c.toString()]?new a(he(this,s),c):null}getURL(c){const u=a._meta.general.articlepath,f=this.getPrefixedDBKey(),y=u.replace("$1",f),v=new URL(y,a._meta.general.base);return c&&(c instanceof URLSearchParams?c:new URLSearchParams(c)).forEach((I,F)=>{v.searchParams.set(F,I)}),v}setTitle(c){return bt(this,s,c),bt(this,o,0),this.fixNSByTitle(),this}setMainText(c){return bt(this,s,c),this}setNamespaceText(c){const u=$t.findNamespaceId(c,a._namespaceIndex);return u!==null&&bt(this,o,u),this}setNamespaceId(c){return bt(this,o,c),this}equals(c){return typeof c=="string"&&(c=new a(c)),this.getPrefixedDBKey()===c.getPrefixedDBKey()}isSpecial(c){if(he(this,o)!==-1)return!1;const u=new a(c,-1);return this.getMainRootText()===u.getMainRootText()}toJSON(){return{ns:he(this,o),text:this.getMainText(),title:this.getPrefixedText(),url:this.getURL().toString(),isSpecial:he(this,o)<0}}};s=new WeakMap,o=new WeakMap,a._meta=t,a._namespaceIndex=n,a._specialPageIndex=r;let i=a;return Sl.set(t,i),i}const Br=class Br extends Jt{constructor(e){super(e,"wikiTitle",!0),this.ctx=e,this.logger=this.ctx.logger("WikiTitleService"),this._titleByPageId=new Map,this.wiki=this.ctx.wiki,this.wikiBaseUrl=this.wiki.baseUrl,this.wikiArticlePath=this.wiki.articlePath.replace("$1",""),this.wikiArticleBaseUrl=this.wiki.articleBaseUrl.replace("$1",""),this.wikiIndexPhpUrl=this.wiki.getSciprtUrl("index.php"),this.Title=$p(this.ctx.wiki._raw)}newTitle(e,n){return new this.Title(e,n)}async newTitleFromUrl(e){const n=this.parseWikiLink(e);return n?.title?n.title:n?.pageId?this.newTitleFromPageId(n.pageId):null}async newTitleFromPageId(e){if(e=parseInt(e,10),isNaN(e)||e<=0)return null;if(this._titleByPageId.has(e))return this._titleByPageId.get(e);const{promise:n,resolve:r,reject:i}=ge();return this._titleByPageId.set(e,n),this.ctx.inject(["wikiPage"],async s=>{try{const o=await s.wikiPage.newFromPageId(e);r(this.newTitle(o.title))}catch(o){this._titleByPageId.delete(e),i(o)}}),n}resolveSpecialPageTarget(e){const n=typeof e=="string"?this.newTitle(e):e;if(!n||n.getNamespaceId()!==-1)return null;let r,i,s="view";const o=n.getMainDBKey().split("/").slice(1).join("/")||"";if(n.isSpecial("edit")&&o)r=o,s="edit";else if(n.isSpecial("talkpage")&&o){const a=n.newTitle(o).getTalkPage();if(!a)return null;r=a.getPrefixedDBKey()}else if(n.isSpecial("mypage"))r=n.newTitle(this.ctx.wiki.userInfo.name,2).getPrefixedDBKey()+(o?`/${o}`:"");else if(n.isSpecial("mytalk"))r=n.newTitle(this.ctx.wiki.userInfo.name,3).getPrefixedDBKey()+(o?`/${o}`:"");else if(n.isSpecial("newsection")&&o)r=o,i="new",s="edit";else return null;return{title:new this.Title(r),section:i,action:s}}isWikiLink(e){return e.startsWith(this.wikiArticleBaseUrl)||e.startsWith(this.wikiIndexPhpUrl)||e.startsWith(`${this.wikiBaseUrl}/?`)}validateHrefAttr(e){return typeof e!="string"?!1:!Br.REG_SKIPPED_HREF.test(e)}parseWikiLink(e){if(!e||typeof e=="string"&&!this.validateHrefAttr(e))return null;const n=ml(e);if(!this.isWikiLink(n.toString()))return null;const r=n.searchParams,i=n.hash.replace("#",""),s=r.get("action")||"view",o=r.get("title")||"",a=parseInt(r.get("curid")||"0",10);let l=o||(()=>{try{return decodeURIComponent(n.pathname.substring(this.wikiArticlePath.length))}catch(f){return this.logger.error("parseLink",n,f),""}})();l.endsWith("index.php")&&(l="");let c=null,u=null;if(a)u=a;else if(l)c=this.newTitle(l);else return null;return{title:c,pageId:u,url:n,params:r,hash:i,action:s}}};Br.inject=["wiki"],Br.REG_SKIPPED_HREF=/^(#|javascript:|vbscript:|file:)/i;let Ys=Br;var gi=(t=>(t.ANALYTICS_API_BASE="https://analytics.ipe.wiki/api",t.ANALYTICS_DASH_URL="https://analytics.ipe.wiki",t.GITHUB_URL="https://github.com/inpageedit/inpageedit-next",t.HOME_URL="https://www.ipe.wiki/",t.UPDATE_LOGS_URL="https://www.ipe.wiki/changelogs/",t))(gi||{});/**
52
52
  * ✏️ InPageEdit NEXT
53
53
  *
54
54
  * 🚀 Modular, Extensible Supercharged Plugin for MediaWiki
@@ -57,53 +57,55 @@
57
57
  * @license MIT
58
58
  * @see https://github.com/inpageedit/inpageedit-next
59
59
  * @see https://www.ipe.wiki/
60
- */const Ur=class Ur extends Ze{constructor(n){super({name:"InPageEdit"});ir(this,Mt);this.version="0.8.1",this.Endpoints=Ys,this.schema=fe,this.config={...Ur.DEFAULT_CONFIG,...n},this.logger=za({name:"IPE",color:"#33aaff",level:this.config.logLevel}),ht(this,Mt,ad).call(this),ht(this,Mt,cd).call(this),ht(this,Mt,ud).call(this)}async useScope(n){const{promise:r,resolve:i}=ge();return this.inject(n,s=>{i(s)}),r}};Mt=new WeakSet,ad=async function(){this.plugin(ah,this.config.apiConfigs),this.plugin(ii),this.plugin(yh),this.plugin(fp),this.plugin(kp),this.plugin(di),this.plugin(Ks),this.plugin(Vs),ht(this,Mt,ld).call(this,["api","currentPage","resourceLoader","modal","storage","wikiPage","wikiTitle","wiki","getUrl","getSciprtUrl","getMainpageUrl"])},ld=function(n){if(typeof n=="string"&&(n=[n]),!Array.isArray(n)||n.length===0)return this;for(const r of n){const i=this[Ur.internal][r];i?.type==="service"&&(i.builtin=!0)}return this},cd=async function(){[Promise.resolve().then(()=>qp).then(({PluginInArticleLinks:r})=>r),Promise.resolve().then(()=>rm).then(({PluginPreferences:r})=>r),Promise.resolve().then(()=>vm).then(({PluginQuickEdit:r})=>r),Promise.resolve().then(()=>Cm).then(({PluginQuickDelete:r})=>r),Promise.resolve().then(()=>Fm).then(({PluginQuickMove:r})=>r),Promise.resolve().then(()=>Qm).then(({PluginQuickPreview:r})=>r),Promise.resolve().then(()=>Bg).then(({PluginQuickDiff:r})=>r),Promise.resolve().then(()=>Ug).then(({PluginQuickRedirect:r})=>r),Promise.resolve().then(()=>Xg).then(({PluginToolbox:r})=>r)].forEach(async r=>{this.plugin(await r)})},ud=async function(){this.inject(["resourceLoader"],n=>{})},Ur.DEFAULT_CONFIG={apiConfigs:{},legacyPreferences:{},logLevel:Es.info,autoloadStyles:!0};let gn=Ur;function Cp(t){return t.charAt(0).toLowerCase()+t.slice(1)}function Tp(t){return Cp(t).replace(/-/g,"_").replace(/.[A-Z]+/g,e=>e[0]+"_"+e.slice(1).toLowerCase())}const cs=class cs{constructor(e,n=void 0,r){ir(this,qr);this.ctx=e,this.disposeHandlers=[],this.name=r||this.constructor.name,this.config=n||{};const{promise:i,resolve:s,reject:o}=Promise.withResolvers();queueMicrotask(()=>{try{const a=this.start();a&&typeof a.then=="function"?a.then(()=>s()).catch(l=>{this.logger.error("start() returns a rejected promise",l),o(l)}):s()}catch(a){this.logger.error("start() threw synchronously",a),o(a)}i.then(()=>{this.logger.debug("started")}),i.catch(a=>{this.logger.error("start failed",a),this.ctx.scope.dispose()})}),this.ctx.once("dispose",()=>{this.disposeHandlers.forEach(a=>a(this.ctx)),this.stop(),this.logger.debug("disposed")})}start(){}stop(){}addDisposeHandler(e){this.disposeHandlers.push(e)}removeDisposeHandler(e){this.disposeHandlers=this.disposeHandlers.filter(n=>n!==e)}set name(e){bt(this,qr,Tp(e).toUpperCase())}get name(){return me(this,qr)}get logger(){return this.ctx.logger(this.name)}};qr=new WeakMap,cs.inject=[],cs.reusable=!1;let ot=cs;window.RLQ||(window.RLQ=[]),window.__IPE_MODULES__||(window.__IPE_MODULES__=[]),Ap("InPageEdit#autoload",()=>{window.RLQ.push(Ip)});async function Ip(){typeof window?.ipe?.stop=="function"&&await window.ipe.stop();const t=window.InPageEdit||{},e=new gn({apiConfigs:{baseURL:window.mw?.util.wikiScript("api")},legacyPreferences:t?.myPreferences||{}});if(window.InPageEdit=gn,window.ipe=e,await e.start(),typeof window?.mw?.hook=="function"&&window.mw.hook("InPageEdit.ready").fire(e),Array.isArray(window.__IPE_MODULES__)){const n=[];for(;window.__IPE_MODULES__.length;)try{const r=window.__IPE_MODULES__.shift();typeof r=="function"&&r?.(e),n.push(r)}catch{}window.__IPE_MODULES__={push:r=>{typeof r=="function"&&r(e),n.push(r)}},e.on("dispose",()=>{window.__IPE_MODULES__=n})}e.logger("AUTOLOAD").info(`${Ys.HOME_URL}
60
+ */const Ur=class Ur extends Ze{constructor(n){super({name:"InPageEdit"});ir(this,Mt);this.version="0.9.0",this.Endpoints=gi,this.schema=fe,this.config={...Ur.DEFAULT_CONFIG,...n},this.logger=za({name:"IPE",color:"#33aaff",level:this.config.logLevel}),ht(this,Mt,ad).call(this),ht(this,Mt,cd).call(this),ht(this,Mt,ud).call(this)}async useScope(n){const{promise:r,resolve:i}=ge();return this.inject(n,s=>{i(s)}),r}};Mt=new WeakSet,ad=async function(){this.plugin(ah,this.config.apiConfigs),this.plugin(ii),this.plugin(yh),this.plugin(fp),this.plugin(kp),this.plugin(di),this.plugin(Vs),this.plugin(Ys),ht(this,Mt,ld).call(this,["api","currentPage","resourceLoader","modal","storage","wikiPage","wikiTitle","wiki","getUrl","getSciprtUrl","getMainpageUrl"])},ld=function(n){if(typeof n=="string"&&(n=[n]),!Array.isArray(n)||n.length===0)return this;for(const r of n){const i=this[Ur.internal][r];i?.type==="service"&&(i.builtin=!0)}return this},cd=async function(){[Promise.resolve().then(()=>qp).then(({PluginInArticleLinks:r})=>r),Promise.resolve().then(()=>rm).then(({PluginPreferences:r})=>r),Promise.resolve().then(()=>vm).then(({PluginQuickEdit:r})=>r),Promise.resolve().then(()=>Cm).then(({PluginQuickDelete:r})=>r),Promise.resolve().then(()=>Fm).then(({PluginQuickMove:r})=>r),Promise.resolve().then(()=>Qm).then(({PluginQuickPreview:r})=>r),Promise.resolve().then(()=>Bg).then(({PluginQuickDiff:r})=>r),Promise.resolve().then(()=>Ug).then(({PluginQuickRedirect:r})=>r),Promise.resolve().then(()=>Xg).then(({PluginToolbox:r})=>r)].forEach(async r=>{this.plugin(await r)})},ud=async function(){this.inject(["resourceLoader"],n=>{})},Ur.DEFAULT_CONFIG={apiConfigs:{},legacyPreferences:{},logLevel:ks.info,autoloadStyles:!0};let gn=Ur;function Cp(t){return t.charAt(0).toLowerCase()+t.slice(1)}function Tp(t){return Cp(t).replace(/-/g,"_").replace(/.[A-Z]+/g,e=>e[0]+"_"+e.slice(1).toLowerCase())}const us=class us{constructor(e,n=void 0,r){ir(this,qr);this.ctx=e,this.disposeHandlers=[],this.name=r||this.constructor.name,this.config=n||{};const{promise:i,resolve:s,reject:o}=Promise.withResolvers();queueMicrotask(()=>{try{const a=this.start();a&&typeof a.then=="function"?a.then(()=>s()).catch(l=>{this.logger.error("start() returns a rejected promise",l),o(l)}):s()}catch(a){this.logger.error("start() threw synchronously",a),o(a)}i.then(()=>{this.logger.debug("started")}),i.catch(a=>{this.logger.error("start failed",a),this.ctx.scope.dispose()})}),this.ctx.once("dispose",()=>{this.disposeHandlers.forEach(a=>a(this.ctx)),this.stop(),this.logger.debug("disposed")})}start(){}stop(){}addDisposeHandler(e){this.disposeHandlers.push(e)}removeDisposeHandler(e){this.disposeHandlers=this.disposeHandlers.filter(n=>n!==e)}set name(e){bt(this,qr,Tp(e).toUpperCase())}get name(){return he(this,qr)}get logger(){return this.ctx.logger(this.name)}};qr=new WeakMap,us.inject=[],us.reusable=!1;let ot=us;window.RLQ||(window.RLQ=[]),window.__IPE_MODULES__||(window.__IPE_MODULES__=[]),Op("InPageEdit#autoload",()=>{const t=document.querySelector('meta[name="generator"][content^="MediaWiki"]')!==null,e=document.querySelector('link[rel="EditURI"]')?.href?.split("?")[0];t&&e&&Ip(e)});async function Ip(t){typeof window?.ipe?.stop=="function"&&await window.ipe.stop();const e=window.InPageEdit||{},n=new gn({apiConfigs:{baseURL:t},legacyPreferences:e?.myPreferences||{}});if(window.InPageEdit=gn,window.ipe=n,await n.start(),window.RLQ.push(()=>{mw.hook("InPageEdit.ready").fire(n)}),Array.isArray(window.__IPE_MODULES__)){const r=[];for(;window.__IPE_MODULES__.length;)try{const i=window.__IPE_MODULES__.shift();typeof i=="function"&&i?.(n),r.push(i)}catch{}window.__IPE_MODULES__={push:i=>{typeof i=="function"&&i(n),r.push(i)}},n.on("dispose",()=>{window.__IPE_MODULES__=r})}n.logger("AUTOLOAD").info(`
61
61
  ____ ____ ______ ___ __
62
62
  / _/___ / __ \\____ _____ ____ / ____/___/ (_) /_
63
63
  / // __ \\/ /_/ / __ \`/ __ \`/ _ \\/ __/ / __ / / __/
64
64
  _/ // / / / ____/ /_/ / /_/ / __/ /___/ /_/ / / /_
65
65
  /___/_/ /_/_/ \\__,_/\\__, /\\___/_____/\\__,_/_/\\__/
66
- /____/ v`+e.version)}function Ap(t,e){const n=Symbol.for(t);return window[n]?!1:(window[n]=!0,e(),!0)}function An(t,e){return function(n){return n.PreferencesSchema=t,n.PreferencesDefaults=e,n}}const El=t=>w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...t,class:`icon icon-tabler icons-tabler-outline icon-tabler-pencil-bolt ${t.className||""}`,children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),w("path",{d:"M13.5 6.5l4 4"}),w("path",{d:"M19 16l-2 3h4l-2 3"})]});var Op=Object.create,Gs=Object.defineProperty,Rp=Object.getOwnPropertyDescriptor,kl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Pl=t=>{throw TypeError(t)},Np=(t,e,n)=>e in t?Gs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Dp=(t,e)=>Gs(t,"name",{value:e,configurable:!0}),Lp=t=>[,,,Op(t?.[kl("metadata")]??null)],Mp=["class","method","getter","setter","accessor","field","value","get","set"],$l=t=>t!==void 0&&typeof t!="function"?Pl("Function expected"):t,jp=(t,e,n,r,i)=>({kind:Mp[t],name:e,metadata:r,addInitializer:s=>n._?Pl("Already initialized"):i.push($l(s||null))}),Fp=(t,e)=>Np(e,kl("metadata"),t[3]),Bp=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Up=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,p=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&Rp(i,n));Dp(i,n);for(var b=r.length-1;b>=0;b--)l=jp(c,n,a={},t[3],p),o=(0,r[b])(i,l),a._=1,$l(o)&&(i=o);return Fp(t,i),v&&Gs(i,n,v),u?c^4?s:v:i},Cl,Qs,Tl;Cl=[We(["wiki","wikiTitle","preferences"]),An(fe.object({"inArticleLinks.enable":fe.boolean().description("Whether to enable in-article links").default(!0),"inArticleLinks.quickDiff.enable":fe.boolean().description("Whether to enable in-article links for quick diff").default(!0),"inArticleLinks.quickEdit.enable":fe.boolean().description("Whether to enable in-article links for quick edit").default(!0),"inArticleLinks.quickEdit.redlinks":fe.boolean().description("Whether to show quick edit button for redlinks").default(!0)}).description("In-article links preferences").extra("category","in-article-links"))];class gi extends(Tl=ot){constructor(e){super(e,{linkClassName:"ipe__in-article-link"},"InArticleLinks"),this._cachedAnchorInfo=new WeakMap,this.ctx.set("inArticleLinks",this),this.ctx.preferences.defineCategory({label:"In Article Links",name:"in-article-links",description:"In-article links preferences",index:9})}async start(){await this.ctx.preferences.get("inArticleLinks.quickEdit.enable")&&this.handleQuickEdit(),await this.ctx.preferences.get("inArticleLinks.quickDiff.enable")&&this.handleQuickDiff()}async stop(){Array.from(document.getElementsByClassName(this.config.linkClassName)).forEach(e=>{e.remove()}),document.querySelectorAll("[data-ipe-edit-mounted]").forEach(e=>{e.dataset.ipeEditMounted=void 0})}parseAnchor(e){if(!(e instanceof HTMLAnchorElement))return null;const n=this._cachedAnchorInfo.get(e);if(n)return n;const r=e.getAttribute("href")||"";if(!this.ctx.wikiTitle.validateHrefAttr(r))return null;const i=e.href||"",s=this.ctx.wikiTitle.parseWikiLink(i);if(!s)return null;const o={$el:e,kind:e.closest('[typeof^="mw:File"]')?"mw:File":"normal",external:e.classList.contains("external")||!!r.startsWith("http"),redlink:e.classList.contains("new")||s.params.has("redlink"),...s};return this._cachedAnchorInfo.set(e,o),o}scanAnchors(e,n){const r=e.querySelectorAll("a[href]");return Array.from(r).map(i=>this.parseAnchor(i)).filter(i=>i!==null&&(!n||n(i)))}async handleQuickEdit(){let e=!1;const n=await this.ctx.preferences.get("inArticleLinks.quickEdit.redlinks");this.ctx.inject(["quickEdit"],r=>{e=!0,r.on("dispose",()=>{e=!1}),window?.mw?.hook?.("wikipage.content").add(i=>{if(!e)return;this.scanAnchors(i.get(0),({action:o,title:a,redlink:l})=>n||!l?["edit","create"].includes(o)?!0:a?.isSpecial("edit")||a?.isSpecial("newsection")?a.getMainText().split("/").length>=2:!1:!1).forEach(({$el:o,title:a,pageId:l,params:c})=>{if(o.dataset.ipeEditMounted)return;if(o.dataset.ipeEditMounted="1",c.has("preload")||c.has("redo"))return this.ctx.logger.debug(o,"Not compatible with quick edit");const f=a?.getPrefixedDBKey()||"",p=c.get("section")?.replace(/^T-/,"")||void 0,v=c.get("oldid"),b=c.has("redlink");let I;p==="new"||a?.isSpecial("newsection")?I="new":p&&/^\d+$/.test(p)&&(I=parseInt(p,10));const B=v?parseInt(v,10):void 0,D={title:f,pageId:l||void 0,section:I,revision:B,createOnly:b},A=w("a",{href:"#ipe://quick-edit/",dataset:D,className:`${this.config.linkClassName} ipe-quick-edit ${b?"ipe-quick-edit--create-only":""}`,style:{userSelect:"none",marginLeft:"0.2em"},onClick:y=>{y.preventDefault(),r.quickEdit.showModal(D)},children:w(El,{className:"ipe-icon"})});o.insertAdjacentElement("afterend",A)})})})}handleQuickDiff(){let e=!1;const n=r=>["prev","next","cur"].includes(r);this.ctx.inject(["quickDiff"],r=>{e=!0,r.on("dispose",()=>{e=!1}),window?.mw?.hook?.("wikipage.content").add(i=>{if(!e)return;this.scanAnchors(i.get(0),({params:o,title:a})=>!!(o.has("diff")||a?.isSpecial("diff"))).forEach(({$el:o,title:a,params:l})=>{if(o.dataset.ipeDiffMounted)return;o.dataset.ipeDiffMounted="1";let c,u;if(a?.getNamespaceId()===-1?[,c,u]=a.getMainDBKey().split("/"):(c=l.get("diff"),u=l.get("oldid")),!c||!u)return;const f={};n(c)?(f.fromrev=parseInt(u),f.torelative=c):(f.fromrev=parseInt(u),f.torev=parseInt(c));const p=w("a",{href:"#ipe://quick-diff/",dataset:f,className:`${this.config.linkClassName} ipe-quick-diff`,style:{userSelect:"none",marginLeft:"0.2em"},onClick:v=>{v.preventDefault(),r.quickDiff.comparePages(f)},children:w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file-diff ipe-icon",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),w("path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"}),w("path",{d:"M12 10l0 4"}),w("path",{d:"M10 12l4 0"}),w("path",{d:"M10 17l4 0"})]})});o.insertAdjacentElement("afterend",p)})})})}}Qs=Lp(Tl),gi=Up(Qs,0,"PluginInArticleLinks",Cl,gi),Bp(Qs,1,gi);const qp=Object.freeze(Object.defineProperty({__proto__:null,get PluginInArticleLinks(){return gi}},Symbol.toStringTag,{value:"Module"})),zp=t=>typeof t=="function";async function Hp(t){return zp(t)?await t():t}const Wp=window?.location?.origin,Kp=({type:t,tag:e,href:n,target:r,children:i,...s})=>(e=e||(n?"a":"button"),typeof r>"u"&&n&&n.startsWith("http")&&!n.startsWith(Wp)&&(r="_blank"),Nh(e,{className:`theme-ipe ipe-action-button ipe-modal-btn is-${t||"default"}`,href:e==="a"?n:void 0,target:e==="a"?r:void 0,"data-href":e!=="a"?n:void 0,...s},i));var Vp=Object.create,Js=Object.defineProperty,Yp=Object.getOwnPropertyDescriptor,Il=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Al=t=>{throw TypeError(t)},Gp=(t,e,n)=>e in t?Js(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Qp=(t,e)=>Js(t,"name",{value:e,configurable:!0}),Jp=t=>[,,,Vp(t?.[Il("metadata")]??null)],Xp=["class","method","getter","setter","accessor","field","value","get","set"],Ol=t=>t!==void 0&&typeof t!="function"?Al("Function expected"):t,Zp=(t,e,n,r,i)=>({kind:Xp[t],name:e,metadata:r,addInitializer:s=>n._?Al("Already initialized"):i.push(Ol(s||null))}),em=(t,e)=>Gp(e,Il("metadata"),t[3]),tm=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},nm=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,p=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&Yp(i,n));Qp(i,n);for(var b=r.length-1;b>=0;b--)l=Zp(c,n,a={},t[3],p),o=(0,r[b])(i,l),a._=1,Ol(o)&&(i=o);return em(t,i),v&&Js(i,n,v),u?c^4?s:v:i},Rl,Xs,Nl;Rl=[We(["storage"])];class vi extends(Nl=ot){constructor(e){super(e,{},"preferences"),this.ctx=e,this.db=void 0,this.customRegistries=[],this.categoryDefinitions=[],this._defaultPreferences={},this.db=e.storage.createDatabse("preferences",1/0),this.ctx.set("preferences",this)}async start(){this.defineCategory({name:"general",label:"General",description:"General settings"}),this.defineCategory({name:"edit",label:"Editing",description:"Settings related to editing content"}),this.defineCategory({name:"about",label:"About",description:"About InPageEdit",index:99}),this.registerCustomConfig("about",fe.object({about:fe.const(w("div",{className:"prose",children:[w("h2",{children:"✏️ InPageEdit NEXT"}),w("i",{children:["v",this.ctx.version]}),w("h2",{children:"Portals"}),w("div",{style:"display: flex; flex-direction: column; gap: 1rem",children:[w("a",{href:this.ctx.Endpoints.HOME_URL,target:"_blank",style:{display:"block",width:"100%"},children:"Official Website & Help Center"}),w(Kp,{href:`${this.ctx.Endpoints.UPDATE_LOGS_URL}#${this.ctx.version}`,style:{display:"block",width:"100%"},children:"Update Logs"})]}),w("h2",{children:"Join us"}),w("ul",{children:[w("li",{children:[w("strong",{children:"GitHub"}),":"," ",w("a",{href:this.ctx.Endpoints.GITHUB_URL,target:"_blank",children:"inpageedit/inpageedit-next"})]}),w("li",{children:[w("strong",{children:"QQ Group"}),": 1026023666"]})]}),w("hr",{}),w("p",{children:"🚀 Modular, Extensible Supercharged Plugin for MediaWiki."}),w("p",{children:"InPageEdit-NEXT Copyright © 2025-present dragon-fish"})]})).role("raw-html")}).description(""),"about",{}),Promise.resolve().then(()=>Vb).then(e=>{const n=this.ctx.plugin(e.PluginPreferencesUI);this.addDisposeHandler(()=>{n.dispose()})})}async get(e,n){n??(n=()=>{const i=this.getDefaultValue(e);return this.logger.debug(e,`(fallback value: ${i})`),i});const r=await this.db.get(e,void 0);return r!==null?r:await Hp(n)}getDefaultValue(e){var n;return(n=this._defaultPreferences)[e]??(n[e]=this.loadDefaultConfigs()[e])}set(e,n){const r=this.getDefaultValue(e);return n===r?this.db.delete(e):this.db.set(e,n)}async getAll(){const e=this.loadDefaultConfigs();return await this.db.iterate((n,r)=>{e[r]=n}),e}loadDefaultConfigs(){const e={};return this.getConfigRegistries().forEach(n=>{try{const r=n.schema({});Object.entries(r).forEach(([i,s])=>{e[i]=s})}catch{}n.defaults&&Object.entries(n.defaults).forEach(([r,i])=>{e[r]=i})}),Object.entries(e).forEach(([n,r])=>{this._defaultPreferences[n]=r}),e}registerCustomConfig(e,n,r,i){return this.customRegistries.push({name:e,schema:n,category:r,defaults:i}),this}getConfigRegistries(e){return Array.from(this.ctx.registry.entries()).map(([n,r])=>n===null?{name:"@root",schema:gn?.PreferencesSchema||null,defaults:gn?.PreferencesDefaults||{}}:{name:n.name,schema:n?.PreferencesSchema||null,defaults:n?.PreferencesDefaults||{}}).filter(n=>n.schema!==null).map(n=>({...n,category:n.schema.meta.category||"general"})).concat(this.customRegistries).filter(n=>!e||n.category===e)}defineCategory(e){const n=this.categoryDefinitions.findIndex(r=>r.name===e.name);return n<0?this.categoryDefinitions.push(e):this.categoryDefinitions[n]=e,this.categoryDefinitions.sort((r,i)=>(r.index??0)-(i.index??0)),this}getConfigCategories(){return this.categoryDefinitions}}Xs=Jp(Nl),vi=nm(Xs,0,"PluginPreferences",Rl,vi),tm(Xs,1,vi);const rm=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferences(){return vi}},Symbol.toStringTag,{value:"Module"})),im=Symbol("@@apply"),sm=Symbol("@@ctor");function Zs(t,e){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError("instance is not an object");const n=(...s)=>{const o=t[e];if(typeof o!="function")throw new TypeError(`Property "${String(e)}" is not a function`);return o.apply(t,s)};n[im]=n,n[sm]=t;const r=t?.constructor?.name;return r&&(n[Symbol.toStringTag]=r),new Proxy(n,{get(s,o,a){return o==="prototype"?Reflect.get(n,o,a):Reflect.get(t,o,t)},set(s,o,a){return Reflect.set(t,o,a)},has(s,o){return Reflect.has(t,o)},deleteProperty(s,o){return Reflect.deleteProperty(t,o)},ownKeys(){return Reflect.ownKeys(t)},getOwnPropertyDescriptor(s,o){return Object.getOwnPropertyDescriptor(t,o)},defineProperty(s,o,a){return Object.defineProperty(t,o,a)}})}const yi={mbox:"_mbox_5x43w_1",title:"_title_5x43w_12",content:"_content_5x43w_19",close:"_close_5x43w_27"},hr=t=>{const{type:e="default",title:n,content:r,closeable:i=!0,titleProps:s,contentProps:o,children:a,...l}=t;let c=n;typeof n>"u"&&e!=="default"&&(c=e[0].toUpperCase()+e.slice(1).toLowerCase());const u=async()=>{if(!f)return Promise.resolve();const{promise:p,resolve:v}=Promise.withResolvers();return f.animate([{opacity:"1",height:f.clientHeight+"px"},{opacity:"0",height:"0px",margin:"0px"}],{duration:300,easing:"ease"}).addEventListener("finish",()=>{f.remove(),v()}),p},f=w("div",{className:`theme-ipe ipe-mbox mbox-type-${e||"default"} ${yi.mbox}`,...l,children:[c&&w("div",{className:`ipe-mbox-title ${yi.title}`,...s,children:c}),w("div",{className:`ipe-mbox-content ${yi.content}`,...o,children:a||r}),i&&w("a",{onClick:u,className:`ipe-mbox-close ${yi.close}`,children:"×"})]});return f.close=u,f},pr=t=>{const{label:e,id:n,name:r,value:i,disabled:s,labelProps:o,inputProps:a,...l}=t;return w("div",{className:"theme-ipe ipe-input-box",...l,children:[w("label",{htmlFor:n,style:{display:"block"},...o,children:e}),w("input",{id:n,name:r,value:i,disabled:s,style:{width:"100%"},...a})]})},Dl=t=>{const{id:e,name:n,value:r,label:i,inputProps:s,labelProps:o,children:a,...l}=t;return w("label",{className:"theme-ipe ipe-radio-box",...l,children:[w("input",{type:"radio",id:e,name:n,value:r,...s}),w("span",{className:"ipe-checkbox-box"}),w("span",{...o,children:i||a})]})},On=t=>{const{id:e,name:n,label:r,checked:i,inputProps:s,labelProps:o,children:a,...l}=t;return w("label",{className:"theme-ipe ipe-checkbox",...l,children:[w("input",{type:"checkbox",id:e,name:n,checked:i,...s}),w("span",{className:"ipe-checkbox-box"}),w("span",{...o,children:r||a})]})},eo=()=>{},om=(t=0)=>new Promise(e=>setTimeout(e,t));var am=Object.create,to=Object.defineProperty,lm=Object.getOwnPropertyDescriptor,Ll=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ml=t=>{throw TypeError(t)},cm=(t,e,n)=>e in t?to(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,um=(t,e)=>to(t,"name",{value:e,configurable:!0}),fm=t=>[,,,am(t?.[Ll("metadata")]??null)],dm=["class","method","getter","setter","accessor","field","value","get","set"],jl=t=>t!==void 0&&typeof t!="function"?Ml("Function expected"):t,hm=(t,e,n,r,i)=>({kind:dm[t],name:e,metadata:r,addInitializer:s=>n._?Ml("Already initialized"):i.push(jl(s||null))}),pm=(t,e)=>cm(e,Ll("metadata"),t[3]),mm=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},gm=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,p=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&lm(i,n));um(i,n);for(var b=r.length-1;b>=0;b--)l=hm(c,n,a={},t[3],p),o=(0,r[b])(i,l),a._=1,jl(o)&&(i=o);return pm(t,i),v&&to(i,n,v),u?c^4?s:v:i},Fl,no,Bl;Fl=[We(["api","wikiPage","wikiTitle","currentPage","wiki","modal","preferences"]),An(fe.object({"quickEdit.editSummary":fe.string().description("Default edit summary for quick edits").default("[IPE-NEXT] Quick edit"),"quickEdit.editMinor":fe.boolean().description("Whether to mark the edit as minor").default(!1),"quickEdit.outSideClose":fe.boolean().description("Whether to close the modal outside").default(!0),"quickEdit.watchList":fe.union([fe.const(wt.preferences).description("Follow my preferences"),fe.const(wt.nochange).description("Keep the current watchlist status"),fe.const(wt.watch).description("Add the page to watchlist"),fe.const(wt.unwatch).description("Remove the page from watchlist")]).description("Watchlist options").default(wt.preferences),"quickEdit.keyshortcut.save":fe.string().default("ctrl-s").description("save button key shortcut (blank to disable)")}).description("Quick edit options").extra("category","edit"))];class bi extends(Bl=ot){constructor(e){super(e,{},"quick-edit"),this.ctx=e,this.DEFAULT_OPTIONS={title:"",pageId:0,revision:0,section:void 0,editMinor:!1,editSummary:"",createOnly:!1,reloadAfterSave:!0},this.ctx.root.set("quickEdit",Zs(this,"showModal"))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e),e.on("dispose",()=>{this.removeToolbox(e)})})}async showModal(e){if(typeof e>"u"?e={}:typeof e=="string"&&(e={title:e}),e?.page&&(e.title=e.page,delete e.page),!e.title&&!e.pageId&&!e.revision){this.logger.warn("None of the title, pageId or revision provided. Using defaults.");const p=new URLSearchParams(window.location.search),v=this.ctx.currentPage.wikiTitle;e={...e,title:v?.getPrefixedDBKey(),revision:p.has("oldid")?Number(p.get("oldid")):void 0,pageId:p.has("curid")?Number(p.get("curid")):void 0}}if(!e.revision&&!e.pageId&&e.title){const p=this.ctx.wikiTitle.resolveSpecialPageTarget(e.title);p&&p.title.getNamespaceId()>=0&&(e.title=p.title.getPrefixedDBKey(),e.section??(e.section=p.section))}const n=await this.ctx.preferences.get("quickEdit.outSideClose"),r=await this.ctx.preferences.get("quickEdit.watchList"),i=typeof e.editSummary=="string"?e.editSummary:await this.ctx.preferences.get("quickEdit.editSummary"),s=typeof e.editMinor=="boolean"?e.editMinor:await this.ctx.preferences.get("quickEdit.editMinor"),o={...this.DEFAULT_OPTIONS,editSummary:i,editMinor:s,...e};o.editSummary||(o.editSummary=await this.ctx.preferences.get("quickEdit.editSummary")||""),this.ctx.emit("quick-edit/init-options",{ctx:this.ctx,options:o});const a=this.ctx.modal.createObject({className:"ipe-quickEdit",sizeClass:"large",center:!1,outSideClose:n}).init();a.setTitle(w(Ft,{children:["Loading: ",w("u",{children:o.title})]})),a.setContent(w("section",{className:"ipe-quickEdit-loading",style:{height:"70vh",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:w(Xt,{})})),a.addButton({side:"right",type:"button",className:"is-danger is-ghost",label:"Cancel",method(){a.close()}}),a.show(),this.ctx.emit("quick-edit/show-modal",{ctx:this.ctx,modal:a,options:o});let l;try{if(l=await this.getWikiPageFromPayload(o),l.pageInfo.special)throw new Error("Special page is not editable")}catch(p){a.off(a.Event.Close),a.close(),this.ctx.modal.notify("error",{content:p instanceof Error?p.message:String(p)});return}a.setTitle(w(Ft,{children:["Quick ",l.pageInfo.pageid===0?"Create":"Edit",":"," ",w("u",{children:l.pageInfo.title})]}));const c=[];l.pageInfo.pageid===0&&c.push(w(hr,{title:"Attention",type:"important",children:w("p",{children:"This page does not exist."})})),l.pageInfo.pageid&&l.pageInfo.lastrevid!==l.revisions[0]?.revid&&c.push(w(hr,{title:"Attention",type:"warning",children:w("p",{children:["You are editing a ",w("em",{children:"historical version"}),"; the content is not the latest!"]})})),this.ctx.emit("quick-edit/edit-notice",{ctx:this.ctx,options:o,modal:a,wikiPage:l,editNotices:c});const u=w("form",{className:"ipe-quickEdit__form",children:[w("div",{className:"ipe-quickEdit__notices",children:c}),w("div",{className:"ipe-quickEdit__content",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.section==="new"&&w(Ft,{children:w(pr,{label:"Section title",id:"summary",name:"summary",value:"",inputProps:{placeholder:"Topic for new section, this will be the h2 heading"}})}),w("textarea",{className:"ipe-quickEdit__textarea",name:"text",id:"wpTextbox1",children:o.section==="new"?"":l.revisions[0]?.content||""})]}),w("div",{class:"ipe-quickEdit__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:[o.section!=="new"&&w(pr,{label:"Summary",id:"summary",name:"summary",value:o.editSummary}),w("div",{className:"ipe-input-box",children:[w("label",{htmlFor:"watchlist",style:{display:"block"},children:"Watchlist"}),w("div",{style:{display:"flex",gap:"1rem"},children:[wt.preferences,wt.nochange,wt.watch,wt.unwatch].map(p=>w(Dl,{name:"watchlist",value:p,inputProps:{checked:r===p},children:p},p))})]}),w("div",{style:{display:"flex",gap:"1rem"},children:[w(On,{name:"minor",id:"minor",checked:o.editMinor,children:"Minor edit"}),w(On,{name:"reloadAfterSave",id:"reloadAfterSave",checked:o.reloadAfterSave,children:"Reload after save"})]})]}),!1]});a.setContent(u),a.addButton({side:"left",className:"is-primary submit-btn",label:"Submit",keyPress:await this.ctx.preferences.get("quickEdit.keyshortcut.save")||void 0,method:()=>{const p=new FormData(u);a.setLoadingState(!0),this.handleSubmit({wikiPage:l,text:p.get("text"),summary:p.get("summary"),minor:p.get("minor")==="on",section:o.section,createonly:l.pageid===0,watchlist:r}).then(async()=>{a.setOptions({beforeClose:eo}),a.close(),this.ctx.modal.notify("success",{title:"Submission Successful",content:"Your changes have been saved."}),p.get("reloadAfterSave")&&(await om(500),location.reload())}).catch(v=>{this.ctx.modal.notify("error",{title:"Submission Error",content:v instanceof Error?v.message:String(v)}),a.setLoadingState(!1)})}},0),a.setOptions({beforeClose:()=>{const p=l.revisions[0]?.content||"";return(u.querySelector("textarea")?.value||"")===p?!0:(this.ctx.modal.confirm({className:"is-primary",title:"Unsaved Changes",content:"All edit contents will be lost after closing the modal. Are you sure you want to close?",center:!0,okBtn:{label:"Give Up",className:"is-danger is-ghost"},cancelBtn:{label:"Continue Editing",className:"is-primary is-ghost"}},b=>(b&&(a.setOptions({beforeClose:eo}),a.close()),!0)),!1)}}),this.ctx.emit("quick-edit/wiki-page",{ctx:this.ctx,options:o,modal:a,wikiPage:l});const f=p=>u.querySelector("textarea")?.value===l.revisions[0]?.content?!0:(p.preventDefault(),"You have unsaved changes. Are you sure you want to leave?");window.addEventListener("beforeunload",f),a.on(a.Event.Close,()=>{window.removeEventListener("beforeunload",f)})}async handleSubmit(e){const n=e.wikiPage,r=e.summary||"",i=e.text||"",s=e.minor,o=e.createonly,a=e.watchlist,l=e.section;return n.edit({summary:r,text:i,watchlist:a,section:l},{minor:s,createonly:o})}async getWikiPageFromPayload(e){if(e.revision)return this.ctx.wikiPage.newFromRevision(e.revision,e.section);if(e.pageId)return this.ctx.wikiPage.newFromPageId(e.pageId,e.section);if(e.title)return this.ctx.wikiPage.newFromTitle(e.title,!1,e.section);throw new Error("Invalid payload")}async injectToolbox(e){const n=this.ctx.currentPage.wikiTitle,r=this.ctx.wiki.hasRight("edit")&&n&&n.getNamespaceId()>=0;e.toolbox.addButton({id:"quick-edit",group:"group1",index:0,icon:w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-edit",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"}),w("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"}),w("path",{d:"M16 5l3 3"})]}),buttonProps:{disabled:!r},tooltip:r?"Quick Edit":"Not editable",onClick:()=>{const i=new URLSearchParams(window.location.search).get("oldid");this.showModal({title:n?.getPrefixedText(),revision:i?Number(i):void 0})}})}removeToolbox(e){e.toolbox.removeButton("quick-edit")}}no=fm(Bl),bi=gm(no,0,"PluginQuickEdit",Fl,bi),mm(no,1,bi);const vm=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickEdit(){return bi}},Symbol.toStringTag,{value:"Module"}));var ym=Object.create,ro=Object.defineProperty,bm=Object.getOwnPropertyDescriptor,Ul=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),ql=t=>{throw TypeError(t)},wm=(t,e,n)=>e in t?ro(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_m=(t,e)=>ro(t,"name",{value:e,configurable:!0}),xm=t=>[,,,ym(t?.[Ul("metadata")]??null)],Sm=["class","method","getter","setter","accessor","field","value","get","set"],zl=t=>t!==void 0&&typeof t!="function"?ql("Function expected"):t,Em=(t,e,n,r,i)=>({kind:Sm[t],name:e,metadata:r,addInitializer:s=>n._?ql("Already initialized"):i.push(zl(s||null))}),km=(t,e)=>wm(e,Ul("metadata"),t[3]),Pm=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},$m=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,p=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&bm(i,n));_m(i,n);for(var b=r.length-1;b>=0;b--)l=Em(c,n,a={},t[3],p),o=(0,r[b])(i,l),a._=1,zl(o)&&(i=o);return km(t,i),v&&ro(i,n,v),u?c^4?s:v:i},Hl,io,Wl;Hl=[We(["api","wikiPage","wikiTitle","currentPage","wiki","modal","preferences"]),An(fe.object({deleteReason:fe.string().description("Default delete reason for quick delete").default("[IPE-NEXT] Quick delete")}).description("Quick delete options").extra("category","delete"))];class wi extends(Wl=ot){constructor(e){super(e,{},"quick-delete"),this.ctx=e,this.DEFAULT_OPTIONS={title:"",pageId:0,revision:0,deleteReason:"",reloadAfterDelete:!0},this.ctx.root.set("quickDelete",Zs(this,"showModal"))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e),e.on("dispose",()=>{this.removeToolbox(e)})}),this.ctx.preferences.defineCategory({label:"Delete",name:"delete",description:"Settings related to deleting pages",index:3})}async showModal(e){if(typeof e>"u"?e={}:typeof e=="string"&&(e={title:e}),!e.title&&!e.pageId&&!e.revision){this.logger.warn("None of the title, pageId or revision provided. Using defaults.");const l=new URLSearchParams(window.location.search),c=this.ctx.currentPage.wikiTitle;e={...e,title:c?.getPrefixedDBKey(),revision:l.has("oldid")?Number(l.get("oldid")):void 0,pageId:l.has("curid")?Number(l.get("curid")):void 0}}const n=typeof e.deleteReason=="string"?e.deleteReason:await this.ctx.preferences.get("deleteReason"),r={...this.DEFAULT_OPTIONS,deleteReason:n,...e};r.deleteReason||(r.deleteReason=await this.ctx.preferences.get("deleteReason")||""),r||this.ctx.emit("quick-delete/init-options",{ctx:this.ctx,options:r});const i=this.ctx.modal.createObject({className:"ipe-quickDelete",sizeClass:"small",center:!0}).init();i.setTitle(w(Ft,{children:["Loading: ",w("u",{children:r.title})]})),i.setContent(w(Xt,{})),i.addButton({side:"right",type:"button",className:"is-ghost",label:"Cancel",method(){i.close()}}),i.show(),this.ctx.emit("quick-delete/show-modal",{ctx:this.ctx,modal:i,options:r});let s;try{if(s=await this.getWikiPageFromPayload(r),s.pageInfo.special)throw new Error("Special page cannot be deleted");if(s.pageInfo.pageid===0)throw new Error("Page does not exist, cannot be deleted")}catch(l){i.off(i.Event.Close),i.close(),this.ctx.modal.notify("error",{content:l instanceof Error?l.message:String(l)});return}i.setTitle(w(Ft,{children:["Quick Delete: ",w("u",{children:s.pageInfo.title})]}));const o=[];s.userCan("delete")||o.push(w(hr,{title:"Permission Denied",type:"error",children:w("p",{children:"You do not have permission to delete this page."})})),s.pageInfo.protection&&s.pageInfo.protection.length>0&&o.push(w(hr,{title:"Warning",type:"warning",children:w("p",{children:"This page is protected and may has special use or purpose. Delete it at your own risk."})})),this.ctx.emit("quick-delete/delete-notice",{ctx:this.ctx,options:r,modal:i,wikiPage:s,deleteNotices:o});const a=w("form",{className:"ipe-quickDelete__form",children:[w("div",{className:"ipe-quickDelete__notices",children:o}),w("div",{className:"ipe-quickDelete__content",children:w("div",{className:"ipe-quickDelete__page-info",style:{padding:"1rem",backgroundColor:"#f8f9fa",border:"1px solid #dee2e6",borderRadius:"4px",marginBottom:"1rem"},children:w("ul",{children:[w("li",{children:[w("strong",{children:"Title:"})," ",s.pageInfo.title]}),w("li",{children:[w("strong",{children:"Page ID:"})," ",s.pageInfo.pageid]}),w("li",{children:[w("strong",{children:"Last Revision:"})," ",s.pageInfo.lastrevid]}),w("li",{children:[w("strong",{children:"Length:"})," ",s.pageInfo.length," characters"]})]})})}),w("div",{class:"ipe-quickDelete__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:w(pr,{label:"Delete Reason",id:"reason",name:"reason",value:r.deleteReason,inputProps:{placeholder:"Enter reason for deletion...",required:!0}})}),!1]});i.setContent(a),i.addButton({side:"left",className:"is-danger submit-btn",label:"Delete Page",method:()=>{const c=new FormData(a).get("reason");if(!c||c.trim()===""){this.ctx.modal.notify("error",{title:"Missing Reason",content:"Please provide a reason for deletion."});return}this.ctx.modal.confirm({className:"is-danger",title:"Confirm Deletion",content:w(Ft,{children:w("p",{children:w("strong",{children:s.pageInfo.title})})}),center:!0,okBtn:{label:"Delete it now",className:"is-danger"},cancelBtn:{label:"Cancel",className:"is-ghost"}},u=>(u&&(i.setLoadingState(!0),this.handleSubmit({wikiPage:s,reason:c}).then(async()=>{i.setOptions({beforeClose:eo}),i.close(),this.ctx.modal.notify("success",{title:"Deletion Successful",content:`The page "${s.pageInfo.title}" has been deleted.`})}).catch(f=>{this.ctx.modal.notify("error",{title:"Deletion Error",content:f instanceof Error?f.message:String(f)}),i.setLoadingState(!1)})),!0))}},0),this.ctx.emit("quick-delete/wiki-page",{ctx:this.ctx,options:r,modal:i,wikiPage:s})}async handleSubmit(e){const n=e.wikiPage,r=e.reason||"";return n.delete(r)}async getWikiPageFromPayload(e){if(e.revision)return this.ctx.wikiPage.newFromRevision(e.revision);if(e.pageId)return this.ctx.wikiPage.newFromPageId(e.pageId);if(e.title)return this.ctx.wikiPage.newFromTitle(e.title,!1);throw new Error("Invalid payload")}async injectToolbox(e){const n=this.ctx.currentPage.wikiTitle,r=n&&this.ctx.wiki.hasRight("delete")&&n.getNamespaceId()>=0;e.toolbox.addButton({id:"quick-delete",group:"group2",icon:w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M4 7l16 0"}),w("path",{d:"M10 11l0 6"}),w("path",{d:"M14 11l0 6"}),w("path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"}),w("path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"})]}),buttonProps:{disabled:!r},tooltip:r?"Quick Delete":"Not deletable",onClick:()=>{this.showModal({title:n?.getPrefixedText()})}})}removeToolbox(e){e.toolbox.removeButton("quick-delete")}}io=xm(Wl),wi=$m(io,0,"PluginQuickDelete",Hl,wi),Pm(io,1,wi);const Cm=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickDelete(){return wi}},Symbol.toStringTag,{value:"Module"})),mr={twinSwapInput:"_twinSwapInput_1gdgl_9",inputWrapper:"_inputWrapper_1gdgl_23",inputLeft:"_inputLeft_1gdgl_27",inputRight:"_inputRight_1gdgl_30",swapButton:"_swapButton_1gdgl_46"},Kl=t=>{const{inputs:e,enableSwap:n=!0,...r}=t,i=e?.length===2?e:[e?.[0]??{},e?.[1]??{}],s=[null,null];let o=0,a=null,l=null;const c=()=>s.some(b=>b&&b.disabled),u=()=>{if(!s[0]||!s[1]||c())return;const b=s[0],I=s[1],B=b.value,D=I.value;b.value=D,I.value=B,b.dispatchEvent(new Event("change")),I.dispatchEvent(new Event("change")),o++,l&&(l.style.transform=`rotateY(${o*-180}deg)`,l.style.transition="transform 200ms ease")},f=b=>{if(!a)return;const I=b??!a.disabled;a.disabled=!I,I&&s.forEach(B=>{B&&(B.disabled=!1)})},p=w("button",{type:"button","aria-label":"Swap values",onClick:u,disabled:c()||!n,ref:b=>a=b,children:w("svg",{ref:b=>l=b,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon-tabler icons-tabler-outline icon-tabler-transfer",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M20 10h-16l5.5 -6"}),w("path",{d:"M4 14h16l-5.5 6"})]})}),v=w("div",{className:`twin-swap-input ${mr.twinSwapInput}`,...r,children:[i.map((b,I)=>{const{label:B,id:D,name:A,value:y,disabled:m,required:h,inputProps:S}=b,T=I===0,R=D||A;return w("div",{className:`${mr.inputWrapper} ${T?mr.inputLeft:mr.inputRight}`,children:[B&&w("label",{htmlFor:R,children:B}),w("input",{ref:H=>s[I]=H,type:"text",id:R,name:A,value:y,disabled:m,required:h,...S})]})}),w("div",{className:mr.swapButton,children:p})]});return v.swap=u,v.toggleEnableSwap=f,v};var Tm=Object.create,so=Object.defineProperty,Im=Object.getOwnPropertyDescriptor,Vl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Yl=t=>{throw TypeError(t)},Am=(t,e,n)=>e in t?so(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Om=(t,e)=>so(t,"name",{value:e,configurable:!0}),Rm=t=>[,,,Tm(t?.[Vl("metadata")]??null)],Nm=["class","method","getter","setter","accessor","field","value","get","set"],Gl=t=>t!==void 0&&typeof t!="function"?Yl("Function expected"):t,Dm=(t,e,n,r,i)=>({kind:Nm[t],name:e,metadata:r,addInitializer:s=>n._?Yl("Already initialized"):i.push(Gl(s||null))}),Lm=(t,e)=>Am(e,Vl("metadata"),t[3]),Mm=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},jm=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,p=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&Im(i,n));Om(i,n);for(var b=r.length-1;b>=0;b--)l=Dm(c,n,a={},t[3],p),o=(0,r[b])(i,l),a._=1,Gl(o)&&(i=o);return Lm(t,i),v&&so(i,n,v),u?c^4?s:v:i},Ql,oo,Jl;Ql=[We(["modal","wiki"])];class _i extends(Jl=ot){constructor(e){super(e,{},"quick-move"),this.ctx=e,e.set("quickMove",this.quickMove.bind(this)),e.set("movePage",this.movePage.bind(this))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e)})}injectToolbox(e){const n=window.mw?.config.get("wgPageName")||"",r=window.mw?.config.get("wgIsProbablyEditable");e.toolbox.addButton({id:"quick-move",icon:w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-forms",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3"}),w("path",{d:"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3"}),w("path",{d:"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7"}),w("path",{d:"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1"}),w("path",{d:"M17 12h.01"}),w("path",{d:"M13 12h.01"})]}),tooltip:"Quick Move",group:"group1",index:1,onClick:()=>{this.quickMove(r?{lockFromField:!0,from:n}:{})}})}quickMove(e){const n=this.ctx.modal.createObject({title:"Quick Move",content:w(Xt,{}),className:"quick-move compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let r=null;return n.setContent(w("form",{ref:i=>r=i,style:{display:"flex",flexDirection:"column",gap:"1rem"},onSubmit:i=>{if(i.preventDefault(),r?.checkValidity(),!r?.reportValidity())return;const s=new FormData(r),o={from:s.get("from")?.toString().trim(),to:s.get("to")?.toString().trim(),reason:s.get("reason")||"",movetalk:s.get("movetalk")==="on",movesubpages:s.get("movesubpages")==="on",noredirect:s.get("noredirect")==="on"};if(!o.from||!o.to){this.ctx.modal.notify("error",{title:"Failed to move",content:"From and to are required."});return}n.setLoadingState(!0),this.movePage(o).then(()=>{location.reload()}).catch(a=>{n.setLoadingState(!1),this.ctx.modal.notify("error",{title:"Failed to move",content:a instanceof Error?a.message:String(a)})})},children:[w(Kl,{inputs:[{label:"Move from",name:"from",value:e?.from,required:!0},{label:"Move to",name:"to",value:e?.to,required:!0}]}),w("div",{children:w(On,{name:"movetalk",id:"movetalk",checked:e?.movetalk,children:"Move talk page"})}),w("div",{children:w(On,{name:"movesubpages",id:"movesubpages",checked:e?.movesubpages,children:"Move subpage(s) (up to 100)"})}),this.ctx.wiki.hasRight("suppressredirect")&&w("div",{children:w(On,{name:"noredirect",id:"noredirect",checked:e?.noredirect,children:"Move without leaving a redirect"})}),w(pr,{label:"Reason",id:"reason",name:"reason",value:e?.reason})]})),n.setButtons([{label:"Move",className:"is-primary is-ghost",method:()=>{r?.dispatchEvent(new Event("submit"))}}]),n.show()}async movePage(e){const{from:n,to:r,reason:i="",...s}=e;if(!n||!r)throw new Error("From and to titles are required.");if(n===r)throw new Error("From and to titles cannot be the same.");return(await this.ctx.wikiPage.newFromTitle(n)).moveTo(r,i,s)}}oo=Rm(Jl),_i=jm(oo,0,"PluginQuickMove",Ql,_i),Mm(oo,1,_i);const Fm=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickMove(){return _i}},Symbol.toStringTag,{value:"Module"}));var Bm=Object.create,ao=Object.defineProperty,Um=Object.getOwnPropertyDescriptor,Xl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Zl=t=>{throw TypeError(t)},qm=(t,e,n)=>e in t?ao(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,zm=(t,e)=>ao(t,"name",{value:e,configurable:!0}),Hm=t=>[,,,Bm(t?.[Xl("metadata")]??null)],Wm=["class","method","getter","setter","accessor","field","value","get","set"],ec=t=>t!==void 0&&typeof t!="function"?Zl("Function expected"):t,Km=(t,e,n,r,i)=>({kind:Wm[t],name:e,metadata:r,addInitializer:s=>n._?Zl("Already initialized"):i.push(ec(s||null))}),Vm=(t,e)=>qm(e,Xl("metadata"),t[3]),Ym=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Gm=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,p=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&Um(i,n));zm(i,n);for(var b=r.length-1;b>=0;b--)l=Km(c,n,a={},t[3],p),o=(0,r[b])(i,l),a._=1,ec(o)&&(i=o);return Vm(t,i),v&&ao(i,n,v),u?c^4?s:v:i},tc,lo,nc;tc=[We(["api","wikiPage","modal","preferences"]),An(fe.object({"quickPreview.keyshortcut":fe.string().default("ctrl-p").description("Key shortcut to open quick preview in quick edit modal")}).extra("category","edit").description("Quick preview options"))];class xi extends(nc=ot){constructor(e){super(e,{},"quickPreview"),this.ctx=e,this.ctx.set("quickPreview",Zs(this,"previewWikitext"))}start(){this.ctx.on("quick-edit/wiki-page",this.injectQuickEdit.bind(this)),this.ctx.on("quick-delete/wiki-page",this.injectQuickDelete.bind(this))}stop(){}previewWikitext(e,n,r,i,s){return r||(r=this.ctx.wikiPage.newBlankPage({title:"API"})),(!i||i.isDestroyed)&&(i=this.ctx.modal.createObject({className:"in-page-edit ipe-quickPreview",sizeClass:"large",center:!1,...s}).init()),i.show(),i.setTitle("Preview - Loading..."),i.setContent(w(Xt,{})),i.bringToFront(),this.ctx.emit("quick-preview/show-modal",{ctx:this.ctx,text:e,modal:i,wikiPage:r}),r.preview(e,n).then(o=>{const{data:{parse:a}}=o;i.setTitle(`Preview - ${a.title}`);let l=null;i.setContent(w("section",{children:w("div",{ref:c=>l=c,className:"mw-parser-output",innerHTML:a.text})})),window.mw?.hook("wikipage.content").fire($(l)),this.ctx.emit("quick-preview/loaded",{ctx:this.ctx,modal:i,wikiPage:r,text:e,parseData:a})}).catch(o=>{i.setTitle("Preview - Failed"),i.setContent(w(Ft,{children:[w("p",{children:"Failed to preview"}),w("p",{children:o instanceof Error?o.message:String(o)})]}))}),i}async injectQuickEdit({options:e,modal:n,wikiPage:r}){let i;n.addButton({label:"Preview",side:"left",className:"btn btn-secondary",keyPress:await this.ctx.preferences.get("quickPreview.keyshortcut.quickEdit")||void 0,method:()=>{let s=n.get$content().querySelector('textarea[name="text"]')?.value||"";if(e.section==="new"){const o=n.get$content().querySelector('input[name="summary"]')?.value;o&&(s=`==${o}==
67
- ${s}`)}i=this.previewWikitext(s,void 0,r,i,{backdrop:!1,draggable:!0})}},1),n.on(n.Event.Close,()=>{i?.destroy(),i=void 0})}injectQuickDelete({ctx:e,modal:n,wikiPage:r}){n.addButton({label:"Preview",side:"left",className:"btn btn-secondary",method:()=>{this.logger.warn("To be implemented: preview wikitext for quick delete")}},2)}}lo=Hm(nc),xi=Gm(lo,0,"PluginQuickPreview",tc,xi),Ym(lo,1,xi);const Qm=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickPreview(){return xi}},Symbol.toStringTag,{value:"Module"}));class Ut{diff(e,n,r={}){let i;typeof r=="function"?(i=r,r={}):"callback"in r&&(i=r.callback);const s=this.castInput(e,r),o=this.castInput(n,r),a=this.removeEmpty(this.tokenize(s,r)),l=this.removeEmpty(this.tokenize(o,r));return this.diffWithOptionsObj(a,l,r,i)}diffWithOptionsObj(e,n,r,i){var s;const o=A=>{if(A=this.postProcess(A,r),i){setTimeout(function(){i(A)},0);return}else return A},a=n.length,l=e.length;let c=1,u=a+l;r.maxEditLength!=null&&(u=Math.min(u,r.maxEditLength));const f=(s=r.timeout)!==null&&s!==void 0?s:1/0,p=Date.now()+f,v=[{oldPos:-1,lastComponent:void 0}];let b=this.extractCommon(v[0],n,e,0,r);if(v[0].oldPos+1>=l&&b+1>=a)return o(this.buildValues(v[0].lastComponent,n,e));let I=-1/0,B=1/0;const D=()=>{for(let A=Math.max(I,-c);A<=Math.min(B,c);A+=2){let y;const m=v[A-1],h=v[A+1];m&&(v[A-1]=void 0);let S=!1;if(h){const R=h.oldPos-A;S=h&&0<=R&&R<a}const T=m&&m.oldPos+1<l;if(!S&&!T){v[A]=void 0;continue}if(!T||S&&m.oldPos<h.oldPos?y=this.addToPath(h,!0,!1,0,r):y=this.addToPath(m,!1,!0,1,r),b=this.extractCommon(y,n,e,A,r),y.oldPos+1>=l&&b+1>=a)return o(this.buildValues(y.lastComponent,n,e))||!0;v[A]=y,y.oldPos+1>=l&&(B=Math.min(B,A-1)),b+1>=a&&(I=Math.max(I,A+1))}c++};if(i)(function A(){setTimeout(function(){if(c>u||Date.now()>p)return i(void 0);D()||A()},0)})();else for(;c<=u&&Date.now()<=p;){const A=D();if(A)return A}}addToPath(e,n,r,i,s){const o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===n&&o.removed===r?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:n,removed:r,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:o}}}extractCommon(e,n,r,i,s){const o=n.length,a=r.length;let l=e.oldPos,c=l-i,u=0;for(;c+1<o&&l+1<a&&this.equals(r[l+1],n[c+1],s);)c++,l++,u++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!s.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const i=[];let s;for(;e;)i.push(e),s=e.previousComponent,delete e.previousComponent,e=s;i.reverse();const o=i.length;let a=0,l=0,c=0;for(;a<o;a++){const u=i[a];if(u.removed)u.value=this.join(r.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=n.slice(l,l+u.count);f=f.map(function(p,v){const b=r[c+v];return b.length>p.length?b:p}),u.value=this.join(f)}else u.value=this.join(n.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return i}}class Jm extends Ut{}const rc=new Jm;function ic(t,e,n){return rc.diff(t,e,n)}function sc(t,e){let n;for(n=0;n<t.length&&n<e.length;n++)if(t[n]!=e[n])return t.slice(0,n);return t.slice(0,n)}function oc(t,e){let n;if(!t||!e||t[t.length-1]!=e[e.length-1])return"";for(n=0;n<t.length&&n<e.length;n++)if(t[t.length-(n+1)]!=e[e.length-(n+1)])return t.slice(-n);return t.slice(-n)}function co(t,e,n){if(t.slice(0,e.length)!=e)throw Error(`string ${JSON.stringify(t)} doesn't start with prefix ${JSON.stringify(e)}; this is a bug`);return n+t.slice(e.length)}function uo(t,e,n){if(!e)return t+n;if(t.slice(-e.length)!=e)throw Error(`string ${JSON.stringify(t)} doesn't end with suffix ${JSON.stringify(e)}; this is a bug`);return t.slice(0,-e.length)+n}function gr(t,e){return co(t,e,"")}function Si(t,e){return uo(t,e,"")}function ac(t,e){return e.slice(0,Xm(t,e))}function Xm(t,e){let n=0;t.length>e.length&&(n=t.length-e.length);let r=e.length;t.length<e.length&&(r=t.length);const i=Array(r);let s=0;i[0]=0;for(let o=1;o<r;o++){for(e[o]==e[s]?i[o]=i[s]:i[o]=s;s>0&&e[o]!=e[s];)s=i[s];e[o]==e[s]&&s++}s=0;for(let o=n;o<t.length;o++){for(;s>0&&t[o]!=e[s];)s=i[s];t[o]==e[s]&&s++}return s}function Zm(t){return t.includes(`\r
66
+ /____/ v`+n.version+`
67
+ `+Object.entries({"Wiki API Base":t,"Document Site":gi.HOME_URL,"Bug reporting":gi.GITHUB_URL}).map(([r,i])=>`- ${r}: ${i}`).join(`
68
+ `))}function Op(t,e){const n=Symbol.for(t);return window[n]?!1:(window[n]=!0,e(),!0)}function On(t,e){return function(n){return n.PreferencesSchema=t,n.PreferencesDefaults=e,n}}const El=t=>w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...t,class:`icon icon-tabler icons-tabler-outline icon-tabler-pencil-bolt ${t.className||""}`,children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),w("path",{d:"M13.5 6.5l4 4"}),w("path",{d:"M19 16l-2 3h4l-2 3"})]});var Ap=Object.create,Gs=Object.defineProperty,Rp=Object.getOwnPropertyDescriptor,kl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Pl=t=>{throw TypeError(t)},Np=(t,e,n)=>e in t?Gs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Dp=(t,e)=>Gs(t,"name",{value:e,configurable:!0}),Lp=t=>[,,,Ap(t?.[kl("metadata")]??null)],Mp=["class","method","getter","setter","accessor","field","value","get","set"],$l=t=>t!==void 0&&typeof t!="function"?Pl("Function expected"):t,jp=(t,e,n,r,i)=>({kind:Mp[t],name:e,metadata:r,addInitializer:s=>n._?Pl("Already initialized"):i.push($l(s||null))}),Fp=(t,e)=>Np(e,kl("metadata"),t[3]),Bp=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Up=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,y=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&Rp(i,n));Dp(i,n);for(var b=r.length-1;b>=0;b--)l=jp(c,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,$l(o)&&(i=o);return Fp(t,i),v&&Gs(i,n,v),u?c^4?s:v:i},Cl,Qs,Tl;Cl=[We(["wiki","wikiTitle","preferences"]),On(fe.object({"inArticleLinks.enable":fe.boolean().description("Whether to enable in-article links").default(!0),"inArticleLinks.quickDiff.enable":fe.boolean().description("Whether to enable in-article links for quick diff").default(!0),"inArticleLinks.quickEdit.enable":fe.boolean().description("Whether to enable in-article links for quick edit").default(!0),"inArticleLinks.quickEdit.redlinks":fe.boolean().description("Whether to show quick edit button for redlinks").default(!0)}).description("In-article links preferences").extra("category","in-article-links"))];class vi extends(Tl=ot){constructor(e){super(e,{linkClassName:"ipe__in-article-link"},"InArticleLinks"),this._cachedAnchorInfo=new WeakMap,this.ctx.set("inArticleLinks",this),this.ctx.preferences.defineCategory({label:"In Article Links",name:"in-article-links",description:"In-article links preferences",index:9})}async start(){await this.ctx.preferences.get("inArticleLinks.quickEdit.enable")&&this.handleQuickEdit(),await this.ctx.preferences.get("inArticleLinks.quickDiff.enable")&&this.handleQuickDiff()}async stop(){Array.from(document.getElementsByClassName(this.config.linkClassName)).forEach(e=>{e.remove()}),document.querySelectorAll("[data-ipe-edit-mounted]").forEach(e=>{e.dataset.ipeEditMounted=void 0})}parseAnchor(e){if(!(e instanceof HTMLAnchorElement))return null;const n=this._cachedAnchorInfo.get(e);if(n)return n;const r=e.getAttribute("href")||"";if(!this.ctx.wikiTitle.validateHrefAttr(r))return null;const i=e.href||"",s=this.ctx.wikiTitle.parseWikiLink(i);if(!s)return null;const o={$el:e,kind:e.closest('[typeof^="mw:File"]')?"mw:File":"normal",external:e.classList.contains("external")||!!r.startsWith("http"),redlink:e.classList.contains("new")||s.params.has("redlink"),...s};return this._cachedAnchorInfo.set(e,o),o}scanAnchors(e,n){const r=e.querySelectorAll("a[href]");return Array.from(r).map(i=>this.parseAnchor(i)).filter(i=>i!==null&&(!n||n(i)))}async handleQuickEdit(){let e=!1;const n=await this.ctx.preferences.get("inArticleLinks.quickEdit.redlinks");this.ctx.inject(["quickEdit"],r=>{e=!0,r.on("dispose",()=>{e=!1}),window?.mw?.hook?.("wikipage.content").add(i=>{if(!e)return;this.scanAnchors(i.get(0),({action:o,title:a,redlink:l})=>n||!l?["edit","create"].includes(o)?!0:a?.isSpecial("edit")||a?.isSpecial("newsection")?a.getMainText().split("/").length>=2:!1:!1).forEach(({$el:o,title:a,pageId:l,params:c})=>{if(o.dataset.ipeEditMounted)return;if(o.dataset.ipeEditMounted="1",c.has("preload")||c.has("redo"))return this.ctx.logger.debug(o,"Not compatible with quick edit");const f=a?.getPrefixedDBKey()||"",y=c.get("section")?.replace(/^T-/,"")||void 0,v=c.get("oldid"),b=c.has("redlink");let I;y==="new"||a?.isSpecial("newsection")?I="new":y&&/^\d+$/.test(y)&&(I=parseInt(y,10));const F=v?parseInt(v,10):void 0,O={title:f,pageId:l||void 0,section:I,revision:F,createOnly:b},A=w("a",{href:"#ipe://quick-edit/",dataset:O,className:`${this.config.linkClassName} ipe-quick-edit ${b?"ipe-quick-edit--create-only":""}`,style:{userSelect:"none",marginLeft:"0.2em"},onClick:g=>{g.preventDefault(),r.quickEdit.showModal(O)},children:w(El,{className:"ipe-icon"})});o.insertAdjacentElement("afterend",A)})})})}handleQuickDiff(){let e=!1;const n=r=>["prev","next","cur"].includes(r);this.ctx.inject(["quickDiff"],r=>{e=!0,r.on("dispose",()=>{e=!1}),window?.mw?.hook?.("wikipage.content").add(i=>{if(!e)return;this.scanAnchors(i.get(0),({params:o,title:a})=>!!(o.has("diff")||a?.isSpecial("diff"))).forEach(({$el:o,title:a,params:l})=>{if(o.dataset.ipeDiffMounted)return;o.dataset.ipeDiffMounted="1";let c,u;if(a?.getNamespaceId()===-1?[,c,u]=a.getMainDBKey().split("/"):(c=l.get("diff"),u=l.get("oldid")),!c||!u)return;const f={};n(c)?(f.fromrev=parseInt(u),f.torelative=c):(f.fromrev=parseInt(u),f.torev=parseInt(c));const y=w("a",{href:"#ipe://quick-diff/",dataset:f,className:`${this.config.linkClassName} ipe-quick-diff`,style:{userSelect:"none",marginLeft:"0.2em"},onClick:v=>{v.preventDefault(),r.quickDiff.comparePages(f)},children:w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file-diff ipe-icon",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),w("path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"}),w("path",{d:"M12 10l0 4"}),w("path",{d:"M10 12l4 0"}),w("path",{d:"M10 17l4 0"})]})});o.insertAdjacentElement("afterend",y)})})})}}Qs=Lp(Tl),vi=Up(Qs,0,"PluginInArticleLinks",Cl,vi),Bp(Qs,1,vi);const qp=Object.freeze(Object.defineProperty({__proto__:null,get PluginInArticleLinks(){return vi}},Symbol.toStringTag,{value:"Module"})),zp=t=>typeof t=="function";async function Hp(t){return zp(t)?await t():t}const Wp=window?.location?.origin,Kp=({type:t,tag:e,href:n,target:r,children:i,...s})=>(e=e||(n?"a":"button"),typeof r>"u"&&n&&n.startsWith("http")&&!n.startsWith(Wp)&&(r="_blank"),Nh(e,{className:`theme-ipe ipe-action-button ipe-modal-btn is-${t||"default"}`,href:e==="a"?n:void 0,target:e==="a"?r:void 0,"data-href":e!=="a"?n:void 0,...s},i));var Vp=Object.create,Js=Object.defineProperty,Yp=Object.getOwnPropertyDescriptor,Il=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ol=t=>{throw TypeError(t)},Gp=(t,e,n)=>e in t?Js(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Qp=(t,e)=>Js(t,"name",{value:e,configurable:!0}),Jp=t=>[,,,Vp(t?.[Il("metadata")]??null)],Xp=["class","method","getter","setter","accessor","field","value","get","set"],Al=t=>t!==void 0&&typeof t!="function"?Ol("Function expected"):t,Zp=(t,e,n,r,i)=>({kind:Xp[t],name:e,metadata:r,addInitializer:s=>n._?Ol("Already initialized"):i.push(Al(s||null))}),em=(t,e)=>Gp(e,Il("metadata"),t[3]),tm=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},nm=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,y=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&Yp(i,n));Qp(i,n);for(var b=r.length-1;b>=0;b--)l=Zp(c,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,Al(o)&&(i=o);return em(t,i),v&&Js(i,n,v),u?c^4?s:v:i},Rl,Xs,Nl;Rl=[We(["storage"])];class yi extends(Nl=ot){constructor(e){super(e,{},"preferences"),this.ctx=e,this.db=void 0,this.customRegistries=[],this.categoryDefinitions=[],this._defaultPreferences={},this.db=e.storage.createDatabse("preferences",1/0),this.ctx.set("preferences",this)}async start(){this.defineCategory({name:"general",label:"General",description:"General settings"}),this.defineCategory({name:"edit",label:"Editing",description:"Settings related to editing content"}),this.defineCategory({name:"about",label:"About",description:"About InPageEdit",index:99}),this.registerCustomConfig("about",fe.object({about:fe.const(w("div",{className:"prose",children:[w("h2",{children:"✏️ InPageEdit NEXT"}),w("i",{children:["v",this.ctx.version]}),w("h2",{children:"Portals"}),w("div",{style:"display: flex; flex-direction: column; gap: 1rem",children:[w("a",{href:this.ctx.Endpoints.HOME_URL,target:"_blank",style:{display:"block",width:"100%"},children:"Official Website & Help Center"}),w(Kp,{href:`${this.ctx.Endpoints.UPDATE_LOGS_URL}#${this.ctx.version}`,style:{display:"block",width:"100%"},children:"Update Logs"})]}),w("h2",{children:"Join us"}),w("ul",{children:[w("li",{children:[w("strong",{children:"GitHub"}),":"," ",w("a",{href:this.ctx.Endpoints.GITHUB_URL,target:"_blank",children:"inpageedit/inpageedit-next"})]}),w("li",{children:[w("strong",{children:"QQ Group"}),": 1026023666"]})]}),w("hr",{}),w("p",{children:"🚀 Modular, Extensible Supercharged Plugin for MediaWiki."}),w("p",{children:"InPageEdit-NEXT Copyright © 2025-present dragon-fish"})]})).role("raw-html")}).description(""),"about",{}),Promise.resolve().then(()=>Vb).then(e=>{const n=this.ctx.plugin(e.PluginPreferencesUI);this.addDisposeHandler(()=>{n.dispose()})})}async get(e,n){n??(n=()=>{const i=this.getDefaultValue(e);return this.logger.debug(e,`(fallback value: ${i})`),i});const r=await this.db.get(e,void 0);return r!==null?r:await Hp(n)}getDefaultValue(e){var n;return(n=this._defaultPreferences)[e]??(n[e]=this.loadDefaultConfigs()[e])}set(e,n){const r=this.getDefaultValue(e);return n===r?this.db.delete(e):this.db.set(e,n)}async getAll(){const e=this.loadDefaultConfigs();return await this.db.iterate((n,r)=>{e[r]=n}),e}loadDefaultConfigs(){const e={};return this.getConfigRegistries().forEach(n=>{try{const r=n.schema({});Object.entries(r).forEach(([i,s])=>{e[i]=s})}catch{}n.defaults&&Object.entries(n.defaults).forEach(([r,i])=>{e[r]=i})}),Object.entries(e).forEach(([n,r])=>{this._defaultPreferences[n]=r}),e}registerCustomConfig(e,n,r,i){return this.customRegistries.push({name:e,schema:n,category:r,defaults:i}),this}getConfigRegistries(e){return Array.from(this.ctx.registry.entries()).map(([n,r])=>n===null?{name:"@root",schema:gn?.PreferencesSchema||null,defaults:gn?.PreferencesDefaults||{}}:{name:n.name,schema:n?.PreferencesSchema||null,defaults:n?.PreferencesDefaults||{}}).filter(n=>n.schema!==null).map(n=>({...n,category:n.schema.meta.category||"general"})).concat(this.customRegistries).filter(n=>!e||n.category===e)}defineCategory(e){const n=this.categoryDefinitions.findIndex(r=>r.name===e.name);return n<0?this.categoryDefinitions.push(e):this.categoryDefinitions[n]=e,this.categoryDefinitions.sort((r,i)=>(r.index??0)-(i.index??0)),this}getConfigCategories(){return this.categoryDefinitions}}Xs=Jp(Nl),yi=nm(Xs,0,"PluginPreferences",Rl,yi),tm(Xs,1,yi);const rm=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferences(){return yi}},Symbol.toStringTag,{value:"Module"})),im=Symbol("@@apply"),sm=Symbol("@@ctor");function Zs(t,e){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError("instance is not an object");const n=(...s)=>{const o=t[e];if(typeof o!="function")throw new TypeError(`Property "${String(e)}" is not a function`);return o.apply(t,s)};n[im]=n,n[sm]=t;const r=t?.constructor?.name;return r&&(n[Symbol.toStringTag]=r),new Proxy(n,{get(s,o,a){return o==="prototype"?Reflect.get(n,o,a):Reflect.get(t,o,t)},set(s,o,a){return Reflect.set(t,o,a)},has(s,o){return Reflect.has(t,o)},deleteProperty(s,o){return Reflect.deleteProperty(t,o)},ownKeys(){return Reflect.ownKeys(t)},getOwnPropertyDescriptor(s,o){return Object.getOwnPropertyDescriptor(t,o)},defineProperty(s,o,a){return Object.defineProperty(t,o,a)}})}const bi={mbox:"_mbox_5x43w_1",title:"_title_5x43w_12",content:"_content_5x43w_19",close:"_close_5x43w_27"},hr=t=>{const{type:e="default",title:n,content:r,closeable:i=!0,titleProps:s,contentProps:o,children:a,...l}=t;let c=n;typeof n>"u"&&e!=="default"&&(c=e[0].toUpperCase()+e.slice(1).toLowerCase());const u=async()=>{if(!f)return Promise.resolve();const{promise:y,resolve:v}=Promise.withResolvers();return f.animate([{opacity:"1",height:f.clientHeight+"px"},{opacity:"0",height:"0px",margin:"0px"}],{duration:300,easing:"ease"}).addEventListener("finish",()=>{f.remove(),v()}),y},f=w("div",{className:`theme-ipe ipe-mbox mbox-type-${e||"default"} ${bi.mbox}`,...l,children:[c&&w("div",{className:`ipe-mbox-title ${bi.title}`,...s,children:c}),w("div",{className:`ipe-mbox-content ${bi.content}`,...o,children:a||r}),i&&w("a",{onClick:u,className:`ipe-mbox-close ${bi.close}`,children:"×"})]});return f.close=u,f},pr=t=>{const{label:e,id:n,name:r,value:i,disabled:s,labelProps:o,inputProps:a,...l}=t;return w("div",{className:"theme-ipe ipe-input-box",...l,children:[w("label",{htmlFor:n,style:{display:"block"},...o,children:e}),w("input",{id:n,name:r,value:i,disabled:s,style:{width:"100%"},...a})]})},Dl=t=>{const{id:e,name:n,value:r,label:i,inputProps:s,labelProps:o,children:a,...l}=t;return w("label",{className:"theme-ipe ipe-radio-box",...l,children:[w("input",{type:"radio",id:e,name:n,value:r,...s}),w("span",{className:"ipe-checkbox-box"}),w("span",{...o,children:i||a})]})},An=t=>{const{id:e,name:n,label:r,checked:i,inputProps:s,labelProps:o,children:a,...l}=t;return w("label",{className:"theme-ipe ipe-checkbox",...l,children:[w("input",{type:"checkbox",id:e,name:n,checked:i,...s}),w("span",{className:"ipe-checkbox-box"}),w("span",{...o,children:r||a})]})},eo=()=>{},om=(t=0)=>new Promise(e=>setTimeout(e,t));var am=Object.create,to=Object.defineProperty,lm=Object.getOwnPropertyDescriptor,Ll=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ml=t=>{throw TypeError(t)},cm=(t,e,n)=>e in t?to(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,um=(t,e)=>to(t,"name",{value:e,configurable:!0}),fm=t=>[,,,am(t?.[Ll("metadata")]??null)],dm=["class","method","getter","setter","accessor","field","value","get","set"],jl=t=>t!==void 0&&typeof t!="function"?Ml("Function expected"):t,hm=(t,e,n,r,i)=>({kind:dm[t],name:e,metadata:r,addInitializer:s=>n._?Ml("Already initialized"):i.push(jl(s||null))}),pm=(t,e)=>cm(e,Ll("metadata"),t[3]),mm=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},gm=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,y=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&lm(i,n));um(i,n);for(var b=r.length-1;b>=0;b--)l=hm(c,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,jl(o)&&(i=o);return pm(t,i),v&&to(i,n,v),u?c^4?s:v:i},Fl,no,Bl;Fl=[We(["api","wikiPage","wikiTitle","currentPage","wiki","modal","preferences"]),On(fe.object({"quickEdit.editSummary":fe.string().description("Default edit summary for quick edits").default("[IPE-NEXT] Quick edit"),"quickEdit.editMinor":fe.boolean().description("Whether to mark the edit as minor").default(!1),"quickEdit.outSideClose":fe.boolean().description("Whether to close the modal outside").default(!0),"quickEdit.watchList":fe.union([fe.const(wt.preferences).description("Follow my preferences"),fe.const(wt.nochange).description("Keep the current watchlist status"),fe.const(wt.watch).description("Add the page to watchlist"),fe.const(wt.unwatch).description("Remove the page from watchlist")]).description("Watchlist options").default(wt.preferences),"quickEdit.keyshortcut.save":fe.string().default("ctrl-s").description("save button key shortcut (blank to disable)")}).description("Quick edit options").extra("category","edit"))];class wi extends(Bl=ot){constructor(e){super(e,{},"quick-edit"),this.ctx=e,this.DEFAULT_OPTIONS={title:"",pageId:0,revision:0,section:void 0,editMinor:!1,editSummary:"",createOnly:!1,reloadAfterSave:!0},this.ctx.root.set("quickEdit",Zs(this,"showModal"))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e),e.on("dispose",()=>{this.removeToolbox(e)})})}async showModal(e){if(typeof e>"u"?e={}:typeof e=="string"&&(e={title:e}),e?.page&&(e.title=e.page,delete e.page),!e.title&&!e.pageId&&!e.revision){this.logger.warn("None of the title, pageId or revision provided. Using defaults.");const O=new URLSearchParams(window.location.search),A=this.ctx.currentPage.wikiTitle;e={...e,title:A?.getPrefixedDBKey(),revision:O.has("oldid")?Number(O.get("oldid")):void 0,pageId:O.has("curid")?Number(O.get("curid")):void 0}}if(!e.revision&&!e.pageId&&e.title){const O=this.ctx.wikiTitle.resolveSpecialPageTarget(e.title);O&&O.title.getNamespaceId()>=0&&(e.title=O.title.getPrefixedDBKey(),e.section??(e.section=O.section))}const n=await this.ctx.preferences.get("quickEdit.outSideClose"),r=await this.ctx.preferences.get("quickEdit.watchList"),i=typeof e.editSummary=="string"?e.editSummary:await this.ctx.preferences.get("quickEdit.editSummary"),s=typeof e.editMinor=="boolean"?e.editMinor:await this.ctx.preferences.get("quickEdit.editMinor"),o={...this.DEFAULT_OPTIONS,editSummary:i,editMinor:s,...e};o.editSummary||(o.editSummary=await this.ctx.preferences.get("quickEdit.editSummary")||""),this.ctx.emit("quick-edit/init-options",{ctx:this.ctx,options:o});const a=this.ctx.modal.createObject({className:"ipe-quickEdit",sizeClass:"large",center:!1,outSideClose:n}).init();a.setTitle(w(Ft,{children:["Loading: ",w("u",{children:o.title})]})),a.setContent(w("section",{className:"ipe-quickEdit-loading",style:{height:"70vh",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:w(Xt,{})})),a.addButton({side:"right",type:"button",className:"is-danger is-ghost",label:"Cancel",method(){a.close()}}),a.show(),this.ctx.emit("quick-edit/show-modal",{ctx:this.ctx,modal:a,options:o});let l;try{if(l=await this.getWikiPageFromPayload(o),l.pageInfo.special)throw new Error("Special page is not editable")}catch(O){a.off(a.Event.Close),a.close(),this.ctx.modal.notify("error",{content:O instanceof Error?O.message:String(O)});return}const c=o.section==="new"?"":l.revisions[0]?.content||"",u=l.revisions[0]?.revid,f=u&&u!==l.lastrevid,y=o.section==="new",v=l.pageid===0;a.setTitle(w(Ft,{children:[y?"New section":`Quick ${v?"Create":"Edit"}`,":"," ",w("u",{children:l.pageInfo.title}),f?` (Revision ${u})`:""]}));const b=[];v&&b.push(w(hr,{title:"Attention",type:"important",children:w("p",{children:"This page does not exist."})})),f&&b.push(w(hr,{title:"Attention",type:"warning",children:w("p",{children:["You are editing a ",w("em",{children:"historical version"}),"; the content is not the latest!"]})})),this.ctx.emit("quick-edit/edit-notice",{ctx:this.ctx,options:o,modal:a,wikiPage:l,editNotices:b});const I=w("form",{className:"ipe-quickEdit__form",children:[w("div",{className:"ipe-quickEdit__notices",children:b}),w("div",{className:"ipe-quickEdit__content",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.section==="new"&&w(Ft,{children:w(pr,{label:"Section title",id:"summary",name:"summary",value:"",inputProps:{placeholder:"Topic for new section, this will be the h2 heading"}})}),w("textarea",{className:"ipe-quickEdit__textarea",name:"text",id:"wpTextbox1",children:c})]}),w("div",{class:"ipe-quickEdit__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:[!y&&w(pr,{label:"Summary",id:"summary",name:"summary",value:o.editSummary}),w("div",{className:"ipe-input-box",children:[w("label",{htmlFor:"watchlist",style:{display:"block"},children:"Watchlist"}),w("div",{style:{display:"flex",gap:"1rem"},children:[wt.preferences,wt.nochange,wt.watch,wt.unwatch].map(O=>w(Dl,{name:"watchlist",value:O,inputProps:{checked:r===O},children:O},O))})]}),w("div",{style:{display:"flex",gap:"1rem"},children:[w(An,{name:"minor",id:"minor",checked:o.editMinor,children:"Minor edit"}),w(An,{name:"reloadAfterSave",id:"reloadAfterSave",checked:o.reloadAfterSave,children:"Reload after save"})]})]}),!1]});a.setContent(I),a.addButton({side:"left",className:"is-primary submit-btn",label:"Submit",keyPress:await this.ctx.preferences.get("quickEdit.keyshortcut.save")||void 0,method:()=>{const O=new FormData(I);a.setLoadingState(!0),this.handleSubmit({wikiPage:l,text:O.get("text"),summary:O.get("summary"),minor:O.get("minor")==="on",section:o.section,createonly:l.pageid===0,watchlist:r}).then(async()=>{a.setOptions({beforeClose:eo}),a.close(),this.ctx.modal.notify("success",{title:"Submission Successful",content:"Your changes have been saved."}),O.get("reloadAfterSave")&&(await om(500),location.reload())}).catch(A=>{this.ctx.modal.notify("error",{title:"Submission Error",content:A instanceof Error?A.message:String(A)}),a.setLoadingState(!1)})}},0),a.setOptions({beforeClose:()=>{const O=l.revisions[0]?.content||"";return(I.querySelector("textarea")?.value||"")===O?!0:(this.ctx.modal.confirm({className:"is-primary",title:"Unsaved Changes",content:"All edit contents will be lost after closing the modal. Are you sure you want to close?",center:!0,okBtn:{label:"Give Up",className:"is-danger is-ghost"},cancelBtn:{label:"Continue Editing",className:"is-primary is-ghost"}},g=>(g&&(a.setOptions({beforeClose:eo}),a.close()),!0)),!1)}}),this.ctx.emit("quick-edit/wiki-page",{ctx:this.ctx,options:o,modal:a,wikiPage:l});const F=O=>I.querySelector("textarea")?.value===l.revisions[0]?.content?!0:(O.preventDefault(),"You have unsaved changes. Are you sure you want to leave?");window.addEventListener("beforeunload",F),a.on(a.Event.Close,()=>{window.removeEventListener("beforeunload",F)})}async handleSubmit(e){const n=e.wikiPage,r=e.summary||"",i=e.text||"",s=e.minor,o=e.createonly,a=e.watchlist,l=e.section;return n.edit({summary:r,text:i,watchlist:a,section:l},{minor:s,createonly:o})}async getWikiPageFromPayload(e){if(e.revision)return this.ctx.wikiPage.newFromRevision(e.revision,e.section);if(e.pageId)return this.ctx.wikiPage.newFromPageId(e.pageId,e.section);if(e.title)return this.ctx.wikiPage.newFromTitle(e.title,!1,e.section);throw new Error("Invalid payload")}async injectToolbox(e){const n=this.ctx.currentPage.wikiTitle,r=this.ctx.wiki.hasRight("edit")&&n&&n.getNamespaceId()>=0;e.toolbox.addButton({id:"quick-edit",group:"group1",index:0,icon:w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-edit",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"}),w("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"}),w("path",{d:"M16 5l3 3"})]}),buttonProps:{disabled:!r},tooltip:r?"Quick Edit":"Not editable",onClick:()=>{const i=new URLSearchParams(window.location.search).get("oldid");this.showModal({title:n?.getPrefixedText(),revision:i?Number(i):void 0})}})}removeToolbox(e){e.toolbox.removeButton("quick-edit")}}no=fm(Bl),wi=gm(no,0,"PluginQuickEdit",Fl,wi),mm(no,1,wi);const vm=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickEdit(){return wi}},Symbol.toStringTag,{value:"Module"}));var ym=Object.create,ro=Object.defineProperty,bm=Object.getOwnPropertyDescriptor,Ul=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),ql=t=>{throw TypeError(t)},wm=(t,e,n)=>e in t?ro(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_m=(t,e)=>ro(t,"name",{value:e,configurable:!0}),xm=t=>[,,,ym(t?.[Ul("metadata")]??null)],Sm=["class","method","getter","setter","accessor","field","value","get","set"],zl=t=>t!==void 0&&typeof t!="function"?ql("Function expected"):t,Em=(t,e,n,r,i)=>({kind:Sm[t],name:e,metadata:r,addInitializer:s=>n._?ql("Already initialized"):i.push(zl(s||null))}),km=(t,e)=>wm(e,Ul("metadata"),t[3]),Pm=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},$m=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,y=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&bm(i,n));_m(i,n);for(var b=r.length-1;b>=0;b--)l=Em(c,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,zl(o)&&(i=o);return km(t,i),v&&ro(i,n,v),u?c^4?s:v:i},Hl,io,Wl;Hl=[We(["api","wikiPage","wikiTitle","currentPage","wiki","modal","preferences"]),On(fe.object({deleteReason:fe.string().description("Default delete reason for quick delete").default("[IPE-NEXT] Quick delete")}).description("Quick delete options").extra("category","delete"))];class _i extends(Wl=ot){constructor(e){super(e,{},"quick-delete"),this.ctx=e,this.DEFAULT_OPTIONS={title:"",pageId:0,revision:0,deleteReason:"",reloadAfterDelete:!0},this.ctx.root.set("quickDelete",Zs(this,"showModal"))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e),e.on("dispose",()=>{this.removeToolbox(e)})}),this.ctx.preferences.defineCategory({label:"Delete",name:"delete",description:"Settings related to deleting pages",index:3})}async showModal(e){if(typeof e>"u"?e={}:typeof e=="string"&&(e={title:e}),!e.title&&!e.pageId&&!e.revision){this.logger.warn("None of the title, pageId or revision provided. Using defaults.");const l=new URLSearchParams(window.location.search),c=this.ctx.currentPage.wikiTitle;e={...e,title:c?.getPrefixedDBKey(),revision:l.has("oldid")?Number(l.get("oldid")):void 0,pageId:l.has("curid")?Number(l.get("curid")):void 0}}const n=typeof e.deleteReason=="string"?e.deleteReason:await this.ctx.preferences.get("deleteReason"),r={...this.DEFAULT_OPTIONS,deleteReason:n,...e};r.deleteReason||(r.deleteReason=await this.ctx.preferences.get("deleteReason")||""),r||this.ctx.emit("quick-delete/init-options",{ctx:this.ctx,options:r});const i=this.ctx.modal.createObject({className:"ipe-quickDelete",sizeClass:"small",center:!0}).init();i.setTitle(w(Ft,{children:["Loading: ",w("u",{children:r.title})]})),i.setContent(w(Xt,{})),i.addButton({side:"right",type:"button",className:"is-ghost",label:"Cancel",method(){i.close()}}),i.show(),this.ctx.emit("quick-delete/show-modal",{ctx:this.ctx,modal:i,options:r});let s;try{if(s=await this.getWikiPageFromPayload(r),s.pageInfo.special)throw new Error("Special page cannot be deleted");if(s.pageInfo.pageid===0)throw new Error("Page does not exist, cannot be deleted")}catch(l){i.off(i.Event.Close),i.close(),this.ctx.modal.notify("error",{content:l instanceof Error?l.message:String(l)});return}i.setTitle(w(Ft,{children:["Quick Delete: ",w("u",{children:s.pageInfo.title})]}));const o=[];s.userCan("delete")||o.push(w(hr,{title:"Permission Denied",type:"error",children:w("p",{children:"You do not have permission to delete this page."})})),s.pageInfo.protection&&s.pageInfo.protection.length>0&&o.push(w(hr,{title:"Warning",type:"warning",children:w("p",{children:"This page is protected and may has special use or purpose. Delete it at your own risk."})})),this.ctx.emit("quick-delete/delete-notice",{ctx:this.ctx,options:r,modal:i,wikiPage:s,deleteNotices:o});const a=w("form",{className:"ipe-quickDelete__form",children:[w("div",{className:"ipe-quickDelete__notices",children:o}),w("div",{className:"ipe-quickDelete__content",children:w("div",{className:"ipe-quickDelete__page-info",style:{padding:"1rem",backgroundColor:"#f8f9fa",border:"1px solid #dee2e6",borderRadius:"4px",marginBottom:"1rem"},children:w("ul",{children:[w("li",{children:[w("strong",{children:"Title:"})," ",s.pageInfo.title]}),w("li",{children:[w("strong",{children:"Page ID:"})," ",s.pageInfo.pageid]}),w("li",{children:[w("strong",{children:"Last Revision:"})," ",s.pageInfo.lastrevid]}),w("li",{children:[w("strong",{children:"Length:"})," ",s.pageInfo.length," characters"]})]})})}),w("div",{class:"ipe-quickDelete__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:w(pr,{label:"Delete Reason",id:"reason",name:"reason",value:r.deleteReason,inputProps:{placeholder:"Enter reason for deletion...",required:!0}})}),!1]});i.setContent(a),i.addButton({side:"left",className:"is-danger submit-btn",label:"Delete Page",method:()=>{const c=new FormData(a).get("reason");if(!c||c.trim()===""){this.ctx.modal.notify("error",{title:"Missing Reason",content:"Please provide a reason for deletion."});return}this.ctx.modal.confirm({className:"is-danger",title:"Confirm Deletion",content:w(Ft,{children:w("p",{children:w("strong",{children:s.pageInfo.title})})}),center:!0,okBtn:{label:"Delete it now",className:"is-danger"},cancelBtn:{label:"Cancel",className:"is-ghost"}},u=>(u&&(i.setLoadingState(!0),this.handleSubmit({wikiPage:s,reason:c}).then(async()=>{i.setOptions({beforeClose:eo}),i.close(),this.ctx.modal.notify("success",{title:"Deletion Successful",content:`The page "${s.pageInfo.title}" has been deleted.`})}).catch(f=>{this.ctx.modal.notify("error",{title:"Deletion Error",content:f instanceof Error?f.message:String(f)}),i.setLoadingState(!1)})),!0))}},0),this.ctx.emit("quick-delete/wiki-page",{ctx:this.ctx,options:r,modal:i,wikiPage:s})}async handleSubmit(e){const n=e.wikiPage,r=e.reason||"";return n.delete(r)}async getWikiPageFromPayload(e){if(e.revision)return this.ctx.wikiPage.newFromRevision(e.revision);if(e.pageId)return this.ctx.wikiPage.newFromPageId(e.pageId);if(e.title)return this.ctx.wikiPage.newFromTitle(e.title,!1);throw new Error("Invalid payload")}async injectToolbox(e){const n=this.ctx.currentPage.wikiTitle,r=n&&this.ctx.wiki.hasRight("delete")&&n.getNamespaceId()>=0;e.toolbox.addButton({id:"quick-delete",group:"group2",icon:w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M4 7l16 0"}),w("path",{d:"M10 11l0 6"}),w("path",{d:"M14 11l0 6"}),w("path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"}),w("path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"})]}),buttonProps:{disabled:!r},tooltip:r?"Quick Delete":"Not deletable",onClick:()=>{this.showModal({title:n?.getPrefixedText()})}})}removeToolbox(e){e.toolbox.removeButton("quick-delete")}}io=xm(Wl),_i=$m(io,0,"PluginQuickDelete",Hl,_i),Pm(io,1,_i);const Cm=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickDelete(){return _i}},Symbol.toStringTag,{value:"Module"})),mr={twinSwapInput:"_twinSwapInput_1gdgl_9",inputWrapper:"_inputWrapper_1gdgl_23",inputLeft:"_inputLeft_1gdgl_27",inputRight:"_inputRight_1gdgl_30",swapButton:"_swapButton_1gdgl_46"},Kl=t=>{const{inputs:e,enableSwap:n=!0,...r}=t,i=e?.length===2?e:[e?.[0]??{},e?.[1]??{}],s=[null,null];let o=0,a=null,l=null;const c=()=>s.some(b=>b&&b.disabled),u=()=>{if(!s[0]||!s[1]||c())return;const b=s[0],I=s[1],F=b.value,O=I.value;b.value=O,I.value=F,b.dispatchEvent(new Event("change")),I.dispatchEvent(new Event("change")),o++,l&&(l.style.transform=`rotateY(${o*-180}deg)`,l.style.transition="transform 200ms ease")},f=b=>{if(!a)return;const I=b??!a.disabled;a.disabled=!I,I&&s.forEach(F=>{F&&(F.disabled=!1)})},y=w("button",{type:"button","aria-label":"Swap values",onClick:u,disabled:c()||!n,ref:b=>a=b,children:w("svg",{ref:b=>l=b,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon-tabler icons-tabler-outline icon-tabler-transfer",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M20 10h-16l5.5 -6"}),w("path",{d:"M4 14h16l-5.5 6"})]})}),v=w("div",{className:`twin-swap-input ${mr.twinSwapInput}`,...r,children:[i.map((b,I)=>{const{label:F,id:O,name:A,value:g,disabled:p,required:h,inputProps:S}=b,T=I===0,N=O||A;return w("div",{className:`${mr.inputWrapper} ${T?mr.inputLeft:mr.inputRight}`,children:[F&&w("label",{htmlFor:N,children:F}),w("input",{ref:H=>s[I]=H,type:"text",id:N,name:A,value:g,disabled:p,required:h,...S})]})}),w("div",{className:mr.swapButton,children:y})]});return v.swap=u,v.toggleEnableSwap=f,v};var Tm=Object.create,so=Object.defineProperty,Im=Object.getOwnPropertyDescriptor,Vl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Yl=t=>{throw TypeError(t)},Om=(t,e,n)=>e in t?so(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Am=(t,e)=>so(t,"name",{value:e,configurable:!0}),Rm=t=>[,,,Tm(t?.[Vl("metadata")]??null)],Nm=["class","method","getter","setter","accessor","field","value","get","set"],Gl=t=>t!==void 0&&typeof t!="function"?Yl("Function expected"):t,Dm=(t,e,n,r,i)=>({kind:Nm[t],name:e,metadata:r,addInitializer:s=>n._?Yl("Already initialized"):i.push(Gl(s||null))}),Lm=(t,e)=>Om(e,Vl("metadata"),t[3]),Mm=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},jm=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,y=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&Im(i,n));Am(i,n);for(var b=r.length-1;b>=0;b--)l=Dm(c,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,Gl(o)&&(i=o);return Lm(t,i),v&&so(i,n,v),u?c^4?s:v:i},Ql,oo,Jl;Ql=[We(["modal","wiki"])];class xi extends(Jl=ot){constructor(e){super(e,{},"quick-move"),this.ctx=e,e.set("quickMove",this.quickMove.bind(this)),e.set("movePage",this.movePage.bind(this))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e)})}injectToolbox(e){const n=window.mw?.config.get("wgPageName")||"",r=window.mw?.config.get("wgIsProbablyEditable");e.toolbox.addButton({id:"quick-move",icon:w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-forms",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3"}),w("path",{d:"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3"}),w("path",{d:"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7"}),w("path",{d:"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1"}),w("path",{d:"M17 12h.01"}),w("path",{d:"M13 12h.01"})]}),tooltip:"Quick Move",group:"group1",index:1,onClick:()=>{this.quickMove(r?{lockFromField:!0,from:n}:{})}})}quickMove(e){const n=this.ctx.modal.createObject({title:"Quick Move",content:w(Xt,{}),className:"quick-move compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let r=null;return n.setContent(w("form",{ref:i=>r=i,style:{display:"flex",flexDirection:"column",gap:"1rem"},onSubmit:i=>{if(i.preventDefault(),r?.checkValidity(),!r?.reportValidity())return;const s=new FormData(r),o={from:s.get("from")?.toString().trim(),to:s.get("to")?.toString().trim(),reason:s.get("reason")||"",movetalk:s.get("movetalk")==="on",movesubpages:s.get("movesubpages")==="on",noredirect:s.get("noredirect")==="on"};if(!o.from||!o.to){this.ctx.modal.notify("error",{title:"Failed to move",content:"From and to are required."});return}n.setLoadingState(!0),this.movePage(o).then(()=>{location.reload()}).catch(a=>{n.setLoadingState(!1),this.ctx.modal.notify("error",{title:"Failed to move",content:a instanceof Error?a.message:String(a)})})},children:[w(Kl,{inputs:[{label:"Move from",name:"from",value:e?.from,required:!0},{label:"Move to",name:"to",value:e?.to,required:!0}]}),w("div",{children:w(An,{name:"movetalk",id:"movetalk",checked:e?.movetalk,children:"Move talk page"})}),w("div",{children:w(An,{name:"movesubpages",id:"movesubpages",checked:e?.movesubpages,children:"Move subpage(s) (up to 100)"})}),this.ctx.wiki.hasRight("suppressredirect")&&w("div",{children:w(An,{name:"noredirect",id:"noredirect",checked:e?.noredirect,children:"Move without leaving a redirect"})}),w(pr,{label:"Reason",id:"reason",name:"reason",value:e?.reason})]})),n.setButtons([{label:"Move",className:"is-primary is-ghost",method:()=>{r?.dispatchEvent(new Event("submit"))}}]),n.show()}async movePage(e){const{from:n,to:r,reason:i="",...s}=e;if(!n||!r)throw new Error("From and to titles are required.");if(n===r)throw new Error("From and to titles cannot be the same.");return(await this.ctx.wikiPage.newFromTitle(n)).moveTo(r,i,s)}}oo=Rm(Jl),xi=jm(oo,0,"PluginQuickMove",Ql,xi),Mm(oo,1,xi);const Fm=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickMove(){return xi}},Symbol.toStringTag,{value:"Module"}));var Bm=Object.create,ao=Object.defineProperty,Um=Object.getOwnPropertyDescriptor,Xl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Zl=t=>{throw TypeError(t)},qm=(t,e,n)=>e in t?ao(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,zm=(t,e)=>ao(t,"name",{value:e,configurable:!0}),Hm=t=>[,,,Bm(t?.[Xl("metadata")]??null)],Wm=["class","method","getter","setter","accessor","field","value","get","set"],ec=t=>t!==void 0&&typeof t!="function"?Zl("Function expected"):t,Km=(t,e,n,r,i)=>({kind:Wm[t],name:e,metadata:r,addInitializer:s=>n._?Zl("Already initialized"):i.push(ec(s||null))}),Vm=(t,e)=>qm(e,Xl("metadata"),t[3]),Ym=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Gm=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,y=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&Um(i,n));zm(i,n);for(var b=r.length-1;b>=0;b--)l=Km(c,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,ec(o)&&(i=o);return Vm(t,i),v&&ao(i,n,v),u?c^4?s:v:i},tc,lo,nc;tc=[We(["api","wikiPage","modal","preferences"]),On(fe.object({"quickPreview.keyshortcut":fe.string().default("ctrl-p").description("Key shortcut to open quick preview in quick edit modal")}).extra("category","edit").description("Quick preview options"))];class Si extends(nc=ot){constructor(e){super(e,{},"quickPreview"),this.ctx=e,this.ctx.set("quickPreview",Zs(this,"previewWikitext"))}start(){this.ctx.on("quick-edit/wiki-page",this.injectQuickEdit.bind(this)),this.ctx.on("quick-delete/wiki-page",this.injectQuickDelete.bind(this))}stop(){}previewWikitext(e,n,r,i,s){return r||(r=this.ctx.wikiPage.newBlankPage({title:"API"})),(!i||i.isDestroyed)&&(i=this.ctx.modal.createObject({className:"in-page-edit ipe-quickPreview",sizeClass:"large",center:!1,...s}).init()),i.show(),i.setTitle("Preview - Loading..."),i.setContent(w(Xt,{})),i.bringToFront(),this.ctx.emit("quick-preview/show-modal",{ctx:this.ctx,text:e,modal:i,wikiPage:r}),r.preview(e,n).then(o=>{const{data:{parse:a}}=o;i.setTitle(`Preview - ${a.title}`);let l=null;i.setContent(w("section",{children:w("div",{ref:c=>l=c,className:"mw-parser-output",innerHTML:a.text})})),window.mw?.hook("wikipage.content").fire($(l)),this.ctx.emit("quick-preview/loaded",{ctx:this.ctx,modal:i,wikiPage:r,text:e,parseData:a})}).catch(o=>{i.setTitle("Preview - Failed"),i.setContent(w(Ft,{children:[w("p",{children:"Failed to preview"}),w("p",{children:o instanceof Error?o.message:String(o)})]}))}),i}async injectQuickEdit({options:e,modal:n,wikiPage:r}){let i;n.addButton({label:"Preview",side:"left",className:"btn btn-secondary",keyPress:await this.ctx.preferences.get("quickPreview.keyshortcut.quickEdit")||void 0,method:()=>{let s=n.get$content().querySelector('textarea[name="text"]')?.value||"";if(e.section==="new"){const o=n.get$content().querySelector('input[name="summary"]')?.value;o&&(s=`==${o}==
69
+ ${s}`)}i=this.previewWikitext(s,void 0,r,i,{backdrop:!1,draggable:!0})}},1),n.on(n.Event.Close,()=>{i?.destroy(),i=void 0})}injectQuickDelete({ctx:e,modal:n,wikiPage:r}){n.addButton({label:"Preview",side:"left",className:"btn btn-secondary",method:()=>{this.logger.warn("To be implemented: preview wikitext for quick delete")}},2)}}lo=Hm(nc),Si=Gm(lo,0,"PluginQuickPreview",tc,Si),Ym(lo,1,Si);const Qm=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickPreview(){return Si}},Symbol.toStringTag,{value:"Module"}));class Ut{diff(e,n,r={}){let i;typeof r=="function"?(i=r,r={}):"callback"in r&&(i=r.callback);const s=this.castInput(e,r),o=this.castInput(n,r),a=this.removeEmpty(this.tokenize(s,r)),l=this.removeEmpty(this.tokenize(o,r));return this.diffWithOptionsObj(a,l,r,i)}diffWithOptionsObj(e,n,r,i){var s;const o=A=>{if(A=this.postProcess(A,r),i){setTimeout(function(){i(A)},0);return}else return A},a=n.length,l=e.length;let c=1,u=a+l;r.maxEditLength!=null&&(u=Math.min(u,r.maxEditLength));const f=(s=r.timeout)!==null&&s!==void 0?s:1/0,y=Date.now()+f,v=[{oldPos:-1,lastComponent:void 0}];let b=this.extractCommon(v[0],n,e,0,r);if(v[0].oldPos+1>=l&&b+1>=a)return o(this.buildValues(v[0].lastComponent,n,e));let I=-1/0,F=1/0;const O=()=>{for(let A=Math.max(I,-c);A<=Math.min(F,c);A+=2){let g;const p=v[A-1],h=v[A+1];p&&(v[A-1]=void 0);let S=!1;if(h){const N=h.oldPos-A;S=h&&0<=N&&N<a}const T=p&&p.oldPos+1<l;if(!S&&!T){v[A]=void 0;continue}if(!T||S&&p.oldPos<h.oldPos?g=this.addToPath(h,!0,!1,0,r):g=this.addToPath(p,!1,!0,1,r),b=this.extractCommon(g,n,e,A,r),g.oldPos+1>=l&&b+1>=a)return o(this.buildValues(g.lastComponent,n,e))||!0;v[A]=g,g.oldPos+1>=l&&(F=Math.min(F,A-1)),b+1>=a&&(I=Math.max(I,A+1))}c++};if(i)(function A(){setTimeout(function(){if(c>u||Date.now()>y)return i(void 0);O()||A()},0)})();else for(;c<=u&&Date.now()<=y;){const A=O();if(A)return A}}addToPath(e,n,r,i,s){const o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===n&&o.removed===r?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:n,removed:r,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:o}}}extractCommon(e,n,r,i,s){const o=n.length,a=r.length;let l=e.oldPos,c=l-i,u=0;for(;c+1<o&&l+1<a&&this.equals(r[l+1],n[c+1],s);)c++,l++,u++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!s.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const i=[];let s;for(;e;)i.push(e),s=e.previousComponent,delete e.previousComponent,e=s;i.reverse();const o=i.length;let a=0,l=0,c=0;for(;a<o;a++){const u=i[a];if(u.removed)u.value=this.join(r.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=n.slice(l,l+u.count);f=f.map(function(y,v){const b=r[c+v];return b.length>y.length?b:y}),u.value=this.join(f)}else u.value=this.join(n.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return i}}class Jm extends Ut{}const rc=new Jm;function ic(t,e,n){return rc.diff(t,e,n)}function sc(t,e){let n;for(n=0;n<t.length&&n<e.length;n++)if(t[n]!=e[n])return t.slice(0,n);return t.slice(0,n)}function oc(t,e){let n;if(!t||!e||t[t.length-1]!=e[e.length-1])return"";for(n=0;n<t.length&&n<e.length;n++)if(t[t.length-(n+1)]!=e[e.length-(n+1)])return t.slice(-n);return t.slice(-n)}function co(t,e,n){if(t.slice(0,e.length)!=e)throw Error(`string ${JSON.stringify(t)} doesn't start with prefix ${JSON.stringify(e)}; this is a bug`);return n+t.slice(e.length)}function uo(t,e,n){if(!e)return t+n;if(t.slice(-e.length)!=e)throw Error(`string ${JSON.stringify(t)} doesn't end with suffix ${JSON.stringify(e)}; this is a bug`);return t.slice(0,-e.length)+n}function gr(t,e){return co(t,e,"")}function Ei(t,e){return uo(t,e,"")}function ac(t,e){return e.slice(0,Xm(t,e))}function Xm(t,e){let n=0;t.length>e.length&&(n=t.length-e.length);let r=e.length;t.length<e.length&&(r=t.length);const i=Array(r);let s=0;i[0]=0;for(let o=1;o<r;o++){for(e[o]==e[s]?i[o]=i[s]:i[o]=s;s>0&&e[o]!=e[s];)s=i[s];e[o]==e[s]&&s++}s=0;for(let o=n;o<t.length;o++){for(;s>0&&t[o]!=e[s];)s=i[s];t[o]==e[s]&&s++}return s}function Zm(t){return t.includes(`\r
68
70
  `)&&!t.startsWith(`
69
71
  `)&&!t.match(/[^\r]\n/)}function eg(t){return!t.includes(`\r
70
72
  `)&&t.includes(`
71
- `)}function vr(t){let e;for(e=t.length-1;e>=0&&t[e].match(/\s/);e--);return t.substring(e+1)}function Zt(t){const e=t.match(/^\s*/);return e?e[0]:""}const Ei="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",tg=new RegExp(`[${Ei}]+|\\s+|[^${Ei}]`,"ug");class ng extends Ut{equals(e,n,r){return r.ignoreCase&&(e=e.toLowerCase(),n=n.toLowerCase()),e.trim()===n.trim()}tokenize(e,n={}){let r;if(n.intlSegmenter){const o=n.intlSegmenter;if(o.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=Array.from(o.segment(e),a=>a.segment)}else r=e.match(tg)||[];const i=[];let s=null;return r.forEach(o=>{/\s/.test(o)?s==null?i.push(o):i.push(i.pop()+o):s!=null&&/\s/.test(s)?i[i.length-1]==s?i.push(i.pop()+o):i.push(s+o):i.push(o),s=o}),i}join(e){return e.map((n,r)=>r==0?n:n.replace(/^\s+/,"")).join("")}postProcess(e,n){if(!e||n.oneChangePerToken)return e;let r=null,i=null,s=null;return e.forEach(o=>{o.added?i=o:o.removed?s=o:((i||s)&&uc(r,s,i,o),r=o,i=null,s=null)}),(i||s)&&uc(r,s,i,null),e}}const lc=new ng;function cc(t,e,n){return n?.ignoreWhitespace!=null&&!n.ignoreWhitespace?fo(t,e,n):lc.diff(t,e,n)}function uc(t,e,n,r){if(e&&n){const i=Zt(e.value),s=vr(e.value),o=Zt(n.value),a=vr(n.value);if(t){const l=sc(i,o);t.value=uo(t.value,o,l),e.value=gr(e.value,l),n.value=gr(n.value,l)}if(r){const l=oc(s,a);r.value=co(r.value,a,l),e.value=Si(e.value,l),n.value=Si(n.value,l)}}else if(n){if(t){const i=Zt(n.value);n.value=n.value.substring(i.length)}if(r){const i=Zt(r.value);r.value=r.value.substring(i.length)}}else if(t&&r){const i=Zt(r.value),s=Zt(e.value),o=vr(e.value),a=sc(i,s);e.value=gr(e.value,a);const l=oc(gr(i,a),o);e.value=Si(e.value,l),r.value=co(r.value,i,l),t.value=uo(t.value,i,i.slice(0,i.length-l.length))}else if(r){const i=Zt(r.value),s=vr(e.value),o=ac(s,i);e.value=Si(e.value,o)}else if(t){const i=vr(t.value),s=Zt(e.value),o=ac(i,s);e.value=gr(e.value,o)}}class rg extends Ut{tokenize(e){const n=new RegExp(`(\\r?\\n)|[${Ei}]+|[^\\S\\n\\r]+|[^${Ei}]`,"ug");return e.match(n)||[]}}const fc=new rg;function fo(t,e,n){return fc.diff(t,e,n)}function ig(t,e){if(typeof t=="function")e.callback=t;else if(t)for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}class sg extends Ut{constructor(){super(...arguments),this.tokenize=hc}equals(e,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!e.includes(`
73
+ `)}function vr(t){let e;for(e=t.length-1;e>=0&&t[e].match(/\s/);e--);return t.substring(e+1)}function Zt(t){const e=t.match(/^\s*/);return e?e[0]:""}const ki="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",tg=new RegExp(`[${ki}]+|\\s+|[^${ki}]`,"ug");class ng extends Ut{equals(e,n,r){return r.ignoreCase&&(e=e.toLowerCase(),n=n.toLowerCase()),e.trim()===n.trim()}tokenize(e,n={}){let r;if(n.intlSegmenter){const o=n.intlSegmenter;if(o.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=Array.from(o.segment(e),a=>a.segment)}else r=e.match(tg)||[];const i=[];let s=null;return r.forEach(o=>{/\s/.test(o)?s==null?i.push(o):i.push(i.pop()+o):s!=null&&/\s/.test(s)?i[i.length-1]==s?i.push(i.pop()+o):i.push(s+o):i.push(o),s=o}),i}join(e){return e.map((n,r)=>r==0?n:n.replace(/^\s+/,"")).join("")}postProcess(e,n){if(!e||n.oneChangePerToken)return e;let r=null,i=null,s=null;return e.forEach(o=>{o.added?i=o:o.removed?s=o:((i||s)&&uc(r,s,i,o),r=o,i=null,s=null)}),(i||s)&&uc(r,s,i,null),e}}const lc=new ng;function cc(t,e,n){return n?.ignoreWhitespace!=null&&!n.ignoreWhitespace?fo(t,e,n):lc.diff(t,e,n)}function uc(t,e,n,r){if(e&&n){const i=Zt(e.value),s=vr(e.value),o=Zt(n.value),a=vr(n.value);if(t){const l=sc(i,o);t.value=uo(t.value,o,l),e.value=gr(e.value,l),n.value=gr(n.value,l)}if(r){const l=oc(s,a);r.value=co(r.value,a,l),e.value=Ei(e.value,l),n.value=Ei(n.value,l)}}else if(n){if(t){const i=Zt(n.value);n.value=n.value.substring(i.length)}if(r){const i=Zt(r.value);r.value=r.value.substring(i.length)}}else if(t&&r){const i=Zt(r.value),s=Zt(e.value),o=vr(e.value),a=sc(i,s);e.value=gr(e.value,a);const l=oc(gr(i,a),o);e.value=Ei(e.value,l),r.value=co(r.value,i,l),t.value=uo(t.value,i,i.slice(0,i.length-l.length))}else if(r){const i=Zt(r.value),s=vr(e.value),o=ac(s,i);e.value=Ei(e.value,o)}else if(t){const i=vr(t.value),s=Zt(e.value),o=ac(i,s);e.value=gr(e.value,o)}}class rg extends Ut{tokenize(e){const n=new RegExp(`(\\r?\\n)|[${ki}]+|[^\\S\\n\\r]+|[^${ki}]`,"ug");return e.match(n)||[]}}const fc=new rg;function fo(t,e,n){return fc.diff(t,e,n)}function ig(t,e){if(typeof t=="function")e.callback=t;else if(t)for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}class sg extends Ut{constructor(){super(...arguments),this.tokenize=hc}equals(e,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!e.includes(`
72
74
  `))&&(e=e.trim()),(!r.newlineIsToken||!n.includes(`
73
75
  `))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(e.endsWith(`
74
76
  `)&&(e=e.slice(0,-1)),n.endsWith(`
75
- `)&&(n=n.slice(0,-1))),super.equals(e,n,r)}}const ho=new sg;function ki(t,e,n){return ho.diff(t,e,n)}function dc(t,e,n){return n=ig(n,{ignoreWhitespace:!0}),ho.diff(t,e,n)}function hc(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
76
- `));const n=[],r=t.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let i=0;i<r.length;i++){const s=r[i];i%2&&!e.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}function og(t){return t=="."||t=="!"||t=="?"}class ag extends Ut{tokenize(e){var n;const r=[];let i=0;for(let s=0;s<e.length;s++){if(s==e.length-1){r.push(e.slice(i));break}if(og(e[s])&&e[s+1].match(/\s/)){for(r.push(e.slice(i,s+1)),s=i=s+1;!((n=e[s+1])===null||n===void 0)&&n.match(/\s/);)s++;r.push(e.slice(i,s+1)),i=s+1}}return r}}const pc=new ag;function mc(t,e,n){return pc.diff(t,e,n)}class lg extends Ut{tokenize(e){return e.split(/([{}:;,]|\s+)/)}}const gc=new lg;function vc(t,e,n){return gc.diff(t,e,n)}class cg extends Ut{constructor(){super(...arguments),this.tokenize=hc}get useLongestToken(){return!0}castInput(e,n){const{undefinedReplacement:r,stringifyReplacer:i=(s,o)=>typeof o>"u"?r:o}=n;return typeof e=="string"?e:JSON.stringify(Pi(e,null,null,i),null," ")}equals(e,n,r){return super.equals(e.replace(/,([\r\n])/g,"$1"),n.replace(/,([\r\n])/g,"$1"),r)}}const yc=new cg;function bc(t,e,n){return yc.diff(t,e,n)}function Pi(t,e,n,r,i){e=e||[],n=n||[],r&&(t=r(i===void 0?"":i,t));let s;for(s=0;s<e.length;s+=1)if(e[s]===t)return n[s];let o;if(Object.prototype.toString.call(t)==="[object Array]"){for(e.push(t),o=new Array(t.length),n.push(o),s=0;s<t.length;s+=1)o[s]=Pi(t[s],e,n,r,String(s));return e.pop(),n.pop(),o}if(t&&t.toJSON&&(t=t.toJSON()),typeof t=="object"&&t!==null){e.push(t),o={},n.push(o);const a=[];let l;for(l in t)Object.prototype.hasOwnProperty.call(t,l)&&a.push(l);for(a.sort(),s=0;s<a.length;s+=1)l=a[s],o[l]=Pi(t[l],e,n,r,l);e.pop(),n.pop()}else o=t;return o}class ug extends Ut{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}}const wc=new ug;function _c(t,e,n){return wc.diff(t,e,n)}function xc(t){return Array.isArray(t)?t.map(e=>xc(e)):Object.assign(Object.assign({},t),{hunks:t.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map((n,r)=>{var i;return n.startsWith("\\")||n.endsWith("\r")||!((i=e.lines[r+1])===null||i===void 0)&&i.startsWith("\\")?n:n+"\r"})}))})}function Sc(t){return Array.isArray(t)?t.map(e=>Sc(e)):Object.assign(Object.assign({},t),{hunks:t.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map(n=>n.endsWith("\r")?n.substring(0,n.length-1):n)}))})}function fg(t){return Array.isArray(t)||(t=[t]),!t.some(e=>e.hunks.some(n=>n.lines.some(r=>!r.startsWith("\\")&&r.endsWith("\r"))))}function dg(t){return Array.isArray(t)||(t=[t]),t.some(e=>e.hunks.some(n=>n.lines.some(r=>r.endsWith("\r"))))&&t.every(e=>e.hunks.every(n=>n.lines.every((r,i)=>{var s;return r.startsWith("\\")||r.endsWith("\r")||((s=n.lines[i+1])===null||s===void 0?void 0:s.startsWith("\\"))})))}function po(t){const e=t.split(/\n/),n=[];let r=0;function i(){const a={};for(n.push(a);r<e.length;){const l=e[r];if(/^(---|\+\+\+|@@)\s/.test(l))break;const c=/^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(l);c&&(a.index=c[1]),r++}for(s(a),s(a),a.hunks=[];r<e.length;){const l=e[r];if(/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(l))break;if(/^@@/.test(l))a.hunks.push(o());else{if(l)throw new Error("Unknown line "+(r+1)+" "+JSON.stringify(l));r++}}}function s(a){const l=/^(---|\+\+\+)\s+(.*)\r?$/.exec(e[r]);if(l){const c=l[2].split(" ",2),u=(c[1]||"").trim();let f=c[0].replace(/\\\\/g,"\\");/^".*"$/.test(f)&&(f=f.substr(1,f.length-2)),l[1]==="---"?(a.oldFileName=f,a.oldHeader=u):(a.newFileName=f,a.newHeader=u),r++}}function o(){var a;const l=r,c=e[r++],u=c.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),f={oldStart:+u[1],oldLines:typeof u[2]>"u"?1:+u[2],newStart:+u[3],newLines:typeof u[4]>"u"?1:+u[4],lines:[]};f.oldLines===0&&(f.oldStart+=1),f.newLines===0&&(f.newStart+=1);let p=0,v=0;for(;r<e.length&&(v<f.oldLines||p<f.newLines||!((a=e[r])===null||a===void 0)&&a.startsWith("\\"));r++){const b=e[r].length==0&&r!=e.length-1?" ":e[r][0];if(b==="+"||b==="-"||b===" "||b==="\\")f.lines.push(e[r]),b==="+"?p++:b==="-"?v++:b===" "&&(p++,v++);else throw new Error(`Hunk at line ${l+1} contained invalid line ${e[r]}`)}if(!p&&f.newLines===1&&(f.newLines=0),!v&&f.oldLines===1&&(f.oldLines=0),p!==f.newLines)throw new Error("Added line count did not match for hunk at line "+(l+1));if(v!==f.oldLines)throw new Error("Removed line count did not match for hunk at line "+(l+1));return f}for(;r<e.length;)i();return n}function hg(t,e,n){let r=!0,i=!1,s=!1,o=1;return function a(){if(r&&!s){if(i?o++:r=!1,t+o<=n)return t+o;s=!0}if(!i)return s||(r=!0),e<=t-o?t-o++:(i=!0,a())}}function Ec(t,e,n={}){let r;if(typeof e=="string"?r=po(e):Array.isArray(e)?r=e:r=[e],r.length>1)throw new Error("applyPatch only works with a single input.");return pg(t,r[0],n)}function pg(t,e,n={}){(n.autoConvertLineEndings||n.autoConvertLineEndings==null)&&(Zm(t)&&fg(e)?e=xc(e):eg(t)&&dg(e)&&(e=Sc(e)));const r=t.split(`
77
- `),i=e.hunks,s=n.compareLine||((b,I,B,D)=>I===D),o=n.fuzzFactor||0;let a=0;if(o<0||!Number.isInteger(o))throw new Error("fuzzFactor must be a non-negative integer");if(!i.length)return t;let l="",c=!1,u=!1;for(let b=0;b<i[i.length-1].lines.length;b++){const I=i[i.length-1].lines[b];I[0]=="\\"&&(l[0]=="+"?c=!0:l[0]=="-"&&(u=!0)),l=I}if(c){if(u){if(!o&&r[r.length-1]=="")return!1}else if(r[r.length-1]=="")r.pop();else if(!o)return!1}else if(u){if(r[r.length-1]!="")r.push("");else if(!o)return!1}function f(b,I,B,D=0,A=!0,y=[],m=0){let h=0,S=!1;for(;D<b.length;D++){const T=b[D],R=T.length>0?T[0]:" ",H=T.length>0?T.substr(1):T;if(R==="-")if(s(I+1,r[I],R,H))I++,h=0;else return!B||r[I]==null?null:(y[m]=r[I],f(b,I+1,B-1,D,!1,y,m+1));if(R==="+"){if(!A)return null;y[m]=H,m++,h=0,S=!0}if(R===" ")if(h++,y[m]=r[I],s(I+1,r[I],R,H))m++,A=!0,S=!1,I++;else return S||!B?null:r[I]&&(f(b,I+1,B-1,D+1,!1,y,m+1)||f(b,I+1,B-1,D,!1,y,m+1))||f(b,I,B-1,D+1,!1,y,m)}return m-=h,I-=h,y.length=m,{patchedLines:y,oldLineLastI:I-1}}const p=[];let v=0;for(let b=0;b<i.length;b++){const I=i[b];let B;const D=r.length-I.oldLines+o;let A;for(let y=0;y<=o;y++){A=I.oldStart+v-1;const m=hg(A,a,D);for(;A!==void 0&&(B=f(I.lines,A,y),!B);A=m());if(B)break}if(!B)return!1;for(let y=a;y<A;y++)p.push(r[y]);for(let y=0;y<B.patchedLines.length;y++){const m=B.patchedLines[y];p.push(m)}a=B.oldLineLastI+1,v=A+1-I.oldStart}for(let b=a;b<r.length;b++)p.push(r[b]);return p.join(`
78
- `)}function mg(t,e){const n=typeof t=="string"?po(t):t;let r=0;function i(){const s=n[r++];if(!s)return e.complete();e.loadFile(s,function(o,a){if(o)return e.complete(o);const l=Ec(a,s,e);e.patched(s,l,function(c){if(c)return e.complete(c);i()})})}i()}function kc(t){return Array.isArray(t)?t.map(e=>kc(e)).reverse():Object.assign(Object.assign({},t),{oldFileName:t.newFileName,oldHeader:t.newHeader,newFileName:t.oldFileName,newHeader:t.oldHeader,hunks:t.hunks.map(e=>({oldLines:e.newLines,oldStart:e.newStart,newLines:e.oldLines,newStart:e.oldStart,lines:e.lines.map(n=>n.startsWith("-")?`+${n.slice(1)}`:n.startsWith("+")?`-${n.slice(1)}`:n)}))})}function mo(t,e,n,r,i,s,o){let a;o?typeof o=="function"?a={callback:o}:a=o:a={},typeof a.context>"u"&&(a.context=4);const l=a.context;if(a.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(a.callback){const{callback:u}=a;ki(n,r,Object.assign(Object.assign({},a),{callback:f=>{const p=c(f);u(p)}}))}else return c(ki(n,r,a));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(A){return A.map(function(y){return" "+y})}const p=[];let v=0,b=0,I=[],B=1,D=1;for(let A=0;A<u.length;A++){const y=u[A],m=y.lines||vg(y.value);if(y.lines=m,y.added||y.removed){if(!v){const h=u[A-1];v=B,b=D,h&&(I=l>0?f(h.lines.slice(-l)):[],v-=I.length,b-=I.length)}for(const h of m)I.push((y.added?"+":"-")+h);y.added?D+=m.length:B+=m.length}else{if(v)if(m.length<=l*2&&A<u.length-2)for(const h of f(m))I.push(h);else{const h=Math.min(m.length,l);for(const T of f(m.slice(0,h)))I.push(T);const S={oldStart:v,oldLines:B-v+h,newStart:b,newLines:D-b+h,lines:I};p.push(S),v=0,b=0,I=[]}B+=m.length,D+=m.length}}for(const A of p)for(let y=0;y<A.lines.length;y++)A.lines[y].endsWith(`
79
- `)?A.lines[y]=A.lines[y].slice(0,-1):(A.lines.splice(y+1,0,"\"),y++);return{oldFileName:t,newFileName:e,oldHeader:i,newHeader:s,hunks:p}}}function $i(t){if(Array.isArray(t))return t.map($i).join(`
77
+ `)&&(n=n.slice(0,-1))),super.equals(e,n,r)}}const ho=new sg;function Pi(t,e,n){return ho.diff(t,e,n)}function dc(t,e,n){return n=ig(n,{ignoreWhitespace:!0}),ho.diff(t,e,n)}function hc(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
78
+ `));const n=[],r=t.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let i=0;i<r.length;i++){const s=r[i];i%2&&!e.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}function og(t){return t=="."||t=="!"||t=="?"}class ag extends Ut{tokenize(e){var n;const r=[];let i=0;for(let s=0;s<e.length;s++){if(s==e.length-1){r.push(e.slice(i));break}if(og(e[s])&&e[s+1].match(/\s/)){for(r.push(e.slice(i,s+1)),s=i=s+1;!((n=e[s+1])===null||n===void 0)&&n.match(/\s/);)s++;r.push(e.slice(i,s+1)),i=s+1}}return r}}const pc=new ag;function mc(t,e,n){return pc.diff(t,e,n)}class lg extends Ut{tokenize(e){return e.split(/([{}:;,]|\s+)/)}}const gc=new lg;function vc(t,e,n){return gc.diff(t,e,n)}class cg extends Ut{constructor(){super(...arguments),this.tokenize=hc}get useLongestToken(){return!0}castInput(e,n){const{undefinedReplacement:r,stringifyReplacer:i=(s,o)=>typeof o>"u"?r:o}=n;return typeof e=="string"?e:JSON.stringify($i(e,null,null,i),null," ")}equals(e,n,r){return super.equals(e.replace(/,([\r\n])/g,"$1"),n.replace(/,([\r\n])/g,"$1"),r)}}const yc=new cg;function bc(t,e,n){return yc.diff(t,e,n)}function $i(t,e,n,r,i){e=e||[],n=n||[],r&&(t=r(i===void 0?"":i,t));let s;for(s=0;s<e.length;s+=1)if(e[s]===t)return n[s];let o;if(Object.prototype.toString.call(t)==="[object Array]"){for(e.push(t),o=new Array(t.length),n.push(o),s=0;s<t.length;s+=1)o[s]=$i(t[s],e,n,r,String(s));return e.pop(),n.pop(),o}if(t&&t.toJSON&&(t=t.toJSON()),typeof t=="object"&&t!==null){e.push(t),o={},n.push(o);const a=[];let l;for(l in t)Object.prototype.hasOwnProperty.call(t,l)&&a.push(l);for(a.sort(),s=0;s<a.length;s+=1)l=a[s],o[l]=$i(t[l],e,n,r,l);e.pop(),n.pop()}else o=t;return o}class ug extends Ut{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}}const wc=new ug;function _c(t,e,n){return wc.diff(t,e,n)}function xc(t){return Array.isArray(t)?t.map(e=>xc(e)):Object.assign(Object.assign({},t),{hunks:t.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map((n,r)=>{var i;return n.startsWith("\\")||n.endsWith("\r")||!((i=e.lines[r+1])===null||i===void 0)&&i.startsWith("\\")?n:n+"\r"})}))})}function Sc(t){return Array.isArray(t)?t.map(e=>Sc(e)):Object.assign(Object.assign({},t),{hunks:t.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map(n=>n.endsWith("\r")?n.substring(0,n.length-1):n)}))})}function fg(t){return Array.isArray(t)||(t=[t]),!t.some(e=>e.hunks.some(n=>n.lines.some(r=>!r.startsWith("\\")&&r.endsWith("\r"))))}function dg(t){return Array.isArray(t)||(t=[t]),t.some(e=>e.hunks.some(n=>n.lines.some(r=>r.endsWith("\r"))))&&t.every(e=>e.hunks.every(n=>n.lines.every((r,i)=>{var s;return r.startsWith("\\")||r.endsWith("\r")||((s=n.lines[i+1])===null||s===void 0?void 0:s.startsWith("\\"))})))}function po(t){const e=t.split(/\n/),n=[];let r=0;function i(){const a={};for(n.push(a);r<e.length;){const l=e[r];if(/^(---|\+\+\+|@@)\s/.test(l))break;const c=/^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(l);c&&(a.index=c[1]),r++}for(s(a),s(a),a.hunks=[];r<e.length;){const l=e[r];if(/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(l))break;if(/^@@/.test(l))a.hunks.push(o());else{if(l)throw new Error("Unknown line "+(r+1)+" "+JSON.stringify(l));r++}}}function s(a){const l=/^(---|\+\+\+)\s+(.*)\r?$/.exec(e[r]);if(l){const c=l[2].split(" ",2),u=(c[1]||"").trim();let f=c[0].replace(/\\\\/g,"\\");/^".*"$/.test(f)&&(f=f.substr(1,f.length-2)),l[1]==="---"?(a.oldFileName=f,a.oldHeader=u):(a.newFileName=f,a.newHeader=u),r++}}function o(){var a;const l=r,c=e[r++],u=c.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),f={oldStart:+u[1],oldLines:typeof u[2]>"u"?1:+u[2],newStart:+u[3],newLines:typeof u[4]>"u"?1:+u[4],lines:[]};f.oldLines===0&&(f.oldStart+=1),f.newLines===0&&(f.newStart+=1);let y=0,v=0;for(;r<e.length&&(v<f.oldLines||y<f.newLines||!((a=e[r])===null||a===void 0)&&a.startsWith("\\"));r++){const b=e[r].length==0&&r!=e.length-1?" ":e[r][0];if(b==="+"||b==="-"||b===" "||b==="\\")f.lines.push(e[r]),b==="+"?y++:b==="-"?v++:b===" "&&(y++,v++);else throw new Error(`Hunk at line ${l+1} contained invalid line ${e[r]}`)}if(!y&&f.newLines===1&&(f.newLines=0),!v&&f.oldLines===1&&(f.oldLines=0),y!==f.newLines)throw new Error("Added line count did not match for hunk at line "+(l+1));if(v!==f.oldLines)throw new Error("Removed line count did not match for hunk at line "+(l+1));return f}for(;r<e.length;)i();return n}function hg(t,e,n){let r=!0,i=!1,s=!1,o=1;return function a(){if(r&&!s){if(i?o++:r=!1,t+o<=n)return t+o;s=!0}if(!i)return s||(r=!0),e<=t-o?t-o++:(i=!0,a())}}function Ec(t,e,n={}){let r;if(typeof e=="string"?r=po(e):Array.isArray(e)?r=e:r=[e],r.length>1)throw new Error("applyPatch only works with a single input.");return pg(t,r[0],n)}function pg(t,e,n={}){(n.autoConvertLineEndings||n.autoConvertLineEndings==null)&&(Zm(t)&&fg(e)?e=xc(e):eg(t)&&dg(e)&&(e=Sc(e)));const r=t.split(`
79
+ `),i=e.hunks,s=n.compareLine||((b,I,F,O)=>I===O),o=n.fuzzFactor||0;let a=0;if(o<0||!Number.isInteger(o))throw new Error("fuzzFactor must be a non-negative integer");if(!i.length)return t;let l="",c=!1,u=!1;for(let b=0;b<i[i.length-1].lines.length;b++){const I=i[i.length-1].lines[b];I[0]=="\\"&&(l[0]=="+"?c=!0:l[0]=="-"&&(u=!0)),l=I}if(c){if(u){if(!o&&r[r.length-1]=="")return!1}else if(r[r.length-1]=="")r.pop();else if(!o)return!1}else if(u){if(r[r.length-1]!="")r.push("");else if(!o)return!1}function f(b,I,F,O=0,A=!0,g=[],p=0){let h=0,S=!1;for(;O<b.length;O++){const T=b[O],N=T.length>0?T[0]:" ",H=T.length>0?T.substr(1):T;if(N==="-")if(s(I+1,r[I],N,H))I++,h=0;else return!F||r[I]==null?null:(g[p]=r[I],f(b,I+1,F-1,O,!1,g,p+1));if(N==="+"){if(!A)return null;g[p]=H,p++,h=0,S=!0}if(N===" ")if(h++,g[p]=r[I],s(I+1,r[I],N,H))p++,A=!0,S=!1,I++;else return S||!F?null:r[I]&&(f(b,I+1,F-1,O+1,!1,g,p+1)||f(b,I+1,F-1,O,!1,g,p+1))||f(b,I,F-1,O+1,!1,g,p)}return p-=h,I-=h,g.length=p,{patchedLines:g,oldLineLastI:I-1}}const y=[];let v=0;for(let b=0;b<i.length;b++){const I=i[b];let F;const O=r.length-I.oldLines+o;let A;for(let g=0;g<=o;g++){A=I.oldStart+v-1;const p=hg(A,a,O);for(;A!==void 0&&(F=f(I.lines,A,g),!F);A=p());if(F)break}if(!F)return!1;for(let g=a;g<A;g++)y.push(r[g]);for(let g=0;g<F.patchedLines.length;g++){const p=F.patchedLines[g];y.push(p)}a=F.oldLineLastI+1,v=A+1-I.oldStart}for(let b=a;b<r.length;b++)y.push(r[b]);return y.join(`
80
+ `)}function mg(t,e){const n=typeof t=="string"?po(t):t;let r=0;function i(){const s=n[r++];if(!s)return e.complete();e.loadFile(s,function(o,a){if(o)return e.complete(o);const l=Ec(a,s,e);e.patched(s,l,function(c){if(c)return e.complete(c);i()})})}i()}function kc(t){return Array.isArray(t)?t.map(e=>kc(e)).reverse():Object.assign(Object.assign({},t),{oldFileName:t.newFileName,oldHeader:t.newHeader,newFileName:t.oldFileName,newHeader:t.oldHeader,hunks:t.hunks.map(e=>({oldLines:e.newLines,oldStart:e.newStart,newLines:e.oldLines,newStart:e.oldStart,lines:e.lines.map(n=>n.startsWith("-")?`+${n.slice(1)}`:n.startsWith("+")?`-${n.slice(1)}`:n)}))})}function mo(t,e,n,r,i,s,o){let a;o?typeof o=="function"?a={callback:o}:a=o:a={},typeof a.context>"u"&&(a.context=4);const l=a.context;if(a.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(a.callback){const{callback:u}=a;Pi(n,r,Object.assign(Object.assign({},a),{callback:f=>{const y=c(f);u(y)}}))}else return c(Pi(n,r,a));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(A){return A.map(function(g){return" "+g})}const y=[];let v=0,b=0,I=[],F=1,O=1;for(let A=0;A<u.length;A++){const g=u[A],p=g.lines||vg(g.value);if(g.lines=p,g.added||g.removed){if(!v){const h=u[A-1];v=F,b=O,h&&(I=l>0?f(h.lines.slice(-l)):[],v-=I.length,b-=I.length)}for(const h of p)I.push((g.added?"+":"-")+h);g.added?O+=p.length:F+=p.length}else{if(v)if(p.length<=l*2&&A<u.length-2)for(const h of f(p))I.push(h);else{const h=Math.min(p.length,l);for(const T of f(p.slice(0,h)))I.push(T);const S={oldStart:v,oldLines:F-v+h,newStart:b,newLines:O-b+h,lines:I};y.push(S),v=0,b=0,I=[]}F+=p.length,O+=p.length}}for(const A of y)for(let g=0;g<A.lines.length;g++)A.lines[g].endsWith(`
81
+ `)?A.lines[g]=A.lines[g].slice(0,-1):(A.lines.splice(g+1,0,"\"),g++);return{oldFileName:t,newFileName:e,oldHeader:i,newHeader:s,hunks:y}}}function Ci(t){if(Array.isArray(t))return t.map(Ci).join(`
80
82
  `);const e=[];t.oldFileName==t.newFileName&&e.push("Index: "+t.oldFileName),e.push("==================================================================="),e.push("--- "+t.oldFileName+(typeof t.oldHeader>"u"?"":" "+t.oldHeader)),e.push("+++ "+t.newFileName+(typeof t.newHeader>"u"?"":" "+t.newHeader));for(let n=0;n<t.hunks.length;n++){const r=t.hunks[n];r.oldLines===0&&(r.oldStart-=1),r.newLines===0&&(r.newStart-=1),e.push("@@ -"+r.oldStart+","+r.oldLines+" +"+r.newStart+","+r.newLines+" @@");for(const i of r.lines)e.push(i)}return e.join(`
81
83
  `)+`
82
- `}function go(t,e,n,r,i,s,o){if(typeof o=="function"&&(o={callback:o}),o?.callback){const{callback:a}=o;mo(t,e,n,r,i,s,Object.assign(Object.assign({},o),{callback:l=>{a(l?$i(l):void 0)}}))}else{const a=mo(t,e,n,r,i,s,o);return a?$i(a):void 0}}function gg(t,e,n,r,i,s){return go(t,t,e,n,r,i,s)}function vg(t){const e=t.endsWith(`
84
+ `}function go(t,e,n,r,i,s,o){if(typeof o=="function"&&(o={callback:o}),o?.callback){const{callback:a}=o;mo(t,e,n,r,i,s,Object.assign(Object.assign({},o),{callback:l=>{a(l?Ci(l):void 0)}}))}else{const a=mo(t,e,n,r,i,s,o);return a?Ci(a):void 0}}function gg(t,e,n,r,i,s){return go(t,t,e,n,r,i,s)}function vg(t){const e=t.endsWith(`
83
85
  `),n=t.split(`
84
86
  `).map(r=>r+`
85
- `);return e?n.pop():n.push(n.pop().slice(0,-1)),n}function yg(t){const e=[];let n,r;for(let i=0;i<t.length;i++)n=t[i],n.added?r=1:n.removed?r=-1:r=0,e.push([r,n.value]);return e}function bg(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n];r.added?e.push("<ins>"):r.removed&&e.push("<del>"),e.push(wg(r.value)),r.added?e.push("</ins>"):r.removed&&e.push("</del>")}return e.join("")}function wg(t){let e=t;return e=e.replace(/&/g,"&amp;"),e=e.replace(/</g,"&lt;"),e=e.replace(/>/g,"&gt;"),e=e.replace(/"/g,"&quot;"),e}const _g=Object.freeze(Object.defineProperty({__proto__:null,Diff:Ut,applyPatch:Ec,applyPatches:mg,arrayDiff:wc,canonicalize:Pi,characterDiff:rc,convertChangesToDMP:yg,convertChangesToXML:bg,createPatch:gg,createTwoFilesPatch:go,cssDiff:gc,diffArrays:_c,diffChars:ic,diffCss:vc,diffJson:bc,diffLines:ki,diffSentences:mc,diffTrimmedLines:dc,diffWords:cc,diffWordsWithSpace:fo,formatPatch:$i,jsonDiff:yc,lineDiff:ho,parsePatch:po,reversePatch:kc,sentenceDiff:pc,structuredPatch:mo,wordDiff:lc,wordsWithSpaceDiff:fc},Symbol.toStringTag,{value:"Module"}));class xg{constructor(e){this.ctx=e,this.JsDiff=_g,this.diffChars=ic,this.diffWords=cc,this.diffWordsWithSpace=fo,this.diffLines=ki,this.diffTrimmedLines=dc,this.diffSentences=mc,this.diffCss=vc,this.diffJson=bc,this.diffArrays=_c,this.createTwoFilesPatch=go,this.ctx.set("jsdiff",this)}}const Sg={"diff-container":"_diff-container_lq0si_2"},Eg=t=>{let{user:e,target:n,ctx:r}=t;const i=r.getUrl.bind(r);return w("span",{className:"mw-userlinks",children:[w("a",{href:i(`User:${e}`),className:"mw-userlink",target:n,children:e})," ",w("span",{className:"mw-usertoollinks",children:["(",w("a",{href:i(`User_talk:${e}`),className:"mw-usertoollinks-talk",target:n,children:"talk"})," | ",w("a",{href:i(`Special:Contributions/${e}`),className:"mw-usertoollinks-contribs",target:n,children:"contribs"})," | ",w("a",{href:i(`Special:Block/${e}`),className:"mw-usertoollinks-block",target:n,children:"block"}),")"]})]})};var Ci=(t=>(t.update="ipe:diff-table/update",t.edit="ipe:diff-table/edit",t))(Ci||{});const kg=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}).format,Pc=t=>{let e=["diff-title"];if(t.type==="from"?e.push("diff-otitle"):t.type==="to"&&e.push("diff-ntitle"),!t.pageid||!t.userid)return w("td",{colSpan:2,className:e,children:w("div",{className:"mw-diff-title--title",children:t.type==="from"?"Original content":t.type==="to"?"Your content":""})});const n=r=>{r.preventDefault(),r.target.dispatchEvent(new CustomEvent("ipe:diff-table/edit",{detail:{revid:t.revid},bubbles:!0}))};return w("td",{colSpan:2,className:e,children:[w("div",{className:"mw-diff-title--title",children:[t.pagetitle||t.timestamp,t.revid?` (rev#${t.revid})`:""]}),w("div",{className:"mw-diff-title--actions",children:w("a",{href:t.ctx.getUrl("",{action:"edit",oldid:t.revid}),onClick:n,children:[w(El,{style:"width: 1em; height: 1em"}),"Quick edit"]})}),w("div",{className:"mw-diff-title--user",children:t.username&&w(Eg,{ctx:t.ctx,user:t.username,target:"_blank"})}),w("div",{className:"mw-diff-title--timestamp",children:t.timestamp&&kg(new Date(t.timestamp))}),w("div",{className:"mw-diff-title--comment",children:t.parsedcomment&&w(Ft,{children:["(",w("i",{innerHTML:t.parsedcomment}),")"]})})]})},Pg=t=>{const e=t.data;if(!e.prev&&!e.next)return null;const n=(r,i,s)=>{r.preventDefault(),r.target.dispatchEvent(new CustomEvent("ipe:diff-table/update",{detail:{fromrev:i,torev:s},bubbles:!0}))};return w("tr",{className:"mw-diff-title--navigation",children:[w("td",{colSpan:2,children:e.prev?w("a",{href:t.ctx.getUrl("",{diff:e.prev,oldid:e.fromrevid}),onClick:r=>n(r,e.prev,e.fromrevid),children:"← Previous"}):w("i",{children:"Oldest version"})}),w("td",{colSpan:2,children:e.next?w("a",{href:t.ctx.getUrl("",{diff:e.next,oldid:e.torevid}),onClick:r=>n(r,e.torevid,e.next),children:"Next →"}):w("i",{children:"Newest version"})})]})},$g=t=>{const{data:e,...n}=t,r=w("table",{className:"theme-ipe diff diff-type-table","data-mw":"interface",...n,children:[w("colgroup",{children:[w("col",{className:"diff-marker"}),w("col",{className:"diff-content"}),w("col",{className:"diff-marker"}),w("col",{className:"diff-content"})]}),w("tbody",{children:[w("tr",{children:[w(Pc,{ctx:t.ctx,type:"from",pageid:e.fromid,pagetitle:e.fromtitle,revid:e.fromrevid,size:e.fromsize,timestamp:e.fromtimestamp,username:e.fromuser,userid:e.fromuserid,comment:e.fromcomment,parsedcomment:e.fromparsedcomment}),w(Pc,{ctx:t.ctx,type:"to",pageid:e.toid,pagetitle:e.totitle,revid:e.torevid,size:e.tosize,timestamp:e.totimestamp,username:e.touser,userid:e.touserid,comment:e.tocomment,parsedcomment:e.toparsedcomment})]}),w(Pg,{data:e,ctx:t.ctx}),w("div",{id:"diffbody"}),w("tr",{className:"diff-size",style:{textAlign:"center"},children:[w("td",{colSpan:2,className:"diff-size-old",children:e.fromsize!==void 0&&`${e.fromsize} bytes`}),w("td",{colSpan:2,className:"diff-size-new",children:e.tosize!==void 0&&`${e.tosize} bytes`})]})]})]});return r.querySelector("#diffbody").outerHTML=e.body||w("tr",{children:w("td",{colSpan:4,children:w("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"5rem"},children:w("i",{children:"No changes"})})})}).outerHTML,r},Cg=(t,e=document)=>e.querySelector(t),Tg=(t,e=document)=>e.querySelectorAll(t);var Ig=Object.create,vo=Object.defineProperty,Ag=Object.getOwnPropertyDescriptor,$c=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Cc=t=>{throw TypeError(t)},Og=(t,e,n)=>e in t?vo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Rg=(t,e)=>vo(t,"name",{value:e,configurable:!0}),Ng=t=>[,,,Ig(t?.[$c("metadata")]??null)],Dg=["class","method","getter","setter","accessor","field","value","get","set"],Tc=t=>t!==void 0&&typeof t!="function"?Cc("Function expected"):t,Lg=(t,e,n,r,i)=>({kind:Dg[t],name:e,metadata:r,addInitializer:s=>n._?Cc("Already initialized"):i.push(Tc(s||null))}),Mg=(t,e)=>Og(e,$c("metadata"),t[3]),jg=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Fg=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,p=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&Ag(i,n));Rg(i,n);for(var b=r.length-1;b>=0;b--)l=Lg(c,n,a={},t[3],p),o=(0,r[b])(i,l),a._=1,Tc(o)&&(i=o);return Mg(t,i),v&&vo(i,n,v),u?c^4?s:v:i},Ic,yo,Ac;const Oc=["diffChars","diffWords","diffSentences","diffLines","createTwoFilesPatch"];Ic=[We(["jsdiff","wiki","getUrl"]),An(fe.object({"quickDiff.preferredCompareMode":fe.union([fe.const("jsDiff"),fe.const("mwApi")]).description("The preferred comparison mode for quick diff").default("mwApi"),"quickDiff.jsDiff.defaultType":fe.union(Oc.map(t=>fe.const(t))).description("The default diff type for JsDiff").default("diffSentences")}).description("Quick Diff Preferences"),{"quickDiff.preferredCompareMode":"mwApi","quickDiff.jsDiff.defaultType":"diffSentences"})];class Ti extends(Ac=ot){constructor(e){super(e,{},"quick-diff"),this.ctx=e,this.VALID_DIFF_TYPES=Oc,this.COMPARE_API_DEFAULT_OPTIONS={prop:["comment","diff","diffsize","ids","parsedcomment","size","timestamp","title","user","rel"].join("|"),difftype:"table"}}start(){this.ctx.set("quickDiff",this),this.ctx.on("quick-edit/wiki-page",this.injectQuickEdit.bind(this)),window.RLQ.push(this.injectHistoryPage.bind(this))}stop(){}injectHistoryPage(){const e=Cg("#mw-history-compare");if(!e)return;Tg(".mw-history-compareselectedversions-button",e).forEach(r=>{r.after(w("button",{className:"cdx-button",onClick:i=>{i.preventDefault();const s=new FormData(e),o=Number(s.get("oldid"))||0,a=Number(s.get("diff"))||0;if(!s.get("title")||!o||!a)return this.logger.warn("Missing title or revision IDs");this.comparePages({fromrev:o,torev:a})},children:"Quick Diff"}))})}injectQuickEdit({modal:e,wikiPage:n,options:r}){if(n.pageid===0||r.section==="new")return;let i;e.addButton({label:"Diff",side:"left",keyPress:"ctrl-d",className:"btn btn-secondary",method:()=>{const s=n.title,o=n.revisions?.[0]?.content||"",a=e.get$content().querySelector('textarea[name="text"]')?.value||"";return o===a?this.ctx.modal.notify("info",{title:"Quick Diff",content:"No changes"}):(i=this.comparePages({fromtitle:s,fromtext:o,totitle:s,totext:a,topst:!0},i,{backdrop:!1,draggable:!0}),i)}},2),e.on(e.Event.Close,()=>{i?.destroy(),i=void 0})}simpleTextDiff(e,n){const r=this.ctx.modal.show({title:"Quick Diff",className:"in-page-edit ipe-quickDiff"});r.show();const i=w("pre",{className:Sg["diff-container"]}),s=w("div",{style:{display:"flex",gap:"1em"},children:this.VALID_DIFF_TYPES.map((o,a)=>w(Dl,{name:"diffType",value:o,label:o,inputProps:{checked:a===0}}))});r.setContent(w("section",{children:[s,i]})),s.querySelectorAll('input[name="diffType"]').forEach(o=>{o.addEventListener("change",()=>{const a=this.renderJsDiff(e,n,o.value);i.textContent="",i.appendChild(a)})}),s.querySelector('input[name="diffType"]').dispatchEvent(new Event("change"))}renderJsDiff(e,n,r="diffSentences"){const i=document.createDocumentFragment();let s;if(r==="createTwoFilesPatch"){let o=!1;s=this.ctx.jsdiff.createTwoFilesPatch("original.txt","modified.txt",e,n).split(`
87
+ `);return e?n.pop():n.push(n.pop().slice(0,-1)),n}function yg(t){const e=[];let n,r;for(let i=0;i<t.length;i++)n=t[i],n.added?r=1:n.removed?r=-1:r=0,e.push([r,n.value]);return e}function bg(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n];r.added?e.push("<ins>"):r.removed&&e.push("<del>"),e.push(wg(r.value)),r.added?e.push("</ins>"):r.removed&&e.push("</del>")}return e.join("")}function wg(t){let e=t;return e=e.replace(/&/g,"&amp;"),e=e.replace(/</g,"&lt;"),e=e.replace(/>/g,"&gt;"),e=e.replace(/"/g,"&quot;"),e}const _g=Object.freeze(Object.defineProperty({__proto__:null,Diff:Ut,applyPatch:Ec,applyPatches:mg,arrayDiff:wc,canonicalize:$i,characterDiff:rc,convertChangesToDMP:yg,convertChangesToXML:bg,createPatch:gg,createTwoFilesPatch:go,cssDiff:gc,diffArrays:_c,diffChars:ic,diffCss:vc,diffJson:bc,diffLines:Pi,diffSentences:mc,diffTrimmedLines:dc,diffWords:cc,diffWordsWithSpace:fo,formatPatch:Ci,jsonDiff:yc,lineDiff:ho,parsePatch:po,reversePatch:kc,sentenceDiff:pc,structuredPatch:mo,wordDiff:lc,wordsWithSpaceDiff:fc},Symbol.toStringTag,{value:"Module"}));class xg{constructor(e){this.ctx=e,this.JsDiff=_g,this.diffChars=ic,this.diffWords=cc,this.diffWordsWithSpace=fo,this.diffLines=Pi,this.diffTrimmedLines=dc,this.diffSentences=mc,this.diffCss=vc,this.diffJson=bc,this.diffArrays=_c,this.createTwoFilesPatch=go,this.ctx.set("jsdiff",this)}}const Sg={"diff-container":"_diff-container_lq0si_2"},Eg=t=>{let{user:e,target:n,ctx:r}=t;const i=r.getUrl.bind(r);return w("span",{className:"mw-userlinks",children:[w("a",{href:i(`User:${e}`),className:"mw-userlink",target:n,children:e})," ",w("span",{className:"mw-usertoollinks",children:["(",w("a",{href:i(`User_talk:${e}`),className:"mw-usertoollinks-talk",target:n,children:"talk"})," | ",w("a",{href:i(`Special:Contributions/${e}`),className:"mw-usertoollinks-contribs",target:n,children:"contribs"})," | ",w("a",{href:i(`Special:Block/${e}`),className:"mw-usertoollinks-block",target:n,children:"block"}),")"]})]})};var Ti=(t=>(t.update="ipe:diff-table/update",t.edit="ipe:diff-table/edit",t))(Ti||{});const kg=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}).format,Pc=t=>{let e=["diff-title"];if(t.type==="from"?e.push("diff-otitle"):t.type==="to"&&e.push("diff-ntitle"),!t.pageid||!t.userid)return w("td",{colSpan:2,className:e,children:w("div",{className:"mw-diff-title--title",children:t.type==="from"?"Original content":t.type==="to"?"Your content":""})});const n=r=>{r.preventDefault(),r.target.dispatchEvent(new CustomEvent("ipe:diff-table/edit",{detail:{revid:t.revid},bubbles:!0}))};return w("td",{colSpan:2,className:e,children:[w("div",{className:"mw-diff-title--title",children:[t.pagetitle||t.timestamp,t.revid?` (rev#${t.revid})`:""]}),w("div",{className:"mw-diff-title--actions",children:w("a",{href:t.ctx.getUrl("",{action:"edit",oldid:t.revid}),onClick:n,children:[w(El,{style:"width: 1em; height: 1em"}),"Quick edit"]})}),w("div",{className:"mw-diff-title--user",children:t.username&&w(Eg,{ctx:t.ctx,user:t.username,target:"_blank"})}),w("div",{className:"mw-diff-title--timestamp",children:t.timestamp&&kg(new Date(t.timestamp))}),w("div",{className:"mw-diff-title--comment",children:t.parsedcomment&&w(Ft,{children:["(",w("i",{innerHTML:t.parsedcomment}),")"]})})]})},Pg=t=>{const e=t.data;if(!e.prev&&!e.next)return null;const n=(r,i,s)=>{r.preventDefault(),r.target.dispatchEvent(new CustomEvent("ipe:diff-table/update",{detail:{fromrev:i,torev:s},bubbles:!0}))};return w("tr",{className:"mw-diff-title--navigation",children:[w("td",{colSpan:2,children:e.prev?w("a",{href:t.ctx.getUrl("",{diff:e.prev,oldid:e.fromrevid}),onClick:r=>n(r,e.prev,e.fromrevid),children:"← Previous"}):w("i",{children:"Oldest version"})}),w("td",{colSpan:2,children:e.next?w("a",{href:t.ctx.getUrl("",{diff:e.next,oldid:e.torevid}),onClick:r=>n(r,e.torevid,e.next),children:"Next →"}):w("i",{children:"Newest version"})})]})},$g=t=>{const{data:e,...n}=t,r=w("table",{className:"theme-ipe diff diff-type-table","data-mw":"interface",...n,children:[w("colgroup",{children:[w("col",{className:"diff-marker"}),w("col",{className:"diff-content"}),w("col",{className:"diff-marker"}),w("col",{className:"diff-content"})]}),w("tbody",{children:[w("tr",{children:[w(Pc,{ctx:t.ctx,type:"from",pageid:e.fromid,pagetitle:e.fromtitle,revid:e.fromrevid,size:e.fromsize,timestamp:e.fromtimestamp,username:e.fromuser,userid:e.fromuserid,comment:e.fromcomment,parsedcomment:e.fromparsedcomment}),w(Pc,{ctx:t.ctx,type:"to",pageid:e.toid,pagetitle:e.totitle,revid:e.torevid,size:e.tosize,timestamp:e.totimestamp,username:e.touser,userid:e.touserid,comment:e.tocomment,parsedcomment:e.toparsedcomment})]}),w(Pg,{data:e,ctx:t.ctx}),w("div",{id:"diffbody"}),w("tr",{className:"diff-size",style:{textAlign:"center"},children:[w("td",{colSpan:2,className:"diff-size-old",children:e.fromsize!==void 0&&`${e.fromsize} bytes`}),w("td",{colSpan:2,className:"diff-size-new",children:e.tosize!==void 0&&`${e.tosize} bytes`})]})]})]});return r.querySelector("#diffbody").outerHTML=e.body||w("tr",{children:w("td",{colSpan:4,children:w("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"5rem"},children:w("i",{children:"No changes"})})})}).outerHTML,r},Cg=(t,e=document)=>e.querySelector(t),Tg=(t,e=document)=>e.querySelectorAll(t);var Ig=Object.create,vo=Object.defineProperty,Og=Object.getOwnPropertyDescriptor,$c=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Cc=t=>{throw TypeError(t)},Ag=(t,e,n)=>e in t?vo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Rg=(t,e)=>vo(t,"name",{value:e,configurable:!0}),Ng=t=>[,,,Ig(t?.[$c("metadata")]??null)],Dg=["class","method","getter","setter","accessor","field","value","get","set"],Tc=t=>t!==void 0&&typeof t!="function"?Cc("Function expected"):t,Lg=(t,e,n,r,i)=>({kind:Dg[t],name:e,metadata:r,addInitializer:s=>n._?Cc("Already initialized"):i.push(Tc(s||null))}),Mg=(t,e)=>Ag(e,$c("metadata"),t[3]),jg=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Fg=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,y=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&Og(i,n));Rg(i,n);for(var b=r.length-1;b>=0;b--)l=Lg(c,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,Tc(o)&&(i=o);return Mg(t,i),v&&vo(i,n,v),u?c^4?s:v:i},Ic,yo,Oc;const Ac=["diffChars","diffWords","diffSentences","diffLines","createTwoFilesPatch"];Ic=[We(["jsdiff","wiki","getUrl"]),On(fe.object({"quickDiff.preferredCompareMode":fe.union([fe.const("jsDiff"),fe.const("mwApi")]).description("The preferred comparison mode for quick diff").default("mwApi"),"quickDiff.jsDiff.defaultType":fe.union(Ac.map(t=>fe.const(t))).description("The default diff type for JsDiff").default("diffSentences")}).description("Quick Diff Preferences"),{"quickDiff.preferredCompareMode":"mwApi","quickDiff.jsDiff.defaultType":"diffSentences"})];class Ii extends(Oc=ot){constructor(e){super(e,{},"quick-diff"),this.ctx=e,this.VALID_DIFF_TYPES=Ac,this.COMPARE_API_DEFAULT_OPTIONS={prop:["comment","diff","diffsize","ids","parsedcomment","size","timestamp","title","user","rel"].join("|"),difftype:"table"}}start(){this.ctx.set("quickDiff",this),this.ctx.on("quick-edit/wiki-page",this.injectQuickEdit.bind(this)),window.RLQ.push(this.injectHistoryPage.bind(this))}stop(){}injectHistoryPage(){const e=Cg("#mw-history-compare");if(!e)return;Tg(".mw-history-compareselectedversions-button",e).forEach(r=>{r.after(w("button",{className:"cdx-button",onClick:i=>{i.preventDefault();const s=new FormData(e),o=Number(s.get("oldid"))||0,a=Number(s.get("diff"))||0;if(!s.get("title")||!o||!a)return this.logger.warn("Missing title or revision IDs");this.comparePages({fromrev:o,torev:a})},children:"Quick Diff"}))})}injectQuickEdit({modal:e,wikiPage:n,options:r}){if(n.pageid===0||r.section==="new")return;let i;e.addButton({label:"Diff",side:"left",keyPress:"ctrl-d",className:"btn btn-secondary",method:()=>{const s=n.title,o=n.revisions?.[0]?.content||"",a=e.get$content().querySelector('textarea[name="text"]')?.value||"";return o===a?this.ctx.modal.notify("info",{title:"Quick Diff",content:"No changes"}):(i=this.comparePages({fromtitle:s,fromtext:o,totitle:s,totext:a,topst:!0},i,{backdrop:!1,draggable:!0}),i)}},2),e.on(e.Event.Close,()=>{i?.destroy(),i=void 0})}simpleTextDiff(e,n){const r=this.ctx.modal.show({title:"Quick Diff",className:"in-page-edit ipe-quickDiff"});r.show();const i=w("pre",{className:Sg["diff-container"]}),s=w("div",{style:{display:"flex",gap:"1em"},children:this.VALID_DIFF_TYPES.map((o,a)=>w(Dl,{name:"diffType",value:o,label:o,inputProps:{checked:a===0}}))});r.setContent(w("section",{children:[s,i]})),s.querySelectorAll('input[name="diffType"]').forEach(o=>{o.addEventListener("change",()=>{const a=this.renderJsDiff(e,n,o.value);i.textContent="",i.appendChild(a)})}),s.querySelector('input[name="diffType"]').dispatchEvent(new Event("change"))}renderJsDiff(e,n,r="diffSentences"){const i=document.createDocumentFragment();let s;if(r==="createTwoFilesPatch"){let o=!1;s=this.ctx.jsdiff.createTwoFilesPatch("original.txt","modified.txt",e,n).split(`
86
88
  `).map(function(a){const l={value:a+`
87
- `};return a.startsWith("@@")?(l.chunkHeader=!0,o=!0):o&&(a.startsWith("-")?l.removed=!0:a.startsWith("+")&&(l.added=!0)),l})}else{const o=this.ctx.jsdiff[r];if(!o)throw new Error(`Missing DiffEngine for ${r}`);s=o(e,n)}if(!Array.isArray(s))throw new Error("Missing diff result");for(let o=0;o<s.length;o++){if(s[o].added&&s[o+1]&&s[o+1].removed){const l=s[o];s[o]=s[o+1],s[o+1]=l}let a;s[o].removed?(a=document.createElement("del"),a.appendChild(document.createTextNode(s[o].value))):s[o].added?(a=document.createElement("ins"),a.appendChild(document.createTextNode(s[o].value))):s[o].chunkHeader?(a=document.createElement("span"),a.setAttribute("class","chunk-header"),a.appendChild(document.createTextNode(s[o].value))):a=document.createTextNode(s[o].value),i.appendChild(a)}return i}comparePages(e,n,r){return!n||n.isDestroyed?n=this.ctx.modal.createObject({title:"Loading diff...",content:"",className:"quick-diff",center:!1,...r}).init():n.removeButton("*"),n.setContent(w("section",{style:{height:"70vh",display:"flex",justifyContent:"center",alignItems:"center"},children:w(Xt,{})})),n.bringToFront(),window.mw&&mw.loader.getState("mediawiki.diff.styles")!=="ready"&&mw.loader.load(["mediawiki.diff.styles"]),this.ctx.api.post({...this.COMPARE_API_DEFAULT_OPTIONS,...e,action:"compare",format:"json",formatversion:2}).then(i=>{if(!i.data.compare)throw new Error("No compare data received",{cause:i});const{data:{compare:s}}=i;n.setTitle(s.fromtitle&&s.totitle?`${s.fromtitle}${s.fromrevid?` (${s.fromrevid})`:""} ⇔ ${s.totitle}${s.torevid?` (${s.torevid})`:""}`:"Differences");let o;n.setContent(w("section",{style:{minHeight:"70vh"},children:w($g,{ref:a=>o=a,data:s,ctx:this.ctx})})),o.addEventListener(Ci.update,a=>{a.stopPropagation(),this.comparePages({fromrev:a.detail.fromrev,torev:a.detail.torev},n,r)},{once:!0}),this.ctx.inject(["quickEdit"],a=>{const l=c=>{c.stopPropagation(),a.quickEdit({revision:c.detail.revid})};o.addEventListener(Ci.edit,l),n.on(n.Event.Close,()=>{o.removeEventListener(Ci.edit,l)})}),s.fromrevid&&s.torevid&&n.addButton({label:"Original Compare Page",side:"right",className:"btn btn-secondary",method:()=>{window.location.href=this.ctx.getUrl("",{oldid:s.fromrevid,diff:s.torevid})}})}).catch(i=>{n.setContent(w(hr,{title:"Failed to load diff",type:"error",children:w("pre",{children:i instanceof Error?i.message:String(i)})}))}),n.show()}}yo=Ng(Ac),Ti=Fg(yo,0,"PluginQuickDiffCore",Ic,Ti),jg(yo,1,Ti);const ya=class ya extends ot{constructor(e){super(e,{},"quick-diff-loader"),this.ctx=e,e.plugin(xg),e.plugin(Ti)}};ya.inject=["api","wikiPage","modal"];let bo=ya;const Bg=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickDiff:bo},Symbol.toStringTag,{value:"Module"})),ba=class ba extends ot{constructor(e){super(e,{},"quick-redirect"),this.ctx=e}start(){this.ctx.set("quickRedirect",this.quickRedirect.bind(this)),this.ctx.set("redirectPage",this.redirectPage.bind(this));const e=window.mw?.config.get("wgPageName")||"",n=window.mw?.config.get("wgIsProbablyEditable");this.ctx.inject(["toolbox"],r=>{this.ctx=r,r.toolbox.addButton({id:"quick-redirect",icon:w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file-symlink",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M4 21v-4a3 3 0 0 1 3 -3h5"}),w("path",{d:"M9 17l3 -3l-3 -3"}),w("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),w("path",{d:"M5 11v-6a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-9.5"})]}),tooltip:"Quick Redirect",group:"group1",index:2,onClick:()=>{this.quickRedirect(n?{to:e}:{})}}),this.addDisposeHandler(i=>{i.toolbox.removeButton("quick-redirect")})})}stop(){}quickRedirect(e){const n=this.ctx.modal.createObject({title:"Quick Redirect",content:w(Xt,{}),className:"quick-redirect compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let r=null;return n.setContent(w("form",{ref:i=>r=i,style:{display:"flex",flexDirection:"column",gap:"1rem"},onSubmit:i=>{if(i.preventDefault(),r?.checkValidity(),!r?.reportValidity())return;const s=new FormData(r),o={from:s.get("from")?.toString().trim(),to:s.get("to")?.toString().trim(),reason:s.get("reason")||"",overwrite:s.get("overwrite")==="on"};if(!o.from||!o.to){this.ctx.modal.notify("error",{title:"Failed to redirect",content:"From and to are required."});return}n.setLoadingState(!0),this.redirectPage(o).then(a=>{n.close(),this.ctx.modal.notify("success",{title:"Redirect successful",content:"The redirect has been created."})}).catch(a=>{n.setLoadingState(!1),this.ctx.modal.notify("error",{title:"Failed to redirect",content:a instanceof Error?a.message:String(a)})})},children:[w(Kl,{inputs:[{label:"From",name:"from",value:e?.from,required:!0},{label:"To",name:"to",value:e?.to,required:!0}]}),w(pr,{label:"Reason",id:"reason",name:"reason",value:e?.reason}),w("div",{children:w(On,{name:"overwrite",id:"overwrite",checked:e?.overwrite,children:"Force create redirect even if the from page already exists"})})]})),n.setButtons([{label:"Create Redirect",className:"is-primary is-ghost",method:()=>{r?.dispatchEvent(new Event("submit"))}}]),n.show()}async redirectPage(e){const{from:n,to:r,reason:i="",overwrite:s=!1}=e,o=await this.ctx.wikiPage.newBlankPage({title:n}),a=`#REDIRECT [[:${r}]]`,l=await o.edit({text:a,summary:i},{createonly:!s});if(l.data?.errors)throw new Error(l.data.errors[0].info,{cause:l});return l}};ba.inject=["api","wikiPage","modal"];let wo=ba;const Ug=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickRedirect:wo},Symbol.toStringTag,{value:"Module"}));var qg=Object.create,_o=Object.defineProperty,zg=Object.getOwnPropertyDescriptor,Rc=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Nc=t=>{throw TypeError(t)},Hg=(t,e,n)=>e in t?_o(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Wg=(t,e)=>_o(t,"name",{value:e,configurable:!0}),Kg=t=>[,,,qg(t?.[Rc("metadata")]??null)],Vg=["class","method","getter","setter","accessor","field","value","get","set"],Dc=t=>t!==void 0&&typeof t!="function"?Nc("Function expected"):t,Yg=(t,e,n,r,i)=>({kind:Vg[t],name:e,metadata:r,addInitializer:s=>n._?Nc("Already initialized"):i.push(Dc(s||null))}),Gg=(t,e)=>Hg(e,Rc("metadata"),t[3]),Qg=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Jg=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,p=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&zg(i,n));Wg(i,n);for(var b=r.length-1;b>=0;b--)l=Yg(c,n,a={},t[3],p),o=(0,r[b])(i,l),a._=1,Dc(o)&&(i=o);return Gg(t,i),v&&_o(i,n,v),u?c^4?s:v:i},Lc,xo,Mc;Lc=[An(fe.object({toolboxAlwaysShow:fe.boolean().description("Make the toolbox opened by default").default(!1)}).description("Toolbox preferences")),We(["preferences"])];class Ii extends(Mc=Jt){constructor(e){super(e,"toolbox",!1),this.ctx=e,this.container=void 0}async start(){this.container=this.createToolbox(),this.ctx.preferences.get("toolboxAlwaysShow").then(e=>{e&&this.container.classList.add("is-persistent")}),this.setupHoverLogic(),document.body.appendChild(this.container),this.updateButtonDelays()}stop(){this.container?.remove()}get isPersistent(){return this.container.classList.contains("is-persistent")}setupHoverLogic(){let e=null;this.container.addEventListener("mouseenter",()=>{e&&(clearTimeout(e),e=null),this.isPersistent||this.container.classList.add("is-hovered")}),this.container.addEventListener("mouseleave",()=>{this.isPersistent||(e=window.setTimeout(()=>{this.container.classList.remove("is-hovered")},150))})}calculateButtonDelay(e,n){if(n<=1)return 0;const r=.15,i=e/(n-1),s=r*Math.sqrt(i);return Math.round(s*1e3)/1e3}updateButtonDelays(){this.container.querySelectorAll(".btn-group").forEach(n=>{const r=n.querySelectorAll(".btn-tip-group"),i=r.length;r.forEach((s,o)=>{const a=this.calculateButtonDelay(o,i);s.style.setProperty("--transition-delay",`${a}s`),s.style.setProperty("--max-transition-delay","0.15s")})})}createToolbox(){return w("div",{id:"ipe-edit-toolbox",children:[w("ul",{className:"btn-group group1",style:{display:"flex",flexDirection:"column"}}),w("ul",{className:"btn-group group2",style:{display:"flex",flexDirection:"row"}}),w("button",{className:"ipe-toolbox-btn",id:"toolbox-toggler",onClick:()=>{this.toggle()},children:w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"448",height:"512",viewBox:"0 0 448 512",children:[w("rect",{width:"448",height:"512",fill:"none"}),w("path",{fill:"currentColor",d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32"})]})})]})}normalizeButtonId(e){return e||(e=Math.random().toString(36).substring(2,8)),`ipe-toolbox__${e.trim()}`.replace(/\s\.#/g,"-")}addButton(e){let{id:n,group:r,icon:i,tooltip:s,itemProps:o,buttonProps:a,onClick:l,index:c}=e;n=this.normalizeButtonId(n);const u=this.container.querySelector(`#${n}`);u&&(this.ctx.logger("toolbox").warn(`Button with id ${n} already exists, replacing it.`),u.remove());let f=null;if(typeof r>"u"||r==="auto"){const v=this.container.querySelector(".btn-group.group1"),b=this.container.querySelector(".btn-group.group2"),I=v?.children.length||0,B=b?.children.length||0;f=I<=B?v:b}else f=this.container.querySelector(`.btn-group.${r}`);if(!f)throw new Error(`Button group ${r} not found`);const p=w("li",{class:"btn-tip-group",id:n,onClick:l,...o,children:[w("div",{class:"btn-tip",children:s}),w("button",{id:`${n}-btn`,class:"ipe-toolbox-btn",...a,children:i})]});return typeof c=="number"?c<=0?f.prepend(p):c>=f.children.length?f.appendChild(p):f.children[c]?.before(p):f.appendChild(p),this.ctx.emit("toolbox/button-added",{ctx:this.ctx,button:p}),this.updateButtonDelays(),p}removeButton(e){this.container.querySelector(`.ipe-toolbox-btn#${e}`)?.remove(),this.ctx.emit("toolbox/button-removed",{ctx:this.ctx,id:e}),this.updateButtonDelays()}getContainer(){return this.container}get isOpened(){return this.container.classList.contains("is-persistent")||this.container.classList.contains("is-hovered")}toggle(e){const n=this.isPersistent,r=typeof e=="boolean"?e:!n;this.container.classList.toggle("is-persistent",r),this.container.classList.remove("is-hovered"),this.ctx.preferences.set("toolboxAlwaysShow",r)}}xo=Kg(Mc),Ii=Jg(xo,0,"PluginToolbox",Lc,Ii),Qg(xo,1,Ii);const Xg=Object.freeze(Object.defineProperty({__proto__:null,get PluginToolbox(){return Ii}},Symbol.toStringTag,{value:"Module"}));/**
89
+ `};return a.startsWith("@@")?(l.chunkHeader=!0,o=!0):o&&(a.startsWith("-")?l.removed=!0:a.startsWith("+")&&(l.added=!0)),l})}else{const o=this.ctx.jsdiff[r];if(!o)throw new Error(`Missing DiffEngine for ${r}`);s=o(e,n)}if(!Array.isArray(s))throw new Error("Missing diff result");for(let o=0;o<s.length;o++){if(s[o].added&&s[o+1]&&s[o+1].removed){const l=s[o];s[o]=s[o+1],s[o+1]=l}let a;s[o].removed?(a=document.createElement("del"),a.appendChild(document.createTextNode(s[o].value))):s[o].added?(a=document.createElement("ins"),a.appendChild(document.createTextNode(s[o].value))):s[o].chunkHeader?(a=document.createElement("span"),a.setAttribute("class","chunk-header"),a.appendChild(document.createTextNode(s[o].value))):a=document.createTextNode(s[o].value),i.appendChild(a)}return i}comparePages(e,n,r){return!n||n.isDestroyed?n=this.ctx.modal.createObject({title:"Loading diff...",content:"",className:"quick-diff",center:!1,...r}).init():n.removeButton("*"),n.setContent(w("section",{style:{height:"70vh",display:"flex",justifyContent:"center",alignItems:"center"},children:w(Xt,{})})),n.bringToFront(),window.mw&&mw.loader.getState("mediawiki.diff.styles")!=="ready"&&mw.loader.load(["mediawiki.diff.styles"]),this.ctx.api.post({...this.COMPARE_API_DEFAULT_OPTIONS,...e,action:"compare",format:"json",formatversion:2}).then(i=>{if(!i.data.compare)throw new Error("No compare data received",{cause:i});const{data:{compare:s}}=i;n.setTitle(s.fromtitle&&s.totitle?`${s.fromtitle}${s.fromrevid?` (${s.fromrevid})`:""} ⇔ ${s.totitle}${s.torevid?` (${s.torevid})`:""}`:"Differences");let o;n.setContent(w("section",{style:{minHeight:"70vh"},children:w($g,{ref:a=>o=a,data:s,ctx:this.ctx})})),o.addEventListener(Ti.update,a=>{a.stopPropagation(),this.comparePages({fromrev:a.detail.fromrev,torev:a.detail.torev},n,r)},{once:!0}),this.ctx.inject(["quickEdit"],a=>{const l=c=>{c.stopPropagation(),a.quickEdit({revision:c.detail.revid})};o.addEventListener(Ti.edit,l),n.on(n.Event.Close,()=>{o.removeEventListener(Ti.edit,l)})}),s.fromrevid&&s.torevid&&n.addButton({label:"Original Compare Page",side:"right",className:"btn btn-secondary",method:()=>{window.location.href=this.ctx.getUrl("",{oldid:s.fromrevid,diff:s.torevid})}})}).catch(i=>{n.setContent(w(hr,{title:"Failed to load diff",type:"error",children:w("pre",{children:i instanceof Error?i.message:String(i)})}))}),n.show()}}yo=Ng(Oc),Ii=Fg(yo,0,"PluginQuickDiffCore",Ic,Ii),jg(yo,1,Ii);const ya=class ya extends ot{constructor(e){super(e,{},"quick-diff-loader"),this.ctx=e,e.plugin(xg),e.plugin(Ii)}};ya.inject=["api","wikiPage","modal"];let bo=ya;const Bg=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickDiff:bo},Symbol.toStringTag,{value:"Module"})),ba=class ba extends ot{constructor(e){super(e,{},"quick-redirect"),this.ctx=e}start(){this.ctx.set("quickRedirect",this.quickRedirect.bind(this)),this.ctx.set("redirectPage",this.redirectPage.bind(this));const e=window.mw?.config.get("wgPageName")||"",n=window.mw?.config.get("wgIsProbablyEditable");this.ctx.inject(["toolbox"],r=>{this.ctx=r,r.toolbox.addButton({id:"quick-redirect",icon:w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file-symlink",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M4 21v-4a3 3 0 0 1 3 -3h5"}),w("path",{d:"M9 17l3 -3l-3 -3"}),w("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),w("path",{d:"M5 11v-6a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-9.5"})]}),tooltip:"Quick Redirect",group:"group1",index:2,onClick:()=>{this.quickRedirect(n?{to:e}:{})}}),this.addDisposeHandler(i=>{i.toolbox.removeButton("quick-redirect")})})}stop(){}quickRedirect(e){const n=this.ctx.modal.createObject({title:"Quick Redirect",content:w(Xt,{}),className:"quick-redirect compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let r=null;return n.setContent(w("form",{ref:i=>r=i,style:{display:"flex",flexDirection:"column",gap:"1rem"},onSubmit:i=>{if(i.preventDefault(),r?.checkValidity(),!r?.reportValidity())return;const s=new FormData(r),o={from:s.get("from")?.toString().trim(),to:s.get("to")?.toString().trim(),reason:s.get("reason")||"",overwrite:s.get("overwrite")==="on"};if(!o.from||!o.to){this.ctx.modal.notify("error",{title:"Failed to redirect",content:"From and to are required."});return}n.setLoadingState(!0),this.redirectPage(o).then(a=>{n.close(),this.ctx.modal.notify("success",{title:"Redirect successful",content:"The redirect has been created."})}).catch(a=>{n.setLoadingState(!1),this.ctx.modal.notify("error",{title:"Failed to redirect",content:a instanceof Error?a.message:String(a)})})},children:[w(Kl,{inputs:[{label:"From",name:"from",value:e?.from,required:!0},{label:"To",name:"to",value:e?.to,required:!0}]}),w(pr,{label:"Reason",id:"reason",name:"reason",value:e?.reason}),w("div",{children:w(An,{name:"overwrite",id:"overwrite",checked:e?.overwrite,children:"Force create redirect even if the from page already exists"})})]})),n.setButtons([{label:"Create Redirect",className:"is-primary is-ghost",method:()=>{r?.dispatchEvent(new Event("submit"))}}]),n.show()}async redirectPage(e){const{from:n,to:r,reason:i="",overwrite:s=!1}=e,o=await this.ctx.wikiPage.newBlankPage({title:n}),a=`#REDIRECT [[:${r}]]`;return o.edit({text:a,summary:i},{createonly:!s})}};ba.inject=["api","wikiPage","modal"];let wo=ba;const Ug=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickRedirect:wo},Symbol.toStringTag,{value:"Module"}));var qg=Object.create,_o=Object.defineProperty,zg=Object.getOwnPropertyDescriptor,Rc=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Nc=t=>{throw TypeError(t)},Hg=(t,e,n)=>e in t?_o(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Wg=(t,e)=>_o(t,"name",{value:e,configurable:!0}),Kg=t=>[,,,qg(t?.[Rc("metadata")]??null)],Vg=["class","method","getter","setter","accessor","field","value","get","set"],Dc=t=>t!==void 0&&typeof t!="function"?Nc("Function expected"):t,Yg=(t,e,n,r,i)=>({kind:Vg[t],name:e,metadata:r,addInitializer:s=>n._?Nc("Already initialized"):i.push(Dc(s||null))}),Gg=(t,e)=>Hg(e,Rc("metadata"),t[3]),Qg=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Jg=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,y=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&zg(i,n));Wg(i,n);for(var b=r.length-1;b>=0;b--)l=Yg(c,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,Dc(o)&&(i=o);return Gg(t,i),v&&_o(i,n,v),u?c^4?s:v:i},Lc,xo,Mc;Lc=[On(fe.object({toolboxAlwaysShow:fe.boolean().description("Make the toolbox opened by default").default(!1)}).description("Toolbox preferences")),We(["preferences"])];class Oi extends(Mc=Jt){constructor(e){super(e,"toolbox",!1),this.ctx=e,this.container=void 0}async start(){this.container=this.createToolbox(),this.ctx.preferences.get("toolboxAlwaysShow").then(e=>{e&&this.container.classList.add("is-persistent")}),this.setupHoverLogic(),document.body.appendChild(this.container),this.updateButtonDelays()}stop(){this.container?.remove()}get isPersistent(){return this.container.classList.contains("is-persistent")}setupHoverLogic(){let e=null;this.container.addEventListener("mouseenter",()=>{e&&(clearTimeout(e),e=null),this.isPersistent||this.container.classList.add("is-hovered")}),this.container.addEventListener("mouseleave",()=>{this.isPersistent||(e=window.setTimeout(()=>{this.container.classList.remove("is-hovered")},150))})}calculateButtonDelay(e,n){if(n<=1)return 0;const r=.15,i=e/(n-1),s=r*Math.sqrt(i);return Math.round(s*1e3)/1e3}updateButtonDelays(){this.container.querySelectorAll(".btn-group").forEach(n=>{const r=n.querySelectorAll(".btn-tip-group"),i=r.length;r.forEach((s,o)=>{const a=this.calculateButtonDelay(o,i);s.style.setProperty("--transition-delay",`${a}s`),s.style.setProperty("--max-transition-delay","0.15s")})})}createToolbox(){return w("div",{id:"ipe-edit-toolbox",children:[w("ul",{className:"btn-group group1",style:{display:"flex",flexDirection:"column"}}),w("ul",{className:"btn-group group2",style:{display:"flex",flexDirection:"row"}}),w("button",{className:"ipe-toolbox-btn",id:"toolbox-toggler",onClick:()=>{this.toggle()},children:w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"448",height:"512",viewBox:"0 0 448 512",children:[w("rect",{width:"448",height:"512",fill:"none"}),w("path",{fill:"currentColor",d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32"})]})})]})}normalizeButtonId(e){return e||(e=Math.random().toString(36).substring(2,8)),`ipe-toolbox__${e.trim()}`.replace(/\s\.#/g,"-")}addButton(e){let{id:n,group:r,icon:i,tooltip:s,itemProps:o,buttonProps:a,onClick:l,index:c}=e;n=this.normalizeButtonId(n);const u=this.container.querySelector(`#${n}`);u&&(this.ctx.logger("toolbox").warn(`Button with id ${n} already exists, replacing it.`),u.remove());let f=null;if(typeof r>"u"||r==="auto"){const v=this.container.querySelector(".btn-group.group1"),b=this.container.querySelector(".btn-group.group2"),I=v?.children.length||0,F=b?.children.length||0;f=I<=F?v:b}else f=this.container.querySelector(`.btn-group.${r}`);if(!f)throw new Error(`Button group ${r} not found`);const y=w("li",{class:"btn-tip-group",id:n,onClick:l,...o,children:[w("div",{class:"btn-tip",children:s}),w("button",{id:`${n}-btn`,class:"ipe-toolbox-btn",...a,children:i})]});return typeof c=="number"?c<=0?f.prepend(y):c>=f.children.length?f.appendChild(y):f.children[c]?.before(y):f.appendChild(y),this.ctx.emit("toolbox/button-added",{ctx:this.ctx,button:y}),this.updateButtonDelays(),y}removeButton(e){this.container.querySelector(`.ipe-toolbox-btn#${e}`)?.remove(),this.ctx.emit("toolbox/button-removed",{ctx:this.ctx,id:e}),this.updateButtonDelays()}getContainer(){return this.container}get isOpened(){return this.container.classList.contains("is-persistent")||this.container.classList.contains("is-hovered")}toggle(e){const n=this.isPersistent,r=typeof e=="boolean"?e:!n;this.container.classList.toggle("is-persistent",r),this.container.classList.remove("is-hovered"),this.ctx.preferences.set("toolboxAlwaysShow",r)}}xo=Kg(Mc),Oi=Jg(xo,0,"PluginToolbox",Lc,Oi),Qg(xo,1,Oi);const Xg=Object.freeze(Object.defineProperty({__proto__:null,get PluginToolbox(){return Oi}},Symbol.toStringTag,{value:"Module"}));/**
88
90
  * @vue/shared v3.5.22
89
91
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
90
92
  * @license MIT
91
- **/function So(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const pe={},Rn=[],Ct=()=>{},jc=()=>!1,Ai=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Eo=t=>t.startsWith("onUpdate:"),Fe=Object.assign,ko=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},Zg=Object.prototype.hasOwnProperty,ve=(t,e)=>Zg.call(t,e),se=Array.isArray,Nn=t=>Oi(t)==="[object Map]",Fc=t=>Oi(t)==="[object Set]",oe=t=>typeof t=="function",Ce=t=>typeof t=="string",en=t=>typeof t=="symbol",Ee=t=>t!==null&&typeof t=="object",Bc=t=>(Ee(t)||oe(t))&&oe(t.then)&&oe(t.catch),Uc=Object.prototype.toString,Oi=t=>Uc.call(t),ev=t=>Oi(t).slice(8,-1),qc=t=>Oi(t)==="[object Object]",Po=t=>Ce(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,yr=So(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ri=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},tv=/-\w/g,qt=Ri(t=>t.replace(tv,e=>e.slice(1).toUpperCase())),nv=/\B([A-Z])/g,tn=Ri(t=>t.replace(nv,"-$1").toLowerCase()),zc=Ri(t=>t.charAt(0).toUpperCase()+t.slice(1)),$o=Ri(t=>t?`on${zc(t)}`:""),nt=(t,e)=>!Object.is(t,e),Co=(t,...e)=>{for(let n=0;n<t.length;n++)t[n](...e)},Hc=(t,e,n,r=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:r,value:n})},rv=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Wc;const Ni=()=>Wc||(Wc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function To(t){if(se(t)){const e={};for(let n=0;n<t.length;n++){const r=t[n],i=Ce(r)?av(r):To(r);if(i)for(const s in i)e[s]=i[s]}return e}else if(Ce(t)||Ee(t))return t}const iv=/;(?![^(]*\))/g,sv=/:([^]+)/,ov=/\/\*[^]*?\*\//g;function av(t){const e={};return t.replace(ov,"").split(iv).forEach(n=>{if(n){const r=n.split(sv);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function Di(t){let e="";if(Ce(t))e=t;else if(se(t))for(let n=0;n<t.length;n++){const r=Di(t[n]);r&&(e+=r+" ")}else if(Ee(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}const lv=So("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function Kc(t){return!!t||t===""}const Vc=t=>!!(t&&t.__v_isRef===!0),Io=t=>Ce(t)?t:t==null?"":se(t)||Ee(t)&&(t.toString===Uc||!oe(t.toString))?Vc(t)?Io(t.value):JSON.stringify(t,Yc,2):String(t),Yc=(t,e)=>Vc(e)?Yc(t,e.value):Nn(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((n,[r,i],s)=>(n[Ao(r,s)+" =>"]=i,n),{})}:Fc(e)?{[`Set(${e.size})`]:[...e.values()].map(n=>Ao(n))}:en(e)?Ao(e):Ee(e)&&!se(e)&&!qc(e)?String(e):e,Ao=(t,e="")=>{var n;return en(t)?`Symbol(${(n=t.description)!=null?n:e})`:t};/**
93
+ **/function So(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const me={},Rn=[],Ct=()=>{},jc=()=>!1,Ai=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Eo=t=>t.startsWith("onUpdate:"),Fe=Object.assign,ko=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},Zg=Object.prototype.hasOwnProperty,ve=(t,e)=>Zg.call(t,e),se=Array.isArray,Nn=t=>Ri(t)==="[object Map]",Fc=t=>Ri(t)==="[object Set]",oe=t=>typeof t=="function",Ce=t=>typeof t=="string",en=t=>typeof t=="symbol",Ee=t=>t!==null&&typeof t=="object",Bc=t=>(Ee(t)||oe(t))&&oe(t.then)&&oe(t.catch),Uc=Object.prototype.toString,Ri=t=>Uc.call(t),ev=t=>Ri(t).slice(8,-1),qc=t=>Ri(t)==="[object Object]",Po=t=>Ce(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,yr=So(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ni=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},tv=/-\w/g,qt=Ni(t=>t.replace(tv,e=>e.slice(1).toUpperCase())),nv=/\B([A-Z])/g,tn=Ni(t=>t.replace(nv,"-$1").toLowerCase()),zc=Ni(t=>t.charAt(0).toUpperCase()+t.slice(1)),$o=Ni(t=>t?`on${zc(t)}`:""),nt=(t,e)=>!Object.is(t,e),Co=(t,...e)=>{for(let n=0;n<t.length;n++)t[n](...e)},Hc=(t,e,n,r=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:r,value:n})},rv=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Wc;const Di=()=>Wc||(Wc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function To(t){if(se(t)){const e={};for(let n=0;n<t.length;n++){const r=t[n],i=Ce(r)?av(r):To(r);if(i)for(const s in i)e[s]=i[s]}return e}else if(Ce(t)||Ee(t))return t}const iv=/;(?![^(]*\))/g,sv=/:([^]+)/,ov=/\/\*[^]*?\*\//g;function av(t){const e={};return t.replace(ov,"").split(iv).forEach(n=>{if(n){const r=n.split(sv);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function Li(t){let e="";if(Ce(t))e=t;else if(se(t))for(let n=0;n<t.length;n++){const r=Li(t[n]);r&&(e+=r+" ")}else if(Ee(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}const lv=So("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function Kc(t){return!!t||t===""}const Vc=t=>!!(t&&t.__v_isRef===!0),Io=t=>Ce(t)?t:t==null?"":se(t)||Ee(t)&&(t.toString===Uc||!oe(t.toString))?Vc(t)?Io(t.value):JSON.stringify(t,Yc,2):String(t),Yc=(t,e)=>Vc(e)?Yc(t,e.value):Nn(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((n,[r,i],s)=>(n[Oo(r,s)+" =>"]=i,n),{})}:Fc(e)?{[`Set(${e.size})`]:[...e.values()].map(n=>Oo(n))}:en(e)?Oo(e):Ee(e)&&!se(e)&&!qc(e)?String(e):e,Oo=(t,e="")=>{var n;return en(t)?`Symbol(${(n=t.description)!=null?n:e})`:t};/**
92
94
  * @vue/reactivity v3.5.22
93
95
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
94
96
  * @license MIT
95
- **/let rt;class cv{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=rt,!e&&rt&&(this.index=(rt.scopes||(rt.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].pause();for(e=0,n=this.effects.length;e<n;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].resume();for(e=0,n=this.effects.length;e<n;e++)this.effects[e].resume()}}run(e){if(this._active){const n=rt;try{return rt=this,e()}finally{rt=n}}}on(){++this._on===1&&(this.prevScope=rt,rt=this)}off(){this._on>0&&--this._on===0&&(rt=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const i=this.parent.scopes.pop();i&&i!==this&&(this.parent.scopes[this.index]=i,i.index=this.index)}this.parent=void 0}}}function uv(){return rt}let Se;const Oo=new WeakSet;class Gc{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,rt&&rt.active&&rt.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Oo.has(this)&&(Oo.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Jc(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,nu(this),Xc(this);const e=Se,n=_t;Se=this,_t=!0;try{return this.fn()}finally{Zc(this),Se=e,_t=n,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Lo(e);this.deps=this.depsTail=void 0,nu(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Oo.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Do(this)&&this.run()}get dirty(){return Do(this)}}let Qc=0,br,wr;function Jc(t,e=!1){if(t.flags|=8,e){t.next=wr,wr=t;return}t.next=br,br=t}function Ro(){Qc++}function No(){if(--Qc>0)return;if(wr){let e=wr;for(wr=void 0;e;){const n=e.next;e.next=void 0,e.flags&=-9,e=n}}let t;for(;br;){let e=br;for(br=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=n}}if(t)throw t}function Xc(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Zc(t){let e,n=t.depsTail,r=n;for(;r;){const i=r.prevDep;r.version===-1?(r===n&&(n=i),Lo(r),fv(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}t.deps=e,t.depsTail=n}function Do(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(eu(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function eu(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===_r)||(t.globalVersion=_r,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Do(t))))return;t.flags|=2;const e=t.dep,n=Se,r=_t;Se=t,_t=!0;try{Xc(t);const i=t.fn(t._value);(e.version===0||nt(i,t._value))&&(t.flags|=128,t._value=i,e.version++)}catch(i){throw e.version++,i}finally{Se=n,_t=r,Zc(t),t.flags&=-3}}function Lo(t,e=!1){const{dep:n,prevSub:r,nextSub:i}=t;if(r&&(r.nextSub=i,t.prevSub=void 0),i&&(i.prevSub=r,t.nextSub=void 0),n.subs===t&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let s=n.computed.deps;s;s=s.nextDep)Lo(s,!0)}!e&&!--n.sc&&n.map&&n.map.delete(n.key)}function fv(t){const{prevDep:e,nextDep:n}=t;e&&(e.nextDep=n,t.prevDep=void 0),n&&(n.prevDep=e,t.nextDep=void 0)}let _t=!0;const tu=[];function Tt(){tu.push(_t),_t=!1}function It(){const t=tu.pop();_t=t===void 0?!0:t}function nu(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const n=Se;Se=void 0;try{e()}finally{Se=n}}}let _r=0;class dv{constructor(e,n){this.sub=e,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Li{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Se||!_t||Se===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Se)n=this.activeLink=new dv(Se,this),Se.deps?(n.prevDep=Se.depsTail,Se.depsTail.nextDep=n,Se.depsTail=n):Se.deps=Se.depsTail=n,ru(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=Se.depsTail,n.nextDep=void 0,Se.depsTail.nextDep=n,Se.depsTail=n,Se.deps===n&&(Se.deps=r)}return n}trigger(e){this.version++,_r++,this.notify(e)}notify(e){Ro();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{No()}}}function ru(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)ru(r)}const n=t.dep.subs;n!==t&&(t.prevSub=n,n&&(n.nextSub=t)),t.dep.subs=t}}const Mo=new WeakMap,vn=Symbol(""),jo=Symbol(""),xr=Symbol("");function Ke(t,e,n){if(_t&&Se){let r=Mo.get(t);r||Mo.set(t,r=new Map);let i=r.get(n);i||(r.set(n,i=new Li),i.map=r,i.key=n),i.track()}}function zt(t,e,n,r,i,s){const o=Mo.get(t);if(!o){_r++;return}const a=l=>{l&&l.trigger()};if(Ro(),e==="clear")o.forEach(a);else{const l=se(t),c=l&&Po(n);if(l&&n==="length"){const u=Number(r);o.forEach((f,p)=>{(p==="length"||p===xr||!en(p)&&p>=u)&&a(f)})}else switch((n!==void 0||o.has(void 0))&&a(o.get(n)),c&&a(o.get(xr)),e){case"add":l?c&&a(o.get("length")):(a(o.get(vn)),Nn(t)&&a(o.get(jo)));break;case"delete":l||(a(o.get(vn)),Nn(t)&&a(o.get(jo)));break;case"set":Nn(t)&&a(o.get(vn));break}}No()}function Dn(t){const e=de(t);return e===t?e:(Ke(e,"iterate",xr),pt(t)?e:e.map(Be))}function Mi(t){return Ke(t=de(t),"iterate",xr),t}const hv={__proto__:null,[Symbol.iterator](){return Fo(this,Symbol.iterator,Be)},concat(...t){return Dn(this).concat(...t.map(e=>se(e)?Dn(e):e))},entries(){return Fo(this,"entries",t=>(t[1]=Be(t[1]),t))},every(t,e){return Ht(this,"every",t,e,void 0,arguments)},filter(t,e){return Ht(this,"filter",t,e,n=>n.map(Be),arguments)},find(t,e){return Ht(this,"find",t,e,Be,arguments)},findIndex(t,e){return Ht(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Ht(this,"findLast",t,e,Be,arguments)},findLastIndex(t,e){return Ht(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Ht(this,"forEach",t,e,void 0,arguments)},includes(...t){return Bo(this,"includes",t)},indexOf(...t){return Bo(this,"indexOf",t)},join(t){return Dn(this).join(t)},lastIndexOf(...t){return Bo(this,"lastIndexOf",t)},map(t,e){return Ht(this,"map",t,e,void 0,arguments)},pop(){return Sr(this,"pop")},push(...t){return Sr(this,"push",t)},reduce(t,...e){return iu(this,"reduce",t,e)},reduceRight(t,...e){return iu(this,"reduceRight",t,e)},shift(){return Sr(this,"shift")},some(t,e){return Ht(this,"some",t,e,void 0,arguments)},splice(...t){return Sr(this,"splice",t)},toReversed(){return Dn(this).toReversed()},toSorted(t){return Dn(this).toSorted(t)},toSpliced(...t){return Dn(this).toSpliced(...t)},unshift(...t){return Sr(this,"unshift",t)},values(){return Fo(this,"values",Be)}};function Fo(t,e,n){const r=Mi(t),i=r[e]();return r!==t&&!pt(t)&&(i._next=i.next,i.next=()=>{const s=i._next();return s.done||(s.value=n(s.value)),s}),i}const pv=Array.prototype;function Ht(t,e,n,r,i,s){const o=Mi(t),a=o!==t&&!pt(t),l=o[e];if(l!==pv[e]){const f=l.apply(t,s);return a?Be(f):f}let c=n;o!==t&&(a?c=function(f,p){return n.call(this,Be(f),p,t)}:n.length>2&&(c=function(f,p){return n.call(this,f,p,t)}));const u=l.call(o,c,r);return a&&i?i(u):u}function iu(t,e,n,r){const i=Mi(t);let s=n;return i!==t&&(pt(t)?n.length>3&&(s=function(o,a,l){return n.call(this,o,a,l,t)}):s=function(o,a,l){return n.call(this,o,Be(a),l,t)}),i[e](s,...r)}function Bo(t,e,n){const r=de(t);Ke(r,"iterate",xr);const i=r[e](...n);return(i===-1||i===!1)&&Ho(n[0])?(n[0]=de(n[0]),r[e](...n)):i}function Sr(t,e,n=[]){Tt(),Ro();const r=de(t)[e].apply(t,n);return No(),It(),r}const mv=So("__proto__,__v_isRef,__isVue"),su=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(en));function gv(t){en(t)||(t=String(t));const e=de(this);return Ke(e,"has",t),e.hasOwnProperty(t)}class ou{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,r){if(n==="__v_skip")return e.__v_skip;const i=this._isReadonly,s=this._isShallow;if(n==="__v_isReactive")return!i;if(n==="__v_isReadonly")return i;if(n==="__v_isShallow")return s;if(n==="__v_raw")return r===(i?s?du:fu:s?uu:cu).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=se(e);if(!i){let l;if(o&&(l=hv[n]))return l;if(n==="hasOwnProperty")return gv}const a=Reflect.get(e,n,Me(e)?e:r);if((en(n)?su.has(n):mv(n))||(i||Ke(e,"get",n),s))return a;if(Me(a)){const l=o&&Po(n)?a:a.value;return i&&Ee(l)?zo(l):l}return Ee(a)?i?zo(a):qo(a):a}}class au extends ou{constructor(e=!1){super(!1,e)}set(e,n,r,i){let s=e[n];if(!this._isShallow){const l=nn(s);if(!pt(r)&&!nn(r)&&(s=de(s),r=de(r)),!se(e)&&Me(s)&&!Me(r))return l||(s.value=r),!0}const o=se(e)&&Po(n)?Number(n)<e.length:ve(e,n),a=Reflect.set(e,n,r,Me(e)?e:i);return e===de(i)&&(o?nt(r,s)&&zt(e,"set",n,r):zt(e,"add",n,r)),a}deleteProperty(e,n){const r=ve(e,n);e[n];const i=Reflect.deleteProperty(e,n);return i&&r&&zt(e,"delete",n,void 0),i}has(e,n){const r=Reflect.has(e,n);return(!en(n)||!su.has(n))&&Ke(e,"has",n),r}ownKeys(e){return Ke(e,"iterate",se(e)?"length":vn),Reflect.ownKeys(e)}}class lu extends ou{constructor(e=!1){super(!0,e)}set(e,n){return!0}deleteProperty(e,n){return!0}}const vv=new au,yv=new lu,bv=new au(!0),wv=new lu(!0),Uo=t=>t,ji=t=>Reflect.getPrototypeOf(t);function _v(t,e,n){return function(...r){const i=this.__v_raw,s=de(i),o=Nn(s),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=i[t](...r),u=n?Uo:e?qi:Be;return!e&&Ke(s,"iterate",l?jo:vn),{next(){const{value:f,done:p}=c.next();return p?{value:f,done:p}:{value:a?[u(f[0]),u(f[1])]:u(f),done:p}},[Symbol.iterator](){return this}}}}function Fi(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function xv(t,e){const n={get(i){const s=this.__v_raw,o=de(s),a=de(i);t||(nt(i,a)&&Ke(o,"get",i),Ke(o,"get",a));const{has:l}=ji(o),c=e?Uo:t?qi:Be;if(l.call(o,i))return c(s.get(i));if(l.call(o,a))return c(s.get(a));s!==o&&s.get(i)},get size(){const i=this.__v_raw;return!t&&Ke(de(i),"iterate",vn),i.size},has(i){const s=this.__v_raw,o=de(s),a=de(i);return t||(nt(i,a)&&Ke(o,"has",i),Ke(o,"has",a)),i===a?s.has(i):s.has(i)||s.has(a)},forEach(i,s){const o=this,a=o.__v_raw,l=de(a),c=e?Uo:t?qi:Be;return!t&&Ke(l,"iterate",vn),a.forEach((u,f)=>i.call(s,c(u),c(f),o))}};return Fe(n,t?{add:Fi("add"),set:Fi("set"),delete:Fi("delete"),clear:Fi("clear")}:{add(i){!e&&!pt(i)&&!nn(i)&&(i=de(i));const s=de(this);return ji(s).has.call(s,i)||(s.add(i),zt(s,"add",i,i)),this},set(i,s){!e&&!pt(s)&&!nn(s)&&(s=de(s));const o=de(this),{has:a,get:l}=ji(o);let c=a.call(o,i);c||(i=de(i),c=a.call(o,i));const u=l.call(o,i);return o.set(i,s),c?nt(s,u)&&zt(o,"set",i,s):zt(o,"add",i,s),this},delete(i){const s=de(this),{has:o,get:a}=ji(s);let l=o.call(s,i);l||(i=de(i),l=o.call(s,i)),a&&a.call(s,i);const c=s.delete(i);return l&&zt(s,"delete",i,void 0),c},clear(){const i=de(this),s=i.size!==0,o=i.clear();return s&&zt(i,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(i=>{n[i]=_v(i,t,e)}),n}function Bi(t,e){const n=xv(t,e);return(r,i,s)=>i==="__v_isReactive"?!t:i==="__v_isReadonly"?t:i==="__v_raw"?r:Reflect.get(ve(n,i)&&i in r?n:r,i,s)}const Sv={get:Bi(!1,!1)},Ev={get:Bi(!1,!0)},kv={get:Bi(!0,!1)},Pv={get:Bi(!0,!0)},cu=new WeakMap,uu=new WeakMap,fu=new WeakMap,du=new WeakMap;function $v(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Cv(t){return t.__v_skip||!Object.isExtensible(t)?0:$v(ev(t))}function qo(t){return nn(t)?t:Ui(t,!1,vv,Sv,cu)}function Tv(t){return Ui(t,!1,bv,Ev,uu)}function zo(t){return Ui(t,!0,yv,kv,fu)}function Hw(t){return Ui(t,!0,wv,Pv,du)}function Ui(t,e,n,r,i){if(!Ee(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const s=Cv(t);if(s===0)return t;const o=i.get(t);if(o)return o;const a=new Proxy(t,s===2?r:n);return i.set(t,a),a}function Ln(t){return nn(t)?Ln(t.__v_raw):!!(t&&t.__v_isReactive)}function nn(t){return!!(t&&t.__v_isReadonly)}function pt(t){return!!(t&&t.__v_isShallow)}function Ho(t){return t?!!t.__v_raw:!1}function de(t){const e=t&&t.__v_raw;return e?de(e):t}function Iv(t){return!ve(t,"__v_skip")&&Object.isExtensible(t)&&Hc(t,"__v_skip",!0),t}const Be=t=>Ee(t)?qo(t):t,qi=t=>Ee(t)?zo(t):t;function Me(t){return t?t.__v_isRef===!0:!1}function hu(t){return pu(t,!1)}function zi(t){return pu(t,!0)}function pu(t,e){return Me(t)?t:new Av(t,e)}class Av{constructor(e,n){this.dep=new Li,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?e:de(e),this._value=n?e:Be(e),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(e){const n=this._rawValue,r=this.__v_isShallow||pt(e)||nn(e);e=r?e:de(e),nt(e,n)&&(this._rawValue=e,this._value=r?e:Be(e),this.dep.trigger())}}function mu(t){return Me(t)?t.value:t}const Ov={get:(t,e,n)=>e==="__v_raw"?t:mu(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const i=t[e];return Me(i)&&!Me(n)?(i.value=n,!0):Reflect.set(t,e,n,r)}};function gu(t){return Ln(t)?t:new Proxy(t,Ov)}class Rv{constructor(e){this.__v_isRef=!0,this._value=void 0;const n=this.dep=new Li,{get:r,set:i}=e(n.track.bind(n),n.trigger.bind(n));this._get=r,this._set=i}get value(){return this._value=this._get()}set value(e){this._set(e)}}function Nv(t){return new Rv(t)}class Dv{constructor(e,n,r){this.fn=e,this.setter=n,this._value=void 0,this.dep=new Li(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=_r-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Se!==this)return Jc(this,!0),!0}get value(){const e=this.dep.track();return eu(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Lv(t,e,n=!1){let r,i;return oe(t)?r=t:(r=t.get,i=t.set),new Dv(r,i,n)}const Hi={},Wi=new WeakMap;let yn;function Mv(t,e=!1,n=yn){if(n){let r=Wi.get(n);r||Wi.set(n,r=[]),r.push(t)}}function jv(t,e,n=pe){const{immediate:r,deep:i,once:s,scheduler:o,augmentJob:a,call:l}=n,c=m=>i?m:pt(m)||i===!1||i===0?rn(m,1):rn(m);let u,f,p,v,b=!1,I=!1;if(Me(t)?(f=()=>t.value,b=pt(t)):Ln(t)?(f=()=>c(t),b=!0):se(t)?(I=!0,b=t.some(m=>Ln(m)||pt(m)),f=()=>t.map(m=>{if(Me(m))return m.value;if(Ln(m))return c(m);if(oe(m))return l?l(m,2):m()})):oe(t)?e?f=l?()=>l(t,2):t:f=()=>{if(p){Tt();try{p()}finally{It()}}const m=yn;yn=u;try{return l?l(t,3,[v]):t(v)}finally{yn=m}}:f=Ct,e&&i){const m=f,h=i===!0?1/0:i;f=()=>rn(m(),h)}const B=uv(),D=()=>{u.stop(),B&&B.active&&ko(B.effects,u)};if(s&&e){const m=e;e=(...h)=>{m(...h),D()}}let A=I?new Array(t.length).fill(Hi):Hi;const y=m=>{if(!(!(u.flags&1)||!u.dirty&&!m))if(e){const h=u.run();if(i||b||(I?h.some((S,T)=>nt(S,A[T])):nt(h,A))){p&&p();const S=yn;yn=u;try{const T=[h,A===Hi?void 0:I&&A[0]===Hi?[]:A,v];A=h,l?l(e,3,T):e(...T)}finally{yn=S}}}else u.run()};return a&&a(y),u=new Gc(f),u.scheduler=o?()=>o(y,!1):y,v=m=>Mv(m,!1,u),p=u.onStop=()=>{const m=Wi.get(u);if(m){if(l)l(m,4);else for(const h of m)h();Wi.delete(u)}},e?r?y(!0):A=u.run():o?o(y.bind(null,!0),!0):u.run(),D.pause=u.pause.bind(u),D.resume=u.resume.bind(u),D.stop=D,D}function rn(t,e=1/0,n){if(e<=0||!Ee(t)||t.__v_skip||(n=n||new Map,(n.get(t)||0)>=e))return t;if(n.set(t,e),e--,Me(t))rn(t.value,e,n);else if(se(t))for(let r=0;r<t.length;r++)rn(t[r],e,n);else if(Fc(t)||Nn(t))t.forEach(r=>{rn(r,e,n)});else if(qc(t)){for(const r in t)rn(t[r],e,n);for(const r of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,r)&&rn(t[r],e,n)}return t}/**
97
+ **/let rt;class cv{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=rt,!e&&rt&&(this.index=(rt.scopes||(rt.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].pause();for(e=0,n=this.effects.length;e<n;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].resume();for(e=0,n=this.effects.length;e<n;e++)this.effects[e].resume()}}run(e){if(this._active){const n=rt;try{return rt=this,e()}finally{rt=n}}}on(){++this._on===1&&(this.prevScope=rt,rt=this)}off(){this._on>0&&--this._on===0&&(rt=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const i=this.parent.scopes.pop();i&&i!==this&&(this.parent.scopes[this.index]=i,i.index=this.index)}this.parent=void 0}}}function uv(){return rt}let Se;const Ao=new WeakSet;class Gc{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,rt&&rt.active&&rt.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Ao.has(this)&&(Ao.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Jc(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,nu(this),Xc(this);const e=Se,n=_t;Se=this,_t=!0;try{return this.fn()}finally{Zc(this),Se=e,_t=n,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Lo(e);this.deps=this.depsTail=void 0,nu(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Ao.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Do(this)&&this.run()}get dirty(){return Do(this)}}let Qc=0,br,wr;function Jc(t,e=!1){if(t.flags|=8,e){t.next=wr,wr=t;return}t.next=br,br=t}function Ro(){Qc++}function No(){if(--Qc>0)return;if(wr){let e=wr;for(wr=void 0;e;){const n=e.next;e.next=void 0,e.flags&=-9,e=n}}let t;for(;br;){let e=br;for(br=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=n}}if(t)throw t}function Xc(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Zc(t){let e,n=t.depsTail,r=n;for(;r;){const i=r.prevDep;r.version===-1?(r===n&&(n=i),Lo(r),fv(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}t.deps=e,t.depsTail=n}function Do(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(eu(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function eu(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===_r)||(t.globalVersion=_r,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Do(t))))return;t.flags|=2;const e=t.dep,n=Se,r=_t;Se=t,_t=!0;try{Xc(t);const i=t.fn(t._value);(e.version===0||nt(i,t._value))&&(t.flags|=128,t._value=i,e.version++)}catch(i){throw e.version++,i}finally{Se=n,_t=r,Zc(t),t.flags&=-3}}function Lo(t,e=!1){const{dep:n,prevSub:r,nextSub:i}=t;if(r&&(r.nextSub=i,t.prevSub=void 0),i&&(i.prevSub=r,t.nextSub=void 0),n.subs===t&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let s=n.computed.deps;s;s=s.nextDep)Lo(s,!0)}!e&&!--n.sc&&n.map&&n.map.delete(n.key)}function fv(t){const{prevDep:e,nextDep:n}=t;e&&(e.nextDep=n,t.prevDep=void 0),n&&(n.prevDep=e,t.nextDep=void 0)}let _t=!0;const tu=[];function Tt(){tu.push(_t),_t=!1}function It(){const t=tu.pop();_t=t===void 0?!0:t}function nu(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const n=Se;Se=void 0;try{e()}finally{Se=n}}}let _r=0;class dv{constructor(e,n){this.sub=e,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Mi{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Se||!_t||Se===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Se)n=this.activeLink=new dv(Se,this),Se.deps?(n.prevDep=Se.depsTail,Se.depsTail.nextDep=n,Se.depsTail=n):Se.deps=Se.depsTail=n,ru(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=Se.depsTail,n.nextDep=void 0,Se.depsTail.nextDep=n,Se.depsTail=n,Se.deps===n&&(Se.deps=r)}return n}trigger(e){this.version++,_r++,this.notify(e)}notify(e){Ro();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{No()}}}function ru(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)ru(r)}const n=t.dep.subs;n!==t&&(t.prevSub=n,n&&(n.nextSub=t)),t.dep.subs=t}}const Mo=new WeakMap,vn=Symbol(""),jo=Symbol(""),xr=Symbol("");function Ke(t,e,n){if(_t&&Se){let r=Mo.get(t);r||Mo.set(t,r=new Map);let i=r.get(n);i||(r.set(n,i=new Mi),i.map=r,i.key=n),i.track()}}function zt(t,e,n,r,i,s){const o=Mo.get(t);if(!o){_r++;return}const a=l=>{l&&l.trigger()};if(Ro(),e==="clear")o.forEach(a);else{const l=se(t),c=l&&Po(n);if(l&&n==="length"){const u=Number(r);o.forEach((f,y)=>{(y==="length"||y===xr||!en(y)&&y>=u)&&a(f)})}else switch((n!==void 0||o.has(void 0))&&a(o.get(n)),c&&a(o.get(xr)),e){case"add":l?c&&a(o.get("length")):(a(o.get(vn)),Nn(t)&&a(o.get(jo)));break;case"delete":l||(a(o.get(vn)),Nn(t)&&a(o.get(jo)));break;case"set":Nn(t)&&a(o.get(vn));break}}No()}function Dn(t){const e=de(t);return e===t?e:(Ke(e,"iterate",xr),pt(t)?e:e.map(Be))}function ji(t){return Ke(t=de(t),"iterate",xr),t}const hv={__proto__:null,[Symbol.iterator](){return Fo(this,Symbol.iterator,Be)},concat(...t){return Dn(this).concat(...t.map(e=>se(e)?Dn(e):e))},entries(){return Fo(this,"entries",t=>(t[1]=Be(t[1]),t))},every(t,e){return Ht(this,"every",t,e,void 0,arguments)},filter(t,e){return Ht(this,"filter",t,e,n=>n.map(Be),arguments)},find(t,e){return Ht(this,"find",t,e,Be,arguments)},findIndex(t,e){return Ht(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Ht(this,"findLast",t,e,Be,arguments)},findLastIndex(t,e){return Ht(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Ht(this,"forEach",t,e,void 0,arguments)},includes(...t){return Bo(this,"includes",t)},indexOf(...t){return Bo(this,"indexOf",t)},join(t){return Dn(this).join(t)},lastIndexOf(...t){return Bo(this,"lastIndexOf",t)},map(t,e){return Ht(this,"map",t,e,void 0,arguments)},pop(){return Sr(this,"pop")},push(...t){return Sr(this,"push",t)},reduce(t,...e){return iu(this,"reduce",t,e)},reduceRight(t,...e){return iu(this,"reduceRight",t,e)},shift(){return Sr(this,"shift")},some(t,e){return Ht(this,"some",t,e,void 0,arguments)},splice(...t){return Sr(this,"splice",t)},toReversed(){return Dn(this).toReversed()},toSorted(t){return Dn(this).toSorted(t)},toSpliced(...t){return Dn(this).toSpliced(...t)},unshift(...t){return Sr(this,"unshift",t)},values(){return Fo(this,"values",Be)}};function Fo(t,e,n){const r=ji(t),i=r[e]();return r!==t&&!pt(t)&&(i._next=i.next,i.next=()=>{const s=i._next();return s.done||(s.value=n(s.value)),s}),i}const pv=Array.prototype;function Ht(t,e,n,r,i,s){const o=ji(t),a=o!==t&&!pt(t),l=o[e];if(l!==pv[e]){const f=l.apply(t,s);return a?Be(f):f}let c=n;o!==t&&(a?c=function(f,y){return n.call(this,Be(f),y,t)}:n.length>2&&(c=function(f,y){return n.call(this,f,y,t)}));const u=l.call(o,c,r);return a&&i?i(u):u}function iu(t,e,n,r){const i=ji(t);let s=n;return i!==t&&(pt(t)?n.length>3&&(s=function(o,a,l){return n.call(this,o,a,l,t)}):s=function(o,a,l){return n.call(this,o,Be(a),l,t)}),i[e](s,...r)}function Bo(t,e,n){const r=de(t);Ke(r,"iterate",xr);const i=r[e](...n);return(i===-1||i===!1)&&Ho(n[0])?(n[0]=de(n[0]),r[e](...n)):i}function Sr(t,e,n=[]){Tt(),Ro();const r=de(t)[e].apply(t,n);return No(),It(),r}const mv=So("__proto__,__v_isRef,__isVue"),su=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(en));function gv(t){en(t)||(t=String(t));const e=de(this);return Ke(e,"has",t),e.hasOwnProperty(t)}class ou{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,r){if(n==="__v_skip")return e.__v_skip;const i=this._isReadonly,s=this._isShallow;if(n==="__v_isReactive")return!i;if(n==="__v_isReadonly")return i;if(n==="__v_isShallow")return s;if(n==="__v_raw")return r===(i?s?du:fu:s?uu:cu).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=se(e);if(!i){let l;if(o&&(l=hv[n]))return l;if(n==="hasOwnProperty")return gv}const a=Reflect.get(e,n,Me(e)?e:r);if((en(n)?su.has(n):mv(n))||(i||Ke(e,"get",n),s))return a;if(Me(a)){const l=o&&Po(n)?a:a.value;return i&&Ee(l)?zo(l):l}return Ee(a)?i?zo(a):qo(a):a}}class au extends ou{constructor(e=!1){super(!1,e)}set(e,n,r,i){let s=e[n];if(!this._isShallow){const l=nn(s);if(!pt(r)&&!nn(r)&&(s=de(s),r=de(r)),!se(e)&&Me(s)&&!Me(r))return l||(s.value=r),!0}const o=se(e)&&Po(n)?Number(n)<e.length:ve(e,n),a=Reflect.set(e,n,r,Me(e)?e:i);return e===de(i)&&(o?nt(r,s)&&zt(e,"set",n,r):zt(e,"add",n,r)),a}deleteProperty(e,n){const r=ve(e,n);e[n];const i=Reflect.deleteProperty(e,n);return i&&r&&zt(e,"delete",n,void 0),i}has(e,n){const r=Reflect.has(e,n);return(!en(n)||!su.has(n))&&Ke(e,"has",n),r}ownKeys(e){return Ke(e,"iterate",se(e)?"length":vn),Reflect.ownKeys(e)}}class lu extends ou{constructor(e=!1){super(!0,e)}set(e,n){return!0}deleteProperty(e,n){return!0}}const vv=new au,yv=new lu,bv=new au(!0),wv=new lu(!0),Uo=t=>t,Fi=t=>Reflect.getPrototypeOf(t);function _v(t,e,n){return function(...r){const i=this.__v_raw,s=de(i),o=Nn(s),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=i[t](...r),u=n?Uo:e?zi:Be;return!e&&Ke(s,"iterate",l?jo:vn),{next(){const{value:f,done:y}=c.next();return y?{value:f,done:y}:{value:a?[u(f[0]),u(f[1])]:u(f),done:y}},[Symbol.iterator](){return this}}}}function Bi(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function xv(t,e){const n={get(i){const s=this.__v_raw,o=de(s),a=de(i);t||(nt(i,a)&&Ke(o,"get",i),Ke(o,"get",a));const{has:l}=Fi(o),c=e?Uo:t?zi:Be;if(l.call(o,i))return c(s.get(i));if(l.call(o,a))return c(s.get(a));s!==o&&s.get(i)},get size(){const i=this.__v_raw;return!t&&Ke(de(i),"iterate",vn),i.size},has(i){const s=this.__v_raw,o=de(s),a=de(i);return t||(nt(i,a)&&Ke(o,"has",i),Ke(o,"has",a)),i===a?s.has(i):s.has(i)||s.has(a)},forEach(i,s){const o=this,a=o.__v_raw,l=de(a),c=e?Uo:t?zi:Be;return!t&&Ke(l,"iterate",vn),a.forEach((u,f)=>i.call(s,c(u),c(f),o))}};return Fe(n,t?{add:Bi("add"),set:Bi("set"),delete:Bi("delete"),clear:Bi("clear")}:{add(i){!e&&!pt(i)&&!nn(i)&&(i=de(i));const s=de(this);return Fi(s).has.call(s,i)||(s.add(i),zt(s,"add",i,i)),this},set(i,s){!e&&!pt(s)&&!nn(s)&&(s=de(s));const o=de(this),{has:a,get:l}=Fi(o);let c=a.call(o,i);c||(i=de(i),c=a.call(o,i));const u=l.call(o,i);return o.set(i,s),c?nt(s,u)&&zt(o,"set",i,s):zt(o,"add",i,s),this},delete(i){const s=de(this),{has:o,get:a}=Fi(s);let l=o.call(s,i);l||(i=de(i),l=o.call(s,i)),a&&a.call(s,i);const c=s.delete(i);return l&&zt(s,"delete",i,void 0),c},clear(){const i=de(this),s=i.size!==0,o=i.clear();return s&&zt(i,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(i=>{n[i]=_v(i,t,e)}),n}function Ui(t,e){const n=xv(t,e);return(r,i,s)=>i==="__v_isReactive"?!t:i==="__v_isReadonly"?t:i==="__v_raw"?r:Reflect.get(ve(n,i)&&i in r?n:r,i,s)}const Sv={get:Ui(!1,!1)},Ev={get:Ui(!1,!0)},kv={get:Ui(!0,!1)},Pv={get:Ui(!0,!0)},cu=new WeakMap,uu=new WeakMap,fu=new WeakMap,du=new WeakMap;function $v(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Cv(t){return t.__v_skip||!Object.isExtensible(t)?0:$v(ev(t))}function qo(t){return nn(t)?t:qi(t,!1,vv,Sv,cu)}function Tv(t){return qi(t,!1,bv,Ev,uu)}function zo(t){return qi(t,!0,yv,kv,fu)}function Hw(t){return qi(t,!0,wv,Pv,du)}function qi(t,e,n,r,i){if(!Ee(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const s=Cv(t);if(s===0)return t;const o=i.get(t);if(o)return o;const a=new Proxy(t,s===2?r:n);return i.set(t,a),a}function Ln(t){return nn(t)?Ln(t.__v_raw):!!(t&&t.__v_isReactive)}function nn(t){return!!(t&&t.__v_isReadonly)}function pt(t){return!!(t&&t.__v_isShallow)}function Ho(t){return t?!!t.__v_raw:!1}function de(t){const e=t&&t.__v_raw;return e?de(e):t}function Iv(t){return!ve(t,"__v_skip")&&Object.isExtensible(t)&&Hc(t,"__v_skip",!0),t}const Be=t=>Ee(t)?qo(t):t,zi=t=>Ee(t)?zo(t):t;function Me(t){return t?t.__v_isRef===!0:!1}function hu(t){return pu(t,!1)}function Hi(t){return pu(t,!0)}function pu(t,e){return Me(t)?t:new Ov(t,e)}class Ov{constructor(e,n){this.dep=new Mi,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?e:de(e),this._value=n?e:Be(e),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(e){const n=this._rawValue,r=this.__v_isShallow||pt(e)||nn(e);e=r?e:de(e),nt(e,n)&&(this._rawValue=e,this._value=r?e:Be(e),this.dep.trigger())}}function mu(t){return Me(t)?t.value:t}const Av={get:(t,e,n)=>e==="__v_raw"?t:mu(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const i=t[e];return Me(i)&&!Me(n)?(i.value=n,!0):Reflect.set(t,e,n,r)}};function gu(t){return Ln(t)?t:new Proxy(t,Av)}class Rv{constructor(e){this.__v_isRef=!0,this._value=void 0;const n=this.dep=new Mi,{get:r,set:i}=e(n.track.bind(n),n.trigger.bind(n));this._get=r,this._set=i}get value(){return this._value=this._get()}set value(e){this._set(e)}}function Nv(t){return new Rv(t)}class Dv{constructor(e,n,r){this.fn=e,this.setter=n,this._value=void 0,this.dep=new Mi(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=_r-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Se!==this)return Jc(this,!0),!0}get value(){const e=this.dep.track();return eu(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Lv(t,e,n=!1){let r,i;return oe(t)?r=t:(r=t.get,i=t.set),new Dv(r,i,n)}const Wi={},Ki=new WeakMap;let yn;function Mv(t,e=!1,n=yn){if(n){let r=Ki.get(n);r||Ki.set(n,r=[]),r.push(t)}}function jv(t,e,n=me){const{immediate:r,deep:i,once:s,scheduler:o,augmentJob:a,call:l}=n,c=p=>i?p:pt(p)||i===!1||i===0?rn(p,1):rn(p);let u,f,y,v,b=!1,I=!1;if(Me(t)?(f=()=>t.value,b=pt(t)):Ln(t)?(f=()=>c(t),b=!0):se(t)?(I=!0,b=t.some(p=>Ln(p)||pt(p)),f=()=>t.map(p=>{if(Me(p))return p.value;if(Ln(p))return c(p);if(oe(p))return l?l(p,2):p()})):oe(t)?e?f=l?()=>l(t,2):t:f=()=>{if(y){Tt();try{y()}finally{It()}}const p=yn;yn=u;try{return l?l(t,3,[v]):t(v)}finally{yn=p}}:f=Ct,e&&i){const p=f,h=i===!0?1/0:i;f=()=>rn(p(),h)}const F=uv(),O=()=>{u.stop(),F&&F.active&&ko(F.effects,u)};if(s&&e){const p=e;e=(...h)=>{p(...h),O()}}let A=I?new Array(t.length).fill(Wi):Wi;const g=p=>{if(!(!(u.flags&1)||!u.dirty&&!p))if(e){const h=u.run();if(i||b||(I?h.some((S,T)=>nt(S,A[T])):nt(h,A))){y&&y();const S=yn;yn=u;try{const T=[h,A===Wi?void 0:I&&A[0]===Wi?[]:A,v];A=h,l?l(e,3,T):e(...T)}finally{yn=S}}}else u.run()};return a&&a(g),u=new Gc(f),u.scheduler=o?()=>o(g,!1):g,v=p=>Mv(p,!1,u),y=u.onStop=()=>{const p=Ki.get(u);if(p){if(l)l(p,4);else for(const h of p)h();Ki.delete(u)}},e?r?g(!0):A=u.run():o?o(g.bind(null,!0),!0):u.run(),O.pause=u.pause.bind(u),O.resume=u.resume.bind(u),O.stop=O,O}function rn(t,e=1/0,n){if(e<=0||!Ee(t)||t.__v_skip||(n=n||new Map,(n.get(t)||0)>=e))return t;if(n.set(t,e),e--,Me(t))rn(t.value,e,n);else if(se(t))for(let r=0;r<t.length;r++)rn(t[r],e,n);else if(Fc(t)||Nn(t))t.forEach(r=>{rn(r,e,n)});else if(qc(t)){for(const r in t)rn(t[r],e,n);for(const r of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,r)&&rn(t[r],e,n)}return t}/**
96
98
  * @vue/runtime-core v3.5.22
97
99
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
98
100
  * @license MIT
99
101
  **/const Er=[];let Wo=!1;function Ww(t,...e){if(Wo)return;Wo=!0,Tt();const n=Er.length?Er[Er.length-1].component:null,r=n&&n.appContext.config.warnHandler,i=Fv();if(r)Mn(r,n,11,[t+e.map(s=>{var o,a;return(a=(o=s.toString)==null?void 0:o.call(s))!=null?a:JSON.stringify(s)}).join(""),n&&n.proxy,i.map(({vnode:s})=>`at <${gf(n,s.type)}>`).join(`
100
102
  `),i]);else{const s=[`[Vue warn]: ${t}`,...e];i.length&&s.push(`
101
103
  `,...Bv(i))}It(),Wo=!1}function Fv(){let t=Er[Er.length-1];if(!t)return[];const e=[];for(;t;){const n=e[0];n&&n.vnode===t?n.recurseCount++:e.push({vnode:t,recurseCount:0});const r=t.component&&t.component.parent;t=r&&r.vnode}return e}function Bv(t){const e=[];return t.forEach((n,r)=>{e.push(...r===0?[]:[`
102
- `],...Uv(n))}),e}function Uv({vnode:t,recurseCount:e}){const n=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,i=` at <${gf(t.component,t.type,r)}`,s=">"+n;return t.props?[i,...qv(t.props),s]:[i+s]}function qv(t){const e=[],n=Object.keys(t);return n.slice(0,3).forEach(r=>{e.push(...vu(r,t[r]))}),n.length>3&&e.push(" ..."),e}function vu(t,e,n){return Ce(e)?(e=JSON.stringify(e),n?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?n?e:[`${t}=${e}`]:Me(e)?(e=vu(t,de(e.value),!0),n?e:[`${t}=Ref<`,e,">"]):oe(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=de(e),n?e:[`${t}=`,e])}function Mn(t,e,n,r){try{return r?t(...r):t()}catch(i){Ki(i,e,n)}}function At(t,e,n,r){if(oe(t)){const i=Mn(t,e,n,r);return i&&Bc(i)&&i.catch(s=>{Ki(s,e,n)}),i}if(se(t)){const i=[];for(let s=0;s<t.length;s++)i.push(At(t[s],e,n,r));return i}}function Ki(t,e,n,r=!0){const i=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||pe;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const u=a.ec;if(u){for(let f=0;f<u.length;f++)if(u[f](t,l,c)===!1)return}a=a.parent}if(s){Tt(),Mn(s,null,10,[t,l,c]),It();return}}zv(t,n,i,r,o)}function zv(t,e,n,r=!0,i=!1){if(i)throw t}const Ge=[];let Ot=-1;const jn=[];let sn=null,Fn=0;const yu=Promise.resolve();let Vi=null;function Yi(t){const e=Vi||yu;return t?e.then(this?t.bind(this):t):e}function Hv(t){let e=Ot+1,n=Ge.length;for(;e<n;){const r=e+n>>>1,i=Ge[r],s=kr(i);s<t||s===t&&i.flags&2?e=r+1:n=r}return e}function Ko(t){if(!(t.flags&1)){const e=kr(t),n=Ge[Ge.length-1];!n||!(t.flags&2)&&e>=kr(n)?Ge.push(t):Ge.splice(Hv(e),0,t),t.flags|=1,bu()}}function bu(){Vi||(Vi=yu.then(xu))}function Wv(t){se(t)?jn.push(...t):sn&&t.id===-1?sn.splice(Fn+1,0,t):t.flags&1||(jn.push(t),t.flags|=1),bu()}function wu(t,e,n=Ot+1){for(;n<Ge.length;n++){const r=Ge[n];if(r&&r.flags&2){if(t&&r.id!==t.uid)continue;Ge.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function _u(t){if(jn.length){const e=[...new Set(jn)].sort((n,r)=>kr(n)-kr(r));if(jn.length=0,sn){sn.push(...e);return}for(sn=e,Fn=0;Fn<sn.length;Fn++){const n=sn[Fn];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}sn=null,Fn=0}}const kr=t=>t.id==null?t.flags&2?-1:1/0:t.id;function xu(t){try{for(Ot=0;Ot<Ge.length;Ot++){const e=Ge[Ot];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Mn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Ot<Ge.length;Ot++){const e=Ge[Ot];e&&(e.flags&=-2)}Ot=-1,Ge.length=0,_u(),Vi=null,(Ge.length||jn.length)&&xu()}}let Rt=null,Su=null;function Gi(t){const e=Rt;return Rt=t,Su=t&&t.type.__scopeId||null,e}function Kv(t,e=Rt,n){if(!e||t._n)return t;const r=(...i)=>{r._d&&af(-1);const s=Gi(e);let o;try{o=t(...i)}finally{Gi(s),r._d&&af(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function bn(t,e,n,r){const i=t.dirs,s=e&&e.dirs;for(let o=0;o<i.length;o++){const a=i[o];s&&(a.oldValue=s[o].value);let l=a.dir[r];l&&(Tt(),At(l,n,8,[t.el,a,t,e]),It())}}const Vv=Symbol("_vte"),Yv=t=>t.__isTeleport,Gv=Symbol("_leaveCb");function Vo(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Vo(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function Eu(t,e){return oe(t)?Fe({name:t.name},e,{setup:t}):t}function ku(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Qv(t){const e=oa(),n=zi(null);if(e){const i=e.refs===pe?e.refs={}:e.refs;Object.defineProperty(i,t,{enumerable:!0,get:()=>n.value,set:s=>n.value=s})}return n}const Qi=new WeakMap;function Pr(t,e,n,r,i=!1){if(se(t)){t.forEach((b,I)=>Pr(b,e&&(se(e)?e[I]:e),n,r,i));return}if($r(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Pr(t,e,n,r.component.subTree);return}const s=r.shapeFlag&4?la(r.component):r.el,o=i?null:s,{i:a,r:l}=t,c=e&&e.r,u=a.refs===pe?a.refs={}:a.refs,f=a.setupState,p=de(f),v=f===pe?jc:b=>ve(p,b);if(c!=null&&c!==l){if(Pu(e),Ce(c))u[c]=null,v(c)&&(f[c]=null);else if(Me(c)){c.value=null;const b=e;b.k&&(u[b.k]=null)}}if(oe(l))Mn(l,a,12,[o,u]);else{const b=Ce(l),I=Me(l);if(b||I){const B=()=>{if(t.f){const D=b?v(l)?f[l]:u[l]:l.value;if(i)se(D)&&ko(D,s);else if(se(D))D.includes(s)||D.push(s);else if(b)u[l]=[s],v(l)&&(f[l]=u[l]);else{const A=[s];l.value=A,t.k&&(u[t.k]=A)}}else b?(u[l]=o,v(l)&&(f[l]=o)):I&&(l.value=o,t.k&&(u[t.k]=o))};if(o){const D=()=>{B(),Qi.delete(t)};D.id=-1,Qi.set(t,D),at(D,n)}else Pu(t),B()}}}function Pu(t){const e=Qi.get(t);e&&(e.flags|=8,Qi.delete(t))}Ni().requestIdleCallback,Ni().cancelIdleCallback;const $r=t=>!!t.type.__asyncLoader,$u=t=>t.type.__isKeepAlive;function Jv(t,e){Cu(t,"a",e)}function Xv(t,e){Cu(t,"da",e)}function Cu(t,e,n=Je){const r=t.__wdc||(t.__wdc=()=>{let i=n;for(;i;){if(i.isDeactivated)return;i=i.parent}return t()});if(Ji(e,r,n),n){let i=n.parent;for(;i&&i.parent;)$u(i.parent.vnode)&&Zv(r,e,n,i),i=i.parent}}function Zv(t,e,n,r){const i=Ji(e,t,r,!0);Au(()=>{ko(r[e],i)},n)}function Ji(t,e,n=Je,r=!1){if(n){const i=n[t]||(n[t]=[]),s=e.__weh||(e.__weh=(...o)=>{Tt();const a=Lr(n),l=At(e,n,t,o);return a(),It(),l});return r?i.unshift(s):i.push(s),s}}const Wt=t=>(e,n=Je)=>{(!Mr||t==="sp")&&Ji(t,(...r)=>e(...r),n)},Tu=Wt("bm"),Yo=Wt("m"),ey=Wt("bu"),ty=Wt("u"),Iu=Wt("bum"),Au=Wt("um"),ny=Wt("sp"),ry=Wt("rtg"),iy=Wt("rtc");function sy(t,e=Je){Ji("ec",t,e)}const oy=Symbol.for("v-ndc");function Ou(t,e,n,r){let i;const s=n,o=se(t);if(o||Ce(t)){const a=o&&Ln(t);let l=!1,c=!1;a&&(l=!pt(t),c=nn(t),t=Mi(t)),i=new Array(t.length);for(let u=0,f=t.length;u<f;u++)i[u]=e(l?c?qi(Be(t[u])):Be(t[u]):t[u],u,void 0,s)}else if(typeof t=="number"){i=new Array(t);for(let a=0;a<t;a++)i[a]=e(a+1,a,void 0,s)}else if(Ee(t))if(t[Symbol.iterator])i=Array.from(t,(a,l)=>e(a,l,void 0,s));else{const a=Object.keys(t);i=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];i[l]=e(t[u],u,l,s)}}else i=[];return i}const Go=t=>t?hf(t)?la(t):Go(t.parent):null,Cr=Fe(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Go(t.parent),$root:t=>Go(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Lu(t),$forceUpdate:t=>t.f||(t.f=()=>{Ko(t.update)}),$nextTick:t=>t.n||(t.n=Yi.bind(t.proxy)),$watch:t=>Cy.bind(t)}),Qo=(t,e)=>t!==pe&&!t.__isScriptSetup&&ve(t,e),ay={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:n,setupState:r,data:i,props:s,accessCache:o,type:a,appContext:l}=t;let c;if(e[0]!=="$"){const v=o[e];if(v!==void 0)switch(v){case 1:return r[e];case 2:return i[e];case 4:return n[e];case 3:return s[e]}else{if(Qo(r,e))return o[e]=1,r[e];if(i!==pe&&ve(i,e))return o[e]=2,i[e];if((c=t.propsOptions[0])&&ve(c,e))return o[e]=3,s[e];if(n!==pe&&ve(n,e))return o[e]=4,n[e];Jo&&(o[e]=0)}}const u=Cr[e];let f,p;if(u)return e==="$attrs"&&Ke(t.attrs,"get",""),u(t);if((f=a.__cssModules)&&(f=f[e]))return f;if(n!==pe&&ve(n,e))return o[e]=4,n[e];if(p=l.config.globalProperties,ve(p,e))return p[e]},set({_:t},e,n){const{data:r,setupState:i,ctx:s}=t;return Qo(i,e)?(i[e]=n,!0):r!==pe&&ve(r,e)?(r[e]=n,!0):ve(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(s[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:r,appContext:i,propsOptions:s,type:o}},a){let l,c;return!!(n[a]||t!==pe&&a[0]!=="$"&&ve(t,a)||Qo(e,a)||(l=s[0])&&ve(l,a)||ve(r,a)||ve(Cr,a)||ve(i.config.globalProperties,a)||(c=o.__cssModules)&&c[a])},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:ve(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};function Xi(t){return se(t)?t.reduce((e,n)=>(e[n]=null,e),{}):t}function Ru(t,e){return!t||!e?t||e:se(t)&&se(e)?t.concat(e):Fe({},Xi(t),Xi(e))}let Jo=!0;function ly(t){const e=Lu(t),n=t.proxy,r=t.ctx;Jo=!1,e.beforeCreate&&Nu(e.beforeCreate,t,"bc");const{data:i,computed:s,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:f,mounted:p,beforeUpdate:v,updated:b,activated:I,deactivated:B,beforeDestroy:D,beforeUnmount:A,destroyed:y,unmounted:m,render:h,renderTracked:S,renderTriggered:T,errorCaptured:R,serverPrefetch:H,expose:X,inheritAttrs:Te,components:De,directives:it,filters:Vt}=e;if(c&&cy(c,r,null),o)for(const ye in o){const we=o[ye];oe(we)&&(r[ye]=we.bind(n))}if(i){const ye=i.call(n,n);Ee(ye)&&(t.data=qo(ye))}if(Jo=!0,s)for(const ye in s){const we=s[ye],Yt=oe(we)?we.bind(n,n):oe(we.get)?we.get.bind(n,n):Ct,Zn=!oe(we)&&oe(we.set)?we.set.bind(n):Ct,Ue=vf({get:Yt,set:Zn});Object.defineProperty(r,ye,{enumerable:!0,configurable:!0,get:()=>Ue.value,set:ut=>Ue.value=ut})}if(a)for(const ye in a)Du(a[ye],r,n,ye);if(l){const ye=oe(l)?l.call(n):l;Reflect.ownKeys(ye).forEach(we=>{Bu(we,ye[we])})}u&&Nu(u,t,"c");function Le(ye,we){se(we)?we.forEach(Yt=>ye(Yt.bind(n))):we&&ye(we.bind(n))}if(Le(Tu,f),Le(Yo,p),Le(ey,v),Le(ty,b),Le(Jv,I),Le(Xv,B),Le(sy,R),Le(iy,S),Le(ry,T),Le(Iu,A),Le(Au,m),Le(ny,H),se(X))if(X.length){const ye=t.exposed||(t.exposed={});X.forEach(we=>{Object.defineProperty(ye,we,{get:()=>n[we],set:Yt=>n[we]=Yt,enumerable:!0})})}else t.exposed||(t.exposed={});h&&t.render===Ct&&(t.render=h),Te!=null&&(t.inheritAttrs=Te),De&&(t.components=De),it&&(t.directives=it),H&&ku(t)}function cy(t,e,n=Ct){se(t)&&(t=Xo(t));for(const r in t){const i=t[r];let s;Ee(i)?"default"in i?s=Ir(i.from||r,i.default,!0):s=Ir(i.from||r):s=Ir(i),Me(s)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[r]=s}}function Nu(t,e,n){At(se(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,n)}function Du(t,e,n,r){let i=r.includes(".")?Zu(n,r):()=>n[r];if(Ce(t)){const s=e[t];oe(s)&&Un(i,s)}else if(oe(t))Un(i,t.bind(n));else if(Ee(t))if(se(t))t.forEach(s=>Du(s,e,n,r));else{const s=oe(t.handler)?t.handler.bind(n):e[t.handler];oe(s)&&Un(i,s,t)}}function Lu(t){const e=t.type,{mixins:n,extends:r}=e,{mixins:i,optionsCache:s,config:{optionMergeStrategies:o}}=t.appContext,a=s.get(e);let l;return a?l=a:!i.length&&!n&&!r?l=e:(l={},i.length&&i.forEach(c=>Zi(l,c,o,!0)),Zi(l,e,o)),Ee(e)&&s.set(e,l),l}function Zi(t,e,n,r=!1){const{mixins:i,extends:s}=e;s&&Zi(t,s,n,!0),i&&i.forEach(o=>Zi(t,o,n,!0));for(const o in e)if(!(r&&o==="expose")){const a=uy[o]||n&&n[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const uy={data:Mu,props:ju,emits:ju,methods:Tr,computed:Tr,beforeCreate:Qe,created:Qe,beforeMount:Qe,mounted:Qe,beforeUpdate:Qe,updated:Qe,beforeDestroy:Qe,beforeUnmount:Qe,destroyed:Qe,unmounted:Qe,activated:Qe,deactivated:Qe,errorCaptured:Qe,serverPrefetch:Qe,components:Tr,directives:Tr,watch:dy,provide:Mu,inject:fy};function Mu(t,e){return e?t?function(){return Fe(oe(t)?t.call(this,this):t,oe(e)?e.call(this,this):e)}:e:t}function fy(t,e){return Tr(Xo(t),Xo(e))}function Xo(t){if(se(t)){const e={};for(let n=0;n<t.length;n++)e[t[n]]=t[n];return e}return t}function Qe(t,e){return t?[...new Set([].concat(t,e))]:e}function Tr(t,e){return t?Fe(Object.create(null),t,e):e}function ju(t,e){return t?se(t)&&se(e)?[...new Set([...t,...e])]:Fe(Object.create(null),Xi(t),Xi(e??{})):e}function dy(t,e){if(!t)return e;if(!e)return t;const n=Fe(Object.create(null),t);for(const r in e)n[r]=Qe(t[r],e[r]);return n}function Fu(){return{app:null,config:{isNativeTag:jc,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let hy=0;function py(t,e){return function(r,i=null){oe(r)||(r=Fe({},r)),i!=null&&!Ee(i)&&(i=null);const s=Fu(),o=new WeakSet,a=[];let l=!1;const c=s.app={_uid:hy++,_component:r,_props:i,_container:null,_context:s,_instance:null,version:Xy,get config(){return s.config},set config(u){},use(u,...f){return o.has(u)||(u&&oe(u.install)?(o.add(u),u.install(c,...f)):oe(u)&&(o.add(u),u(c,...f))),c},mixin(u){return s.mixins.includes(u)||s.mixins.push(u),c},component(u,f){return f?(s.components[u]=f,c):s.components[u]},directive(u,f){return f?(s.directives[u]=f,c):s.directives[u]},mount(u,f,p){if(!l){const v=c._ceVNode||on(r,i);return v.appContext=s,p===!0?p="svg":p===!1&&(p=void 0),t(v,u,p),l=!0,c._container=u,u.__vue_app__=c,la(v.component)}},onUnmount(u){a.push(u)},unmount(){l&&(At(a,c._instance,16),t(null,c._container),delete c._container.__vue_app__)},provide(u,f){return s.provides[u]=f,c},runWithContext(u){const f=Bn;Bn=c;try{return u()}finally{Bn=f}}};return c}}let Bn=null;function Bu(t,e){if(Je){let n=Je.provides;const r=Je.parent&&Je.parent.provides;r===n&&(n=Je.provides=Object.create(r)),n[t]=e}}function Ir(t,e,n=!1){const r=oa();if(r||Bn){let i=Bn?Bn._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&t in i)return i[t];if(arguments.length>1)return n&&oe(e)?e.call(r&&r.proxy):e}}const Uu={},qu=()=>Object.create(Uu),zu=t=>Object.getPrototypeOf(t)===Uu;function my(t,e,n,r=!1){const i={},s=qu();t.propsDefaults=Object.create(null),Hu(t,e,i,s);for(const o in t.propsOptions[0])o in i||(i[o]=void 0);n?t.props=r?i:Tv(i):t.type.props?t.props=i:t.props=s,t.attrs=s}function gy(t,e,n,r){const{props:i,attrs:s,vnode:{patchFlag:o}}=t,a=de(i),[l]=t.propsOptions;let c=!1;if((r||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let f=0;f<u.length;f++){let p=u[f];if(es(t.emitsOptions,p))continue;const v=e[p];if(l)if(ve(s,p))v!==s[p]&&(s[p]=v,c=!0);else{const b=qt(p);i[b]=Zo(l,a,b,v,t,!1)}else v!==s[p]&&(s[p]=v,c=!0)}}}else{Hu(t,e,i,s)&&(c=!0);let u;for(const f in a)(!e||!ve(e,f)&&((u=tn(f))===f||!ve(e,u)))&&(l?n&&(n[f]!==void 0||n[u]!==void 0)&&(i[f]=Zo(l,a,f,void 0,t,!0)):delete i[f]);if(s!==a)for(const f in s)(!e||!ve(e,f))&&(delete s[f],c=!0)}c&&zt(t.attrs,"set","")}function Hu(t,e,n,r){const[i,s]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(yr(l))continue;const c=e[l];let u;i&&ve(i,u=qt(l))?!s||!s.includes(u)?n[u]=c:(a||(a={}))[u]=c:es(t.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,o=!0)}if(s){const l=de(n),c=a||pe;for(let u=0;u<s.length;u++){const f=s[u];n[f]=Zo(i,l,f,c[f],t,!ve(c,f))}}return o}function Zo(t,e,n,r,i,s){const o=t[n];if(o!=null){const a=ve(o,"default");if(a&&r===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&oe(l)){const{propsDefaults:c}=i;if(n in c)r=c[n];else{const u=Lr(i);r=c[n]=l.call(null,e),u()}}else r=l;i.ce&&i.ce._setProp(n,r)}o[0]&&(s&&!a?r=!1:o[1]&&(r===""||r===tn(n))&&(r=!0))}return r}const vy=new WeakMap;function Wu(t,e,n=!1){const r=n?vy:e.propsCache,i=r.get(t);if(i)return i;const s=t.props,o={},a=[];let l=!1;if(!oe(t)){const u=f=>{l=!0;const[p,v]=Wu(f,e,!0);Fe(o,p),v&&a.push(...v)};!n&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!s&&!l)return Ee(t)&&r.set(t,Rn),Rn;if(se(s))for(let u=0;u<s.length;u++){const f=qt(s[u]);Ku(f)&&(o[f]=pe)}else if(s)for(const u in s){const f=qt(u);if(Ku(f)){const p=s[u],v=o[f]=se(p)||oe(p)?{type:p}:Fe({},p),b=v.type;let I=!1,B=!0;if(se(b))for(let D=0;D<b.length;++D){const A=b[D],y=oe(A)&&A.name;if(y==="Boolean"){I=!0;break}else y==="String"&&(B=!1)}else I=oe(b)&&b.name==="Boolean";v[0]=I,v[1]=B,(I||ve(v,"default"))&&a.push(f)}}const c=[o,a];return Ee(t)&&r.set(t,c),c}function Ku(t){return t[0]!=="$"&&!yr(t)}const ea=t=>t==="_"||t==="_ctx"||t==="$stable",ta=t=>se(t)?t.map(Nt):[Nt(t)],yy=(t,e,n)=>{if(e._n)return e;const r=Kv((...i)=>ta(e(...i)),n);return r._c=!1,r},Vu=(t,e,n)=>{const r=t._ctx;for(const i in t){if(ea(i))continue;const s=t[i];if(oe(s))e[i]=yy(i,s,r);else if(s!=null){const o=ta(s);e[i]=()=>o}}},Yu=(t,e)=>{const n=ta(e);t.slots.default=()=>n},Gu=(t,e,n)=>{for(const r in e)(n||!ea(r))&&(t[r]=e[r])},by=(t,e,n)=>{const r=t.slots=qu();if(t.vnode.shapeFlag&32){const i=e._;i?(Gu(r,e,n),n&&Hc(r,"_",i,!0)):Vu(e,r)}else e&&Yu(t,e)},wy=(t,e,n)=>{const{vnode:r,slots:i}=t;let s=!0,o=pe;if(r.shapeFlag&32){const a=e._;a?n&&a===1?s=!1:Gu(i,e,n):(s=!e.$stable,Vu(e,i)),o=e}else e&&(Yu(t,e),o={default:1});if(s)for(const a in i)!ea(a)&&o[a]==null&&delete i[a]},at=Dy;function _y(t){return xy(t)}function xy(t,e){const n=Ni();n.__VUE__=!0;const{insert:r,remove:i,patchProp:s,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:f,nextSibling:p,setScopeId:v=Ct,insertStaticContent:b}=t,I=(_,k,O,L=null,M=null,j=null,G=void 0,V=null,W=!!k.dynamicChildren)=>{if(_===k)return;_&&!Nr(_,k)&&(L=er(_),ut(_,M,j,!0),_=null),k.patchFlag===-2&&(W=!1,k.dynamicChildren=null);const{type:U,ref:ee,shapeFlag:Q}=k;switch(U){case ts:B(_,k,O,L);break;case qn:D(_,k,O,L);break;case ia:_==null&&A(k,O,L,G);break;case xt:De(_,k,O,L,M,j,G,V,W);break;default:Q&1?h(_,k,O,L,M,j,G,V,W):Q&6?it(_,k,O,L,M,j,G,V,W):(Q&64||Q&128)&&U.process(_,k,O,L,M,j,G,V,W,Pn)}ee!=null&&M?Pr(ee,_&&_.ref,j,k||_,!k):ee==null&&_&&_.ref!=null&&Pr(_.ref,null,j,_,!0)},B=(_,k,O,L)=>{if(_==null)r(k.el=a(k.children),O,L);else{const M=k.el=_.el;k.children!==_.children&&c(M,k.children)}},D=(_,k,O,L)=>{_==null?r(k.el=l(k.children||""),O,L):k.el=_.el},A=(_,k,O,L)=>{[_.el,_.anchor]=b(_.children,k,O,L,_.el,_.anchor)},y=({el:_,anchor:k},O,L)=>{let M;for(;_&&_!==k;)M=p(_),r(_,O,L),_=M;r(k,O,L)},m=({el:_,anchor:k})=>{let O;for(;_&&_!==k;)O=p(_),i(_),_=O;i(k)},h=(_,k,O,L,M,j,G,V,W)=>{k.type==="svg"?G="svg":k.type==="math"&&(G="mathml"),_==null?S(k,O,L,M,j,G,V,W):H(_,k,M,j,G,V,W)},S=(_,k,O,L,M,j,G,V)=>{let W,U;const{props:ee,shapeFlag:Q,transition:Z,dirs:re}=_;if(W=_.el=o(_.type,j,ee&&ee.is,ee),Q&8?u(W,_.children):Q&16&&R(_.children,W,null,L,M,na(_,j),G,V),re&&bn(_,null,L,"created"),T(W,_,_.scopeId,G,L),ee){for(const _e in ee)_e!=="value"&&!yr(_e)&&s(W,_e,null,ee[_e],j,L);"value"in ee&&s(W,"value",null,ee.value,j),(U=ee.onVnodeBeforeMount)&&Dt(U,L,_)}re&&bn(_,null,L,"beforeMount");const ce=Sy(M,Z);ce&&Z.beforeEnter(W),r(W,k,O),((U=ee&&ee.onVnodeMounted)||ce||re)&&at(()=>{U&&Dt(U,L,_),ce&&Z.enter(W),re&&bn(_,null,L,"mounted")},M)},T=(_,k,O,L,M)=>{if(O&&v(_,O),L)for(let j=0;j<L.length;j++)v(_,L[j]);if(M){let j=M.subTree;if(k===j||of(j.type)&&(j.ssContent===k||j.ssFallback===k)){const G=M.vnode;T(_,G,G.scopeId,G.slotScopeIds,M.parent)}}},R=(_,k,O,L,M,j,G,V,W=0)=>{for(let U=W;U<_.length;U++){const ee=_[U]=V?an(_[U]):Nt(_[U]);I(null,ee,k,O,L,M,j,G,V)}},H=(_,k,O,L,M,j,G)=>{const V=k.el=_.el;let{patchFlag:W,dynamicChildren:U,dirs:ee}=k;W|=_.patchFlag&16;const Q=_.props||pe,Z=k.props||pe;let re;if(O&&wn(O,!1),(re=Z.onVnodeBeforeUpdate)&&Dt(re,O,k,_),ee&&bn(k,_,O,"beforeUpdate"),O&&wn(O,!0),(Q.innerHTML&&Z.innerHTML==null||Q.textContent&&Z.textContent==null)&&u(V,""),U?X(_.dynamicChildren,U,V,O,L,na(k,M),j):G||we(_,k,V,null,O,L,na(k,M),j,!1),W>0){if(W&16)Te(V,Q,Z,O,M);else if(W&2&&Q.class!==Z.class&&s(V,"class",null,Z.class,M),W&4&&s(V,"style",Q.style,Z.style,M),W&8){const ce=k.dynamicProps;for(let _e=0;_e<ce.length;_e++){const he=ce[_e],qe=Q[he],ze=Z[he];(ze!==qe||he==="value")&&s(V,he,qe,ze,M,O)}}W&1&&_.children!==k.children&&u(V,k.children)}else!G&&U==null&&Te(V,Q,Z,O,M);((re=Z.onVnodeUpdated)||ee)&&at(()=>{re&&Dt(re,O,k,_),ee&&bn(k,_,O,"updated")},L)},X=(_,k,O,L,M,j,G)=>{for(let V=0;V<k.length;V++){const W=_[V],U=k[V],ee=W.el&&(W.type===xt||!Nr(W,U)||W.shapeFlag&198)?f(W.el):O;I(W,U,ee,null,L,M,j,G,!0)}},Te=(_,k,O,L,M)=>{if(k!==O){if(k!==pe)for(const j in k)!yr(j)&&!(j in O)&&s(_,j,k[j],null,M,L);for(const j in O){if(yr(j))continue;const G=O[j],V=k[j];G!==V&&j!=="value"&&s(_,j,V,G,M,L)}"value"in O&&s(_,"value",k.value,O.value,M)}},De=(_,k,O,L,M,j,G,V,W)=>{const U=k.el=_?_.el:a(""),ee=k.anchor=_?_.anchor:a("");let{patchFlag:Q,dynamicChildren:Z,slotScopeIds:re}=k;re&&(V=V?V.concat(re):re),_==null?(r(U,O,L),r(ee,O,L),R(k.children||[],O,ee,M,j,G,V,W)):Q>0&&Q&64&&Z&&_.dynamicChildren?(X(_.dynamicChildren,Z,O,M,j,G,V),(k.key!=null||M&&k===M.subTree)&&Qu(_,k,!0)):we(_,k,O,ee,M,j,G,V,W)},it=(_,k,O,L,M,j,G,V,W)=>{k.slotScopeIds=V,_==null?k.shapeFlag&512?M.ctx.activate(k,O,L,G,W):Vt(k,O,L,M,j,G,W):En(_,k,W)},Vt=(_,k,O,L,M,j,G)=>{const V=_.component=zy(_,L,M);if($u(_)&&(V.ctx.renderer=Pn),Hy(V,!1,G),V.asyncDep){if(M&&M.registerDep(V,Le,G),!_.el){const W=V.subTree=on(qn);D(null,W,k,O),_.placeholder=W.el}}else Le(V,_,k,O,M,j,G)},En=(_,k,O)=>{const L=k.component=_.component;if(Ry(_,k,O))if(L.asyncDep&&!L.asyncResolved){ye(L,k,O);return}else L.next=k,L.update();else k.el=_.el,L.vnode=k},Le=(_,k,O,L,M,j,G)=>{const V=()=>{if(_.isMounted){let{next:Q,bu:Z,u:re,parent:ce,vnode:_e}=_;{const dt=Ju(_);if(dt){Q&&(Q.el=_e.el,ye(_,Q,G)),dt.asyncDep.then(()=>{_.isUnmounted||V()});return}}let he=Q,qe;wn(_,!1),Q?(Q.el=_e.el,ye(_,Q,G)):Q=_e,Z&&Co(Z),(qe=Q.props&&Q.props.onVnodeBeforeUpdate)&&Dt(qe,ce,Q,_e),wn(_,!0);const ze=rf(_),ft=_.subTree;_.subTree=ze,I(ft,ze,f(ft.el),er(ft),_,M,j),Q.el=ze.el,he===null&&Ny(_,ze.el),re&&at(re,M),(qe=Q.props&&Q.props.onVnodeUpdated)&&at(()=>Dt(qe,ce,Q,_e),M)}else{let Q;const{el:Z,props:re}=k,{bm:ce,m:_e,parent:he,root:qe,type:ze}=_,ft=$r(k);wn(_,!1),ce&&Co(ce),!ft&&(Q=re&&re.onVnodeBeforeMount)&&Dt(Q,he,k),wn(_,!0);{qe.ce&&qe.ce._def.shadowRoot!==!1&&qe.ce._injectChildStyle(ze);const dt=_.subTree=rf(_);I(null,dt,O,L,_,M,j),k.el=dt.el}if(_e&&at(_e,M),!ft&&(Q=re&&re.onVnodeMounted)){const dt=k;at(()=>Dt(Q,he,dt),M)}(k.shapeFlag&256||he&&$r(he.vnode)&&he.vnode.shapeFlag&256)&&_.a&&at(_.a,M),_.isMounted=!0,k=O=L=null}};_.scope.on();const W=_.effect=new Gc(V);_.scope.off();const U=_.update=W.run.bind(W),ee=_.job=W.runIfDirty.bind(W);ee.i=_,ee.id=_.uid,W.scheduler=()=>Ko(ee),wn(_,!0),U()},ye=(_,k,O)=>{k.component=_;const L=_.vnode.props;_.vnode=k,_.next=null,gy(_,k.props,L,O),wy(_,k.children,O),Tt(),wu(_),It()},we=(_,k,O,L,M,j,G,V,W=!1)=>{const U=_&&_.children,ee=_?_.shapeFlag:0,Q=k.children,{patchFlag:Z,shapeFlag:re}=k;if(Z>0){if(Z&128){Zn(U,Q,O,L,M,j,G,V,W);return}else if(Z&256){Yt(U,Q,O,L,M,j,G,V,W);return}}re&8?(ee&16&&kn(U,M,j),Q!==U&&u(O,Q)):ee&16?re&16?Zn(U,Q,O,L,M,j,G,V,W):kn(U,M,j,!0):(ee&8&&u(O,""),re&16&&R(Q,O,L,M,j,G,V,W))},Yt=(_,k,O,L,M,j,G,V,W)=>{_=_||Rn,k=k||Rn;const U=_.length,ee=k.length,Q=Math.min(U,ee);let Z;for(Z=0;Z<Q;Z++){const re=k[Z]=W?an(k[Z]):Nt(k[Z]);I(_[Z],re,O,null,M,j,G,V,W)}U>ee?kn(_,M,j,!0,!1,Q):R(k,O,L,M,j,G,V,W,Q)},Zn=(_,k,O,L,M,j,G,V,W)=>{let U=0;const ee=k.length;let Q=_.length-1,Z=ee-1;for(;U<=Q&&U<=Z;){const re=_[U],ce=k[U]=W?an(k[U]):Nt(k[U]);if(Nr(re,ce))I(re,ce,O,null,M,j,G,V,W);else break;U++}for(;U<=Q&&U<=Z;){const re=_[Q],ce=k[Z]=W?an(k[Z]):Nt(k[Z]);if(Nr(re,ce))I(re,ce,O,null,M,j,G,V,W);else break;Q--,Z--}if(U>Q){if(U<=Z){const re=Z+1,ce=re<ee?k[re].el:L;for(;U<=Z;)I(null,k[U]=W?an(k[U]):Nt(k[U]),O,ce,M,j,G,V,W),U++}}else if(U>Z)for(;U<=Q;)ut(_[U],M,j,!0),U++;else{const re=U,ce=U,_e=new Map;for(U=ce;U<=Z;U++){const Xe=k[U]=W?an(k[U]):Nt(k[U]);Xe.key!=null&&_e.set(Xe.key,U)}let he,qe=0;const ze=Z-ce+1;let ft=!1,dt=0;const cn=new Array(ze);for(U=0;U<ze;U++)cn[U]=0;for(U=re;U<=Q;U++){const Xe=_[U];if(qe>=ze){ut(Xe,M,j,!0);continue}let vt;if(Xe.key!=null)vt=_e.get(Xe.key);else for(he=ce;he<=Z;he++)if(cn[he-ce]===0&&Nr(Xe,k[he])){vt=he;break}vt===void 0?ut(Xe,M,j,!0):(cn[vt-ce]=U+1,vt>=dt?dt=vt:ft=!0,I(Xe,k[vt],O,null,M,j,G,V,W),qe++)}const tr=ft?Ey(cn):Rn;for(he=tr.length-1,U=ze-1;U>=0;U--){const Xe=ce+U,vt=k[Xe],nr=k[Xe+1],Hr=Xe+1<ee?nr.el||nr.placeholder:L;cn[U]===0?I(null,vt,O,Hr,M,j,G,V,W):ft&&(he<0||U!==tr[he]?Ue(vt,O,Hr,2):he--)}}},Ue=(_,k,O,L,M=null)=>{const{el:j,type:G,transition:V,children:W,shapeFlag:U}=_;if(U&6){Ue(_.component.subTree,k,O,L);return}if(U&128){_.suspense.move(k,O,L);return}if(U&64){G.move(_,k,O,Pn);return}if(G===xt){r(j,k,O);for(let Q=0;Q<W.length;Q++)Ue(W[Q],k,O,L);r(_.anchor,k,O);return}if(G===ia){y(_,k,O);return}if(L!==2&&U&1&&V)if(L===0)V.beforeEnter(j),r(j,k,O),at(()=>V.enter(j),M);else{const{leave:Q,delayLeave:Z,afterLeave:re}=V,ce=()=>{_.ctx.isUnmounted?i(j):r(j,k,O)},_e=()=>{j._isLeaving&&j[Gv](!0),Q(j,()=>{ce(),re&&re()})};Z?Z(j,ce,_e):_e()}else r(j,k,O)},ut=(_,k,O,L=!1,M=!1)=>{const{type:j,props:G,ref:V,children:W,dynamicChildren:U,shapeFlag:ee,patchFlag:Q,dirs:Z,cacheIndex:re}=_;if(Q===-2&&(M=!1),V!=null&&(Tt(),Pr(V,null,O,_,!0),It()),re!=null&&(k.renderCache[re]=void 0),ee&256){k.ctx.deactivate(_);return}const ce=ee&1&&Z,_e=!$r(_);let he;if(_e&&(he=G&&G.onVnodeBeforeUnmount)&&Dt(he,k,_),ee&6)_a(_.component,O,L);else{if(ee&128){_.suspense.unmount(O,L);return}ce&&bn(_,null,k,"beforeUnmount"),ee&64?_.type.remove(_,k,O,Pn,L):U&&!U.hasOnce&&(j!==xt||Q>0&&Q&64)?kn(U,k,O,!1,!0):(j===xt&&Q&384||!M&&ee&16)&&kn(W,k,O),L&&fs(_)}(_e&&(he=G&&G.onVnodeUnmounted)||ce)&&at(()=>{he&&Dt(he,k,_),ce&&bn(_,null,k,"unmounted")},O)},fs=_=>{const{type:k,el:O,anchor:L,transition:M}=_;if(k===xt){wa(O,L);return}if(k===ia){m(_);return}const j=()=>{i(O),M&&!M.persisted&&M.afterLeave&&M.afterLeave()};if(_.shapeFlag&1&&M&&!M.persisted){const{leave:G,delayLeave:V}=M,W=()=>G(O,j);V?V(_.el,j,W):W()}else j()},wa=(_,k)=>{let O;for(;_!==k;)O=p(_),i(_),_=O;i(k)},_a=(_,k,O)=>{const{bum:L,scope:M,job:j,subTree:G,um:V,m:W,a:U}=_;Xu(W),Xu(U),L&&Co(L),M.stop(),j&&(j.flags|=8,ut(G,_,k,O)),V&&at(V,k),at(()=>{_.isUnmounted=!0},k)},kn=(_,k,O,L=!1,M=!1,j=0)=>{for(let G=j;G<_.length;G++)ut(_[G],k,O,L,M)},er=_=>{if(_.shapeFlag&6)return er(_.component.subTree);if(_.shapeFlag&128)return _.suspense.next();const k=p(_.anchor||_.el),O=k&&k[Vv];return O?p(O):k};let zr=!1;const ds=(_,k,O)=>{_==null?k._vnode&&ut(k._vnode,null,null,!0):I(k._vnode||null,_,k,null,null,null,O),k._vnode=_,zr||(zr=!0,wu(),_u(),zr=!1)},Pn={p:I,um:ut,m:Ue,r:fs,mt:Vt,mc:R,pc:we,pbc:X,n:er,o:t};return{render:ds,hydrate:void 0,createApp:py(ds)}}function na({type:t,props:e},n){return n==="svg"&&t==="foreignObject"||n==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:n}function wn({effect:t,job:e},n){n?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function Sy(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Qu(t,e,n=!1){const r=t.children,i=e.children;if(se(r)&&se(i))for(let s=0;s<r.length;s++){const o=r[s];let a=i[s];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[s]=an(i[s]),a.el=o.el),!n&&a.patchFlag!==-2&&Qu(o,a)),a.type===ts&&a.patchFlag!==-1&&(a.el=o.el),a.type===qn&&!a.el&&(a.el=o.el)}}function Ey(t){const e=t.slice(),n=[0];let r,i,s,o,a;const l=t.length;for(r=0;r<l;r++){const c=t[r];if(c!==0){if(i=n[n.length-1],t[i]<c){e[r]=i,n.push(r);continue}for(s=0,o=n.length-1;s<o;)a=s+o>>1,t[n[a]]<c?s=a+1:o=a;c<t[n[s]]&&(s>0&&(e[r]=n[s-1]),n[s]=r)}}for(s=n.length,o=n[s-1];s-- >0;)n[s]=o,o=e[o];return n}function Ju(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Ju(e)}function Xu(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}const ky=Symbol.for("v-scx"),Py=()=>Ir(ky);function $y(t,e){return ra(t,null,{flush:"sync"})}function Un(t,e,n){return ra(t,e,n)}function ra(t,e,n=pe){const{immediate:r,deep:i,flush:s,once:o}=n,a=Fe({},n),l=e&&r||!e&&s!=="post";let c;if(Mr){if(s==="sync"){const v=Py();c=v.__watcherHandles||(v.__watcherHandles=[])}else if(!l){const v=()=>{};return v.stop=Ct,v.resume=Ct,v.pause=Ct,v}}const u=Je;a.call=(v,b,I)=>At(v,u,b,I);let f=!1;s==="post"?a.scheduler=v=>{at(v,u&&u.suspense)}:s!=="sync"&&(f=!0,a.scheduler=(v,b)=>{b?v():Ko(v)}),a.augmentJob=v=>{e&&(v.flags|=4),f&&(v.flags|=2,u&&(v.id=u.uid,v.i=u))};const p=jv(t,e,a);return Mr&&(c?c.push(p):l&&p()),p}function Cy(t,e,n){const r=this.proxy,i=Ce(t)?t.includes(".")?Zu(r,t):()=>r[t]:t.bind(r,r);let s;oe(e)?s=e:(s=e.handler,n=e);const o=Lr(this),a=ra(i,s.bind(r),n);return o(),a}function Zu(t,e){const n=e.split(".");return()=>{let r=t;for(let i=0;i<n.length&&r;i++)r=r[n[i]];return r}}function ef(t,e,n=pe){const r=oa(),i=qt(e),s=tn(e),o=tf(t,i),a=Nv((l,c)=>{let u,f=pe,p;return $y(()=>{const v=t[i];nt(u,v)&&(u=v,c())}),{get(){return l(),n.get?n.get(u):u},set(v){const b=n.set?n.set(v):v;if(!nt(b,u)&&!(f!==pe&&nt(v,f)))return;const I=r.vnode.props;I&&(e in I||i in I||s in I)&&(`onUpdate:${e}`in I||`onUpdate:${i}`in I||`onUpdate:${s}`in I)||(u=v,c()),r.emit(`update:${e}`,b),nt(v,b)&&nt(v,f)&&!nt(b,p)&&c(),f=v,p=b}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?o||pe:a,done:!1}:{done:!0}}}},a}const tf=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${qt(e)}Modifiers`]||t[`${tn(e)}Modifiers`];function Ty(t,e,...n){if(t.isUnmounted)return;const r=t.vnode.props||pe;let i=n;const s=e.startsWith("update:"),o=s&&tf(r,e.slice(7));o&&(o.trim&&(i=n.map(u=>Ce(u)?u.trim():u)),o.number&&(i=n.map(rv)));let a,l=r[a=$o(e)]||r[a=$o(qt(e))];!l&&s&&(l=r[a=$o(tn(e))]),l&&At(l,t,6,i);const c=r[a+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,At(c,t,6,i)}}const Iy=new WeakMap;function nf(t,e,n=!1){const r=n?Iy:e.emitsCache,i=r.get(t);if(i!==void 0)return i;const s=t.emits;let o={},a=!1;if(!oe(t)){const l=c=>{const u=nf(c,e,!0);u&&(a=!0,Fe(o,u))};!n&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!s&&!a?(Ee(t)&&r.set(t,null),null):(se(s)?s.forEach(l=>o[l]=null):Fe(o,s),Ee(t)&&r.set(t,o),o)}function es(t,e){return!t||!Ai(e)?!1:(e=e.slice(2).replace(/Once$/,""),ve(t,e[0].toLowerCase()+e.slice(1))||ve(t,tn(e))||ve(t,e))}function Kw(){}function rf(t){const{type:e,vnode:n,proxy:r,withProxy:i,propsOptions:[s],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:f,data:p,setupState:v,ctx:b,inheritAttrs:I}=t,B=Gi(t);let D,A;try{if(n.shapeFlag&4){const m=i||r,h=m;D=Nt(c.call(h,m,u,f,v,p,b)),A=a}else{const m=e;D=Nt(m.length>1?m(f,{attrs:a,slots:o,emit:l}):m(f,null)),A=e.props?a:Ay(a)}}catch(m){Ar.length=0,Ki(m,t,1),D=on(qn)}let y=D;if(A&&I!==!1){const m=Object.keys(A),{shapeFlag:h}=y;m.length&&h&7&&(s&&m.some(Eo)&&(A=Oy(A,s)),y=Hn(y,A,!1,!0))}return n.dirs&&(y=Hn(y,null,!1,!0),y.dirs=y.dirs?y.dirs.concat(n.dirs):n.dirs),n.transition&&Vo(y,n.transition),D=y,Gi(B),D}const Ay=t=>{let e;for(const n in t)(n==="class"||n==="style"||Ai(n))&&((e||(e={}))[n]=t[n]);return e},Oy=(t,e)=>{const n={};for(const r in t)(!Eo(r)||!(r.slice(9)in e))&&(n[r]=t[r]);return n};function Ry(t,e,n){const{props:r,children:i,component:s}=t,{props:o,children:a,patchFlag:l}=e,c=s.emitsOptions;if(e.dirs||e.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?sf(r,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let f=0;f<u.length;f++){const p=u[f];if(o[p]!==r[p]&&!es(c,p))return!0}}}else return(i||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?sf(r,o,c):!0:!!o;return!1}function sf(t,e,n){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!0;for(let i=0;i<r.length;i++){const s=r[i];if(e[s]!==t[s]&&!es(n,s))return!0}return!1}function Ny({vnode:t,parent:e},n){for(;e;){const r=e.subTree;if(r.suspense&&r.suspense.activeBranch===t&&(r.el=t.el),r===t)(t=e.vnode).el=n,e=e.parent;else break}}const of=t=>t.__isSuspense;function Dy(t,e){e&&e.pendingBranch?se(t)?e.effects.push(...t):e.effects.push(t):Wv(t)}const xt=Symbol.for("v-fgt"),ts=Symbol.for("v-txt"),qn=Symbol.for("v-cmt"),ia=Symbol.for("v-stc"),Ar=[];let lt=null;function zn(t=!1){Ar.push(lt=t?null:[])}function Ly(){Ar.pop(),lt=Ar[Ar.length-1]||null}let Or=1;function af(t,e=!1){Or+=t,t<0&&lt&&e&&(lt.hasOnce=!0)}function lf(t){return t.dynamicChildren=Or>0?lt||Rn:null,Ly(),Or>0&&lt&&lt.push(t),t}function Rr(t,e,n,r,i,s){return lf(Dr(t,e,n,r,i,s,!0))}function My(t,e,n,r,i){return lf(on(t,e,n,r,i,!0))}function cf(t){return t?t.__v_isVNode===!0:!1}function Nr(t,e){return t.type===e.type&&t.key===e.key}const uf=({key:t})=>t??null,ns=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?Ce(t)||Me(t)||oe(t)?{i:Rt,r:t,k:e,f:!!n}:t:null);function Dr(t,e=null,n=null,r=0,i=null,s=t===xt?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&uf(e),ref:e&&ns(e),scopeId:Su,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Rt};return a?(sa(l,n),s&128&&t.normalize(l)):n&&(l.shapeFlag|=Ce(n)?8:16),Or>0&&!o&&lt&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&&lt.push(l),l}const on=jy;function jy(t,e=null,n=null,r=0,i=null,s=!1){if((!t||t===oy)&&(t=qn),cf(t)){const a=Hn(t,e,!0);return n&&sa(a,n),Or>0&&!s&&lt&&(a.shapeFlag&6?lt[lt.indexOf(t)]=a:lt.push(a)),a.patchFlag=-2,a}if(Jy(t)&&(t=t.__vccOpts),e){e=Fy(e);let{class:a,style:l}=e;a&&!Ce(a)&&(e.class=Di(a)),Ee(l)&&(Ho(l)&&!se(l)&&(l=Fe({},l)),e.style=To(l))}const o=Ce(t)?1:of(t)?128:Yv(t)?64:Ee(t)?4:oe(t)?2:0;return Dr(t,e,n,r,i,o,s,!0)}function Fy(t){return t?Ho(t)||zu(t)?Fe({},t):t:null}function Hn(t,e,n=!1,r=!1){const{props:i,ref:s,patchFlag:o,children:a,transition:l}=t,c=e?ff(i||{},e):i,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&uf(c),ref:e&&e.ref?n&&s?se(s)?s.concat(ns(e)):[s,ns(e)]:ns(e):s,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==xt?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Hn(t.ssContent),ssFallback:t.ssFallback&&Hn(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&r&&Vo(u,l.clone(u)),u}function By(t=" ",e=0){return on(ts,null,t,e)}function Nt(t){return t==null||typeof t=="boolean"?on(qn):se(t)?on(xt,null,t.slice()):cf(t)?an(t):on(ts,null,String(t))}function an(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Hn(t)}function sa(t,e){let n=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(se(e))n=16;else if(typeof e=="object")if(r&65){const i=e.default;i&&(i._c&&(i._d=!1),sa(t,i()),i._c&&(i._d=!0));return}else{n=32;const i=e._;!i&&!zu(e)?e._ctx=Rt:i===3&&Rt&&(Rt.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else oe(e)?(e={default:e,_ctx:Rt},n=32):(e=String(e),r&64?(n=16,e=[By(e)]):n=8);t.children=e,t.shapeFlag|=n}function ff(...t){const e={};for(let n=0;n<t.length;n++){const r=t[n];for(const i in r)if(i==="class")e.class!==r.class&&(e.class=Di([e.class,r.class]));else if(i==="style")e.style=To([e.style,r.style]);else if(Ai(i)){const s=e[i],o=r[i];o&&s!==o&&!(se(s)&&s.includes(o))&&(e[i]=s?[].concat(s,o):o)}else i!==""&&(e[i]=r[i])}return e}function Dt(t,e,n,r=null){At(t,e,7,[n,r])}const Uy=Fu();let qy=0;function zy(t,e,n){const r=t.type,i=(e?e.appContext:t.appContext)||Uy,s={uid:qy++,vnode:t,type:r,parent:e,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new cv(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(i.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Wu(r,i),emitsOptions:nf(r,i),emit:null,emitted:null,propsDefaults:pe,inheritAttrs:r.inheritAttrs,ctx:pe,data:pe,props:pe,attrs:pe,slots:pe,refs:pe,setupState:pe,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return s.ctx={_:s},s.root=e?e.root:s,s.emit=Ty.bind(null,s),t.ce&&t.ce(s),s}let Je=null;const oa=()=>Je||Rt;let rs,aa;{const t=Ni(),e=(n,r)=>{let i;return(i=t[n])||(i=t[n]=[]),i.push(r),s=>{i.length>1?i.forEach(o=>o(s)):i[0](s)}};rs=e("__VUE_INSTANCE_SETTERS__",n=>Je=n),aa=e("__VUE_SSR_SETTERS__",n=>Mr=n)}const Lr=t=>{const e=Je;return rs(t),t.scope.on(),()=>{t.scope.off(),rs(e)}},df=()=>{Je&&Je.scope.off(),rs(null)};function hf(t){return t.vnode.shapeFlag&4}let Mr=!1;function Hy(t,e=!1,n=!1){e&&aa(e);const{props:r,children:i}=t.vnode,s=hf(t);my(t,r,s,e),by(t,i,n||e);const o=s?Wy(t,e):void 0;return e&&aa(!1),o}function Wy(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,ay);const{setup:r}=n;if(r){Tt();const i=t.setupContext=r.length>1?Vy(t):null,s=Lr(t),o=Mn(r,t,0,[t.props,i]),a=Bc(o);if(It(),s(),(a||t.sp)&&!$r(t)&&ku(t),a){if(o.then(df,df),e)return o.then(l=>{pf(t,l)}).catch(l=>{Ki(l,t,0)});t.asyncDep=o}else pf(t,o)}else mf(t)}function pf(t,e,n){oe(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:Ee(e)&&(t.setupState=gu(e)),mf(t)}function mf(t,e,n){const r=t.type;t.render||(t.render=r.render||Ct);{const i=Lr(t);Tt();try{ly(t)}finally{It(),i()}}}const Ky={get(t,e){return Ke(t,"get",""),t[e]}};function Vy(t){const e=n=>{t.exposed=n||{}};return{attrs:new Proxy(t.attrs,Ky),slots:t.slots,emit:t.emit,expose:e}}function la(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(gu(Iv(t.exposed)),{get(e,n){if(n in e)return e[n];if(n in Cr)return Cr[n](t)},has(e,n){return n in e||n in Cr}})):t.proxy}const Yy=/(?:^|[-_])\w/g,Gy=t=>t.replace(Yy,e=>e.toUpperCase()).replace(/[-_]/g,"");function Qy(t,e=!0){return oe(t)?t.displayName||t.name:t.name||e&&t.__name}function gf(t,e,n=!1){let r=Qy(e);if(!r&&e.__file){const i=e.__file.match(/([^/\\]+)\.\w+$/);i&&(r=i[1])}if(!r&&t&&t.parent){const i=s=>{for(const o in s)if(s[o]===e)return o};r=i(t.components||t.parent.type.components)||i(t.appContext.components)}return r?Gy(r):n?"App":"Anonymous"}function Jy(t){return oe(t)&&"__vccOpts"in t}const vf=(t,e)=>Lv(t,e,Mr),Xy="3.5.22";/**
104
+ `],...Uv(n))}),e}function Uv({vnode:t,recurseCount:e}){const n=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,i=` at <${gf(t.component,t.type,r)}`,s=">"+n;return t.props?[i,...qv(t.props),s]:[i+s]}function qv(t){const e=[],n=Object.keys(t);return n.slice(0,3).forEach(r=>{e.push(...vu(r,t[r]))}),n.length>3&&e.push(" ..."),e}function vu(t,e,n){return Ce(e)?(e=JSON.stringify(e),n?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?n?e:[`${t}=${e}`]:Me(e)?(e=vu(t,de(e.value),!0),n?e:[`${t}=Ref<`,e,">"]):oe(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=de(e),n?e:[`${t}=`,e])}function Mn(t,e,n,r){try{return r?t(...r):t()}catch(i){Vi(i,e,n)}}function Ot(t,e,n,r){if(oe(t)){const i=Mn(t,e,n,r);return i&&Bc(i)&&i.catch(s=>{Vi(s,e,n)}),i}if(se(t)){const i=[];for(let s=0;s<t.length;s++)i.push(Ot(t[s],e,n,r));return i}}function Vi(t,e,n,r=!0){const i=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||me;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const u=a.ec;if(u){for(let f=0;f<u.length;f++)if(u[f](t,l,c)===!1)return}a=a.parent}if(s){Tt(),Mn(s,null,10,[t,l,c]),It();return}}zv(t,n,i,r,o)}function zv(t,e,n,r=!0,i=!1){if(i)throw t}const Ge=[];let At=-1;const jn=[];let sn=null,Fn=0;const yu=Promise.resolve();let Yi=null;function Gi(t){const e=Yi||yu;return t?e.then(this?t.bind(this):t):e}function Hv(t){let e=At+1,n=Ge.length;for(;e<n;){const r=e+n>>>1,i=Ge[r],s=kr(i);s<t||s===t&&i.flags&2?e=r+1:n=r}return e}function Ko(t){if(!(t.flags&1)){const e=kr(t),n=Ge[Ge.length-1];!n||!(t.flags&2)&&e>=kr(n)?Ge.push(t):Ge.splice(Hv(e),0,t),t.flags|=1,bu()}}function bu(){Yi||(Yi=yu.then(xu))}function Wv(t){se(t)?jn.push(...t):sn&&t.id===-1?sn.splice(Fn+1,0,t):t.flags&1||(jn.push(t),t.flags|=1),bu()}function wu(t,e,n=At+1){for(;n<Ge.length;n++){const r=Ge[n];if(r&&r.flags&2){if(t&&r.id!==t.uid)continue;Ge.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function _u(t){if(jn.length){const e=[...new Set(jn)].sort((n,r)=>kr(n)-kr(r));if(jn.length=0,sn){sn.push(...e);return}for(sn=e,Fn=0;Fn<sn.length;Fn++){const n=sn[Fn];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}sn=null,Fn=0}}const kr=t=>t.id==null?t.flags&2?-1:1/0:t.id;function xu(t){try{for(At=0;At<Ge.length;At++){const e=Ge[At];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Mn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;At<Ge.length;At++){const e=Ge[At];e&&(e.flags&=-2)}At=-1,Ge.length=0,_u(),Yi=null,(Ge.length||jn.length)&&xu()}}let Rt=null,Su=null;function Qi(t){const e=Rt;return Rt=t,Su=t&&t.type.__scopeId||null,e}function Kv(t,e=Rt,n){if(!e||t._n)return t;const r=(...i)=>{r._d&&af(-1);const s=Qi(e);let o;try{o=t(...i)}finally{Qi(s),r._d&&af(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function bn(t,e,n,r){const i=t.dirs,s=e&&e.dirs;for(let o=0;o<i.length;o++){const a=i[o];s&&(a.oldValue=s[o].value);let l=a.dir[r];l&&(Tt(),Ot(l,n,8,[t.el,a,t,e]),It())}}const Vv=Symbol("_vte"),Yv=t=>t.__isTeleport,Gv=Symbol("_leaveCb");function Vo(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Vo(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function Eu(t,e){return oe(t)?Fe({name:t.name},e,{setup:t}):t}function ku(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Qv(t){const e=oa(),n=Hi(null);if(e){const i=e.refs===me?e.refs={}:e.refs;Object.defineProperty(i,t,{enumerable:!0,get:()=>n.value,set:s=>n.value=s})}return n}const Ji=new WeakMap;function Pr(t,e,n,r,i=!1){if(se(t)){t.forEach((b,I)=>Pr(b,e&&(se(e)?e[I]:e),n,r,i));return}if($r(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Pr(t,e,n,r.component.subTree);return}const s=r.shapeFlag&4?la(r.component):r.el,o=i?null:s,{i:a,r:l}=t,c=e&&e.r,u=a.refs===me?a.refs={}:a.refs,f=a.setupState,y=de(f),v=f===me?jc:b=>ve(y,b);if(c!=null&&c!==l){if(Pu(e),Ce(c))u[c]=null,v(c)&&(f[c]=null);else if(Me(c)){c.value=null;const b=e;b.k&&(u[b.k]=null)}}if(oe(l))Mn(l,a,12,[o,u]);else{const b=Ce(l),I=Me(l);if(b||I){const F=()=>{if(t.f){const O=b?v(l)?f[l]:u[l]:l.value;if(i)se(O)&&ko(O,s);else if(se(O))O.includes(s)||O.push(s);else if(b)u[l]=[s],v(l)&&(f[l]=u[l]);else{const A=[s];l.value=A,t.k&&(u[t.k]=A)}}else b?(u[l]=o,v(l)&&(f[l]=o)):I&&(l.value=o,t.k&&(u[t.k]=o))};if(o){const O=()=>{F(),Ji.delete(t)};O.id=-1,Ji.set(t,O),at(O,n)}else Pu(t),F()}}}function Pu(t){const e=Ji.get(t);e&&(e.flags|=8,Ji.delete(t))}Di().requestIdleCallback,Di().cancelIdleCallback;const $r=t=>!!t.type.__asyncLoader,$u=t=>t.type.__isKeepAlive;function Jv(t,e){Cu(t,"a",e)}function Xv(t,e){Cu(t,"da",e)}function Cu(t,e,n=Je){const r=t.__wdc||(t.__wdc=()=>{let i=n;for(;i;){if(i.isDeactivated)return;i=i.parent}return t()});if(Xi(e,r,n),n){let i=n.parent;for(;i&&i.parent;)$u(i.parent.vnode)&&Zv(r,e,n,i),i=i.parent}}function Zv(t,e,n,r){const i=Xi(e,t,r,!0);Ou(()=>{ko(r[e],i)},n)}function Xi(t,e,n=Je,r=!1){if(n){const i=n[t]||(n[t]=[]),s=e.__weh||(e.__weh=(...o)=>{Tt();const a=Lr(n),l=Ot(e,n,t,o);return a(),It(),l});return r?i.unshift(s):i.push(s),s}}const Wt=t=>(e,n=Je)=>{(!Mr||t==="sp")&&Xi(t,(...r)=>e(...r),n)},Tu=Wt("bm"),Yo=Wt("m"),ey=Wt("bu"),ty=Wt("u"),Iu=Wt("bum"),Ou=Wt("um"),ny=Wt("sp"),ry=Wt("rtg"),iy=Wt("rtc");function sy(t,e=Je){Xi("ec",t,e)}const oy=Symbol.for("v-ndc");function Au(t,e,n,r){let i;const s=n,o=se(t);if(o||Ce(t)){const a=o&&Ln(t);let l=!1,c=!1;a&&(l=!pt(t),c=nn(t),t=ji(t)),i=new Array(t.length);for(let u=0,f=t.length;u<f;u++)i[u]=e(l?c?zi(Be(t[u])):Be(t[u]):t[u],u,void 0,s)}else if(typeof t=="number"){i=new Array(t);for(let a=0;a<t;a++)i[a]=e(a+1,a,void 0,s)}else if(Ee(t))if(t[Symbol.iterator])i=Array.from(t,(a,l)=>e(a,l,void 0,s));else{const a=Object.keys(t);i=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];i[l]=e(t[u],u,l,s)}}else i=[];return i}const Go=t=>t?hf(t)?la(t):Go(t.parent):null,Cr=Fe(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Go(t.parent),$root:t=>Go(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Lu(t),$forceUpdate:t=>t.f||(t.f=()=>{Ko(t.update)}),$nextTick:t=>t.n||(t.n=Gi.bind(t.proxy)),$watch:t=>Cy.bind(t)}),Qo=(t,e)=>t!==me&&!t.__isScriptSetup&&ve(t,e),ay={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:n,setupState:r,data:i,props:s,accessCache:o,type:a,appContext:l}=t;let c;if(e[0]!=="$"){const v=o[e];if(v!==void 0)switch(v){case 1:return r[e];case 2:return i[e];case 4:return n[e];case 3:return s[e]}else{if(Qo(r,e))return o[e]=1,r[e];if(i!==me&&ve(i,e))return o[e]=2,i[e];if((c=t.propsOptions[0])&&ve(c,e))return o[e]=3,s[e];if(n!==me&&ve(n,e))return o[e]=4,n[e];Jo&&(o[e]=0)}}const u=Cr[e];let f,y;if(u)return e==="$attrs"&&Ke(t.attrs,"get",""),u(t);if((f=a.__cssModules)&&(f=f[e]))return f;if(n!==me&&ve(n,e))return o[e]=4,n[e];if(y=l.config.globalProperties,ve(y,e))return y[e]},set({_:t},e,n){const{data:r,setupState:i,ctx:s}=t;return Qo(i,e)?(i[e]=n,!0):r!==me&&ve(r,e)?(r[e]=n,!0):ve(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(s[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:r,appContext:i,propsOptions:s,type:o}},a){let l,c;return!!(n[a]||t!==me&&a[0]!=="$"&&ve(t,a)||Qo(e,a)||(l=s[0])&&ve(l,a)||ve(r,a)||ve(Cr,a)||ve(i.config.globalProperties,a)||(c=o.__cssModules)&&c[a])},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:ve(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};function Zi(t){return se(t)?t.reduce((e,n)=>(e[n]=null,e),{}):t}function Ru(t,e){return!t||!e?t||e:se(t)&&se(e)?t.concat(e):Fe({},Zi(t),Zi(e))}let Jo=!0;function ly(t){const e=Lu(t),n=t.proxy,r=t.ctx;Jo=!1,e.beforeCreate&&Nu(e.beforeCreate,t,"bc");const{data:i,computed:s,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:f,mounted:y,beforeUpdate:v,updated:b,activated:I,deactivated:F,beforeDestroy:O,beforeUnmount:A,destroyed:g,unmounted:p,render:h,renderTracked:S,renderTriggered:T,errorCaptured:N,serverPrefetch:H,expose:X,inheritAttrs:Te,components:De,directives:it,filters:Vt}=e;if(c&&cy(c,r,null),o)for(const ye in o){const we=o[ye];oe(we)&&(r[ye]=we.bind(n))}if(i){const ye=i.call(n,n);Ee(ye)&&(t.data=qo(ye))}if(Jo=!0,s)for(const ye in s){const we=s[ye],Yt=oe(we)?we.bind(n,n):oe(we.get)?we.get.bind(n,n):Ct,Zn=!oe(we)&&oe(we.set)?we.set.bind(n):Ct,Ue=vf({get:Yt,set:Zn});Object.defineProperty(r,ye,{enumerable:!0,configurable:!0,get:()=>Ue.value,set:ut=>Ue.value=ut})}if(a)for(const ye in a)Du(a[ye],r,n,ye);if(l){const ye=oe(l)?l.call(n):l;Reflect.ownKeys(ye).forEach(we=>{Bu(we,ye[we])})}u&&Nu(u,t,"c");function Le(ye,we){se(we)?we.forEach(Yt=>ye(Yt.bind(n))):we&&ye(we.bind(n))}if(Le(Tu,f),Le(Yo,y),Le(ey,v),Le(ty,b),Le(Jv,I),Le(Xv,F),Le(sy,N),Le(iy,S),Le(ry,T),Le(Iu,A),Le(Ou,p),Le(ny,H),se(X))if(X.length){const ye=t.exposed||(t.exposed={});X.forEach(we=>{Object.defineProperty(ye,we,{get:()=>n[we],set:Yt=>n[we]=Yt,enumerable:!0})})}else t.exposed||(t.exposed={});h&&t.render===Ct&&(t.render=h),Te!=null&&(t.inheritAttrs=Te),De&&(t.components=De),it&&(t.directives=it),H&&ku(t)}function cy(t,e,n=Ct){se(t)&&(t=Xo(t));for(const r in t){const i=t[r];let s;Ee(i)?"default"in i?s=Ir(i.from||r,i.default,!0):s=Ir(i.from||r):s=Ir(i),Me(s)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[r]=s}}function Nu(t,e,n){Ot(se(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,n)}function Du(t,e,n,r){let i=r.includes(".")?Zu(n,r):()=>n[r];if(Ce(t)){const s=e[t];oe(s)&&Un(i,s)}else if(oe(t))Un(i,t.bind(n));else if(Ee(t))if(se(t))t.forEach(s=>Du(s,e,n,r));else{const s=oe(t.handler)?t.handler.bind(n):e[t.handler];oe(s)&&Un(i,s,t)}}function Lu(t){const e=t.type,{mixins:n,extends:r}=e,{mixins:i,optionsCache:s,config:{optionMergeStrategies:o}}=t.appContext,a=s.get(e);let l;return a?l=a:!i.length&&!n&&!r?l=e:(l={},i.length&&i.forEach(c=>es(l,c,o,!0)),es(l,e,o)),Ee(e)&&s.set(e,l),l}function es(t,e,n,r=!1){const{mixins:i,extends:s}=e;s&&es(t,s,n,!0),i&&i.forEach(o=>es(t,o,n,!0));for(const o in e)if(!(r&&o==="expose")){const a=uy[o]||n&&n[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const uy={data:Mu,props:ju,emits:ju,methods:Tr,computed:Tr,beforeCreate:Qe,created:Qe,beforeMount:Qe,mounted:Qe,beforeUpdate:Qe,updated:Qe,beforeDestroy:Qe,beforeUnmount:Qe,destroyed:Qe,unmounted:Qe,activated:Qe,deactivated:Qe,errorCaptured:Qe,serverPrefetch:Qe,components:Tr,directives:Tr,watch:dy,provide:Mu,inject:fy};function Mu(t,e){return e?t?function(){return Fe(oe(t)?t.call(this,this):t,oe(e)?e.call(this,this):e)}:e:t}function fy(t,e){return Tr(Xo(t),Xo(e))}function Xo(t){if(se(t)){const e={};for(let n=0;n<t.length;n++)e[t[n]]=t[n];return e}return t}function Qe(t,e){return t?[...new Set([].concat(t,e))]:e}function Tr(t,e){return t?Fe(Object.create(null),t,e):e}function ju(t,e){return t?se(t)&&se(e)?[...new Set([...t,...e])]:Fe(Object.create(null),Zi(t),Zi(e??{})):e}function dy(t,e){if(!t)return e;if(!e)return t;const n=Fe(Object.create(null),t);for(const r in e)n[r]=Qe(t[r],e[r]);return n}function Fu(){return{app:null,config:{isNativeTag:jc,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let hy=0;function py(t,e){return function(r,i=null){oe(r)||(r=Fe({},r)),i!=null&&!Ee(i)&&(i=null);const s=Fu(),o=new WeakSet,a=[];let l=!1;const c=s.app={_uid:hy++,_component:r,_props:i,_container:null,_context:s,_instance:null,version:Xy,get config(){return s.config},set config(u){},use(u,...f){return o.has(u)||(u&&oe(u.install)?(o.add(u),u.install(c,...f)):oe(u)&&(o.add(u),u(c,...f))),c},mixin(u){return s.mixins.includes(u)||s.mixins.push(u),c},component(u,f){return f?(s.components[u]=f,c):s.components[u]},directive(u,f){return f?(s.directives[u]=f,c):s.directives[u]},mount(u,f,y){if(!l){const v=c._ceVNode||on(r,i);return v.appContext=s,y===!0?y="svg":y===!1&&(y=void 0),t(v,u,y),l=!0,c._container=u,u.__vue_app__=c,la(v.component)}},onUnmount(u){a.push(u)},unmount(){l&&(Ot(a,c._instance,16),t(null,c._container),delete c._container.__vue_app__)},provide(u,f){return s.provides[u]=f,c},runWithContext(u){const f=Bn;Bn=c;try{return u()}finally{Bn=f}}};return c}}let Bn=null;function Bu(t,e){if(Je){let n=Je.provides;const r=Je.parent&&Je.parent.provides;r===n&&(n=Je.provides=Object.create(r)),n[t]=e}}function Ir(t,e,n=!1){const r=oa();if(r||Bn){let i=Bn?Bn._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&t in i)return i[t];if(arguments.length>1)return n&&oe(e)?e.call(r&&r.proxy):e}}const Uu={},qu=()=>Object.create(Uu),zu=t=>Object.getPrototypeOf(t)===Uu;function my(t,e,n,r=!1){const i={},s=qu();t.propsDefaults=Object.create(null),Hu(t,e,i,s);for(const o in t.propsOptions[0])o in i||(i[o]=void 0);n?t.props=r?i:Tv(i):t.type.props?t.props=i:t.props=s,t.attrs=s}function gy(t,e,n,r){const{props:i,attrs:s,vnode:{patchFlag:o}}=t,a=de(i),[l]=t.propsOptions;let c=!1;if((r||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let f=0;f<u.length;f++){let y=u[f];if(ts(t.emitsOptions,y))continue;const v=e[y];if(l)if(ve(s,y))v!==s[y]&&(s[y]=v,c=!0);else{const b=qt(y);i[b]=Zo(l,a,b,v,t,!1)}else v!==s[y]&&(s[y]=v,c=!0)}}}else{Hu(t,e,i,s)&&(c=!0);let u;for(const f in a)(!e||!ve(e,f)&&((u=tn(f))===f||!ve(e,u)))&&(l?n&&(n[f]!==void 0||n[u]!==void 0)&&(i[f]=Zo(l,a,f,void 0,t,!0)):delete i[f]);if(s!==a)for(const f in s)(!e||!ve(e,f))&&(delete s[f],c=!0)}c&&zt(t.attrs,"set","")}function Hu(t,e,n,r){const[i,s]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(yr(l))continue;const c=e[l];let u;i&&ve(i,u=qt(l))?!s||!s.includes(u)?n[u]=c:(a||(a={}))[u]=c:ts(t.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,o=!0)}if(s){const l=de(n),c=a||me;for(let u=0;u<s.length;u++){const f=s[u];n[f]=Zo(i,l,f,c[f],t,!ve(c,f))}}return o}function Zo(t,e,n,r,i,s){const o=t[n];if(o!=null){const a=ve(o,"default");if(a&&r===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&oe(l)){const{propsDefaults:c}=i;if(n in c)r=c[n];else{const u=Lr(i);r=c[n]=l.call(null,e),u()}}else r=l;i.ce&&i.ce._setProp(n,r)}o[0]&&(s&&!a?r=!1:o[1]&&(r===""||r===tn(n))&&(r=!0))}return r}const vy=new WeakMap;function Wu(t,e,n=!1){const r=n?vy:e.propsCache,i=r.get(t);if(i)return i;const s=t.props,o={},a=[];let l=!1;if(!oe(t)){const u=f=>{l=!0;const[y,v]=Wu(f,e,!0);Fe(o,y),v&&a.push(...v)};!n&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!s&&!l)return Ee(t)&&r.set(t,Rn),Rn;if(se(s))for(let u=0;u<s.length;u++){const f=qt(s[u]);Ku(f)&&(o[f]=me)}else if(s)for(const u in s){const f=qt(u);if(Ku(f)){const y=s[u],v=o[f]=se(y)||oe(y)?{type:y}:Fe({},y),b=v.type;let I=!1,F=!0;if(se(b))for(let O=0;O<b.length;++O){const A=b[O],g=oe(A)&&A.name;if(g==="Boolean"){I=!0;break}else g==="String"&&(F=!1)}else I=oe(b)&&b.name==="Boolean";v[0]=I,v[1]=F,(I||ve(v,"default"))&&a.push(f)}}const c=[o,a];return Ee(t)&&r.set(t,c),c}function Ku(t){return t[0]!=="$"&&!yr(t)}const ea=t=>t==="_"||t==="_ctx"||t==="$stable",ta=t=>se(t)?t.map(Nt):[Nt(t)],yy=(t,e,n)=>{if(e._n)return e;const r=Kv((...i)=>ta(e(...i)),n);return r._c=!1,r},Vu=(t,e,n)=>{const r=t._ctx;for(const i in t){if(ea(i))continue;const s=t[i];if(oe(s))e[i]=yy(i,s,r);else if(s!=null){const o=ta(s);e[i]=()=>o}}},Yu=(t,e)=>{const n=ta(e);t.slots.default=()=>n},Gu=(t,e,n)=>{for(const r in e)(n||!ea(r))&&(t[r]=e[r])},by=(t,e,n)=>{const r=t.slots=qu();if(t.vnode.shapeFlag&32){const i=e._;i?(Gu(r,e,n),n&&Hc(r,"_",i,!0)):Vu(e,r)}else e&&Yu(t,e)},wy=(t,e,n)=>{const{vnode:r,slots:i}=t;let s=!0,o=me;if(r.shapeFlag&32){const a=e._;a?n&&a===1?s=!1:Gu(i,e,n):(s=!e.$stable,Vu(e,i)),o=e}else e&&(Yu(t,e),o={default:1});if(s)for(const a in i)!ea(a)&&o[a]==null&&delete i[a]},at=Dy;function _y(t){return xy(t)}function xy(t,e){const n=Di();n.__VUE__=!0;const{insert:r,remove:i,patchProp:s,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:f,nextSibling:y,setScopeId:v=Ct,insertStaticContent:b}=t,I=(_,k,R,L=null,M=null,j=null,G=void 0,V=null,W=!!k.dynamicChildren)=>{if(_===k)return;_&&!Nr(_,k)&&(L=er(_),ut(_,M,j,!0),_=null),k.patchFlag===-2&&(W=!1,k.dynamicChildren=null);const{type:U,ref:ee,shapeFlag:Q}=k;switch(U){case ns:F(_,k,R,L);break;case qn:O(_,k,R,L);break;case ia:_==null&&A(k,R,L,G);break;case xt:De(_,k,R,L,M,j,G,V,W);break;default:Q&1?h(_,k,R,L,M,j,G,V,W):Q&6?it(_,k,R,L,M,j,G,V,W):(Q&64||Q&128)&&U.process(_,k,R,L,M,j,G,V,W,Pn)}ee!=null&&M?Pr(ee,_&&_.ref,j,k||_,!k):ee==null&&_&&_.ref!=null&&Pr(_.ref,null,j,_,!0)},F=(_,k,R,L)=>{if(_==null)r(k.el=a(k.children),R,L);else{const M=k.el=_.el;k.children!==_.children&&c(M,k.children)}},O=(_,k,R,L)=>{_==null?r(k.el=l(k.children||""),R,L):k.el=_.el},A=(_,k,R,L)=>{[_.el,_.anchor]=b(_.children,k,R,L,_.el,_.anchor)},g=({el:_,anchor:k},R,L)=>{let M;for(;_&&_!==k;)M=y(_),r(_,R,L),_=M;r(k,R,L)},p=({el:_,anchor:k})=>{let R;for(;_&&_!==k;)R=y(_),i(_),_=R;i(k)},h=(_,k,R,L,M,j,G,V,W)=>{k.type==="svg"?G="svg":k.type==="math"&&(G="mathml"),_==null?S(k,R,L,M,j,G,V,W):H(_,k,M,j,G,V,W)},S=(_,k,R,L,M,j,G,V)=>{let W,U;const{props:ee,shapeFlag:Q,transition:Z,dirs:re}=_;if(W=_.el=o(_.type,j,ee&&ee.is,ee),Q&8?u(W,_.children):Q&16&&N(_.children,W,null,L,M,na(_,j),G,V),re&&bn(_,null,L,"created"),T(W,_,_.scopeId,G,L),ee){for(const _e in ee)_e!=="value"&&!yr(_e)&&s(W,_e,null,ee[_e],j,L);"value"in ee&&s(W,"value",null,ee.value,j),(U=ee.onVnodeBeforeMount)&&Dt(U,L,_)}re&&bn(_,null,L,"beforeMount");const ce=Sy(M,Z);ce&&Z.beforeEnter(W),r(W,k,R),((U=ee&&ee.onVnodeMounted)||ce||re)&&at(()=>{U&&Dt(U,L,_),ce&&Z.enter(W),re&&bn(_,null,L,"mounted")},M)},T=(_,k,R,L,M)=>{if(R&&v(_,R),L)for(let j=0;j<L.length;j++)v(_,L[j]);if(M){let j=M.subTree;if(k===j||of(j.type)&&(j.ssContent===k||j.ssFallback===k)){const G=M.vnode;T(_,G,G.scopeId,G.slotScopeIds,M.parent)}}},N=(_,k,R,L,M,j,G,V,W=0)=>{for(let U=W;U<_.length;U++){const ee=_[U]=V?an(_[U]):Nt(_[U]);I(null,ee,k,R,L,M,j,G,V)}},H=(_,k,R,L,M,j,G)=>{const V=k.el=_.el;let{patchFlag:W,dynamicChildren:U,dirs:ee}=k;W|=_.patchFlag&16;const Q=_.props||me,Z=k.props||me;let re;if(R&&wn(R,!1),(re=Z.onVnodeBeforeUpdate)&&Dt(re,R,k,_),ee&&bn(k,_,R,"beforeUpdate"),R&&wn(R,!0),(Q.innerHTML&&Z.innerHTML==null||Q.textContent&&Z.textContent==null)&&u(V,""),U?X(_.dynamicChildren,U,V,R,L,na(k,M),j):G||we(_,k,V,null,R,L,na(k,M),j,!1),W>0){if(W&16)Te(V,Q,Z,R,M);else if(W&2&&Q.class!==Z.class&&s(V,"class",null,Z.class,M),W&4&&s(V,"style",Q.style,Z.style,M),W&8){const ce=k.dynamicProps;for(let _e=0;_e<ce.length;_e++){const pe=ce[_e],qe=Q[pe],ze=Z[pe];(ze!==qe||pe==="value")&&s(V,pe,qe,ze,M,R)}}W&1&&_.children!==k.children&&u(V,k.children)}else!G&&U==null&&Te(V,Q,Z,R,M);((re=Z.onVnodeUpdated)||ee)&&at(()=>{re&&Dt(re,R,k,_),ee&&bn(k,_,R,"updated")},L)},X=(_,k,R,L,M,j,G)=>{for(let V=0;V<k.length;V++){const W=_[V],U=k[V],ee=W.el&&(W.type===xt||!Nr(W,U)||W.shapeFlag&198)?f(W.el):R;I(W,U,ee,null,L,M,j,G,!0)}},Te=(_,k,R,L,M)=>{if(k!==R){if(k!==me)for(const j in k)!yr(j)&&!(j in R)&&s(_,j,k[j],null,M,L);for(const j in R){if(yr(j))continue;const G=R[j],V=k[j];G!==V&&j!=="value"&&s(_,j,V,G,M,L)}"value"in R&&s(_,"value",k.value,R.value,M)}},De=(_,k,R,L,M,j,G,V,W)=>{const U=k.el=_?_.el:a(""),ee=k.anchor=_?_.anchor:a("");let{patchFlag:Q,dynamicChildren:Z,slotScopeIds:re}=k;re&&(V=V?V.concat(re):re),_==null?(r(U,R,L),r(ee,R,L),N(k.children||[],R,ee,M,j,G,V,W)):Q>0&&Q&64&&Z&&_.dynamicChildren?(X(_.dynamicChildren,Z,R,M,j,G,V),(k.key!=null||M&&k===M.subTree)&&Qu(_,k,!0)):we(_,k,R,ee,M,j,G,V,W)},it=(_,k,R,L,M,j,G,V,W)=>{k.slotScopeIds=V,_==null?k.shapeFlag&512?M.ctx.activate(k,R,L,G,W):Vt(k,R,L,M,j,G,W):En(_,k,W)},Vt=(_,k,R,L,M,j,G)=>{const V=_.component=zy(_,L,M);if($u(_)&&(V.ctx.renderer=Pn),Hy(V,!1,G),V.asyncDep){if(M&&M.registerDep(V,Le,G),!_.el){const W=V.subTree=on(qn);O(null,W,k,R),_.placeholder=W.el}}else Le(V,_,k,R,M,j,G)},En=(_,k,R)=>{const L=k.component=_.component;if(Ry(_,k,R))if(L.asyncDep&&!L.asyncResolved){ye(L,k,R);return}else L.next=k,L.update();else k.el=_.el,L.vnode=k},Le=(_,k,R,L,M,j,G)=>{const V=()=>{if(_.isMounted){let{next:Q,bu:Z,u:re,parent:ce,vnode:_e}=_;{const dt=Ju(_);if(dt){Q&&(Q.el=_e.el,ye(_,Q,G)),dt.asyncDep.then(()=>{_.isUnmounted||V()});return}}let pe=Q,qe;wn(_,!1),Q?(Q.el=_e.el,ye(_,Q,G)):Q=_e,Z&&Co(Z),(qe=Q.props&&Q.props.onVnodeBeforeUpdate)&&Dt(qe,ce,Q,_e),wn(_,!0);const ze=rf(_),ft=_.subTree;_.subTree=ze,I(ft,ze,f(ft.el),er(ft),_,M,j),Q.el=ze.el,pe===null&&Ny(_,ze.el),re&&at(re,M),(qe=Q.props&&Q.props.onVnodeUpdated)&&at(()=>Dt(qe,ce,Q,_e),M)}else{let Q;const{el:Z,props:re}=k,{bm:ce,m:_e,parent:pe,root:qe,type:ze}=_,ft=$r(k);wn(_,!1),ce&&Co(ce),!ft&&(Q=re&&re.onVnodeBeforeMount)&&Dt(Q,pe,k),wn(_,!0);{qe.ce&&qe.ce._def.shadowRoot!==!1&&qe.ce._injectChildStyle(ze);const dt=_.subTree=rf(_);I(null,dt,R,L,_,M,j),k.el=dt.el}if(_e&&at(_e,M),!ft&&(Q=re&&re.onVnodeMounted)){const dt=k;at(()=>Dt(Q,pe,dt),M)}(k.shapeFlag&256||pe&&$r(pe.vnode)&&pe.vnode.shapeFlag&256)&&_.a&&at(_.a,M),_.isMounted=!0,k=R=L=null}};_.scope.on();const W=_.effect=new Gc(V);_.scope.off();const U=_.update=W.run.bind(W),ee=_.job=W.runIfDirty.bind(W);ee.i=_,ee.id=_.uid,W.scheduler=()=>Ko(ee),wn(_,!0),U()},ye=(_,k,R)=>{k.component=_;const L=_.vnode.props;_.vnode=k,_.next=null,gy(_,k.props,L,R),wy(_,k.children,R),Tt(),wu(_),It()},we=(_,k,R,L,M,j,G,V,W=!1)=>{const U=_&&_.children,ee=_?_.shapeFlag:0,Q=k.children,{patchFlag:Z,shapeFlag:re}=k;if(Z>0){if(Z&128){Zn(U,Q,R,L,M,j,G,V,W);return}else if(Z&256){Yt(U,Q,R,L,M,j,G,V,W);return}}re&8?(ee&16&&kn(U,M,j),Q!==U&&u(R,Q)):ee&16?re&16?Zn(U,Q,R,L,M,j,G,V,W):kn(U,M,j,!0):(ee&8&&u(R,""),re&16&&N(Q,R,L,M,j,G,V,W))},Yt=(_,k,R,L,M,j,G,V,W)=>{_=_||Rn,k=k||Rn;const U=_.length,ee=k.length,Q=Math.min(U,ee);let Z;for(Z=0;Z<Q;Z++){const re=k[Z]=W?an(k[Z]):Nt(k[Z]);I(_[Z],re,R,null,M,j,G,V,W)}U>ee?kn(_,M,j,!0,!1,Q):N(k,R,L,M,j,G,V,W,Q)},Zn=(_,k,R,L,M,j,G,V,W)=>{let U=0;const ee=k.length;let Q=_.length-1,Z=ee-1;for(;U<=Q&&U<=Z;){const re=_[U],ce=k[U]=W?an(k[U]):Nt(k[U]);if(Nr(re,ce))I(re,ce,R,null,M,j,G,V,W);else break;U++}for(;U<=Q&&U<=Z;){const re=_[Q],ce=k[Z]=W?an(k[Z]):Nt(k[Z]);if(Nr(re,ce))I(re,ce,R,null,M,j,G,V,W);else break;Q--,Z--}if(U>Q){if(U<=Z){const re=Z+1,ce=re<ee?k[re].el:L;for(;U<=Z;)I(null,k[U]=W?an(k[U]):Nt(k[U]),R,ce,M,j,G,V,W),U++}}else if(U>Z)for(;U<=Q;)ut(_[U],M,j,!0),U++;else{const re=U,ce=U,_e=new Map;for(U=ce;U<=Z;U++){const Xe=k[U]=W?an(k[U]):Nt(k[U]);Xe.key!=null&&_e.set(Xe.key,U)}let pe,qe=0;const ze=Z-ce+1;let ft=!1,dt=0;const cn=new Array(ze);for(U=0;U<ze;U++)cn[U]=0;for(U=re;U<=Q;U++){const Xe=_[U];if(qe>=ze){ut(Xe,M,j,!0);continue}let vt;if(Xe.key!=null)vt=_e.get(Xe.key);else for(pe=ce;pe<=Z;pe++)if(cn[pe-ce]===0&&Nr(Xe,k[pe])){vt=pe;break}vt===void 0?ut(Xe,M,j,!0):(cn[vt-ce]=U+1,vt>=dt?dt=vt:ft=!0,I(Xe,k[vt],R,null,M,j,G,V,W),qe++)}const tr=ft?Ey(cn):Rn;for(pe=tr.length-1,U=ze-1;U>=0;U--){const Xe=ce+U,vt=k[Xe],nr=k[Xe+1],Hr=Xe+1<ee?nr.el||nr.placeholder:L;cn[U]===0?I(null,vt,R,Hr,M,j,G,V,W):ft&&(pe<0||U!==tr[pe]?Ue(vt,R,Hr,2):pe--)}}},Ue=(_,k,R,L,M=null)=>{const{el:j,type:G,transition:V,children:W,shapeFlag:U}=_;if(U&6){Ue(_.component.subTree,k,R,L);return}if(U&128){_.suspense.move(k,R,L);return}if(U&64){G.move(_,k,R,Pn);return}if(G===xt){r(j,k,R);for(let Q=0;Q<W.length;Q++)Ue(W[Q],k,R,L);r(_.anchor,k,R);return}if(G===ia){g(_,k,R);return}if(L!==2&&U&1&&V)if(L===0)V.beforeEnter(j),r(j,k,R),at(()=>V.enter(j),M);else{const{leave:Q,delayLeave:Z,afterLeave:re}=V,ce=()=>{_.ctx.isUnmounted?i(j):r(j,k,R)},_e=()=>{j._isLeaving&&j[Gv](!0),Q(j,()=>{ce(),re&&re()})};Z?Z(j,ce,_e):_e()}else r(j,k,R)},ut=(_,k,R,L=!1,M=!1)=>{const{type:j,props:G,ref:V,children:W,dynamicChildren:U,shapeFlag:ee,patchFlag:Q,dirs:Z,cacheIndex:re}=_;if(Q===-2&&(M=!1),V!=null&&(Tt(),Pr(V,null,R,_,!0),It()),re!=null&&(k.renderCache[re]=void 0),ee&256){k.ctx.deactivate(_);return}const ce=ee&1&&Z,_e=!$r(_);let pe;if(_e&&(pe=G&&G.onVnodeBeforeUnmount)&&Dt(pe,k,_),ee&6)_a(_.component,R,L);else{if(ee&128){_.suspense.unmount(R,L);return}ce&&bn(_,null,k,"beforeUnmount"),ee&64?_.type.remove(_,k,R,Pn,L):U&&!U.hasOnce&&(j!==xt||Q>0&&Q&64)?kn(U,k,R,!1,!0):(j===xt&&Q&384||!M&&ee&16)&&kn(W,k,R),L&&ds(_)}(_e&&(pe=G&&G.onVnodeUnmounted)||ce)&&at(()=>{pe&&Dt(pe,k,_),ce&&bn(_,null,k,"unmounted")},R)},ds=_=>{const{type:k,el:R,anchor:L,transition:M}=_;if(k===xt){wa(R,L);return}if(k===ia){p(_);return}const j=()=>{i(R),M&&!M.persisted&&M.afterLeave&&M.afterLeave()};if(_.shapeFlag&1&&M&&!M.persisted){const{leave:G,delayLeave:V}=M,W=()=>G(R,j);V?V(_.el,j,W):W()}else j()},wa=(_,k)=>{let R;for(;_!==k;)R=y(_),i(_),_=R;i(k)},_a=(_,k,R)=>{const{bum:L,scope:M,job:j,subTree:G,um:V,m:W,a:U}=_;Xu(W),Xu(U),L&&Co(L),M.stop(),j&&(j.flags|=8,ut(G,_,k,R)),V&&at(V,k),at(()=>{_.isUnmounted=!0},k)},kn=(_,k,R,L=!1,M=!1,j=0)=>{for(let G=j;G<_.length;G++)ut(_[G],k,R,L,M)},er=_=>{if(_.shapeFlag&6)return er(_.component.subTree);if(_.shapeFlag&128)return _.suspense.next();const k=y(_.anchor||_.el),R=k&&k[Vv];return R?y(R):k};let zr=!1;const hs=(_,k,R)=>{_==null?k._vnode&&ut(k._vnode,null,null,!0):I(k._vnode||null,_,k,null,null,null,R),k._vnode=_,zr||(zr=!0,wu(),_u(),zr=!1)},Pn={p:I,um:ut,m:Ue,r:ds,mt:Vt,mc:N,pc:we,pbc:X,n:er,o:t};return{render:hs,hydrate:void 0,createApp:py(hs)}}function na({type:t,props:e},n){return n==="svg"&&t==="foreignObject"||n==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:n}function wn({effect:t,job:e},n){n?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function Sy(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Qu(t,e,n=!1){const r=t.children,i=e.children;if(se(r)&&se(i))for(let s=0;s<r.length;s++){const o=r[s];let a=i[s];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[s]=an(i[s]),a.el=o.el),!n&&a.patchFlag!==-2&&Qu(o,a)),a.type===ns&&a.patchFlag!==-1&&(a.el=o.el),a.type===qn&&!a.el&&(a.el=o.el)}}function Ey(t){const e=t.slice(),n=[0];let r,i,s,o,a;const l=t.length;for(r=0;r<l;r++){const c=t[r];if(c!==0){if(i=n[n.length-1],t[i]<c){e[r]=i,n.push(r);continue}for(s=0,o=n.length-1;s<o;)a=s+o>>1,t[n[a]]<c?s=a+1:o=a;c<t[n[s]]&&(s>0&&(e[r]=n[s-1]),n[s]=r)}}for(s=n.length,o=n[s-1];s-- >0;)n[s]=o,o=e[o];return n}function Ju(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Ju(e)}function Xu(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}const ky=Symbol.for("v-scx"),Py=()=>Ir(ky);function $y(t,e){return ra(t,null,{flush:"sync"})}function Un(t,e,n){return ra(t,e,n)}function ra(t,e,n=me){const{immediate:r,deep:i,flush:s,once:o}=n,a=Fe({},n),l=e&&r||!e&&s!=="post";let c;if(Mr){if(s==="sync"){const v=Py();c=v.__watcherHandles||(v.__watcherHandles=[])}else if(!l){const v=()=>{};return v.stop=Ct,v.resume=Ct,v.pause=Ct,v}}const u=Je;a.call=(v,b,I)=>Ot(v,u,b,I);let f=!1;s==="post"?a.scheduler=v=>{at(v,u&&u.suspense)}:s!=="sync"&&(f=!0,a.scheduler=(v,b)=>{b?v():Ko(v)}),a.augmentJob=v=>{e&&(v.flags|=4),f&&(v.flags|=2,u&&(v.id=u.uid,v.i=u))};const y=jv(t,e,a);return Mr&&(c?c.push(y):l&&y()),y}function Cy(t,e,n){const r=this.proxy,i=Ce(t)?t.includes(".")?Zu(r,t):()=>r[t]:t.bind(r,r);let s;oe(e)?s=e:(s=e.handler,n=e);const o=Lr(this),a=ra(i,s.bind(r),n);return o(),a}function Zu(t,e){const n=e.split(".");return()=>{let r=t;for(let i=0;i<n.length&&r;i++)r=r[n[i]];return r}}function ef(t,e,n=me){const r=oa(),i=qt(e),s=tn(e),o=tf(t,i),a=Nv((l,c)=>{let u,f=me,y;return $y(()=>{const v=t[i];nt(u,v)&&(u=v,c())}),{get(){return l(),n.get?n.get(u):u},set(v){const b=n.set?n.set(v):v;if(!nt(b,u)&&!(f!==me&&nt(v,f)))return;const I=r.vnode.props;I&&(e in I||i in I||s in I)&&(`onUpdate:${e}`in I||`onUpdate:${i}`in I||`onUpdate:${s}`in I)||(u=v,c()),r.emit(`update:${e}`,b),nt(v,b)&&nt(v,f)&&!nt(b,y)&&c(),f=v,y=b}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?o||me:a,done:!1}:{done:!0}}}},a}const tf=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${qt(e)}Modifiers`]||t[`${tn(e)}Modifiers`];function Ty(t,e,...n){if(t.isUnmounted)return;const r=t.vnode.props||me;let i=n;const s=e.startsWith("update:"),o=s&&tf(r,e.slice(7));o&&(o.trim&&(i=n.map(u=>Ce(u)?u.trim():u)),o.number&&(i=n.map(rv)));let a,l=r[a=$o(e)]||r[a=$o(qt(e))];!l&&s&&(l=r[a=$o(tn(e))]),l&&Ot(l,t,6,i);const c=r[a+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,Ot(c,t,6,i)}}const Iy=new WeakMap;function nf(t,e,n=!1){const r=n?Iy:e.emitsCache,i=r.get(t);if(i!==void 0)return i;const s=t.emits;let o={},a=!1;if(!oe(t)){const l=c=>{const u=nf(c,e,!0);u&&(a=!0,Fe(o,u))};!n&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!s&&!a?(Ee(t)&&r.set(t,null),null):(se(s)?s.forEach(l=>o[l]=null):Fe(o,s),Ee(t)&&r.set(t,o),o)}function ts(t,e){return!t||!Ai(e)?!1:(e=e.slice(2).replace(/Once$/,""),ve(t,e[0].toLowerCase()+e.slice(1))||ve(t,tn(e))||ve(t,e))}function Kw(){}function rf(t){const{type:e,vnode:n,proxy:r,withProxy:i,propsOptions:[s],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:f,data:y,setupState:v,ctx:b,inheritAttrs:I}=t,F=Qi(t);let O,A;try{if(n.shapeFlag&4){const p=i||r,h=p;O=Nt(c.call(h,p,u,f,v,y,b)),A=a}else{const p=e;O=Nt(p.length>1?p(f,{attrs:a,slots:o,emit:l}):p(f,null)),A=e.props?a:Oy(a)}}catch(p){Or.length=0,Vi(p,t,1),O=on(qn)}let g=O;if(A&&I!==!1){const p=Object.keys(A),{shapeFlag:h}=g;p.length&&h&7&&(s&&p.some(Eo)&&(A=Ay(A,s)),g=Hn(g,A,!1,!0))}return n.dirs&&(g=Hn(g,null,!1,!0),g.dirs=g.dirs?g.dirs.concat(n.dirs):n.dirs),n.transition&&Vo(g,n.transition),O=g,Qi(F),O}const Oy=t=>{let e;for(const n in t)(n==="class"||n==="style"||Ai(n))&&((e||(e={}))[n]=t[n]);return e},Ay=(t,e)=>{const n={};for(const r in t)(!Eo(r)||!(r.slice(9)in e))&&(n[r]=t[r]);return n};function Ry(t,e,n){const{props:r,children:i,component:s}=t,{props:o,children:a,patchFlag:l}=e,c=s.emitsOptions;if(e.dirs||e.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?sf(r,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let f=0;f<u.length;f++){const y=u[f];if(o[y]!==r[y]&&!ts(c,y))return!0}}}else return(i||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?sf(r,o,c):!0:!!o;return!1}function sf(t,e,n){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!0;for(let i=0;i<r.length;i++){const s=r[i];if(e[s]!==t[s]&&!ts(n,s))return!0}return!1}function Ny({vnode:t,parent:e},n){for(;e;){const r=e.subTree;if(r.suspense&&r.suspense.activeBranch===t&&(r.el=t.el),r===t)(t=e.vnode).el=n,e=e.parent;else break}}const of=t=>t.__isSuspense;function Dy(t,e){e&&e.pendingBranch?se(t)?e.effects.push(...t):e.effects.push(t):Wv(t)}const xt=Symbol.for("v-fgt"),ns=Symbol.for("v-txt"),qn=Symbol.for("v-cmt"),ia=Symbol.for("v-stc"),Or=[];let lt=null;function zn(t=!1){Or.push(lt=t?null:[])}function Ly(){Or.pop(),lt=Or[Or.length-1]||null}let Ar=1;function af(t,e=!1){Ar+=t,t<0&&lt&&e&&(lt.hasOnce=!0)}function lf(t){return t.dynamicChildren=Ar>0?lt||Rn:null,Ly(),Ar>0&&lt&&lt.push(t),t}function Rr(t,e,n,r,i,s){return lf(Dr(t,e,n,r,i,s,!0))}function My(t,e,n,r,i){return lf(on(t,e,n,r,i,!0))}function cf(t){return t?t.__v_isVNode===!0:!1}function Nr(t,e){return t.type===e.type&&t.key===e.key}const uf=({key:t})=>t??null,rs=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?Ce(t)||Me(t)||oe(t)?{i:Rt,r:t,k:e,f:!!n}:t:null);function Dr(t,e=null,n=null,r=0,i=null,s=t===xt?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&uf(e),ref:e&&rs(e),scopeId:Su,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Rt};return a?(sa(l,n),s&128&&t.normalize(l)):n&&(l.shapeFlag|=Ce(n)?8:16),Ar>0&&!o&&lt&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&&lt.push(l),l}const on=jy;function jy(t,e=null,n=null,r=0,i=null,s=!1){if((!t||t===oy)&&(t=qn),cf(t)){const a=Hn(t,e,!0);return n&&sa(a,n),Ar>0&&!s&&lt&&(a.shapeFlag&6?lt[lt.indexOf(t)]=a:lt.push(a)),a.patchFlag=-2,a}if(Jy(t)&&(t=t.__vccOpts),e){e=Fy(e);let{class:a,style:l}=e;a&&!Ce(a)&&(e.class=Li(a)),Ee(l)&&(Ho(l)&&!se(l)&&(l=Fe({},l)),e.style=To(l))}const o=Ce(t)?1:of(t)?128:Yv(t)?64:Ee(t)?4:oe(t)?2:0;return Dr(t,e,n,r,i,o,s,!0)}function Fy(t){return t?Ho(t)||zu(t)?Fe({},t):t:null}function Hn(t,e,n=!1,r=!1){const{props:i,ref:s,patchFlag:o,children:a,transition:l}=t,c=e?ff(i||{},e):i,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&uf(c),ref:e&&e.ref?n&&s?se(s)?s.concat(rs(e)):[s,rs(e)]:rs(e):s,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==xt?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Hn(t.ssContent),ssFallback:t.ssFallback&&Hn(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&r&&Vo(u,l.clone(u)),u}function By(t=" ",e=0){return on(ns,null,t,e)}function Nt(t){return t==null||typeof t=="boolean"?on(qn):se(t)?on(xt,null,t.slice()):cf(t)?an(t):on(ns,null,String(t))}function an(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Hn(t)}function sa(t,e){let n=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(se(e))n=16;else if(typeof e=="object")if(r&65){const i=e.default;i&&(i._c&&(i._d=!1),sa(t,i()),i._c&&(i._d=!0));return}else{n=32;const i=e._;!i&&!zu(e)?e._ctx=Rt:i===3&&Rt&&(Rt.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else oe(e)?(e={default:e,_ctx:Rt},n=32):(e=String(e),r&64?(n=16,e=[By(e)]):n=8);t.children=e,t.shapeFlag|=n}function ff(...t){const e={};for(let n=0;n<t.length;n++){const r=t[n];for(const i in r)if(i==="class")e.class!==r.class&&(e.class=Li([e.class,r.class]));else if(i==="style")e.style=To([e.style,r.style]);else if(Ai(i)){const s=e[i],o=r[i];o&&s!==o&&!(se(s)&&s.includes(o))&&(e[i]=s?[].concat(s,o):o)}else i!==""&&(e[i]=r[i])}return e}function Dt(t,e,n,r=null){Ot(t,e,7,[n,r])}const Uy=Fu();let qy=0;function zy(t,e,n){const r=t.type,i=(e?e.appContext:t.appContext)||Uy,s={uid:qy++,vnode:t,type:r,parent:e,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new cv(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(i.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Wu(r,i),emitsOptions:nf(r,i),emit:null,emitted:null,propsDefaults:me,inheritAttrs:r.inheritAttrs,ctx:me,data:me,props:me,attrs:me,slots:me,refs:me,setupState:me,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return s.ctx={_:s},s.root=e?e.root:s,s.emit=Ty.bind(null,s),t.ce&&t.ce(s),s}let Je=null;const oa=()=>Je||Rt;let is,aa;{const t=Di(),e=(n,r)=>{let i;return(i=t[n])||(i=t[n]=[]),i.push(r),s=>{i.length>1?i.forEach(o=>o(s)):i[0](s)}};is=e("__VUE_INSTANCE_SETTERS__",n=>Je=n),aa=e("__VUE_SSR_SETTERS__",n=>Mr=n)}const Lr=t=>{const e=Je;return is(t),t.scope.on(),()=>{t.scope.off(),is(e)}},df=()=>{Je&&Je.scope.off(),is(null)};function hf(t){return t.vnode.shapeFlag&4}let Mr=!1;function Hy(t,e=!1,n=!1){e&&aa(e);const{props:r,children:i}=t.vnode,s=hf(t);my(t,r,s,e),by(t,i,n||e);const o=s?Wy(t,e):void 0;return e&&aa(!1),o}function Wy(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,ay);const{setup:r}=n;if(r){Tt();const i=t.setupContext=r.length>1?Vy(t):null,s=Lr(t),o=Mn(r,t,0,[t.props,i]),a=Bc(o);if(It(),s(),(a||t.sp)&&!$r(t)&&ku(t),a){if(o.then(df,df),e)return o.then(l=>{pf(t,l)}).catch(l=>{Vi(l,t,0)});t.asyncDep=o}else pf(t,o)}else mf(t)}function pf(t,e,n){oe(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:Ee(e)&&(t.setupState=gu(e)),mf(t)}function mf(t,e,n){const r=t.type;t.render||(t.render=r.render||Ct);{const i=Lr(t);Tt();try{ly(t)}finally{It(),i()}}}const Ky={get(t,e){return Ke(t,"get",""),t[e]}};function Vy(t){const e=n=>{t.exposed=n||{}};return{attrs:new Proxy(t.attrs,Ky),slots:t.slots,emit:t.emit,expose:e}}function la(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(gu(Iv(t.exposed)),{get(e,n){if(n in e)return e[n];if(n in Cr)return Cr[n](t)},has(e,n){return n in e||n in Cr}})):t.proxy}const Yy=/(?:^|[-_])\w/g,Gy=t=>t.replace(Yy,e=>e.toUpperCase()).replace(/[-_]/g,"");function Qy(t,e=!0){return oe(t)?t.displayName||t.name:t.name||e&&t.__name}function gf(t,e,n=!1){let r=Qy(e);if(!r&&e.__file){const i=e.__file.match(/([^/\\]+)\.\w+$/);i&&(r=i[1])}if(!r&&t&&t.parent){const i=s=>{for(const o in s)if(s[o]===e)return o};r=i(t.components||t.parent.type.components)||i(t.appContext.components)}return r?Gy(r):n?"App":"Anonymous"}function Jy(t){return oe(t)&&"__vccOpts"in t}const vf=(t,e)=>Lv(t,e,Mr),Xy="3.5.22";/**
103
105
  * @vue/runtime-dom v3.5.22
104
106
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
105
107
  * @license MIT
106
- **/let ca;const yf=typeof window<"u"&&window.trustedTypes;if(yf)try{ca=yf.createPolicy("vue",{createHTML:t=>t})}catch{}const bf=ca?t=>ca.createHTML(t):t=>t,Zy="http://www.w3.org/2000/svg",eb="http://www.w3.org/1998/Math/MathML",Kt=typeof document<"u"?document:null,wf=Kt&&Kt.createElement("template"),tb={insert:(t,e,n)=>{e.insertBefore(t,n||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,n,r)=>{const i=e==="svg"?Kt.createElementNS(Zy,t):e==="mathml"?Kt.createElementNS(eb,t):n?Kt.createElement(t,{is:n}):Kt.createElement(t);return t==="select"&&r&&r.multiple!=null&&i.setAttribute("multiple",r.multiple),i},createText:t=>Kt.createTextNode(t),createComment:t=>Kt.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Kt.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,n,r,i,s){const o=n?n.previousSibling:e.lastChild;if(i&&(i===s||i.nextSibling))for(;e.insertBefore(i.cloneNode(!0),n),!(i===s||!(i=i.nextSibling)););else{wf.innerHTML=bf(r==="svg"?`<svg>${t}</svg>`:r==="mathml"?`<math>${t}</math>`:t);const a=wf.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,n)}return[o?o.nextSibling:e.firstChild,n?n.previousSibling:e.lastChild]}},nb=Symbol("_vtc");function rb(t,e,n){const r=t[nb];r&&(e=(e?[e,...r]:[...r]).join(" ")),e==null?t.removeAttribute("class"):n?t.setAttribute("class",e):t.className=e}const _f=Symbol("_vod"),ib=Symbol("_vsh"),sb=Symbol(""),ob=/(?:^|;)\s*display\s*:/;function ab(t,e,n){const r=t.style,i=Ce(n);let s=!1;if(n&&!i){if(e)if(Ce(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();n[a]==null&&is(r,a,"")}else for(const o in e)n[o]==null&&is(r,o,"");for(const o in n)o==="display"&&(s=!0),is(r,o,n[o])}else if(i){if(e!==n){const o=r[sb];o&&(n+=";"+o),r.cssText=n,s=ob.test(n)}}else e&&t.removeAttribute("style");_f in t&&(t[_f]=s?r.display:"",t[ib]&&(r.display="none"))}const xf=/\s*!important$/;function is(t,e,n){if(se(n))n.forEach(r=>is(t,e,r));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const r=lb(t,e);xf.test(n)?t.setProperty(tn(r),n.replace(xf,""),"important"):t[r]=n}}const Sf=["Webkit","Moz","ms"],ua={};function lb(t,e){const n=ua[e];if(n)return n;let r=qt(e);if(r!=="filter"&&r in t)return ua[e]=r;r=zc(r);for(let i=0;i<Sf.length;i++){const s=Sf[i]+r;if(s in t)return ua[e]=s}return e}const Ef="http://www.w3.org/1999/xlink";function kf(t,e,n,r,i,s=lv(e)){r&&e.startsWith("xlink:")?n==null?t.removeAttributeNS(Ef,e.slice(6,e.length)):t.setAttributeNS(Ef,e,n):n==null||s&&!Kc(n)?t.removeAttribute(e):t.setAttribute(e,s?"":en(n)?String(n):n)}function Pf(t,e,n,r,i){if(e==="innerHTML"||e==="textContent"){n!=null&&(t[e]=e==="innerHTML"?bf(n):n);return}const s=t.tagName;if(e==="value"&&s!=="PROGRESS"&&!s.includes("-")){const a=s==="OPTION"?t.getAttribute("value")||"":t.value,l=n==null?t.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in t))&&(t.value=l),n==null&&t.removeAttribute(e),t._value=n;return}let o=!1;if(n===""||n==null){const a=typeof t[e];a==="boolean"?n=Kc(n):n==null&&a==="string"?(n="",o=!0):a==="number"&&(n=0,o=!0)}try{t[e]=n}catch{}o&&t.removeAttribute(i||e)}function cb(t,e,n,r){t.addEventListener(e,n,r)}function ub(t,e,n,r){t.removeEventListener(e,n,r)}const $f=Symbol("_vei");function fb(t,e,n,r,i=null){const s=t[$f]||(t[$f]={}),o=s[e];if(r&&o)o.value=r;else{const[a,l]=db(e);if(r){const c=s[e]=mb(r,i);cb(t,a,c,l)}else o&&(ub(t,a,o,l),s[e]=void 0)}}const Cf=/(?:Once|Passive|Capture)$/;function db(t){let e;if(Cf.test(t)){e={};let r;for(;r=t.match(Cf);)t=t.slice(0,t.length-r[0].length),e[r[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):tn(t.slice(2)),e]}let fa=0;const hb=Promise.resolve(),pb=()=>fa||(hb.then(()=>fa=0),fa=Date.now());function mb(t,e){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;At(gb(r,n.value),e,5,[r])};return n.value=t,n.attached=pb(),n}function gb(t,e){if(se(e)){const n=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{n.call(t),t._stopped=!0},e.map(r=>i=>!i._stopped&&r&&r(i))}else return e}const Tf=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,vb=(t,e,n,r,i,s)=>{const o=i==="svg";e==="class"?rb(t,r,o):e==="style"?ab(t,n,r):Ai(e)?Eo(e)||fb(t,e,n,r,s):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):yb(t,e,r,o))?(Pf(t,e,r),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&kf(t,e,r,o,s,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!Ce(r))?Pf(t,qt(e),r,s,e):(e==="true-value"?t._trueValue=r:e==="false-value"&&(t._falseValue=r),kf(t,e,r,o))};function yb(t,e,n,r){if(r)return!!(e==="innerHTML"||e==="textContent"||e in t&&Tf(e)&&oe(n));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const i=t.tagName;if(i==="IMG"||i==="VIDEO"||i==="CANVAS"||i==="SOURCE")return!1}return Tf(e)&&Ce(n)?!1:e in t}const bb=Fe({patchProp:vb},tb);let If;function wb(){return If||(If=_y(bb))}const _b=(...t)=>{const e=wb().createApp(...t),{mount:n}=e;return e.mount=r=>{const i=Sb(r);if(!i)return;const s=e._component;!oe(s)&&!s.render&&!s.template&&(s.template=i.innerHTML),i.nodeType===1&&(i.textContent="");const o=n(i,!1,xb(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),o},e};function xb(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Sb(t){return Ce(t)?document.querySelector(t):t}const da=Symbol("IPEInjectKey"),Eb=(t,e)=>(e?e.provide(da,t):Bu(da,t),t),kb=()=>{const t=Ir(da);if(!t)throw new Error("InPageEdit instance is not provided");return t},mt='@charset "UTF-8";:host{all:initial;font-family:var(--schema-font-family, ui-sans-serif, system-ui, -apple-system)}*,*:before,*:after{box-sizing:border-box}:host{color:var(--schema-color-fg, #111827)}:host{--schema-radius: var(--schema-radius, 10px)}.wrapper{display:block;background:var(--schema-color-bg, #ffffff)}.form{display:grid;gap:12px}.field{display:grid;gap:6px;padding:8px 10px;border:1px solid var(--schema-color-muted, #e5e7eb);border-radius:var(--schema-radius);background:var(--schema-surface, #fff)}.label{font-size:12px;color:var(--schema-color-muted-text, #6b7280)}.input,select,textarea{width:100%;padding:8px 10px;border-radius:8px;border:1px solid var(--schema-color-muted, #e5e7eb);background:var(--schema-input-bg, #fff);color:inherit}.checkbox{display:inline-flex;align-items:center;gap:8px}.helper{font-size:12px;color:var(--schema-color-muted-text, #6b7280)}.row{display:grid;gap:8px}.actions{display:flex;gap:8px}.btn{padding:6px 10px;border:1px solid var(--schema-color-muted, #e5e7eb);background:var(--schema-btn-bg, #f8fafc);border-radius:8px;cursor:pointer}.btn.primary{background:var(--schema-color-primary, #2563eb);color:#fff;border-color:transparent}.btn:disabled{opacity:.5;cursor:not-allowed}.btn.danger{background:var(--schema-color-danger, #dc2626);color:#fff;border-color:transparent}.group{display:grid;gap:10px;border-left:3px solid var(--schema-color-muted, #e5e7eb);padding-left:10px}.kv{display:grid;grid-template-columns:1fr 1fr auto;gap:8px;align-items:center}.badge{display:inline-flex;padding:2px 6px;border-radius:999px;font-size:11px;background:var(--schema-badge-bg, #eef2ff);color:var(--schema-badge-fg, #4f46e5)}.hidden{display:none!important}.toolbar{display:flex;gap:6px}.schema-collection-row{position:relative;transition:transform var(--schema-collection-transition-duration, .25s) var(--schema-collection-transition-ease, ease),opacity var(--schema-collection-transition-duration, .25s) var(--schema-collection-transition-ease, ease)}.schema-collection-row.enter{opacity:0}.schema-collection-row.enter.enter-active{opacity:1}.schema-collection-row.leaving{opacity:0}.field.schema-type-array .group,.field.schema-type-array .group .row{position:relative}';/**
108
+ **/let ca;const yf=typeof window<"u"&&window.trustedTypes;if(yf)try{ca=yf.createPolicy("vue",{createHTML:t=>t})}catch{}const bf=ca?t=>ca.createHTML(t):t=>t,Zy="http://www.w3.org/2000/svg",eb="http://www.w3.org/1998/Math/MathML",Kt=typeof document<"u"?document:null,wf=Kt&&Kt.createElement("template"),tb={insert:(t,e,n)=>{e.insertBefore(t,n||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,n,r)=>{const i=e==="svg"?Kt.createElementNS(Zy,t):e==="mathml"?Kt.createElementNS(eb,t):n?Kt.createElement(t,{is:n}):Kt.createElement(t);return t==="select"&&r&&r.multiple!=null&&i.setAttribute("multiple",r.multiple),i},createText:t=>Kt.createTextNode(t),createComment:t=>Kt.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Kt.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,n,r,i,s){const o=n?n.previousSibling:e.lastChild;if(i&&(i===s||i.nextSibling))for(;e.insertBefore(i.cloneNode(!0),n),!(i===s||!(i=i.nextSibling)););else{wf.innerHTML=bf(r==="svg"?`<svg>${t}</svg>`:r==="mathml"?`<math>${t}</math>`:t);const a=wf.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,n)}return[o?o.nextSibling:e.firstChild,n?n.previousSibling:e.lastChild]}},nb=Symbol("_vtc");function rb(t,e,n){const r=t[nb];r&&(e=(e?[e,...r]:[...r]).join(" ")),e==null?t.removeAttribute("class"):n?t.setAttribute("class",e):t.className=e}const _f=Symbol("_vod"),ib=Symbol("_vsh"),sb=Symbol(""),ob=/(?:^|;)\s*display\s*:/;function ab(t,e,n){const r=t.style,i=Ce(n);let s=!1;if(n&&!i){if(e)if(Ce(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();n[a]==null&&ss(r,a,"")}else for(const o in e)n[o]==null&&ss(r,o,"");for(const o in n)o==="display"&&(s=!0),ss(r,o,n[o])}else if(i){if(e!==n){const o=r[sb];o&&(n+=";"+o),r.cssText=n,s=ob.test(n)}}else e&&t.removeAttribute("style");_f in t&&(t[_f]=s?r.display:"",t[ib]&&(r.display="none"))}const xf=/\s*!important$/;function ss(t,e,n){if(se(n))n.forEach(r=>ss(t,e,r));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const r=lb(t,e);xf.test(n)?t.setProperty(tn(r),n.replace(xf,""),"important"):t[r]=n}}const Sf=["Webkit","Moz","ms"],ua={};function lb(t,e){const n=ua[e];if(n)return n;let r=qt(e);if(r!=="filter"&&r in t)return ua[e]=r;r=zc(r);for(let i=0;i<Sf.length;i++){const s=Sf[i]+r;if(s in t)return ua[e]=s}return e}const Ef="http://www.w3.org/1999/xlink";function kf(t,e,n,r,i,s=lv(e)){r&&e.startsWith("xlink:")?n==null?t.removeAttributeNS(Ef,e.slice(6,e.length)):t.setAttributeNS(Ef,e,n):n==null||s&&!Kc(n)?t.removeAttribute(e):t.setAttribute(e,s?"":en(n)?String(n):n)}function Pf(t,e,n,r,i){if(e==="innerHTML"||e==="textContent"){n!=null&&(t[e]=e==="innerHTML"?bf(n):n);return}const s=t.tagName;if(e==="value"&&s!=="PROGRESS"&&!s.includes("-")){const a=s==="OPTION"?t.getAttribute("value")||"":t.value,l=n==null?t.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in t))&&(t.value=l),n==null&&t.removeAttribute(e),t._value=n;return}let o=!1;if(n===""||n==null){const a=typeof t[e];a==="boolean"?n=Kc(n):n==null&&a==="string"?(n="",o=!0):a==="number"&&(n=0,o=!0)}try{t[e]=n}catch{}o&&t.removeAttribute(i||e)}function cb(t,e,n,r){t.addEventListener(e,n,r)}function ub(t,e,n,r){t.removeEventListener(e,n,r)}const $f=Symbol("_vei");function fb(t,e,n,r,i=null){const s=t[$f]||(t[$f]={}),o=s[e];if(r&&o)o.value=r;else{const[a,l]=db(e);if(r){const c=s[e]=mb(r,i);cb(t,a,c,l)}else o&&(ub(t,a,o,l),s[e]=void 0)}}const Cf=/(?:Once|Passive|Capture)$/;function db(t){let e;if(Cf.test(t)){e={};let r;for(;r=t.match(Cf);)t=t.slice(0,t.length-r[0].length),e[r[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):tn(t.slice(2)),e]}let fa=0;const hb=Promise.resolve(),pb=()=>fa||(hb.then(()=>fa=0),fa=Date.now());function mb(t,e){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Ot(gb(r,n.value),e,5,[r])};return n.value=t,n.attached=pb(),n}function gb(t,e){if(se(e)){const n=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{n.call(t),t._stopped=!0},e.map(r=>i=>!i._stopped&&r&&r(i))}else return e}const Tf=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,vb=(t,e,n,r,i,s)=>{const o=i==="svg";e==="class"?rb(t,r,o):e==="style"?ab(t,n,r):Ai(e)?Eo(e)||fb(t,e,n,r,s):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):yb(t,e,r,o))?(Pf(t,e,r),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&kf(t,e,r,o,s,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!Ce(r))?Pf(t,qt(e),r,s,e):(e==="true-value"?t._trueValue=r:e==="false-value"&&(t._falseValue=r),kf(t,e,r,o))};function yb(t,e,n,r){if(r)return!!(e==="innerHTML"||e==="textContent"||e in t&&Tf(e)&&oe(n));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const i=t.tagName;if(i==="IMG"||i==="VIDEO"||i==="CANVAS"||i==="SOURCE")return!1}return Tf(e)&&Ce(n)?!1:e in t}const bb=Fe({patchProp:vb},tb);let If;function wb(){return If||(If=_y(bb))}const _b=(...t)=>{const e=wb().createApp(...t),{mount:n}=e;return e.mount=r=>{const i=Sb(r);if(!i)return;const s=e._component;!oe(s)&&!s.render&&!s.template&&(s.template=i.innerHTML),i.nodeType===1&&(i.textContent="");const o=n(i,!1,xb(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),o},e};function xb(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Sb(t){return Ce(t)?document.querySelector(t):t}const da=Symbol("IPEInjectKey"),Eb=(t,e)=>(e?e.provide(da,t):Bu(da,t),t),kb=()=>{const t=Ir(da);if(!t)throw new Error("InPageEdit instance is not provided");return t},mt='@charset "UTF-8";:host{all:initial;font-family:var(--schema-font-family, ui-sans-serif, system-ui, -apple-system)}*,*:before,*:after{box-sizing:border-box}:host{color:var(--schema-color-fg, #111827)}:host{--schema-radius: var(--schema-radius, 10px)}.wrapper{display:block;background:var(--schema-color-bg, #ffffff)}.form{display:grid;gap:12px}.field{display:grid;gap:6px;padding:8px 10px;border:1px solid var(--schema-color-muted, #e5e7eb);border-radius:var(--schema-radius);background:var(--schema-surface, #fff)}.label{font-size:12px;color:var(--schema-color-muted-text, #6b7280)}.input,select,textarea{width:100%;padding:8px 10px;border-radius:8px;border:1px solid var(--schema-color-muted, #e5e7eb);background:var(--schema-input-bg, #fff);color:inherit}.checkbox{display:inline-flex;align-items:center;gap:8px}.helper{font-size:12px;color:var(--schema-color-muted-text, #6b7280)}.row{display:grid;gap:8px}.actions{display:flex;gap:8px}.btn{padding:6px 10px;border:1px solid var(--schema-color-muted, #e5e7eb);background:var(--schema-btn-bg, #f8fafc);border-radius:8px;cursor:pointer}.btn.primary{background:var(--schema-color-primary, #2563eb);color:#fff;border-color:transparent}.btn:disabled{opacity:.5;cursor:not-allowed}.btn.danger{background:var(--schema-color-danger, #dc2626);color:#fff;border-color:transparent}.group{display:grid;gap:10px;border-left:3px solid var(--schema-color-muted, #e5e7eb);padding-left:10px}.kv{display:grid;grid-template-columns:1fr 1fr auto;gap:8px;align-items:center}.badge{display:inline-flex;padding:2px 6px;border-radius:999px;font-size:11px;background:var(--schema-badge-bg, #eef2ff);color:var(--schema-badge-fg, #4f46e5)}.hidden{display:none!important}.toolbar{display:flex;gap:6px}.schema-collection-row{position:relative;transition:transform var(--schema-collection-transition-duration, .25s) var(--schema-collection-transition-ease, ease),opacity var(--schema-collection-transition-duration, .25s) var(--schema-collection-transition-ease, ease)}.schema-collection-row.enter{opacity:0}.schema-collection-row.enter.enter-active{opacity:1}.schema-collection-row.leaving{opacity:0}.field.schema-type-array .group,.field.schema-type-array .group .row{position:relative}';/**
107
109
  * SchemaForm
108
110
  * 一个基于 Schemastery 的 Web Components 表单生成器
109
111
  *
@@ -120,5 +122,5 @@ ${s}`)}i=this.previewWikitext(s,void 0,r,i,{backdrop:!1,draggable:!0})}},1),n.on
120
122
  * @license MIT
121
123
  * @author dragon-fish
122
124
  * @author @openai/gpt-5
123
- */const Af={arrayAdd:"+",arrayMoveUp:"↑",arrayMoveDown:"↓",arrayRemove:"×",dictAdd:"+",dictRemove:"×",rootLabel:"root"},Pe=(t,e)=>{customElements.get(t)||customElements.define(t,e)},Pb=(t,e,n)=>{if(!e.length)return;let r=t,i=null,s=null;for(let a=0;a<e.length-1;a++){const l=e[a];let c=r?.[l];c==null?(c=typeof e[a+1]=="number"?[]:{},r[l]=c):typeof c!="object"&&(c=typeof e[a+1]=="number"?[]:{},r[l]=c),i=r,s=l,r=c}const o=e[e.length-1];if(r==null||typeof r!="object"){const a=typeof o=="number"?[]:{};if(i)i[s]=a,r=a;else return}try{r[o]=n}catch{try{const a=Array.isArray(r)?r.slice():{...r};a[o]=n,i&&(i[s]=a)}catch{}}},jr=t=>t.map(String).join("."),$b=t=>t.replace(/[^a-zA-Z0-9_-]/g,"_"),ln=t=>`schema_${$b(jr(t)||"root")}`,_n=t=>jr(t);function ha(t,e){if(e==null)return e;switch(t){case"number":case"natural":case"percent":{if(e==="")return;const n=Number(e);return Number.isNaN(n)?void 0:n}case"boolean":return!!e;case"date":{if(!e)return;const n=new Date(e);return Number.isNaN(+n)?void 0:n}case"const":case"string":default:return e}}function Of(t){return typeof t=="function"&&!!t?.type}function Rf(t){if(!t)throw new Error("schema is required");if(Of(t))return t;try{const e=Schema.from(t);if(Of(e))return e}catch{}if(t?.type){const e=t.type;if(Schema[e])return Schema[e](t.inner??t.list??t.dict)}throw new Error("无法从传入对象生成 Schemastery 实例,请传入 schema 或 schema.toJSON() 的结果。")}function St(t){return t?.meta??{}}function Cb(t){return t.length>0&&t.every(e=>e?.type==="const")}function Wn(t){if(!t)return;const e=t,n=e.meta||{};if(Object.prototype.hasOwnProperty.call(n,"default"))return n.default;const r=e.type;try{const i=t();if(i!==void 0)return i}catch{}switch(r){case"string":return"";case"number":case"natural":case"percent":return 0;case"boolean":return!1;case"array":return[];case"tuple":return[];case"object":return{};case"dict":return{};case"union":{const i=e.list||[];return i.length?Wn(i[0]):void 0}case"const":return e.value;case"date":return;default:return}}class Lt extends HTMLElement{constructor(){super(),this._path=[],this._i18n=Af,this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=mt,this.$root.appendChild(e)}makeFieldContainer(e,n){const r=document.createElement("div");if(r.className=`field schema-form-item schema-type-${e}`,r.setAttribute("data-path",jr(this._path)),this._label){const i=document.createElement("label");i.className="label",i.textContent=this._label,r.appendChild(i)}if(n){const i=document.createElement("div");i.className="helper",i.textContent=n,r.appendChild(i)}return r}set schema(e){this._schema=Rf(e),this.render()}get schema(){return this._schema}set path(e){this._path=e??[],this.render()}get path(){return this._path}set label(e){this._label=e,this.render()}get label(){return this._label}set i18n(e){e&&(this._i18n={...this._i18n,...e}),this.render()}get i18n(){return this._i18n}setValue(e){this._value=e,this.render()}getValue(){return this._value}emitChange(e){this._value=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{path:this._path,value:e}}))}}class Nf extends Lt{render(){if(this.$input&&this.$root.contains(this.$input)){const s=this._value??"";this.$input.value!==s&&document.activeElement!==this.$input&&(this.$input.value=s);return}this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this.makeFieldContainer("string",e.description),r=document.createElement("input");this.$input=r,r.className="input",r.type="text",r.name=_n(this._path),r.id=ln(this._path),e?.pattern?.source&&(r.pattern=e.pattern.source),e?.max!=null&&(r.maxLength=e.max),r.value=this._value??"",r.oninput=()=>this.emitChange(ha("string",r.value));const i=n.querySelector("label.label");i&&(i.htmlFor=r.id),n.appendChild(r),this.$root.appendChild(n)}}Pe("schema-form-string",Nf);class Df extends Lt{render(){if(this.$input&&this.$root.contains(this.$input)){const o=this._value??"";this.$input.value!==String(o)&&document.activeElement!==this.$input&&(this.$input.value=o);return}this.$root.innerHTML=`<style>${mt}</style>`;const e=this._schema?.type??"number",n=St(this._schema),r=this.makeFieldContainer("number",n.description),i=document.createElement("input");this.$input=i,i.className="input",i.name=_n(this._path),i.id=ln(this._path),n?.min!=null&&(i.min=String(n.min)),n?.max!=null&&(i.max=String(n.max)),n?.step!=null&&(i.step=String(n.step)),e==="percent"&&!i.step&&(i.step="0.01"),i.value=this._value??"",i.oninput=()=>this.emitChange(ha(e,i.value));const s=r.querySelector("label.label");s&&(s.htmlFor=i.id),n.role==="slider"?i.type="range":i.type="number",r.appendChild(i),this.$root.appendChild(r)}}Pe("schema-form-number",Df);class Lf extends Lt{render(){this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this.makeFieldContainer("boolean",e.description),r=document.createElement("label");r.className="checkbox";const i=document.createElement("input");i.type="checkbox",i.checked=!!this._value,i.name=_n(this._path),i.id=ln(this._path);const s=document.createElement("span");s.textContent=e.description??this._label??"",i.onchange=()=>this.emitChange(i.checked);const o=n.querySelector("label.label");o&&(o.htmlFor=i.id),r.append(i,s),n.appendChild(r),this.$root.appendChild(n)}}Pe("schema-form-boolean",Lf);function ss(t){return String(t).padStart(2,"0")}function Fr(t){return`${t.getFullYear()}-${ss(t.getMonth()+1)}-${ss(t.getDate())}`}function pa(t){return`${ss(t.getHours())}:${ss(t.getMinutes())}`}function os(t){return`${Fr(t)}T${pa(t)}`}class Mf extends Lt{render(){if(this.$input&&this.$root.contains(this.$input)){const o=St(this._schema).role||"date";if(document.activeElement!==this.$input)if(this._value instanceof Date)o==="date"?this.$input.value=Fr(this._value):o==="time"?this.$input.value=pa(this._value):o==="datetime"&&(this.$input.value=os(this._value));else if(typeof this._value=="string"&&o!=="time"){const a=new Date(this._value);isNaN(+a)||(o==="date"?this.$input.value=Fr(a):o==="datetime"&&(this.$input.value=os(a)))}else this._value||(this.$input.value="");return}this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this.makeFieldContainer("date",e.description),r=document.createElement("input");this.$input=r,r.className="input";const i=e.role||"date";if(i==="datetime"?r.type="datetime-local":i==="time"?r.type="time":r.type="date",r.name=_n(this._path),r.id=ln(this._path),this._value instanceof Date)i==="date"?r.value=Fr(this._value):i==="time"?r.value=pa(this._value):i==="datetime"&&(r.value=os(this._value));else if(typeof this._value=="string"&&i!=="time"){const o=new Date(this._value);isNaN(+o)||(i==="date"?r.value=Fr(o):i==="datetime"&&(r.value=os(o)))}r.oninput=()=>{e.role;let o;if(!r.value)o=void 0;else{const a=new Date(r.value);o=Number.isNaN(+a)?void 0:a}this.emitChange(o)};const s=n.querySelector("label.label");s&&(s.htmlFor=r.id),n.appendChild(r),this.$root.appendChild(n)}}Pe("schema-form-date",Mf);class jf extends Lt{render(){this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this._schema.value;if(e.role==="raw-html"){if(n instanceof Node){this.$root.appendChild(n);return}const o=document.createElement("div");o.innerHTML=String(n),this.$root.appendChild(o);return}const r=this.makeFieldContainer("const",e.description),i=document.createElement("section");i.className="const content",i.textContent=String(n),i.id=ln(this._path);const s=r.querySelector("label.label");s&&(s.htmlFor=i.id),r.appendChild(i),this.$root.appendChild(r)}}Pe("schema-form-const",jf);function Tb(t){switch(t.type){case"string":return"schema-form-string";case"number":case"natural":case"percent":return"schema-form-number";case"boolean":return"schema-form-boolean";case"date":return"schema-form-date";case"const":return"schema-form-const";case"array":return"schema-form-array";case"object":return"schema-form-object";case"tuple":return"schema-form-tuple";case"dict":return"schema-form-dict";case"union":{const e=t.list||[];return e.length===2&&e[0]?.type==="is"&&e[0]?.constructor===Date&&e[1]?.type==="transform"&&(e[1]?.inner?.meta?.role==="datetime"||e[1]?.inner?.meta?.role==="date"||e[1]?.inner?.meta?.role==="time")?"schema-form-date":"schema-form-union"}default:return"schema-form-string"}}function Kn(t,e,n,r,i){const s=Tb(t),o=document.createElement(s);return o.schema=t,o.path=e,o.label=r,i&&(o.i18n=i),o.setValue?.(n),o}class Ff extends Lt{render(){this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this.makeFieldContainer("union",e.description),r=this._schema.list||[];if(Cb(r)){const i=document.createElement("select");i.className="input",i.name=_n(this._path),i.id=ln(this._path),r.forEach(o=>{const a=document.createElement("option");a.value=String(o.value),a.textContent=String(o.value),this._value===o.value&&(a.selected=!0),i.appendChild(a)}),i.onchange=()=>this.emitChange(ha("string",i.value));const s=n.querySelector("label.label");s&&(s.htmlFor=i.id),n.appendChild(i)}else{const i=document.createElement("div");i.className="toolbar";const s=document.createElement("select");s.className="input",s.name=_n(this._path)+".__type",s.id=ln(this._path)+"__type";let o=0;r.forEach((u,f)=>{const p=document.createElement("option");p.value=String(f),p.textContent=u.type,s.appendChild(p)}),s.onchange=()=>{o=Number(s.value);const u=r[o],f=Wn(u);this.emitChange(f),c()};const a=n.querySelector("label.label");a&&(a.htmlFor=s.id),i.appendChild(s),n.appendChild(i);const l=document.createElement("div");l.className="group";const c=()=>{l.innerHTML="";const u=r[o],f=Kn(u,this._path,this._value,this._label);f.addEventListener("change",p=>{p.stopPropagation(),this.emitChange(p.detail.value)}),l.appendChild(f)};c(),n.appendChild(l)}this.$root.appendChild(n)}}Pe("schema-form-union",Ff);class Bf extends Lt{render(){this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this.makeFieldContainer("tuple",e.description),r=document.createElement("div");r.className="group";const i=Array.isArray(this._value)?this._value:[];(this._schema.list||[]).forEach((s,o)=>{const a=Kn(s,[...this._path,o],i[o],`${this._label??""}[${o}]`);a.addEventListener("change",l=>{l.stopPropagation();const c=Array.isArray(this._value)?this._value.slice():[];c[o]=l.detail.value,this.emitChange(c)}),r.appendChild(a)}),n.appendChild(r),this.$root.appendChild(n)}}Pe("schema-form-tuple",Bf);class Uf extends Lt{render(){this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this.makeFieldContainer("object",e.description),r=document.createElement("div");r.className="group";const i=this._schema.dict||{};Object.keys(i).forEach(s=>{if(i[s]?.meta?.hidden)return;const o=(this._value??{})[s],a=Kn(i[s],[...this._path,s],o,s);a.addEventListener("change",l=>{l.stopPropagation();const c={...this._value??{}};c[s]=l.detail.value,this.emitChange(c)}),r.appendChild(a)}),n.appendChild(r),this.$root.appendChild(n)}}Pe("schema-form-object",Uf);const us=class us extends Lt{constructor(){super(...arguments),this._itemIds=[]}generateItemId(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return"i"+us._idCounter++}ensureItemIds(e){for(;this._itemIds.length<e;)this._itemIds.push(this.generateItemId());this._itemIds.length>e&&(this._itemIds.length=e)}capturePositions(e){const n={};return e.querySelectorAll(".row").forEach(r=>{const i=r.dataset.uid;i&&(n[i]=r.getBoundingClientRect())}),n}playFLIP(e,n){Array.from(e.querySelectorAll(".row")).forEach(r=>{const i=r.dataset.uid;if(!i)return;const s=n[i];if(!s)return;const o=r.getBoundingClientRect(),a=s.left-o.left,l=s.top-o.top;(a||l)&&(r.style.transition="none",r.style.transform=`translate(${a}px, ${l}px)`,requestAnimationFrame(()=>{r.style.transition="transform .25s ease",r.style.transform=""}))})}render(){this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this.makeFieldContainer("array",e.description),r=document.createElement("div");r.className="group";const i=this._schema.inner,s=()=>Array.isArray(this._value)?this._value:[];this.ensureItemIds(s().length);const o=(c,u)=>{r.innerHTML="",s().forEach((f,p)=>{const v=[...this._path,p],b=document.createElement("div");b.className="row schema-collection-row";const I=this._itemIds[p];b.dataset.uid=I,b.setAttribute("data-path",jr(v));const B=Kn(i,v,f,`${this._label??""}[${p}]`);B.addEventListener("change",h=>{h.stopPropagation();const S=s().slice();S[p]=h.detail.value,this._value=S,this.emitChange(S)});const D=document.createElement("div");D.className="actions";const A=document.createElement("button");A.type="button",A.className="btn",A.textContent=this._i18n.arrayMoveUp??"↑",A.onclick=()=>{if(p<=0)return;const h=this.capturePositions(r),S=s().slice();[S[p-1],S[p]]=[S[p],S[p-1]],[this._itemIds[p-1],this._itemIds[p]]=[this._itemIds[p],this._itemIds[p-1]],this._value=S,o(h),this.emitChange(S)};const y=document.createElement("button");y.type="button",y.className="btn",y.textContent=this._i18n.arrayMoveDown??"↓",y.onclick=()=>{const h=s();if(p>=h.length-1)return;const S=this.capturePositions(r),T=h.slice();[T[p+1],T[p]]=[T[p],T[p+1]],[this._itemIds[p+1],this._itemIds[p]]=[this._itemIds[p],this._itemIds[p+1]],this._value=T,o(S),this.emitChange(T)};const m=document.createElement("button");m.type="button",m.className="btn danger",m.textContent=this._i18n.arrayRemove??"×",m.onclick=()=>{b.classList.add("leaving");const h=250;let S=!1;const T=()=>{if(S)return;S=!0,clearTimeout(R);const H=s().filter((Te,De)=>De!==p);this._itemIds.splice(p,1);const X=this.capturePositions(r);this._value=H,o(X),this.emitChange(H)};b.addEventListener("transitionend",T,{once:!0});const R=setTimeout(T,h+80)},D.append(A,y,m),b.appendChild(B),b.appendChild(D),r.appendChild(b),u&&u===I&&(b.classList.add("enter"),requestAnimationFrame(()=>{b.classList.add("enter-active")}),requestAnimationFrame(()=>{b.classList.remove("enter")}))}),c&&this.playFLIP(r,c)};o();const a=document.createElement("button");a.type="button",a.className="btn primary",a.textContent=this._i18n.arrayAdd??"+",a.onclick=()=>{const c=this.capturePositions(r),u=s().slice(),f=Wn(i);u.push(f);const p=this.generateItemId();this._itemIds.push(p),this._value=u,o(c,p),this.emitChange(u)};const l=document.createElement("div");l.className="actions",l.appendChild(a),n.appendChild(r),n.appendChild(l),this.$root.appendChild(n)}};us._idCounter=0;let as=us;Pe("schema-form-array",as);class qf extends Lt{render(){this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this.makeFieldContainer("dict",e.description),r=document.createElement("div");r.className="group";const i=this._schema.inner,s=this._value??{},o=p=>`d_${p}`,a=()=>{const p={};return r.querySelectorAll(".kv").forEach(v=>{const b=v.dataset.uid;b&&(p[b]=v.getBoundingClientRect())}),p},l=p=>{r.querySelectorAll(".kv").forEach(v=>{const b=v.dataset.uid;if(!b)return;const I=p[b];if(!I)return;const B=v.getBoundingClientRect(),D=I.left-B.left,A=I.top-B.top;(D||A)&&(v.style.transition="none",v.style.transform=`translate(${D}px, ${A}px)`,requestAnimationFrame(()=>{v.style.transition="transform .25s ease",v.style.transform=""}))})},c=(p,v)=>{r.innerHTML="",Object.keys(s).forEach(b=>{const I=[...this._path,b],B=document.createElement("div");B.className="kv schema-collection-row",B.dataset.uid=o(b),B.setAttribute("data-path",jr(I));const D=document.createElement("input");D.className="input",D.value=b,D.name=_n(I)+".__key",D.id=ln(I)+"__key";const A=Kn(i,I,s[b],`${this._label??""}[${b}]`),y=document.createElement("button");y.type="button",y.className="btn danger",y.textContent=this._i18n.dictRemove??"×",y.onclick=()=>{const m=a();delete s[b];const h={...this._value??{}};delete h[b],this._value=h,c(m),this.emitChange(h)},D.onchange=()=>{const m=D.value.trim();if(!m||m===b||s[m]!==void 0)return;const h=a();s[m]=s[b],delete s[b];const S={...this._value??{}};S[m]=S[b],delete S[b],this._value=S,c(h),this.emitChange(S)},A.addEventListener("change",m=>{m.stopPropagation();const h={...this._value??{}};h[b]=m.detail.value,this._value=h,this.emitChange(h)}),B.append(D,A,y),r.appendChild(B),v===b&&(B.classList.add("enter"),requestAnimationFrame(()=>B.classList.add("enter-active")),requestAnimationFrame(()=>B.classList.remove("enter")))}),p&&l(p)};c();const u=document.createElement("button");u.type="button",u.className="btn primary",u.textContent=this._i18n.dictAdd??"+",u.onclick=()=>{let p=Object.keys(s).length+1,v=`k${p}`;for(;s[v]!==void 0;)v=`k${++p}`;const b=a();s[v]=Wn(i);const I={...this._value??{},[v]:s[v]};this._value=I,c(b,v),this.emitChange(I)};const f=document.createElement("div");f.className="actions",f.appendChild(u),n.appendChild(r),n.appendChild(f),this.$root.appendChild(n)}}Pe("schema-form-dict",qf);class zf extends HTMLElement{constructor(){super(),this._i18n={...Af},this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=mt,this.$root.appendChild(e);const n=document.createElement("div");n.className="wrapper",n.innerHTML='<form class="form" part="form"></form>',this.$root.appendChild(n),this.addEventListener("change",r=>{if(!r?.detail)return;const{path:i,value:s}=r.detail;Array.isArray(i)&&i.length===0?this._state=s:Pb(this._state??(this._state={}),i,s),this.dispatchEvent(new CustomEvent("form-change",{detail:{path:i,value:s,state:this._state}}))})}set schema(e){this._schema=Rf(e);try{this._state=this._schema(null,{autofix:!0})}catch{this._state=Wn(this._schema)}this.render()}get schema(){return this._schema}set schemaJSON(e){this.schema=e}get schemaJSON(){return this._schema?.toJSON?.()}setData(e,n={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const r=n.validate?this._schema(e??null,{autofix:n.autofix}):e;this._state=r,this.render()}getData(e={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const n=this._state;return e.validate?this._schema(n??null,{autofix:e.autofix}):n}reset(){try{this._state=this._schema(null,{autofix:!0})}catch{this._state=Wn(this._schema)}this.render()}refresh(){this.render()}set i18n(e){this._i18n={...this._i18n,...e},this.render()}get i18n(){return this._i18n}render(){if(!this._schema)return;const e=this.$root.querySelector("form");e.innerHTML="";const n=Kn(this._schema,[],this._state,this._i18n.rootLabel,this._i18n);e.appendChild(n)}}Pe("schema-form",zf);function Ib(){Pe("schema-form",zf),Pe("schema-form-string",Nf),Pe("schema-form-number",Df),Pe("schema-form-boolean",Lf),Pe("schema-form-date",Mf),Pe("schema-form-const",jf),Pe("schema-form-union",Ff),Pe("schema-form-tuple",Bf),Pe("schema-form-object",Uf),Pe("schema-form-array",as),Pe("schema-form-dict",qf)}const Ab=Eu({__name:"SchemasteryFormVue",props:Ru({schema:{},value:{},validateOnChange:{type:Boolean,default:!1}},{schema:{required:!0},schemaModifiers:{},value:{required:!1,default:{}},valueModifiers:{}}),emits:Ru(["change"],["update:schema","update:value"]),setup(t,{expose:e,emit:n}){const r=ef(t,"schema"),i=ef(t,"value"),s=n,o=Qv("elRef");let a=!1,l=!1;const c=u=>{if(l)return;const f=o.value,p=t.validateOnChange?f.getData({validate:!0}):u.detail.state;a=!0,i.value=p,Yi(()=>{a=!1}),s("change",u.detail)};return Tu(()=>{Ib()}),Yo(()=>{const u=o.value;r.value&&(u.schema=r.value),i.value!==void 0&&u.setData(i.value,{validate:!1,autofix:!0}),u.addEventListener("form-change",c)}),Iu(()=>{o.value?.removeEventListener("form-change",c)}),Un(()=>r,u=>{a||o.value&&u&&o.value.schema!==u.value&&(l=!0,o.value.schema=u.value,Yi(()=>{l=!1}))},{deep:!0,immediate:!0}),Un(()=>i,u=>{if(a||!o.value||u.value===void 0)return;const f=o.value.getData({validate:!1});JSON.stringify(f)!==JSON.stringify(u.value)&&(l=!0,o.value.setData(u.value,{validate:!1}),Yi(()=>{l=!1}))},{deep:!0,immediate:!0}),e({setData(u,f){const p=o.value;p.setData(u,{validate:!!f?.validate}),f?.emit&&(i.value=p.getData({validate:!!f?.validate}))},getData(u){return o.value.getData(u)},setSchema(u,f=!0){o.value.schema=u,f&&(r.value=u)},refresh(){o.value.refresh()},reset(){o.value.reset()},el:o}),(u,f)=>(zn(),Rr("schema-form",ff({ref_key:"elRef",ref:o},u.$attrs),null,16))}});function xn(t,e=new WeakMap){if(Me(t))return xn(t.value,e);if(t===null||typeof t!="object")return t;if(e.has(t))return e.get(t);if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(t instanceof Map){const i=new Map;return e.set(t,i),Array.from(t.entries()).forEach(([s,o])=>{i.set(s,xn(o,e))}),i}if(t instanceof Set){const i=new Set;return e.set(t,i),Array.from(t).forEach(s=>{i.add(xn(s,e))}),i}if(Array.isArray(t)){const i=[];e.set(t,i);for(const s of t)i.push(xn(s,e));return i}const n=de(t),r={};e.set(t,r);for(const i of Object.keys(n))r[i]=xn(n[i],e);for(const i of Object.getOwnPropertySymbols(n))r[i]=xn(n[i],e);return r}const Ob={class:"preferences-ui-app"},Rb={class:"tabs"},Nb=["onClick","data-value"],Db={style:{"max-height":"20em",overflow:"auto"}},Lb=((t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n})(Eu({__name:"PreferencesForm",setup(t,{expose:e}){const n=kb(),r=hu([]),i=hu(""),s=zi([]),o=vf(()=>s.value.map(c=>c.schema)),a=zi({}),l=zi({});return e({getValue(){return xn(l)}}),Un(i,c=>{c&&(a.value=l.value,s.value=n.preferences.getConfigRegistries(c))},{immediate:!0}),Yo(async()=>{n.inject(["preferences"],async c=>{const u=await c.preferences.getAll();a.value=l.value=u,r.value=c.preferences.getConfigCategories(),i.value=r.value[0].name})}),(c,u)=>(zn(),Rr("div",Ob,[Dr("div",Rb,[(zn(!0),Rr(xt,null,Ou(r.value,f=>(zn(),Rr("a",{class:Di(["tab",{active:i.value===f.name}]),key:f.name,onClick:p=>i.value=f.name,"data-value":f.name},Io(f.label),11,Nb))),128))]),(zn(!0),Rr(xt,null,Ou(o.value,(f,p)=>(zn(),My(mu(Ab),{key:`${i.value}-${p}`,schema:f,value:a.value,"onUpdate:value":u[0]||(u[0]=v=>l.value=v),"validate-on-change":!1,i18n:{rootLabel:""}},null,8,["schema","value"]))),128)),Dr("details",null,[Dr("pre",Db,Io(l.value),1)])]))}}),[["__scopeId","data-v-e89c782f"]]);var Mb=Object.create,ma=Object.defineProperty,jb=Object.getOwnPropertyDescriptor,Hf=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Wf=t=>{throw TypeError(t)},Fb=(t,e,n)=>e in t?ma(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Bb=(t,e)=>ma(t,"name",{value:e,configurable:!0}),Ub=t=>[,,,Mb(t?.[Hf("metadata")]??null)],qb=["class","method","getter","setter","accessor","field","value","get","set"],Kf=t=>t!==void 0&&typeof t!="function"?Wf("Function expected"):t,zb=(t,e,n,r,i)=>({kind:qb[t],name:e,metadata:r,addInitializer:s=>n._?Wf("Already initialized"):i.push(Kf(s||null))}),Hb=(t,e)=>Fb(e,Hf("metadata"),t[3]),Wb=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Kb=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,p=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&jb(i,n));Bb(i,n);for(var b=r.length-1;b>=0;b--)l=zb(c,n,a={},t[3],p),o=(0,r[b])(i,l),a._=1,Kf(o)&&(i=o);return Hb(t,i),v&&ma(i,n,v),u?c^4?s:v:i},Vf,ga,Yf;Vf=[We(["preferences","modal"])];class ls extends(Yf=ot){constructor(e){super(e,{},"preferences-ui"),this.ctx=e,e.set("preferencesUI",this),e.inject(["toolbox"],n=>{n.toolbox.addButton({id:"preferences",icon:w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-settings",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M14.647 4.081a.724 .724 0 0 0 1.08 .448c2.439 -1.485 5.23 1.305 3.745 3.744a.724 .724 0 0 0 .447 1.08c2.775 .673 2.775 4.62 0 5.294a.724 .724 0 0 0 -.448 1.08c1.485 2.439 -1.305 5.23 -3.744 3.745a.724 .724 0 0 0 -1.08 .447c-.673 2.775 -4.62 2.775 -5.294 0a.724 .724 0 0 0 -1.08 -.448c-2.439 1.485 -5.23 -1.305 -3.745 -3.744a.724 .724 0 0 0 -.447 -1.08c-2.775 -.673 -2.775 -4.62 0 -5.294a.724 .724 0 0 0 .448 -1.08c-1.485 -2.439 1.305 -5.23 3.744 -3.745a.722 .722 0 0 0 1.08 -.447c.673 -2.775 4.62 -2.775 5.294 0zm-2.647 4.919a3 3 0 1 0 0 6a3 3 0 0 0 0 -6z"})]}),tooltip:"Open preferences",group:"group2",index:1/0,onClick:()=>this.showModal()}),this.addDisposeHandler(()=>{n.toolbox.removeButton("preferences")})})}showModal(){const e=this.ctx.modal.show({className:"ipe-preference compact-buttons",sizeClass:"small",outSideClose:!1,center:!0,title:"InPageEdit Preferences",content:w(Ft,{children:w(Xt,{})})});e.get$window().classList.add("dialog");const n=w("div",{id:"ipe-preferences-app",style:{minHeight:"65vh"}});e.setContent(n);const r=this.createFormApp(),i=r.mount(n);e.setButtons([{label:"Cancel",className:"is-danger is-ghost",method:()=>{e.close()}},{label:"Save",className:"is-primary is-ghost",method:()=>{const s=i.getValue();this.logger.info("saving preferences",s);try{Object.entries(s).forEach(([o,a])=>{this.ctx.preferences.set(o,a).catch(console.error)})}catch(o){this.logger.error("failed to save preferences",o)}e.close(),this.ctx.modal.notify("success",{title:"Preferences Saved",content:w("p",{children:"Some settings may take effect after reloading the page."})})}}]),e.on(e.Event.Close,()=>{this.logger.debug("preferences modal closed, vue app unmounting"),r.unmount()})}createFormApp(){const e=_b(Lb);return Eb(this.ctx,e),e}}ga=Ub(Yf),ls=Kb(ga,0,"PluginPreferencesUI",Vf,ls),Wb(ga,1,ls);const Vb=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferencesUI(){return ls}},Symbol.toStringTag,{value:"Module"}));le.BasePlugin=ot,le.InPageEdit=gn,le.Inject=We,le.Logger=Zr,le.LoggerLevel=Es,le.Schema=fe,le.Service=Jt,le.createLogger=za,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
125
+ */const Of={arrayAdd:"+",arrayMoveUp:"↑",arrayMoveDown:"↓",arrayRemove:"×",dictAdd:"+",dictRemove:"×",rootLabel:"root"},Pe=(t,e)=>{customElements.get(t)||customElements.define(t,e)},Pb=(t,e,n)=>{if(!e.length)return;let r=t,i=null,s=null;for(let a=0;a<e.length-1;a++){const l=e[a];let c=r?.[l];c==null?(c=typeof e[a+1]=="number"?[]:{},r[l]=c):typeof c!="object"&&(c=typeof e[a+1]=="number"?[]:{},r[l]=c),i=r,s=l,r=c}const o=e[e.length-1];if(r==null||typeof r!="object"){const a=typeof o=="number"?[]:{};if(i)i[s]=a,r=a;else return}try{r[o]=n}catch{try{const a=Array.isArray(r)?r.slice():{...r};a[o]=n,i&&(i[s]=a)}catch{}}},jr=t=>t.map(String).join("."),$b=t=>t.replace(/[^a-zA-Z0-9_-]/g,"_"),ln=t=>`schema_${$b(jr(t)||"root")}`,_n=t=>jr(t);function ha(t,e){if(e==null)return e;switch(t){case"number":case"natural":case"percent":{if(e==="")return;const n=Number(e);return Number.isNaN(n)?void 0:n}case"boolean":return!!e;case"date":{if(!e)return;const n=new Date(e);return Number.isNaN(+n)?void 0:n}case"const":case"string":default:return e}}function Af(t){return typeof t=="function"&&!!t?.type}function Rf(t){if(!t)throw new Error("schema is required");if(Af(t))return t;try{const e=Schema.from(t);if(Af(e))return e}catch{}if(t?.type){const e=t.type;if(Schema[e])return Schema[e](t.inner??t.list??t.dict)}throw new Error("无法从传入对象生成 Schemastery 实例,请传入 schema 或 schema.toJSON() 的结果。")}function St(t){return t?.meta??{}}function Cb(t){return t.length>0&&t.every(e=>e?.type==="const")}function Wn(t){if(!t)return;const e=t,n=e.meta||{};if(Object.prototype.hasOwnProperty.call(n,"default"))return n.default;const r=e.type;try{const i=t();if(i!==void 0)return i}catch{}switch(r){case"string":return"";case"number":case"natural":case"percent":return 0;case"boolean":return!1;case"array":return[];case"tuple":return[];case"object":return{};case"dict":return{};case"union":{const i=e.list||[];return i.length?Wn(i[0]):void 0}case"const":return e.value;case"date":return;default:return}}class Lt extends HTMLElement{constructor(){super(),this._path=[],this._i18n=Of,this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=mt,this.$root.appendChild(e)}makeFieldContainer(e,n){const r=document.createElement("div");if(r.className=`field schema-form-item schema-type-${e}`,r.setAttribute("data-path",jr(this._path)),this._label){const i=document.createElement("label");i.className="label",i.textContent=this._label,r.appendChild(i)}if(n){const i=document.createElement("div");i.className="helper",i.textContent=n,r.appendChild(i)}return r}set schema(e){this._schema=Rf(e),this.render()}get schema(){return this._schema}set path(e){this._path=e??[],this.render()}get path(){return this._path}set label(e){this._label=e,this.render()}get label(){return this._label}set i18n(e){e&&(this._i18n={...this._i18n,...e}),this.render()}get i18n(){return this._i18n}setValue(e){this._value=e,this.render()}getValue(){return this._value}emitChange(e){this._value=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{path:this._path,value:e}}))}}class Nf extends Lt{render(){if(this.$input&&this.$root.contains(this.$input)){const s=this._value??"";this.$input.value!==s&&document.activeElement!==this.$input&&(this.$input.value=s);return}this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this.makeFieldContainer("string",e.description),r=document.createElement("input");this.$input=r,r.className="input",r.type="text",r.name=_n(this._path),r.id=ln(this._path),e?.pattern?.source&&(r.pattern=e.pattern.source),e?.max!=null&&(r.maxLength=e.max),r.value=this._value??"",r.oninput=()=>this.emitChange(ha("string",r.value));const i=n.querySelector("label.label");i&&(i.htmlFor=r.id),n.appendChild(r),this.$root.appendChild(n)}}Pe("schema-form-string",Nf);class Df extends Lt{render(){if(this.$input&&this.$root.contains(this.$input)){const o=this._value??"";this.$input.value!==String(o)&&document.activeElement!==this.$input&&(this.$input.value=o);return}this.$root.innerHTML=`<style>${mt}</style>`;const e=this._schema?.type??"number",n=St(this._schema),r=this.makeFieldContainer("number",n.description),i=document.createElement("input");this.$input=i,i.className="input",i.name=_n(this._path),i.id=ln(this._path),n?.min!=null&&(i.min=String(n.min)),n?.max!=null&&(i.max=String(n.max)),n?.step!=null&&(i.step=String(n.step)),e==="percent"&&!i.step&&(i.step="0.01"),i.value=this._value??"",i.oninput=()=>this.emitChange(ha(e,i.value));const s=r.querySelector("label.label");s&&(s.htmlFor=i.id),n.role==="slider"?i.type="range":i.type="number",r.appendChild(i),this.$root.appendChild(r)}}Pe("schema-form-number",Df);class Lf extends Lt{render(){this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this.makeFieldContainer("boolean",e.description),r=document.createElement("label");r.className="checkbox";const i=document.createElement("input");i.type="checkbox",i.checked=!!this._value,i.name=_n(this._path),i.id=ln(this._path);const s=document.createElement("span");s.textContent=e.description??this._label??"",i.onchange=()=>this.emitChange(i.checked);const o=n.querySelector("label.label");o&&(o.htmlFor=i.id),r.append(i,s),n.appendChild(r),this.$root.appendChild(n)}}Pe("schema-form-boolean",Lf);function os(t){return String(t).padStart(2,"0")}function Fr(t){return`${t.getFullYear()}-${os(t.getMonth()+1)}-${os(t.getDate())}`}function pa(t){return`${os(t.getHours())}:${os(t.getMinutes())}`}function as(t){return`${Fr(t)}T${pa(t)}`}class Mf extends Lt{render(){if(this.$input&&this.$root.contains(this.$input)){const o=St(this._schema).role||"date";if(document.activeElement!==this.$input)if(this._value instanceof Date)o==="date"?this.$input.value=Fr(this._value):o==="time"?this.$input.value=pa(this._value):o==="datetime"&&(this.$input.value=as(this._value));else if(typeof this._value=="string"&&o!=="time"){const a=new Date(this._value);isNaN(+a)||(o==="date"?this.$input.value=Fr(a):o==="datetime"&&(this.$input.value=as(a)))}else this._value||(this.$input.value="");return}this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this.makeFieldContainer("date",e.description),r=document.createElement("input");this.$input=r,r.className="input";const i=e.role||"date";if(i==="datetime"?r.type="datetime-local":i==="time"?r.type="time":r.type="date",r.name=_n(this._path),r.id=ln(this._path),this._value instanceof Date)i==="date"?r.value=Fr(this._value):i==="time"?r.value=pa(this._value):i==="datetime"&&(r.value=as(this._value));else if(typeof this._value=="string"&&i!=="time"){const o=new Date(this._value);isNaN(+o)||(i==="date"?r.value=Fr(o):i==="datetime"&&(r.value=as(o)))}r.oninput=()=>{e.role;let o;if(!r.value)o=void 0;else{const a=new Date(r.value);o=Number.isNaN(+a)?void 0:a}this.emitChange(o)};const s=n.querySelector("label.label");s&&(s.htmlFor=r.id),n.appendChild(r),this.$root.appendChild(n)}}Pe("schema-form-date",Mf);class jf extends Lt{render(){this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this._schema.value;if(e.role==="raw-html"){if(n instanceof Node){this.$root.appendChild(n);return}const o=document.createElement("div");o.innerHTML=String(n),this.$root.appendChild(o);return}const r=this.makeFieldContainer("const",e.description),i=document.createElement("section");i.className="const content",i.textContent=String(n),i.id=ln(this._path);const s=r.querySelector("label.label");s&&(s.htmlFor=i.id),r.appendChild(i),this.$root.appendChild(r)}}Pe("schema-form-const",jf);function Tb(t){switch(t.type){case"string":return"schema-form-string";case"number":case"natural":case"percent":return"schema-form-number";case"boolean":return"schema-form-boolean";case"date":return"schema-form-date";case"const":return"schema-form-const";case"array":return"schema-form-array";case"object":return"schema-form-object";case"tuple":return"schema-form-tuple";case"dict":return"schema-form-dict";case"union":{const e=t.list||[];return e.length===2&&e[0]?.type==="is"&&e[0]?.constructor===Date&&e[1]?.type==="transform"&&(e[1]?.inner?.meta?.role==="datetime"||e[1]?.inner?.meta?.role==="date"||e[1]?.inner?.meta?.role==="time")?"schema-form-date":"schema-form-union"}default:return"schema-form-string"}}function Kn(t,e,n,r,i){const s=Tb(t),o=document.createElement(s);return o.schema=t,o.path=e,o.label=r,i&&(o.i18n=i),o.setValue?.(n),o}class Ff extends Lt{render(){this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this.makeFieldContainer("union",e.description),r=this._schema.list||[];if(Cb(r)){const i=document.createElement("select");i.className="input",i.name=_n(this._path),i.id=ln(this._path),r.forEach(o=>{const a=document.createElement("option");a.value=String(o.value),a.textContent=String(o.value),this._value===o.value&&(a.selected=!0),i.appendChild(a)}),i.onchange=()=>this.emitChange(ha("string",i.value));const s=n.querySelector("label.label");s&&(s.htmlFor=i.id),n.appendChild(i)}else{const i=document.createElement("div");i.className="toolbar";const s=document.createElement("select");s.className="input",s.name=_n(this._path)+".__type",s.id=ln(this._path)+"__type";let o=0;r.forEach((u,f)=>{const y=document.createElement("option");y.value=String(f),y.textContent=u.type,s.appendChild(y)}),s.onchange=()=>{o=Number(s.value);const u=r[o],f=Wn(u);this.emitChange(f),c()};const a=n.querySelector("label.label");a&&(a.htmlFor=s.id),i.appendChild(s),n.appendChild(i);const l=document.createElement("div");l.className="group";const c=()=>{l.innerHTML="";const u=r[o],f=Kn(u,this._path,this._value,this._label);f.addEventListener("change",y=>{y.stopPropagation(),this.emitChange(y.detail.value)}),l.appendChild(f)};c(),n.appendChild(l)}this.$root.appendChild(n)}}Pe("schema-form-union",Ff);class Bf extends Lt{render(){this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this.makeFieldContainer("tuple",e.description),r=document.createElement("div");r.className="group";const i=Array.isArray(this._value)?this._value:[];(this._schema.list||[]).forEach((s,o)=>{const a=Kn(s,[...this._path,o],i[o],`${this._label??""}[${o}]`);a.addEventListener("change",l=>{l.stopPropagation();const c=Array.isArray(this._value)?this._value.slice():[];c[o]=l.detail.value,this.emitChange(c)}),r.appendChild(a)}),n.appendChild(r),this.$root.appendChild(n)}}Pe("schema-form-tuple",Bf);class Uf extends Lt{render(){this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this.makeFieldContainer("object",e.description),r=document.createElement("div");r.className="group";const i=this._schema.dict||{};Object.keys(i).forEach(s=>{if(i[s]?.meta?.hidden)return;const o=(this._value??{})[s],a=Kn(i[s],[...this._path,s],o,s);a.addEventListener("change",l=>{l.stopPropagation();const c={...this._value??{}};c[s]=l.detail.value,this.emitChange(c)}),r.appendChild(a)}),n.appendChild(r),this.$root.appendChild(n)}}Pe("schema-form-object",Uf);const fs=class fs extends Lt{constructor(){super(...arguments),this._itemIds=[]}generateItemId(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return"i"+fs._idCounter++}ensureItemIds(e){for(;this._itemIds.length<e;)this._itemIds.push(this.generateItemId());this._itemIds.length>e&&(this._itemIds.length=e)}capturePositions(e){const n={};return e.querySelectorAll(".row").forEach(r=>{const i=r.dataset.uid;i&&(n[i]=r.getBoundingClientRect())}),n}playFLIP(e,n){Array.from(e.querySelectorAll(".row")).forEach(r=>{const i=r.dataset.uid;if(!i)return;const s=n[i];if(!s)return;const o=r.getBoundingClientRect(),a=s.left-o.left,l=s.top-o.top;(a||l)&&(r.style.transition="none",r.style.transform=`translate(${a}px, ${l}px)`,requestAnimationFrame(()=>{r.style.transition="transform .25s ease",r.style.transform=""}))})}render(){this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this.makeFieldContainer("array",e.description),r=document.createElement("div");r.className="group";const i=this._schema.inner,s=()=>Array.isArray(this._value)?this._value:[];this.ensureItemIds(s().length);const o=(c,u)=>{r.innerHTML="",s().forEach((f,y)=>{const v=[...this._path,y],b=document.createElement("div");b.className="row schema-collection-row";const I=this._itemIds[y];b.dataset.uid=I,b.setAttribute("data-path",jr(v));const F=Kn(i,v,f,`${this._label??""}[${y}]`);F.addEventListener("change",h=>{h.stopPropagation();const S=s().slice();S[y]=h.detail.value,this._value=S,this.emitChange(S)});const O=document.createElement("div");O.className="actions";const A=document.createElement("button");A.type="button",A.className="btn",A.textContent=this._i18n.arrayMoveUp??"↑",A.onclick=()=>{if(y<=0)return;const h=this.capturePositions(r),S=s().slice();[S[y-1],S[y]]=[S[y],S[y-1]],[this._itemIds[y-1],this._itemIds[y]]=[this._itemIds[y],this._itemIds[y-1]],this._value=S,o(h),this.emitChange(S)};const g=document.createElement("button");g.type="button",g.className="btn",g.textContent=this._i18n.arrayMoveDown??"↓",g.onclick=()=>{const h=s();if(y>=h.length-1)return;const S=this.capturePositions(r),T=h.slice();[T[y+1],T[y]]=[T[y],T[y+1]],[this._itemIds[y+1],this._itemIds[y]]=[this._itemIds[y],this._itemIds[y+1]],this._value=T,o(S),this.emitChange(T)};const p=document.createElement("button");p.type="button",p.className="btn danger",p.textContent=this._i18n.arrayRemove??"×",p.onclick=()=>{b.classList.add("leaving");const h=250;let S=!1;const T=()=>{if(S)return;S=!0,clearTimeout(N);const H=s().filter((Te,De)=>De!==y);this._itemIds.splice(y,1);const X=this.capturePositions(r);this._value=H,o(X),this.emitChange(H)};b.addEventListener("transitionend",T,{once:!0});const N=setTimeout(T,h+80)},O.append(A,g,p),b.appendChild(F),b.appendChild(O),r.appendChild(b),u&&u===I&&(b.classList.add("enter"),requestAnimationFrame(()=>{b.classList.add("enter-active")}),requestAnimationFrame(()=>{b.classList.remove("enter")}))}),c&&this.playFLIP(r,c)};o();const a=document.createElement("button");a.type="button",a.className="btn primary",a.textContent=this._i18n.arrayAdd??"+",a.onclick=()=>{const c=this.capturePositions(r),u=s().slice(),f=Wn(i);u.push(f);const y=this.generateItemId();this._itemIds.push(y),this._value=u,o(c,y),this.emitChange(u)};const l=document.createElement("div");l.className="actions",l.appendChild(a),n.appendChild(r),n.appendChild(l),this.$root.appendChild(n)}};fs._idCounter=0;let ls=fs;Pe("schema-form-array",ls);class qf extends Lt{render(){this.$root.innerHTML=`<style>${mt}</style>`;const e=St(this._schema),n=this.makeFieldContainer("dict",e.description),r=document.createElement("div");r.className="group";const i=this._schema.inner,s=this._value??{},o=y=>`d_${y}`,a=()=>{const y={};return r.querySelectorAll(".kv").forEach(v=>{const b=v.dataset.uid;b&&(y[b]=v.getBoundingClientRect())}),y},l=y=>{r.querySelectorAll(".kv").forEach(v=>{const b=v.dataset.uid;if(!b)return;const I=y[b];if(!I)return;const F=v.getBoundingClientRect(),O=I.left-F.left,A=I.top-F.top;(O||A)&&(v.style.transition="none",v.style.transform=`translate(${O}px, ${A}px)`,requestAnimationFrame(()=>{v.style.transition="transform .25s ease",v.style.transform=""}))})},c=(y,v)=>{r.innerHTML="",Object.keys(s).forEach(b=>{const I=[...this._path,b],F=document.createElement("div");F.className="kv schema-collection-row",F.dataset.uid=o(b),F.setAttribute("data-path",jr(I));const O=document.createElement("input");O.className="input",O.value=b,O.name=_n(I)+".__key",O.id=ln(I)+"__key";const A=Kn(i,I,s[b],`${this._label??""}[${b}]`),g=document.createElement("button");g.type="button",g.className="btn danger",g.textContent=this._i18n.dictRemove??"×",g.onclick=()=>{const p=a();delete s[b];const h={...this._value??{}};delete h[b],this._value=h,c(p),this.emitChange(h)},O.onchange=()=>{const p=O.value.trim();if(!p||p===b||s[p]!==void 0)return;const h=a();s[p]=s[b],delete s[b];const S={...this._value??{}};S[p]=S[b],delete S[b],this._value=S,c(h),this.emitChange(S)},A.addEventListener("change",p=>{p.stopPropagation();const h={...this._value??{}};h[b]=p.detail.value,this._value=h,this.emitChange(h)}),F.append(O,A,g),r.appendChild(F),v===b&&(F.classList.add("enter"),requestAnimationFrame(()=>F.classList.add("enter-active")),requestAnimationFrame(()=>F.classList.remove("enter")))}),y&&l(y)};c();const u=document.createElement("button");u.type="button",u.className="btn primary",u.textContent=this._i18n.dictAdd??"+",u.onclick=()=>{let y=Object.keys(s).length+1,v=`k${y}`;for(;s[v]!==void 0;)v=`k${++y}`;const b=a();s[v]=Wn(i);const I={...this._value??{},[v]:s[v]};this._value=I,c(b,v),this.emitChange(I)};const f=document.createElement("div");f.className="actions",f.appendChild(u),n.appendChild(r),n.appendChild(f),this.$root.appendChild(n)}}Pe("schema-form-dict",qf);class zf extends HTMLElement{constructor(){super(),this._i18n={...Of},this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=mt,this.$root.appendChild(e);const n=document.createElement("div");n.className="wrapper",n.innerHTML='<form class="form" part="form"></form>',this.$root.appendChild(n),this.addEventListener("change",r=>{if(!r?.detail)return;const{path:i,value:s}=r.detail;Array.isArray(i)&&i.length===0?this._state=s:Pb(this._state??(this._state={}),i,s),this.dispatchEvent(new CustomEvent("form-change",{detail:{path:i,value:s,state:this._state}}))})}set schema(e){this._schema=Rf(e);try{this._state=this._schema(null,{autofix:!0})}catch{this._state=Wn(this._schema)}this.render()}get schema(){return this._schema}set schemaJSON(e){this.schema=e}get schemaJSON(){return this._schema?.toJSON?.()}setData(e,n={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const r=n.validate?this._schema(e??null,{autofix:n.autofix}):e;this._state=r,this.render()}getData(e={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const n=this._state;return e.validate?this._schema(n??null,{autofix:e.autofix}):n}reset(){try{this._state=this._schema(null,{autofix:!0})}catch{this._state=Wn(this._schema)}this.render()}refresh(){this.render()}set i18n(e){this._i18n={...this._i18n,...e},this.render()}get i18n(){return this._i18n}render(){if(!this._schema)return;const e=this.$root.querySelector("form");e.innerHTML="";const n=Kn(this._schema,[],this._state,this._i18n.rootLabel,this._i18n);e.appendChild(n)}}Pe("schema-form",zf);function Ib(){Pe("schema-form",zf),Pe("schema-form-string",Nf),Pe("schema-form-number",Df),Pe("schema-form-boolean",Lf),Pe("schema-form-date",Mf),Pe("schema-form-const",jf),Pe("schema-form-union",Ff),Pe("schema-form-tuple",Bf),Pe("schema-form-object",Uf),Pe("schema-form-array",ls),Pe("schema-form-dict",qf)}const Ob=Eu({__name:"SchemasteryFormVue",props:Ru({schema:{},value:{},validateOnChange:{type:Boolean,default:!1}},{schema:{required:!0},schemaModifiers:{},value:{required:!1,default:{}},valueModifiers:{}}),emits:Ru(["change"],["update:schema","update:value"]),setup(t,{expose:e,emit:n}){const r=ef(t,"schema"),i=ef(t,"value"),s=n,o=Qv("elRef");let a=!1,l=!1;const c=u=>{if(l)return;const f=o.value,y=t.validateOnChange?f.getData({validate:!0}):u.detail.state;a=!0,i.value=y,Gi(()=>{a=!1}),s("change",u.detail)};return Tu(()=>{Ib()}),Yo(()=>{const u=o.value;r.value&&(u.schema=r.value),i.value!==void 0&&u.setData(i.value,{validate:!1,autofix:!0}),u.addEventListener("form-change",c)}),Iu(()=>{o.value?.removeEventListener("form-change",c)}),Un(()=>r,u=>{a||o.value&&u&&o.value.schema!==u.value&&(l=!0,o.value.schema=u.value,Gi(()=>{l=!1}))},{deep:!0,immediate:!0}),Un(()=>i,u=>{if(a||!o.value||u.value===void 0)return;const f=o.value.getData({validate:!1});JSON.stringify(f)!==JSON.stringify(u.value)&&(l=!0,o.value.setData(u.value,{validate:!1}),Gi(()=>{l=!1}))},{deep:!0,immediate:!0}),e({setData(u,f){const y=o.value;y.setData(u,{validate:!!f?.validate}),f?.emit&&(i.value=y.getData({validate:!!f?.validate}))},getData(u){return o.value.getData(u)},setSchema(u,f=!0){o.value.schema=u,f&&(r.value=u)},refresh(){o.value.refresh()},reset(){o.value.reset()},el:o}),(u,f)=>(zn(),Rr("schema-form",ff({ref_key:"elRef",ref:o},u.$attrs),null,16))}});function xn(t,e=new WeakMap){if(Me(t))return xn(t.value,e);if(t===null||typeof t!="object")return t;if(e.has(t))return e.get(t);if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(t instanceof Map){const i=new Map;return e.set(t,i),Array.from(t.entries()).forEach(([s,o])=>{i.set(s,xn(o,e))}),i}if(t instanceof Set){const i=new Set;return e.set(t,i),Array.from(t).forEach(s=>{i.add(xn(s,e))}),i}if(Array.isArray(t)){const i=[];e.set(t,i);for(const s of t)i.push(xn(s,e));return i}const n=de(t),r={};e.set(t,r);for(const i of Object.keys(n))r[i]=xn(n[i],e);for(const i of Object.getOwnPropertySymbols(n))r[i]=xn(n[i],e);return r}const Ab={class:"preferences-ui-app"},Rb={class:"tabs"},Nb=["onClick","data-value"],Db={style:{"max-height":"20em",overflow:"auto"}},Lb=((t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n})(Eu({__name:"PreferencesForm",setup(t,{expose:e}){const n=kb(),r=hu([]),i=hu(""),s=Hi([]),o=vf(()=>s.value.map(c=>c.schema)),a=Hi({}),l=Hi({});return e({getValue(){return xn(l)}}),Un(i,c=>{c&&(a.value=l.value,s.value=n.preferences.getConfigRegistries(c))},{immediate:!0}),Yo(async()=>{n.inject(["preferences"],async c=>{const u=await c.preferences.getAll();a.value=l.value=u,r.value=c.preferences.getConfigCategories(),i.value=r.value[0].name})}),(c,u)=>(zn(),Rr("div",Ab,[Dr("div",Rb,[(zn(!0),Rr(xt,null,Au(r.value,f=>(zn(),Rr("a",{class:Li(["tab",{active:i.value===f.name}]),key:f.name,onClick:y=>i.value=f.name,"data-value":f.name},Io(f.label),11,Nb))),128))]),(zn(!0),Rr(xt,null,Au(o.value,(f,y)=>(zn(),My(mu(Ob),{key:`${i.value}-${y}`,schema:f,value:a.value,"onUpdate:value":u[0]||(u[0]=v=>l.value=v),"validate-on-change":!1,i18n:{rootLabel:""}},null,8,["schema","value"]))),128)),Dr("details",null,[Dr("pre",Db,Io(l.value),1)])]))}}),[["__scopeId","data-v-571b939a"]]);var Mb=Object.create,ma=Object.defineProperty,jb=Object.getOwnPropertyDescriptor,Hf=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Wf=t=>{throw TypeError(t)},Fb=(t,e,n)=>e in t?ma(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Bb=(t,e)=>ma(t,"name",{value:e,configurable:!0}),Ub=t=>[,,,Mb(t?.[Hf("metadata")]??null)],qb=["class","method","getter","setter","accessor","field","value","get","set"],Kf=t=>t!==void 0&&typeof t!="function"?Wf("Function expected"):t,zb=(t,e,n,r,i)=>({kind:qb[t],name:e,metadata:r,addInitializer:s=>n._?Wf("Already initialized"):i.push(Kf(s||null))}),Hb=(t,e)=>Fb(e,Hf("metadata"),t[3]),Wb=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Kb=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,y=t[f]||(t[f]=[]),v=c&&(i=i.prototype,c<5&&(c>3||!u)&&jb(i,n));Bb(i,n);for(var b=r.length-1;b>=0;b--)l=zb(c,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,Kf(o)&&(i=o);return Hb(t,i),v&&ma(i,n,v),u?c^4?s:v:i},Vf,ga,Yf;Vf=[We(["preferences","modal"])];class cs extends(Yf=ot){constructor(e){super(e,{},"preferences-ui"),this.ctx=e,e.set("preferencesUI",this),e.inject(["toolbox"],n=>{n.toolbox.addButton({id:"preferences",icon:w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-settings",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M14.647 4.081a.724 .724 0 0 0 1.08 .448c2.439 -1.485 5.23 1.305 3.745 3.744a.724 .724 0 0 0 .447 1.08c2.775 .673 2.775 4.62 0 5.294a.724 .724 0 0 0 -.448 1.08c1.485 2.439 -1.305 5.23 -3.744 3.745a.724 .724 0 0 0 -1.08 .447c-.673 2.775 -4.62 2.775 -5.294 0a.724 .724 0 0 0 -1.08 -.448c-2.439 1.485 -5.23 -1.305 -3.745 -3.744a.724 .724 0 0 0 -.447 -1.08c-2.775 -.673 -2.775 -4.62 0 -5.294a.724 .724 0 0 0 .448 -1.08c-1.485 -2.439 1.305 -5.23 3.744 -3.745a.722 .722 0 0 0 1.08 -.447c.673 -2.775 4.62 -2.775 5.294 0zm-2.647 4.919a3 3 0 1 0 0 6a3 3 0 0 0 0 -6z"})]}),tooltip:"Open preferences",group:"group2",index:1/0,onClick:()=>this.showModal()}),this.addDisposeHandler(()=>{n.toolbox.removeButton("preferences")})})}showModal(){const e=this.ctx.modal.show({className:"ipe-preference compact-buttons",sizeClass:"small",outSideClose:!1,center:!0,title:"InPageEdit Preferences",content:w(Ft,{children:w(Xt,{})})});e.get$window().classList.add("dialog");const n=w("div",{id:"ipe-preferences-app",style:{minHeight:"65vh"}});e.setContent(n);const r=this.createFormApp(),i=r.mount(n);e.setButtons([{label:"Cancel",className:"is-danger is-ghost",method:()=>{e.close()}},{label:"Save",className:"is-primary is-ghost",method:()=>{const s=i.getValue();this.logger.info("saving preferences",s);try{Object.entries(s).forEach(([o,a])=>{this.ctx.preferences.set(o,a).catch(console.error)})}catch(o){this.logger.error("failed to save preferences",o)}e.close(),this.ctx.modal.notify("success",{title:"Preferences Saved",content:w("p",{children:"Some settings may take effect after reloading the page."})})}}]),e.on(e.Event.Close,()=>{this.logger.debug("preferences modal closed, vue app unmounting"),r.unmount()})}createFormApp(){const e=_b(Lb);return Eb(this.ctx,e),e}}ga=Ub(Yf),cs=Kb(ga,0,"PluginPreferencesUI",Vf,cs),Wb(ga,1,cs);const Vb=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferencesUI(){return cs}},Symbol.toStringTag,{value:"Module"}));le.BasePlugin=ot,le.InPageEdit=gn,le.Inject=We,le.Logger=Zr,le.LoggerLevel=ks,le.Schema=fe,le.Service=Jt,le.createLogger=za,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
124
126
  //# sourceMappingURL=index.umd.js.map