zerocodejs 1.0.1-beta.5 → 1.0.1-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- (function(en,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(en=typeof globalThis<"u"?globalThis:en||self,a(en.ZeroCode={},en.Vue))})(this,(function(en,a){"use strict";const Oc=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Wm=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,o)=>o?o.toUpperCase():n.toLowerCase()),Gm=t=>{const e=Wm(t);return e.charAt(0).toUpperCase()+e.slice(1)},qm=(...t)=>t.filter((e,n,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===n).join(" ").trim(),Dc=t=>t==="";var rr={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"};const Km=({name:t,iconNode:e,absoluteStrokeWidth:n,"absolute-stroke-width":o,strokeWidth:r,"stroke-width":i,size:s=rr.width,color:l=rr.stroke,...c},{slots:d})=>a.h("svg",{...rr,...c,width:s,height:s,stroke:l,"stroke-width":Dc(n)||Dc(o)||n===!0||o===!0?Number(r||i||rr["stroke-width"])*24/Number(s):r||i||rr["stroke-width"],class:qm("lucide",c.class,...t?[`lucide-${Oc(Gm(t))}-icon`,`lucide-${Oc(t)}`]:["lucide-icon"])},[...e.map(u=>a.h(...u)),...d.default?[d.default()]:[]]);const He=(t,e)=>(n,{slots:o,attrs:r})=>a.h(Km,{...r,...n,iconNode:e,name:t},o);const ir=He("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);const Jm=He("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const sr=He("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const si=He("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Vn=He("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Xm=He("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const Ym=He("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);const Qm=He("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const Rc=He("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);const na=He("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const Zm=He("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const eg=He("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const tg=He("list-ordered",[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]);const ng=He("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]);const og=He("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);const Pc=He("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const uo=He("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Lc=He("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const $c=He("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const oa=He("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);const rg=He("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);const Bn=He("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);const Vc=He("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Qe=He("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const Bc=He("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);class ig{styleElements=new Map;container=null;setContainer(e){this.container!==e&&(this.container=e,this.removeAllCSS())}applyCSS(e){if(!this.container){console.warn("[PageCSSManager] Container not set");return}if(!e||!e.trim()){this.removeCSS("default");return}this.applyCSSForCategory("default",e)}applyMultipleCSS(e){if(!this.container){console.warn("[PageCSSManager] Container not set");return}["common","individual","special"].forEach(o=>{const r=e[o];r&&r.trim()?this.applyCSSForCategory(o,r):this.removeCSS(o)})}applyCSSForCategory(e,n){if(!this.container)return;let o=this.styleElements.get(e);o||(o=document.createElement("style"),o.id=`zcode-css-style-${e}`,o.setAttribute("data-zcode-css","true"),o.setAttribute("data-zcode-css-category",e),this.container.appendChild(o),this.styleElements.set(e,o)),o.textContent=n}removeCSS(e="default"){const n=this.styleElements.get(e);n&&(n.remove(),this.styleElements.delete(e))}removeAllCSS(){this.styleElements.forEach(e=>{e.remove()}),this.styleElements.clear()}cleanup(){this.removeAllCSS(),this.container=null}}const sg=["innerHTML"],ag={key:0,class:"zcode-empty-state"},Fc=a.defineComponent({__name:"PreviewArea",props:{cmsData:{type:Object},fullPageHtml:{type:String},onAddClick:{type:Function},allowDynamicContentInteraction:{type:Boolean}},setup(t,{expose:e}){const n=t,o=a.ref(null),r=a.ref(null),i=new ig;let s=null,l=!1;const c=u=>{if(n.allowDynamicContentInteraction===!1){const f=u.target;(f.tagName==="A"||f.closest("a"))&&(u.preventDefault(),u.stopPropagation())}};a.watch(()=>n.fullPageHtml,()=>{a.nextTick(()=>{r.value&&(l=!0,s&&s.disconnect(),s=new MutationObserver(()=>{l&&(l=!1,a.nextTick(()=>{window.dispatchEvent(new CustomEvent("zcode-dom-updated",{})),s&&(s.disconnect(),s=null)}))}),s.observe(r.value,{childList:!0,subtree:!0,characterData:!0}))})},{immediate:!1}),a.watch(()=>[n.cmsData.css?.common,n.cmsData.css?.individual,n.cmsData.css?.special],()=>{a.nextTick(()=>{d()})},{deep:!0});function d(){if(!o.value)return;const u=o.value.getRootNode();u instanceof ShadowRoot?i.setContainer(u):i.setContainer(document.head);const f={common:n.cmsData.css?.common,individual:n.cmsData.css?.individual,special:n.cmsData.css?.special};i.applyMultipleCSS(f)}return a.onMounted(()=>{a.nextTick(()=>{r.value&&(window.dispatchEvent(new CustomEvent("zcode-dom-updated",{})),r.value.addEventListener("click",c,!0)),d()})}),a.onUnmounted(()=>{s&&(s.disconnect(),s=null),r.value&&r.value.removeEventListener("click",c,!0),i.cleanup()}),e({previewArea:o}),(u,f)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"previewArea",ref:o},[a.createElementVNode("div",{ref_key:"htmlContainer",ref:r,innerHTML:t.fullPageHtml},null,8,sg),t.cmsData.page.length===0&&t.onAddClick?(a.openBlock(),a.createElementBlock("div",ag,[f[1]||(f[1]=a.createElementVNode("p",null,"パーツを追加してください",-1)),a.createElementVNode("button",{class:"zcode-add-btn",onClick:f[0]||(f[0]=p=>t.onAddClick("page.0"))}," + パーツを追加 ")])):a.createCommentVNode("",!0)],512))}});function ra(){if(typeof window<"u"&&typeof DOMParser<"u")return DOMParser;if(typeof require<"u")try{const{JSDOM:t}=require("jsdom");return new t().window.DOMParser}catch{throw new Error("jsdom is required for server-side rendering. Please install it: npm install jsdom")}if(typeof DOMParser<"u")return DOMParser;throw new Error("DOMParser is not available in this environment")}function lg(t){const e=window;e.__zcmsShadowRoots||(e.__zcmsShadowRoots=new Map);const n=`script-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return e.__zcmsShadowRoots.set(n,t),`
1
+ (function(Gt,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(Gt=typeof globalThis<"u"?globalThis:Gt||self,a(Gt.ZeroCode={},Gt.Vue))})(this,(function(Gt,a){"use strict";const pc=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),cm=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,o)=>o?o.toUpperCase():t.toLowerCase()),dm=n=>{const e=cm(n);return e.charAt(0).toUpperCase()+e.slice(1)},um=(...n)=>n.filter((e,t,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===t).join(" ").trim(),hc=n=>n==="";var Xo={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"};const fm=({name:n,iconNode:e,absoluteStrokeWidth:t,"absolute-stroke-width":o,strokeWidth:r,"stroke-width":i,size:s=Xo.width,color:l=Xo.stroke,...c},{slots:d})=>a.h("svg",{...Xo,...c,width:s,height:s,stroke:l,"stroke-width":hc(t)||hc(o)||t===!0||o===!0?Number(r||i||Xo["stroke-width"])*24/Number(s):r||i||Xo["stroke-width"],class:um("lucide",c.class,...n?[`lucide-${pc(dm(n))}-icon`,`lucide-${pc(n)}`]:["lucide-icon"])},[...e.map(u=>a.h(...u)),...d.default?[d.default()]:[]]);const Ue=(n,e)=>(t,{slots:o,attrs:r})=>a.h(fm,{...r,...t,iconNode:e,name:n},o);const Yo=Ue("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);const pm=Ue("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const Qo=Ue("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Jr=Ue("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const _n=Ue("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const hm=Ue("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const mm=Ue("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);const gm=Ue("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const mc=Ue("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);const js=Ue("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const ym=Ue("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const bm=Ue("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const xm=Ue("list-ordered",[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]);const km=Ue("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]);const Em=Ue("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);const gc=Ue("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const io=Ue("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const yc=Ue("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const bc=Ue("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const Hs=Ue("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);const wm=Ue("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);const On=Ue("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);const xc=Ue("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Ye=Ue("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const kc=Ue("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);class Sm{styleElements=new Map;container=null;setContainer(e){this.container!==e&&(this.container=e,this.removeAllCSS())}applyCSS(e){if(!this.container){console.warn("[PageCSSManager] Container not set");return}if(!e||!e.trim()){this.removeCSS("default");return}this.applyCSSForCategory("default",e)}applyMultipleCSS(e){if(!this.container){console.warn("[PageCSSManager] Container not set");return}["common","individual","special"].forEach(o=>{const r=e[o];r&&r.trim()?this.applyCSSForCategory(o,r):this.removeCSS(o)})}applyCSSForCategory(e,t){if(!this.container)return;let o=this.styleElements.get(e);o||(o=document.createElement("style"),o.id=`zcode-css-style-${e}`,o.setAttribute("data-zcode-css","true"),o.setAttribute("data-zcode-css-category",e),this.container.appendChild(o),this.styleElements.set(e,o)),o.textContent=t}removeCSS(e="default"){const t=this.styleElements.get(e);t&&(t.remove(),this.styleElements.delete(e))}removeAllCSS(){this.styleElements.forEach(e=>{e.remove()}),this.styleElements.clear()}cleanup(){this.removeAllCSS(),this.container=null}}const Cm=["innerHTML"],Nm={key:0,class:"zcode-empty-state"},Ec=a.defineComponent({__name:"PreviewArea",props:{cmsData:{type:Object},fullPageHtml:{type:String},onAddClick:{type:Function},allowDynamicContentInteraction:{type:Boolean}},setup(n,{expose:e}){const t=n,o=a.ref(null),r=a.ref(null),i=new Sm;let s=null,l=!1;const c=u=>{if(t.allowDynamicContentInteraction===!1){const f=u.target;(f.tagName==="A"||f.closest("a"))&&(u.preventDefault(),u.stopPropagation())}};a.watch(()=>t.fullPageHtml,()=>{a.nextTick(()=>{r.value&&(l=!0,s&&s.disconnect(),s=new MutationObserver(()=>{l&&(l=!1,a.nextTick(()=>{window.dispatchEvent(new CustomEvent("zcode-dom-updated",{})),s&&(s.disconnect(),s=null)}))}),s.observe(r.value,{childList:!0,subtree:!0,characterData:!0}))})},{immediate:!1}),a.watch(()=>[t.cmsData.css?.common,t.cmsData.css?.individual,t.cmsData.css?.special],()=>{a.nextTick(()=>{d()})},{deep:!0});function d(){if(!o.value)return;const u=o.value.getRootNode();u instanceof ShadowRoot?i.setContainer(u):i.setContainer(document.head);const f={common:t.cmsData.css?.common,individual:t.cmsData.css?.individual,special:t.cmsData.css?.special};i.applyMultipleCSS(f)}return a.onMounted(()=>{a.nextTick(()=>{r.value&&(window.dispatchEvent(new CustomEvent("zcode-dom-updated",{})),r.value.addEventListener("click",c,!0)),d()})}),a.onUnmounted(()=>{s&&(s.disconnect(),s=null),r.value&&r.value.removeEventListener("click",c,!0),i.cleanup()}),e({previewArea:o}),(u,f)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"previewArea",ref:o},[a.createElementVNode("div",{ref_key:"htmlContainer",ref:r,innerHTML:n.fullPageHtml},null,8,Cm),n.cmsData.page.length===0&&n.onAddClick?(a.openBlock(),a.createElementBlock("div",Nm,[f[1]||(f[1]=a.createElementVNode("p",null,"パーツを追加してください",-1)),a.createElementVNode("button",{class:"zcode-add-btn",onClick:f[0]||(f[0]=p=>n.onAddClick("page.0"))}," + パーツを追加 ")])):a.createCommentVNode("",!0)],512))}});function Us(){if(typeof window<"u"&&typeof DOMParser<"u")return DOMParser;if(typeof require<"u")try{const{JSDOM:n}=require("jsdom");return new n().window.DOMParser}catch{throw new Error("jsdom is required for server-side rendering. Please install it: npm install jsdom")}if(typeof DOMParser<"u")return DOMParser;throw new Error("DOMParser is not available in this environment")}function Tm(n){const e=window;e.__zcmsShadowRoots||(e.__zcmsShadowRoots=new Map);const t=`script-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return e.__zcmsShadowRoots.set(t,n),`
2
2
  (function() {
3
- const scriptId = '${n}'
3
+ const scriptId = '${t}'
4
4
  const shadowRoot = window.__zcmsShadowRoots?.get(scriptId)
5
5
  if (!shadowRoot || !(shadowRoot instanceof ShadowRoot)) {
6
6
  return
@@ -334,30 +334,26 @@
334
334
  }
335
335
  })
336
336
  })()
337
- `}function Mo(t,e=!1){const n=t,o=t.querySelector("script[data-zcode-shadow-extension]");if(o)if(e){if(n.__zcmsEventListeners){const i=n.__zcmsEventListeners;i.forEach(function(s){s.forEach(function(l){t.removeEventListener(l.eventName,l.handler,!0)})}),i.clear()}o.remove(),n.__zcmsJQueryExtended&&delete n.__zcmsJQueryExtended,n.__zcmsNativeAPIExtended&&delete n.__zcmsNativeAPIExtended}else return;const r=document.createElement("script");r.setAttribute("data-zcode-shadow-extension","true"),r.textContent=lg(t),t.insertBefore(r,t.firstChild)}function cg(){if(typeof window>"u")return 20;try{let t=document.querySelector(".zcode-toolbar");if(!t){const n=document.querySelectorAll("zcode-cms, zcode-editor");for(const o of Array.from(n)){const r=o.shadowRoot;if(r){const i=r.querySelector(".zcode-toolbar");if(i){t=i;break}}}}if(!t)return 20;const e=t.getBoundingClientRect();return e.height>0?e.height:20}catch(t){return console.warn("Failed to get toolbar height:",t),20}}function ar(t,e=0){if(!(typeof window>"u"||!t))try{const n=t.getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,r=cg(),i=n.top+o-r-e;window.scrollTo({top:Math.max(0,i),behavior:"smooth"})}catch(n){console.warn("Failed to scroll to element:",n);try{const o=t.getBoundingClientRect(),r=window.pageYOffset||document.documentElement.scrollTop,i=o.top+r-20;window.scrollTo({top:Math.max(0,i),behavior:"smooth"})}catch(o){console.error("Scroll fallback also failed:",o)}}}const{entries:jc,setPrototypeOf:Uc,isFrozen:dg,getPrototypeOf:ug,getOwnPropertyDescriptor:fg}=Object;let{freeze:wt,seal:Ft,create:ia}=Object,{apply:sa,construct:aa}=typeof Reflect<"u"&&Reflect;wt||(wt=function(e){return e}),Ft||(Ft=function(e){return e}),sa||(sa=function(e,n){for(var o=arguments.length,r=new Array(o>2?o-2:0),i=2;i<o;i++)r[i-2]=arguments[i];return e.apply(n,r)}),aa||(aa=function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return new e(...o)});const ai=Nt(Array.prototype.forEach),pg=Nt(Array.prototype.lastIndexOf),Hc=Nt(Array.prototype.pop),lr=Nt(Array.prototype.push),hg=Nt(Array.prototype.splice),li=Nt(String.prototype.toLowerCase),la=Nt(String.prototype.toString),ca=Nt(String.prototype.match),cr=Nt(String.prototype.replace),mg=Nt(String.prototype.indexOf),gg=Nt(String.prototype.trim),tn=Nt(Object.prototype.hasOwnProperty),St=Nt(RegExp.prototype.test),dr=bg(TypeError);function Nt(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return sa(t,e,o)}}function bg(t){return function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return aa(t,n)}}function De(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:li;Uc&&Uc(t,null);let o=e.length;for(;o--;){let r=e[o];if(typeof r=="string"){const i=n(r);i!==r&&(dg(e)||(e[o]=i),r=i)}t[r]=!0}return t}function yg(t){for(let e=0;e<t.length;e++)tn(t,e)||(t[e]=null);return t}function cn(t){const e=ia(null);for(const[n,o]of jc(t))tn(t,n)&&(Array.isArray(o)?e[n]=yg(o):o&&typeof o=="object"&&o.constructor===Object?e[n]=cn(o):e[n]=o);return e}function ur(t,e){for(;t!==null;){const o=fg(t,e);if(o){if(o.get)return Nt(o.get);if(typeof o.value=="function")return Nt(o.value)}t=ug(t)}function n(){return null}return n}const Wc=wt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),da=wt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ua=wt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),xg=wt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),fa=wt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Eg=wt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Gc=wt(["#text"]),qc=wt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),pa=wt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Kc=wt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ci=wt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),kg=Ft(/\{\{[\w\W]*|[\w\W]*\}\}/gm),wg=Ft(/<%[\w\W]*|[\w\W]*%>/gm),Sg=Ft(/\$\{[\w\W]*/gm),Ng=Ft(/^data-[\-\w.\u00B7-\uFFFF]+$/),Cg=Ft(/^aria-[\-\w]+$/),Jc=Ft(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),vg=Ft(/^(?:\w+script|data):/i),Tg=Ft(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Xc=Ft(/^html$/i),zg=Ft(/^[a-z][.\w]*(-[.\w]+)+$/i);var Yc=Object.freeze({__proto__:null,ARIA_ATTR:Cg,ATTR_WHITESPACE:Tg,CUSTOM_ELEMENT:zg,DATA_ATTR:Ng,DOCTYPE_NAME:Xc,ERB_EXPR:wg,IS_ALLOWED_URI:Jc,IS_SCRIPT_OR_DATA:vg,MUSTACHE_EXPR:kg,TMPLIT_EXPR:Sg});const fr={element:1,text:3,progressingInstruction:7,comment:8,document:9},_g=function(){return typeof window>"u"?null:window},Ag=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let o=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(o=n.getAttribute(r));const i="dompurify"+(o?"#"+o:"");try{return e.createPolicy(i,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Qc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Zc(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_g();const e=Ee=>Zc(Ee);if(e.version="3.3.1",e.removed=[],!t||!t.document||t.document.nodeType!==fr.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const o=n,r=o.currentScript,{DocumentFragment:i,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:h}=t,m=c.prototype,b=ur(m,"cloneNode"),g=ur(m,"remove"),x=ur(m,"nextSibling"),v=ur(m,"childNodes"),w=ur(m,"parentNode");if(typeof s=="function"){const Ee=n.createElement("template");Ee.content&&Ee.content.ownerDocument&&(n=Ee.content.ownerDocument)}let T,M="";const{implementation:A,createNodeIterator:y,createDocumentFragment:E,getElementsByTagName:k}=n,{importNode:O}=o;let G=Qc();e.isSupported=typeof jc=="function"&&typeof w=="function"&&A&&A.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:z,ERB_EXPR:R,TMPLIT_EXPR:W,DATA_ATTR:H,ARIA_ATTR:L,IS_SCRIPT_OR_DATA:j,ATTR_WHITESPACE:Z,CUSTOM_ELEMENT:K}=Yc;let{IS_ALLOWED_URI:ae}=Yc,ee=null;const X=De({},[...Wc,...da,...ua,...fa,...Gc]);let Y=null;const J=De({},[...qc,...pa,...Kc,...ci]);let Q=Object.seal(ia(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),de=null,ke=null;const Te=Object.seal(ia(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let $e=!0,N=!0,P=!1,V=!0,S=!1,C=!0,$=!1,te=!1,ge=!1,Re=!1,ve=!1,_=!1,I=!0,q=!1;const pe="user-content-";let Ae=!0,ze=!1,Se={},F=null;const ne=De({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Me=null;const B=De({},["audio","video","img","source","image","track"]);let U=null;const ie=De({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),le="http://www.w3.org/1998/Math/MathML",we="http://www.w3.org/2000/svg",Fe="http://www.w3.org/1999/xhtml";let st=Fe,xn=!1,oi=null;const Tc=De({},[le,we,Fe],la);let Zo=De({},["mi","mo","mn","ms","mtext"]),er=De({},["annotation-xml"]);const zc=De({},["title","style","font","a","script"]);let Pn=null;const ri=["application/xhtml+xml","text/html"],Ln="text/html";let Ze=null,En=null;const Xs=n.createElement("form"),Ys=function(D){return D instanceof RegExp||D instanceof Function},tr=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(En&&En===D)){if((!D||typeof D!="object")&&(D={}),D=cn(D),Pn=ri.indexOf(D.PARSER_MEDIA_TYPE)===-1?Ln:D.PARSER_MEDIA_TYPE,Ze=Pn==="application/xhtml+xml"?la:li,ee=tn(D,"ALLOWED_TAGS")?De({},D.ALLOWED_TAGS,Ze):X,Y=tn(D,"ALLOWED_ATTR")?De({},D.ALLOWED_ATTR,Ze):J,oi=tn(D,"ALLOWED_NAMESPACES")?De({},D.ALLOWED_NAMESPACES,la):Tc,U=tn(D,"ADD_URI_SAFE_ATTR")?De(cn(ie),D.ADD_URI_SAFE_ATTR,Ze):ie,Me=tn(D,"ADD_DATA_URI_TAGS")?De(cn(B),D.ADD_DATA_URI_TAGS,Ze):B,F=tn(D,"FORBID_CONTENTS")?De({},D.FORBID_CONTENTS,Ze):ne,de=tn(D,"FORBID_TAGS")?De({},D.FORBID_TAGS,Ze):cn({}),ke=tn(D,"FORBID_ATTR")?De({},D.FORBID_ATTR,Ze):cn({}),Se=tn(D,"USE_PROFILES")?D.USE_PROFILES:!1,$e=D.ALLOW_ARIA_ATTR!==!1,N=D.ALLOW_DATA_ATTR!==!1,P=D.ALLOW_UNKNOWN_PROTOCOLS||!1,V=D.ALLOW_SELF_CLOSE_IN_ATTR!==!1,S=D.SAFE_FOR_TEMPLATES||!1,C=D.SAFE_FOR_XML!==!1,$=D.WHOLE_DOCUMENT||!1,Re=D.RETURN_DOM||!1,ve=D.RETURN_DOM_FRAGMENT||!1,_=D.RETURN_TRUSTED_TYPE||!1,ge=D.FORCE_BODY||!1,I=D.SANITIZE_DOM!==!1,q=D.SANITIZE_NAMED_PROPS||!1,Ae=D.KEEP_CONTENT!==!1,ze=D.IN_PLACE||!1,ae=D.ALLOWED_URI_REGEXP||Jc,st=D.NAMESPACE||Fe,Zo=D.MATHML_TEXT_INTEGRATION_POINTS||Zo,er=D.HTML_INTEGRATION_POINTS||er,Q=D.CUSTOM_ELEMENT_HANDLING||{},D.CUSTOM_ELEMENT_HANDLING&&Ys(D.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=D.CUSTOM_ELEMENT_HANDLING.tagNameCheck),D.CUSTOM_ELEMENT_HANDLING&&Ys(D.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=D.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),D.CUSTOM_ELEMENT_HANDLING&&typeof D.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=D.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),S&&(N=!1),ve&&(Re=!0),Se&&(ee=De({},Gc),Y=[],Se.html===!0&&(De(ee,Wc),De(Y,qc)),Se.svg===!0&&(De(ee,da),De(Y,pa),De(Y,ci)),Se.svgFilters===!0&&(De(ee,ua),De(Y,pa),De(Y,ci)),Se.mathMl===!0&&(De(ee,fa),De(Y,Kc),De(Y,ci))),D.ADD_TAGS&&(typeof D.ADD_TAGS=="function"?Te.tagCheck=D.ADD_TAGS:(ee===X&&(ee=cn(ee)),De(ee,D.ADD_TAGS,Ze))),D.ADD_ATTR&&(typeof D.ADD_ATTR=="function"?Te.attributeCheck=D.ADD_ATTR:(Y===J&&(Y=cn(Y)),De(Y,D.ADD_ATTR,Ze))),D.ADD_URI_SAFE_ATTR&&De(U,D.ADD_URI_SAFE_ATTR,Ze),D.FORBID_CONTENTS&&(F===ne&&(F=cn(F)),De(F,D.FORBID_CONTENTS,Ze)),D.ADD_FORBID_CONTENTS&&(F===ne&&(F=cn(F)),De(F,D.ADD_FORBID_CONTENTS,Ze)),Ae&&(ee["#text"]=!0),$&&De(ee,["html","head","body"]),ee.table&&(De(ee,["tbody"]),delete de.tbody),D.TRUSTED_TYPES_POLICY){if(typeof D.TRUSTED_TYPES_POLICY.createHTML!="function")throw dr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof D.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw dr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=D.TRUSTED_TYPES_POLICY,M=T.createHTML("")}else T===void 0&&(T=Ag(h,r)),T!==null&&typeof M=="string"&&(M=T.createHTML(""));wt&&wt(D),En=D}},Qs=De({},[...da,...ua,...xg]),Zs=De({},[...fa,...Eg]),ea=function(D){let se=w(D);(!se||!se.tagName)&&(se={namespaceURI:st,tagName:"template"});const be=li(D.tagName),Xe=li(se.tagName);return oi[D.namespaceURI]?D.namespaceURI===we?se.namespaceURI===Fe?be==="svg":se.namespaceURI===le?be==="svg"&&(Xe==="annotation-xml"||Zo[Xe]):!!Qs[be]:D.namespaceURI===le?se.namespaceURI===Fe?be==="math":se.namespaceURI===we?be==="math"&&er[Xe]:!!Zs[be]:D.namespaceURI===Fe?se.namespaceURI===we&&!er[Xe]||se.namespaceURI===le&&!Zo[Xe]?!1:!Zs[be]&&(zc[be]||!Qs[be]):!!(Pn==="application/xhtml+xml"&&oi[D.namespaceURI]):!1},Zt=function(D){lr(e.removed,{element:D});try{w(D).removeChild(D)}catch{g(D)}},kn=function(D,se){try{lr(e.removed,{attribute:se.getAttributeNode(D),from:se})}catch{lr(e.removed,{attribute:null,from:se})}if(se.removeAttribute(D),D==="is")if(Re||ve)try{Zt(se)}catch{}else try{se.setAttribute(D,"")}catch{}},ta=function(D){let se=null,be=null;if(ge)D="<remove></remove>"+D;else{const rt=ca(D,/^[\r\n\t ]+/);be=rt&&rt[0]}Pn==="application/xhtml+xml"&&st===Fe&&(D='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+D+"</body></html>");const Xe=T?T.createHTML(D):D;if(st===Fe)try{se=new p().parseFromString(Xe,Pn)}catch{}if(!se||!se.documentElement){se=A.createDocument(st,"template",null);try{se.documentElement.innerHTML=xn?M:Xe}catch{}}const kt=se.body||se.documentElement;return D&&be&&kt.insertBefore(n.createTextNode(be),kt.childNodes[0]||null),st===Fe?k.call(se,$?"html":"body")[0]:$?se.documentElement:kt},ii=function(D){return y.call(D.ownerDocument||D,D,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},ce=function(D){return D instanceof f&&(typeof D.nodeName!="string"||typeof D.textContent!="string"||typeof D.removeChild!="function"||!(D.attributes instanceof u)||typeof D.removeAttribute!="function"||typeof D.setAttribute!="function"||typeof D.namespaceURI!="string"||typeof D.insertBefore!="function"||typeof D.hasChildNodes!="function")},ue=function(D){return typeof l=="function"&&D instanceof l};function ye(Ee,D,se){ai(Ee,be=>{be.call(e,D,se,En)})}const Ge=function(D){let se=null;if(ye(G.beforeSanitizeElements,D,null),ce(D))return Zt(D),!0;const be=Ze(D.nodeName);if(ye(G.uponSanitizeElement,D,{tagName:be,allowedTags:ee}),C&&D.hasChildNodes()&&!ue(D.firstElementChild)&&St(/<[/\w!]/g,D.innerHTML)&&St(/<[/\w!]/g,D.textContent)||D.nodeType===fr.progressingInstruction||C&&D.nodeType===fr.comment&&St(/<[/\w]/g,D.data))return Zt(D),!0;if(!(Te.tagCheck instanceof Function&&Te.tagCheck(be))&&(!ee[be]||de[be])){if(!de[be]&&At(be)&&(Q.tagNameCheck instanceof RegExp&&St(Q.tagNameCheck,be)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(be)))return!1;if(Ae&&!F[be]){const Xe=w(D)||D.parentNode,kt=v(D)||D.childNodes;if(kt&&Xe){const rt=kt.length;for(let Lt=rt-1;Lt>=0;--Lt){const $n=b(kt[Lt],!0);$n.__removalCount=(D.__removalCount||0)+1,Xe.insertBefore($n,x(D))}}}return Zt(D),!0}return D instanceof c&&!ea(D)||(be==="noscript"||be==="noembed"||be==="noframes")&&St(/<\/no(script|embed|frames)/i,D.innerHTML)?(Zt(D),!0):(S&&D.nodeType===fr.text&&(se=D.textContent,ai([z,R,W],Xe=>{se=cr(se,Xe," ")}),D.textContent!==se&&(lr(e.removed,{element:D.cloneNode()}),D.textContent=se)),ye(G.afterSanitizeElements,D,null),!1)},et=function(D,se,be){if(I&&(se==="id"||se==="name")&&(be in n||be in Xs))return!1;if(!(N&&!ke[se]&&St(H,se))){if(!($e&&St(L,se))){if(!(Te.attributeCheck instanceof Function&&Te.attributeCheck(se,D))){if(!Y[se]||ke[se]){if(!(At(D)&&(Q.tagNameCheck instanceof RegExp&&St(Q.tagNameCheck,D)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(D))&&(Q.attributeNameCheck instanceof RegExp&&St(Q.attributeNameCheck,se)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(se,D))||se==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&St(Q.tagNameCheck,be)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(be))))return!1}else if(!U[se]){if(!St(ae,cr(be,Z,""))){if(!((se==="src"||se==="xlink:href"||se==="href")&&D!=="script"&&mg(be,"data:")===0&&Me[D])){if(!(P&&!St(j,cr(be,Z,"")))){if(be)return!1}}}}}}}return!0},At=function(D){return D!=="annotation-xml"&&ca(D,K)},Lm=function(D){ye(G.beforeSanitizeAttributes,D,null);const{attributes:se}=D;if(!se||ce(D))return;const be={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let Xe=se.length;for(;Xe--;){const kt=se[Xe],{name:rt,namespaceURI:Lt,value:$n}=kt,nr=Ze(rt),_c=$n;let bt=rt==="value"?_c:gg(_c);if(be.attrName=nr,be.attrValue=bt,be.keepAttr=!0,be.forceKeepAttr=void 0,ye(G.uponSanitizeAttribute,D,be),bt=be.attrValue,q&&(nr==="id"||nr==="name")&&(kn(rt,D),bt=pe+bt),C&&St(/((--!?|])>)|<\/(style|title|textarea)/i,bt)){kn(rt,D);continue}if(nr==="attributename"&&ca(bt,"href")){kn(rt,D);continue}if(be.forceKeepAttr)continue;if(!be.keepAttr){kn(rt,D);continue}if(!V&&St(/\/>/i,bt)){kn(rt,D);continue}S&&ai([z,R,W],Vm=>{bt=cr(bt,Vm," ")});const $m=Ze(D.nodeName);if(!et($m,nr,bt)){kn(rt,D);continue}if(T&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Lt)switch(h.getAttributeType($m,nr)){case"TrustedHTML":{bt=T.createHTML(bt);break}case"TrustedScriptURL":{bt=T.createScriptURL(bt);break}}if(bt!==_c)try{Lt?D.setAttributeNS(Lt,rt,bt):D.setAttribute(rt,bt),ce(D)?Zt(D):Hc(e.removed)}catch{kn(rt,D)}}ye(G.afterSanitizeAttributes,D,null)},yM=function Ee(D){let se=null;const be=ii(D);for(ye(G.beforeSanitizeShadowDOM,D,null);se=be.nextNode();)ye(G.uponSanitizeShadowNode,se,null),Ge(se),Lm(se),se.content instanceof i&&Ee(se.content);ye(G.afterSanitizeShadowDOM,D,null)};return e.sanitize=function(Ee){let D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},se=null,be=null,Xe=null,kt=null;if(xn=!Ee,xn&&(Ee="<!-->"),typeof Ee!="string"&&!ue(Ee))if(typeof Ee.toString=="function"){if(Ee=Ee.toString(),typeof Ee!="string")throw dr("dirty is not a string, aborting")}else throw dr("toString is not a function");if(!e.isSupported)return Ee;if(te||tr(D),e.removed=[],typeof Ee=="string"&&(ze=!1),ze){if(Ee.nodeName){const $n=Ze(Ee.nodeName);if(!ee[$n]||de[$n])throw dr("root node is forbidden and cannot be sanitized in-place")}}else if(Ee instanceof l)se=ta("<!---->"),be=se.ownerDocument.importNode(Ee,!0),be.nodeType===fr.element&&be.nodeName==="BODY"||be.nodeName==="HTML"?se=be:se.appendChild(be);else{if(!Re&&!S&&!$&&Ee.indexOf("<")===-1)return T&&_?T.createHTML(Ee):Ee;if(se=ta(Ee),!se)return Re?null:_?M:""}se&&ge&&Zt(se.firstChild);const rt=ii(ze?Ee:se);for(;Xe=rt.nextNode();)Ge(Xe),Lm(Xe),Xe.content instanceof i&&yM(Xe.content);if(ze)return Ee;if(Re){if(ve)for(kt=E.call(se.ownerDocument);se.firstChild;)kt.appendChild(se.firstChild);else kt=se;return(Y.shadowroot||Y.shadowrootmode)&&(kt=O.call(o,kt,!0)),kt}let Lt=$?se.outerHTML:se.innerHTML;return $&&ee["!doctype"]&&se.ownerDocument&&se.ownerDocument.doctype&&se.ownerDocument.doctype.name&&St(Xc,se.ownerDocument.doctype.name)&&(Lt="<!DOCTYPE "+se.ownerDocument.doctype.name+`>
338
- `+Lt),S&&ai([z,R,W],$n=>{Lt=cr(Lt,$n," ")}),T&&_?T.createHTML(Lt):Lt},e.setConfig=function(){let Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tr(Ee),te=!0},e.clearConfig=function(){En=null,te=!1},e.isValidAttribute=function(Ee,D,se){En||tr({});const be=Ze(Ee),Xe=Ze(D);return et(be,Xe,se)},e.addHook=function(Ee,D){typeof D=="function"&&lr(G[Ee],D)},e.removeHook=function(Ee,D){if(D!==void 0){const se=pg(G[Ee],D);return se===-1?void 0:hg(G[Ee],se,1)[0]}return Hc(G[Ee])},e.removeHooks=function(Ee){G[Ee]=[]},e.removeAllHooks=function(){G=Qc()},e}var Mg=Zc();function ed(t){return Mg.sanitize(t,{ALLOWED_TAGS:["p","br","strong","em","s","u","ul","ol","li","a","hr"],ALLOWED_ATTR:["href","target","rel"],ALLOW_DATA_ATTR:!1,FORBID_TAGS:["script","iframe","object","embed","form","input","button","style"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur"]})}function it(t){return typeof t!="string"?"":t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ct(t){if(!t||typeof t!="string")return"";const e=t.trim(),n=e.toLowerCase();return n.startsWith("javascript:")||n.startsWith("vbscript:")||n.startsWith("file:")?"":n.startsWith("data:")?n.startsWith("data:image/")?e:"":e}const he={TEXT_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):([^}]+)\}/g,TEXT_FIELD:/\{\$(\w+):([^}]+)\}/g,RICH_TEXT_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):rich(?::[^}]+)?\}/g,RICH_TEXT_FIELD:/\{\$(\w+):(.+?):rich(?::[^}]+)?\}/g,TEXTAREA_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):textarea(?::[^}]+)?\}/g,TEXTAREA_FIELD:/\{\$(\w+):(.+?):textarea(?::[^}]+)?\}/g,IMAGE_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):image(?::[^}]+)?\}/g,IMAGE_FIELD:/\{\$(\w+):(.+?):image(?::[^}]+)?\}/g,SELECT_FIELD_WITH_GROUP:/\(\$(\w+)\.(\w+)@:([^)]+)\)/g,SELECT_FIELD:/\(\$(\w+)@:([^)]+)\)/g,RADIO_CHECKBOX_FIELD_WITH_GROUP:/\(\$(\w+)\.(\w+):([^)]+)\)/g,RADIO_FIELD:/\(\$(\w+):([^)]+)\)/g,BACKEND_DATA:/\{@([\w.[\]]+)\}/g};function Ig(t){const e={};for(const n of t){if(n==="required"){e.required=!0;continue}if(n==="readonly"){e.readonly=!0;continue}if(n==="disabled"){e.disabled=!0;continue}if(n.startsWith("max=")){const o=Number(n.slice(4));Number.isFinite(o)&&(e.maxLength=o)}}return e}function _e(t){const e=t.split(":"),n=[],o=r=>r==="required"||r==="readonly"||r==="disabled"||/^max=\d+$/.test(r);for(;e.length>0&&o(e[e.length-1]);)n.unshift(e.pop());return{defaultValue:e.join(":"),validation:Ig(n)}}function Fn(t){const e=[],n=new Set,o=ra(),s=new o().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template");if(!s)return e;const l=d=>{if(d.nodeType===Node.TEXT_NODE){const u=d.textContent||"",f=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(f)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]){const C=S[1],$=S[2];if(!n.has(C)){const{defaultValue:te,validation:ge}=_e(S[3]);e.push({fieldName:C,groupName:$,type:"rich",defaultValue:te,optional:!0,...ge}),n.add(C)}}});const h=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(h)).forEach(S=>{if(S&&S[1]&&S[2]){const C=S[1];if(!n.has(C)){const{defaultValue:$,validation:te}=_e(S[2]);e.push({fieldName:C,type:"rich",defaultValue:$,optional:!0,...te}),n.add(C)}}});const b=new RegExp(he.RICH_TEXT_FIELD_WITH_GROUP.source,he.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(b)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]){const C=S[1],$=S[2];if(!n.has(C)){const{defaultValue:te,validation:ge}=_e(S[3]);e.push({fieldName:C,groupName:$,type:"rich",defaultValue:te,...ge}),n.add(C)}}});const x=new RegExp(he.RICH_TEXT_FIELD.source,he.RICH_TEXT_FIELD.flags);Array.from(u.matchAll(x)).forEach(S=>{if(S&&S[1]&&S[2]){const C=S[1];if(!n.has(C)){const{defaultValue:$,validation:te}=_e(S[2]);e.push({fieldName:C,type:"rich",defaultValue:$,...te}),n.add(C)}}});const w=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(w)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"textarea",defaultValue:C,optional:!0,...$}),n.add(S[1])}});const M=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(M)).forEach(S=>{if(S&&S[1]&&S[2]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[2]);e.push({fieldName:S[1],type:"textarea",defaultValue:C,optional:!0,...$}),n.add(S[1])}});const y=new RegExp(he.TEXTAREA_FIELD_WITH_GROUP.source,he.TEXTAREA_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(y)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"textarea",defaultValue:C,...$}),n.add(S[1])}});const k=new RegExp(he.TEXTAREA_FIELD.source,he.TEXTAREA_FIELD.flags);Array.from(u.matchAll(k)).forEach(S=>{if(S&&S[1]&&S[2]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[2]);e.push({fieldName:S[1],type:"textarea",defaultValue:C,...$}),n.add(S[1])}});const G=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(G)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"image",defaultValue:C,optional:!0,...$}),n.add(S[1])}});const R=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(R)).forEach(S=>{if(S&&S[1]&&S[2]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[2]);e.push({fieldName:S[1],type:"image",defaultValue:C,optional:!0,...$}),n.add(S[1])}});const H=new RegExp(he.IMAGE_FIELD_WITH_GROUP.source,he.IMAGE_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(H)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"image",defaultValue:C,...$}),n.add(S[1])}});const j=new RegExp(he.IMAGE_FIELD.source,he.IMAGE_FIELD.flags);Array.from(u.matchAll(j)).forEach(S=>{if(S&&S[1]&&S[2]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[2]);e.push({fieldName:S[1],type:"image",defaultValue:C,...$}),n.add(S[1])}});const K=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(K)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"text",defaultValue:C,optional:!0,...$}),n.add(S[1])}});const ee=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(ee)).forEach(S=>{if(S&&S[0]&&!/:rich(?::[^}]*)?\}$/.test(S[0])&&!/:image(?::[^}]*)?\}$/.test(S[0])&&!/:textarea(?::[^}]*)?\}$/.test(S[0])&&!S[0].includes(".")&&S[1]&&S[2]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[2]);e.push({fieldName:S[1],type:"text",defaultValue:C,optional:!0,...$}),n.add(S[1])}});const Y=new RegExp(he.TEXT_FIELD_WITH_GROUP.source,he.TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(Y)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"text",defaultValue:C,...$}),n.add(S[1])}});const Q=new RegExp(he.TEXT_FIELD.source,he.TEXT_FIELD.flags);Array.from(u.matchAll(Q)).forEach(S=>{if(S&&S[0]&&!/:rich(?::[^}]*)?\}$/.test(S[0])&&!/:image(?::[^}]*)?\}$/.test(S[0])&&!/:textarea(?::[^}]*)?\}$/.test(S[0])&&!S[0].includes(".")&&S[1]&&S[2]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[2]);e.push({fieldName:S[1],type:"text",defaultValue:C,...$}),n.add(S[1])}});const ke=new RegExp(he.SELECT_FIELD_WITH_GROUP.source,he.SELECT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(ke)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!n.has(S[1])){const C=S[1],$=S[2],te=S[3];te.includes("|")?e.push({fieldName:C,groupName:$,type:"select",options:te.split("|")}):te.includes(",")&&e.push({fieldName:C,groupName:$,type:"select-multiple",options:te.split(",")}),n.add(C)}}),(u.match(he.SELECT_FIELD)||[]).forEach(S=>{const C=S.match(/\(\$(\w+)@:([^)]+)\)/);if(C&&!n.has(C[1])){const $=C[1],te=C[2];te.includes("|")?e.push({fieldName:$,type:"select",options:te.split("|")}):te.includes(",")&&e.push({fieldName:$,type:"select-multiple",options:te.split(",")}),n.add($)}});const N=new RegExp(he.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,he.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(N)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!n.has(S[1])){const C=S[1],$=S[2],te=S[3];te.includes("|")?e.push({fieldName:C,groupName:$,type:"radio",options:te.split("|")}):te.includes(",")&&e.push({fieldName:C,groupName:$,type:"checkbox",options:te.split(",")}),n.add(C)}}),(u.match(he.RADIO_FIELD)||[]).forEach(S=>{const C=S.match(/\(\$(\w+):([^)]+)\)/);if(C&&!n.has(C[1])){const $=C[1],te=C[2];te.includes("|")?e.push({fieldName:$,type:"radio",options:te.split("|")}):te.includes(",")&&e.push({fieldName:$,type:"checkbox",options:te.split(",")}),n.add($)}});return}else if(d.nodeType===Node.ELEMENT_NODE){const u=d,f=u.getAttribute("z-if");f&&!n.has(f)&&(e.push({fieldName:f,type:"boolean",defaultValue:"true"}),n.add(f));const p=u.getAttribute("z-tag");if(p){const m=p.match(/^\$(\w+)(?::(.+))?$/);if(m){const b=m[1],g=m[2];if(!n.has(b)){const x=g?g.split("|").map(T=>T.trim()):void 0,v=u.tagName.toLowerCase();let w=v;x&&!x.includes(v)&&(typeof process<"u"&&process.env?.NODE_ENV==="development"&&console.warn(`[ZeroCode] z-tag="${p}": 現在のタグ名 "${v}" が選択肢に含まれていません。デフォルト値として "${x[0]}" を使用します。`),w=x[0]),e.push({fieldName:b,type:"tag",defaultValue:w,options:x,optional:!1}),n.add(b)}}}Array.from(u.attributes).forEach(m=>{const b=m.value,g=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(b.matchAll(g)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"rich",defaultValue:P,optional:!0,...V}),n.add(N[1])}});const v=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(b.matchAll(v)).forEach(N=>{if(N&&N[1]&&N[2]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[2]);e.push({fieldName:N[1],type:"rich",defaultValue:P,optional:!0,...V}),n.add(N[1])}});const T=new RegExp(he.RICH_TEXT_FIELD_WITH_GROUP.source,he.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(T)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"rich",defaultValue:P,...V}),n.add(N[1])}});const A=new RegExp(he.RICH_TEXT_FIELD.source,he.RICH_TEXT_FIELD.flags);Array.from(b.matchAll(A)).forEach(N=>{if(N&&N[1]&&N[2]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[2]);e.push({fieldName:N[1],type:"rich",defaultValue:P,...V}),n.add(N[1])}});const E=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(b.matchAll(E)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"image",defaultValue:P,optional:!0,...V}),n.add(N[1])}});const O=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(b.matchAll(O)).forEach(N=>{if(N&&N[1]&&N[2]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[2]);e.push({fieldName:N[1],type:"image",defaultValue:P,optional:!0,...V}),n.add(N[1])}});const z=new RegExp(he.IMAGE_FIELD_WITH_GROUP.source,he.IMAGE_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(z)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"image",defaultValue:P,...V}),n.add(N[1])}});const W=new RegExp(he.IMAGE_FIELD.source,he.IMAGE_FIELD.flags);Array.from(b.matchAll(W)).forEach(N=>{if(N&&N[1]&&N[2]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[2]);e.push({fieldName:N[1],type:"image",defaultValue:P,...V}),n.add(N[1])}});const L=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(b.matchAll(L)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"text",defaultValue:P,optional:!0,...V}),n.add(N[1])}});const Z=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(b.matchAll(Z)).forEach(N=>{if(N&&N[0]&&!/:rich(?::[^}]*)?\}$/.test(N[0])&&!/:image(?::[^}]*)?\}$/.test(N[0])&&!/:textarea(?::[^}]*)?\}$/.test(N[0])&&!N[0].includes(".")&&N[1]&&N[2]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[2]);e.push({fieldName:N[1],type:"text",defaultValue:P,optional:!0,...V}),n.add(N[1])}});const ae=new RegExp(he.TEXT_FIELD_WITH_GROUP.source,he.TEXT_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(ae)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"text",defaultValue:P,...V}),n.add(N[1])}});const X=new RegExp(he.TEXT_FIELD.source,he.TEXT_FIELD.flags);Array.from(b.matchAll(X)).forEach(N=>{if(N&&N[0]&&!/:rich(?::[^}]*)?\}$/.test(N[0])&&!/:image(?::[^}]*)?\}$/.test(N[0])&&!/:textarea(?::[^}]*)?\}$/.test(N[0])&&!N[0].includes(".")&&N[1]&&N[2]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[2]);e.push({fieldName:N[1],type:"text",defaultValue:P,...V}),n.add(N[1])}});const J=new RegExp(he.SELECT_FIELD_WITH_GROUP.source,he.SELECT_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(J)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!n.has(N[1])){const P=N[1],V=N[2],S=N[3];S.includes("|")?e.push({fieldName:P,groupName:V,type:"select",options:S.split("|")}):S.includes(",")&&e.push({fieldName:P,groupName:V,type:"select-multiple",options:S.split(",")}),n.add(P)}}),(b.match(he.SELECT_FIELD)||[]).forEach(N=>{const P=N.match(/\(\$(\w+)@:([^)]+)\)/);if(P&&!n.has(P[1])){const V=P[1],S=P[2];S.includes("|")?e.push({fieldName:V,type:"select",options:S.split("|")}):S.includes(",")&&e.push({fieldName:V,type:"select-multiple",options:S.split(",")}),n.add(V)}});const ke=new RegExp(he.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,he.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(ke)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!n.has(N[1])){const P=N[1],V=N[2],S=N[3];S.includes("|")?e.push({fieldName:P,groupName:V,type:"radio",options:S.split("|")}):S.includes(",")&&e.push({fieldName:P,groupName:V,type:"checkbox",options:S.split(",")}),n.add(P)}}),(b.match(he.RADIO_FIELD)||[]).forEach(N=>{const P=N.match(/\(\$(\w+):([^)]+)\)/);if(P&&!n.has(P[1])){const V=P[1],S=P[2];S.includes("|")?e.push({fieldName:V,type:"radio",options:S.split("|")}):S.includes(",")&&e.push({fieldName:V,type:"checkbox",options:S.split(",")}),n.add(V)}})}),Array.from(d.childNodes).forEach(m=>l(m));return}else if(d.nodeType===Node.DOCUMENT_FRAGMENT_NODE){Array.from(d.childNodes).forEach(f=>l(f));return}};return Array.from(s.content.childNodes).forEach(d=>l(d)),e}function td(t,e){const n=ra(),i=new n().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template");if(!i||!i.content.firstElementChild)return console.warn("Failed to parse HTML:",t),t;const s=i.content.firstElementChild;return Object.entries(e).forEach(([l,c])=>{s.setAttribute(l,c)}),s.outerHTML}function di(t,e,n,o,r=[]){const i=[...n,...o,...r];if(t){const s=i.find(l=>l.id===t);if(s)return s.url}if(e){const s=i.find(l=>l.id===e);if(s)return console.warn(`Image not found: ${t}, using default: ${e}`),s.url}return console.warn(`Image not found: ${t}, default: ${e}`),""}function Og(t){return typeof t=="object"&&t!==null}function nd(t,e){if(!t||!e)return"";try{const n=[];let o="";for(let i=0;i<e.length;i++){const s=e[i];s==="["||s==="]"||s==="."?o&&(n.push(o),o=""):o+=s}o&&n.push(o);let r=t;for(let i=0;i<n.length;i++){const s=n[i];if(s.match(/^\d+$/)){const l=parseInt(s,10);if(Array.isArray(r)&&l>=0&&l<r.length)r=r[l];else return""}else if(Og(r)&&s in r)r=r[s];else return""}return r==null?"":String(r)}catch(n){return console.warn(`[ZeroCode] Failed to resolve backend data path: ${e}`,n),""}}function Dg(t,e){return!t||!e?t:t.replace(/\{(\w+)\}/g,(n,o)=>{const r=e[o];return r==null?n:String(r)})}function ui(t,e,n,o,r,i=!0,s=[],l=[],c=[],d){const u=ra(),f=new u,p=f.parseFromString(`<template>${t}</template>`,"text/html"),h=p.querySelector("template");if(!h||!h.content)return console.error("Failed to parse template HTML"),t;const m=y=>{if(y.nodeType===Node.TEXT_NODE){let E=y.textContent||"";d&&(E=E.replace(he.BACKEND_DATA,(ee,X)=>nd(d,X)));let O=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(E),G=!1;if(O&&y.parentNode?G=!0:O=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(E),O&&y.parentNode){const ee=O[1],X=G?O[3]:O[2],{defaultValue:Y}=_e(X),J=e[ee];if(typeof J=="boolean"){const P=y.parentNode,V=O.index||0,S=E.substring(0,V),C=E.substring(V+O[0].length);S&&P.insertBefore(p.createTextNode(S),y),C&&P.insertBefore(p.createTextNode(C),y),y.parentNode&&y.parentNode.removeChild(y);return}let Q=J===void 0?"":typeof J=="string"?J:String(J||Y);i||(Q=ed(Q));const de=y.parentNode,ke=O.index||0,Te=E.substring(0,ke),$e=E.substring(ke+O[0].length);Q?Q.trim().startsWith("<p")||(Q=`<p>${Q}</p>`):Q="";const N=p.createElement("div");N.innerHTML=Q,Te&&de.insertBefore(p.createTextNode(Te),y),Array.from(N.childNodes).forEach(P=>{de.insertBefore(P.cloneNode(!0),y)}),$e&&de.insertBefore(p.createTextNode($e),y),y.parentNode&&y.parentNode.removeChild(y);return}let R=new RegExp(he.RICH_TEXT_FIELD_WITH_GROUP.source,he.RICH_TEXT_FIELD_WITH_GROUP.flags).exec(E),W=!1;if(R&&y.parentNode?W=!0:R=new RegExp(he.RICH_TEXT_FIELD.source,he.RICH_TEXT_FIELD.flags).exec(E),R&&y.parentNode){const ee=R[1],X=W?R[3]:R[2],Y=e[ee];let J=Y===void 0?"":typeof Y=="string"?Y:String(Y||X);i||(J=ed(J));const Q=y.parentNode,de=R.index||0,ke=E.substring(0,de),Te=E.substring(de+R[0].length);J?J.trim().startsWith("<p")||(J=`<p>${J}</p>`):J="<p></p>";const $e=p.createElement("div");$e.innerHTML=J,ke&&Q.insertBefore(p.createTextNode(ke),y),Array.from($e.childNodes).forEach(N=>{Q.insertBefore(N.cloneNode(!0),y)}),Te&&Q.insertBefore(p.createTextNode(Te),y),y.parentNode&&y.parentNode.removeChild(y);return}let L=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(E),j=!1;if(L&&y.parentNode?j=!0:L=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(E),L&&y.parentNode){const ee=L[1],X=j?L[3]:L[2],{defaultValue:Y}=_e(X),J=e[ee],Q=J===void 0?"":String(J||Y),de=y.parentNode,ke=L.index||0,Te=E.substring(0,ke),$e=E.substring(ke+L[0].length);Te&&de.insertBefore(p.createTextNode(Te),y);const N=Q.split(`
339
- `);if(N.forEach((P,V)=>{P&&de.insertBefore(p.createTextNode(P),y),V<N.length-1&&de.insertBefore(p.createElement("br"),y)}),$e){const P=p.createTextNode($e);de.insertBefore(P,y),m(P)}y.parentNode&&y.parentNode.removeChild(y);return}let K=new RegExp(he.TEXTAREA_FIELD_WITH_GROUP.source,he.TEXTAREA_FIELD_WITH_GROUP.flags).exec(E),ae=!1;if(K&&y.parentNode?ae=!0:K=new RegExp(he.TEXTAREA_FIELD.source,he.TEXTAREA_FIELD.flags).exec(E),K&&y.parentNode){const ee=K[1],X=ae?K[3]:K[2],Y=e[ee]??X??"",J=String(Y),Q=y.parentNode,de=K.index||0,ke=E.substring(0,de),Te=E.substring(de+K[0].length);ke&&Q.insertBefore(p.createTextNode(ke),y);const $e=J.split(`
340
- `);if($e.forEach((N,P)=>{N&&Q.insertBefore(p.createTextNode(N),y),P<$e.length-1&&Q.insertBefore(p.createElement("br"),y)}),Te){const N=p.createTextNode(Te);Q.insertBefore(N,y),m(N)}y.parentNode&&y.parentNode.removeChild(y);return}E=E.replace(/\{\$(\w+)\?:([^}]+)\}/g,(ee,X,Y)=>{if(/:textarea(?::[^}]*)?$/.test(ee))return ee;const J=e[X];if(J===void 0||typeof J=="boolean")return"";const{defaultValue:Q}=_e(Y);return String(J||Q)}),E=E.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(ee,X,Y,J)=>{if(/:textarea(?::[^}]*)?$/.test(ee))return ee;const Q=e[X];if(Q===void 0||typeof Q=="boolean")return"";const{defaultValue:de}=_e(J);return String(Q||de)}),E=E.replace(he.TEXT_FIELD_WITH_GROUP,(ee,X,Y,J)=>{const Q=e[X];if(Q===void 0)return"";const{defaultValue:de}=_e(J);return String(Q||de)}),E=E.replace(he.TEXT_FIELD,(ee,X,Y)=>{const J=e[X];if(J===void 0)return"";const{defaultValue:Q}=_e(Y);return String(J||Q)}),y.textContent=E}else if(y.nodeType===Node.ELEMENT_NODE){const E=y,k=[];Array.from(E.attributes).forEach(O=>{const G=O.value;let z=O.value;const R=O.name.toLowerCase();if(R==="z-if"||R==="z-for"||R==="z-slot"||R==="z-empty"||R==="z-tag"||R.startsWith("data-zcode-"))return;const W=/^\{\$[\w.]+?\?:[^}]+\}(?::(rich|image|textarea))?$/.test(G.trim());d&&((R==="href"||R==="src"||R==="action")&&(z=Dg(z,d)),z=z.replace(he.BACKEND_DATA,(H,L)=>{const j=nd(d,L);return R==="href"||R==="src"||R==="action"?Ct(j):it(j)})),z=z.replace(/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(H,L,j)=>{const Z=e[L];if(Z===void 0||typeof Z=="boolean")return"";const{defaultValue:K}=_e(j);return it(String(Z||K))}),z=z.replace(/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(H,L,j,Z)=>{const K=e[L];if(K===void 0||typeof K=="boolean")return"";const{defaultValue:ae}=_e(Z);return it(String(K||ae))}),z=z.replace(/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(H,L,j)=>{const Z=e[L];if(Z===void 0)return"";const{defaultValue:K}=_e(j),ae=typeof Z=="string"?Z:String(Z||K),ee=di(ae,K,s,l,c),X=typeof ee=="string"?ee:String(ee||K);return R==="href"||R==="src"?Ct(X):it(X)}),z=z.replace(/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(H,L,j,Z)=>{const K=e[L];if(K===void 0)return"";const{defaultValue:ae}=_e(Z),ee=typeof K=="string"?K:String(K||ae),X=di(ee,ae,s,l,c),Y=typeof X=="string"?X:String(X||ae);return R==="href"||R==="src"?Ct(Y):it(Y)}),z=z.replace(he.RICH_TEXT_FIELD_WITH_GROUP,(H,L,j,Z)=>{const K=e[L];return K===void 0?"":it(String(K||Z))}),z=z.replace(he.RICH_TEXT_FIELD,(H,L,j)=>{const Z=e[L];return Z===void 0?"":it(String(Z||j))}),z=z.replace(he.IMAGE_FIELD_WITH_GROUP,(H,L,j,Z)=>{const K=e[L];if(K===void 0)return"";const ae=di(K||Z,Z,s,l,c);return R==="href"||R==="src"?Ct(ae||Z):it(ae||Z)}),z=z.replace(he.IMAGE_FIELD,(H,L,j)=>{const Z=e[L];if(Z===void 0)return"";const K=di(Z||j,j,s,l,c);return R==="href"||R==="src"?Ct(K||j):it(K||j)}),z=z.replace(/\{\$(\w+)\?:([^}]+)\}/g,(H,L,j)=>{const Z=e[L];if(Z===void 0||typeof Z=="boolean")return"";const{defaultValue:K}=_e(j),ae=String(Z||K);return R==="href"||R==="src"||R==="action"?Ct(ae):it(ae)}),z=z.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(H,L,j,Z)=>{const K=e[L];if(K===void 0||typeof K=="boolean")return"";const{defaultValue:ae}=_e(Z),ee=String(K||ae);return R==="href"||R==="src"||R==="action"?Ct(ee):it(ee)}),z=z.replace(he.TEXT_FIELD_WITH_GROUP,(H,L,j,Z)=>{const K=e[L];if(K===void 0)return"";const{defaultValue:ae}=_e(Z),ee=String(K||ae);return R==="href"||R==="src"||R==="action"?Ct(ee):it(ee)}),z=z.replace(he.TEXT_FIELD,(H,L,j)=>{const Z=e[L];if(Z===void 0)return"";const{defaultValue:K}=_e(j),ae=String(Z||K);return R==="href"||R==="src"||R==="action"?Ct(ae):it(ae)}),W&&z.trim()===""?k.push(O.name):O.value=z}),k.forEach(O=>{E.removeAttribute(O)})}Array.from(y.childNodes).forEach(E=>m(E))};m(h.content);const b=y=>{if(y.nodeType===Node.TEXT_NODE){let E=y.textContent||"";E=E.replace(he.SELECT_FIELD_WITH_GROUP,(k,O,G,z)=>{if(z.includes("|"))return e[O]||z.split("|")[0];if(z.includes(",")){const R=e[O],W=Array.isArray(R)?R:[],H=z.split(",");return W.filter(L=>typeof L=="string"&&H.includes(L)).join(" ")}return e[O]||z}),E=E.replace(he.SELECT_FIELD,(k,O,G)=>{if(G.includes("|")){const R=e[O];return typeof R=="string"?R:G.split("|")[0]}else if(G.includes(",")){const R=e[O],W=Array.isArray(R)?R:[],H=G.split(",");return W.filter(L=>typeof L=="string"&&H.includes(L)).join(" ")}const z=e[O];return typeof z=="string"?z:G}),E=E.replace(he.RADIO_CHECKBOX_FIELD_WITH_GROUP,(k,O,G,z)=>{if(z.includes("|")){const W=e[O];return typeof W=="string"?W:z.split("|")[0]}else if(z.includes(",")){const W=e[O],H=Array.isArray(W)?W:[],L=z.split(",");return H.filter(j=>typeof j=="string"&&L.includes(j)).join(" ")}const R=e[O];return typeof R=="string"?R:z}),E=E.replace(he.RADIO_FIELD,(k,O,G)=>{if(G.includes("|")){const R=e[O];return typeof R=="string"?R:G.split("|")[0]}else if(G.includes(",")){const R=e[O],W=Array.isArray(R)?R:[],H=G.split(",");return W.filter(L=>typeof L=="string"&&H.includes(L)).join(" ")}const z=e[O];return typeof z=="string"?z:G}),y.textContent=E}else y.nodeType===Node.ELEMENT_NODE&&Array.from(y.attributes).forEach(k=>{let O=k.value;const G=k.name.toLowerCase();O=O.replace(he.SELECT_FIELD_WITH_GROUP,(z,R,W,H)=>{let L;if(H.includes("|"))L=e[R]||H.split("|")[0];else if(H.includes(",")){const j=e[R],Z=Array.isArray(j)?j:[],K=H.split(",");L=Z.filter(ae=>typeof ae=="string"&&K.includes(ae)).join(" ")}else{const j=e[R];L=typeof j=="string"?j:H}return G==="href"||G==="src"||G==="action"?Ct(String(L)):it(String(L))}),O=O.replace(he.SELECT_FIELD,(z,R,W)=>{let H;if(W.includes("|"))H=e[R]||W.split("|")[0];else if(W.includes(",")){const L=e[R],j=Array.isArray(L)?L:[],Z=W.split(",");H=j.filter(K=>typeof K=="string"&&Z.includes(K)).join(" ")}else{const L=e[R];H=typeof L=="string"?L:W}return G==="href"||G==="src"||G==="action"?Ct(String(H)):it(String(H))}),O=O.replace(he.RADIO_CHECKBOX_FIELD_WITH_GROUP,(z,R,W,H)=>{let L;if(H.includes("|"))L=e[R]||H.split("|")[0];else if(H.includes(",")){const j=e[R],Z=Array.isArray(j)?j:[],K=H.split(",");L=Z.filter(ae=>typeof ae=="string"&&K.includes(ae)).join(" ")}else{const j=e[R];L=typeof j=="string"?j:H}return G==="href"||G==="src"||G==="action"?Ct(String(L)):it(String(L))}),O=O.replace(he.RADIO_FIELD,(z,R,W)=>{let H;if(W.includes("|"))H=e[R]||W.split("|")[0];else if(W.includes(",")){const L=e[R],j=Array.isArray(L)?L:[],Z=W.split(",");H=j.filter(K=>typeof K=="string"&&Z.includes(K)).join(" ")}else{const L=e[R];H=typeof L=="string"?L:W}return G==="href"||G==="src"||G==="action"?Ct(String(H)):it(String(H))}),k.value=O});y.childNodes.forEach(E=>b(E))};b(h.content),h.content.querySelectorAll("[z-if]").forEach(y=>{const E=y.getAttribute("z-if");E?(e[E]!==void 0?e[E]:!0)?y.removeAttribute("z-if"):y.remove():y.removeAttribute("z-if")}),h.content.querySelectorAll("[z-tag]").forEach(y=>{const E=y.getAttribute("z-tag");if(E){const k=E.match(/^\$(\w+)(?::(.+))?$/);if(k){const O=k[1],G=e[O],z=typeof G=="string"?G:y.tagName.toLowerCase(),R=["h1","h2","h3","h4","h5","h6","div","p","span","li","ul","ol","section","article","aside","nav","header","footer","main","figure","figcaption","blockquote","pre","code","table","thead","tbody","tr","th","td"],W=typeof z=="string"?z.toLowerCase():z;if(typeof W=="string"&&R.includes(W)){const H=p.createElement(W);Array.from(y.attributes).forEach(L=>{L.name!=="z-tag"&&H.setAttribute(L.name,L.value)}),Array.from(y.childNodes).forEach(L=>{H.appendChild(L.cloneNode(!0))}),y.parentNode?.replaceChild(H,y)}}}}),h.content.querySelectorAll("[z-empty]").forEach(y=>{const E=y.getAttribute("z-empty");if(E){const k=E.match(/^\$(\w+)$/);if(k){const O=k[1],G=e[O];(R=>{if(R==null||R==="")return!0;if(typeof R=="string"){const W=R.trim();if(W===""||W==="<p></p>"||W==="<p> </p>"||/^<p>\s*<\/p>$/i.test(W)||/^<p>\s*<br\s*\/?>\s*<\/p>$/i.test(W))return!0}return!1})(G)?y.remove():y.removeAttribute("z-empty")}else y.removeAttribute("z-empty")}else y.removeAttribute("z-empty")});const w=()=>{Array.from(h.content.querySelectorAll("[z-for]")).forEach(E=>{const k=E.getAttribute("z-for");if(!k){E.removeAttribute("z-for");return}const O=k.match(/^(\w+)\s+in\s+(.+)$/);if(!O){console.warn(`[ZeroCode] Invalid z-for syntax: ${k}`),E.removeAttribute("z-for");return}const[,G,z]=O;if(!z.startsWith("{@")||!z.endsWith("}")){console.warn(`[ZeroCode] z-for only supports backend data: ${z}`),E.removeAttribute("z-for");return}const R=z.slice(2,-1);if(!d){E.remove();return}let W;try{const L=R.split(".");let j=d;for(const Z of L)if(j&&typeof j=="object"&&Z in j)j=j[Z];else{j=null;break}W=j}catch(L){console.warn(`[ZeroCode] Failed to resolve data source: ${R}`,L),E.remove();return}if(!Array.isArray(W)||W.length===0){E.remove();return}const H=document.createDocumentFragment();W.forEach(L=>{const j=E.cloneNode(!0);j.removeAttribute("z-for"),T(j,G,L,e,d),H.appendChild(j)}),E.parentNode&&E.parentNode.replaceChild(H,E)})},T=(y,E,k,O,G,z)=>{const R=H=>{if(H.nodeType===Node.TEXT_NODE){let L=H.textContent||"";const j=new RegExp(`\\{${E}\\.([\\w\\.\\[\\]]+)\\}`,"g");L=L.replace(j,(Z,K)=>{try{const ae=K.split(/[.[\]]/).filter(X=>X);let ee=k;for(const X of ae)if(X.match(/^\d+$/)){const Y=parseInt(X,10);if(Array.isArray(ee)&&Y>=0&&Y<ee.length)ee=ee[Y];else return""}else if(ee&&typeof ee=="object"&&X in ee)ee=ee[X];else return"";return ee==null?"":String(ee)}catch{return""}}),L=L.replace(new RegExp(`\\{${E}\\}`,"g"),()=>typeof k=="object"&&k!==null?JSON.stringify(k):String(k)),H.textContent=L}else if(H.nodeType===Node.ELEMENT_NODE){const L=H;Array.from(L.attributes).forEach(j=>{let Z=j.value;const K=new RegExp(`\\{${E}\\.([\\w\\.\\[\\]]+)\\}`,"g");Z=Z.replace(K,(ae,ee)=>{try{const X=ee.split(/[.[\]]/).filter(Q=>Q);let Y=k;for(const Q of X)if(Q.match(/^\d+$/)){const de=parseInt(Q,10);if(Array.isArray(Y)&&de>=0&&de<Y.length)Y=Y[de];else return""}else if(Y&&typeof Y=="object"&&Q in Y)Y=Y[Q];else return"";const J=Y==null?"":String(Y);return j.name==="href"||j.name==="src"||j.name==="action"?Ct(J):it(J)}catch{return""}}),Z=Z.replace(new RegExp(`\\{${E}\\}`,"g"),()=>{const ae=typeof k=="object"&&k!==null?JSON.stringify(k):String(k);return j.name==="href"||j.name==="src"||j.name==="action"?Ct(ae):it(ae)}),j.value=Z}),Array.from(L.childNodes).forEach(j=>R(j))}};Array.from(y.childNodes).forEach(H=>R(H));const W=y.innerHTML;if(W){const H=ui(W,O,n,o,r,i,s,l,c,G);y.innerHTML=H}};w();const M=y=>{y.forEach(E=>{const k=E.getAttribute("z-slot")||"default",O=e.slots?.[k];let G=[];if(Array.isArray(O)?G=O:O&&typeof O=="object"&&O.children&&(G=O.children||[]),G.length===0){E.removeAttribute("z-slot"),i?(E.setAttribute("data-zcode-empty-slot",k),E.setAttribute("data-zcode-slot-path",n?`${n}.slots.${k}`:`slots.${k}`),E.innerHTML=`<div class="zcode-empty-slot" data-zcode-empty-slot-content>
337
+ `}function Co(n,e=!1){const t=n,o=n.querySelector("script[data-zcode-shadow-extension]");if(o)if(e){if(t.__zcmsEventListeners){const i=t.__zcmsEventListeners;i.forEach(function(s){s.forEach(function(l){n.removeEventListener(l.eventName,l.handler,!0)})}),i.clear()}o.remove(),t.__zcmsJQueryExtended&&delete t.__zcmsJQueryExtended,t.__zcmsNativeAPIExtended&&delete t.__zcmsNativeAPIExtended}else return;const r=document.createElement("script");r.setAttribute("data-zcode-shadow-extension","true"),r.textContent=Tm(n),n.insertBefore(r,n.firstChild)}function vm(){if(typeof window>"u")return 20;try{let n=document.querySelector(".zcode-toolbar");if(!n){const t=document.querySelectorAll("zcode-cms, zcode-editor");for(const o of Array.from(t)){const r=o.shadowRoot;if(r){const i=r.querySelector(".zcode-toolbar");if(i){n=i;break}}}}if(!n)return 20;const e=n.getBoundingClientRect();return e.height>0?e.height:20}catch(n){return console.warn("Failed to get toolbar height:",n),20}}function Zo(n,e=0){if(!(typeof window>"u"||!n))try{const t=n.getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,r=vm(),i=t.top+o-r-e;window.scrollTo({top:Math.max(0,i),behavior:"smooth"})}catch(t){console.warn("Failed to scroll to element:",t);try{const o=n.getBoundingClientRect(),r=window.pageYOffset||document.documentElement.scrollTop,i=o.top+r-20;window.scrollTo({top:Math.max(0,i),behavior:"smooth"})}catch(o){console.error("Scroll fallback also failed:",o)}}}const{entries:wc,setPrototypeOf:Sc,isFrozen:zm,getPrototypeOf:Mm,getOwnPropertyDescriptor:Am}=Object;let{freeze:xt,seal:Pt,create:Ws}=Object,{apply:qs,construct:Gs}=typeof Reflect<"u"&&Reflect;xt||(xt=function(e){return e}),Pt||(Pt=function(e){return e}),qs||(qs=function(e,t){for(var o=arguments.length,r=new Array(o>2?o-2:0),i=2;i<o;i++)r[i-2]=arguments[i];return e.apply(t,r)}),Gs||(Gs=function(e){for(var t=arguments.length,o=new Array(t>1?t-1:0),r=1;r<t;r++)o[r-1]=arguments[r];return new e(...o)});const Xr=Et(Array.prototype.forEach),Im=Et(Array.prototype.lastIndexOf),Cc=Et(Array.prototype.pop),er=Et(Array.prototype.push),_m=Et(Array.prototype.splice),Yr=Et(String.prototype.toLowerCase),Ks=Et(String.prototype.toString),Js=Et(String.prototype.match),tr=Et(String.prototype.replace),Om=Et(String.prototype.indexOf),Dm=Et(String.prototype.trim),Kt=Et(Object.prototype.hasOwnProperty),kt=Et(RegExp.prototype.test),nr=Rm(TypeError);function Et(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,o=new Array(t>1?t-1:0),r=1;r<t;r++)o[r-1]=arguments[r];return qs(n,e,o)}}function Rm(n){return function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return Gs(n,t)}}function Oe(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Yr;Sc&&Sc(n,null);let o=e.length;for(;o--;){let r=e[o];if(typeof r=="string"){const i=t(r);i!==r&&(zm(e)||(e[o]=i),r=i)}n[r]=!0}return n}function Pm(n){for(let e=0;e<n.length;e++)Kt(n,e)||(n[e]=null);return n}function nn(n){const e=Ws(null);for(const[t,o]of wc(n))Kt(n,t)&&(Array.isArray(o)?e[t]=Pm(o):o&&typeof o=="object"&&o.constructor===Object?e[t]=nn(o):e[t]=o);return e}function or(n,e){for(;n!==null;){const o=Am(n,e);if(o){if(o.get)return Et(o.get);if(typeof o.value=="function")return Et(o.value)}n=Mm(n)}function t(){return null}return t}const Nc=xt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Xs=xt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ys=xt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Lm=xt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Qs=xt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),$m=xt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Tc=xt(["#text"]),vc=xt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Zs=xt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),zc=xt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Qr=xt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Vm=Pt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Bm=Pt(/<%[\w\W]*|[\w\W]*%>/gm),Fm=Pt(/\$\{[\w\W]*/gm),jm=Pt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Hm=Pt(/^aria-[\-\w]+$/),Mc=Pt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Um=Pt(/^(?:\w+script|data):/i),Wm=Pt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ac=Pt(/^html$/i),qm=Pt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ic=Object.freeze({__proto__:null,ARIA_ATTR:Hm,ATTR_WHITESPACE:Wm,CUSTOM_ELEMENT:qm,DATA_ATTR:jm,DOCTYPE_NAME:Ac,ERB_EXPR:Bm,IS_ALLOWED_URI:Mc,IS_SCRIPT_OR_DATA:Um,MUSTACHE_EXPR:Vm,TMPLIT_EXPR:Fm});const rr={element:1,text:3,progressingInstruction:7,comment:8,document:9},Gm=function(){return typeof window>"u"?null:window},Km=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let o=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(o=t.getAttribute(r));const i="dompurify"+(o?"#"+o:"");try{return e.createPolicy(i,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},_c=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Oc(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Gm();const e=Ee=>Oc(Ee);if(e.version="3.3.1",e.removed=[],!n||!n.document||n.document.nodeType!==rr.document||!n.Element)return e.isSupported=!1,e;let{document:t}=n;const o=t,r=o.currentScript,{DocumentFragment:i,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:h}=n,m=c.prototype,y=or(m,"cloneNode"),g=or(m,"remove"),x=or(m,"nextSibling"),M=or(m,"childNodes"),E=or(m,"parentNode");if(typeof s=="function"){const Ee=t.createElement("template");Ee.content&&Ee.content.ownerDocument&&(t=Ee.content.ownerDocument)}let v,_="";const{implementation:A,createNodeIterator:b,createDocumentFragment:k,getElementsByTagName:w}=t,{importNode:O}=o;let q=_c();e.isSupported=typeof wc=="function"&&typeof E=="function"&&A&&A.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:T,ERB_EXPR:R,TMPLIT_EXPR:H,DATA_ATTR:F,ARIA_ATTR:L,IS_SCRIPT_OR_DATA:B,ATTR_WHITESPACE:te,CUSTOM_ELEMENT:K}=Ic;let{IS_ALLOWED_URI:ae}=Ic,Q=null;const Z=Oe({},[...Nc,...Xs,...Ys,...Qs,...Tc]);let Y=null;const J=Oe({},[...vc,...Zs,...zc,...Qr]);let ee=Object.seal(Ws(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),de=null,we=null;const Ne=Object.seal(Ws(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Pe=!0,C=!0,P=!1,V=!0,S=!1,N=!0,$=!1,ne=!1,me=!1,De=!1,Te=!1,z=!1,I=!0,G=!1;const pe="user-content-";let Ae=!0,ye=!1,U={},X=null;const ze=Oe({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ve=null;const j=Oe({},["audio","video","img","source","image","track"]);let W=null;const re=Oe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ce="http://www.w3.org/1998/Math/MathML",ve="http://www.w3.org/2000/svg",He="http://www.w3.org/1999/xhtml";let yt=He,fn=!1,qr=null;const ac=Oe({},[ce,ve,He],Ks);let Wo=Oe({},["mi","mo","mn","ms","mtext"]),qo=Oe({},["annotation-xml"]);const lc=Oe({},["title","style","font","a","script"]);let Mn=null;const Gr=["application/xhtml+xml","text/html"],An="text/html";let Qe=null,pn=null;const Ps=t.createElement("form"),Ls=function(D){return D instanceof RegExp||D instanceof Function},Go=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(pn&&pn===D)){if((!D||typeof D!="object")&&(D={}),D=nn(D),Mn=Gr.indexOf(D.PARSER_MEDIA_TYPE)===-1?An:D.PARSER_MEDIA_TYPE,Qe=Mn==="application/xhtml+xml"?Ks:Yr,Q=Kt(D,"ALLOWED_TAGS")?Oe({},D.ALLOWED_TAGS,Qe):Z,Y=Kt(D,"ALLOWED_ATTR")?Oe({},D.ALLOWED_ATTR,Qe):J,qr=Kt(D,"ALLOWED_NAMESPACES")?Oe({},D.ALLOWED_NAMESPACES,Ks):ac,W=Kt(D,"ADD_URI_SAFE_ATTR")?Oe(nn(re),D.ADD_URI_SAFE_ATTR,Qe):re,Ve=Kt(D,"ADD_DATA_URI_TAGS")?Oe(nn(j),D.ADD_DATA_URI_TAGS,Qe):j,X=Kt(D,"FORBID_CONTENTS")?Oe({},D.FORBID_CONTENTS,Qe):ze,de=Kt(D,"FORBID_TAGS")?Oe({},D.FORBID_TAGS,Qe):nn({}),we=Kt(D,"FORBID_ATTR")?Oe({},D.FORBID_ATTR,Qe):nn({}),U=Kt(D,"USE_PROFILES")?D.USE_PROFILES:!1,Pe=D.ALLOW_ARIA_ATTR!==!1,C=D.ALLOW_DATA_ATTR!==!1,P=D.ALLOW_UNKNOWN_PROTOCOLS||!1,V=D.ALLOW_SELF_CLOSE_IN_ATTR!==!1,S=D.SAFE_FOR_TEMPLATES||!1,N=D.SAFE_FOR_XML!==!1,$=D.WHOLE_DOCUMENT||!1,De=D.RETURN_DOM||!1,Te=D.RETURN_DOM_FRAGMENT||!1,z=D.RETURN_TRUSTED_TYPE||!1,me=D.FORCE_BODY||!1,I=D.SANITIZE_DOM!==!1,G=D.SANITIZE_NAMED_PROPS||!1,Ae=D.KEEP_CONTENT!==!1,ye=D.IN_PLACE||!1,ae=D.ALLOWED_URI_REGEXP||Mc,yt=D.NAMESPACE||He,Wo=D.MATHML_TEXT_INTEGRATION_POINTS||Wo,qo=D.HTML_INTEGRATION_POINTS||qo,ee=D.CUSTOM_ELEMENT_HANDLING||{},D.CUSTOM_ELEMENT_HANDLING&&Ls(D.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ee.tagNameCheck=D.CUSTOM_ELEMENT_HANDLING.tagNameCheck),D.CUSTOM_ELEMENT_HANDLING&&Ls(D.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ee.attributeNameCheck=D.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),D.CUSTOM_ELEMENT_HANDLING&&typeof D.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ee.allowCustomizedBuiltInElements=D.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),S&&(C=!1),Te&&(De=!0),U&&(Q=Oe({},Tc),Y=[],U.html===!0&&(Oe(Q,Nc),Oe(Y,vc)),U.svg===!0&&(Oe(Q,Xs),Oe(Y,Zs),Oe(Y,Qr)),U.svgFilters===!0&&(Oe(Q,Ys),Oe(Y,Zs),Oe(Y,Qr)),U.mathMl===!0&&(Oe(Q,Qs),Oe(Y,zc),Oe(Y,Qr))),D.ADD_TAGS&&(typeof D.ADD_TAGS=="function"?Ne.tagCheck=D.ADD_TAGS:(Q===Z&&(Q=nn(Q)),Oe(Q,D.ADD_TAGS,Qe))),D.ADD_ATTR&&(typeof D.ADD_ATTR=="function"?Ne.attributeCheck=D.ADD_ATTR:(Y===J&&(Y=nn(Y)),Oe(Y,D.ADD_ATTR,Qe))),D.ADD_URI_SAFE_ATTR&&Oe(W,D.ADD_URI_SAFE_ATTR,Qe),D.FORBID_CONTENTS&&(X===ze&&(X=nn(X)),Oe(X,D.FORBID_CONTENTS,Qe)),D.ADD_FORBID_CONTENTS&&(X===ze&&(X=nn(X)),Oe(X,D.ADD_FORBID_CONTENTS,Qe)),Ae&&(Q["#text"]=!0),$&&Oe(Q,["html","head","body"]),Q.table&&(Oe(Q,["tbody"]),delete de.tbody),D.TRUSTED_TYPES_POLICY){if(typeof D.TRUSTED_TYPES_POLICY.createHTML!="function")throw nr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof D.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw nr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=D.TRUSTED_TYPES_POLICY,_=v.createHTML("")}else v===void 0&&(v=Km(h,r)),v!==null&&typeof _=="string"&&(_=v.createHTML(""));xt&&xt(D),pn=D}},$s=Oe({},[...Xs,...Ys,...Lm]),Vs=Oe({},[...Qs,...$m]),Bs=function(D){let se=E(D);(!se||!se.tagName)&&(se={namespaceURI:yt,tagName:"template"});const ge=Yr(D.tagName),Ge=Yr(se.tagName);return qr[D.namespaceURI]?D.namespaceURI===ve?se.namespaceURI===He?ge==="svg":se.namespaceURI===ce?ge==="svg"&&(Ge==="annotation-xml"||Wo[Ge]):!!$s[ge]:D.namespaceURI===ce?se.namespaceURI===He?ge==="math":se.namespaceURI===ve?ge==="math"&&qo[Ge]:!!Vs[ge]:D.namespaceURI===He?se.namespaceURI===ve&&!qo[Ge]||se.namespaceURI===ce&&!Wo[Ge]?!1:!Vs[ge]&&(lc[ge]||!$s[ge]):!!(Mn==="application/xhtml+xml"&&qr[D.namespaceURI]):!1},qt=function(D){er(e.removed,{element:D});try{E(D).removeChild(D)}catch{g(D)}},hn=function(D,se){try{er(e.removed,{attribute:se.getAttributeNode(D),from:se})}catch{er(e.removed,{attribute:null,from:se})}if(se.removeAttribute(D),D==="is")if(De||Te)try{qt(se)}catch{}else try{se.setAttribute(D,"")}catch{}},Fs=function(D){let se=null,ge=null;if(me)D="<remove></remove>"+D;else{const nt=Js(D,/^[\r\n\t ]+/);ge=nt&&nt[0]}Mn==="application/xhtml+xml"&&yt===He&&(D='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+D+"</body></html>");const Ge=v?v.createHTML(D):D;if(yt===He)try{se=new p().parseFromString(Ge,Mn)}catch{}if(!se||!se.documentElement){se=A.createDocument(yt,"template",null);try{se.documentElement.innerHTML=fn?_:Ge}catch{}}const bt=se.body||se.documentElement;return D&&ge&&bt.insertBefore(t.createTextNode(ge),bt.childNodes[0]||null),yt===He?w.call(se,$?"html":"body")[0]:$?se.documentElement:bt},Kr=function(D){return b.call(D.ownerDocument||D,D,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},le=function(D){return D instanceof f&&(typeof D.nodeName!="string"||typeof D.textContent!="string"||typeof D.removeChild!="function"||!(D.attributes instanceof u)||typeof D.removeAttribute!="function"||typeof D.setAttribute!="function"||typeof D.namespaceURI!="string"||typeof D.insertBefore!="function"||typeof D.hasChildNodes!="function")},ue=function(D){return typeof l=="function"&&D instanceof l};function be(Ee,D,se){Xr(Ee,ge=>{ge.call(e,D,se,pn)})}const qe=function(D){let se=null;if(be(q.beforeSanitizeElements,D,null),le(D))return qt(D),!0;const ge=Qe(D.nodeName);if(be(q.uponSanitizeElement,D,{tagName:ge,allowedTags:Q}),N&&D.hasChildNodes()&&!ue(D.firstElementChild)&&kt(/<[/\w!]/g,D.innerHTML)&&kt(/<[/\w!]/g,D.textContent)||D.nodeType===rr.progressingInstruction||N&&D.nodeType===rr.comment&&kt(/<[/\w]/g,D.data))return qt(D),!0;if(!(Ne.tagCheck instanceof Function&&Ne.tagCheck(ge))&&(!Q[ge]||de[ge])){if(!de[ge]&&vt(ge)&&(ee.tagNameCheck instanceof RegExp&&kt(ee.tagNameCheck,ge)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(ge)))return!1;if(Ae&&!X[ge]){const Ge=E(D)||D.parentNode,bt=M(D)||D.childNodes;if(bt&&Ge){const nt=bt.length;for(let Ot=nt-1;Ot>=0;--Ot){const In=y(bt[Ot],!0);In.__removalCount=(D.__removalCount||0)+1,Ge.insertBefore(In,x(D))}}}return qt(D),!0}return D instanceof c&&!Bs(D)||(ge==="noscript"||ge==="noembed"||ge==="noframes")&&kt(/<\/no(script|embed|frames)/i,D.innerHTML)?(qt(D),!0):(S&&D.nodeType===rr.text&&(se=D.textContent,Xr([T,R,H],Ge=>{se=tr(se,Ge," ")}),D.textContent!==se&&(er(e.removed,{element:D.cloneNode()}),D.textContent=se)),be(q.afterSanitizeElements,D,null),!1)},Ze=function(D,se,ge){if(I&&(se==="id"||se==="name")&&(ge in t||ge in Ps))return!1;if(!(C&&!we[se]&&kt(F,se))){if(!(Pe&&kt(L,se))){if(!(Ne.attributeCheck instanceof Function&&Ne.attributeCheck(se,D))){if(!Y[se]||we[se]){if(!(vt(D)&&(ee.tagNameCheck instanceof RegExp&&kt(ee.tagNameCheck,D)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(D))&&(ee.attributeNameCheck instanceof RegExp&&kt(ee.attributeNameCheck,se)||ee.attributeNameCheck instanceof Function&&ee.attributeNameCheck(se,D))||se==="is"&&ee.allowCustomizedBuiltInElements&&(ee.tagNameCheck instanceof RegExp&&kt(ee.tagNameCheck,ge)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(ge))))return!1}else if(!W[se]){if(!kt(ae,tr(ge,te,""))){if(!((se==="src"||se==="xlink:href"||se==="href")&&D!=="script"&&Om(ge,"data:")===0&&Ve[D])){if(!(P&&!kt(B,tr(ge,te,"")))){if(ge)return!1}}}}}}}return!0},vt=function(D){return D!=="annotation-xml"&&Js(D,K)},tm=function(D){be(q.beforeSanitizeAttributes,D,null);const{attributes:se}=D;if(!se||le(D))return;const ge={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let Ge=se.length;for(;Ge--;){const bt=se[Ge],{name:nt,namespaceURI:Ot,value:In}=bt,Ko=Qe(nt),cc=In;let ht=nt==="value"?cc:Dm(cc);if(ge.attrName=Ko,ge.attrValue=ht,ge.keepAttr=!0,ge.forceKeepAttr=void 0,be(q.uponSanitizeAttribute,D,ge),ht=ge.attrValue,G&&(Ko==="id"||Ko==="name")&&(hn(nt,D),ht=pe+ht),N&&kt(/((--!?|])>)|<\/(style|title|textarea)/i,ht)){hn(nt,D);continue}if(Ko==="attributename"&&Js(ht,"href")){hn(nt,D);continue}if(ge.forceKeepAttr)continue;if(!ge.keepAttr){hn(nt,D);continue}if(!V&&kt(/\/>/i,ht)){hn(nt,D);continue}S&&Xr([T,R,H],om=>{ht=tr(ht,om," ")});const nm=Qe(D.nodeName);if(!Ze(nm,Ko,ht)){hn(nt,D);continue}if(v&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Ot)switch(h.getAttributeType(nm,Ko)){case"TrustedHTML":{ht=v.createHTML(ht);break}case"TrustedScriptURL":{ht=v.createScriptURL(ht);break}}if(ht!==cc)try{Ot?D.setAttributeNS(Ot,nt,ht):D.setAttribute(nt,ht),le(D)?qt(D):Cc(e.removed)}catch{hn(nt,D)}}be(q.afterSanitizeAttributes,D,null)},oA=function Ee(D){let se=null;const ge=Kr(D);for(be(q.beforeSanitizeShadowDOM,D,null);se=ge.nextNode();)be(q.uponSanitizeShadowNode,se,null),qe(se),tm(se),se.content instanceof i&&Ee(se.content);be(q.afterSanitizeShadowDOM,D,null)};return e.sanitize=function(Ee){let D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},se=null,ge=null,Ge=null,bt=null;if(fn=!Ee,fn&&(Ee="<!-->"),typeof Ee!="string"&&!ue(Ee))if(typeof Ee.toString=="function"){if(Ee=Ee.toString(),typeof Ee!="string")throw nr("dirty is not a string, aborting")}else throw nr("toString is not a function");if(!e.isSupported)return Ee;if(ne||Go(D),e.removed=[],typeof Ee=="string"&&(ye=!1),ye){if(Ee.nodeName){const In=Qe(Ee.nodeName);if(!Q[In]||de[In])throw nr("root node is forbidden and cannot be sanitized in-place")}}else if(Ee instanceof l)se=Fs("<!---->"),ge=se.ownerDocument.importNode(Ee,!0),ge.nodeType===rr.element&&ge.nodeName==="BODY"||ge.nodeName==="HTML"?se=ge:se.appendChild(ge);else{if(!De&&!S&&!$&&Ee.indexOf("<")===-1)return v&&z?v.createHTML(Ee):Ee;if(se=Fs(Ee),!se)return De?null:z?_:""}se&&me&&qt(se.firstChild);const nt=Kr(ye?Ee:se);for(;Ge=nt.nextNode();)qe(Ge),tm(Ge),Ge.content instanceof i&&oA(Ge.content);if(ye)return Ee;if(De){if(Te)for(bt=k.call(se.ownerDocument);se.firstChild;)bt.appendChild(se.firstChild);else bt=se;return(Y.shadowroot||Y.shadowrootmode)&&(bt=O.call(o,bt,!0)),bt}let Ot=$?se.outerHTML:se.innerHTML;return $&&Q["!doctype"]&&se.ownerDocument&&se.ownerDocument.doctype&&se.ownerDocument.doctype.name&&kt(Ac,se.ownerDocument.doctype.name)&&(Ot="<!DOCTYPE "+se.ownerDocument.doctype.name+`>
338
+ `+Ot),S&&Xr([T,R,H],In=>{Ot=tr(Ot,In," ")}),v&&z?v.createHTML(Ot):Ot},e.setConfig=function(){let Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Go(Ee),ne=!0},e.clearConfig=function(){pn=null,ne=!1},e.isValidAttribute=function(Ee,D,se){pn||Go({});const ge=Qe(Ee),Ge=Qe(D);return Ze(ge,Ge,se)},e.addHook=function(Ee,D){typeof D=="function"&&er(q[Ee],D)},e.removeHook=function(Ee,D){if(D!==void 0){const se=Im(q[Ee],D);return se===-1?void 0:_m(q[Ee],se,1)[0]}return Cc(q[Ee])},e.removeHooks=function(Ee){q[Ee]=[]},e.removeAllHooks=function(){q=_c()},e}var Jm=Oc();function Dc(n){return Jm.sanitize(n,{ALLOWED_TAGS:["p","br","strong","em","s","u","ul","ol","li","a","hr"],ALLOWED_ATTR:["href","target","rel"],ALLOW_DATA_ATTR:!1,FORBID_TAGS:["script","iframe","object","embed","form","input","button","style"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur"]})}function ot(n){return typeof n!="string"?"":n.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function wt(n){if(!n||typeof n!="string")return"";const e=n.trim(),t=e.toLowerCase();return t.startsWith("javascript:")||t.startsWith("vbscript:")||t.startsWith("file:")?"":t.startsWith("data:")?t.startsWith("data:image/")?e:"":e}const he={TEXT_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):([^}]+)\}/g,TEXT_FIELD:/\{\$(\w+):([^}]+)\}/g,RICH_TEXT_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):rich(?::[^}]+)?\}/g,RICH_TEXT_FIELD:/\{\$(\w+):(.+?):rich(?::[^}]+)?\}/g,TEXTAREA_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):textarea(?::[^}]+)?\}/g,TEXTAREA_FIELD:/\{\$(\w+):(.+?):textarea(?::[^}]+)?\}/g,IMAGE_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):image(?::[^}]+)?\}/g,IMAGE_FIELD:/\{\$(\w+):(.+?):image(?::[^}]+)?\}/g,SELECT_FIELD_WITH_GROUP:/\(\$(\w+)\.(\w+)@:([^)]+)\)/g,SELECT_FIELD:/\(\$(\w+)@:([^)]+)\)/g,RADIO_CHECKBOX_FIELD_WITH_GROUP:/\(\$(\w+)\.(\w+):([^)]+)\)/g,RADIO_FIELD:/\(\$(\w+):([^)]+)\)/g,BACKEND_DATA:/\{@([\w.[\]]+)\}/g};function Xm(n){const e={};for(const t of n){if(t==="required"){e.required=!0;continue}if(t==="readonly"){e.readonly=!0;continue}if(t==="disabled"){e.disabled=!0;continue}if(t.startsWith("max=")){const o=Number(t.slice(4));Number.isFinite(o)&&(e.maxLength=o)}}return e}function Me(n){const e=n.split(":"),t=[],o=r=>r==="required"||r==="readonly"||r==="disabled"||/^max=\d+$/.test(r);for(;e.length>0&&o(e[e.length-1]);)t.unshift(e.pop());return{defaultValue:e.join(":"),validation:Xm(t)}}function Dn(n){const e=[],t=new Set,o=Us(),s=new o().parseFromString(`<template>${n}</template>`,"text/html").querySelector("template");if(!s)return e;const l=d=>{if(d.nodeType===Node.TEXT_NODE){const u=d.textContent||"",f=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(f)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]){const N=S[1],$=S[2];if(!t.has(N)){const{defaultValue:ne,validation:me}=Me(S[3]);e.push({fieldName:N,groupName:$,type:"rich",defaultValue:ne,optional:!0,...me}),t.add(N)}}});const h=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(h)).forEach(S=>{if(S&&S[1]&&S[2]){const N=S[1];if(!t.has(N)){const{defaultValue:$,validation:ne}=Me(S[2]);e.push({fieldName:N,type:"rich",defaultValue:$,optional:!0,...ne}),t.add(N)}}});const y=new RegExp(he.RICH_TEXT_FIELD_WITH_GROUP.source,he.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(y)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]){const N=S[1],$=S[2];if(!t.has(N)){const{defaultValue:ne,validation:me}=Me(S[3]);e.push({fieldName:N,groupName:$,type:"rich",defaultValue:ne,...me}),t.add(N)}}});const x=new RegExp(he.RICH_TEXT_FIELD.source,he.RICH_TEXT_FIELD.flags);Array.from(u.matchAll(x)).forEach(S=>{if(S&&S[1]&&S[2]){const N=S[1];if(!t.has(N)){const{defaultValue:$,validation:ne}=Me(S[2]);e.push({fieldName:N,type:"rich",defaultValue:$,...ne}),t.add(N)}}});const E=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(E)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:N,validation:$}=Me(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"textarea",defaultValue:N,optional:!0,...$}),t.add(S[1])}});const _=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(_)).forEach(S=>{if(S&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:N,validation:$}=Me(S[2]);e.push({fieldName:S[1],type:"textarea",defaultValue:N,optional:!0,...$}),t.add(S[1])}});const b=new RegExp(he.TEXTAREA_FIELD_WITH_GROUP.source,he.TEXTAREA_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(b)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:N,validation:$}=Me(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"textarea",defaultValue:N,...$}),t.add(S[1])}});const w=new RegExp(he.TEXTAREA_FIELD.source,he.TEXTAREA_FIELD.flags);Array.from(u.matchAll(w)).forEach(S=>{if(S&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:N,validation:$}=Me(S[2]);e.push({fieldName:S[1],type:"textarea",defaultValue:N,...$}),t.add(S[1])}});const q=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(q)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:N,validation:$}=Me(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"image",defaultValue:N,optional:!0,...$}),t.add(S[1])}});const R=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(R)).forEach(S=>{if(S&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:N,validation:$}=Me(S[2]);e.push({fieldName:S[1],type:"image",defaultValue:N,optional:!0,...$}),t.add(S[1])}});const F=new RegExp(he.IMAGE_FIELD_WITH_GROUP.source,he.IMAGE_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(F)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:N,validation:$}=Me(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"image",defaultValue:N,...$}),t.add(S[1])}});const B=new RegExp(he.IMAGE_FIELD.source,he.IMAGE_FIELD.flags);Array.from(u.matchAll(B)).forEach(S=>{if(S&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:N,validation:$}=Me(S[2]);e.push({fieldName:S[1],type:"image",defaultValue:N,...$}),t.add(S[1])}});const K=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(K)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:N,validation:$}=Me(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"text",defaultValue:N,optional:!0,...$}),t.add(S[1])}});const Q=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(Q)).forEach(S=>{if(S&&S[0]&&!/:rich(?::[^}]*)?\}$/.test(S[0])&&!/:image(?::[^}]*)?\}$/.test(S[0])&&!/:textarea(?::[^}]*)?\}$/.test(S[0])&&!S[0].includes(".")&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:N,validation:$}=Me(S[2]);e.push({fieldName:S[1],type:"text",defaultValue:N,optional:!0,...$}),t.add(S[1])}});const Y=new RegExp(he.TEXT_FIELD_WITH_GROUP.source,he.TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(Y)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:N,validation:$}=Me(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"text",defaultValue:N,...$}),t.add(S[1])}});const ee=new RegExp(he.TEXT_FIELD.source,he.TEXT_FIELD.flags);Array.from(u.matchAll(ee)).forEach(S=>{if(S&&S[0]&&!/:rich(?::[^}]*)?\}$/.test(S[0])&&!/:image(?::[^}]*)?\}$/.test(S[0])&&!/:textarea(?::[^}]*)?\}$/.test(S[0])&&!S[0].includes(".")&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:N,validation:$}=Me(S[2]);e.push({fieldName:S[1],type:"text",defaultValue:N,...$}),t.add(S[1])}});const we=new RegExp(he.SELECT_FIELD_WITH_GROUP.source,he.SELECT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(we)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const N=S[1],$=S[2],ne=S[3];ne.includes("|")?e.push({fieldName:N,groupName:$,type:"select",options:ne.split("|")}):ne.includes(",")&&e.push({fieldName:N,groupName:$,type:"select-multiple",options:ne.split(",")}),t.add(N)}}),(u.match(he.SELECT_FIELD)||[]).forEach(S=>{const N=S.match(/\(\$(\w+)@:([^)]+)\)/);if(N&&!t.has(N[1])){const $=N[1],ne=N[2];ne.includes("|")?e.push({fieldName:$,type:"select",options:ne.split("|")}):ne.includes(",")&&e.push({fieldName:$,type:"select-multiple",options:ne.split(",")}),t.add($)}});const C=new RegExp(he.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,he.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(C)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const N=S[1],$=S[2],ne=S[3];ne.includes("|")?e.push({fieldName:N,groupName:$,type:"radio",options:ne.split("|")}):ne.includes(",")&&e.push({fieldName:N,groupName:$,type:"checkbox",options:ne.split(",")}),t.add(N)}}),(u.match(he.RADIO_FIELD)||[]).forEach(S=>{const N=S.match(/\(\$(\w+):([^)]+)\)/);if(N&&!t.has(N[1])){const $=N[1],ne=N[2];ne.includes("|")?e.push({fieldName:$,type:"radio",options:ne.split("|")}):ne.includes(",")&&e.push({fieldName:$,type:"checkbox",options:ne.split(",")}),t.add($)}});return}else if(d.nodeType===Node.ELEMENT_NODE){const u=d,f=u.getAttribute("z-if");f&&!t.has(f)&&(e.push({fieldName:f,type:"boolean",defaultValue:"true"}),t.add(f));const p=u.getAttribute("z-tag");if(p){const m=p.match(/^\$(\w+)(?::(.+))?$/);if(m){const y=m[1],g=m[2];if(!t.has(y)){const x=g?g.split("|").map(v=>v.trim()):void 0,M=u.tagName.toLowerCase();let E=M;x&&!x.includes(M)&&(E=x[0]),e.push({fieldName:y,type:"tag",defaultValue:E,options:x,optional:!1}),t.add(y)}}}Array.from(u.attributes).forEach(m=>{const y=m.value,g=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(y.matchAll(g)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:P,validation:V}=Me(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"rich",defaultValue:P,optional:!0,...V}),t.add(C[1])}});const M=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(y.matchAll(M)).forEach(C=>{if(C&&C[1]&&C[2]&&!t.has(C[1])){const{defaultValue:P,validation:V}=Me(C[2]);e.push({fieldName:C[1],type:"rich",defaultValue:P,optional:!0,...V}),t.add(C[1])}});const v=new RegExp(he.RICH_TEXT_FIELD_WITH_GROUP.source,he.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(y.matchAll(v)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:P,validation:V}=Me(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"rich",defaultValue:P,...V}),t.add(C[1])}});const A=new RegExp(he.RICH_TEXT_FIELD.source,he.RICH_TEXT_FIELD.flags);Array.from(y.matchAll(A)).forEach(C=>{if(C&&C[1]&&C[2]&&!t.has(C[1])){const{defaultValue:P,validation:V}=Me(C[2]);e.push({fieldName:C[1],type:"rich",defaultValue:P,...V}),t.add(C[1])}});const k=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(y.matchAll(k)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:P,validation:V}=Me(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"image",defaultValue:P,optional:!0,...V}),t.add(C[1])}});const O=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(y.matchAll(O)).forEach(C=>{if(C&&C[1]&&C[2]&&!t.has(C[1])){const{defaultValue:P,validation:V}=Me(C[2]);e.push({fieldName:C[1],type:"image",defaultValue:P,optional:!0,...V}),t.add(C[1])}});const T=new RegExp(he.IMAGE_FIELD_WITH_GROUP.source,he.IMAGE_FIELD_WITH_GROUP.flags);Array.from(y.matchAll(T)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:P,validation:V}=Me(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"image",defaultValue:P,...V}),t.add(C[1])}});const H=new RegExp(he.IMAGE_FIELD.source,he.IMAGE_FIELD.flags);Array.from(y.matchAll(H)).forEach(C=>{if(C&&C[1]&&C[2]&&!t.has(C[1])){const{defaultValue:P,validation:V}=Me(C[2]);e.push({fieldName:C[1],type:"image",defaultValue:P,...V}),t.add(C[1])}});const L=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(y.matchAll(L)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:P,validation:V}=Me(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"text",defaultValue:P,optional:!0,...V}),t.add(C[1])}});const te=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(y.matchAll(te)).forEach(C=>{if(C&&C[0]&&!/:rich(?::[^}]*)?\}$/.test(C[0])&&!/:image(?::[^}]*)?\}$/.test(C[0])&&!/:textarea(?::[^}]*)?\}$/.test(C[0])&&!C[0].includes(".")&&C[1]&&C[2]&&!t.has(C[1])){const{defaultValue:P,validation:V}=Me(C[2]);e.push({fieldName:C[1],type:"text",defaultValue:P,optional:!0,...V}),t.add(C[1])}});const ae=new RegExp(he.TEXT_FIELD_WITH_GROUP.source,he.TEXT_FIELD_WITH_GROUP.flags);Array.from(y.matchAll(ae)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:P,validation:V}=Me(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"text",defaultValue:P,...V}),t.add(C[1])}});const Z=new RegExp(he.TEXT_FIELD.source,he.TEXT_FIELD.flags);Array.from(y.matchAll(Z)).forEach(C=>{if(C&&C[0]&&!/:rich(?::[^}]*)?\}$/.test(C[0])&&!/:image(?::[^}]*)?\}$/.test(C[0])&&!/:textarea(?::[^}]*)?\}$/.test(C[0])&&!C[0].includes(".")&&C[1]&&C[2]&&!t.has(C[1])){const{defaultValue:P,validation:V}=Me(C[2]);e.push({fieldName:C[1],type:"text",defaultValue:P,...V}),t.add(C[1])}});const J=new RegExp(he.SELECT_FIELD_WITH_GROUP.source,he.SELECT_FIELD_WITH_GROUP.flags);Array.from(y.matchAll(J)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const P=C[1],V=C[2],S=C[3];S.includes("|")?e.push({fieldName:P,groupName:V,type:"select",options:S.split("|")}):S.includes(",")&&e.push({fieldName:P,groupName:V,type:"select-multiple",options:S.split(",")}),t.add(P)}}),(y.match(he.SELECT_FIELD)||[]).forEach(C=>{const P=C.match(/\(\$(\w+)@:([^)]+)\)/);if(P&&!t.has(P[1])){const V=P[1],S=P[2];S.includes("|")?e.push({fieldName:V,type:"select",options:S.split("|")}):S.includes(",")&&e.push({fieldName:V,type:"select-multiple",options:S.split(",")}),t.add(V)}});const we=new RegExp(he.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,he.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(y.matchAll(we)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const P=C[1],V=C[2],S=C[3];S.includes("|")?e.push({fieldName:P,groupName:V,type:"radio",options:S.split("|")}):S.includes(",")&&e.push({fieldName:P,groupName:V,type:"checkbox",options:S.split(",")}),t.add(P)}}),(y.match(he.RADIO_FIELD)||[]).forEach(C=>{const P=C.match(/\(\$(\w+):([^)]+)\)/);if(P&&!t.has(P[1])){const V=P[1],S=P[2];S.includes("|")?e.push({fieldName:V,type:"radio",options:S.split("|")}):S.includes(",")&&e.push({fieldName:V,type:"checkbox",options:S.split(",")}),t.add(V)}})}),Array.from(d.childNodes).forEach(m=>l(m));return}else if(d.nodeType===Node.DOCUMENT_FRAGMENT_NODE){Array.from(d.childNodes).forEach(f=>l(f));return}};return Array.from(s.content.childNodes).forEach(d=>l(d)),e}function Rc(n,e){const t=Us(),i=new t().parseFromString(`<template>${n}</template>`,"text/html").querySelector("template");if(!i||!i.content.firstElementChild)return console.warn("Failed to parse HTML:",n),n;const s=i.content.firstElementChild;return Object.entries(e).forEach(([l,c])=>{s.setAttribute(l,c)}),s.outerHTML}function Zr(n,e,t,o,r=[]){const i=[...t,...o,...r];if(n){const s=i.find(l=>l.id===n);if(s)return s.url}if(e){const s=i.find(l=>l.id===e);if(s)return console.warn(`Image not found: ${n}, using default: ${e}`),s.url}return console.warn(`Image not found: ${n}, default: ${e}`),""}function Ym(n){return typeof n=="object"&&n!==null}function Pc(n,e){if(!n||!e)return"";try{const t=[];let o="";for(let i=0;i<e.length;i++){const s=e[i];s==="["||s==="]"||s==="."?o&&(t.push(o),o=""):o+=s}o&&t.push(o);let r=n;for(let i=0;i<t.length;i++){const s=t[i];if(s.match(/^\d+$/)){const l=parseInt(s,10);if(Array.isArray(r)&&l>=0&&l<r.length)r=r[l];else return""}else if(Ym(r)&&s in r)r=r[s];else return""}return r==null?"":String(r)}catch(t){return console.warn(`[ZeroCode] Failed to resolve backend data path: ${e}`,t),""}}function Qm(n,e){return!n||!e?n:n.replace(/\{(\w+)\}/g,(t,o)=>{const r=e[o];return r==null?t:String(r)})}function ei(n,e,t,o,r,i=!0,s=[],l=[],c=[],d){const u=Us(),f=new u,p=f.parseFromString(`<template>${n}</template>`,"text/html"),h=p.querySelector("template");if(!h||!h.content)return console.error("Failed to parse template HTML"),n;const m=b=>{if(b.nodeType===Node.TEXT_NODE){let k=b.textContent||"";d&&(k=k.replace(he.BACKEND_DATA,(Q,Z)=>Pc(d,Z)));let O=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(k),q=!1;if(O&&b.parentNode?q=!0:O=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(k),O&&b.parentNode){const Q=O[1],Z=q?O[3]:O[2],{defaultValue:Y}=Me(Z),J=e[Q];if(typeof J=="boolean"){const P=b.parentNode,V=O.index||0,S=k.substring(0,V),N=k.substring(V+O[0].length);S&&P.insertBefore(p.createTextNode(S),b),N&&P.insertBefore(p.createTextNode(N),b),b.parentNode&&b.parentNode.removeChild(b);return}let ee=J===void 0?"":typeof J=="string"?J:String(J||Y);i||(ee=Dc(ee));const de=b.parentNode,we=O.index||0,Ne=k.substring(0,we),Pe=k.substring(we+O[0].length);ee?ee.trim().startsWith("<p")||(ee=`<p>${ee}</p>`):ee="";const C=p.createElement("div");C.innerHTML=ee,Ne&&de.insertBefore(p.createTextNode(Ne),b),Array.from(C.childNodes).forEach(P=>{de.insertBefore(P.cloneNode(!0),b)}),Pe&&de.insertBefore(p.createTextNode(Pe),b),b.parentNode&&b.parentNode.removeChild(b);return}let R=new RegExp(he.RICH_TEXT_FIELD_WITH_GROUP.source,he.RICH_TEXT_FIELD_WITH_GROUP.flags).exec(k),H=!1;if(R&&b.parentNode?H=!0:R=new RegExp(he.RICH_TEXT_FIELD.source,he.RICH_TEXT_FIELD.flags).exec(k),R&&b.parentNode){const Q=R[1],Z=H?R[3]:R[2],Y=e[Q];let J=Y===void 0?"":typeof Y=="string"?Y:String(Y||Z);i||(J=Dc(J));const ee=b.parentNode,de=R.index||0,we=k.substring(0,de),Ne=k.substring(de+R[0].length);J?J.trim().startsWith("<p")||(J=`<p>${J}</p>`):J="<p></p>";const Pe=p.createElement("div");Pe.innerHTML=J,we&&ee.insertBefore(p.createTextNode(we),b),Array.from(Pe.childNodes).forEach(C=>{ee.insertBefore(C.cloneNode(!0),b)}),Ne&&ee.insertBefore(p.createTextNode(Ne),b),b.parentNode&&b.parentNode.removeChild(b);return}let L=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(k),B=!1;if(L&&b.parentNode?B=!0:L=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(k),L&&b.parentNode){const Q=L[1],Z=B?L[3]:L[2],{defaultValue:Y}=Me(Z),J=e[Q],ee=J===void 0?"":String(J||Y),de=b.parentNode,we=L.index||0,Ne=k.substring(0,we),Pe=k.substring(we+L[0].length);Ne&&de.insertBefore(p.createTextNode(Ne),b);const C=ee.split(`
339
+ `);if(C.forEach((P,V)=>{P&&de.insertBefore(p.createTextNode(P),b),V<C.length-1&&de.insertBefore(p.createElement("br"),b)}),Pe){const P=p.createTextNode(Pe);de.insertBefore(P,b),m(P)}b.parentNode&&b.parentNode.removeChild(b);return}let K=new RegExp(he.TEXTAREA_FIELD_WITH_GROUP.source,he.TEXTAREA_FIELD_WITH_GROUP.flags).exec(k),ae=!1;if(K&&b.parentNode?ae=!0:K=new RegExp(he.TEXTAREA_FIELD.source,he.TEXTAREA_FIELD.flags).exec(k),K&&b.parentNode){const Q=K[1],Z=ae?K[3]:K[2],Y=e[Q]??Z??"",J=String(Y),ee=b.parentNode,de=K.index||0,we=k.substring(0,de),Ne=k.substring(de+K[0].length);we&&ee.insertBefore(p.createTextNode(we),b);const Pe=J.split(`
340
+ `);if(Pe.forEach((C,P)=>{C&&ee.insertBefore(p.createTextNode(C),b),P<Pe.length-1&&ee.insertBefore(p.createElement("br"),b)}),Ne){const C=p.createTextNode(Ne);ee.insertBefore(C,b),m(C)}b.parentNode&&b.parentNode.removeChild(b);return}k=k.replace(/\{\$(\w+)\?:([^}]+)\}/g,(Q,Z,Y)=>{if(/:textarea(?::[^}]*)?$/.test(Q))return Q;const J=e[Z];if(J===void 0||typeof J=="boolean")return"";const{defaultValue:ee}=Me(Y);return String(J||ee)}),k=k.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(Q,Z,Y,J)=>{if(/:textarea(?::[^}]*)?$/.test(Q))return Q;const ee=e[Z];if(ee===void 0||typeof ee=="boolean")return"";const{defaultValue:de}=Me(J);return String(ee||de)}),k=k.replace(he.TEXT_FIELD_WITH_GROUP,(Q,Z,Y,J)=>{const ee=e[Z];if(ee===void 0)return"";const{defaultValue:de}=Me(J);return String(ee||de)}),k=k.replace(he.TEXT_FIELD,(Q,Z,Y)=>{const J=e[Z];if(J===void 0)return"";const{defaultValue:ee}=Me(Y);return String(J||ee)}),b.textContent=k}else if(b.nodeType===Node.ELEMENT_NODE){const k=b,w=[];Array.from(k.attributes).forEach(O=>{const q=O.value;let T=O.value;const R=O.name.toLowerCase();if(R==="z-if"||R==="z-for"||R==="z-slot"||R==="z-empty"||R==="z-tag"||R.startsWith("data-zcode-"))return;const H=/^\{\$[\w.]+?\?:[^}]+\}(?::(rich|image|textarea))?$/.test(q.trim());d&&((R==="href"||R==="src"||R==="action")&&(T=Qm(T,d)),T=T.replace(he.BACKEND_DATA,(F,L)=>{const B=Pc(d,L);return R==="href"||R==="src"||R==="action"?wt(B):ot(B)})),T=T.replace(/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(F,L,B)=>{const te=e[L];if(te===void 0||typeof te=="boolean")return"";const{defaultValue:K}=Me(B);return ot(String(te||K))}),T=T.replace(/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(F,L,B,te)=>{const K=e[L];if(K===void 0||typeof K=="boolean")return"";const{defaultValue:ae}=Me(te);return ot(String(K||ae))}),T=T.replace(/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(F,L,B)=>{const te=e[L];if(te===void 0)return"";const{defaultValue:K}=Me(B),ae=typeof te=="string"?te:String(te||K),Q=Zr(ae,K,s,l,c),Z=typeof Q=="string"?Q:String(Q||K);return R==="href"||R==="src"?wt(Z):ot(Z)}),T=T.replace(/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(F,L,B,te)=>{const K=e[L];if(K===void 0)return"";const{defaultValue:ae}=Me(te),Q=typeof K=="string"?K:String(K||ae),Z=Zr(Q,ae,s,l,c),Y=typeof Z=="string"?Z:String(Z||ae);return R==="href"||R==="src"?wt(Y):ot(Y)}),T=T.replace(he.RICH_TEXT_FIELD_WITH_GROUP,(F,L,B,te)=>{const K=e[L];return K===void 0?"":ot(String(K||te))}),T=T.replace(he.RICH_TEXT_FIELD,(F,L,B)=>{const te=e[L];return te===void 0?"":ot(String(te||B))}),T=T.replace(he.IMAGE_FIELD_WITH_GROUP,(F,L,B,te)=>{const K=e[L];if(K===void 0)return"";const ae=Zr(K||te,te,s,l,c);return R==="href"||R==="src"?wt(ae||te):ot(ae||te)}),T=T.replace(he.IMAGE_FIELD,(F,L,B)=>{const te=e[L];if(te===void 0)return"";const K=Zr(te||B,B,s,l,c);return R==="href"||R==="src"?wt(K||B):ot(K||B)}),T=T.replace(/\{\$(\w+)\?:([^}]+)\}/g,(F,L,B)=>{const te=e[L];if(te===void 0||typeof te=="boolean")return"";const{defaultValue:K}=Me(B),ae=String(te||K);return R==="href"||R==="src"||R==="action"?wt(ae):ot(ae)}),T=T.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(F,L,B,te)=>{const K=e[L];if(K===void 0||typeof K=="boolean")return"";const{defaultValue:ae}=Me(te),Q=String(K||ae);return R==="href"||R==="src"||R==="action"?wt(Q):ot(Q)}),T=T.replace(he.TEXT_FIELD_WITH_GROUP,(F,L,B,te)=>{const K=e[L];if(K===void 0)return"";const{defaultValue:ae}=Me(te),Q=String(K||ae);return R==="href"||R==="src"||R==="action"?wt(Q):ot(Q)}),T=T.replace(he.TEXT_FIELD,(F,L,B)=>{const te=e[L];if(te===void 0)return"";const{defaultValue:K}=Me(B),ae=String(te||K);return R==="href"||R==="src"||R==="action"?wt(ae):ot(ae)}),H&&T.trim()===""?w.push(O.name):O.value=T}),w.forEach(O=>{k.removeAttribute(O)})}Array.from(b.childNodes).forEach(k=>m(k))};m(h.content);const y=b=>{if(b.nodeType===Node.TEXT_NODE){let k=b.textContent||"";k=k.replace(he.SELECT_FIELD_WITH_GROUP,(w,O,q,T)=>{if(T.includes("|"))return e[O]||T.split("|")[0];if(T.includes(",")){const R=e[O],H=Array.isArray(R)?R:[],F=T.split(",");return H.filter(L=>typeof L=="string"&&F.includes(L)).join(" ")}return e[O]||T}),k=k.replace(he.SELECT_FIELD,(w,O,q)=>{if(q.includes("|")){const R=e[O];return typeof R=="string"?R:q.split("|")[0]}else if(q.includes(",")){const R=e[O],H=Array.isArray(R)?R:[],F=q.split(",");return H.filter(L=>typeof L=="string"&&F.includes(L)).join(" ")}const T=e[O];return typeof T=="string"?T:q}),k=k.replace(he.RADIO_CHECKBOX_FIELD_WITH_GROUP,(w,O,q,T)=>{if(T.includes("|")){const H=e[O];return typeof H=="string"?H:T.split("|")[0]}else if(T.includes(",")){const H=e[O],F=Array.isArray(H)?H:[],L=T.split(",");return F.filter(B=>typeof B=="string"&&L.includes(B)).join(" ")}const R=e[O];return typeof R=="string"?R:T}),k=k.replace(he.RADIO_FIELD,(w,O,q)=>{if(q.includes("|")){const R=e[O];return typeof R=="string"?R:q.split("|")[0]}else if(q.includes(",")){const R=e[O],H=Array.isArray(R)?R:[],F=q.split(",");return H.filter(L=>typeof L=="string"&&F.includes(L)).join(" ")}const T=e[O];return typeof T=="string"?T:q}),b.textContent=k}else b.nodeType===Node.ELEMENT_NODE&&Array.from(b.attributes).forEach(w=>{let O=w.value;const q=w.name.toLowerCase();O=O.replace(he.SELECT_FIELD_WITH_GROUP,(T,R,H,F)=>{let L;if(F.includes("|"))L=e[R]||F.split("|")[0];else if(F.includes(",")){const B=e[R],te=Array.isArray(B)?B:[],K=F.split(",");L=te.filter(ae=>typeof ae=="string"&&K.includes(ae)).join(" ")}else{const B=e[R];L=typeof B=="string"?B:F}return q==="href"||q==="src"||q==="action"?wt(String(L)):ot(String(L))}),O=O.replace(he.SELECT_FIELD,(T,R,H)=>{let F;if(H.includes("|"))F=e[R]||H.split("|")[0];else if(H.includes(",")){const L=e[R],B=Array.isArray(L)?L:[],te=H.split(",");F=B.filter(K=>typeof K=="string"&&te.includes(K)).join(" ")}else{const L=e[R];F=typeof L=="string"?L:H}return q==="href"||q==="src"||q==="action"?wt(String(F)):ot(String(F))}),O=O.replace(he.RADIO_CHECKBOX_FIELD_WITH_GROUP,(T,R,H,F)=>{let L;if(F.includes("|"))L=e[R]||F.split("|")[0];else if(F.includes(",")){const B=e[R],te=Array.isArray(B)?B:[],K=F.split(",");L=te.filter(ae=>typeof ae=="string"&&K.includes(ae)).join(" ")}else{const B=e[R];L=typeof B=="string"?B:F}return q==="href"||q==="src"||q==="action"?wt(String(L)):ot(String(L))}),O=O.replace(he.RADIO_FIELD,(T,R,H)=>{let F;if(H.includes("|"))F=e[R]||H.split("|")[0];else if(H.includes(",")){const L=e[R],B=Array.isArray(L)?L:[],te=H.split(",");F=B.filter(K=>typeof K=="string"&&te.includes(K)).join(" ")}else{const L=e[R];F=typeof L=="string"?L:H}return q==="href"||q==="src"||q==="action"?wt(String(F)):ot(String(F))}),w.value=O});b.childNodes.forEach(k=>y(k))};y(h.content),h.content.querySelectorAll("[z-if]").forEach(b=>{const k=b.getAttribute("z-if");k?(e[k]!==void 0?e[k]:!0)?b.removeAttribute("z-if"):b.remove():b.removeAttribute("z-if")}),h.content.querySelectorAll("[z-tag]").forEach(b=>{const k=b.getAttribute("z-tag");if(k){const w=k.match(/^\$(\w+)(?::(.+))?$/);if(w){const O=w[1],q=e[O],T=typeof q=="string"?q:b.tagName.toLowerCase(),R=["h1","h2","h3","h4","h5","h6","div","p","span","li","ul","ol","section","article","aside","nav","header","footer","main","figure","figcaption","blockquote","pre","code","table","thead","tbody","tr","th","td"],H=typeof T=="string"?T.toLowerCase():T;if(typeof H=="string"&&R.includes(H)){const F=p.createElement(H);Array.from(b.attributes).forEach(L=>{L.name!=="z-tag"&&F.setAttribute(L.name,L.value)}),Array.from(b.childNodes).forEach(L=>{F.appendChild(L.cloneNode(!0))}),b.parentNode?.replaceChild(F,b)}}}}),h.content.querySelectorAll("[z-empty]").forEach(b=>{const k=b.getAttribute("z-empty");if(k){const w=k.match(/^\$(\w+)$/);if(w){const O=w[1],q=e[O];(R=>{if(R==null||R==="")return!0;if(typeof R=="string"){const H=R.trim();if(H===""||H==="<p></p>"||H==="<p> </p>"||/^<p>\s*<\/p>$/i.test(H)||/^<p>\s*<br\s*\/?>\s*<\/p>$/i.test(H))return!0}return!1})(q)?b.remove():b.removeAttribute("z-empty")}else b.removeAttribute("z-empty")}else b.removeAttribute("z-empty")});const E=()=>{Array.from(h.content.querySelectorAll("[z-for]")).forEach(k=>{const w=k.getAttribute("z-for");if(!w){k.removeAttribute("z-for");return}const O=w.match(/^(\w+)\s+in\s+(.+)$/);if(!O){console.warn(`[ZeroCode] Invalid z-for syntax: ${w}`),k.removeAttribute("z-for");return}const[,q,T]=O;if(!T.startsWith("{@")||!T.endsWith("}")){console.warn(`[ZeroCode] z-for only supports backend data: ${T}`),k.removeAttribute("z-for");return}const R=T.slice(2,-1);if(!d){k.remove();return}let H;try{const L=R.split(".");let B=d;for(const te of L)if(B&&typeof B=="object"&&te in B)B=B[te];else{B=null;break}H=B}catch(L){console.warn(`[ZeroCode] Failed to resolve data source: ${R}`,L),k.remove();return}if(!Array.isArray(H)||H.length===0){k.remove();return}const F=document.createDocumentFragment();H.forEach(L=>{const B=k.cloneNode(!0);B.removeAttribute("z-for"),v(B,q,L,e,d),F.appendChild(B)}),k.parentNode&&k.parentNode.replaceChild(F,k)})},v=(b,k,w,O,q,T)=>{const R=F=>{if(F.nodeType===Node.TEXT_NODE){let L=F.textContent||"";const B=new RegExp(`\\{${k}\\.([\\w\\.\\[\\]]+)\\}`,"g");L=L.replace(B,(te,K)=>{try{const ae=K.split(/[.[\]]/).filter(Z=>Z);let Q=w;for(const Z of ae)if(Z.match(/^\d+$/)){const Y=parseInt(Z,10);if(Array.isArray(Q)&&Y>=0&&Y<Q.length)Q=Q[Y];else return""}else if(Q&&typeof Q=="object"&&Z in Q)Q=Q[Z];else return"";return Q==null?"":String(Q)}catch{return""}}),L=L.replace(new RegExp(`\\{${k}\\}`,"g"),()=>typeof w=="object"&&w!==null?JSON.stringify(w):String(w)),F.textContent=L}else if(F.nodeType===Node.ELEMENT_NODE){const L=F;Array.from(L.attributes).forEach(B=>{let te=B.value;const K=new RegExp(`\\{${k}\\.([\\w\\.\\[\\]]+)\\}`,"g");te=te.replace(K,(ae,Q)=>{try{const Z=Q.split(/[.[\]]/).filter(ee=>ee);let Y=w;for(const ee of Z)if(ee.match(/^\d+$/)){const de=parseInt(ee,10);if(Array.isArray(Y)&&de>=0&&de<Y.length)Y=Y[de];else return""}else if(Y&&typeof Y=="object"&&ee in Y)Y=Y[ee];else return"";const J=Y==null?"":String(Y);return B.name==="href"||B.name==="src"||B.name==="action"?wt(J):ot(J)}catch{return""}}),te=te.replace(new RegExp(`\\{${k}\\}`,"g"),()=>{const ae=typeof w=="object"&&w!==null?JSON.stringify(w):String(w);return B.name==="href"||B.name==="src"||B.name==="action"?wt(ae):ot(ae)}),B.value=te}),Array.from(L.childNodes).forEach(B=>R(B))}};Array.from(b.childNodes).forEach(F=>R(F));const H=b.innerHTML;if(H){const F=ei(H,O,t,o,r,i,s,l,c,q);b.innerHTML=F}};E();const _=b=>{b.forEach(k=>{const w=k.getAttribute("z-slot")||"default",O=e.slots?.[w];let q=[];if(Array.isArray(O)?q=O:O&&typeof O=="object"&&O.children&&(q=O.children||[]),q.length===0){k.removeAttribute("z-slot"),i?(k.setAttribute("data-zcode-empty-slot",w),k.setAttribute("data-zcode-slot-path",t?`${t}.slots.${w}`:`slots.${w}`),k.innerHTML=`<div class="zcode-empty-slot" data-zcode-empty-slot-content>
341
341
  <button class="zcode-add-slot-btn" data-zcode-add-slot>+ パーツを追加</button>
342
- </div>`):E.innerHTML="";return}const z=G.map((H,L)=>{const j=n?`${n}.slots.${k}.${L}`:`slots.${k}.${L}`;return r(H,j)}).join("");E.removeAttribute("z-slot");const W=f.parseFromString(`<template>${z}</template>`,"text/html").querySelector("template");if(W&&W.content)for(E.innerHTML="";W.content.firstChild;)E.appendChild(W.content.firstChild);else E.innerHTML=z})},A=Array.from(h.content.querySelectorAll("[z-slot]"));return M(A),h.innerHTML}function dn(t,e){const n=t.split(".");let o=e;for(const r of n)if(o==null||typeof o!="object"||(/^\d+$/.test(r)?o=o[parseInt(r)]:o=o[r],o===void 0))return null;return o}function jn(){return`zcode-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function Rg(t){return t.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^\s*([a-zA-Z])/,e=>e.toUpperCase())}function Pg(t){return Rg(t)}function od(t){const e=t.split(".");if(e.length<=2&&e[0]==="page")return null;if(e.includes("slots")){let o=-1;for(let r=e.length-1;r>=0;r--)if(e[r]==="slots"){o=r;break}if(o!==-1&&o<e.length-1){const r=e[e.length-1];if(!isNaN(parseInt(r)))return e.slice(0,o).join(".")}}const n=e.slice(0,-1);return n.length===0?null:n.join(".")}function ha(t,e){const n=[...e.common,...e.individual,...e.special];for(const o of n){const r=o.parts.find(i=>i.id===t);if(r)return r}return null}function fi(t,e=!0){function n(i){return ha(i,t.parts)}function o(i,s="",l=new Set){if(l.has(s))return console.warn(`循環参照を検出しました: ${s}`),`<div class="zcode-error-message">循環参照が検出されました: ${s}</div>`;l.add(s);const c=i.part_id,d=n(c);if(!d)return`<div class="zcode-error-message">パーツが見つかりません: ${c}</div>`;const u=ui(d.body,i,s,n,(f,p)=>o(f,p,l),e,t.images.common,t.images.individual,t.images.special,t.backendData);return e?td(u,{"data-zcode-id":i.id,"data-zcode-path":s,"data-zcode-part":c}):u}return{fullPageHtml:a.computed(()=>t.page.map((i,s)=>o(i,`page.${s}`)).join("")),renderComponentToHtml:o,findPart:n}}const ma=a.defineComponent({__name:"ZeroCodePreview",props:{cmsData:{type:Object},allowDynamicContentInteraction:{type:Boolean}},setup(t,{expose:e}){const n=t,{fullPageHtml:o}=fi(n.cmsData,!1),r=a.ref(null),i=a.computed(()=>r.value?.previewArea||null);return e({previewArea:i}),(s,l)=>(a.openBlock(),a.createBlock(Fc,{ref_key:"previewAreaRef",ref:r,"cms-data":t.cmsData,"full-page-html":a.unref(o),"allow-dynamic-content-interaction":t.allowDynamicContentInteraction},null,8,["cms-data","full-page-html","allow-dynamic-content-interaction"]))}}),Lg={class:"zcode-toolbar"},$g=["title"],rd=a.defineComponent({__name:"Toolbar",props:{currentMode:{type:String},viewMode:{type:String},availableModes:{type:Array},allowDynamicContentInteraction:{type:Boolean}},emits:["switch-mode","switch-view-mode","open-settings","toggle-dynamic-content"],setup(t,{emit:e}){const n=t,o=e,r=i=>{n.viewMode==="preview"?(o("switch-view-mode","manage"),a.nextTick(()=>{o("switch-mode",i)})):o("switch-mode",i)};return(i,s)=>(a.openBlock(),a.createElementBlock("div",Lg,[a.createElementVNode("button",{class:a.normalizeClass([{active:t.viewMode==="preview"},"zcode-view-mode-btn zcode-view-mode-preview"]),onClick:s[0]||(s[0]=l=>i.$emit("switch-view-mode",t.viewMode==="preview"?"manage":"preview"))},[a.createVNode(a.unref(Qm),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.viewMode")),1)],2),!t.availableModes||t.availableModes.includes("edit")?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass([{active:t.currentMode==="edit"&&t.viewMode==="manage"},"zcode-mode-btn zcode-mode-edit"]),onClick:s[1]||(s[1]=l=>r("edit"))},[a.createVNode(a.unref(Pc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.editMode")),1)],2)):a.createCommentVNode("",!0),!t.availableModes||t.availableModes.includes("add")?(a.openBlock(),a.createElementBlock("button",{key:1,class:a.normalizeClass([{active:t.currentMode==="add"&&t.viewMode==="manage"},"zcode-mode-btn zcode-mode-add"]),onClick:s[2]||(s[2]=l=>r("add"))},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.addMode")),1)],2)):a.createCommentVNode("",!0),!t.availableModes||t.availableModes.includes("reorder")?(a.openBlock(),a.createElementBlock("button",{key:2,class:a.normalizeClass([{active:t.currentMode==="reorder"&&t.viewMode==="manage"},"zcode-mode-btn zcode-mode-reorder"]),onClick:s[3]||(s[3]=l=>r("reorder"))},[a.createVNode(a.unref(ir),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.reorderMode")),1)],2)):a.createCommentVNode("",!0),!t.availableModes||t.availableModes.includes("delete")?(a.openBlock(),a.createElementBlock("button",{key:3,class:a.normalizeClass([{active:t.currentMode==="delete"&&t.viewMode==="manage"},"zcode-mode-btn zcode-mode-delete"]),onClick:s[4]||(s[4]=l=>r("delete"))},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.deleteMode")),1)],2)):a.createCommentVNode("",!0),a.createElementVNode("button",{class:"zcode-settings-btn",title:i.$t("toolbar.settings"),onClick:s[5]||(s[5]=l=>i.$emit("open-settings"))},[a.createVNode(a.unref($c),{size:16})],8,$g)]))}});function un(t,e){typeof console<"u"&&(console.warn("[intlify] "+t),e&&console.warn(e.stack))}const id={};function sd(t){id[t]||(id[t]=!0,un(t))}const wn=typeof window<"u";let $t,fo;if(process.env.NODE_ENV!=="production"){const t=wn&&window.performance;t&&t.mark&&t.measure&&t.clearMarks&&t.clearMeasures&&($t=e=>{t.mark(e)},fo=(e,n,o)=>{t.measure(e,n,o),t.clearMarks(n),t.clearMarks(o)})}const Vg=/\{([0-9a-zA-Z]+)\}/g;function ga(t,...e){return e.length===1&&Pe(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),t.replace(Vg,(n,o)=>e.hasOwnProperty(o)?e[o]:"")}const fn=(t,e=!1)=>e?Symbol.for(t):Symbol(t),Bg=(t,e,n)=>Fg({l:t,k:e,s:n}),Fg=t=>JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),at=t=>typeof t=="number"&&isFinite(t),jg=t=>ud(t)==="[object Date]",pi=t=>ud(t)==="[object RegExp]",hi=t=>Ve(t)&&Object.keys(t).length===0,yt=Object.assign,Ug=Object.create,Be=(t=null)=>Ug(t);let ad;const pr=()=>ad||(ad=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:Be());function ld(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\//g,"&#x2F;").replace(/=/g,"&#x3D;")}function cd(t){return t.replace(/&(?![a-zA-Z0-9#]{2,6};)/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Hg(t){return t=t.replace(/(\w+)\s*=\s*"([^"]*)"/g,(o,r,i)=>`${r}="${cd(i)}"`),t=t.replace(/(\w+)\s*=\s*'([^']*)'/g,(o,r,i)=>`${r}='${cd(i)}'`),/\s*on\w+\s*=\s*["']?[^"'>]+["']?/gi.test(t)&&(process.env.NODE_ENV!=="production"&&un("Potentially dangerous event handlers detected in translation. Consider removing onclick, onerror, etc. from your translation messages."),t=t.replace(/(\s+)(on)(\w+\s*=)/gi,"$1&#111;n$3")),[/(\s+(?:href|src|action|formaction)\s*=\s*["']?)\s*javascript:/gi,/(style\s*=\s*["'][^"']*url\s*\(\s*)javascript:/gi].forEach(o=>{t=t.replace(o,"$1javascript&#58;")}),t}const Wg=Object.prototype.hasOwnProperty;function nn(t,e){return Wg.call(t,e)}const tt=Array.isArray,qe=t=>typeof t=="function",me=t=>typeof t=="string",Ke=t=>typeof t=="boolean",Pe=t=>t!==null&&typeof t=="object",Gg=t=>Pe(t)&&qe(t.then)&&qe(t.catch),dd=Object.prototype.toString,ud=t=>dd.call(t),Ve=t=>{if(!Pe(t))return!1;const e=Object.getPrototypeOf(t);return e===null||e.constructor===Object},qg=t=>t==null?"":tt(t)||Ve(t)&&t.toString===dd?JSON.stringify(t,null,2):String(t);function Kg(t,e=""){return t.reduce((n,o,r)=>r===0?n+o:n+e+o,"")}const fd=2;function Jg(t,e=0,n=t.length){const o=t.split(/\r?\n/);let r=0;const i=[];for(let s=0;s<o.length;s++)if(r+=o[s].length+1,r>=e){for(let l=s-fd;l<=s+fd||n>r;l++){if(l<0||l>=o.length)continue;const c=l+1;i.push(`${c}${" ".repeat(3-String(c).length)}| ${o[l]}`);const d=o[l].length;if(l===s){const u=e-(r-d)+1,f=Math.max(1,n>r?d-u:n-e);i.push(" | "+" ".repeat(u)+"^".repeat(f))}else if(l>s){if(n>r){const u=Math.max(Math.min(n-r,d),1);i.push(" | "+"^".repeat(u))}r+=d+1}}break}return i.join(`
343
- `)}function mi(t){let e=t;return()=>++e}function pd(){const t=new Map;return{events:t,on(n,o){const r=t.get(n);r&&r.push(o)||t.set(n,[o])},off(n,o){const r=t.get(n);r&&r.splice(r.indexOf(o)>>>0,1)},emit(n,o){(t.get(n)||[]).slice().map(r=>r(o)),(t.get("*")||[]).slice().map(r=>r(n,o))}}}const gi=t=>!Pe(t)||tt(t);function bi(t,e){if(gi(t)||gi(e))throw new Error("Invalid value");const n=[{src:t,des:e}];for(;n.length;){const{src:o,des:r}=n.pop();Object.keys(o).forEach(i=>{i!=="__proto__"&&(Pe(o[i])&&!Pe(r[i])&&(r[i]=Array.isArray(o[i])?[]:Be()),gi(r[i])||gi(o[i])?r[i]=o[i]:n.push({src:o[i],des:r[i]}))})}}function Xg(t,e,n){return{line:t,column:e,offset:n}}function yi(t,e,n){return{start:t,end:e}}const Yg=/\{([0-9a-zA-Z]+)\}/g;function hd(t,...e){return e.length===1&&Qg(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),t.replace(Yg,(n,o)=>e.hasOwnProperty(o)?e[o]:"")}const md=Object.assign,gd=t=>typeof t=="string",Qg=t=>t!==null&&typeof t=="object";function bd(t,e=""){return t.reduce((n,o,r)=>r===0?n+o:n+e+o,"")}const xi={USE_MODULO_SYNTAX:1,__EXTEND_POINT__:2},Zg={[xi.USE_MODULO_SYNTAX]:"Use modulo before '{{0}}'."};function eb(t,e,...n){const o=hd(Zg[t],...n||[]),r={message:String(o),code:t};return e&&(r.location=e),r}const Ne={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16,__EXTEND_POINT__:17},tb={[Ne.EXPECTED_TOKEN]:"Expected token: '{0}'",[Ne.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[Ne.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[Ne.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[Ne.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[Ne.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[Ne.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[Ne.EMPTY_PLACEHOLDER]:"Empty placeholder",[Ne.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[Ne.INVALID_LINKED_FORMAT]:"Invalid linked format",[Ne.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[Ne.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[Ne.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[Ne.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[Ne.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[Ne.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function Io(t,e,n={}){const{domain:o,messages:r,args:i}=n,s=hd((r||tb)[t]||"",...i||[]),l=new SyntaxError(String(s));return l.code=t,e&&(l.location=e),l.domain=o,l}function nb(t){throw t}const ob=/<\/?[\w\s="/.':;#-\/]+>/,rb=t=>ob.test(t),Sn=" ",ib="\r",vt=`
344
- `,sb="\u2028",ab="\u2029";function lb(t){const e=t;let n=0,o=1,r=1,i=0;const s=y=>e[y]===ib&&e[y+1]===vt,l=y=>e[y]===vt,c=y=>e[y]===ab,d=y=>e[y]===sb,u=y=>s(y)||l(y)||c(y)||d(y),f=()=>n,p=()=>o,h=()=>r,m=()=>i,b=y=>s(y)||c(y)||d(y)?vt:e[y],g=()=>b(n),x=()=>b(n+i);function v(){return i=0,u(n)&&(o++,r=0),s(n)&&n++,n++,r++,e[n]}function w(){return s(n+i)&&i++,i++,e[n+i]}function T(){n=0,o=1,r=1,i=0}function M(y=0){i=y}function A(){const y=n+i;for(;y!==n;)v();i=0}return{index:f,line:p,column:h,peekOffset:m,charAt:b,currentChar:g,currentPeek:x,next:v,peek:w,reset:T,resetPeek:M,skipToPeek:A}}const Un=void 0,cb=".",yd="'",db="tokenizer";function ub(t,e={}){const n=e.location!==!1,o=lb(t),r=()=>o.index(),i=()=>Xg(o.line(),o.column(),o.index()),s=i(),l=r(),c={currentType:14,offset:l,startLoc:s,endLoc:s,lastType:14,lastOffset:l,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},d=()=>c,{onError:u}=e;function f(_,I,q,...pe){const Ae=d();if(I.column+=q,I.offset+=q,u){const ze=n?yi(Ae.startLoc,I):null,Se=Io(_,ze,{domain:db,args:pe});u(Se)}}function p(_,I,q){_.endLoc=i(),_.currentType=I;const pe={type:I};return n&&(pe.loc=yi(_.startLoc,_.endLoc)),q!=null&&(pe.value=q),pe}const h=_=>p(_,14);function m(_,I){return _.currentChar()===I?(_.next(),I):(f(Ne.EXPECTED_TOKEN,i(),0,I),"")}function b(_){let I="";for(;_.currentPeek()===Sn||_.currentPeek()===vt;)I+=_.currentPeek(),_.peek();return I}function g(_){const I=b(_);return _.skipToPeek(),I}function x(_){if(_===Un)return!1;const I=_.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I===95}function v(_){if(_===Un)return!1;const I=_.charCodeAt(0);return I>=48&&I<=57}function w(_,I){const{currentType:q}=I;if(q!==2)return!1;b(_);const pe=x(_.currentPeek());return _.resetPeek(),pe}function T(_,I){const{currentType:q}=I;if(q!==2)return!1;b(_);const pe=_.currentPeek()==="-"?_.peek():_.currentPeek(),Ae=v(pe);return _.resetPeek(),Ae}function M(_,I){const{currentType:q}=I;if(q!==2)return!1;b(_);const pe=_.currentPeek()===yd;return _.resetPeek(),pe}function A(_,I){const{currentType:q}=I;if(q!==8)return!1;b(_);const pe=_.currentPeek()===".";return _.resetPeek(),pe}function y(_,I){const{currentType:q}=I;if(q!==9)return!1;b(_);const pe=x(_.currentPeek());return _.resetPeek(),pe}function E(_,I){const{currentType:q}=I;if(!(q===8||q===12))return!1;b(_);const pe=_.currentPeek()===":";return _.resetPeek(),pe}function k(_,I){const{currentType:q}=I;if(q!==10)return!1;const pe=()=>{const ze=_.currentPeek();return ze==="{"?x(_.peek()):ze==="@"||ze==="%"||ze==="|"||ze===":"||ze==="."||ze===Sn||!ze?!1:ze===vt?(_.peek(),pe()):z(_,!1)},Ae=pe();return _.resetPeek(),Ae}function O(_){b(_);const I=_.currentPeek()==="|";return _.resetPeek(),I}function G(_){const I=b(_),q=_.currentPeek()==="%"&&_.peek()==="{";return _.resetPeek(),{isModulo:q,hasSpace:I.length>0}}function z(_,I=!0){const q=(Ae=!1,ze="",Se=!1)=>{const F=_.currentPeek();return F==="{"?ze==="%"?!1:Ae:F==="@"||!F?ze==="%"?!0:Ae:F==="%"?(_.peek(),q(Ae,"%",!0)):F==="|"?ze==="%"||Se?!0:!(ze===Sn||ze===vt):F===Sn?(_.peek(),q(!0,Sn,Se)):F===vt?(_.peek(),q(!0,vt,Se)):!0},pe=q();return I&&_.resetPeek(),pe}function R(_,I){const q=_.currentChar();return q===Un?Un:I(q)?(_.next(),q):null}function W(_){const I=_.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36}function H(_){return R(_,W)}function L(_){const I=_.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36||I===45}function j(_){return R(_,L)}function Z(_){const I=_.charCodeAt(0);return I>=48&&I<=57}function K(_){return R(_,Z)}function ae(_){const I=_.charCodeAt(0);return I>=48&&I<=57||I>=65&&I<=70||I>=97&&I<=102}function ee(_){return R(_,ae)}function X(_){let I="",q="";for(;I=K(_);)q+=I;return q}function Y(_){g(_);const I=_.currentChar();return I!=="%"&&f(Ne.EXPECTED_TOKEN,i(),0,I),_.next(),"%"}function J(_){let I="";for(;;){const q=_.currentChar();if(q==="{"||q==="}"||q==="@"||q==="|"||!q)break;if(q==="%")if(z(_))I+=q,_.next();else break;else if(q===Sn||q===vt)if(z(_))I+=q,_.next();else{if(O(_))break;I+=q,_.next()}else I+=q,_.next()}return I}function Q(_){g(_);let I="",q="";for(;I=j(_);)q+=I;return _.currentChar()===Un&&f(Ne.UNTERMINATED_CLOSING_BRACE,i(),0),q}function de(_){g(_);let I="";return _.currentChar()==="-"?(_.next(),I+=`-${X(_)}`):I+=X(_),_.currentChar()===Un&&f(Ne.UNTERMINATED_CLOSING_BRACE,i(),0),I}function ke(_){return _!==yd&&_!==vt}function Te(_){g(_),m(_,"'");let I="",q="";for(;I=R(_,ke);)I==="\\"?q+=$e(_):q+=I;const pe=_.currentChar();return pe===vt||pe===Un?(f(Ne.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,i(),0),pe===vt&&(_.next(),m(_,"'")),q):(m(_,"'"),q)}function $e(_){const I=_.currentChar();switch(I){case"\\":case"'":return _.next(),`\\${I}`;case"u":return N(_,I,4);case"U":return N(_,I,6);default:return f(Ne.UNKNOWN_ESCAPE_SEQUENCE,i(),0,I),""}}function N(_,I,q){m(_,I);let pe="";for(let Ae=0;Ae<q;Ae++){const ze=ee(_);if(!ze){f(Ne.INVALID_UNICODE_ESCAPE_SEQUENCE,i(),0,`\\${I}${pe}${_.currentChar()}`);break}pe+=ze}return`\\${I}${pe}`}function P(_){return _!=="{"&&_!=="}"&&_!==Sn&&_!==vt}function V(_){g(_);let I="",q="";for(;I=R(_,P);)q+=I;return q}function S(_){let I="",q="";for(;I=H(_);)q+=I;return q}function C(_){const I=q=>{const pe=_.currentChar();return pe==="{"||pe==="%"||pe==="@"||pe==="|"||pe==="("||pe===")"||!pe||pe===Sn?q:(q+=pe,_.next(),I(q))};return I("")}function $(_){g(_);const I=m(_,"|");return g(_),I}function te(_,I){let q=null;switch(_.currentChar()){case"{":return I.braceNest>=1&&f(Ne.NOT_ALLOW_NEST_PLACEHOLDER,i(),0),_.next(),q=p(I,2,"{"),g(_),I.braceNest++,q;case"}":return I.braceNest>0&&I.currentType===2&&f(Ne.EMPTY_PLACEHOLDER,i(),0),_.next(),q=p(I,3,"}"),I.braceNest--,I.braceNest>0&&g(_),I.inLinked&&I.braceNest===0&&(I.inLinked=!1),q;case"@":return I.braceNest>0&&f(Ne.UNTERMINATED_CLOSING_BRACE,i(),0),q=ge(_,I)||h(I),I.braceNest=0,q;default:{let Ae=!0,ze=!0,Se=!0;if(O(_))return I.braceNest>0&&f(Ne.UNTERMINATED_CLOSING_BRACE,i(),0),q=p(I,1,$(_)),I.braceNest=0,I.inLinked=!1,q;if(I.braceNest>0&&(I.currentType===5||I.currentType===6||I.currentType===7))return f(Ne.UNTERMINATED_CLOSING_BRACE,i(),0),I.braceNest=0,Re(_,I);if(Ae=w(_,I))return q=p(I,5,Q(_)),g(_),q;if(ze=T(_,I))return q=p(I,6,de(_)),g(_),q;if(Se=M(_,I))return q=p(I,7,Te(_)),g(_),q;if(!Ae&&!ze&&!Se)return q=p(I,13,V(_)),f(Ne.INVALID_TOKEN_IN_PLACEHOLDER,i(),0,q.value),g(_),q;break}}return q}function ge(_,I){const{currentType:q}=I;let pe=null;const Ae=_.currentChar();switch((q===8||q===9||q===12||q===10)&&(Ae===vt||Ae===Sn)&&f(Ne.INVALID_LINKED_FORMAT,i(),0),Ae){case"@":return _.next(),pe=p(I,8,"@"),I.inLinked=!0,pe;case".":return g(_),_.next(),p(I,9,".");case":":return g(_),_.next(),p(I,10,":");default:return O(_)?(pe=p(I,1,$(_)),I.braceNest=0,I.inLinked=!1,pe):A(_,I)||E(_,I)?(g(_),ge(_,I)):y(_,I)?(g(_),p(I,12,S(_))):k(_,I)?(g(_),Ae==="{"?te(_,I)||pe:p(I,11,C(_))):(q===8&&f(Ne.INVALID_LINKED_FORMAT,i(),0),I.braceNest=0,I.inLinked=!1,Re(_,I))}}function Re(_,I){let q={type:14};if(I.braceNest>0)return te(_,I)||h(I);if(I.inLinked)return ge(_,I)||h(I);switch(_.currentChar()){case"{":return te(_,I)||h(I);case"}":return f(Ne.UNBALANCED_CLOSING_BRACE,i(),0),_.next(),p(I,3,"}");case"@":return ge(_,I)||h(I);default:{if(O(_))return q=p(I,1,$(_)),I.braceNest=0,I.inLinked=!1,q;const{isModulo:Ae,hasSpace:ze}=G(_);if(Ae)return ze?p(I,0,J(_)):p(I,4,Y(_));if(z(_))return p(I,0,J(_));break}}return q}function ve(){const{currentType:_,offset:I,startLoc:q,endLoc:pe}=c;return c.lastType=_,c.lastOffset=I,c.lastStartLoc=q,c.lastEndLoc=pe,c.offset=r(),c.startLoc=i(),o.currentChar()===Un?p(c,14):Re(o,c)}return{nextToken:ve,currentOffset:r,currentPosition:i,context:d}}const fb="parser",pb=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function hb(t,e,n){switch(t){case"\\\\":return"\\";case"\\'":return"'";default:{const o=parseInt(e||n,16);return o<=55295||o>=57344?String.fromCodePoint(o):"�"}}}function mb(t={}){const e=t.location!==!1,{onError:n,onWarn:o}=t;function r(w,T,M,A,...y){const E=w.currentPosition();if(E.offset+=A,E.column+=A,n){const k=e?yi(M,E):null,O=Io(T,k,{domain:fb,args:y});n(O)}}function i(w,T,M,A,...y){const E=w.currentPosition();if(E.offset+=A,E.column+=A,o){const k=e?yi(M,E):null;o(eb(T,k,y))}}function s(w,T,M){const A={type:w};return e&&(A.start=T,A.end=T,A.loc={start:M,end:M}),A}function l(w,T,M,A){e&&(w.end=T,w.loc&&(w.loc.end=M))}function c(w,T){const M=w.context(),A=s(3,M.offset,M.startLoc);return A.value=T,l(A,w.currentOffset(),w.currentPosition()),A}function d(w,T){const M=w.context(),{lastOffset:A,lastStartLoc:y}=M,E=s(5,A,y);return E.index=parseInt(T,10),w.nextToken(),l(E,w.currentOffset(),w.currentPosition()),E}function u(w,T,M){const A=w.context(),{lastOffset:y,lastStartLoc:E}=A,k=s(4,y,E);return k.key=T,M===!0&&(k.modulo=!0),w.nextToken(),l(k,w.currentOffset(),w.currentPosition()),k}function f(w,T){const M=w.context(),{lastOffset:A,lastStartLoc:y}=M,E=s(9,A,y);return E.value=T.replace(pb,hb),w.nextToken(),l(E,w.currentOffset(),w.currentPosition()),E}function p(w){const T=w.nextToken(),M=w.context(),{lastOffset:A,lastStartLoc:y}=M,E=s(8,A,y);return T.type!==12?(r(w,Ne.UNEXPECTED_EMPTY_LINKED_MODIFIER,M.lastStartLoc,0),E.value="",l(E,A,y),{nextConsumeToken:T,node:E}):(T.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,M.lastStartLoc,0,on(T)),E.value=T.value||"",l(E,w.currentOffset(),w.currentPosition()),{node:E})}function h(w,T){const M=w.context(),A=s(7,M.offset,M.startLoc);return A.value=T,l(A,w.currentOffset(),w.currentPosition()),A}function m(w){const T=w.context(),M=s(6,T.offset,T.startLoc);let A=w.nextToken();if(A.type===9){const y=p(w);M.modifier=y.node,A=y.nextConsumeToken||w.nextToken()}switch(A.type!==10&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),A=w.nextToken(),A.type===2&&(A=w.nextToken()),A.type){case 11:A.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=h(w,A.value||"");break;case 5:A.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=u(w,A.value||"");break;case 6:A.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=d(w,A.value||"");break;case 7:A.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=f(w,A.value||"");break;default:{r(w,Ne.UNEXPECTED_EMPTY_LINKED_KEY,T.lastStartLoc,0);const y=w.context(),E=s(7,y.offset,y.startLoc);return E.value="",l(E,y.offset,y.startLoc),M.key=E,l(M,y.offset,y.startLoc),{nextConsumeToken:A,node:M}}}return l(M,w.currentOffset(),w.currentPosition()),{node:M}}function b(w){const T=w.context(),M=T.currentType===1?w.currentOffset():T.offset,A=T.currentType===1?T.endLoc:T.startLoc,y=s(2,M,A);y.items=[];let E=null,k=null;do{const z=E||w.nextToken();switch(E=null,z.type){case 0:z.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(c(w,z.value||""));break;case 6:z.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(d(w,z.value||""));break;case 4:k=!0;break;case 5:z.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(u(w,z.value||"",!!k)),k&&(i(w,xi.USE_MODULO_SYNTAX,T.lastStartLoc,0,on(z)),k=null);break;case 7:z.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(f(w,z.value||""));break;case 8:{const R=m(w);y.items.push(R.node),E=R.nextConsumeToken||null;break}}}while(T.currentType!==14&&T.currentType!==1);const O=T.currentType===1?T.lastOffset:w.currentOffset(),G=T.currentType===1?T.lastEndLoc:w.currentPosition();return l(y,O,G),y}function g(w,T,M,A){const y=w.context();let E=A.items.length===0;const k=s(1,T,M);k.cases=[],k.cases.push(A);do{const O=b(w);E||(E=O.items.length===0),k.cases.push(O)}while(y.currentType!==14);return E&&r(w,Ne.MUST_HAVE_MESSAGES_IN_PLURAL,M,0),l(k,w.currentOffset(),w.currentPosition()),k}function x(w){const T=w.context(),{offset:M,startLoc:A}=T,y=b(w);return T.currentType===14?y:g(w,M,A,y)}function v(w){const T=ub(w,md({},t)),M=T.context(),A=s(0,M.offset,M.startLoc);return e&&A.loc&&(A.loc.source=w),A.body=x(T),t.onCacheKey&&(A.cacheKey=t.onCacheKey(w)),M.currentType!==14&&r(T,Ne.UNEXPECTED_LEXICAL_ANALYSIS,M.lastStartLoc,0,w[M.offset]||""),l(A,T.currentOffset(),T.currentPosition()),A}return{parse:v}}function on(t){if(t.type===14)return"EOF";const e=(t.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function gb(t,e={}){const n={ast:t,helpers:new Set};return{context:()=>n,helper:i=>(n.helpers.add(i),i)}}function xd(t,e){for(let n=0;n<t.length;n++)ba(t[n],e)}function ba(t,e){switch(t.type){case 1:xd(t.cases,e),e.helper("plural");break;case 2:xd(t.items,e);break;case 6:{ba(t.key,e),e.helper("linked"),e.helper("type");break}case 5:e.helper("interpolate"),e.helper("list");break;case 4:e.helper("interpolate"),e.helper("named");break}}function bb(t,e={}){const n=gb(t);n.helper("normalize"),t.body&&ba(t.body,n);const o=n.context();t.helpers=Array.from(o.helpers)}function yb(t){const e=t.body;return e.type===2?Ed(e):e.cases.forEach(n=>Ed(n)),t}function Ed(t){if(t.items.length===1){const e=t.items[0];(e.type===3||e.type===9)&&(t.static=e.value,delete e.value)}else{const e=[];for(let n=0;n<t.items.length;n++){const o=t.items[n];if(!(o.type===3||o.type===9)||o.value==null)break;e.push(o.value)}if(e.length===t.items.length){t.static=bd(e);for(let n=0;n<t.items.length;n++){const o=t.items[n];(o.type===3||o.type===9)&&delete o.value}}}}const xb="minifier";function Oo(t){switch(t.t=t.type,t.type){case 0:{const e=t;Oo(e.body),e.b=e.body,delete e.body;break}case 1:{const e=t,n=e.cases;for(let o=0;o<n.length;o++)Oo(n[o]);e.c=n,delete e.cases;break}case 2:{const e=t,n=e.items;for(let o=0;o<n.length;o++)Oo(n[o]);e.i=n,delete e.items,e.static&&(e.s=e.static,delete e.static);break}case 3:case 9:case 8:case 7:{const e=t;e.value&&(e.v=e.value,delete e.value);break}case 6:{const e=t;Oo(e.key),e.k=e.key,delete e.key,e.modifier&&(Oo(e.modifier),e.m=e.modifier,delete e.modifier);break}case 5:{const e=t;e.i=e.index,delete e.index;break}case 4:{const e=t;e.k=e.key,delete e.key;break}default:throw Io(Ne.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:xb,args:[t.type]})}delete t.type}const Eb="parser";function kb(t,e){const{filename:n,breakLineCode:o,needIndent:r}=e,i=e.location!==!1,s={filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:r,indentLevel:0};i&&t.loc&&(s.source=t.loc.source);const l=()=>s;function c(b,g){s.code+=b}function d(b,g=!0){const x=g?o:"";c(r?x+" ".repeat(b):x)}function u(b=!0){const g=++s.indentLevel;b&&d(g)}function f(b=!0){const g=--s.indentLevel;b&&d(g)}function p(){d(s.indentLevel)}return{context:l,push:c,indent:u,deindent:f,newline:p,helper:b=>`_${b}`,needIndent:()=>s.needIndent}}function wb(t,e){const{helper:n}=t;t.push(`${n("linked")}(`),Do(t,e.key),e.modifier?(t.push(", "),Do(t,e.modifier),t.push(", _type")):t.push(", undefined, _type"),t.push(")")}function Sb(t,e){const{helper:n,needIndent:o}=t;t.push(`${n("normalize")}([`),t.indent(o());const r=e.items.length;for(let i=0;i<r&&(Do(t,e.items[i]),i!==r-1);i++)t.push(", ");t.deindent(o()),t.push("])")}function Nb(t,e){const{helper:n,needIndent:o}=t;if(e.cases.length>1){t.push(`${n("plural")}([`),t.indent(o());const r=e.cases.length;for(let i=0;i<r&&(Do(t,e.cases[i]),i!==r-1);i++)t.push(", ");t.deindent(o()),t.push("])")}}function Cb(t,e){e.body?Do(t,e.body):t.push("null")}function Do(t,e){const{helper:n}=t;switch(e.type){case 0:Cb(t,e);break;case 1:Nb(t,e);break;case 2:Sb(t,e);break;case 6:wb(t,e);break;case 8:t.push(JSON.stringify(e.value),e);break;case 7:t.push(JSON.stringify(e.value),e);break;case 5:t.push(`${n("interpolate")}(${n("list")}(${e.index}))`,e);break;case 4:t.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(e.key)}))`,e);break;case 9:t.push(JSON.stringify(e.value),e);break;case 3:t.push(JSON.stringify(e.value),e);break;default:throw Io(Ne.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:Eb,args:[e.type]})}}const vb=(t,e={})=>{const n=gd(e.mode)?e.mode:"normal",o=gd(e.filename)?e.filename:"message.intl";e.sourceMap;const r=e.breakLineCode!=null?e.breakLineCode:n==="arrow"?";":`
345
- `,i=e.needIndent?e.needIndent:n!=="arrow",s=t.helpers||[],l=kb(t,{filename:o,breakLineCode:r,needIndent:i});l.push(n==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),l.indent(i),s.length>0&&(l.push(`const { ${bd(s.map(u=>`${u}: _${u}`),", ")} } = ctx`),l.newline()),l.push("return "),Do(l,t),l.deindent(i),l.push("}"),delete t.helpers;const{code:c,map:d}=l.context();return{ast:t,code:c,map:d?d.toJSON():void 0}};function Tb(t,e={}){const n=md({},e),o=!!n.jit,r=!!n.minify,i=n.optimize==null?!0:n.optimize,l=mb(n).parse(t);return o?(i&&yb(l),r&&Oo(l),{ast:l,code:""}):(bb(l,n),vb(l,n))}function zb(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(pr().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(pr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function jt(t){return Pe(t)&&ya(t)===0&&(nn(t,"b")||nn(t,"body"))}const kd=["b","body"];function _b(t){return Hn(t,kd)}const wd=["c","cases"];function Ab(t){return Hn(t,wd,[])}const Sd=["s","static"];function Mb(t){return Hn(t,Sd)}const Nd=["i","items"];function Ib(t){return Hn(t,Nd,[])}const Cd=["t","type"];function ya(t){return Hn(t,Cd)}const vd=["v","value"];function Ei(t,e){const n=Hn(t,vd);if(n!=null)return n;throw hr(e)}const Td=["m","modifier"];function Ob(t){return Hn(t,Td)}const zd=["k","key"];function Db(t){const e=Hn(t,zd);if(e)return e;throw hr(6)}function Hn(t,e,n){for(let o=0;o<e.length;o++){const r=e[o];if(nn(t,r)&&t[r]!=null)return t[r]}return n}const _d=[...kd,...wd,...Sd,...Nd,...zd,...Td,...vd,...Cd];function hr(t){return new Error(`unhandled node type: ${t}`)}const Wn=[];Wn[0]={w:[0],i:[3,0],"[":[4],o:[7]},Wn[1]={w:[1],".":[2],"[":[4],o:[7]},Wn[2]={w:[2],i:[3,0],0:[3,0]},Wn[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},Wn[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},Wn[5]={"'":[4,0],o:8,l:[5,0]},Wn[6]={'"':[4,0],o:8,l:[6,0]};const Rb=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function Pb(t){return Rb.test(t)}function Lb(t){const e=t.charCodeAt(0),n=t.charCodeAt(t.length-1);return e===n&&(e===34||e===39)?t.slice(1,-1):t}function $b(t){if(t==null)return"o";switch(t.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return t;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function Vb(t){const e=t.trim();return t.charAt(0)==="0"&&isNaN(parseInt(t))?!1:Pb(e)?Lb(e):"*"+e}function Bb(t){const e=[];let n=-1,o=0,r=0,i,s,l,c,d,u,f;const p=[];p[0]=()=>{s===void 0?s=l:s+=l},p[1]=()=>{s!==void 0&&(e.push(s),s=void 0)},p[2]=()=>{p[0](),r++},p[3]=()=>{if(r>0)r--,o=4,p[0]();else{if(r=0,s===void 0||(s=Vb(s),s===!1))return!1;p[1]()}};function h(){const m=t[n+1];if(o===5&&m==="'"||o===6&&m==='"')return n++,l="\\"+m,p[0](),!0}for(;o!==null;)if(n++,i=t[n],!(i==="\\"&&h())){if(c=$b(i),f=Wn[o],d=f[c]||f.l||8,d===8||(o=d[0],d[1]!==void 0&&(u=p[d[1]],u&&(l=i,u()===!1))))return;if(o===7)return e}}const Ad=new Map;function Fb(t,e){return Pe(t)?t[e]:null}function jb(t,e){if(!Pe(t))return null;let n=Ad.get(e);if(n||(n=Bb(e),n&&Ad.set(e,n)),!n)return null;const o=n.length;let r=t,i=0;for(;i<o;){const s=n[i];if(_d.includes(s)&&jt(r))return null;const l=r[s];if(l===void 0||qe(r))return null;r=l,i++}return r}const Ub=t=>t,Hb=t=>"",Wb="text",Gb=t=>t.length===0?"":Kg(t),qb=qg;function Md(t,e){return t=Math.abs(t),e===2?t?t>1?1:0:1:t?Math.min(t,2):0}function Kb(t){const e=at(t.pluralIndex)?t.pluralIndex:-1;return t.named&&(at(t.named.count)||at(t.named.n))?at(t.named.count)?t.named.count:at(t.named.n)?t.named.n:e:e}function Jb(t,e){e.count||(e.count=t),e.n||(e.n=t)}function Xb(t={}){const e=t.locale,n=Kb(t),o=Pe(t.pluralRules)&&me(e)&&qe(t.pluralRules[e])?t.pluralRules[e]:Md,r=Pe(t.pluralRules)&&me(e)&&qe(t.pluralRules[e])?Md:void 0,i=x=>x[o(n,x.length,r)],s=t.list||[],l=x=>s[x],c=t.named||Be();at(t.pluralIndex)&&Jb(n,c);const d=x=>c[x];function u(x){const v=qe(t.messages)?t.messages(x):Pe(t.messages)?t.messages[x]:!1;return v||(t.parent?t.parent.message(x):Hb)}const f=x=>t.modifiers?t.modifiers[x]:Ub,p=Ve(t.processor)&&qe(t.processor.normalize)?t.processor.normalize:Gb,h=Ve(t.processor)&&qe(t.processor.interpolate)?t.processor.interpolate:qb,m=Ve(t.processor)&&me(t.processor.type)?t.processor.type:Wb,g={list:l,named:d,plural:i,linked:(x,...v)=>{const[w,T]=v;let M="text",A="";v.length===1?Pe(w)?(A=w.modifier||A,M=w.type||M):me(w)&&(A=w||A):v.length===2&&(me(w)&&(A=w||A),me(T)&&(M=T||M));const y=u(x)(g),E=M==="vnode"&&tt(y)&&A?y[0]:y;return A?f(A)(E,M):E},message:u,type:m,interpolate:h,normalize:p,values:yt(Be(),s,c)};return g}let mr=null;function Yb(t){mr=t}function Qb(t,e,n){mr&&mr.emit("i18n:init",{timestamp:Date.now(),i18n:t,version:e,meta:n})}const Zb=ey("function:translate");function ey(t){return e=>mr&&mr.emit(t,e)}const Id=xi.__EXTEND_POINT__,po=mi(Id),Tt={NOT_FOUND_KEY:Id,FALLBACK_TO_TRANSLATE:po(),CANNOT_FORMAT_NUMBER:po(),FALLBACK_TO_NUMBER_FORMAT:po(),CANNOT_FORMAT_DATE:po(),FALLBACK_TO_DATE_FORMAT:po(),EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:po(),__EXTEND_POINT__:po()},ty={[Tt.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[Tt.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[Tt.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[Tt.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[Tt.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[Tt.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[Tt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]:"This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future."};function ho(t,...e){return ga(ty[t],...e)}const Od=Ne.__EXTEND_POINT__,mo=mi(Od),lt={INVALID_ARGUMENT:Od,INVALID_DATE_ARGUMENT:mo(),INVALID_ISO_DATE_ARGUMENT:mo(),NOT_SUPPORT_NON_STRING_MESSAGE:mo(),NOT_SUPPORT_LOCALE_PROMISE_VALUE:mo(),NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:mo(),NOT_SUPPORT_LOCALE_TYPE:mo(),__EXTEND_POINT__:mo()};function pn(t){return Io(t,null,process.env.NODE_ENV!=="production"?{messages:ny}:void 0)}const ny={[lt.INVALID_ARGUMENT]:"Invalid arguments",[lt.INVALID_DATE_ARGUMENT]:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",[lt.INVALID_ISO_DATE_ARGUMENT]:"The argument provided is not a valid ISO date string",[lt.NOT_SUPPORT_NON_STRING_MESSAGE]:"Not support non-string message",[lt.NOT_SUPPORT_LOCALE_PROMISE_VALUE]:"cannot support promise value",[lt.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]:"cannot support async function",[lt.NOT_SUPPORT_LOCALE_TYPE]:"cannot support locale type"};function xa(t,e){return e.locale!=null?Dd(e.locale):Dd(t.locale)}let Ea;function Dd(t){if(me(t))return t;if(qe(t)){if(t.resolvedOnce&&Ea!=null)return Ea;if(t.constructor.name==="Function"){const e=t();if(Gg(e))throw pn(lt.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Ea=e}else throw pn(lt.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw pn(lt.NOT_SUPPORT_LOCALE_TYPE)}function oy(t,e,n){return[...new Set([n,...tt(e)?e:Pe(e)?Object.keys(e):me(e)?[e]:[n]])]}function Rd(t,e,n){const o=me(n)?n:wi,r=t;r.__localeChainCache||(r.__localeChainCache=new Map);let i=r.__localeChainCache.get(o);if(!i){i=[];let s=[n];for(;tt(s);)s=Pd(i,s,e);const l=tt(e)||!Ve(e)?e:e.default?e.default:null;s=me(l)?[l]:l,tt(s)&&Pd(i,s,!1),r.__localeChainCache.set(o,i)}return i}function Pd(t,e,n){let o=!0;for(let r=0;r<e.length&&Ke(o);r++){const i=e[r];me(i)&&(o=ry(t,e[r],n))}return o}function ry(t,e,n){let o;const r=e.split("-");do{const i=r.join("-");o=iy(t,i,n),r.splice(-1,1)}while(r.length&&o===!0);return o}function iy(t,e,n){let o=!1;if(!t.includes(e)&&(o=!0,e)){o=e[e.length-1]!=="!";const r=e.replace(/!/g,"");t.push(r),(tt(n)||Ve(n))&&n[r]&&(o=n[r])}return o}const sy="9.14.5",ki=-1,wi="en-US",Si="",Ld=t=>`${t.charAt(0).toLocaleUpperCase()}${t.substr(1)}`;function ay(){return{upper:(t,e)=>e==="text"&&me(t)?t.toUpperCase():e==="vnode"&&Pe(t)&&"__v_isVNode"in t?t.children.toUpperCase():t,lower:(t,e)=>e==="text"&&me(t)?t.toLowerCase():e==="vnode"&&Pe(t)&&"__v_isVNode"in t?t.children.toLowerCase():t,capitalize:(t,e)=>e==="text"&&me(t)?Ld(t):e==="vnode"&&Pe(t)&&"__v_isVNode"in t?Ld(t.children):t}}let $d;function Vd(t){$d=t}let Bd;function ly(t){Bd=t}let Fd;function cy(t){Fd=t}let jd=null;const dy=t=>{jd=t},uy=()=>jd;let Ud=null;const Hd=t=>{Ud=t},fy=()=>Ud;let Wd=0;function py(t={}){const e=qe(t.onWarn)?t.onWarn:un,n=me(t.version)?t.version:sy,o=me(t.locale)||qe(t.locale)?t.locale:wi,r=qe(o)?wi:o,i=tt(t.fallbackLocale)||Ve(t.fallbackLocale)||me(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:r,s=Ve(t.messages)?t.messages:ka(r),l=Ve(t.datetimeFormats)?t.datetimeFormats:ka(r),c=Ve(t.numberFormats)?t.numberFormats:ka(r),d=yt(Be(),t.modifiers,ay()),u=t.pluralRules||Be(),f=qe(t.missing)?t.missing:null,p=Ke(t.missingWarn)||pi(t.missingWarn)?t.missingWarn:!0,h=Ke(t.fallbackWarn)||pi(t.fallbackWarn)?t.fallbackWarn:!0,m=!!t.fallbackFormat,b=!!t.unresolving,g=qe(t.postTranslation)?t.postTranslation:null,x=Ve(t.processor)?t.processor:null,v=Ke(t.warnHtmlMessage)?t.warnHtmlMessage:!0,w=!!t.escapeParameter,T=qe(t.messageCompiler)?t.messageCompiler:$d;process.env.NODE_ENV!=="production"&&qe(t.messageCompiler)&&sd(ho(Tt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));const M=qe(t.messageResolver)?t.messageResolver:Bd||Fb,A=qe(t.localeFallbacker)?t.localeFallbacker:Fd||oy,y=Pe(t.fallbackContext)?t.fallbackContext:void 0,E=t,k=Pe(E.__datetimeFormatters)?E.__datetimeFormatters:new Map,O=Pe(E.__numberFormatters)?E.__numberFormatters:new Map,G=Pe(E.__meta)?E.__meta:{};Wd++;const z={version:n,cid:Wd,locale:o,fallbackLocale:i,messages:s,modifiers:d,pluralRules:u,missing:f,missingWarn:p,fallbackWarn:h,fallbackFormat:m,unresolving:b,postTranslation:g,processor:x,warnHtmlMessage:v,escapeParameter:w,messageCompiler:T,messageResolver:M,localeFallbacker:A,fallbackContext:y,onWarn:e,__meta:G};return z.datetimeFormats=l,z.numberFormats=c,z.__datetimeFormatters=k,z.__numberFormatters=O,process.env.NODE_ENV!=="production"&&(z.__v_emitter=E.__v_emitter!=null?E.__v_emitter:void 0),process.env.NODE_ENV!=="production"&&Qb(z,n,G),z}const ka=t=>({[t]:Be()});function Ni(t,e){return t instanceof RegExp?t.test(e):t}function Gd(t,e){return t instanceof RegExp?t.test(e):t}function wa(t,e,n,o,r){const{missing:i,onWarn:s}=t;if(process.env.NODE_ENV!=="production"){const l=t.__v_emitter;l&&l.emit("missing",{locale:n,key:e,type:r,groupId:`${r}:${e}`})}if(i!==null){const l=i(t,n,e,r);return me(l)?l:e}else return process.env.NODE_ENV!=="production"&&Gd(o,e)&&s(ho(Tt.NOT_FOUND_KEY,{key:e,locale:n})),e}function gr(t,e,n){const o=t;o.__localeChainCache=new Map,t.localeFallbacker(t,n,e)}function qd(t,e){return t===e?!1:t.split("-")[0]===e.split("-")[0]}function hy(t,e){const n=e.indexOf(t);if(n===-1)return!1;for(let o=n+1;o<e.length;o++)if(qd(t,e[o]))return!0;return!1}function Sa(t){return n=>my(n,t)}function my(t,e){const n=_b(e);if(n==null)throw hr(0);if(ya(n)===1){const i=Ab(n);return t.plural(i.reduce((s,l)=>[...s,Kd(t,l)],[]))}else return Kd(t,n)}function Kd(t,e){const n=Mb(e);if(n!=null)return t.type==="text"?n:t.normalize([n]);{const o=Ib(e).reduce((r,i)=>[...r,Na(t,i)],[]);return t.normalize(o)}}function Na(t,e){const n=ya(e);switch(n){case 3:return Ei(e,n);case 9:return Ei(e,n);case 4:{const o=e;if(nn(o,"k")&&o.k)return t.interpolate(t.named(o.k));if(nn(o,"key")&&o.key)return t.interpolate(t.named(o.key));throw hr(n)}case 5:{const o=e;if(nn(o,"i")&&at(o.i))return t.interpolate(t.list(o.i));if(nn(o,"index")&&at(o.index))return t.interpolate(t.list(o.index));throw hr(n)}case 6:{const o=e,r=Ob(o),i=Db(o);return t.linked(Na(t,i),r?Na(t,r):void 0,t.type)}case 7:return Ei(e,n);case 8:return Ei(e,n);default:throw new Error(`unhandled node on format message part: ${n}`)}}const gy="Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.";function Jd(t,e){e&&rb(t)&&un(ga(gy,{source:t}))}const Xd=t=>t;let Ro=Be();function Yd(t){t.code===xi.USE_MODULO_SYNTAX&&un(`The use of named interpolation with modulo syntax is deprecated. It will be removed in v10.
346
- reference: https://vue-i18n.intlify.dev/guide/essentials/syntax#rails-i18n-format
347
- (message compiler warning message: ${t.message})`)}function Qd(t,e={}){let n=!1;const o=e.onError||nb;return e.onError=r=>{n=!0,o(r)},{...Tb(t,e),detectError:n}}const by=(t,e)=>{if(!me(t))throw pn(lt.NOT_SUPPORT_NON_STRING_MESSAGE);process.env.NODE_ENV!=="production"&&(e.onWarn=Yd);{const n=Ke(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&Jd(t,n);const r=(e.onCacheKey||Xd)(t),i=Ro[r];if(i)return i;const{code:s,detectError:l}=Qd(t,e),c=new Function(`return ${s}`)();return l?c:Ro[r]=c}};function yy(t,e){if(process.env.NODE_ENV!=="production"&&(e.onWarn=Yd),__INTLIFY_JIT_COMPILATION__&&!__INTLIFY_DROP_MESSAGE_COMPILER__&&me(t)){const n=Ke(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&Jd(t,n);const r=(e.onCacheKey||Xd)(t),i=Ro[r];if(i)return i;const{ast:s,detectError:l}=Qd(t,{...e,location:process.env.NODE_ENV!=="production",jit:!0}),c=Sa(s);return l?c:Ro[r]=c}else{if(process.env.NODE_ENV!=="production"&&!jt(t))return un(`the message that is resolve with key '${e.key}' is not supported for jit compilation`),(()=>t);const n=t.cacheKey;if(n){const o=Ro[n];return o||(Ro[n]=Sa(t))}else return Sa(t)}}const Zd=()=>"",Ut=t=>qe(t);function eu(t,...e){const{fallbackFormat:n,postTranslation:o,unresolving:r,messageCompiler:i,fallbackLocale:s,messages:l}=t,[c,d]=Ca(...e),u=Ke(d.missingWarn)?d.missingWarn:t.missingWarn,f=Ke(d.fallbackWarn)?d.fallbackWarn:t.fallbackWarn,p=Ke(d.escapeParameter)?d.escapeParameter:t.escapeParameter,h=!!d.resolvedMessage,m=me(d.default)||Ke(d.default)?Ke(d.default)?i?c:()=>c:d.default:n?i?c:()=>c:"",b=n||m!=="",g=xa(t,d);p&&xy(d);let[x,v,w]=h?[c,g,l[g]||Be()]:tu(t,c,g,s,f,u),T=x,M=c;if(!h&&!(me(T)||jt(T)||Ut(T))&&b&&(T=m,M=T),!h&&(!(me(T)||jt(T)||Ut(T))||!me(v)))return r?ki:c;if(process.env.NODE_ENV!=="production"&&me(T)&&t.messageCompiler==null)return un(`The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return '${c}'.`),c;let A=!1;const y=()=>{A=!0},E=Ut(T)?T:nu(t,c,v,T,M,y);if(A)return T;const k=Sy(t,v,w,d),O=Xb(k),G=Ey(t,E,O);let z=o?o(G,c):G;if(p&&me(z)&&(z=Hg(z)),process.env.NODE_ENV!=="production"){const R={timestamp:Date.now(),key:me(c)?c:Ut(T)?T.key:"",locale:v||(Ut(T)?T.locale:""),format:me(T)?T:Ut(T)?T.source:"",message:z};R.meta=yt({},t.__meta,uy()||{}),Zb(R)}return z}function xy(t){tt(t.list)?t.list=t.list.map(e=>me(e)?ld(e):e):Pe(t.named)&&Object.keys(t.named).forEach(e=>{me(t.named[e])&&(t.named[e]=ld(t.named[e]))})}function tu(t,e,n,o,r,i){const{messages:s,onWarn:l,messageResolver:c,localeFallbacker:d}=t,u=d(t,o,n);let f=Be(),p,h=null,m=n,b=null;const g="translate";for(let x=0;x<u.length;x++){if(p=b=u[x],process.env.NODE_ENV!=="production"&&n!==p&&!qd(n,p)&&Ni(r,e)&&l(ho(Tt.FALLBACK_TO_TRANSLATE,{key:e,target:p})),process.env.NODE_ENV!=="production"&&n!==p){const M=t.__v_emitter;M&&M.emit("fallback",{type:g,key:e,from:m,to:b,groupId:`${g}:${e}`})}f=s[p]||Be();let v=null,w,T;if(process.env.NODE_ENV!=="production"&&wn&&(v=window.performance.now(),w="intlify-message-resolve-start",T="intlify-message-resolve-end",$t&&$t(w)),(h=c(f,e))===null&&(h=f[e]),process.env.NODE_ENV!=="production"&&wn){const M=window.performance.now(),A=t.__v_emitter;A&&v&&h&&A.emit("message-resolve",{type:"message-resolve",key:e,message:h,time:M-v,groupId:`${g}:${e}`}),w&&T&&$t&&fo&&($t(T),fo("intlify message resolve",w,T))}if(me(h)||jt(h)||Ut(h))break;if(!hy(p,u)){const M=wa(t,e,p,i,g);M!==e&&(h=M)}m=b}return[h,p,f]}function nu(t,e,n,o,r,i){const{messageCompiler:s,warnHtmlMessage:l}=t;if(Ut(o)){const p=o;return p.locale=p.locale||n,p.key=p.key||e,p}if(s==null){const p=(()=>o);return p.locale=n,p.key=e,p}let c=null,d,u;process.env.NODE_ENV!=="production"&&wn&&(c=window.performance.now(),d="intlify-message-compilation-start",u="intlify-message-compilation-end",$t&&$t(d));const f=s(o,ky(t,n,r,o,l,i));if(process.env.NODE_ENV!=="production"&&wn){const p=window.performance.now(),h=t.__v_emitter;h&&c&&h.emit("message-compilation",{type:"message-compilation",message:o,time:p-c,groupId:`translate:${e}`}),d&&u&&$t&&fo&&($t(u),fo("intlify message compilation",d,u))}return f.locale=n,f.key=e,f.source=o,f}function Ey(t,e,n){let o=null,r,i;process.env.NODE_ENV!=="production"&&wn&&(o=window.performance.now(),r="intlify-message-evaluation-start",i="intlify-message-evaluation-end",$t&&$t(r));const s=e(n);if(process.env.NODE_ENV!=="production"&&wn){const l=window.performance.now(),c=t.__v_emitter;c&&o&&c.emit("message-evaluation",{type:"message-evaluation",value:s,time:l-o,groupId:`translate:${e.key}`}),r&&i&&$t&&fo&&($t(i),fo("intlify message evaluation",r,i))}return s}function Ca(...t){const[e,n,o]=t,r=Be();if(!me(e)&&!at(e)&&!Ut(e)&&!jt(e))throw pn(lt.INVALID_ARGUMENT);const i=at(e)?String(e):(Ut(e),e);return at(n)?r.plural=n:me(n)?r.default=n:Ve(n)&&!hi(n)?r.named=n:tt(n)&&(r.list=n),at(o)?r.plural=o:me(o)?r.default=o:Ve(o)&&yt(r,o),[i,r]}function ky(t,e,n,o,r,i){return{locale:e,key:n,warnHtmlMessage:r,onError:s=>{if(i&&i(s),process.env.NODE_ENV!=="production"){const l=wy(o),c=`Message compilation error: ${s.message}`,d=s.location&&l&&Jg(l,s.location.start.offset,s.location.end.offset),u=t.__v_emitter;u&&l&&u.emit("compile-error",{message:l,error:s.message,start:s.location&&s.location.start.offset,end:s.location&&s.location.end.offset,groupId:`translate:${n}`}),console.error(d?`${c}
348
- ${d}`:c)}else throw s},onCacheKey:s=>Bg(e,n,s)}}function wy(t){if(me(t))return t;if(t.loc&&t.loc.source)return t.loc.source}function Sy(t,e,n,o){const{modifiers:r,pluralRules:i,messageResolver:s,fallbackLocale:l,fallbackWarn:c,missingWarn:d,fallbackContext:u}=t,p={locale:e,modifiers:r,pluralRules:i,messages:h=>{let m=s(n,h);if(m==null&&u){const[,,b]=tu(u,h,e,l,c,d);m=s(b,h)}if(me(m)||jt(m)){let b=!1;const x=nu(t,h,e,m,h,()=>{b=!0});return b?Zd:x}else return Ut(m)?m:Zd}};return t.processor&&(p.processor=t.processor),o.list&&(p.list=o.list),o.named&&(p.named=o.named),at(o.plural)&&(p.pluralIndex=o.plural),p}const ou=typeof Intl<"u",ru={dateTimeFormat:ou&&typeof Intl.DateTimeFormat<"u",numberFormat:ou&&typeof Intl.NumberFormat<"u"};function iu(t,...e){const{datetimeFormats:n,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:s}=t,{__datetimeFormatters:l}=t;if(process.env.NODE_ENV!=="production"&&!ru.dateTimeFormat)return i(ho(Tt.CANNOT_FORMAT_DATE)),Si;const[c,d,u,f]=va(...e),p=Ke(u.missingWarn)?u.missingWarn:t.missingWarn,h=Ke(u.fallbackWarn)?u.fallbackWarn:t.fallbackWarn,m=!!u.part,b=xa(t,u),g=s(t,r,b);if(!me(c)||c==="")return new Intl.DateTimeFormat(b,f).format(d);let x={},v,w=null,T=b,M=null;const A="datetime format";for(let k=0;k<g.length;k++){if(v=M=g[k],process.env.NODE_ENV!=="production"&&b!==v&&Ni(h,c)&&i(ho(Tt.FALLBACK_TO_DATE_FORMAT,{key:c,target:v})),process.env.NODE_ENV!=="production"&&b!==v){const O=t.__v_emitter;O&&O.emit("fallback",{type:A,key:c,from:T,to:M,groupId:`${A}:${c}`})}if(x=n[v]||{},w=x[c],Ve(w))break;wa(t,c,v,p,A),T=M}if(!Ve(w)||!me(v))return o?ki:c;let y=`${v}__${c}`;hi(f)||(y=`${y}__${JSON.stringify(f)}`);let E=l.get(y);return E||(E=new Intl.DateTimeFormat(v,yt({},w,f)),l.set(y,E)),m?E.formatToParts(d):E.format(d)}const su=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function va(...t){const[e,n,o,r]=t,i=Be();let s=Be(),l;if(me(e)){const c=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!c)throw pn(lt.INVALID_ISO_DATE_ARGUMENT);const d=c[3]?c[3].trim().startsWith("T")?`${c[1].trim()}${c[3].trim()}`:`${c[1].trim()}T${c[3].trim()}`:c[1].trim();l=new Date(d);try{l.toISOString()}catch{throw pn(lt.INVALID_ISO_DATE_ARGUMENT)}}else if(jg(e)){if(isNaN(e.getTime()))throw pn(lt.INVALID_DATE_ARGUMENT);l=e}else if(at(e))l=e;else throw pn(lt.INVALID_ARGUMENT);return me(n)?i.key=n:Ve(n)&&Object.keys(n).forEach(c=>{su.includes(c)?s[c]=n[c]:i[c]=n[c]}),me(o)?i.locale=o:Ve(o)&&(s=o),Ve(r)&&(s=r),[i.key||"",l,i,s]}function au(t,e,n){const o=t;for(const r in n){const i=`${e}__${r}`;o.__datetimeFormatters.has(i)&&o.__datetimeFormatters.delete(i)}}function lu(t,...e){const{numberFormats:n,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:s}=t,{__numberFormatters:l}=t;if(process.env.NODE_ENV!=="production"&&!ru.numberFormat)return i(ho(Tt.CANNOT_FORMAT_NUMBER)),Si;const[c,d,u,f]=Ta(...e),p=Ke(u.missingWarn)?u.missingWarn:t.missingWarn,h=Ke(u.fallbackWarn)?u.fallbackWarn:t.fallbackWarn,m=!!u.part,b=xa(t,u),g=s(t,r,b);if(!me(c)||c==="")return new Intl.NumberFormat(b,f).format(d);let x={},v,w=null,T=b,M=null;const A="number format";for(let k=0;k<g.length;k++){if(v=M=g[k],process.env.NODE_ENV!=="production"&&b!==v&&Ni(h,c)&&i(ho(Tt.FALLBACK_TO_NUMBER_FORMAT,{key:c,target:v})),process.env.NODE_ENV!=="production"&&b!==v){const O=t.__v_emitter;O&&O.emit("fallback",{type:A,key:c,from:T,to:M,groupId:`${A}:${c}`})}if(x=n[v]||{},w=x[c],Ve(w))break;wa(t,c,v,p,A),T=M}if(!Ve(w)||!me(v))return o?ki:c;let y=`${v}__${c}`;hi(f)||(y=`${y}__${JSON.stringify(f)}`);let E=l.get(y);return E||(E=new Intl.NumberFormat(v,yt({},w,f)),l.set(y,E)),m?E.formatToParts(d):E.format(d)}const cu=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function Ta(...t){const[e,n,o,r]=t,i=Be();let s=Be();if(!at(e))throw pn(lt.INVALID_ARGUMENT);const l=e;return me(n)?i.key=n:Ve(n)&&Object.keys(n).forEach(c=>{cu.includes(c)?s[c]=n[c]:i[c]=n[c]}),me(o)?i.locale=o:Ve(o)&&(s=o),Ve(r)&&(s=r),[i.key||"",l,i,s]}function du(t,e,n){const o=t;for(const r in n){const i=`${e}__${r}`;o.__numberFormatters.has(i)&&o.__numberFormatters.delete(i)}}zb();function Ny(){return uu().__VUE_DEVTOOLS_GLOBAL_HOOK__}function uu(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const Cy=typeof Proxy=="function",vy="devtools-plugin:setup",Ty="plugin:settings:set";let Po,za;function zy(){var t;return Po!==void 0||(typeof window<"u"&&window.performance?(Po=!0,za=window.performance):typeof globalThis<"u"&&(!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance)?(Po=!0,za=globalThis.perf_hooks.performance):Po=!1),Po}function _y(){return zy()?za.now():Date.now()}class Ay{constructor(e,n){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=n;const o={};if(e.settings)for(const s in e.settings){const l=e.settings[s];o[s]=l.defaultValue}const r=`__vue-devtools-plugin-settings__${e.id}`;let i=Object.assign({},o);try{const s=localStorage.getItem(r),l=JSON.parse(s);Object.assign(i,l)}catch{}this.fallbacks={getSettings(){return i},setSettings(s){try{localStorage.setItem(r,JSON.stringify(s))}catch{}i=s},now(){return _y()}},n&&n.on(Ty,(s,l)=>{s===this.plugin.id&&this.fallbacks.setSettings(l)}),this.proxiedOn=new Proxy({},{get:(s,l)=>this.target?this.target.on[l]:(...c)=>{this.onQueue.push({method:l,args:c})}}),this.proxiedTarget=new Proxy({},{get:(s,l)=>this.target?this.target[l]:l==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(l)?(...c)=>(this.targetQueue.push({method:l,args:c,resolve:()=>{}}),this.fallbacks[l](...c)):(...c)=>new Promise(d=>{this.targetQueue.push({method:l,args:c,resolve:d})})})}async setRealTarget(e){this.target=e;for(const n of this.onQueue)this.target.on[n.method](...n.args);for(const n of this.targetQueue)n.resolve(await this.target[n.method](...n.args))}}function My(t,e){const n=t,o=uu(),r=Ny(),i=Cy&&n.enableEarlyProxy;if(r&&(o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!i))r.emit(vy,t,e);else{const s=i?new Ay(n,r):null;(o.__VUE_DEVTOOLS_PLUGINS__=o.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:e,proxy:s}),s&&e(s.proxiedTarget)}}const Iy="9.14.5";function Oy(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(pr().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(pr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}const fu=Tt.__EXTEND_POINT__,Nn=mi(fu),Mt={FALLBACK_TO_ROOT:fu,NOT_SUPPORTED_PRESERVE:Nn(),NOT_SUPPORTED_FORMATTER:Nn(),NOT_SUPPORTED_PRESERVE_DIRECTIVE:Nn(),NOT_SUPPORTED_GET_CHOICE_INDEX:Nn(),COMPONENT_NAME_LEGACY_COMPATIBLE:Nn(),NOT_FOUND_PARENT_SCOPE:Nn(),IGNORE_OBJ_FLATTEN:Nn(),NOTICE_DROP_ALLOW_COMPOSITION:Nn(),NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG:Nn()},Dy={[Mt.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[Mt.NOT_SUPPORTED_PRESERVE]:"Not supported 'preserve'.",[Mt.NOT_SUPPORTED_FORMATTER]:"Not supported 'formatter'.",[Mt.NOT_SUPPORTED_PRESERVE_DIRECTIVE]:"Not supported 'preserveDirectiveContent'.",[Mt.NOT_SUPPORTED_GET_CHOICE_INDEX]:"Not supported 'getChoiceIndex'.",[Mt.COMPONENT_NAME_LEGACY_COMPATIBLE]:"Component name legacy compatible: '{name}' -> 'i18n'",[Mt.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[Mt.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[Mt.NOTICE_DROP_ALLOW_COMPOSITION]:"'allowComposition' option will be dropped in the next major version. For more information, please see 👉 https://tinyurl.com/2p97mcze",[Mt.NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG]:"'translateExistCompatible' option will be dropped in the next major version."};function Ci(t,...e){return ga(Dy[t],...e)}const pu=lt.__EXTEND_POINT__,It=mi(pu),Je={UNEXPECTED_RETURN_TYPE:pu,INVALID_ARGUMENT:It(),MUST_BE_CALL_SETUP_TOP:It(),NOT_INSTALLED:It(),NOT_AVAILABLE_IN_LEGACY_MODE:It(),REQUIRED_VALUE:It(),INVALID_VALUE:It(),CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:It(),NOT_INSTALLED_WITH_PROVIDE:It(),UNEXPECTED_ERROR:It(),NOT_COMPATIBLE_LEGACY_VUE_I18N:It(),BRIDGE_SUPPORT_VUE_2_ONLY:It(),MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION:It(),NOT_AVAILABLE_COMPOSITION_IN_LEGACY:It(),__EXTEND_POINT__:It()};function Cn(t,...e){return Io(t,null,process.env.NODE_ENV!=="production"?{messages:Ry,args:e}:void 0)}const Ry={[Je.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[Je.INVALID_ARGUMENT]:"Invalid argument",[Je.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[Je.NOT_INSTALLED]:"Need to install with `app.use` function",[Je.UNEXPECTED_ERROR]:"Unexpected error",[Je.NOT_AVAILABLE_IN_LEGACY_MODE]:"Not available in legacy mode",[Je.REQUIRED_VALUE]:"Required in value: {0}",[Je.INVALID_VALUE]:"Invalid value",[Je.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[Je.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[Je.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[Je.BRIDGE_SUPPORT_VUE_2_ONLY]:"vue-i18n-bridge support Vue 2.x only",[Je.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION]:"Must define ‘i18n’ option or custom block in Composition API with using local scope in Legacy API mode",[Je.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly"},_a=fn("__translateVNode"),Aa=fn("__datetimeParts"),Ma=fn("__numberParts"),br=fn("__enableEmitter"),Ia=fn("__disableEmitter"),Py=fn("__setPluralRules"),Ly=fn("__injectWithOption"),Oa=fn("__dispose");function yr(t){if(!Pe(t)||jt(t))return t;for(const e in t)if(nn(t,e))if(!e.includes("."))Pe(t[e])&&yr(t[e]);else{const n=e.split("."),o=n.length-1;let r=t,i=!1;for(let s=0;s<o;s++){if(n[s]==="__proto__")throw new Error(`unsafe key: ${n[s]}`);if(n[s]in r||(r[n[s]]=Be()),!Pe(r[n[s]])){process.env.NODE_ENV!=="production"&&un(Ci(Mt.IGNORE_OBJ_FLATTEN,{key:n[s]})),i=!0;break}r=r[n[s]]}if(i||(jt(r)?_d.includes(n[o])||delete t[e]:(r[n[o]]=t[e],delete t[e])),!jt(r)){const s=r[n[o]];Pe(s)&&yr(s)}}return t}function hu(t,e){const{messages:n,__i18n:o,messageResolver:r,flatJson:i}=e,s=Ve(n)?n:tt(o)?Be():{[t]:Be()};if(tt(o)&&o.forEach(l=>{if("locale"in l&&"resource"in l){const{locale:c,resource:d}=l;c?(s[c]=s[c]||Be(),bi(d,s[c])):bi(d,s)}else me(l)&&bi(JSON.parse(l),s)}),r==null&&i)for(const l in s)nn(s,l)&&yr(s[l]);return s}function mu(t){return t.type}function $y(t,e,n){let o=Pe(e.messages)?e.messages:Be();"__i18nGlobal"in n&&(o=hu(t.locale.value,{messages:o,__i18n:n.__i18nGlobal}));const r=Object.keys(o);r.length&&r.forEach(i=>{t.mergeLocaleMessage(i,o[i])});{if(Pe(e.datetimeFormats)){const i=Object.keys(e.datetimeFormats);i.length&&i.forEach(s=>{t.mergeDateTimeFormat(s,e.datetimeFormats[s])})}if(Pe(e.numberFormats)){const i=Object.keys(e.numberFormats);i.length&&i.forEach(s=>{t.mergeNumberFormat(s,e.numberFormats[s])})}}}function gu(t){return a.createVNode(a.Text,null,t,0)}const bu="__INTLIFY_META__",yu=()=>[],Vy=()=>!1;let xu=0;function Eu(t){return((e,n,o,r)=>t(n,o,a.getCurrentInstance()||void 0,r))}const By=()=>{const t=a.getCurrentInstance();let e=null;return t&&(e=mu(t)[bu])?{[bu]:e}:null};function ku(t={},e){const{__root:n,__injectWithOption:o}=t,r=n===void 0,i=t.flatJson,s=wn?a.ref:a.shallowRef,l=!!t.translateExistCompatible;process.env.NODE_ENV!=="production"&&l&&sd(Ci(Mt.NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG));let c=Ke(t.inheritLocale)?t.inheritLocale:!0;const d=s(n&&c?n.locale.value:me(t.locale)?t.locale:wi),u=s(n&&c?n.fallbackLocale.value:me(t.fallbackLocale)||tt(t.fallbackLocale)||Ve(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:d.value),f=s(hu(d.value,t)),p=s(Ve(t.datetimeFormats)?t.datetimeFormats:{[d.value]:{}}),h=s(Ve(t.numberFormats)?t.numberFormats:{[d.value]:{}});let m=n?n.missingWarn:Ke(t.missingWarn)||pi(t.missingWarn)?t.missingWarn:!0,b=n?n.fallbackWarn:Ke(t.fallbackWarn)||pi(t.fallbackWarn)?t.fallbackWarn:!0,g=n?n.fallbackRoot:Ke(t.fallbackRoot)?t.fallbackRoot:!0,x=!!t.fallbackFormat,v=qe(t.missing)?t.missing:null,w=qe(t.missing)?Eu(t.missing):null,T=qe(t.postTranslation)?t.postTranslation:null,M=n?n.warnHtmlMessage:Ke(t.warnHtmlMessage)?t.warnHtmlMessage:!0,A=!!t.escapeParameter;const y=n?n.modifiers:Ve(t.modifiers)?t.modifiers:{};let E=t.pluralRules||n&&n.pluralRules,k;k=(()=>{r&&Hd(null);const F={version:Iy,locale:d.value,fallbackLocale:u.value,messages:f.value,modifiers:y,pluralRules:E,missing:w===null?void 0:w,missingWarn:m,fallbackWarn:b,fallbackFormat:x,unresolving:!0,postTranslation:T===null?void 0:T,warnHtmlMessage:M,escapeParameter:A,messageResolver:t.messageResolver,messageCompiler:t.messageCompiler,__meta:{framework:"vue"}};F.datetimeFormats=p.value,F.numberFormats=h.value,F.__datetimeFormatters=Ve(k)?k.__datetimeFormatters:void 0,F.__numberFormatters=Ve(k)?k.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(F.__v_emitter=Ve(k)?k.__v_emitter:void 0);const ne=py(F);return r&&Hd(ne),ne})(),gr(k,d.value,u.value);function G(){return[d.value,u.value,f.value,p.value,h.value]}const z=a.computed({get:()=>d.value,set:F=>{d.value=F,k.locale=d.value}}),R=a.computed({get:()=>u.value,set:F=>{u.value=F,k.fallbackLocale=u.value,gr(k,d.value,F)}}),W=a.computed(()=>f.value),H=a.computed(()=>p.value),L=a.computed(()=>h.value);function j(){return qe(T)?T:null}function Z(F){T=F,k.postTranslation=F}function K(){return v}function ae(F){F!==null&&(w=Eu(F)),v=F,k.missing=w}function ee(F,ne){return F!=="translate"||!ne.resolvedMessage}const X=(F,ne,Me,B,U,ie)=>{G();let le;try{process.env.NODE_ENV,r||(k.fallbackContext=n?fy():void 0),le=F(k)}finally{process.env.NODE_ENV,r||(k.fallbackContext=void 0)}if(Me!=="translate exists"&&at(le)&&le===ki||Me==="translate exists"&&!le){const[we,Fe]=ne();if(process.env.NODE_ENV!=="production"&&n&&me(we)&&ee(Me,Fe)&&(g&&(Ni(b,we)||Gd(m,we))&&un(Ci(Mt.FALLBACK_TO_ROOT,{key:we,type:Me})),process.env.NODE_ENV!=="production")){const{__v_emitter:st}=k;st&&g&&st.emit("fallback",{type:Me,key:we,to:"global",groupId:`${Me}:${we}`})}return n&&g?B(n):U(we)}else{if(ie(le))return le;throw Cn(Je.UNEXPECTED_RETURN_TYPE)}};function Y(...F){return X(ne=>Reflect.apply(eu,null,[ne,...F]),()=>Ca(...F),"translate",ne=>Reflect.apply(ne.t,ne,[...F]),ne=>ne,ne=>me(ne))}function J(...F){const[ne,Me,B]=F;if(B&&!Pe(B))throw Cn(Je.INVALID_ARGUMENT);return Y(ne,Me,yt({resolvedMessage:!0},B||{}))}function Q(...F){return X(ne=>Reflect.apply(iu,null,[ne,...F]),()=>va(...F),"datetime format",ne=>Reflect.apply(ne.d,ne,[...F]),()=>Si,ne=>me(ne))}function de(...F){return X(ne=>Reflect.apply(lu,null,[ne,...F]),()=>Ta(...F),"number format",ne=>Reflect.apply(ne.n,ne,[...F]),()=>Si,ne=>me(ne))}function ke(F){return F.map(ne=>me(ne)||at(ne)||Ke(ne)?gu(String(ne)):ne)}const $e={normalize:ke,interpolate:F=>F,type:"vnode"};function N(...F){return X(ne=>{let Me;const B=ne;try{B.processor=$e,Me=Reflect.apply(eu,null,[B,...F])}finally{B.processor=null}return Me},()=>Ca(...F),"translate",ne=>ne[_a](...F),ne=>[gu(ne)],ne=>tt(ne))}function P(...F){return X(ne=>Reflect.apply(lu,null,[ne,...F]),()=>Ta(...F),"number format",ne=>ne[Ma](...F),yu,ne=>me(ne)||tt(ne))}function V(...F){return X(ne=>Reflect.apply(iu,null,[ne,...F]),()=>va(...F),"datetime format",ne=>ne[Aa](...F),yu,ne=>me(ne)||tt(ne))}function S(F){E=F,k.pluralRules=E}function C(F,ne){return X(()=>{if(!F)return!1;const Me=me(ne)?ne:d.value,B=ge(Me),U=k.messageResolver(B,F);return l?U!=null:jt(U)||Ut(U)||me(U)},()=>[F],"translate exists",Me=>Reflect.apply(Me.te,Me,[F,ne]),Vy,Me=>Ke(Me))}function $(F){let ne=null;const Me=Rd(k,u.value,d.value);for(let B=0;B<Me.length;B++){const U=f.value[Me[B]]||{},ie=k.messageResolver(U,F);if(ie!=null){ne=ie;break}}return ne}function te(F){const ne=$(F);return ne??(n?n.tm(F)||{}:{})}function ge(F){return f.value[F]||{}}function Re(F,ne){if(i){const Me={[F]:ne};for(const B in Me)nn(Me,B)&&yr(Me[B]);ne=Me[F]}f.value[F]=ne,k.messages=f.value}function ve(F,ne){f.value[F]=f.value[F]||{};const Me={[F]:ne};if(i)for(const B in Me)nn(Me,B)&&yr(Me[B]);ne=Me[F],bi(ne,f.value[F]),k.messages=f.value}function _(F){return p.value[F]||{}}function I(F,ne){p.value[F]=ne,k.datetimeFormats=p.value,au(k,F,ne)}function q(F,ne){p.value[F]=yt(p.value[F]||{},ne),k.datetimeFormats=p.value,au(k,F,ne)}function pe(F){return h.value[F]||{}}function Ae(F,ne){h.value[F]=ne,k.numberFormats=h.value,du(k,F,ne)}function ze(F,ne){h.value[F]=yt(h.value[F]||{},ne),k.numberFormats=h.value,du(k,F,ne)}xu++,n&&wn&&(a.watch(n.locale,F=>{c&&(d.value=F,k.locale=F,gr(k,d.value,u.value))}),a.watch(n.fallbackLocale,F=>{c&&(u.value=F,k.fallbackLocale=F,gr(k,d.value,u.value))}));const Se={id:xu,locale:z,fallbackLocale:R,get inheritLocale(){return c},set inheritLocale(F){c=F,F&&n&&(d.value=n.locale.value,u.value=n.fallbackLocale.value,gr(k,d.value,u.value))},get availableLocales(){return Object.keys(f.value).sort()},messages:W,get modifiers(){return y},get pluralRules(){return E||{}},get isGlobal(){return r},get missingWarn(){return m},set missingWarn(F){m=F,k.missingWarn=m},get fallbackWarn(){return b},set fallbackWarn(F){b=F,k.fallbackWarn=b},get fallbackRoot(){return g},set fallbackRoot(F){g=F},get fallbackFormat(){return x},set fallbackFormat(F){x=F,k.fallbackFormat=x},get warnHtmlMessage(){return M},set warnHtmlMessage(F){M=F,k.warnHtmlMessage=F},get escapeParameter(){return A},set escapeParameter(F){A=F,k.escapeParameter=F},t:Y,getLocaleMessage:ge,setLocaleMessage:Re,mergeLocaleMessage:ve,getPostTranslationHandler:j,setPostTranslationHandler:Z,getMissingHandler:K,setMissingHandler:ae,[Py]:S};return Se.datetimeFormats=H,Se.numberFormats=L,Se.rt=J,Se.te=C,Se.tm=te,Se.d=Q,Se.n=de,Se.getDateTimeFormat=_,Se.setDateTimeFormat=I,Se.mergeDateTimeFormat=q,Se.getNumberFormat=pe,Se.setNumberFormat=Ae,Se.mergeNumberFormat=ze,Se[Ly]=o,Se[_a]=N,Se[Aa]=V,Se[Ma]=P,process.env.NODE_ENV!=="production"&&(Se[br]=F=>{k.__v_emitter=F},Se[Ia]=()=>{k.__v_emitter=void 0}),Se}const Da={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:t=>t==="parent"||t==="global",default:"parent"},i18n:{type:Object}};function Fy({slots:t},e){return e.length===1&&e[0]==="default"?(t.default?t.default():[]).reduce((o,r)=>[...o,...r.type===a.Fragment?r.children:[r]],[]):e.reduce((n,o)=>{const r=t[o];return r&&(n[o]=r()),n},Be())}function wu(t){return a.Fragment}yt({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:t=>at(t)||!isNaN(t)}},Da);function jy(t){return tt(t)&&!me(t[0])}function Su(t,e,n,o){const{slots:r,attrs:i}=e;return()=>{const s={part:!0};let l=Be();t.locale&&(s.locale=t.locale),me(t.format)?s.key=t.format:Pe(t.format)&&(me(t.format.key)&&(s.key=t.format.key),l=Object.keys(t.format).reduce((p,h)=>n.includes(h)?yt(Be(),p,{[h]:t.format[h]}):p,Be()));const c=o(t.value,s,l);let d=[s.key];tt(c)?d=c.map((p,h)=>{const m=r[p.type],b=m?m({[p.type]:p.value,index:h,parts:c}):[p.value];return jy(b)&&(b[0].key=`${p.type}-${h}`),b}):me(c)&&(d=[c]);const u=yt(Be(),i),f=me(t.tag)||Pe(t.tag)?t.tag:wu();return a.h(f,u,d)}}yt({value:{type:Number,required:!0},format:{type:[String,Object]}},Da),yt({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},Da);const Ra={"vue-devtools-plugin-vue-i18n":"Vue I18n devtools","vue-i18n-resource-inspector":"I18n Resources","vue-i18n-timeline":"Vue I18n"},Uy={"vue-i18n-resource-inspector":"Search for scopes ..."},Hy={"vue-i18n-timeline":16764185},Nu="vue-i18n: composer properties";let Pa;async function Wy(t,e){return new Promise((n,o)=>{try{My({id:"vue-devtools-plugin-vue-i18n",label:Ra["vue-devtools-plugin-vue-i18n"],packageName:"vue-i18n",homepage:"https://vue-i18n.intlify.dev",logo:"https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png",componentStateTypes:[Nu],app:t},r=>{Pa=r,r.on.visitComponentTree(({componentInstance:s,treeNode:l})=>{Gy(s,l,e)}),r.on.inspectComponent(({componentInstance:s,instanceData:l})=>{s.vnode.el&&s.vnode.el.__VUE_I18N__&&l&&(e.mode==="legacy"?s.vnode.el.__VUE_I18N__!==e.global.__composer&&vu(l,s.vnode.el.__VUE_I18N__):vu(l,s.vnode.el.__VUE_I18N__))}),r.addInspector({id:"vue-i18n-resource-inspector",label:Ra["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:Uy["vue-i18n-resource-inspector"]}),r.on.getInspectorTree(s=>{s.app===t&&s.inspectorId==="vue-i18n-resource-inspector"&&Yy(s,e)});const i=new Map;r.on.getInspectorState(async s=>{if(s.app===t&&s.inspectorId==="vue-i18n-resource-inspector")if(r.unhighlightElement(),Zy(s,e),s.nodeId==="global"){if(!i.has(s.app)){const[l]=await r.getComponentInstances(s.app);i.set(s.app,l)}r.highlightElement(i.get(s.app))}else{const l=Qy(s.nodeId,e);l&&r.highlightElement(l)}}),r.on.editInspectorState(s=>{s.app===t&&s.inspectorId==="vue-i18n-resource-inspector"&&t1(s,e)}),r.addTimelineLayer({id:"vue-i18n-timeline",label:Ra["vue-i18n-timeline"],color:Hy["vue-i18n-timeline"]}),n(!0)})}catch(r){console.error(r),o(!1)}})}function Cu(t){return t.type.name||t.type.displayName||t.type.__file||"Anonymous"}function Gy(t,e,n){const o=n.mode==="composition"?n.global:n.global.__composer;if(t&&t.vnode.el&&t.vnode.el.__VUE_I18N__&&t.vnode.el.__VUE_I18N__!==o){const r={label:`i18n (${Cu(t)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(r)}}function vu(t,e){const n=Nu;t.state.push({type:n,key:"locale",editable:!0,value:e.locale.value}),t.state.push({type:n,key:"availableLocales",editable:!1,value:e.availableLocales}),t.state.push({type:n,key:"fallbackLocale",editable:!0,value:e.fallbackLocale.value}),t.state.push({type:n,key:"inheritLocale",editable:!0,value:e.inheritLocale}),t.state.push({type:n,key:"messages",editable:!1,value:La(e.messages.value)}),t.state.push({type:n,key:"datetimeFormats",editable:!1,value:e.datetimeFormats.value}),t.state.push({type:n,key:"numberFormats",editable:!1,value:e.numberFormats.value})}function La(t){const e={};return Object.keys(t).forEach(n=>{const o=t[n];qe(o)&&"source"in o?e[n]=Xy(o):jt(o)&&o.loc&&o.loc.source?e[n]=o.loc.source:Pe(o)?e[n]=La(o):e[n]=o}),e}const qy={"<":"&lt;",">":"&gt;",'"':"&quot;","&":"&amp;"};function Ky(t){return t.replace(/[<>"&]/g,Jy)}function Jy(t){return qy[t]||t}function Xy(t){return{_custom:{type:"function",display:`<span>ƒ</span> ${t.source?`("${Ky(t.source)}")`:"(?)"}`}}}function Yy(t,e){t.rootNodes.push({id:"global",label:"Global Scope"});const n=e.mode==="composition"?e.global:e.global.__composer;for(const[o,r]of e.__instances){const i=e.mode==="composition"?r:r.__composer;n!==i&&t.rootNodes.push({id:i.id.toString(),label:`${Cu(o)} Scope`})}}function Qy(t,e){let n=null;if(t!=="global"){for(const[o,r]of e.__instances.entries())if(r.id.toString()===t){n=o;break}}return n}function Tu(t,e){if(t==="global")return e.mode==="composition"?e.global:e.global.__composer;{const n=Array.from(e.__instances.values()).find(o=>o.id.toString()===t);return n?e.mode==="composition"?n:n.__composer:null}}function Zy(t,e){const n=Tu(t.nodeId,e);return n&&(t.state=e1(n)),null}function e1(t){const e={},n="Locale related info",o=[{type:n,key:"locale",editable:!0,value:t.locale.value},{type:n,key:"fallbackLocale",editable:!0,value:t.fallbackLocale.value},{type:n,key:"availableLocales",editable:!1,value:t.availableLocales},{type:n,key:"inheritLocale",editable:!0,value:t.inheritLocale}];e[n]=o;const r="Locale messages info",i=[{type:r,key:"messages",editable:!1,value:La(t.messages.value)}];e[r]=i;{const s="Datetime formats info",l=[{type:s,key:"datetimeFormats",editable:!1,value:t.datetimeFormats.value}];e[s]=l;const c="Datetime formats info",d=[{type:c,key:"numberFormats",editable:!1,value:t.numberFormats.value}];e[c]=d}return e}function $a(t,e){if(Pa){let n;e&&"groupId"in e&&(n=e.groupId,delete e.groupId),Pa.addTimelineEvent({layerId:"vue-i18n-timeline",event:{title:t,groupId:n,time:Date.now(),meta:{},data:e||{},logType:t==="compile-error"?"error":t==="fallback"||t==="missing"?"warning":"default"}})}}function t1(t,e){const n=Tu(t.nodeId,e);if(n){const[o]=t.path;o==="locale"&&me(t.state.value)?n.locale.value=t.state.value:o==="fallbackLocale"&&(me(t.state.value)||tt(t.state.value)||Pe(t.state.value))?n.fallbackLocale.value=t.state.value:o==="inheritLocale"&&Ke(t.state.value)&&(n.inheritLocale=t.state.value)}}const n1=fn("global-vue-i18n");function o1(t={},e){const n=Ke(t.globalInjection)?t.globalInjection:!0,o=!0,r=new Map,[i,s]=r1(t),l=fn(process.env.NODE_ENV!=="production"?"vue-i18n":"");process.env.NODE_ENV;function c(f){return r.get(f)||null}function d(f,p){r.set(f,p)}function u(f){r.delete(f)}{const f={get mode(){return"composition"},get allowComposition(){return o},async install(p,...h){if(process.env.NODE_ENV!=="production"&&(p.__VUE_I18N__=f),p.__VUE_I18N_SYMBOL__=l,p.provide(p.__VUE_I18N_SYMBOL__,f),Ve(h[0])){const g=h[0];f.__composerExtend=g.__composerExtend,f.__vueI18nExtend=g.__vueI18nExtend}let m=null;n&&(m=f1(p,f.global));const b=p.unmount;if(p.unmount=()=>{m&&m(),f.dispose(),b()},process.env.NODE_ENV!=="production"){if(!await Wy(p,f))throw Cn(Je.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const x=pd();{const v=s;v[br]&&v[br](x)}x.on("*",$a)}},get global(){return s},dispose(){i.stop()},__instances:r,__getInstance:c,__setInstance:d,__deleteInstance:u};return f}}function rn(t={}){const e=a.getCurrentInstance();if(e==null)throw Cn(Je.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw Cn(Je.NOT_INSTALLED);const n=i1(e),o=a1(n),r=mu(e),i=s1(t,r);if(i==="global")return $y(o,t,r),o;if(i==="parent"){let c=l1(n,e,t.__useComponent);return c==null&&(process.env.NODE_ENV!=="production"&&un(Ci(Mt.NOT_FOUND_PARENT_SCOPE)),c=o),c}const s=n;let l=s.__getInstance(e);if(l==null){const c=yt({},t);"__i18n"in r&&(c.__i18n=r.__i18n),o&&(c.__root=o),l=ku(c),s.__composerExtend&&(l[Oa]=s.__composerExtend(l)),d1(s,e,l),s.__setInstance(e,l)}return l}function r1(t,e,n){const o=a.effectScope();{const r=o.run(()=>ku(t));if(r==null)throw Cn(Je.UNEXPECTED_ERROR);return[o,r]}}function i1(t){{const e=a.inject(t.isCE?n1:t.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw Cn(t.isCE?Je.NOT_INSTALLED_WITH_PROVIDE:Je.UNEXPECTED_ERROR);return e}}function s1(t,e){return hi(t)?"__i18n"in e?"local":"global":t.useScope?t.useScope:"local"}function a1(t){return t.mode==="composition"?t.global:t.global.__composer}function l1(t,e,n=!1){let o=null;const r=e.root;let i=c1(e,n);for(;i!=null;){const s=t;if(t.mode==="composition"&&(o=s.__getInstance(i)),o!=null||r===i)break;i=i.parent}return o}function c1(t,e=!1){return t==null?null:e&&t.vnode.ctx||t.parent}function d1(t,e,n){let o=null;a.onMounted(()=>{if(process.env.NODE_ENV!=="production"&&e.vnode.el){e.vnode.el.__VUE_I18N__=n,o=pd();const r=n;r[br]&&r[br](o),o.on("*",$a)}},e),a.onUnmounted(()=>{const r=n;process.env.NODE_ENV!=="production"&&e.vnode.el&&e.vnode.el.__VUE_I18N__&&(o&&o.off("*",$a),r[Ia]&&r[Ia](),delete e.vnode.el.__VUE_I18N__),t.__deleteInstance(e);const i=r[Oa];i&&(i(),delete r[Oa])},e)}const u1=["locale","fallbackLocale","availableLocales"],zu=["t","rt","d","n","tm","te"];function f1(t,e){const n=Object.create(null);return u1.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i)throw Cn(Je.UNEXPECTED_ERROR);const s=a.isRef(i.value)?{get(){return i.value.value},set(l){i.value.value=l}}:{get(){return i.get&&i.get()}};Object.defineProperty(n,r,s)}),t.config.globalProperties.$i18n=n,zu.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i||!i.value)throw Cn(Je.UNEXPECTED_ERROR);Object.defineProperty(t.config.globalProperties,`$${r}`,i)}),()=>{delete t.config.globalProperties.$i18n,zu.forEach(r=>{delete t.config.globalProperties[`$${r}`]})}}if(Oy(),__INTLIFY_JIT_COMPILATION__?Vd(yy):Vd(by),ly(jb),cy(Rd),process.env.NODE_ENV!=="production"){const t=pr();t.__INTLIFY__=!0,Yb(t.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const _u="zcode-user-settings";function Lo(){try{const t=localStorage.getItem(_u);return t?JSON.parse(t):{}}catch(t){return console.warn("[ZeroCode] Failed to load user settings:",t),{}}}function Va(t){try{const e=Lo(),n={locale:t.locale??e.locale,cms:t.cms?{...e.cms||{},...t.cms}:e.cms,dev:t.dev?{...e.dev||{},...t.dev}:e.dev};localStorage.setItem(_u,JSON.stringify(n))}catch(e){console.warn("[ZeroCode] Failed to save user settings:",e)}}function p1(t=null){const e=Lo();return e.locale!==void 0?e.locale:t}function Au(){return Lo().cms||{}}function vi(t){const e=Lo();Va({cms:{...e.cms,...t}})}function h1(t,e){return Au()[t]??e}function Mu(){return Lo().dev||{}}function Ba(t){const e=Lo();Va({dev:{...e.dev,...t}})}function m1(t,e){return Mu()[t]??e}const Iu="zcode-dont-show-css-warning-parts";function g1(){try{return sessionStorage.getItem(Iu)==="true"}catch{return!1}}function b1(t){try{sessionStorage.setItem(Iu,String(t))}catch(e){console.warn("[ZeroCode] Failed to save CSS warning setting:",e)}}const y1={class:"zcode-settings-panel-header"},x1={class:"zcode-settings-panel-header-title",role:"heading","aria-level":"3"},E1={class:"zcode-settings-panel-header-actions"},k1=["value","aria-label"],w1={value:"ja"},S1={value:"en"},N1={class:"zcode-settings-panel-content"},C1={key:0},v1={key:0,class:"zcode-setting-item"},T1={class:"zcode-setting-label"},z1=["checked"],_1=["title"],A1={key:0,class:"zcode-setting-description"},M1={key:1,class:"zcode-setting-item"},I1={class:"zcode-setting-label"},O1=["checked"],D1=["title"],R1={key:0,class:"zcode-setting-description"},P1={key:2,class:"zcode-setting-item"},L1={class:"zcode-setting-label"},$1=["checked"],V1=["title"],B1={key:0,class:"zcode-setting-description"},F1={key:3,class:"zcode-setting-item"},j1={class:"zcode-setting-label"},U1=["checked"],H1=["title"],W1={key:0,class:"zcode-setting-description"},G1={key:1,class:"zcode-setting-item"},q1={class:"zcode-setting-info"},Ou=a.defineComponent({__name:"SettingsPanel",props:{isOpen:{type:Boolean},viewMode:{type:String},mode:{type:String},allowDynamicContentInteraction:{type:Boolean},devRightPadding:{type:Boolean},enableContextMenu:{type:Boolean},showSaveConfirm:{type:Boolean}},emits:["close","toggle-dynamic-content","toggle-dev-padding","toggle-context-menu","toggle-save-confirm"],setup(t){const e=t,{locale:n}=rn(),o=a.computed(()=>n.value||"ja");function r(u){const p=u.target.value;n.value=p,Va({locale:p})}const i=a.ref(!1),s=a.ref(!1),l=a.ref(!1),c=a.ref(!1),d=a.computed(()=>e.devRightPadding!==void 0?e.devRightPadding:!1);return(u,f)=>t.isOpen?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-settings-panel-overlay",onClick:f[10]||(f[10]=a.withModifiers(p=>u.$emit("close"),["self"]))},[a.createElementVNode("div",{class:"zcode-settings-panel",onClick:f[9]||(f[9]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",y1,[a.createElementVNode("div",x1,a.toDisplayString(u.$t("settings.title")),1),a.createElementVNode("div",E1,[a.createElementVNode("select",{value:o.value,class:"zcode-language-select","aria-label":u.$t("settings.language.label"),onChange:r},[a.createElementVNode("option",w1,a.toDisplayString(u.$t("settings.language.ja")),1),a.createElementVNode("option",S1,a.toDisplayString(u.$t("settings.language.en")),1)],40,k1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":"$t('common.close')",onClick:f[0]||(f[0]=p=>u.$emit("close"))},[a.createVNode(a.unref(Qe),{size:18})])])]),a.createElementVNode("div",N1,[t.viewMode==="manage"?(a.openBlock(),a.createElementBlock("div",C1,[e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",v1,[a.createElementVNode("label",T1,[a.createElementVNode("input",{type:"checkbox",checked:e.allowDynamicContentInteraction??!1,class:"zcode-setting-checkbox",onChange:f[1]||(f[1]=p=>u.$emit("toggle-dynamic-content",p.target.checked))},null,40,z1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.enableDynamicContent")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[2]||(f[2]=a.withModifiers(p=>i.value=!i.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,_1)]),i.value?(a.openBlock(),a.createElementBlock("div",A1,a.toDisplayString(u.$t("settings.enableDynamicContentDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",M1,[a.createElementVNode("label",I1,[a.createElementVNode("input",{type:"checkbox",checked:d.value,class:"zcode-setting-checkbox",onChange:f[3]||(f[3]=p=>u.$emit("toggle-dev-padding",p.target.checked))},null,40,O1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.devRightPadding")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[4]||(f[4]=a.withModifiers(p=>s.value=!s.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,D1)]),s.value?(a.openBlock(),a.createElementBlock("div",R1,a.toDisplayString(u.$t("settings.devRightPaddingDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",P1,[a.createElementVNode("label",L1,[a.createElementVNode("input",{type:"checkbox",checked:e.enableContextMenu??!1,class:"zcode-setting-checkbox",onChange:f[5]||(f[5]=p=>u.$emit("toggle-context-menu",p.target.checked))},null,40,$1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.enableContextMenu")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[6]||(f[6]=a.withModifiers(p=>l.value=!l.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,V1)]),l.value?(a.openBlock(),a.createElementBlock("div",B1,a.toDisplayString(u.$t("settings.enableContextMenuDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="dev-tabs"?(a.openBlock(),a.createElementBlock("div",F1,[a.createElementVNode("label",j1,[a.createElementVNode("input",{type:"checkbox",checked:e.showSaveConfirm??!0,class:"zcode-setting-checkbox",onChange:f[7]||(f[7]=p=>u.$emit("toggle-save-confirm",p.target.checked))},null,40,U1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.showSaveConfirm")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[8]||(f[8]=a.withModifiers(p=>c.value=!c.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,H1)]),c.value?(a.openBlock(),a.createElementBlock("div",W1,a.toDisplayString(u.$t("settings.showSaveConfirmDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)])):(a.openBlock(),a.createElementBlock("div",G1,[a.createElementVNode("div",q1,a.toDisplayString(u.$t("settings.previewModeInfo")),1)]))])])])):a.createCommentVNode("",!0)}});function pt(t){this.content=t}pt.prototype={constructor:pt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var o=n&&n!=t?this.remove(n):this,r=o.find(t),i=o.content.slice();return r==-1?i.push(n||t,e):(i[r+1]=e,n&&(i[r]=n)),new pt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new pt(n)},addToStart:function(t,e){return new pt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new pt(n)},addBefore:function(t,e,n){var o=this.remove(e),r=o.content.slice(),i=o.find(t);return r.splice(i==-1?r.length:i,0,e,n),new pt(r)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=pt.from(t),t.size?new pt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=pt.from(t),t.size?new pt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=pt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},pt.from=function(t){if(t instanceof pt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new pt(e)};function Du(t,e,n){for(let o=0;;o++){if(o==t.childCount||o==e.childCount)return t.childCount==e.childCount?null:n;let r=t.child(o),i=e.child(o);if(r==i){n+=r.nodeSize;continue}if(!r.sameMarkup(i))return n;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)n++;return n}if(r.content.size||i.content.size){let s=Du(r.content,i.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function Ru(t,e,n,o){for(let r=t.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:n,b:o};let s=t.child(--r),l=e.child(--i),c=s.nodeSize;if(s==l){n-=c,o-=c;continue}if(!s.sameMarkup(l))return{a:n,b:o};if(s.isText&&s.text!=l.text){let d=0,u=Math.min(s.text.length,l.text.length);for(;d<u&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,n--,o--;return{a:n,b:o}}if(s.content.size||l.content.size){let d=Ru(s.content,l.content,n-1,o-1);if(d)return d}n-=c,o-=c}}class oe{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,n,o,r=0,i){for(let s=0,l=0;l<n;s++){let c=this.content[s],d=l+c.nodeSize;if(d>e&&o(c,r+l,i||null,s)!==!1&&c.content.size){let u=l+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,n-u),o,r+u)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,o,r){let i="",s=!0;return this.nodesBetween(e,n,(l,c)=>{let d=l.isText?l.text.slice(Math.max(e,c)-c,n-c):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=d},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(o)&&(r[r.length-1]=n.withText(n.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new oe(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let o=[],r=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],c=s+l.nodeSize;c>e&&((s<e||c>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),o.push(l),r+=l.nodeSize),s=c}return new oe(o,r)}cutByIndex(e,n){return e==n?oe.empty:e==0&&n==this.content.length?this:new oe(this.content.slice(e,n))}replaceChild(e,n){let o=this.content[e];if(o==n)return this;let r=this.content.slice(),i=this.size+n.nodeSize-o.nodeSize;return r[e]=n,new oe(r,i)}addToStart(e){return new oe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new oe(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,o=0;n<this.content.length;n++){let r=this.content[n];e(r,o,n),o+=r.nodeSize}}findDiffStart(e,n=0){return Du(this,e,n)}findDiffEnd(e,n=this.size,o=e.size){return Ru(this,e,n,o)}findIndex(e){if(e==0)return Ti(0,e);if(e==this.size)return Ti(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,o=0;;n++){let r=this.child(n),i=o+r.nodeSize;if(i>=e)return i==e?Ti(n+1,i):Ti(n,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return oe.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new oe(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return oe.empty;let n,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(n||(n=e.slice(0,r)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new oe(n||e,o)}static from(e){if(!e)return oe.empty;if(e instanceof oe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new oe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}oe.empty=new oe([],0);const Fa={index:0,offset:0};function Ti(t,e){return Fa.index=t,Fa.offset=e,Fa}function zi(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let o=0;o<t.length;o++)if(!zi(t[o],e[o]))return!1}else{for(let o in t)if(!(o in e)||!zi(t[o],e[o]))return!1;for(let o in e)if(!(o in t))return!1}return!0}let je=class Ac{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,r)),n.push(this),o=!0),n&&n.push(i)}}return n||(n=e.slice()),o||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&zi(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[n.type];if(!o)throw new RangeError(`There is no mark type ${n.type} in this schema`);let r=o.create(n.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(n[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ac.none;if(e instanceof Ac)return[e];let n=e.slice();return n.sort((o,r)=>o.type.rank-r.type.rank),n}};je.none=[];class _i extends Error{}class fe{constructor(e,n,o){this.content=e,this.openStart=n,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let o=Lu(this.content,e+this.openStart,n);return o&&new fe(o,this.openStart,this.openEnd)}removeBetween(e,n){return new fe(Pu(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return fe.empty;let o=n.openStart||0,r=n.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new fe(oe.fromJSON(e,n.content),o,r)}static maxOpen(e,n=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)r++;return new fe(e,o,r)}}fe.empty=new fe(oe.empty,0,0);function Pu(t,e,n){let{index:o,offset:r}=t.findIndex(e),i=t.maybeChild(o),{index:s,offset:l}=t.findIndex(n);if(r==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(o!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(o,i.copy(Pu(i.content,e-r-1,n-r-1)))}function Lu(t,e,n,o){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r);if(i==e||s.isText)return o&&!o.canReplace(r,r,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=Lu(s.content,e-i-1,n,s);return l&&t.replaceChild(r,s.copy(l))}function K1(t,e,n){if(n.openStart>t.depth)throw new _i("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new _i("Inconsistent open depths");return $u(t,e,n,0)}function $u(t,e,n,o){let r=t.index(o),i=t.node(o);if(r==e.index(o)&&o<t.depth-n.openStart){let s=$u(t,e,n,o+1);return i.copy(i.content.replaceChild(r,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==o&&e.depth==o){let s=t.parent,l=s.content;return bo(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=J1(n,t);return bo(i,Bu(t,s,l,e,o))}else return bo(i,Ai(t,e,o))}function Vu(t,e){if(!e.type.compatibleContent(t.type))throw new _i("Cannot join "+e.type.name+" onto "+t.type.name)}function ja(t,e,n){let o=t.node(n);return Vu(o,e.node(n)),o}function go(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function xr(t,e,n,o){let r=(e||t).node(n),i=0,s=e?e.index(n):r.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(go(t.nodeAfter,o),i++));for(let l=i;l<s;l++)go(r.child(l),o);e&&e.depth==n&&e.textOffset&&go(e.nodeBefore,o)}function bo(t,e){return t.type.checkContent(e),t.copy(e)}function Bu(t,e,n,o,r){let i=t.depth>r&&ja(t,e,r+1),s=o.depth>r&&ja(n,o,r+1),l=[];return xr(null,t,r,l),i&&s&&e.index(r)==n.index(r)?(Vu(i,s),go(bo(i,Bu(t,e,n,o,r+1)),l)):(i&&go(bo(i,Ai(t,e,r+1)),l),xr(e,n,r,l),s&&go(bo(s,Ai(n,o,r+1)),l)),xr(o,null,r,l),new oe(l)}function Ai(t,e,n){let o=[];if(xr(null,t,n,o),t.depth>n){let r=ja(t,e,n+1);go(bo(r,Ai(t,e,n+1)),o)}return xr(e,null,n,o),new oe(o)}function J1(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)r=e.node(i).copy(oe.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class Er{constructor(e,n,o){this.pos=e,this.path=n,this.parentOffset=o,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],r=e.child(n);return o?e.child(n).cut(o):r}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let o=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)r+=o.child(i).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return je.none;if(this.textOffset)return e.child(n).marks;let o=e.maybeChild(n-1),r=e.maybeChild(n);if(!o){let l=o;o=r,r=l}let i=o.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let o=n.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!n||n(this.node(o))))return new Mi(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let o=[],r=0,i=n;for(let s=e;;){let{index:l,offset:c}=s.content.findIndex(i),d=i-c;if(o.push(s,l,r+c),!d||(s=s.child(l),s.isText))break;i=d-1,r+=c+1}return new Er(n,o,i)}static resolveCached(e,n){let o=Fu.get(e);if(o)for(let i=0;i<o.elts.length;i++){let s=o.elts[i];if(s.pos==n)return s}else Fu.set(e,o=new X1);let r=o.elts[o.i]=Er.resolve(e,n);return o.i=(o.i+1)%Y1,r}}class X1{constructor(){this.elts=[],this.i=0}}const Y1=12,Fu=new WeakMap;class Mi{constructor(e,n,o){this.$from=e,this.$to=n,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Q1=Object.create(null);let Gn=class Mc{constructor(e,n,o,r=je.none){this.type=e,this.attrs=n,this.marks=r,this.content=o||oe.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,o,r=0){this.content.nodesBetween(e,n,o,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,o,r){return this.content.textBetween(e,n,o,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,o){return this.type==e&&zi(this.attrs,n||e.defaultAttrs||Q1)&&je.sameSet(this.marks,o||je.none)}copy(e=null){return e==this.content?this:new Mc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Mc(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,o=!1){if(e==n)return fe.empty;let r=this.resolve(e),i=this.resolve(n),s=o?0:r.sharedDepth(n),l=r.start(s),d=r.node(s).content.cut(r.pos-l,i.pos-l);return new fe(d,r.depth-s,i.depth-s)}replace(e,n,o){return K1(this.resolve(e),this.resolve(n),o)}nodeAt(e){for(let n=this;;){let{index:o,offset:r}=n.content.findIndex(e);if(n=n.maybeChild(o),!n)return null;if(r==e||n.isText)return n;e-=r+1}}childAfter(e){let{index:n,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(n),index:n,offset:o};let r=this.content.child(n-1);return{node:r,index:n-1,offset:o-r.nodeSize}}resolve(e){return Er.resolveCached(this,e)}resolveNoCache(e){return Er.resolve(this,e)}rangeHasMark(e,n,o){let r=!1;return n>e&&this.nodesBetween(e,n,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),ju(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,o=oe.empty,r=0,i=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,r,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let c=r;c<i;c++)if(!this.type.allowsMarks(o.child(c).marks))return!1;return!0}canReplaceWith(e,n,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(o),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=je.none;for(let n=0;n<this.marks.length;n++){let o=this.marks[n];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!je.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let o;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,o)}let r=oe.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};Gn.prototype.text=void 0;class Ii extends Gn{constructor(e,n,o,r){if(super(e,n,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ju(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ii(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ii(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function ju(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class yo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let o=new Z1(e,n);if(o.next==null)return yo.empty;let r=Uu(o);o.next&&o.err("Unexpected trailing text");let i=s0(i0(r));return a0(i,o),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,o=e.childCount){let r=this;for(let i=n;r&&i<o;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let o=0;o<e.next.length;o++)if(this.next[n].type==e.next[o].type)return!0;return!1}fillBefore(e,n=!1,o=0){let r=[this];function i(s,l){let c=s.matchFragment(e,o);if(c&&(!n||c.validEnd))return oe.from(l.map(d=>d.createAndFill()));for(let d=0;d<s.next.length;d++){let{type:u,next:f}=s.next[d];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(f)==-1){r.push(f);let p=i(f,l.concat(u));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(e)){let s=[];for(let l=r;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:c}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!r.type||c.validEnd)&&(o.push({match:l.contentMatch,type:l,via:r}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&n(o.next[r].next)}return n(this),e.map((o,r)=>{let i=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)i+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return i}).join(`
349
- `)}}yo.empty=new yo(!0);class Z1{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Uu(t){let e=[];do e.push(e0(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function e0(t){let e=[];do e.push(t0(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function t0(t){let e=r0(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=n0(t,e);else break;return e}function Hu(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function n0(t,e){let n=Hu(t),o=n;return t.eat(",")&&(t.next!="}"?o=Hu(t):o=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:e}}function o0(t,e){let n=t.nodeTypes,o=n[e];if(o)return[o];let r=[];for(let i in n){let s=n[i];s.isInGroup(e)&&r.push(s)}return r.length==0&&t.err("No node type or group '"+e+"' found"),r}function r0(t){if(t.eat("(")){let e=Uu(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=o0(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function i0(t){let e=[[]];return r(i(t,0),n()),e;function n(){return e.push([])-1}function o(s,l,c){let d={term:c,to:l};return e[s].push(d),d}function r(s,l){s.forEach(c=>c.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((c,d)=>c.concat(i(d,l)),[]);if(s.type=="seq")for(let c=0;;c++){let d=i(s.exprs[c],l);if(c==s.exprs.length-1)return d;r(d,l=n())}else if(s.type=="star"){let c=n();return o(l,c),r(i(s.expr,c),c),[o(c)]}else if(s.type=="plus"){let c=n();return r(i(s.expr,l),c),r(i(s.expr,c),c),[o(c)]}else{if(s.type=="opt")return[o(l)].concat(i(s.expr,l));if(s.type=="range"){let c=l;for(let d=0;d<s.min;d++){let u=n();r(i(s.expr,c),u),c=u}if(s.max==-1)r(i(s.expr,c),c);else for(let d=s.min;d<s.max;d++){let u=n();o(c,u),r(i(s.expr,c),u),c=u}return[o(c)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Wu(t,e){return e-t}function Gu(t,e){let n=[];return o(e),n.sort(Wu);function o(r){let i=t[r];if(i.length==1&&!i[0].term)return o(i[0].to);n.push(r);for(let s=0;s<i.length;s++){let{term:l,to:c}=i[s];!l&&n.indexOf(c)==-1&&o(c)}}}function s0(t){let e=Object.create(null);return n(Gu(t,0));function n(o){let r=[];o.forEach(s=>{t[s].forEach(({term:l,to:c})=>{if(!l)return;let d;for(let u=0;u<r.length;u++)r[u][0]==l&&(d=r[u][1]);Gu(t,c).forEach(u=>{d||r.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let i=e[o.join(",")]=new yo(o.indexOf(t.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(Wu);i.next.push({type:r[s][0],next:e[l.join(",")]||n(l)})}return i}}function a0(t,e){for(let n=0,o=[t];n<o.length;n++){let r=o[n],i=!r.validEnd,s=[];for(let l=0;l<r.next.length;l++){let{type:c,next:d}=r.next[l];s.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),o.indexOf(d)==-1&&o.push(d)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function qu(t){let e=Object.create(null);for(let n in t){let o=t[n];if(!o.hasDefault)return null;e[n]=o.default}return e}function Ku(t,e){let n=Object.create(null);for(let o in t){let r=e&&e[o];if(r===void 0){let i=t[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}n[o]=r}return n}function Ju(t,e,n,o){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let r in t){let i=t[r];i.validate&&i.validate(e[r])}}function Xu(t,e){let n=Object.create(null);if(e)for(let o in e)n[o]=new c0(t,o,e[o]);return n}let Yu=class Bm{constructor(e,n,o){this.name=e,this.schema=n,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=Xu(e,o.attrs),this.defaultAttrs=qu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==yo.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Ku(this.attrs,e)}create(e=null,n,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Gn(this,this.computeAttrs(e),oe.from(n),je.setFrom(o))}createChecked(e=null,n,o){return n=oe.from(n),this.checkContent(n),new Gn(this,this.computeAttrs(e),n,je.setFrom(o))}createAndFill(e=null,n,o){if(e=this.computeAttrs(e),n=oe.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let r=this.contentMatch.matchFragment(n),i=r&&r.fillBefore(oe.empty,!0);return i?new Gn(this,e,n.append(i),je.setFrom(o)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ju(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?n&&n.push(e[o]):n||(n=e.slice(0,o));return n?n.length?n:je.none:e}static compile(e,n){let o=Object.create(null);e.forEach((i,s)=>o[i]=new Bm(i,n,s));let r=n.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function l0(t,e,n){let o=n.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${t}, got ${i}`)}}class c0{constructor(e,n,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?l0(e,n,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class Oi{constructor(e,n,o,r){this.name=e,this.rank=n,this.schema=o,this.spec=r,this.attrs=Xu(e,r.attrs),this.excluded=null;let i=qu(this.attrs);this.instance=i?new je(this,i):null}create(e=null){return!e&&this.instance?this.instance:new je(this,Ku(this.attrs,e))}static compile(e,n){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new Oi(i,r++,n,s)),o}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Ju(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Qu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let r in e)n[r]=e[r];n.nodes=pt.from(e.nodes),n.marks=pt.from(e.marks||{}),this.nodes=Yu.compile(this.spec.nodes,this),this.marks=Oi.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=o[s]||(o[s]=yo.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?Zu(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Zu(this,s.split(" "))}this.nodeFromJSON=r=>Gn.fromJSON(this,r),this.markFromJSON=r=>je.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Yu){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,o,r)}text(e,n){let o=this.nodes.text;return new Ii(o,o.defaultAttrs,e,je.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Zu(t,e){let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=t.marks[r],s=i;if(i)n.push(i);else for(let l in t.marks){let c=t.marks[l];(r=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(r)>-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return n}function d0(t){return t.tag!=null}function u0(t){return t.style!=null}let kr=class Ic{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let o=this.matchedStyles=[];n.forEach(r=>{if(d0(r))this.tags.push(r);else if(u0(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let o=new of(this,n,!1);return o.addAll(e,je.none,n.from,n.to),o.finish()}parseSlice(e,n={}){let o=new of(this,n,!0);return o.addAll(e,je.none,n.from,n.to),fe.maxOpen(o.finish())}matchTag(e,n,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(h0(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let c=s.getAttrs(n);if(c===!1)continue;s.attrs=c||void 0}return s}}}static schemaRules(e){let n=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=rf(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=rf(s)),s.node||s.ignore||s.mark||(s.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ic(e,Ic.schemaRules(e)))}};const ef={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},f0={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},tf={ol:!0,ul:!0},wr=1,Ua=2,Sr=4;function nf(t,e,n){return e!=null?(e?wr:0)|(e==="full"?Ua:0):t&&t.whitespace=="pre"?wr|Ua:n&~Sr}class Di{constructor(e,n,o,r,i,s){this.type=e,this.attrs=n,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=je.none,this.match=i||(s&Sr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(oe.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&wr)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let n=oe.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(oe.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ef.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class of{constructor(e,n,o){this.parser=e,this.options=n,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=n.topNode,i,s=nf(null,n.preserveWhitespace,0)|(o?Sr:0);r?i=new Di(r.type,r.attrs,je.none,!0,n.topMatch||r.type.contentMatch,s):o?i=new Di(null,null,je.none,!0,null,s):i=new Di(e.schema.topNodeType,null,je.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let o=e.nodeValue,r=this.top,i=r.options&Ua?"full":this.localPreserveWS||(r.options&wr)>0,{schema:s}=this.parser;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)if(i==="full")o=o.replace(/\r\n?/g,`
350
- `);else if(s.linebreakReplacement&&/[\r\n]/.test(o)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=o.split(/\r?\n|\r/);for(let c=0;c<l.length;c++)c&&this.insertNode(s.linebreakReplacement.create(),n,!0),l[c]&&this.insertNode(s.text(l[c]),n,!/\S/.test(l[c]));o=""}else o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let l=r.content[r.content.length-1],c=e.previousSibling;(!l||c&&c.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(o=o.slice(1))}o&&this.insertNode(s.text(o),n,!/\S/.test(o)),this.findInText(e)}else this.findInside(e)}addElement(e,n,o){let r=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;tf.hasOwnProperty(s)&&this.parser.normalizeLists&&p0(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(c?c.ignore:f0.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let d,u=this.needsBlock;if(ef.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),d=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let f=c&&c.skip?n:this.readStyles(e,n);f&&this.addAll(e,f),d&&this.sync(i),this.needsBlock=u}else{let d=this.readStyles(e,n);d&&this.addElementByRule(e,c,d,c.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
351
- `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.getPropertyValue(i);if(s)for(let l=void 0;;){let c=this.parser.matchStyle(i,s,this,l);if(!c)break;if(c.ignore)return null;if(c.clearMark?n=n.filter(d=>!c.clearMark(d)):n=n.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)l=c;else break}}return n}addElementByRule(e,n,o,r){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let c=this.enter(s,n.attrs||null,o,n.preserveWhitespace);c&&(i=!0,o=c)}else{let c=this.parser.schema.marks[n.mark];o=o.concat(c.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,o,!1));else{let c=e;typeof n.contentElement=="string"?c=e.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(e):n.contentElement&&(c=n.contentElement),this.findAround(e,c,!0),this.addAll(c,o),this.findAround(e,c,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,o){let r,i;for(let s=this.open,l=0;s>=0;s--){let c=this.nodes[s],d=c.findWrapping(e);if(d&&(!r||r.length>d.length+l)&&(r=d,i=c,!d.length))break;if(c.solid){if(o)break;l+=2}}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)n=this.enterInner(r[s],null,n,!1);return n}insertNode(e,n,o){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let r=this.findPlace(e,n,o);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=je.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):sf(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,o,r){let i=this.findPlace(e.create(n),o,!1);return i&&(i=this.enterInner(e,n,o,!0,r)),i}enterInner(e,n,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=nf(e,i,s.options);s.options&Sr&&s.content.length==0&&(l|=Sr);let c=je.none;return o=o.filter(d=>(s.type?s.type.allowsMarkType(d.type):sf(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new Di(e,n,c,r,null,l)),this.open++,o}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=wr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let o=this.nodes[n].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==n&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,o){if(e!=n&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&n.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,c)=>{for(;l>=0;l--){let d=n[l];if(d==""){if(l==n.length-1||l==0)continue;for(;c>=i;c--)if(s(l-1,c))return!0;return!1}else{let u=c>0||c==0&&r?this.nodes[c].type:o&&c>=i?o.node(c-i).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;c--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let n in this.parser.schema.nodes){let o=this.parser.schema.nodes[n];if(o.isTextblock&&o.defaultAttrs)return o}}}function p0(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&tf.hasOwnProperty(o)&&n?(n.appendChild(e),e=n):o=="li"?n=e:o&&(n=null)}}function h0(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function rf(t){let e={};for(let n in t)e[n]=t[n];return e}function sf(t,e){let n=e.schema.nodes;for(let o in n){let r=n[o];if(!r.allowsMarkType(t))continue;let i=[],s=l=>{i.push(l);for(let c=0;c<l.edgeCount;c++){let{type:d,next:u}=l.edge(c);if(d==e||i.indexOf(u)<0&&s(u))return!0}};if(s(r.contentMatch))return!0}}class xo{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},o){o||(o=Ha(n).createDocumentFragment());let r=o,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,c=0;for(;l<i.length&&c<s.marks.length;){let d=s.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(i[l][0])||d.type.spec.spanning===!1)break;l++,c++}for(;l<i.length;)r=i.pop()[1];for(;c<s.marks.length;){let d=s.marks[c++],u=this.serializeMark(d,s.isInline,n);u&&(i.push([d,r]),r.appendChild(u.dom),r=u.contentDOM||u.dom)}}r.appendChild(this.serializeNodeInner(s,n))}),o}serializeNodeInner(e,n){let{dom:o,contentDOM:r}=Ri(Ha(n),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,r)}return o}serializeNode(e,n={}){let o=this.serializeNodeInner(e,n);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(e,n,o={}){let r=this.marks[e.type.name];return r&&Ri(Ha(o),r(e,n),null,e.attrs)}static renderSpec(e,n,o=null,r){return Ri(e,n,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new xo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=af(e.nodes);return n.text||(n.text=o=>o.text),n}static marksFromSchema(e){return af(e.marks)}}function af(t){let e={};for(let n in t){let o=t[n].spec.toDOM;o&&(e[n]=o)}return e}function Ha(t){return t.document||window.document}const lf=new WeakMap;function m0(t){let e=lf.get(t);return e===void 0&&lf.set(t,e=g0(t)),e}function g0(t){let e=null;function n(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)n(o[r]);else for(let r in o)n(o[r])}return n(t),e}function Ri(t,e,n,o){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=m0(o))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(n=r.slice(0,s),r=r.slice(s+1));let l,c=n?t.createElementNS(n,r):t.createElement(r),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let f in d)if(d[f]!=null){let p=f.indexOf(" ");p>0?c.setAttributeNS(f.slice(0,p),f.slice(p+1),d[f]):f=="style"&&c.style?c.style.cssText=d[f]:c.setAttribute(f,d[f])}}for(let f=u;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:h,contentDOM:m}=Ri(t,p,n,o);if(c.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:c,contentDOM:l}}const cf=65535,df=Math.pow(2,16);function b0(t,e){return t+e*df}function uf(t){return t&cf}function y0(t){return(t-(t&cf))/df}const ff=1,pf=2,Pi=4,hf=8;class Wa{constructor(e,n,o){this.pos=e,this.delInfo=n,this.recover=o}get deleted(){return(this.delInfo&hf)>0}get deletedBefore(){return(this.delInfo&(ff|Pi))>0}get deletedAfter(){return(this.delInfo&(pf|Pi))>0}get deletedAcross(){return(this.delInfo&Pi)>0}}class Vt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Vt.empty)return Vt.empty}recover(e){let n=0,o=uf(e);if(!this.inverted)for(let r=0;r<o;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+n+y0(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[l+i],u=this.ranges[l+s],f=c+d;if(e<=f){let p=d?e==c?-1:e==f?1:n:n,h=c+r+(p<0?0:u);if(o)return h;let m=e==(n<0?c:f)?null:b0(l/3,e-c),b=e==c?pf:e==f?ff:Pi;return(n<0?e!=c:e!=f)&&(b|=hf),new Wa(h,b,m)}r+=u-d}return o?e+r:new Wa(e+r,0,null)}touches(e,n){let o=0,r=uf(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?o:0);if(c>e)break;let d=this.ranges[l+i],u=c+d;if(e<=u&&l==r*3)return!0;o+=this.ranges[l+s]-d}return!1}forEach(e){let n=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),c=s+(this.inverted?0:i),d=this.ranges[r+n],u=this.ranges[r+o];e(l,l+d,c,c+u),i+=u-d}}invert(){return new Vt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Vt.empty:new Vt(e<0?[0,-e,0]:[0,0,e])}}Vt.empty=new Vt([]);class Li{constructor(e,n,o=0,r=e?e.length:0){this.mirror=n,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Li(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,o=this._maps.length;n<e._maps.length;n++){let r=e.getMirror(n);this.appendMap(e._maps[n],r!=null&&r<n?o+r:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,o=this._maps.length+e._maps.length;n>=0;n--){let r=e.getMirror(n);this.appendMap(e._maps[n].invert(),r!=null&&r>n?o-r-1:void 0)}}invert(){let e=new Li;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,n);if(l.recover!=null){let c=this.getMirror(i);if(c!=null&&c>i&&c<this.to){i=c,e=this._maps[c].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new Wa(e,r,null)}}const Ga=Object.create(null);class xt{getMap(){return Vt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Ga[n.stepType];if(!o)throw new RangeError(`No step type ${n.stepType} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in Ga)throw new RangeError("Duplicate use of step JSON ID "+e);return Ga[e]=n,n.prototype.jsonID=e,n}}class nt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new nt(e,null)}static fail(e){return new nt(null,e)}static fromReplace(e,n,o,r){try{return nt.ok(e.replace(n,o,r))}catch(i){if(i instanceof _i)return nt.fail(i.message);throw i}}}function qa(t,e,n){let o=[];for(let r=0;r<t.childCount;r++){let i=t.child(r);i.content.size&&(i=i.copy(qa(i.content,e,i))),i.isInline&&(i=e(i,n,r)),o.push(i)}return oe.fromArray(o)}class qn extends xt{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new fe(qa(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),n.openStart,n.openEnd);return nt.fromReplace(e,this.from,this.to,i)}invert(){return new sn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new qn(n.pos,o.pos,this.mark)}merge(e){return e instanceof qn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new qn(n.from,n.to,e.markFromJSON(n.mark))}}xt.jsonID("addMark",qn);class sn extends xt{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=new fe(qa(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return nt.fromReplace(e,this.from,this.to,o)}invert(){return new qn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new sn(n.pos,o.pos,this.mark)}merge(e){return e instanceof sn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new sn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new sn(n.from,n.to,e.markFromJSON(n.mark))}}xt.jsonID("removeMark",sn);class Kn extends xt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nt.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return nt.fromReplace(e,this.pos,this.pos+1,new fe(oe.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let o=this.mark.addToSet(n.marks);if(o.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(o))return new Kn(this.pos,n.marks[r]);return new Kn(this.pos,this.mark)}}return new Eo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Kn(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Kn(n.pos,e.markFromJSON(n.mark))}}xt.jsonID("addNodeMark",Kn);class Eo extends xt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nt.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return nt.fromReplace(e,this.pos,this.pos+1,new fe(oe.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Kn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Eo(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Eo(n.pos,e.markFromJSON(n.mark))}}xt.jsonID("removeNodeMark",Eo);class ct extends xt{constructor(e,n,o,r=!1){super(),this.from=e,this.to=n,this.slice=o,this.structure=r}apply(e){return this.structure&&Ka(e,this.from,this.to)?nt.fail("Structure replace would overwrite content"):nt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Vt([this.from,this.to-this.from,this.slice.size])}invert(e){return new ct(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deletedAcross&&o.deletedAcross?null:new ct(n.pos,Math.max(n.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ct)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?fe.empty:new fe(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ct(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?fe.empty:new fe(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ct(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ct(n.from,n.to,fe.fromJSON(e,n.slice),!!n.structure)}}xt.jsonID("replace",ct);class dt extends xt{constructor(e,n,o,r,i,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Ka(e,this.from,this.gapFrom)||Ka(e,this.gapTo,this.to)))return nt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return nt.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,n.content);return o?nt.fromReplace(e,this.from,this.to,o):nt.fail("Content does not fit in gap")}getMap(){return new Vt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new dt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return n.deletedAcross&&o.deletedAcross||r<n.pos||i>o.pos?null:new dt(n.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new dt(n.from,n.to,n.gapFrom,n.gapTo,fe.fromJSON(e,n.slice),n.insert,!!n.structure)}}xt.jsonID("replaceAround",dt);function Ka(t,e,n){let o=t.resolve(e),r=n-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function x0(t,e,n,o){let r=[],i=[],s,l;t.doc.nodesBetween(e,n,(c,d,u)=>{if(!c.isInline)return;let f=c.marks;if(!o.isInSet(f)&&u.type.allowsMarkType(o.type)){let p=Math.max(d,e),h=Math.min(d+c.nodeSize,n),m=o.addToSet(f);for(let b=0;b<f.length;b++)f[b].isInSet(m)||(s&&s.to==p&&s.mark.eq(f[b])?s.to=h:r.push(s=new sn(p,h,f[b])));l&&l.to==p?l.to=h:i.push(l=new qn(p,h,o))}}),r.forEach(c=>t.step(c)),i.forEach(c=>t.step(c))}function E0(t,e,n,o){let r=[],i=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;i++;let c=null;if(o instanceof Oi){let d=s.marks,u;for(;u=o.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else o?o.isInSet(s.marks)&&(c=[o]):c=s.marks;if(c&&c.length){let d=Math.min(l+s.nodeSize,n);for(let u=0;u<c.length;u++){let f=c[u],p;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&f.eq(r[h].style)&&(p=m)}p?(p.to=d,p.step=i):r.push({style:f,from:Math.max(l,e),to:d,step:i})}}}),r.forEach(s=>t.step(new sn(s.from,s.to,s.style)))}function Ja(t,e,n,o=n.contentMatch,r=!0){let i=t.doc.nodeAt(e),s=[],l=e+1;for(let c=0;c<i.childCount;c++){let d=i.child(c),u=l+d.nodeSize,f=o.matchType(d.type);if(!f)s.push(new ct(l,u,fe.empty));else{o=f;for(let p=0;p<d.marks.length;p++)n.allowsMarkType(d.marks[p].type)||t.step(new sn(l,u,d.marks[p]));if(r&&d.isText&&n.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(d.text);)m||(m=new fe(oe.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),s.push(new ct(l+p.index,l+p.index+p[0].length,m))}}l=u}if(!o.validEnd){let c=o.fillBefore(oe.empty,!0);t.replace(l,l,new fe(c,0,0))}for(let c=s.length-1;c>=0;c--)t.step(s[c])}function k0(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function $o(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let o=t.depth,r=0,i=0;;--o){let s=t.$from.node(o),l=t.$from.index(o)+r,c=t.$to.indexAfter(o)-i;if(o<t.depth&&s.canReplace(l,c,n))return o;if(o==0||s.type.spec.isolating||!k0(s,l,c))break;l&&(r=1),c<s.childCount&&(i=1)}return null}function w0(t,e,n){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),c=s,d=l,u=oe.empty,f=0;for(let m=i,b=!1;m>n;m--)b||o.index(m)>0?(b=!0,u=oe.from(o.node(m).copy(u)),f++):c--;let p=oe.empty,h=0;for(let m=i,b=!1;m>n;m--)b||r.after(m+1)<r.end(m)?(b=!0,p=oe.from(r.node(m).copy(p)),h++):d++;t.step(new dt(c,d,s,l,new fe(u.append(p),f,h),u.size-f,!0))}function Xa(t,e,n=null,o=t){let r=S0(t,e),i=r&&N0(o,e);return i?r.map(mf).concat({type:e,attrs:n}).concat(i.map(mf)):null}function mf(t){return{type:t,attrs:null}}function S0(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.contentMatchAt(o).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(o,r,s)?i:null}function N0(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.child(o),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let c=(s.length?s[s.length-1]:e).contentMatch;for(let d=o;c&&d<r;d++)c=c.matchType(n.child(d).type);return!c||!c.validEnd?null:s}function C0(t,e,n){let o=oe.empty;for(let s=n.length-1;s>=0;s--){if(o.size){let l=n[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=oe.from(n[s].type.create(n[s].attrs,o))}let r=e.start,i=e.end;t.step(new dt(r,i,r,i,new fe(o,0,0),n.length,!0))}function v0(t,e,n,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let c=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,c)&&T0(t.doc,t.mapping.slice(i).map(l),o)){let d=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?d=!1:!h&&m&&(d=!0)}d===!1&&bf(t,s,l,i),Ja(t,t.mapping.slice(i).map(l,1),o,void 0,d===null);let u=t.mapping.slice(i),f=u.map(l,1),p=u.map(l+s.nodeSize,1);return t.step(new dt(f,p,f+1,p-1,new fe(oe.from(o.create(c,null,s.marks)),0,0),1,!0)),d===!0&&gf(t,s,l,i),!1}})}function gf(t,e,n,o){e.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let c=t.mapping.slice(o).map(n+1+i+s.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function bf(t,e,n,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=t.mapping.slice(o).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
352
- `))}})}function T0(t,e,n){let o=t.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,n)}function z0(t,e,n,o,r){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(o,null,r||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new dt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new fe(oe.from(s),0,0),1,!0))}function vn(t,e,n=1,o){let r=t.resolve(e),i=r.depth-n,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let d=r.depth-1,u=n-2;d>i;d--,u--){let f=r.node(d),p=r.index(d);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=o&&o[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let b=o&&o[u]||f;if(!f.canReplace(p+1,f.childCount)||!b.type.validContent(h))return!1}let l=r.indexAfter(i),c=o&&o[0];return r.node(i).canReplaceWith(l,l,c?c.type:r.node(i+1).type)}function _0(t,e,n=1,o){let r=t.doc.resolve(e),i=oe.empty,s=oe.empty;for(let l=r.depth,c=r.depth-n,d=n-1;l>c;l--,d--){i=oe.from(r.node(l).copy(i));let u=o&&o[d];s=oe.from(u?u.type.create(u.attrs,s):r.node(l).copy(s))}t.step(new ct(e,e,new fe(i.append(s),n,n),!0))}function Jn(t,e){let n=t.resolve(e),o=n.index();return yf(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(o,o+1)}function A0(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:o}=t.type.schema;for(let r=0;r<e.childCount;r++){let i=e.child(r),s=i.type==o?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function yf(t,e){return!!(t&&e&&!t.isLeaf&&A0(t,e))}function $i(t,e,n=-1){let o=t.resolve(e);for(let r=o.depth;;r--){let i,s,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,s=o.nodeAfter):n>0?(i=o.node(r+1),l++,s=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),s=o.node(r+1)),i&&!i.isTextblock&&yf(i,s)&&o.node(r).canReplace(l,l+1))return e;if(r==0)break;e=n<0?o.before(r):o.after(r)}}function M0(t,e,n){let o=null,{linebreakReplacement:r}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(r&&s.inlineContent){let u=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);u&&!f?o=!1:!u&&f&&(o=!0)}let l=t.steps.length;if(o===!1){let u=t.doc.resolve(e+n);bf(t,u.node(),u.before(),l)}s.inlineContent&&Ja(t,e+n-1,s,i.node().contentMatchAt(i.index()),o==null);let c=t.mapping.slice(l),d=c.map(e-n);if(t.step(new ct(d,c.map(e+n,-1),fe.empty,!0)),o===!0){let u=t.doc.resolve(d);gf(t,u.node(),u.before(),t.steps.length)}return t}function I0(t,e,n){let o=t.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),n))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,n))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,n))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function O0(t,e,n){let o=t.resolve(e);if(!n.content.size)return e;let r=n.content;for(let i=0;i<n.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=o.depth;s>=0;s--){let l=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,c=o.index(s)+(l>0?1:0),d=o.node(s),u=!1;if(i==1)u=d.canReplace(c,c,r);else{let f=d.contentMatchAt(c).findWrapping(r.firstChild.type);u=f&&d.canReplaceWith(c,c,f[0])}if(u)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function Vi(t,e,n=e,o=fe.empty){if(e==n&&!o.size)return null;let r=t.resolve(e),i=t.resolve(n);return xf(r,i,o)?new ct(e,n,o):new D0(r,i,o).fit()}function xf(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class D0{constructor(e,n,o){this.$from=e,this.$to=n,this.unplaced=o,this.frontier=[],this.placed=oe.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=oe.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let c=new fe(i,s,l);return e>-1?new dt(o.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||o.pos!=this.$to.pos?new ct(o.pos,r.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=n.firstChild;if(n.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}n=i.content}for(let n=1;n<=2;n++)for(let o=n==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=Ya(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:d}=this.frontier[l],u,f=null;if(n==1&&(s?d.matchType(s.type)||(f=d.fillBefore(oe.from(s),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(n==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:u};if(i&&d.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Ya(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new fe(e,n+1,Math.max(o,r.size+n>=e.size-o?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Ya(e,n);if(r.childCount<=1&&n>0){let i=e.size-n<=n+r.size;this.unplaced=new fe(Nr(e,n-1,1),n-1,i?n-1:o)}else this.unplaced=new fe(Nr(e,n,1),n,o)}placeNodes({sliceDepth:e,frontierDepth:n,parent:o,inject:r,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let b=0;b<i.length;b++)this.openFrontierNode(i[b]);let s=this.unplaced,l=o?o.content:s.content,c=s.openStart-e,d=0,u=[],{match:f,type:p}=this.frontier[n];if(r){for(let b=0;b<r.childCount;b++)u.push(r.child(b));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;d<l.childCount;){let b=l.child(d),g=f.matchType(b.type);if(!g)break;d++,(d>1||c==0||b.content.size)&&(f=g,u.push(Ef(b.mark(p.allowedMarks(b.marks)),d==1?c:0,d==l.childCount?h:-1)))}let m=d==l.childCount;m||(h=-1),this.placed=Cr(this.placed,n,oe.from(u)),this.frontier[n].match=f,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let b=0,g=l;b<h;b++){let x=g.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),g=x.content}this.unplaced=m?e==0?fe.empty:new fe(Nr(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new fe(Nr(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Qa(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:o,type:r}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Qa(e,n,r,o,i);if(s){for(let l=n-1;l>=0;l--){let{match:c,type:d}=this.frontier[l],u=Qa(e,l,d,c,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Cr(this.placed,n.depth,n.fit)),e=n.move;for(let o=n.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,n=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Cr(this.placed,this.depth,oe.from(e.create(n,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(oe.empty,!0);n.childCount&&(this.placed=Cr(this.placed,this.frontier.length,n))}}function Nr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Nr(t.firstChild.content,e-1,n)))}function Cr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Cr(t.lastChild.content,e-1,n)))}function Ya(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Ef(t,e,n){if(e<=0)return t;let o=t.content;return e>1&&(o=o.replaceChild(0,Ef(o.firstChild,e-1,o.childCount==1?n-1:0))),e>0&&(o=t.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(oe.empty,!0)))),t.copy(o)}function Qa(t,e,n,o,r){let i=t.node(e),s=r?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!R0(n,i.content,s)?l:null}function R0(t,e,n){for(let o=n;o<e.childCount;o++)if(!t.allowsMarks(e.child(o).marks))return!0;return!1}function P0(t){return t.spec.defining||t.spec.definingForContent}function L0(t,e,n,o){if(!o.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),i=t.doc.resolve(n);if(xf(r,i,o))return t.step(new ct(e,n,o));let s=wf(r,i);s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let p=r.depth,h=r.pos-1;p>0;p--,h--){let m=r.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?l=p:r.before(p)==h&&s.splice(1,0,-p)}let c=s.indexOf(l),d=[],u=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(d.push(m),h==o.openStart)break;p=m.content}for(let p=u-1;p>=0;p--){let h=d[p],m=P0(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))u=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+u+1)%(o.openStart+1),m=d[h];if(m)for(let b=0;b<s.length;b++){let g=s[(b+c)%s.length],x=!0;g<0&&(x=!1,g=-g);let v=r.node(g-1),w=r.index(g-1);if(v.canReplaceWith(w,w,m.type,m.marks))return t.replace(r.before(g),x?i.after(g):n,new fe(kf(o.content,0,o.openStart,h),h,o.openEnd))}}let f=t.steps.length;for(let p=s.length-1;p>=0&&(t.replace(e,n,o),!(t.steps.length>f));p--){let h=s[p];h<0||(e=r.before(h),n=i.after(h))}}function kf(t,e,n,o,r){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(kf(i.content,e+1,n,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(oe.empty,!0))}return t}function $0(t,e,n,o){if(!o.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=I0(t.doc,e,o.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new fe(oe.from(o),0,0))}function V0(t,e,n){let o=t.doc.resolve(e),r=t.doc.resolve(n),i=wf(o,r);for(let s=0;s<i.length;s++){let l=i[s],c=s==i.length-1;if(c&&l==0||o.node(l).type.contentMatch.validEnd)return t.delete(o.start(l),r.end(l));if(l>0&&(c||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return t.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&n>o.end(s)&&r.end(s)-n!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return t.delete(o.before(s),n);t.delete(e,n)}function wf(t,e){let n=[],o=Math.min(t.depth,e.depth);for(let r=o;r>=0;r--){let i=t.start(r);if(i<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&n.push(r)}return n}class Vo extends xt{constructor(e,n,o){super(),this.pos=e,this.attr=n,this.value=o}apply(e){let n=e.nodeAt(this.pos);if(!n)return nt.fail("No node at attribute step's position");let o=Object.create(null);for(let i in n.attrs)o[i]=n.attrs[i];o[this.attr]=this.value;let r=n.type.create(o,null,n.marks);return nt.fromReplace(e,this.pos,this.pos+1,new fe(oe.from(r),0,n.isLeaf?0:1))}getMap(){return Vt.empty}invert(e){return new Vo(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Vo(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Vo(n.pos,n.attr,n.value)}}xt.jsonID("attr",Vo);class vr extends xt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let o=e.type.create(n,e.content,e.marks);return nt.ok(o)}getMap(){return Vt.empty}invert(e){return new vr(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new vr(n.attr,n.value)}}xt.jsonID("docAttr",vr);let Bo=class extends Error{};Bo=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},Bo.prototype=Object.create(Error.prototype),Bo.prototype.constructor=Bo,Bo.prototype.name="TransformError";class Sf{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Li}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Bo(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,o=fe.empty){let r=Vi(this.doc,e,n,o);return r&&this.step(r),this}replaceWith(e,n,o){return this.replace(e,n,new fe(oe.from(o),0,0))}delete(e,n){return this.replace(e,n,fe.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,o){return L0(this,e,n,o),this}replaceRangeWith(e,n,o){return $0(this,e,n,o),this}deleteRange(e,n){return V0(this,e,n),this}lift(e,n){return w0(this,e,n),this}join(e,n=1){return M0(this,e,n),this}wrap(e,n){return C0(this,e,n),this}setBlockType(e,n=e,o,r=null){return v0(this,e,n,o,r),this}setNodeMarkup(e,n,o=null,r){return z0(this,e,n,o,r),this}setNodeAttribute(e,n,o){return this.step(new Vo(e,n,o)),this}setDocAttribute(e,n){return this.step(new vr(e,n)),this}addNodeMark(e,n){return this.step(new Kn(e,n)),this}removeNodeMark(e,n){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(n instanceof je)n.isInSet(o.marks)&&this.step(new Eo(e,n));else{let r=o.marks,i,s=[];for(;i=n.isInSet(r);)s.push(new Eo(e,i)),r=i.removeFromSet(r);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,n=1,o){return _0(this,e,n,o),this}addMark(e,n,o){return x0(this,e,n,o),this}removeMark(e,n,o){return E0(this,e,n,o),this}clearIncompatible(e,n,o){return Ja(this,e,n,o),this}}const Za=Object.create(null);class Le{constructor(e,n,o){this.$anchor=e,this.$head=n,this.ranges=o||[new B0(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=fe.empty){let o=n.content.lastChild,r=null;for(let l=0;l<n.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:c,$to:d}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(c.pos),u.map(d.pos),l?fe.empty:n),l==0&&vf(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,n){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],c=e.mapping.slice(o),d=c.map(s.pos),u=c.map(l.pos);i?e.deleteRange(d,u):(e.replaceRangeWith(d,u,n),vf(e,o,n.isInline?-1:1))}}static findFrom(e,n,o=!1){let r=e.parent.inlineContent?new Oe(e):Fo(e.node(0),e.parent,e.pos,e.index(),n,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=n<0?Fo(e.node(0),e.node(i),e.before(i+1),e.index(i),n,o):Fo(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,o);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Bt(e.node(0))}static atStart(e){return Fo(e,e,0,0,1)||new Bt(e)}static atEnd(e){return Fo(e,e,e.content.size,e.childCount,-1)||new Bt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Za[n.type];if(!o)throw new RangeError(`No selection type ${n.type} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in Za)throw new RangeError("Duplicate use of selection JSON ID "+e);return Za[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Oe.between(this.$anchor,this.$head).getBookmark()}}Le.prototype.visible=!0;class B0{constructor(e,n){this.$from=e,this.$to=n}}let Nf=!1;function Cf(t){!Nf&&!t.parent.inlineContent&&(Nf=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Oe extends Le{constructor(e,n=e){Cf(e),Cf(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let o=e.resolve(n.map(this.head));if(!o.parent.inlineContent)return Le.near(o);let r=e.resolve(n.map(this.anchor));return new Oe(r.parent.inlineContent?r:o,o)}replace(e,n=fe.empty){if(super.replace(e,n),n==fe.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof Oe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Bi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Oe(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){let r=e.resolve(n);return new this(r,o==n?r:e.resolve(o))}static between(e,n,o){let r=e.pos-n.pos;if((!o||r)&&(o=r>=0?1:-1),!n.parent.inlineContent){let i=Le.findFrom(n,o,!0)||Le.findFrom(n,-o,!0);if(i)n=i.$head;else return Le.near(n,o)}return e.parent.inlineContent||(r==0?e=n:(e=(Le.findFrom(e,-o,!0)||Le.findFrom(e,o,!0)).$anchor,e.pos<n.pos!=r<0&&(e=n))),new Oe(e,n)}}Le.jsonID("text",Oe);class Bi{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Bi(e.map(this.anchor),e.map(this.head))}resolve(e){return Oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ce extends Le{constructor(e){let n=e.nodeAfter,o=e.node(0).resolve(e.pos+n.nodeSize);super(e,o),this.node=n}map(e,n){let{deleted:o,pos:r}=n.mapResult(this.anchor),i=e.resolve(r);return o?Le.near(i):new Ce(i)}content(){return new fe(oe.from(this.node),0,0)}eq(e){return e instanceof Ce&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new el(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ce(e.resolve(n.anchor))}static create(e,n){return new Ce(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ce.prototype.visible=!1,Le.jsonID("node",Ce);class el{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:o}=e.mapResult(this.anchor);return n?new Bi(o,o):new el(o)}resolve(e){let n=e.resolve(this.anchor),o=n.nodeAfter;return o&&Ce.isSelectable(o)?new Ce(n):Le.near(n)}}class Bt extends Le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=fe.empty){if(n==fe.empty){e.delete(0,e.doc.content.size);let o=Le.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Bt(e)}map(e){return new Bt(e)}eq(e){return e instanceof Bt}getBookmark(){return F0}}Le.jsonID("all",Bt);const F0={map(){return this},resolve(t){return new Bt(t)}};function Fo(t,e,n,o,r,i=!1){if(e.inlineContent)return Oe.create(t,n);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let l=e.child(s);if(l.isAtom){if(!i&&Ce.isSelectable(l))return Ce.create(t,n-(r<0?l.nodeSize:0))}else{let c=Fo(t,l,n+r,r<0?l.childCount:0,r,i);if(c)return c}n+=l.nodeSize*r}return null}function vf(t,e,n){let o=t.steps.length-1;if(o<e)return;let r=t.steps[o];if(!(r instanceof ct||r instanceof dt))return;let i=t.mapping.maps[o],s;i.forEach((l,c,d,u)=>{s==null&&(s=u)}),t.setSelection(Le.near(t.doc.resolve(s),n))}const Tf=1,Fi=2,zf=4;class j0 extends Sf{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Tf)&~Fi,this.storedMarks=null,this}get selectionSet(){return(this.updated&Tf)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Fi,this}ensureMarks(e){return je.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Fi)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Fi,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let o=this.selection;return n&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||je.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,o){let r=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(o==null&&(o=n),!e)return this.deleteRange(n,o);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=o==n?s.marks():s.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(n,o,r.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Le.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=zf,this}get scrolledIntoView(){return(this.updated&zf)>0}}function _f(t,e){return!e||!t?t:t.bind(e)}class Tr{constructor(e,n,o){this.name=e,this.init=_f(n.init,o),this.apply=_f(n.apply,o)}}const U0=[new Tr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Tr("selection",{init(t,e){return t.selection||Le.atStart(e.doc)},apply(t){return t.selection}}),new Tr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,o){return o.selection.$cursor?t.storedMarks:null}}),new Tr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class tl{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=U0.slice(),n&&n.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new Tr(o.key,o.spec.state,o))})}}class jo{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let o=0;o<this.config.plugins.length;o++)if(o!=n){let r=this.config.plugins[o];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],o=this.applyInner(e),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let c=r?r[s].n:0,d=r?r[s].state:this,u=c<n.length&&l.spec.appendTransaction.call(l,c?n.slice(c):n,d,o);if(u&&o.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!r){r=[];for(let f=0;f<this.config.plugins.length;f++)r.push(f<s?{state:o,n:n.length}:{state:this,n:0})}n.push(u),o=o.applyInner(u),i=!0}r&&(r[s]={state:o,n:n.length})}}if(!i)return{state:o,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new jo(this.config),o=this.config.fields;for(let r=0;r<o.length;r++){let i=o[r];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new j0(this)}static create(e){let n=new tl(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new jo(n);for(let r=0;r<n.fields.length;r++)o[n.fields[r].name]=n.fields[r].init(e,o);return o}reconfigure(e){let n=new tl(this.schema,e.plugins),o=n.fields,r=new jo(n);for(let i=0;i<o.length;i++){let s=o[i].name;r[s]=this.hasOwnProperty(s)?this[s]:o[i].init(e,r)}return r}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[o],i=r.spec.state;i&&i.toJSON&&(n[o]=i.toJSON.call(r,this[r.key]))}return n}static fromJSON(e,n,o){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new tl(e.schema,e.plugins),i=new jo(r);return r.fields.forEach(s=>{if(s.name=="doc")i.doc=Gn.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=Le.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let l in o){let c=o[l],d=c.spec.state;if(c.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[s.name]=d.fromJSON.call(c,e,n[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function Af(t,e,n){for(let o in t){let r=t[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=Af(r,e,{})),n[o]=r}return n}class Ot{constructor(e){this.spec=e,this.props={},e.props&&Af(e.props,this,this.props),this.key=e.key?e.key.key:Mf("plugin")}getState(e){return e[this.key]}}const nl=Object.create(null);function Mf(t){return t in nl?t+"$"+ ++nl[t]:(nl[t]=0,t+"$")}class an{constructor(e="key"){this.key=Mf(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ol=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function If(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Of=(t,e,n)=>{let o=If(t,n);if(!o)return!1;let r=rl(o);if(!r){let s=o.blockRange(),l=s&&$o(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(jf(t,r,e,-1))return!0;if(o.parent.content.size==0&&(Uo(i,"end")||Ce.isSelectable(i)))for(let s=o.depth;;s--){let l=Vi(t.doc,o.before(s),o.after(s),fe.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(Uo(i,"end")?Le.findFrom(c.doc.resolve(c.mapping.map(r.pos,-1)),-1):Ce.create(c.doc,r.pos-i.nodeSize)),e(c.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},H0=(t,e,n)=>{let o=If(t,n);if(!o)return!1;let r=rl(o);return r?Df(t,r,e):!1},W0=(t,e,n)=>{let o=Pf(t,n);if(!o)return!1;let r=il(o);return r?Df(t,r,e):!1};function Df(t,e,n){let o=e.nodeBefore,r=o,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let u=r.lastChild;if(!u)return!1;r=u}let s=e.nodeAfter,l=s,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let d=Vi(t.doc,i,c,fe.empty);if(!d||d.from!=i||d instanceof ct&&d.slice.size>=c-i)return!1;if(n){let u=t.tr.step(d);u.setSelection(Oe.create(u.doc,i)),n(u.scrollIntoView())}return!0}function Uo(t,e,n=!1){for(let o=t;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(n&&o.childCount!=1)return!1}return!1}const Rf=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):o.parentOffset>0)return!1;i=rl(o)}let s=i&&i.nodeBefore;return!s||!Ce.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Ce.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function rl(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Pf(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Lf=(t,e,n)=>{let o=Pf(t,n);if(!o)return!1;let r=il(o);if(!r)return!1;let i=r.nodeAfter;if(jf(t,r,e,1))return!0;if(o.parent.content.size==0&&(Uo(i,"start")||Ce.isSelectable(i))){let s=Vi(t.doc,o.before(),o.after(),fe.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(Uo(i,"start")?Le.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):Ce.create(l.doc,l.mapping.map(r.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},$f=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):o.parentOffset<o.parent.content.size)return!1;i=il(o)}let s=i&&i.nodeAfter;return!s||!Ce.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Ce.create(t.doc,i.pos)).scrollIntoView()),!0)};function il(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const G0=(t,e)=>{let n=t.selection,o=n instanceof Ce,r;if(o){if(n.node.isTextblock||!Jn(t.doc,n.from))return!1;r=n.from}else if(r=$i(t.doc,n.from,-1),r==null)return!1;if(e){let i=t.tr.join(r);o&&i.setSelection(Ce.create(i.doc,r-t.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},q0=(t,e)=>{let n=t.selection,o;if(n instanceof Ce){if(n.node.isTextblock||!Jn(t.doc,n.to))return!1;o=n.to}else if(o=$i(t.doc,n.to,1),o==null)return!1;return e&&e(t.tr.join(o).scrollIntoView()),!0},K0=(t,e)=>{let{$from:n,$to:o}=t.selection,r=n.blockRange(o),i=r&&$o(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},Vf=(t,e)=>{let{$head:n,$anchor:o}=t.selection;return!n.parent.type.spec.code||!n.sameParent(o)?!1:(e&&e(t.tr.insertText(`
353
- `).scrollIntoView()),!0)};function sl(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const J0=(t,e)=>{let{$head:n,$anchor:o}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(o))return!1;let r=n.node(-1),i=n.indexAfter(-1),s=sl(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(e){let l=n.after(),c=t.tr.replaceWith(l,l,s.createAndFill());c.setSelection(Le.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},Bf=(t,e)=>{let n=t.selection,{$from:o,$to:r}=n;if(n instanceof Bt||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=sl(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=t.tr.insert(s,i.createAndFill());l.setSelection(Oe.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},Ff=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(vn(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let o=n.blockRange(),r=o&&$o(o);return r==null?!1:(e&&e(t.tr.lift(o,r).scrollIntoView()),!0)};function X0(t){return(e,n)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof Ce&&e.selection.node.isBlock)return!o.parentOffset||!vn(e.doc,o.pos)?!1:(n&&n(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],s,l,c=!1,d=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){c=o.end(h)==o.pos+(o.depth-h),d=o.start(h)==o.pos-(o.depth-h),l=sl(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(c&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof Oe||e.selection instanceof Bt)&&u.deleteSelection();let f=u.mapping.map(o.pos),p=vn(u.doc,f,i.length,i);if(p||(i[0]=l?{type:l}:null,p=vn(u.doc,f,i.length,i)),!p)return!1;if(u.split(f,i.length,i),!c&&d&&o.node(s).type!=l){let h=u.mapping.map(o.before(s)),m=u.doc.resolve(h);l&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,l)&&u.setNodeMarkup(u.mapping.map(o.before(s)),l)}return n&&n(u.scrollIntoView()),!0}}const Y0=X0(),Q0=(t,e)=>{let{$from:n,to:o}=t.selection,r,i=n.sharedDepth(o);return i==0?!1:(r=n.before(i),e&&e(t.tr.setSelection(Ce.create(t.doc,r))),!0)};function Z0(t,e,n){let o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(r.isTextblock||Jn(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function jf(t,e,n,o){let r=e.nodeBefore,i=e.nodeAfter,s,l,c=r.type.spec.isolating||i.type.spec.isolating;if(!c&&Z0(t,e,n))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(s=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,m=oe.empty;for(let x=s.length-1;x>=0;x--)m=oe.from(s[x].create(null,m));m=oe.from(r.copy(m));let b=t.tr.step(new dt(e.pos-1,h,e.pos,h,new fe(m,1,0),s.length,!0)),g=b.doc.resolve(h+2*s.length);g.nodeAfter&&g.nodeAfter.type==r.type&&Jn(b.doc,g.pos)&&b.join(g.pos),n(b.scrollIntoView())}return!0}let u=i.type.spec.isolating||o>0&&c?null:Le.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),p=f&&$o(f);if(p!=null&&p>=e.depth)return n&&n(t.tr.lift(f,p).scrollIntoView()),!0;if(d&&Uo(i,"start",!0)&&Uo(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let b=i,g=1;for(;!b.isTextblock;b=b.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,b.content)){if(n){let x=oe.empty;for(let w=m.length-1;w>=0;w--)x=oe.from(m[w].copy(x));let v=t.tr.step(new dt(e.pos-m.length,e.pos+i.nodeSize,e.pos+g,e.pos+i.nodeSize-g,new fe(x,m.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function Uf(t){return function(e,n){let o=e.selection,r=t<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(n&&n(e.tr.setSelection(Oe.create(e.doc,t<0?r.start(i):r.end(i)))),!0):!1}}const ex=Uf(-1),tx=Uf(1);function nx(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i),l=s&&Xa(s,t,e);return l?(o&&o(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Hf(t,e=null){return function(n,o){let r=!1;for(let i=0;i<n.selection.ranges.length&&!r;i++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(c,d)=>{if(r)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)r=!0;else{let u=n.doc.resolve(d),f=u.index();r=u.parent.canReplaceWith(f,f+1,t)}})}if(!r)return!1;if(o){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[s];i.setBlockType(l,c,t,e)}o(i.scrollIntoView())}return!0}}function al(...t){return function(e,n,o){for(let r=0;r<t.length;r++)if(t[r](e,n,o))return!0;return!1}}al(ol,Of,Rf),al(ol,Lf,$f),al(Vf,Bf,Ff,Y0),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function ox(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i);if(!s)return!1;let l=o?n.tr:null;return rx(l,s,t,e)?(o&&o(l.scrollIntoView()),!0):!1}}function rx(t,e,n,o=null){let r=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=s.resolve(e.start-2);i=new Mi(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new Mi(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=Xa(i,n,o,e);return l?(t&&ix(t,e,l,r,n),!0):!1}function ix(t,e,n,o,r){let i=oe.empty;for(let u=n.length-1;u>=0;u--)i=oe.from(n[u].type.create(n[u].attrs,i));t.step(new dt(e.start-(o?2:0),e.end,e.start,e.end,new fe(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==r&&(s=u+1);let l=n.length-s,c=e.start+n.length-(o?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,p=!0;u<f;u++,p=!1)!p&&vn(t.doc,c,l)&&(t.split(c,l),c+=2*l),c+=d.child(u).nodeSize;return t}function sx(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==t);return i?n?o.node(i.depth-1).type==t?ax(e,n,t,i):lx(e,n,i):!0:!1}}function ax(t,e,n,o){let r=t.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new dt(i-1,s,i,s,new fe(oe.from(n.create(null,o.parent.copy())),1,0),1,!0)),o=new Mi(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=$o(o);if(l==null)return!1;r.lift(o,l);let c=r.doc.resolve(r.mapping.map(i,-1)-1);return Jn(r.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&r.join(c.pos),e(r.scrollIntoView()),!0}function lx(t,e,n){let o=t.tr,r=n.parent;for(let h=n.end,m=n.endIndex-1,b=n.startIndex;m>b;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(n.start),s=i.nodeAfter;if(o.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,c=n.endIndex==r.childCount,d=i.node(-1),u=i.index(-1);if(!d.canReplace(u+(l?0:1),u+1,s.content.append(c?oe.empty:oe.from(r))))return!1;let f=i.pos,p=f+s.nodeSize;return o.step(new dt(f-(l?1:0),p+(c?1:0),f+1,p-1,new fe((l?oe.empty:oe.from(r.copy(oe.empty))).append(c?oe.empty:oe.from(r.copy(oe.empty))),l?0:1,c?0:1),l?0:1)),e(o.scrollIntoView()),!0}function cx(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,d=>d.childCount>0&&d.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,c=l.child(s-1);if(c.type!=t)return!1;if(n){let d=c.lastChild&&c.lastChild.type==l.type,u=oe.from(d?t.create():null),f=new fe(oe.from(t.create(null,oe.from(l.type.create(null,u)))),d?3:1,0),p=i.start,h=i.end;n(e.tr.step(new dt(p-(d?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}const ht=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ho=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let ll=null;const Tn=function(t,e,n){let o=ll||(ll=document.createRange());return o.setEnd(t,n??t.nodeValue.length),o.setStart(t,e||0),o},dx=function(){ll=null},ko=function(t,e,n,o){return n&&(Wf(t,e,n,o,-1)||Wf(t,e,n,o,1))},ux=/^(img|br|input|textarea|hr)$/i;function Wf(t,e,n,o,r){for(var i;;){if(t==n&&e==o)return!0;if(e==(r<0?0:Ht(t))){let s=t.parentNode;if(!s||s.nodeType!=1||zr(t)||ux.test(t.nodeName)||t.contentEditable=="false")return!1;e=ht(t)+(r<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(r<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=r;else return!1;else t=s,e=r<0?Ht(t):0}else return!1}}function Ht(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function fx(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Ht(t)}else if(t.parentNode&&!zr(t))e=ht(t),t=t.parentNode;else return null}}function px(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!zr(t))e=ht(t)+1,t=t.parentNode;else return null}}function hx(t,e,n){for(let o=e==0,r=e==Ht(t);o||r;){if(t==n)return!0;let i=ht(t);if(t=t.parentNode,!t)return!1;o=o&&i==0,r=r&&i==Ht(t)}}function zr(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const ji=function(t){return t.focusNode&&ko(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function wo(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function mx(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function gx(t,e,n){if(t.caretPositionFromPoint)try{let o=t.caretPositionFromPoint(e,n);if(o)return{node:o.offsetNode,offset:Math.min(Ht(o.offsetNode),o.offset)}}catch{}if(t.caretRangeFromPoint){let o=t.caretRangeFromPoint(e,n);if(o)return{node:o.startContainer,offset:Math.min(Ht(o.startContainer),o.startOffset)}}}const hn=typeof navigator<"u"?navigator:null,Gf=typeof document<"u"?document:null,Xn=hn&&hn.userAgent||"",cl=/Edge\/(\d+)/.exec(Xn),qf=/MSIE \d/.exec(Xn),dl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Xn),Dt=!!(qf||dl||cl),Yn=qf?document.documentMode:dl?+dl[1]:cl?+cl[1]:0,Wt=!Dt&&/gecko\/(\d+)/i.test(Xn);Wt&&+(/Firefox\/(\d+)/.exec(Xn)||[0,0])[1];const ul=!Dt&&/Chrome\/(\d+)/.exec(Xn),ut=!!ul,Kf=ul?+ul[1]:0,mt=!Dt&&!!hn&&/Apple Computer/.test(hn.vendor),Wo=mt&&(/Mobile\/\w+/.test(Xn)||!!hn&&hn.maxTouchPoints>2),Gt=Wo||(hn?/Mac/.test(hn.platform):!1),Jf=hn?/Win/.test(hn.platform):!1,zn=/Android \d/.test(Xn),_r=!!Gf&&"webkitFontSmoothing"in Gf.documentElement.style,bx=_r?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function yx(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function _n(t,e){return typeof t=="number"?t:t[e]}function xx(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,o=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*o}}function Xf(t,e,n){let o=t.someProp("scrollThreshold")||0,r=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=Ho(s);continue}let l=s,c=l==i.body,d=c?yx(i):xx(l),u=0,f=0;if(e.top<d.top+_n(o,"top")?f=-(d.top-e.top+_n(r,"top")):e.bottom>d.bottom-_n(o,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+_n(r,"top")-d.top:e.bottom-d.bottom+_n(r,"bottom")),e.left<d.left+_n(o,"left")?u=-(d.left-e.left+_n(r,"left")):e.right>d.right-_n(o,"right")&&(u=e.right-d.right+_n(r,"right")),u||f)if(c)i.defaultView.scrollBy(u,f);else{let h=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);let b=l.scrollLeft-h,g=l.scrollTop-m;e={left:e.left-b,top:e.top-g,right:e.right-b,bottom:e.bottom-g}}let p=c?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:Ho(s)}}function Ex(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),o,r;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=t.root.elementFromPoint(i,s);if(!l||l==t.dom||!t.dom.contains(l))continue;let c=l.getBoundingClientRect();if(c.top>=n-20){o=l,r=c.top;break}}return{refDOM:o,refTop:r,stack:Yf(t.dom)}}function Yf(t){let e=[],n=t.ownerDocument;for(let o=t;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),t!=n);o=Ho(o));return e}function kx({refDOM:t,refTop:e,stack:n}){let o=t?t.getBoundingClientRect().top:0;Qf(n,o==0?0:o-e)}function Qf(t,e){for(let n=0;n<t.length;n++){let{dom:o,top:r,left:i}=t[n];o.scrollTop!=r+e&&(o.scrollTop=r+e),o.scrollLeft!=i&&(o.scrollLeft=i)}}let Go=null;function wx(t){if(t.setActive)return t.setActive();if(Go)return t.focus(Go);let e=Yf(t);t.focus(Go==null?{get preventScroll(){return Go={preventScroll:!0},!0}}:void 0),Go||(Go=!1,Qf(e,0))}function Zf(t,e){let n,o=2e8,r,i=0,s=e.top,l=e.top,c,d;for(let u=t.firstChild,f=0;u;u=u.nextSibling,f++){let p;if(u.nodeType==1)p=u.getClientRects();else if(u.nodeType==3)p=Tn(u).getClientRects();else continue;for(let h=0;h<p.length;h++){let m=p[h];if(m.top<=s&&m.bottom>=l){s=Math.max(m.bottom,s),l=Math.min(m.top,l);let b=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(b<o){n=u,o=b,r=b&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&b&&(i=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=f+1)}}return!n&&c&&(n=c,r=d,o=0),n&&n.nodeType==3?Sx(n,r):!n||o&&n.nodeType==1?{node:t,offset:i}:Zf(n,r)}function Sx(t,e){let n=t.nodeValue.length,o=document.createRange(),r;for(let i=0;i<n;i++){o.setEnd(t,i+1),o.setStart(t,i);let s=Qn(o,1);if(s.top!=s.bottom&&fl(e,s)){r={node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return o.detach(),r||{node:t,offset:0}}function fl(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Nx(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Cx(t,e,n){let{node:o,offset:r}=Zf(e,n),i=-1;if(o.nodeType==1&&!o.firstChild){let s=o.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(o,r,i)}function vx(t,e,n,o){let r=-1;for(let i=e,s=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!0),c;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((c=l.dom.getBoundingClientRect()).width||c.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&c.left>o.left||c.top>o.top?r=l.posBefore:(!s&&c.right<o.left||c.bottom<o.top)&&(r=l.posAfter),s=!0),!l.contentDOM&&r<0&&!l.node.isText))return(l.node.isBlock?o.top<(c.top+c.bottom)/2:o.left<(c.left+c.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return r>-1?r:t.docView.posFromDOM(e,n,-1)}function ep(t,e,n){let o=t.childNodes.length;if(o&&n.top<n.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-n.top)/(n.bottom-n.top))-2)),i=r;;){let s=t.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(fl(e,d))return ep(s,e,d)}}if((i=(i+1)%o)==r)break}return t}function Tx(t,e){let n=t.dom.ownerDocument,o,r=0,i=gx(n,e.left,e.top);i&&({node:o,offset:r}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let d=t.dom.getBoundingClientRect();if(!fl(e,d)||(s=ep(t.dom,e,d),!s))return null}if(mt)for(let d=s;o&&d;d=Ho(d))d.draggable&&(o=void 0);if(s=Nx(s,e),o){if(Wt&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let u=o.childNodes[r],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&r++}let d;_r&&r&&o.nodeType==1&&(d=o.childNodes[r-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&r--,o==t.dom&&r==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(r==0||o.nodeType!=1||o.childNodes[r-1].nodeName!="BR")&&(l=vx(t,o,r,e))}l==null&&(l=Cx(t,s,e));let c=t.docView.nearestDesc(s,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function tp(t){return t.top<t.bottom||t.left<t.right}function Qn(t,e){let n=t.getClientRects();if(n.length){let o=n[e<0?0:n.length-1];if(tp(o))return o}return Array.prototype.find.call(n,tp)||t.getBoundingClientRect()}const zx=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function np(t,e,n){let{node:o,offset:r,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=_r||Wt;if(o.nodeType==3)if(s&&(zx.test(o.nodeValue)||(n<0?!r:r==o.nodeValue.length))){let c=Qn(Tn(o,r,r),n);if(Wt&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let d=Qn(Tn(o,r-1,r-1),-1);if(d.top==c.top){let u=Qn(Tn(o,r,r+1),-1);if(u.top!=c.top)return Ar(u,u.left<d.left)}}return c}else{let c=r,d=r,u=n<0?1:-1;return n<0&&!r?(d++,u=-1):n>=0&&r==o.nodeValue.length?(c--,u=1):n<0?c--:d++,Ar(Qn(Tn(o,c,d),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(n<0||r==Ht(o))){let c=o.childNodes[r-1];if(c.nodeType==1)return pl(c.getBoundingClientRect(),!1)}if(i==null&&r<Ht(o)){let c=o.childNodes[r];if(c.nodeType==1)return pl(c.getBoundingClientRect(),!0)}return pl(o.getBoundingClientRect(),n>=0)}if(i==null&&r&&(n<0||r==Ht(o))){let c=o.childNodes[r-1],d=c.nodeType==3?Tn(c,Ht(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return Ar(Qn(d,1),!1)}if(i==null&&r<Ht(o)){let c=o.childNodes[r];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?Tn(c,0,s?0:1):c.nodeType==1?c:null:null;if(d)return Ar(Qn(d,-1),!0)}return Ar(Qn(o.nodeType==3?Tn(o):o,-n),n>=0)}function Ar(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function pl(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function op(t,e,n){let o=t.state,r=t.root.activeElement;o!=e&&t.updateState(e),r!=t.dom&&t.focus();try{return n()}finally{o!=e&&t.updateState(o),r!=t.dom&&r&&r.focus()}}function _x(t,e,n){let o=e.selection,r=n=="up"?o.$from:o.$to;return op(t,e,()=>{let{node:i}=t.docView.domFromPos(r.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=np(t,r.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let c;if(l.nodeType==1)c=l.getClientRects();else if(l.nodeType==3)c=Tn(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const Ax=/[\u0590-\u08ac]/;function Mx(t,e,n){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,s=r==o.parent.content.size,l=t.domSelection();return l?!Ax.test(o.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:op(t,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:f}=t.domSelectionRange(),p=l.caretBidiLevel;l.modify("move",n,"character");let h=o.depth?t.docView.domAfterPos(o.before()):t.dom,{focusNode:m,focusOffset:b}=t.domSelectionRange(),g=m&&!h.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==b;try{l.collapse(u,f),c&&(c!=u||d!=f)&&l.extend&&l.extend(c,d)}catch{}return p!=null&&(l.caretBidiLevel=p),g}):o.pos==o.start()||o.pos==o.end()}let rp=null,ip=null,sp=!1;function Ix(t,e,n){return rp==e&&ip==n?sp:(rp=e,ip=n,sp=n=="up"||n=="down"?_x(t,e,n):Mx(t,e,n))}const qt=0,ap=1,So=2,mn=3;class Mr{constructor(e,n,o,r){this.parent=e,this.children=n,this.dom=o,this.contentDOM=r,this.dirty=qt,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,o){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,o=this.posAtStart;;n++){let r=this.children[n];if(r==e)return o;o+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=n>ht(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!1;break}if(i.previousSibling)break}if(r==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!0;break}if(i.nextSibling)break}}return r??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let o=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),s;if(i&&(!n||i.node))if(o&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))o=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let o=n;o;o=o.parent)if(o==this)return n}posFromDOM(e,n,o){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,n,o)}return-1}descAt(e){for(let n=0,o=0;n<this.children.length;n++){let r=this.children[n],i=o+r.size;if(o==e&&i!=o){for(;!r.border&&r.children.length;)for(let s=0;s<r.children.length;s++){let l=r.children[s];if(l.size){r=l;break}}return r}if(e<i)return r.descAt(e-o-r.border);o=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,r=0;for(let i=0;o<this.children.length;o++){let s=this.children[o],l=i+s.size;if(l>e||s instanceof dp){r=e-i;break}i=l}if(r)return this.children[o].domFromPos(r-this.children[o].border,n);for(let i;o&&!(i=this.children[o-1]).size&&i instanceof lp&&i.side>=0;o--);if(n<=0){let i,s=!0;for(;i=o?this.children[o-1]:null,!(!i||i.dom.parentNode==this.contentDOM);o--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?ht(i.dom)+1:0}}else{let i,s=!0;for(;i=o<this.children.length?this.children[o]:null,!(!i||i.dom.parentNode==this.contentDOM);o++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?ht(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=o,l=0;;l++){let c=this.children[l],d=s+c.size;if(r==-1&&e<=d){let u=s+c.border;if(e>=u&&n<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,u);e=s;for(let f=l;f>0;f--){let p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=ht(p.dom)+1;break}e-=p.size}r==-1&&(r=0)}if(r>-1&&(d>n||l==this.children.length-1)){n=d;for(let u=l+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=ht(f.dom);break}n+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=d}return{node:this.contentDOM,from:e,to:n,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:o}=this.domFromPos(e,0);if(n.nodeType!=1||o==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[o]}setSelection(e,n,o,r=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let h=0,m=0;h<this.children.length;h++){let b=this.children[h],g=m+b.size;if(i>m&&s<g)return b.setSelection(e-m-b.border,n-m-b.border,o,r);m=g}let l=this.domFromPos(e,e?-1:1),c=n==e?l:this.domFromPos(n,n?-1:1),d=o.root.getSelection(),u=o.domSelectionRange(),f=!1;if((Wt||mt)&&e==n){let{node:h,offset:m}=l;if(h.nodeType==3){if(f=!!(m&&h.nodeValue[m-1]==`
354
- `),f&&m==h.nodeValue.length)for(let b=h,g;b;b=b.parentNode){if(g=b.nextSibling){g.nodeName=="BR"&&(l=c={node:g.parentNode,offset:ht(g)+1});break}let x=b.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let b=h.childNodes[m-1];f=b&&(b.nodeName=="BR"||b.contentEditable=="false")}}if(Wt&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(r=!0)}if(!(r||f&&mt)&&ko(l.node,l.offset,u.anchorNode,u.anchorOffset)&&ko(c.node,c.offset,u.focusNode,u.focusOffset))return;let p=!1;if((d.extend||e==n)&&!(f&&Wt)){d.collapse(l.node,l.offset);try{e!=n&&d.extend(c.node,c.offset),p=!0}catch{}}if(!p){if(e>n){let m=l;l=c,c=m}let h=document.createRange();h.setEnd(c.node,c.offset),h.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let o=0,r=0;r<this.children.length;r++){let i=this.children[r],s=o+i.size;if(o==s?e<=s&&n>=o:e<s&&n>o){let l=o+i.border,c=s-i.border;if(e>=l&&n<=c){this.dirty=e==o||n==s?So:ap,e==l&&n==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=mn:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?So:mn}o=s}this.dirty=So}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let o=e==1?So:ap;n.dirty<o&&(n.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class lp extends Mr{constructor(e,n,o,r){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(o,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==qt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Ox extends Mr{constructor(e,n,o,r){super(e,[],n,null),this.textDOM=o,this.text=r}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class No extends Mr{constructor(e,n,o,r,i){super(e,[],o,r),this.mark=n,this.spec=i}static create(e,n,o,r){let i=r.nodeViews[n.type.name],s=i&&i(n,r,o);return(!s||!s.dom)&&(s=xo.renderSpec(document,n.type.spec.toDOM(n,o),null,n.attrs)),new No(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&mn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=mn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=qt){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=qt}}slice(e,n,o){let r=No.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;n<s&&(i=ml(i,n,s,o)),e>0&&(i=ml(i,0,e,o));for(let l=0;l<i.length;l++)i[l].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Zn extends Mr{constructor(e,n,o,r,i,s,l,c,d){super(e,[],i,s),this.node=n,this.outerDeco=o,this.innerDeco=r,this.nodeDOM=l}static create(e,n,o,r,i,s){let l=i.nodeViews[n.type.name],c,d=l&&l(n,i,()=>{if(!c)return s;if(c.parent)return c.parent.posBeforeChild(c)},o,r),u=d&&d.dom,f=d&&d.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=xo.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let p=u;return u=pp(u,o,n),d?c=new Dx(e,n,o,r,u,f||null,p,d,i,s+1):n.isText?new Ui(e,n,o,r,u,p,i):new Zn(e,n,o,r,u,f||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let o=this.children[n];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>oe.empty)}return e}matchesNode(e,n,o){return this.dirty==qt&&e.eq(this.node)&&Hi(n,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let o=this.node.inlineContent,r=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,c=new Px(this,s&&s.node,e);Vx(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?c.syncToMarks(d.spec.marks,o,e,u):d.type.side>=0&&!f&&c.syncToMarks(u==this.node.childCount?je.none:this.node.child(u).marks,o,e,u),c.placeWidget(d,e,r)},(d,u,f,p)=>{c.syncToMarks(d.marks,o,e,p);let h;c.findNodeMatch(d,u,f,p)||l&&e.state.selection.from>r&&e.state.selection.to<r+d.nodeSize&&(h=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(d,u,f,h,e)||c.updateNextNode(d,u,f,e,p,r)||c.addNode(d,u,f,e,r),r+=d.nodeSize}),c.syncToMarks([],o,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==So)&&(s&&this.protectLocalComposition(e,s),up(this.contentDOM,this.children,e),Wo&&Bx(this.dom))}localCompositionInfo(e,n){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof Oe)||o<n||r>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=Fx(this.node.content,s,o-n,r-n);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:o,text:r}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new Ox(this,i,n,r);e.input.compositionNodes.push(s),this.children=ml(this.children,o,o+r.length,e,s)}update(e,n,o,r){return this.dirty==mn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,o,r),!0)}updateInner(e,n,o,r){this.updateOuterDeco(n),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=qt}updateOuterDeco(e){if(Hi(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=fp(this.dom,this.nodeDOM,hl(this.outerDeco,this.node,n),hl(e,this.node,n)),this.dom!=o&&(o.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function cp(t,e,n,o,r){pp(o,e,t);let i=new Zn(void 0,t,e,n,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class Ui extends Zn{constructor(e,n,o,r,i,s,l){super(e,n,o,r,i,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,o,r){return this.dirty==mn||this.dirty!=qt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=qt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=qt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,o){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,o){let r=this.node.cut(e,n),i=document.createTextNode(r.text);return new Ui(this.parent,r,this.outerDeco,this.innerDeco,i,i,o)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=mn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class dp extends Mr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==qt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Dx extends Zn{constructor(e,n,o,r,i,s,l,c,d,u){super(e,n,o,r,i,s,l,d,u),this.spec=c}update(e,n,o,r){if(this.dirty==mn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,o);return i&&this.updateInner(e,n,o,r),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,o,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,o,r){this.spec.setSelection?this.spec.setSelection(e,n,o.root):super.setSelection(e,n,o,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function up(t,e,n){let o=t.firstChild,r=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==t){for(;l!=o;)o=hp(o),r=!0;o=o.nextSibling}else r=!0,t.insertBefore(l,o);if(s instanceof No){let c=o?o.previousSibling:t.lastChild;up(s.contentDOM,s.children,n),o=c?c.nextSibling:t.firstChild}}for(;o;)o=hp(o),r=!0;r&&n.trackWrites==t&&(n.trackWrites=null)}const Ir=function(t){t&&(this.nodeName=t)};Ir.prototype=Object.create(null);const Co=[new Ir];function hl(t,e,n){if(t.length==0)return Co;let o=n?Co[0]:new Ir,r=[o];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&r.push(o=new Ir(s.nodeName));for(let l in s){let c=s[l];c!=null&&(n&&r.length==1&&r.push(o=new Ir(e.isInline?"span":"div")),l=="class"?o.class=(o.class?o.class+" ":"")+c:l=="style"?o.style=(o.style?o.style+";":"")+c:l!="nodeName"&&(o[l]=c))}}}return r}function fp(t,e,n,o){if(n==Co&&o==Co)return e;let r=e;for(let i=0;i<o.length;i++){let s=o[i],l=n[i];if(i){let c;l&&l.nodeName==s.nodeName&&r!=t&&(c=r.parentNode)&&c.nodeName.toLowerCase()==s.nodeName||(c=document.createElement(s.nodeName),c.pmIsDeco=!0,c.appendChild(r),l=Co[0]),r=c}Rx(r,l||Co[0],s)}return r}function Rx(t,e,n){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in n)&&t.removeAttribute(o);for(let o in n)o!="class"&&o!="style"&&o!="nodeName"&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){let o=e.class?e.class.split(" ").filter(Boolean):[],r=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.remove(o[i]);for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.add(r[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=o.exec(e.style);)t.style.removeProperty(r[1])}n.style&&(t.style.cssText+=n.style)}}function pp(t,e,n){return fp(t,t,Co,hl(e,n,t.nodeType!=1))}function Hi(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function hp(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Px{constructor(e,n,o){this.lock=n,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Lx(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let o=e;o<n;o++)this.top.children[o].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,o,r){let i=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;i<l&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=qt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let c=-1,d=this.top.children.length;r<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let u=this.index;u<d;u++){let f=this.top.children[u];if(f.matchesMark(e[s])&&!this.isLocked(f.dom)){c=u;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let u=No.create(this.top,e[s],n,o);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,o,r){let i=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,o))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,c=Math.min(this.top.children.length,l+5);l<c;l++){let d=this.top.children[l];if(d.matchesNode(e,n,o)&&!this.preMatch.matched.has(d)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,o,r,i){let s=this.top.children[r];return s.dirty==mn&&s.dom==s.contentDOM&&(s.dirty=So),s.update(e,n,o,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==o)return r}return-1}e=n}}updateNextNode(e,n,o,r,i,s){for(let l=this.index;l<this.top.children.length;l++){let c=this.top.children[l];if(c instanceof Zn){let d=this.preMatch.matched.get(c);if(d!=null&&d!=i)return!1;let u=c.dom,f,p=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=mn&&Hi(n,c.outerDeco));if(!p&&c.update(e,n,o,r))return this.destroyBetween(this.index,l),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!p&&(f=this.recreateWrapper(c,e,n,o,r,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=So,f.updateChildren(r,s+1),f.dirty=qt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,o,r,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Hi(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=Zn.create(this.top,n,o,r,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let c of l.children)c.parent=l}return e.destroy(),l}addNode(e,n,o,r,i){let s=Zn.create(this.top,e,n,o,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,o){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let i=new lp(this.top,e,n,o);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof No;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Ui)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((mt||ut)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let r=new dp(this.top,[],o,null);n!=this.top?n.children.push(r):n.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Lx(t,e){let n=e,o=n.children.length,r=t.childCount,i=new Map,s=[];e:for(;r>0;){let l;for(;;)if(o){let d=n.children[o-1];if(d instanceof No)n=d,o=d.children.length;else{l=d,o--;break}}else{if(n==e)break e;o=n.parent.children.indexOf(n),n=n.parent}let c=l.node;if(c){if(c!=t.child(r-1))break;--r,i.set(l,r),s.push(l)}}return{index:r,matched:i,matches:s.reverse()}}function $x(t,e){return t.type.side-e.type.side}function Vx(t,e,n,o){let r=e.locals(t),i=0;if(r.length==0){for(let d=0;d<t.childCount;d++){let u=t.child(d);o(u,r,e.forChild(i,u),d),i+=u.nodeSize}return}let s=0,l=[],c=null;for(let d=0;;){let u,f;for(;s<r.length&&r[s].to==i;){let g=r[s++];g.widget&&(u?(f||(f=[u])).push(g):u=g)}if(u)if(f){f.sort($x);for(let g=0;g<f.length;g++)n(f[g],d,!!c)}else n(u,d,!!c);let p,h;if(c)h=-1,p=c,c=null;else if(d<t.childCount)h=d,p=t.child(d++);else break;for(let g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;s<r.length&&r[s].from<=i&&r[s].to>i;)l.push(r[s++]);let m=i+p.nodeSize;if(p.isText){let g=m;s<r.length&&r[s].from<g&&(g=r[s].from);for(let x=0;x<l.length;x++)l[x].to<g&&(g=l[x].to);g<m&&(c=p.cut(g-i),p=p.cut(0,g-i),m=g,h=-1)}else for(;s<r.length&&r[s].to<m;)s++;let b=p.isInline&&!p.isLeaf?l.filter(g=>!g.inline):l.slice();o(p,b,e.forChild(i,p),h),i=m}}function Bx(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Fx(t,e,n,o){for(let r=0,i=0;r<t.childCount&&i<=o;){let s=t.child(r++),l=i;if(i+=s.nodeSize,!s.isText)continue;let c=s.text;for(;r<t.childCount;){let d=t.child(r++);if(i+=d.nodeSize,!d.isText)break;c+=d.text}if(i>=n){if(i>=o&&c.slice(o-e.length-l,o-l)==e)return o-e.length;let d=l<o?c.lastIndexOf(e,o-l-1):-1;if(d>=0&&d+e.length+l>=n)return l+d;if(n==o&&c.length>=o+e.length-l&&c.slice(o-l,o-l+e.length)==e)return o}}return-1}function ml(t,e,n,o,r){let i=[];for(let s=0,l=0;s<t.length;s++){let c=t[s],d=l,u=l+=c.size;d>=n||u<=e?i.push(c):(d<e&&i.push(c.slice(0,e-d,o)),r&&(i.push(r),r=void 0),u>n&&i.push(c.slice(n-d,c.size,o)))}return i}function gl(t,e=null){let n=t.domSelectionRange(),o=t.state.doc;if(!n.focusNode)return null;let r=t.docView.nearestDesc(n.focusNode),i=r&&r.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=o.resolve(s),c,d;if(ji(n)){for(c=s;r&&!r.node;)r=r.parent;let f=r.node;if(r&&f.isAtom&&Ce.isSelectable(f)&&r.parent&&!(f.isInline&&hx(n.focusNode,n.focusOffset,r.dom))){let p=r.posBefore;d=new Ce(s==p?l:o.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=s,p=s;for(let h=0;h<n.rangeCount;h++){let m=n.getRangeAt(h);f=Math.min(f,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[c,s]=p==t.state.selection.anchor?[p,f]:[f,p],l=o.resolve(s)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=o.resolve(c);if(!d){let f=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;d=yl(t,u,l,f)}return d}function mp(t){return t.editable?t.hasFocus():wp(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function An(t,e=!1){let n=t.state.selection;if(xp(t,n),!!mp(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ut){let o=t.domSelectionRange(),r=t.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&ko(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Ux(t);else{let{anchor:o,head:r}=n,i,s;gp&&!(n instanceof Oe)&&(n.$from.parent.inlineContent||(i=bp(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=bp(t,n.to))),t.docView.setSelection(o,r,t,e),gp&&(i&&yp(i),s&&yp(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&jx(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const gp=mt||ut&&Kf<63;function bp(t,e){let{node:n,offset:o}=t.docView.domFromPos(e,0),r=o<n.childNodes.length?n.childNodes[o]:null,i=o?n.childNodes[o-1]:null;if(mt&&r&&r.contentEditable=="false")return bl(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return bl(r);if(i)return bl(i)}}function bl(t){return t.contentEditable="true",mt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function yp(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function jx(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),o=n.anchorNode,r=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=o||n.anchorOffset!=r)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!mp(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Ux(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,o=n.nodeName=="IMG";o?e.collapse(n.parentNode,ht(n)+1):e.collapse(n,0),!o&&!t.state.selection.visible&&Dt&&Yn<=11&&(n.disabled=!0,n.disabled=!1)}function xp(t,e){if(e instanceof Ce){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Ep(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Ep(t)}function Ep(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function yl(t,e,n,o){return t.someProp("createSelectionBetween",r=>r(t,e,n))||Oe.between(e,n,o)}function kp(t){return t.editable&&!t.hasFocus()?!1:wp(t)}function wp(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Hx(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ko(e.node,e.offset,n.anchorNode,n.anchorOffset)}function xl(t,e){let{$anchor:n,$head:o}=t.selection,r=e>0?n.max(o):n.min(o),i=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return i&&Le.findFrom(i,e)}function eo(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Sp(t,e,n){let o=t.state.selection;if(o instanceof Oe)if(n.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return eo(t,new Oe(o.$anchor,s))}else if(o.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=xl(t.state,e);return r&&r instanceof Ce?eo(t,r):!1}else if(!(Gt&&n.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?Ce.isSelectable(i)?eo(t,new Ce(e<0?t.state.doc.resolve(r.pos-i.nodeSize):r)):_r?eo(t,new Oe(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof Ce&&o.node.isInline)return eo(t,new Oe(e>0?o.$to:o.$from));{let r=xl(t.state,e);return r?eo(t,r):!1}}}function Wi(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Or(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function qo(t,e){return e<0?Wx(t):Gx(t)}function Wx(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r,i,s=!1;for(Wt&&n.nodeType==1&&o<Wi(n)&&Or(n.childNodes[o],-1)&&(s=!0);;)if(o>0){if(n.nodeType!=1)break;{let l=n.childNodes[o-1];if(Or(l,-1))r=n,i=--o;else if(l.nodeType==3)n=l,o=n.nodeValue.length;else break}}else{if(Np(n))break;{let l=n.previousSibling;for(;l&&Or(l,-1);)r=n.parentNode,i=ht(l),l=l.previousSibling;if(l)n=l,o=Wi(n);else{if(n=n.parentNode,n==t.dom)break;o=0}}}s?El(t,n,o):r&&El(t,r,i)}function Gx(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r=Wi(n),i,s;for(;;)if(o<r){if(n.nodeType!=1)break;let l=n.childNodes[o];if(Or(l,1))i=n,s=++o;else break}else{if(Np(n))break;{let l=n.nextSibling;for(;l&&Or(l,1);)i=l.parentNode,s=ht(l)+1,l=l.nextSibling;if(l)n=l,o=0,r=Wi(n);else{if(n=n.parentNode,n==t.dom)break;o=r=0}}}i&&El(t,i,s)}function Np(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function qx(t,e){for(;t&&e==t.childNodes.length&&!zr(t);)e=ht(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Kx(t,e){for(;t&&!e&&!zr(t);)e=ht(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function El(t,e,n){if(e.nodeType!=3){let i,s;(s=qx(e,n))?(e=s,n=0):(i=Kx(e,n))&&(e=i,n=i.nodeValue.length)}let o=t.domSelection();if(!o)return;if(ji(o)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(e,n);t.domObserver.setCurSelection();let{state:r}=t;setTimeout(()=>{t.state==r&&An(t)},50)}function Cp(t,e){let n=t.state.doc.resolve(e);if(!(ut||Jf)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function vp(t,e,n){let o=t.state.selection;if(o instanceof Oe&&!o.empty||n.indexOf("s")>-1||Gt&&n.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=xl(t.state,e);if(s&&s instanceof Ce)return eo(t,s)}if(!r.parent.inlineContent){let s=e<0?r:i,l=o instanceof Bt?Le.near(s,e):Le.findFrom(s,e);return l?eo(t,l):!1}return!1}function Tp(t,e){if(!(t.state.selection instanceof Oe))return!0;let{$head:n,$anchor:o,empty:r}=t.state.selection;if(!n.sameParent(o))return!0;if(!r)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function zp(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Jx(t){if(!mt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;zp(t,o,"true"),setTimeout(()=>zp(t,o,"false"),20)}return!1}function Xx(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Yx(t,e){let n=e.keyCode,o=Xx(e);if(n==8||Gt&&n==72&&o=="c")return Tp(t,-1)||qo(t,-1);if(n==46&&!e.shiftKey||Gt&&n==68&&o=="c")return Tp(t,1)||qo(t,1);if(n==13||n==27)return!0;if(n==37||Gt&&n==66&&o=="c"){let r=n==37?Cp(t,t.state.selection.from)=="ltr"?-1:1:-1;return Sp(t,r,o)||qo(t,r)}else if(n==39||Gt&&n==70&&o=="c"){let r=n==39?Cp(t,t.state.selection.from)=="ltr"?1:-1:1;return Sp(t,r,o)||qo(t,r)}else{if(n==38||Gt&&n==80&&o=="c")return vp(t,-1,o)||qo(t,-1);if(n==40||Gt&&n==78&&o=="c")return Jx(t)||vp(t,1,o)||qo(t,1);if(o==(Gt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function kl(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:o,openStart:r,openEnd:i}=e;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let h=o.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let s=t.someProp("clipboardSerializer")||xo.fromSchema(t.state.schema),l=Pp(),c=l.createElement("div");c.appendChild(s.serializeFragment(o,{document:l}));let d=c.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=Dp[d.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=l.createElement(u[h]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),f++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${r} ${i}${f?` -${f}`:""} ${JSON.stringify(n)}`);let p=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
355
-
356
- `);return{dom:c,text:p,slice:e}}function _p(t,e,n,o,r){let i=r.parent.type.spec.code,s,l;if(!n&&!e)return null;let c=!!e&&(o||i||!n);if(c){if(t.someProp("transformPastedText",p=>{e=p(e,i||o,t)}),i)return l=new fe(oe.from(t.state.schema.text(e.replace(/\r\n?/g,`
357
- `))),0,0),t.someProp("transformPasted",p=>{l=p(l,t,!0)}),l;let f=t.someProp("clipboardTextParser",p=>p(e,r,o,t));if(f)l=f;else{let p=r.marks(),{schema:h}=t.state,m=xo.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(b=>{let g=s.appendChild(document.createElement("p"));b&&g.appendChild(m.serializeNode(h.text(b,p)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),s=tE(n),_r&&nE(s);let d=s&&s.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||kr.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||u),context:r,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!Qx.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)l=oE(Op(l,+u[1],+u[2]),u[4]);else if(l=fe.maxOpen(Zx(l.content,r),!0),l.openStart||l.openEnd){let f=0,p=0;for(let h=l.content.firstChild;f<l.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=l.content.lastChild;p<l.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);l=Op(l,f,p)}return t.someProp("transformPasted",f=>{l=f(l,t,c)}),l}const Qx=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Zx(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(l=>{if(!s)return;let c=r.findWrapping(l.type),d;if(!c)return s=null;if(d=s.length&&i.length&&Mp(c,i,l,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=Ip(s[s.length-1],i.length));let u=Ap(l,c);s.push(u),r=r.matchType(u.type),i=c}}),s)return oe.from(s)}return t}function Ap(t,e,n=0){for(let o=e.length-1;o>=n;o--)t=e[o].create(null,oe.from(t));return t}function Mp(t,e,n,o,r){if(r<t.length&&r<e.length&&t[r]==e[r]){let i=Mp(t,e,n,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==t.length-1?n.type:t[r+1]))return o.copy(o.content.append(oe.from(Ap(n,t,r+1))))}}function Ip(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Ip(t.lastChild,e-1)),o=t.contentMatchAt(t.childCount).fillBefore(oe.empty,!0);return t.copy(n.append(o))}function wl(t,e,n,o,r,i){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(i=0),r<o-1&&(l=wl(l,e,n,o,r+1,i)),r>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(oe.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function Op(t,e,n){return e<t.openStart&&(t=new fe(wl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new fe(wl(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Dp={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Rp=null;function Pp(){return Rp||(Rp=document.implementation.createHTMLDocument("title"))}let Sl=null;function eE(t){let e=window.trustedTypes;return e?(Sl||(Sl=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Sl.createHTML(t)):t}function tE(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Pp().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t),r;if((r=o&&Dp[o[1].toLowerCase()])&&(t=r.map(i=>"<"+i+">").join("")+t+r.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=eE(t),r)for(let i=0;i<r.length;i++)n=n.querySelector(r[i])||n;return n}function nE(t){let e=t.querySelectorAll(ut?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let o=e[n];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),o)}}function oE(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return t}let{content:r,openStart:i,openEnd:s}=t;for(let l=o.length-2;l>=0;l-=2){let c=n.nodes[o[l]];if(!c||c.hasRequiredAttrs())break;r=oe.from(c.create(o[l+1],r)),i++,s++}return new fe(r,i,s)}const zt={},_t={},rE={touchstart:!0,touchmove:!0};class iE{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function sE(t){for(let e in zt){let n=zt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=o=>{lE(t,o)&&!Cl(t,o)&&(t.editable||!(o.type in _t))&&n(t,o)},rE[e]?{passive:!0}:void 0)}mt&&t.dom.addEventListener("input",()=>null),Nl(t)}function to(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function aE(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Nl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=o=>Cl(t,o))})}function Cl(t,e){return t.someProp("handleDOMEvents",n=>{let o=n[e.type];return o?o(t,e)||e.defaultPrevented:!1})}function lE(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function cE(t,e){!Cl(t,e)&&zt[e.type]&&(t.editable||!(e.type in _t))&&zt[e.type](t,e)}_t.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!$p(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(zn&&ut&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Wo&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let o=Date.now();t.input.lastIOSEnter=o,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==o&&(t.someProp("handleKeyDown",r=>r(t,wo(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",o=>o(t,n))||Yx(t,n)?n.preventDefault():to(t,"key")},_t.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},_t.keypress=(t,e)=>{let n=e;if($p(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Gt&&n.metaKey)return;if(t.someProp("handleKeyPress",r=>r(t,n))){n.preventDefault();return}let o=t.state.selection;if(!(o instanceof Oe)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!t.someProp("handleTextInput",s=>s(t,o.$from.pos,o.$to.pos,r,i))&&t.dispatch(i()),n.preventDefault()}};function Gi(t){return{left:t.clientX,top:t.clientY}}function dE(t,e){let n=e.x-t.clientX,o=e.y-t.clientY;return n*n+o*o<100}function vl(t,e,n,o,r){if(o==-1)return!1;let i=t.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,l=>s>i.depth?l(t,n,i.nodeAfter,i.before(s),r,!0):l(t,n,i.node(s),i.before(s),r,!1)))return!0;return!1}function Ko(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let o=t.state.tr.setSelection(e);o.setMeta("pointer",!0),t.dispatch(o)}function uE(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),o=n.nodeAfter;return o&&o.isAtom&&Ce.isSelectable(o)?(Ko(t,new Ce(n)),!0):!1}function fE(t,e){if(e==-1)return!1;let n=t.state.selection,o,r;n instanceof Ce&&(o=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(Ce.isSelectable(l)){o&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?r=i.before(n.$from.depth):r=i.before(s);break}}return r!=null?(Ko(t,Ce.create(t.state.doc,r)),!0):!1}function pE(t,e,n,o,r){return vl(t,"handleClickOn",e,n,o)||t.someProp("handleClick",i=>i(t,e,o))||(r?fE(t,n):uE(t,n))}function hE(t,e,n,o){return vl(t,"handleDoubleClickOn",e,n,o)||t.someProp("handleDoubleClick",r=>r(t,e,o))}function mE(t,e,n,o){return vl(t,"handleTripleClickOn",e,n,o)||t.someProp("handleTripleClick",r=>r(t,e,o))||gE(t,n,o)}function gE(t,e,n){if(n.button!=0)return!1;let o=t.state.doc;if(e==-1)return o.inlineContent?(Ko(t,Oe.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let s=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(s.inlineContent)Ko(t,Oe.create(o,l+1,l+1+s.content.size));else if(Ce.isSelectable(s))Ko(t,Ce.create(o,l));else continue;return!0}}function Tl(t){return qi(t)}const Lp=Gt?"metaKey":"ctrlKey";zt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let o=Tl(t),r=Date.now(),i="singleClick";r-t.input.lastClick.time<500&&dE(n,t.input.lastClick)&&!n[Lp]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(Gi(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new bE(t,s,n,!!o)):(i=="doubleClick"?hE:mE)(t,s.pos,s.inside,n)?n.preventDefault():to(t,"pointer"))};class bE{constructor(e,n,o,r){this.view=e,this.pos=n,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[Lp],this.allowDefault=o.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const l=r?null:o.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:d}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||d instanceof Ce&&d.from<=s&&d.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Wt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),to(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>An(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Gi(e))),this.updateAllowDefault(e),this.allowDefault||!n?to(this.view,"pointer"):pE(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||mt&&this.mightDrag&&!this.mightDrag.node.isAtom||ut&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Ko(this.view,Le.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):to(this.view,"pointer")}move(e){this.updateAllowDefault(e),to(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}zt.touchstart=t=>{t.input.lastTouch=Date.now(),Tl(t),to(t,"pointer")},zt.touchmove=t=>{t.input.lastTouch=Date.now(),to(t,"pointer")},zt.contextmenu=t=>Tl(t);function $p(t,e){return t.composing?!0:mt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const yE=zn?5e3:-1;_t.compositionstart=_t.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Oe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||ut&&Jf&&xE(t)))t.markCursor=t.state.storedMarks||n.marks(),qi(t,!0),t.markCursor=null;else if(qi(t,!e.selection.empty),Wt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let o=t.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else r=s,i=-1}}t.input.composing=!0}Vp(t,yE)};function xE(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let o=e.childNodes[n];return o.nodeType==1&&o.contentEditable=="false"}_t.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Vp(t,20))};function Vp(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>qi(t),e))}function Bp(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=kE());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function EE(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=fx(e.focusNode,e.focusOffset),o=px(e.focusNode,e.focusOffset);if(n&&o&&n!=o){let r=o.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||o==i)return i;if(!r||!r.isText(o.nodeValue))return o;if(t.input.compositionNode==o){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return o}}return n||o}function kE(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function qi(t,e=!1){if(!(zn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Bp(t),e||t.docView&&t.docView.dirty){let n=gl(t),o=t.state.selection;return n&&!n.eq(o)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function wE(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Dr=Dt&&Yn<15||Wo&&bx<604;zt.copy=_t.cut=(t,e)=>{let n=e,o=t.state.selection,r=n.type=="cut";if(o.empty)return;let i=Dr?null:n.clipboardData,s=o.content(),{dom:l,text:c}=kl(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",c)):wE(t,l),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function SE(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function NE(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,o=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),o.parentNode&&o.parentNode.removeChild(o),n?Rr(t,o.value,null,r,e):Rr(t,o.textContent,o.innerHTML,r,e)},50)}function Rr(t,e,n,o,r){let i=_p(t,e,n,o,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,r,i||fe.empty)))return!0;if(!i)return!1;let s=SE(i),l=s?t.state.tr.replaceSelectionWith(s,o):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Fp(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}_t.paste=(t,e)=>{let n=e;if(t.composing&&!zn)return;let o=Dr?null:n.clipboardData,r=t.input.shiftKey&&t.input.lastKeyCode!=45;o&&Rr(t,Fp(o),o.getData("text/html"),r,n)?n.preventDefault():NE(t,n)};class jp{constructor(e,n,o){this.slice=e,this.move=n,this.node=o}}const CE=Gt?"altKey":"ctrlKey";function Up(t,e){let n=t.someProp("dragCopies",o=>!o(e));return n??!e[CE]}zt.dragstart=(t,e)=>{let n=e,o=t.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let r=t.state.selection,i=r.empty?null:t.posAtCoords(Gi(n)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof Ce?r.to-1:r.to))){if(o&&o.mightDrag)s=Ce.create(t.state.doc,o.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(s=Ce.create(t.state.doc,f.posBefore))}}let l=(s||t.state.selection).content(),{dom:c,text:d,slice:u}=kl(t,l);(!n.dataTransfer.files.length||!ut||Kf>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Dr?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Dr||n.dataTransfer.setData("text/plain",d),t.dragging=new jp(u,Up(t,n),s)},zt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},_t.dragover=_t.dragenter=(t,e)=>e.preventDefault(),_t.drop=(t,e)=>{try{vE(t,e,t.dragging)}finally{t.dragging=null}};function vE(t,e,n){if(!e.dataTransfer)return;let o=t.posAtCoords(Gi(e));if(!o)return;let r=t.state.doc.resolve(o.pos),i=n&&n.slice;i?t.someProp("transformPasted",h=>{i=h(i,t,!1)}):i=_p(t,Fp(e.dataTransfer),Dr?null:e.dataTransfer.getData("text/html"),!1,r);let s=!!(n&&Up(t,e));if(t.someProp("handleDrop",h=>h(t,e,i||fe.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?O0(t.state.doc,r.pos,i):r.pos;l==null&&(l=r.pos);let c=t.state.tr;if(s){let{node:h}=n;h?h.replace(c):c.deleteSelection()}let d=c.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=c.doc;if(u?c.replaceRangeWith(d,d,i.content.firstChild):c.replaceRange(d,d,i),c.doc.eq(f))return;let p=c.doc.resolve(d);if(u&&Ce.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new Ce(p));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,b,g,x)=>h=x),c.setSelection(yl(t,p,c.doc.resolve(h)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}zt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&An(t)},20))},zt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},zt.beforeinput=(t,e)=>{if(ut&&zn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:o}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=o||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,wo(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in _t)zt[t]=_t[t];function Pr(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Ki{constructor(e,n){this.toDOM=e,this.spec=n||vo,this.side=this.spec.side||0}map(e,n,o,r){let{pos:i,deleted:s}=e.mapResult(n.from+r,this.side<0?-1:1);return s?null:new ln(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof Ki&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Pr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class no{constructor(e,n){this.attrs=e,this.spec=n||vo}map(e,n,o,r){let i=e.map(n.from+r,this.spec.inclusiveStart?-1:1)-o,s=e.map(n.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new ln(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof no&&Pr(this.attrs,e.attrs)&&Pr(this.spec,e.spec)}static is(e){return e.type instanceof no}destroy(){}}class zl{constructor(e,n){this.attrs=e,this.spec=n||vo}map(e,n,o,r){let i=e.mapResult(n.from+r,1);if(i.deleted)return null;let s=e.mapResult(n.to+r,-1);return s.deleted||s.pos<=i.pos?null:new ln(i.pos-o,s.pos-o,this)}valid(e,n){let{index:o,offset:r}=e.content.findIndex(n.from),i;return r==n.from&&!(i=e.child(o)).isText&&r+i.nodeSize==n.to}eq(e){return this==e||e instanceof zl&&Pr(this.attrs,e.attrs)&&Pr(this.spec,e.spec)}destroy(){}}class ln{constructor(e,n,o){this.from=e,this.to=n,this.type=o}copy(e,n){return new ln(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,o){return this.type.map(e,this,n,o)}static widget(e,n,o){return new ln(e,e,new Ki(n,o))}static inline(e,n,o,r){return new ln(e,n,new no(o,r))}static node(e,n,o,r){return new ln(e,n,new zl(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof no}get widget(){return this.type instanceof Ki}}const Jo=[],vo={};class ft{constructor(e,n){this.local=e.length?e:Jo,this.children=n.length?n:Jo}static create(e,n){return n.length?Ji(n,e,0,vo):Et}find(e,n,o){let r=[];return this.findInner(e??0,n??1e9,r,0,o),r}findInner(e,n,o,r,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,o,r+l,i)}}map(e,n,o){return this==Et||e.maps.length==0?this:this.mapInner(e,n,0,0,o||vo)}mapInner(e,n,o,r,i){let s;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,o,r);c&&c.type.valid(n,c)?(s||(s=[])).push(c):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?TE(this.children,s||[],e,n,o,r,i):s?new ft(s.sort(To),Jo):Et}add(e,n){return n.length?this==Et?ft.create(e,n):this.addInner(e,n,0):this}addInner(e,n,o){let r,i=0;e.forEach((l,c)=>{let d=c+o,u;if(u=Wp(n,l,d)){for(r||(r=this.children.slice());i<r.length&&r[i]<c;)i+=3;r[i]==c?r[i+2]=r[i+2].addInner(l,u,d+1):r.splice(i,0,c,c+l.nodeSize,Ji(u,l,d+1,vo)),i+=3}});let s=Hp(i?Gp(n):n,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new ft(s.length?this.local.concat(s).sort(To):this.local,r||this.children)}remove(e){return e.length==0||this==Et?this:this.removeInner(e,0)}removeInner(e,n){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let s,l=o[i]+n,c=o[i+1]+n;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>l&&f.to<c&&(e[u]=null,(s||(s=[])).push(f));if(!s)continue;o==this.children&&(o=this.children.slice());let d=o[i+2].removeInner(s,l+1);d!=Et?o[i+2]=d:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<r.length;l++)r[l].eq(s,n)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new ft(r,o):Et}forChild(e,n){if(this==Et)return this;if(n.isLeaf)return ft.empty;let o,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let i=e+1,s=i+n.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<s&&c.to>i&&c.type instanceof no){let d=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;d<u&&(r||(r=[])).push(c.copy(d,u))}}if(r){let l=new ft(r.sort(To),Jo);return o?new oo([l,o]):l}return o||Et}eq(e){if(this==e)return!0;if(!(e instanceof ft)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return _l(this.localsInner(e))}localsInner(e){if(this==Et)return Jo;if(e.inlineContent||!this.local.some(no.is))return this.local;let n=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof no||n.push(this.local[o]);return n}forEachSet(e){e(this)}}ft.empty=new ft([],[]),ft.removeOverlap=_l;const Et=ft.empty;class oo{constructor(e){this.members=e}map(e,n){const o=this.members.map(r=>r.map(e,n,vo));return oo.from(o)}forChild(e,n){if(n.isLeaf)return ft.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,n);i!=Et&&(i instanceof oo?o=o.concat(i.members):o.push(i))}return oo.from(o)}eq(e){if(!(e instanceof oo)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!n)n=i;else{o&&(n=n.slice(),o=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?_l(o?n:n.sort(To)):Jo}static from(e){switch(e.length){case 0:return Et;case 1:return e[0];default:return new oo(e.every(n=>n instanceof ft)?e:e.reduce((n,o)=>n.concat(o instanceof ft?o:o.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function TE(t,e,n,o,r,i,s){let l=t.slice();for(let d=0,u=i;d<n.maps.length;d++){let f=0;n.maps[d].forEach((p,h,m,b)=>{let g=b-m-(h-p);for(let x=0;x<l.length;x+=3){let v=l[x+1];if(v<0||p>v+u-f)continue;let w=l[x]+u-f;h>=w?l[x+1]=p<=w?-2:-1:p>=u&&g&&(l[x]+=g,l[x+1]+=g)}f+=g}),u=n.maps[d].map(u,-1)}let c=!1;for(let d=0;d<l.length;d+=3)if(l[d+1]<0){if(l[d+1]==-2){c=!0,l[d+1]=-1;continue}let u=n.map(t[d]+i),f=u-r;if(f<0||f>=o.content.size){c=!0;continue}let p=n.map(t[d+1]+i,-1),h=p-r,{index:m,offset:b}=o.content.findIndex(f),g=o.maybeChild(m);if(g&&b==f&&b+g.nodeSize==h){let x=l[d+2].mapInner(n,g,u+1,t[d]+i+1,s);x!=Et?(l[d]=f,l[d+1]=h,l[d+2]=x):(l[d+1]=-2,c=!0)}else c=!0}if(c){let d=zE(l,t,e,n,r,i,s),u=Ji(d,o,0,s);e=u.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,p=0;f<u.children.length;f+=3){let h=u.children[f];for(;p<l.length&&l[p]<h;)p+=3;l.splice(p,0,u.children[f],u.children[f+1],u.children[f+2])}}return new ft(e.sort(To),l)}function Hp(t,e){if(!e||!t.length)return t;let n=[];for(let o=0;o<t.length;o++){let r=t[o];n.push(new ln(r.from+e,r.to+e,r.type))}return n}function zE(t,e,n,o,r,i,s){function l(c,d){for(let u=0;u<c.local.length;u++){let f=c.local[u].map(o,r,d);f?n.push(f):s.onRemove&&s.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)l(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&l(t[c+2],e[c]+i+1);return n}function Wp(t,e,n){if(e.isLeaf)return null;let o=n+e.nodeSize,r=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<o&&((r||(r=[])).push(s),t[i]=null);return r}function Gp(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Ji(t,e,n,o){let r=[],i=!1;e.forEach((l,c)=>{let d=Wp(t,l,c+n);if(d){i=!0;let u=Ji(d,l,n+c+1,o);u!=Et&&r.push(c,c+l.nodeSize,u)}});let s=Hp(i?Gp(t):t,-n).sort(To);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(o.onRemove&&o.onRemove(s[l].spec),s.splice(l--,1));return s.length||r.length?new ft(s,r):Et}function To(t,e){return t.from-e.from||t.to-e.to}function _l(t){let e=t;for(let n=0;n<e.length-1;n++){let o=e[n];if(o.from!=o.to)for(let r=n+1;r<e.length;r++){let i=e[r];if(i.from==o.from){i.to!=o.to&&(e==t&&(e=t.slice()),e[r]=i.copy(i.from,o.to),qp(e,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(e==t&&(e=t.slice()),e[n]=o.copy(o.from,i.from),qp(e,r,o.copy(i.from,o.to)));break}}}return e}function qp(t,e,n){for(;e<t.length&&To(n,t[e])>0;)e++;t.splice(e,0,n)}function Al(t){let e=[];return t.someProp("decorations",n=>{let o=n(t.state);o&&o!=Et&&e.push(o)}),t.cursorWrapper&&e.push(ft.create(t.state.doc,[t.cursorWrapper.deco])),oo.from(e)}const _E={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},AE=Dt&&Yn<=11;class ME{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class IE{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ME,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let r=0;r<o.length;r++)this.queue.push(o[r]);Dt&&Yn<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():mt&&e.composing&&o.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),AE&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,_E)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(kp(this.view)){if(this.suppressingSelectionUpdates)return An(this.view);if(Dt&&Yn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ko(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,o;for(let i=e.focusNode;i;i=Ho(i))n.add(i);for(let i=e.anchorNode;i;i=Ho(i))if(n.has(i)){o=i;break}let r=o&&this.view.docView.nearestDesc(o);if(r&&r.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let o=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&kp(e)&&!this.ignoreSelectionChange(o),i=-1,s=-1,l=!1,c=[];if(e.editable)for(let u=0;u<n.length;u++){let f=this.registerMutation(n[u],c);f&&(i=i<0?f.from:Math.min(f.from,i),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(l=!0))}if(Wt&&c.length){let u=c.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,p]=u;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of u){let h=p.parentNode;h&&h.nodeName=="LI"&&(!f||RE(e,f)!=h)&&p.remove()}}}else if((ut||mt)&&c.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of c)if(u.nodeName=="BR"&&u.parentNode){let f=u.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&u.parentNode.removeChild(u)}}let d=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ji(o)&&(d=gl(e))&&d.eq(Le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,An(e),this.currentSelection.set(o),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,s),OE(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,PE(e,c)),this.handleDOMChange(i,s,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||An(e),this.currentSelection.set(o))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let f=e.addedNodes[u];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let r=e.previousSibling,i=e.nextSibling;if(Dt&&Yn<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:p}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(r=f),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(i=p)}let s=r&&r.parentNode==e.target?ht(r)+1:0,l=o.localPosFromDOM(e.target,s,-1),c=i&&i.parentNode==e.target?ht(i):e.target.childNodes.length,d=o.localPosFromDOM(e.target,c,1);return{from:l,to:d}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Kp=new WeakMap,Jp=!1;function OE(t){if(!Kp.has(t)&&(Kp.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Wt,Jp)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Jp=!0}}function Xp(t,e){let n=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return ko(s.node,s.offset,r,i)&&([n,o,r,i]=[r,i,n,o]),{anchorNode:n,anchorOffset:o,focusNode:r,focusOffset:i}}function DE(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return Xp(t,r)}let n;function o(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",o,!0),n?Xp(t,n):null}function RE(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let o=t.docView.nearestDesc(n,!0);if(o&&o.node.isBlock)return n}return null}function PE(t,e){var n;let{focusNode:o,focusOffset:r}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let c=l.firstChild;if(!c||c.nodeType!=1||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;l=c}l.insertBefore(i,l.firstChild),o==i&&t.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function LE(t,e,n){let{node:o,fromOffset:r,toOffset:i,from:s,to:l}=t.docView.parseRange(e,n),c=t.domSelectionRange(),d,u=c.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],ji(c)||d.push({node:c.focusNode,offset:c.focusOffset})),ut&&t.input.lastKeyCode===8)for(let g=i;g>r;g--){let x=o.childNodes[g-1],v=x.pmViewDesc;if(x.nodeName=="BR"&&!v){i=g;break}if(!v||v.size)break}let f=t.state.doc,p=t.someProp("domParser")||kr.fromSchema(t.state.schema),h=f.resolve(s),m=null,b=p.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:r,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:$E,context:h});if(d&&d[0].pos!=null){let g=d[0].pos,x=d[1]&&d[1].pos;x==null&&(x=g),m={anchor:g+s,head:x+s}}return{doc:b,sel:m,from:s,to:l}}function $E(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(mt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||mt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const VE=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function BE(t,e,n,o,r){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let y=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,E=gl(t,y);if(E&&!t.state.selection.eq(E)){if(ut&&zn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",O=>O(t,wo(13,"Enter"))))return;let k=t.state.tr.setSelection(E);y=="pointer"?k.setMeta("pointer",!0):y=="key"&&k.scrollIntoView(),i&&k.setMeta("composition",i),t.dispatch(k)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let c=t.state.selection,d=LE(t,e,n),u=t.state.doc,f=u.slice(d.from,d.to),p,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(p=t.state.selection.to,h="end"):(p=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let m=UE(f.content,d.doc.content,d.from,p,h);if(m&&t.input.domChangeCount++,(Wo&&t.input.lastIOSEnter>Date.now()-225||zn)&&r.some(y=>y.nodeType==1&&!VE.test(y.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",y=>y(t,wo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof Oe&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let y=Yp(t,t.state.doc,d.sel);if(y&&!y.eq(t.state.selection)){let E=t.state.tr.setSelection(y);i&&E.setMeta("composition",i),t.dispatch(E)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof Oe&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=d.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=d.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Dt&&Yn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let b=d.doc.resolveNoCache(m.start-d.from),g=d.doc.resolveNoCache(m.endB-d.from),x=u.resolve(m.start),v=b.sameParent(g)&&b.parent.inlineContent&&x.end()>=m.endA;if((Wo&&t.input.lastIOSEnter>Date.now()-225&&(!v||r.some(y=>y.nodeName=="DIV"||y.nodeName=="P"))||!v&&b.pos<d.doc.content.size&&(!b.sameParent(g)||!b.parent.inlineContent)&&b.pos<g.pos&&!/\S/.test(d.doc.textBetween(b.pos,g.pos,"","")))&&t.someProp("handleKeyDown",y=>y(t,wo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&jE(u,m.start,m.endA,b,g)&&t.someProp("handleKeyDown",y=>y(t,wo(8,"Backspace")))){zn&&ut&&t.domObserver.suppressSelectionUpdates();return}ut&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),zn&&!v&&b.start()!=g.start()&&g.parentOffset==0&&b.depth==g.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,g=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{t.someProp("handleKeyDown",function(y){return y(t,wo(13,"Enter"))})},20));let w=m.start,T=m.endA,M=y=>{let E=y||t.state.tr.replace(w,T,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let k=Yp(t,E.doc,d.sel);k&&!(ut&&t.composing&&k.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(k.head==w||k.head==E.mapping.map(T)-1)||Dt&&k.empty&&k.head==w)&&E.setSelection(k)}return i&&E.setMeta("composition",i),E.scrollIntoView()},A;if(v)if(b.pos==g.pos){Dt&&Yn<=11&&b.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>An(t),20));let y=M(t.state.tr.delete(w,T)),E=u.resolve(m.start).marksAcross(u.resolve(m.endA));E&&y.ensureMarks(E),t.dispatch(y)}else if(m.endA==m.endB&&(A=FE(b.parent.content.cut(b.parentOffset,g.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start())))){let y=M(t.state.tr);A.type=="add"?y.addMark(w,T,A.mark):y.removeMark(w,T,A.mark),t.dispatch(y)}else if(b.parent.child(b.index()).isText&&b.index()==g.index()-(g.textOffset?0:1)){let y=b.parent.textBetween(b.parentOffset,g.parentOffset),E=()=>M(t.state.tr.insertText(y,w,T));t.someProp("handleTextInput",k=>k(t,w,T,y,E))||t.dispatch(E())}else t.dispatch(M());else t.dispatch(M())}function Yp(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:yl(t,e.resolve(n.anchor),e.resolve(n.head))}function FE(t,e){let n=t.firstChild.marks,o=e.firstChild.marks,r=n,i=o,s,l,c;for(let u=0;u<o.length;u++)r=o[u].removeFromSet(r);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(r.length==1&&i.length==0)l=r[0],s="add",c=u=>u.mark(l.addToSet(u.marks));else if(r.length==0&&i.length==1)l=i[0],s="remove",c=u=>u.mark(l.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(oe.from(d).eq(t))return{mark:l,type:s}}function jE(t,e,n,o,r){if(n-e<=r.pos-o.pos||Ml(o,!0,!1)<r.pos)return!1;let i=t.resolve(e);if(!o.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(Ml(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Ml(s,!0,!1)<n?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function Ml(t,e,n){let o=t.depth,r=e?t.end():t.pos;for(;o>0&&(e||t.indexAfter(o)==t.node(o).childCount);)o--,r++,e=!1;if(n){let i=t.node(o).maybeChild(t.indexAfter(o));for(;i&&!i.isLeaf;)i=i.firstChild,r++}return r}function UE(t,e,n,o,r){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(r=="end"){let c=Math.max(0,i-Math.min(s,l));o-=s+c-i}if(s<i&&t.size<e.size){let c=o<=i&&o>=s?i-o:0;i-=c,i&&i<e.size&&Qp(e.textBetween(i-1,i+1))&&(i+=c?1:-1),l=i+(l-s),s=i}else if(l<i){let c=o<=i&&o>=l?i-o:0;i-=c,i&&i<t.size&&Qp(t.textBetween(i-1,i+1))&&(i+=c?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function Qp(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Zp{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new iE,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(rh),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=nh(this),th(this),this.nodeViews=oh(this),this.docView=cp(this.state.doc,eh(this),Al(this),this.dom,this),this.domObserver=new IE(this,(o,r,i,s)=>BE(this,o,r,i,s)),this.domObserver.start(),sE(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Nl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(rh),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let o in this._props)n[o]=this._props[o];n.state=this.state;for(let o in e)n[o]=e[o];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var o;let r=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Bp(this),s=!0),this.state=e;let l=r.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=oh(this);WE(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Nl(this),this.editable=nh(this),th(this);let c=Al(this),d=eh(this),u=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,d,c);(f||!e.selection.eq(r.selection))&&(s=!0);let p=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Ex(this);if(s){this.domObserver.stop();let h=f&&(Dt||ut)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&HE(r.selection,e.selection);if(f){let m=ut?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=EE(this)),(i||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=cp(e.doc,d,c,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Hx(this))?An(this,h):(xp(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((o=this.dragging)===null||o===void 0)&&o.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():p&&kx(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Ce){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Xf(this,n.getBoundingClientRect(),e)}else Xf(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let o=this.directPlugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let o=this.state.plugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let o=this.pluginViews[n];o.update&&o.update(this,e)}}updateDraggedNode(e,n){let o=e.node,r=-1;if(this.state.doc.nodeAt(o.from)==o.node)r=o.from;else{let i=o.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==o.node&&(r=i)}this.dragging=new jp(e.slice,e.move,r<0?void 0:Ce.create(this.state.doc,r))}someProp(e,n){let o=this._props&&this._props[e],r;if(o!=null&&(r=n?n(o):o))return r;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(r=n?n(l):l))return r}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(r=n?n(l):l))return r}}hasFocus(){if(Dt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&wx(this.dom),An(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Tx(this,e)}coordsAtPos(e,n=1){return np(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,o=-1){let r=this.docView.posFromDOM(e,n,o);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,n){return Ix(this,n||this.state,e)}pasteHTML(e,n){return Rr(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Rr(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return kl(this,e)}destroy(){this.docView&&(aE(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Al(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,dx())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return cE(this,e)}domSelectionRange(){let e=this.domSelection();return e?mt&&this.root.nodeType===11&&mx(this.dom.ownerDocument)==this.dom&&DE(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Zp.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function eh(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let o in n)o=="class"?e.class+=" "+n[o]:o=="style"?e.style=(e.style?e.style+";":"")+n[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(n[o]))}),e.translate||(e.translate="no"),[ln.node(0,t.state.doc.content.size,e)]}function th(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:ln.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function nh(t){return!t.someProp("editable",e=>e(t.state)===!1)}function HE(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function oh(t){let e=Object.create(null);function n(o){for(let r in o)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=o[r])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function WE(t,e){let n=0,o=0;for(let r in t){if(t[r]!=e[r])return!0;n++}for(let r in e)o++;return n!=o}function rh(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var ro={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Xi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},GE=typeof navigator<"u"&&/Mac/.test(navigator.platform),qE=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),gt=0;gt<10;gt++)ro[48+gt]=ro[96+gt]=String(gt);for(var gt=1;gt<=24;gt++)ro[gt+111]="F"+gt;for(var gt=65;gt<=90;gt++)ro[gt]=String.fromCharCode(gt+32),Xi[gt]=String.fromCharCode(gt);for(var Il in ro)Xi.hasOwnProperty(Il)||(Xi[Il]=ro[Il]);function KE(t){var e=GE&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||qE&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Xi:ro)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const JE=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),XE=typeof navigator<"u"&&/Win/.test(navigator.platform);function YE(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let o,r,i,s;for(let l=0;l<e.length-1;l++){let c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))JE?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+c)}return o&&(n="Alt-"+n),r&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function QE(t){let e=Object.create(null);for(let n in t)e[YE(n)]=t[n];return e}function Ol(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function ZE(t){return new Ot({props:{handleKeyDown:ek(t)}})}function ek(t){let e=QE(t);return function(n,o){let r=KE(o),i,s=e[Ol(r,o)];if(s&&s(n.state,n.dispatch,n))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[Ol(r,o,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(XE&&o.ctrlKey&&o.altKey)&&(i=ro[o.keyCode])&&i!=r){let l=e[Ol(i,o)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var tk=Object.defineProperty,Dl=(t,e)=>{for(var n in e)tk(t,n,{get:e[n],enumerable:!0})};function Yi(t){const{state:e,transaction:n}=t;let{selection:o}=n,{doc:r}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return o},get doc(){return r},get tr(){return o=n.selection,r=n.doc,i=n.storedMarks,n}}}var Qi=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:o}=e,{tr:r}=n,i=this.buildProps(r);return Object.fromEntries(Object.entries(t).map(([s,l])=>[s,(...d)=>{const u=l(...d)(i);return!r.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(r),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:o,state:r}=this,{view:i}=o,s=[],l=!!t,c=t||r.tr,d=()=>(!l&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(c),s.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(n).map(([f,p])=>[f,(...m)=>{const b=this.buildProps(c,e),g=p(...m)(b);return s.push(g),u}])),run:d};return u}createCan(t){const{rawCommands:e,state:n}=this,o=!1,r=t||n.tr,i=this.buildProps(r,o);return{...Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...d)=>c(...d)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,o)}}buildProps(t,e=!0){const{rawCommands:n,editor:o,state:r}=this,{view:i}=o,s={tr:t,editor:o,view:i,state:Yi({state:r,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,c])=>[l,(...d)=>c(...d)(s)]))}};return s}},ih={};Dl(ih,{blur:()=>nk,clearContent:()=>ok,clearNodes:()=>rk,command:()=>ik,createParagraphNear:()=>sk,cut:()=>ak,deleteCurrentNode:()=>lk,deleteNode:()=>ck,deleteRange:()=>dk,deleteSelection:()=>uk,enter:()=>fk,exitCode:()=>pk,extendMarkRange:()=>hk,first:()=>mk,focus:()=>bk,forEach:()=>yk,insertContent:()=>xk,insertContentAt:()=>wk,joinBackward:()=>Ck,joinDown:()=>Nk,joinForward:()=>vk,joinItemBackward:()=>Tk,joinItemForward:()=>zk,joinTextblockBackward:()=>_k,joinTextblockForward:()=>Ak,joinUp:()=>Sk,keyboardShortcut:()=>Ik,lift:()=>Ok,liftEmptyBlock:()=>Dk,liftListItem:()=>Rk,newlineInCode:()=>Pk,resetAttributes:()=>Lk,scrollIntoView:()=>$k,selectAll:()=>Vk,selectNodeBackward:()=>Bk,selectNodeForward:()=>Fk,selectParentNode:()=>jk,selectTextblockEnd:()=>Uk,selectTextblockStart:()=>Hk,setContent:()=>Wk,setMark:()=>uw,setMeta:()=>fw,setNode:()=>pw,setNodeSelection:()=>hw,setTextDirection:()=>mw,setTextSelection:()=>gw,sinkListItem:()=>bw,splitBlock:()=>yw,splitListItem:()=>xw,toggleList:()=>Ew,toggleMark:()=>kw,toggleNode:()=>ww,toggleWrap:()=>Sw,undoInputRule:()=>Nw,unsetAllMarks:()=>Cw,unsetMark:()=>vw,unsetTextDirection:()=>Tw,updateAttributes:()=>zw,wrapIn:()=>_w,wrapInList:()=>Aw});var nk=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),ok=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),rk=()=>({state:t,tr:e,dispatch:n})=>{const{selection:o}=e,{ranges:r}=o;return n&&r.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(l,c)=>{if(l.type.isText)return;const{doc:d,mapping:u}=e,f=d.resolve(u.map(c)),p=d.resolve(u.map(c+l.nodeSize)),h=f.blockRange(p);if(!h)return;const m=$o(h);if(l.type.isTextblock){const{defaultType:b}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,b)}(m||m===0)&&e.lift(h,m)})}),!0},ik=t=>e=>t(e),sk=()=>({state:t,dispatch:e})=>Bf(t,e),ak=(t,e)=>({editor:n,tr:o})=>{const{state:r}=n,i=r.doc.slice(t.from,t.to);o.deleteRange(t.from,t.to);const s=o.mapping.map(e);return o.insert(s,i.content),o.setSelection(new Oe(o.doc.resolve(Math.max(s-1,0)))),!0},lk=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,o=n.$anchor.node();if(o.content.size>0)return!1;const r=t.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const l=r.before(i),c=r.after(i);t.delete(l,c).scrollIntoView()}return!0}return!1};function ot(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var ck=t=>({tr:e,state:n,dispatch:o})=>{const r=ot(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r){if(o){const c=i.before(s),d=i.after(s);e.delete(c,d).scrollIntoView()}return!0}return!1},dk=t=>({tr:e,dispatch:n})=>{const{from:o,to:r}=t;return n&&e.delete(o,r),!0},uk=()=>({state:t,dispatch:e})=>ol(t,e),fk=()=>({commands:t})=>t.keyboardShortcut("Enter"),pk=()=>({state:t,dispatch:e})=>J0(t,e);function Rl(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Zi(t,e,n={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>n.strict?e[r]===t[r]:Rl(e[r])?e[r].test(t[r]):e[r]===t[r]):!0}function sh(t,e,n={}){return t.find(o=>o.type===e&&Zi(Object.fromEntries(Object.keys(n).map(r=>[r,o.attrs[r]])),n))}function ah(t,e,n={}){return!!sh(t,e,n)}function Pl(t,e,n){var o;if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===e)||(n=n||((o=r.node.marks[0])==null?void 0:o.attrs),!sh([...r.node.marks],e,n)))return;let s=r.index,l=t.start()+r.offset,c=s+1,d=l+r.node.nodeSize;for(;s>0&&ah([...t.parent.child(s-1).marks],e,n);)s-=1,l-=t.parent.child(s).nodeSize;for(;c<t.parent.childCount&&ah([...t.parent.child(c).marks],e,n);)d+=t.parent.child(c).nodeSize,c+=1;return{from:l,to:d}}function Mn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var hk=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const i=Mn(t,o.schema),{doc:s,selection:l}=n,{$from:c,from:d,to:u}=l;if(r){const f=Pl(c,i,e);if(f&&f.from<=d&&f.to>=u){const p=Oe.create(s,f.from,f.to);n.setSelection(p)}}return!0},mk=t=>e=>{const n=typeof t=="function"?t(e):t;for(let o=0;o<n.length;o+=1)if(n[o](e))return!0;return!1};function lh(t){return t instanceof Oe}function zo(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function ch(t,e=null){if(!e)return null;const n=Le.atStart(t),o=Le.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return o;const r=n.from,i=o.to;return e==="all"?Oe.create(t,zo(0,r,i),zo(t.content.size,r,i)):Oe.create(t,zo(e,r,i),zo(e,r,i))}function dh(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function es(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function gk(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var bk=(t=null,e={})=>({editor:n,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(es()||dh())&&o.dom.focus(),gk()&&!es()&&!dh()&&o.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(o.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(o.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!lh(n.state.selection))return s(),!0;const l=ch(r.doc,t)||n.state.selection,c=n.state.selection.eq(l);return i&&(c||r.setSelection(l),c&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},yk=(t,e)=>n=>t.every((o,r)=>e(o,{...n,index:r})),xk=(t,e)=>({tr:n,commands:o})=>o.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),uh=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const o=e[n];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?t.removeChild(o):o.nodeType===1&&uh(o)}return t};function ts(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return uh(n)}function Lr(t,e,n){if(t instanceof Gn||t instanceof oe)return t;n={slice:!0,parseOptions:{},...n};const o=typeof t=="object"&&t!==null,r=typeof t=="string";if(o)try{if(Array.isArray(t)&&t.length>0)return oe.fromArray(t.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),Lr("",e,n)}if(r){if(n.errorOnInvalidContent){let s=!1,l="";const c=new Qu({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(s=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(n.slice?kr.fromSchema(c).parseSlice(ts(t),n.parseOptions):kr.fromSchema(c).parse(ts(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=kr.fromSchema(e);return n.slice?i.parseSlice(ts(t),n.parseOptions).content:i.parse(ts(t),n.parseOptions)}return Lr("",e,n)}function Ek(t,e,n){const o=t.steps.length-1;if(o<e)return;const r=t.steps[o];if(!(r instanceof ct||r instanceof dt))return;const i=t.mapping.maps[o];let s=0;i.forEach((l,c,d,u)=>{s===0&&(s=u)}),t.setSelection(Le.near(t.doc.resolve(s),n))}var kk=t=>!("type"in t),wk=(t,e,n)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const c=g=>{i.emit("contentError",{editor:i,error:g,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Lr(e,i.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(g){c(g)}try{l=Lr(e,i.schema,{parseOptions:d,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(g){return c(g),!1}let{from:u,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},p=!0,h=!0;if((kk(l)?l:[l]).forEach(g=>{g.check(),p=p?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),u===f&&h){const{parent:g}=o.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,f+=1)}let b;if(p){if(Array.isArray(e))b=e.map(g=>g.text||"").join("");else if(e instanceof oe){let g="";e.forEach(x=>{x.text&&(g+=x.text)}),b=g}else typeof e=="object"&&e&&e.text?b=e.text:b=e;o.insertText(b,u,f)}else{b=l;const g=o.doc.resolve(u),x=g.node(),v=g.parentOffset===0,w=x.isText||x.isTextblock,T=x.content.size>0;v&&w&&T&&(u=Math.max(0,u-1)),o.replaceWith(u,f,b)}n.updateSelection&&Ek(o,o.steps.length-1,-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:u,text:b}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:u,text:b})}return!0},Sk=()=>({state:t,dispatch:e})=>G0(t,e),Nk=()=>({state:t,dispatch:e})=>q0(t,e),Ck=()=>({state:t,dispatch:e})=>Of(t,e),vk=()=>({state:t,dispatch:e})=>Lf(t,e),Tk=()=>({state:t,dispatch:e,tr:n})=>{try{const o=$i(t.doc,t.selection.$from.pos,-1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},zk=()=>({state:t,dispatch:e,tr:n})=>{try{const o=$i(t.doc,t.selection.$from.pos,1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},_k=()=>({state:t,dispatch:e})=>H0(t,e),Ak=()=>({state:t,dispatch:e})=>W0(t,e);function fh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Mk(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let o,r,i,s;for(let l=0;l<e.length-1;l+=1){const c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))es()||fh()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return o&&(n=`Alt-${n}`),r&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var Ik=t=>({editor:e,view:n,tr:o,dispatch:r})=>{const i=Mk(t).split(/-(?!$)/),s=i.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,l))});return c?.steps.forEach(d=>{const u=d.map(o.mapping);u&&r&&o.maybeStep(u)}),!0};function io(t,e,n={}){const{from:o,to:r,empty:i}=t.selection,s=e?ot(e,t.schema):null,l=[];t.doc.nodesBetween(o,r,(f,p)=>{if(f.isText)return;const h=Math.max(o,p),m=Math.min(r,p+f.nodeSize);l.push({node:f,from:h,to:m})});const c=r-o,d=l.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>Zi(f.node.attrs,n,{strict:!1}));return i?!!d.length:d.reduce((f,p)=>f+p.to-p.from,0)>=c}var Ok=(t,e={})=>({state:n,dispatch:o})=>{const r=ot(t,n.schema);return io(n,r,e)?K0(n,o):!1},Dk=()=>({state:t,dispatch:e})=>Ff(t,e),Rk=t=>({state:e,dispatch:n})=>{const o=ot(t,e.schema);return sx(o)(e,n)},Pk=()=>({state:t,dispatch:e})=>Vf(t,e);function ns(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ph(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((o,r)=>(n.includes(r)||(o[r]=t[r]),o),{})}var Lk=(t,e)=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=ns(typeof t=="string"?t:t.name,o.schema);if(!l)return!1;l==="node"&&(i=ot(t,o.schema)),l==="mark"&&(s=Mn(t,o.schema));let c=!1;return n.selection.ranges.forEach(d=>{o.doc.nodesBetween(d.$from.pos,d.$to.pos,(u,f)=>{i&&i===u.type&&(c=!0,r&&n.setNodeMarkup(f,void 0,ph(u.attrs,e))),s&&u.marks.length&&u.marks.forEach(p=>{s===p.type&&(c=!0,r&&n.addMark(f,f+u.nodeSize,s.create(ph(p.attrs,e))))})})}),c},$k=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Vk=()=>({tr:t,dispatch:e})=>{if(e){const n=new Bt(t.doc);t.setSelection(n)}return!0},Bk=()=>({state:t,dispatch:e})=>Rf(t,e),Fk=()=>({state:t,dispatch:e})=>$f(t,e),jk=()=>({state:t,dispatch:e})=>Q0(t,e),Uk=()=>({state:t,dispatch:e})=>tx(t,e),Hk=()=>({state:t,dispatch:e})=>ex(t,e);function Ll(t,e,n={},o={}){return Lr(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:o.errorOnInvalidContent})}var Wk=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:o={}}={})=>({editor:r,tr:i,dispatch:s,commands:l})=>{const{doc:c}=i;if(o.preserveWhitespace!=="full"){const d=Ll(t,r.schema,o,{errorOnInvalidContent:e??r.options.enableContentCheck});return s&&i.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:c.content.size},t,{parseOptions:o,errorOnInvalidContent:e??r.options.enableContentCheck})};function hh(t,e){const n=Mn(e,t.schema),{from:o,to:r,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(o,r,c=>{s.push(...c.marks)});const l=s.find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function mh(t,e){const n=new Sf(t);return e.forEach(o=>{o.steps.forEach(r=>{n.step(r)})}),n}function Gk(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function qk(t,e,n){const o=[];return t.nodesBetween(e.from,e.to,(r,i)=>{n(r)&&o.push({node:r,pos:i})}),o}function Kk(t,e){for(let n=t.depth;n>0;n-=1){const o=t.node(n);if(e(o))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:o}}}function rs(t){return e=>Kk(e.$from,t)}function xe(t,e,n){return t.config[e]===void 0&&t.parent?xe(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?xe(t.parent,e,n):null}):t.config[e]}function $l(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},o=xe(e,"addExtensions",n);return o?[e,...$l(o())]:e}).flat(10)}function Vl(t,e){const n=xo.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function gh(t){return typeof t=="function"}function Ue(t,e=void 0,...n){return gh(t)?e?t.bind(e)(...n):t(...n):t}function Jk(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Xo(t){const e=t.filter(r=>r.type==="extension"),n=t.filter(r=>r.type==="node"),o=t.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:o}}function bh(t){const e=[],{nodeExtensions:n,markExtensions:o}=Xo(t),r=[...n,...o],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:r},c=xe(s,"addGlobalAttributes",l);if(!c)return;c().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([p,h])=>{e.push({type:f,name:p,attribute:{...i,...h}})})})})}),r.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},c=xe(s,"addAttributes",l);if(!c)return;const d=c();Object.entries(d).forEach(([u,f])=>{const p={...i,...f};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:s.name,name:u,attribute:p})})}),e}function Rt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const o={...e};return Object.entries(n).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const l=i?String(i).split(" "):[],c=o[r]?o[r].split(" "):[],d=l.filter(u=>!c.includes(u));o[r]=[...c,...d].join(" ")}else if(r==="style"){const l=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],c=o[r]?o[r].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;c.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),l.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),o[r]=Array.from(d.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else o[r]=i}),o},{})}function $r(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,o)=>Rt(n,o),{})}function Xk(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function yh(t,e){return"style"in t?t:{...t,getAttrs:n=>{const o=t.getAttrs?t.getAttrs(n):t.attrs;if(o===!1)return!1;const r=e.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(n):Xk(n.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...o,...r}}}}function xh(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Jk(n)?!1:n!=null))}function Eh(t){var e,n;const o={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(o.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(o.validate=t.attribute.validate),[t.name,o]}function Yk(t,e){var n;const o=bh(t),{nodeExtensions:r,markExtensions:i}=Xo(t),s=(n=r.find(d=>xe(d,"topNode")))==null?void 0:n.name,l=Object.fromEntries(r.map(d=>{const u=o.filter(x=>x.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=t.reduce((x,v)=>{const w=xe(v,"extendNodeSchema",f);return{...x,...w?w(d):{}}},{}),h=xh({...p,content:Ue(xe(d,"content",f)),marks:Ue(xe(d,"marks",f)),group:Ue(xe(d,"group",f)),inline:Ue(xe(d,"inline",f)),atom:Ue(xe(d,"atom",f)),selectable:Ue(xe(d,"selectable",f)),draggable:Ue(xe(d,"draggable",f)),code:Ue(xe(d,"code",f)),whitespace:Ue(xe(d,"whitespace",f)),linebreakReplacement:Ue(xe(d,"linebreakReplacement",f)),defining:Ue(xe(d,"defining",f)),isolating:Ue(xe(d,"isolating",f)),attrs:Object.fromEntries(u.map(Eh))}),m=Ue(xe(d,"parseHTML",f));m&&(h.parseDOM=m.map(x=>yh(x,u)));const b=xe(d,"renderHTML",f);b&&(h.toDOM=x=>b({node:x,HTMLAttributes:$r(x,u)}));const g=xe(d,"renderText",f);return g&&(h.toText=g),[d.name,h]})),c=Object.fromEntries(i.map(d=>{const u=o.filter(g=>g.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=t.reduce((g,x)=>{const v=xe(x,"extendMarkSchema",f);return{...g,...v?v(d):{}}},{}),h=xh({...p,inclusive:Ue(xe(d,"inclusive",f)),excludes:Ue(xe(d,"excludes",f)),group:Ue(xe(d,"group",f)),spanning:Ue(xe(d,"spanning",f)),code:Ue(xe(d,"code",f)),attrs:Object.fromEntries(u.map(Eh))}),m=Ue(xe(d,"parseHTML",f));m&&(h.parseDOM=m.map(g=>yh(g,u)));const b=xe(d,"renderHTML",f);return b&&(h.toDOM=g=>b({mark:g,HTMLAttributes:$r(g,u)})),[d.name,h]}));return new Qu({topNode:s,nodes:l,marks:c})}function Qk(t){const e=t.filter((n,o)=>t.indexOf(n)!==o);return Array.from(new Set(e))}function is(t){return t.sort((n,o)=>{const r=xe(n,"priority")||100,i=xe(o,"priority")||100;return r>i?-1:r<i?1:0})}function kh(t){const e=is($l(t)),n=Qk(e.map(o=>o.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),e}function wh(t,e,n){const{from:o,to:r}=e,{blockSeparator:i=`
358
-
359
- `,textSerializers:s={}}=n||{};let l="";return t.nodesBetween(o,r,(c,d,u,f)=>{var p;c.isBlock&&d>o&&(l+=i);const h=s?.[c.type.name];if(h)return u&&(l+=h({node:c,pos:d,parent:u,index:f,range:e})),!1;c.isText&&(l+=(p=c?.text)==null?void 0:p.slice(Math.max(o,d)-d,r-d))}),l}function Zk(t,e){const n={from:0,to:t.content.size};return wh(t,n,e)}function Sh(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function ew(t,e){const n=ot(e,t.schema),{from:o,to:r}=t.selection,i=[];t.doc.nodesBetween(o,r,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function Nh(t,e){const n=ns(typeof e=="string"?e:e.name,t.schema);return n==="node"?ew(t,e):n==="mark"?hh(t,e):{}}function tw(t,e=JSON.stringify){const n={};return t.filter(o=>{const r=e(o);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function nw(t){const e=tw(t);return e.length===1?e:e.filter((n,o)=>!e.filter((i,s)=>s!==o).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function Ch(t){const{mapping:e,steps:n}=t,o=[];return e.maps.forEach((r,i)=>{const s=[];if(r.ranges.length)r.forEach((l,c)=>{s.push({from:l,to:c})});else{const{from:l,to:c}=n[i];if(l===void 0||c===void 0)return;s.push({from:l,to:c})}s.forEach(({from:l,to:c})=>{const d=e.slice(i).map(l,-1),u=e.slice(i).map(c),f=e.invert().map(d,-1),p=e.invert().map(u);o.push({oldRange:{from:f,to:p},newRange:{from:d,to:u}})})}),nw(o)}function Bl(t,e,n){const o=[];return t===e?n.resolve(t).marks().forEach(r=>{const i=n.resolve(t),s=Pl(i,r.type);s&&o.push({mark:r,...s})}):n.nodesBetween(t,e,(r,i)=>{!r||r?.nodeSize===void 0||o.push(...r.marks.map(s=>({from:i,to:i+r.nodeSize,mark:s})))}),o}var ow=(t,e,n,o=20)=>{const r=t.doc.resolve(n);let i=o,s=null;for(;i>0&&s===null;){const l=r.node(i);l?.type.name===e?s=l:i-=1}return[s,i]};function ss(t,e){return e.nodes[t]||e.marks[t]||null}function as(t,e,n){return Object.fromEntries(Object.entries(n).filter(([o])=>{const r=t.find(i=>i.type===e&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}var rw=(t,e=500)=>{let n="";const o=t.parentOffset;return t.parent.nodesBetween(Math.max(0,o-e),o,(r,i,s,l)=>{var c,d;const u=((d=(c=r.type.spec).toText)==null?void 0:d.call(c,{node:r,pos:i,parent:s,index:l}))||r.textContent||"%leaf%";n+=r.isAtom&&!r.isText?u:u.slice(0,Math.max(0,o-i))}),n};function Fl(t,e,n={}){const{empty:o,ranges:r}=t.selection,i=e?Mn(e,t.schema):null;if(o)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>i?i.name===f.type.name:!0).find(f=>Zi(f.attrs,n,{strict:!1}));let s=0;const l=[];if(r.forEach(({$from:f,$to:p})=>{const h=f.pos,m=p.pos;t.doc.nodesBetween(h,m,(b,g)=>{if(!b.isText&&!b.marks.length)return;const x=Math.max(h,g),v=Math.min(m,g+b.nodeSize),w=v-x;s+=w,l.push(...b.marks.map(T=>({mark:T,from:x,to:v})))})}),s===0)return!1;const c=l.filter(f=>i?i.name===f.mark.type.name:!0).filter(f=>Zi(f.mark.attrs,n,{strict:!1})).reduce((f,p)=>f+p.to-p.from,0),d=l.filter(f=>i?f.mark.type!==i&&f.mark.type.excludes(i):!0).reduce((f,p)=>f+p.to-p.from,0);return(c>0?c+d:c)>=s}function iw(t,e,n={}){if(!e)return io(t,null,n)||Fl(t,null,n);const o=ns(e,t.schema);return o==="node"?io(t,e,n):o==="mark"?Fl(t,e,n):!1}var sw=(t,e)=>{const{$from:n,$to:o,$anchor:r}=t.selection;if(e){const i=rs(l=>l.type.name===e)(t.selection);if(!i)return!1;const s=t.doc.resolve(i.pos+1);return r.pos+1===s.end()}return!(o.parentOffset<o.parent.nodeSize-2||n.pos!==o.pos)},aw=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function vh(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Th(t,e){const{nodeExtensions:n}=Xo(e),o=n.find(s=>s.name===t);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=Ue(xe(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function jl(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var o;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((o=t.text)!=null?o:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let r=!0;return t.content.forEach(i=>{r!==!1&&(jl(i,{ignoreWhitespace:n,checkChildren:e})||(r=!1))}),r}return!1}var zh=class Fm{constructor(e){this.position=e}static fromJSON(e){return new Fm(e.position)}toJSON(){return{position:this.position}}};function lw(t,e){const n=e.mapping.mapResult(t.position);return{position:new zh(n.pos),mapResult:n}}function cw(t){return new zh(t)}function dw(t,e,n){var o;const{selection:r}=e;let i=null;if(lh(r)&&(i=r.$cursor),i){const l=(o=t.storedMarks)!=null?o:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(d=>d.type.excludes(n)))}const{ranges:s}=r;return s.some(({$from:l,$to:c})=>{let d=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,c.pos,(u,f,p)=>{if(d)return!1;if(u.isInline){const h=!p||p.type.allowsMarkType(n),m=!!n.isInSet(u.marks)||!u.marks.some(b=>b.type.excludes(n));d=h&&m}return!d}),d})}var uw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const{selection:i}=n,{empty:s,ranges:l}=i,c=Mn(t,o.schema);if(r)if(s){const d=hh(o,c);n.addStoredMark(c.create({...d,...e}))}else l.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;o.doc.nodesBetween(u,f,(p,h)=>{const m=Math.max(h,u),b=Math.min(h+p.nodeSize,f);p.marks.find(x=>x.type===c)?p.marks.forEach(x=>{c===x.type&&n.addMark(m,b,c.create({...x.attrs,...e}))}):n.addMark(m,b,c.create(e))})});return dw(o,n,c)},fw=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),pw=(t,e={})=>({state:n,dispatch:o,chain:r})=>{const i=ot(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>Hf(i,{...s,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Hf(i,{...s,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},hw=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,r=zo(t,0,o.content.size),i=Ce.create(o,r);e.setSelection(i)}return!0},mw=(t,e)=>({tr:n,state:o,dispatch:r})=>{const{selection:i}=o;let s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=i.from,l=i.to),r&&n.doc.nodesBetween(s,l,(c,d)=>{c.isText||n.setNodeMarkup(d,void 0,{...c.attrs,dir:t})}),!0},gw=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,{from:r,to:i}=typeof t=="number"?{from:t,to:t}:t,s=Oe.atStart(o).from,l=Oe.atEnd(o).to,c=zo(r,s,l),d=zo(i,s,l),u=Oe.create(o,c,d);e.setSelection(u)}return!0},bw=t=>({state:e,dispatch:n})=>{const o=ot(t,e.schema);return cx(o)(e,n)};function _h(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const o=n.filter(r=>e?.includes(r.type.name));t.tr.ensureMarks(o)}}var yw=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:l,$to:c}=i,d=r.extensionManager.attributes,u=as(d,l.node().type.name,l.node().attrs);if(i instanceof Ce&&i.node.isBlock)return!l.parentOffset||!vn(s,l.pos)?!1:(o&&(t&&_h(n,r.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=c.parentOffset===c.parent.content.size,p=l.depth===0?void 0:Gk(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:u}]:void 0,m=vn(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&vn(e.doc,e.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:u}]:void 0),o){if(m&&(i instanceof Oe&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),p&&!f&&!l.parentOffset&&l.parent.type!==p)){const b=e.mapping.map(l.before()),g=e.doc.resolve(b);l.node(-1).canReplaceWith(g.index(),g.index()+1,p)&&e.setNodeMarkup(e.mapping.map(l.before()),p)}t&&_h(n,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},xw=(t,e={})=>({tr:n,state:o,dispatch:r,editor:i})=>{var s;const l=ot(t,o.schema),{$from:c,$to:d}=o.selection,u=o.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const f=c.node(-1);if(f.type!==l)return!1;const p=i.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(r){let x=oe.empty;const v=c.index(-1)?1:c.index(-2)?2:3;for(let E=c.depth-v;E>=c.depth-3;E-=1)x=oe.from(c.node(E).copy(x));const w=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,T={...as(p,c.node().type.name,c.node().attrs),...e},M=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(T))||void 0;x=x.append(oe.from(l.createAndFill(null,M)||void 0));const A=c.before(c.depth-(v-1));n.replace(A,c.after(-w),new fe(x,4-v,0));let y=-1;n.doc.nodesBetween(A,n.doc.content.size,(E,k)=>{if(y>-1)return!1;E.isTextblock&&E.content.size===0&&(y=k+1)}),y>-1&&n.setSelection(Oe.near(n.doc.resolve(y))),n.scrollIntoView()}return!0}const h=d.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...as(p,f.type.name,f.attrs),...e},b={...as(p,c.node().type.name,c.node().attrs),...e};n.delete(c.pos,d.pos);const g=h?[{type:l,attrs:m},{type:h,attrs:b}]:[{type:l,attrs:m}];if(!vn(n.doc,c.pos,2))return!1;if(r){const{selection:x,storedMarks:v}=o,{splittableMarks:w}=i.extensionManager,T=v||x.$to.parentOffset&&x.$from.marks();if(n.split(c.pos,2,g).scrollIntoView(),!T||!r)return!0;const M=T.filter(A=>w.includes(A.type.name));n.ensureMarks(M)}return!0},Ul=(t,e)=>{const n=rs(s=>s.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===r?.type&&Jn(t.doc,n.pos)&&t.join(n.pos),!0},Hl=(t,e)=>{const n=rs(s=>s.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(n.start).after(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===r?.type&&Jn(t.doc,o)&&t.join(o),!0},Ew=(t,e,n,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:c,commands:d,can:u})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,h=ot(t,s.schema),m=ot(e,s.schema),{selection:b,storedMarks:g}=s,{$from:x,$to:v}=b,w=x.blockRange(v),T=g||b.$to.parentOffset&&b.$from.marks();if(!w)return!1;const M=rs(A=>Th(A.type.name,f))(b);if(w.depth>=1&&M&&w.depth-M.depth<=1){if(M.node.type===h)return d.liftListItem(m);if(Th(M.node.type.name,f)&&h.validContent(M.node.content)&&l)return c().command(()=>(i.setNodeMarkup(M.pos,h),!0)).command(()=>Ul(i,h)).command(()=>Hl(i,h)).run()}return!n||!T||!l?c().command(()=>u().wrapInList(h,o)?!0:d.clearNodes()).wrapInList(h,o).command(()=>Ul(i,h)).command(()=>Hl(i,h)).run():c().command(()=>{const A=u().wrapInList(h,o),y=T.filter(E=>p.includes(E.type.name));return i.ensureMarks(y),A?!0:d.clearNodes()}).wrapInList(h,o).command(()=>Ul(i,h)).command(()=>Hl(i,h)).run()},kw=(t,e={},n={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=n,s=Mn(t,o.schema);return Fl(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},ww=(t,e,n={})=>({state:o,commands:r})=>{const i=ot(t,o.schema),s=ot(e,o.schema),l=io(o,i,n);let c;return o.selection.$anchor.sameParent(o.selection.$head)&&(c=o.selection.$anchor.parent.attrs),l?r.setNode(s,c):r.setNode(i,{...c,...n})},Sw=(t,e={})=>({state:n,commands:o})=>{const r=ot(t,n.schema);return io(n,r,e)?o.lift(r):o.wrapIn(r,e)},Nw=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let o=0;o<n.length;o+=1){const r=n[o];let i;if(r.spec.isInputRules&&(i=r.getState(t))){if(e){const s=t.tr,l=i.transform;for(let c=l.steps.length-1;c>=0;c-=1)s.step(l.steps[c].invert(l.docs[c]));if(i.text){const c=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,c))}else s.delete(i.from,i.to)}return!0}}return!1},Cw=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:o,ranges:r}=n;return o||e&&r.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},vw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,c=Mn(t,o.schema),{$from:d,empty:u,ranges:f}=l;if(!r)return!0;if(u&&s){let{from:p,to:h}=l;const m=(i=d.marks().find(g=>g.type===c))==null?void 0:i.attrs,b=Pl(d,c,m);b&&(p=b.from,h=b.to),n.removeMark(p,h,c)}else f.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,c)});return n.removeStoredMark(c),!0},Tw=t=>({tr:e,state:n,dispatch:o})=>{const{selection:r}=n;let i,s;return typeof t=="number"?(i=t,s=t):t&&"from"in t&&"to"in t?(i=t.from,s=t.to):(i=r.from,s=r.to),o&&e.doc.nodesBetween(i,s,(l,c)=>{if(l.isText)return;const d={...l.attrs};delete d.dir,e.setNodeMarkup(c,void 0,d)}),!0},zw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=ns(typeof t=="string"?t:t.name,o.schema);if(!l)return!1;l==="node"&&(i=ot(t,o.schema)),l==="mark"&&(s=Mn(t,o.schema));let c=!1;return n.selection.ranges.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;let p,h,m,b;n.selection.empty?o.doc.nodesBetween(u,f,(g,x)=>{i&&i===g.type&&(c=!0,m=Math.max(x,u),b=Math.min(x+g.nodeSize,f),p=x,h=g)}):o.doc.nodesBetween(u,f,(g,x)=>{x<u&&i&&i===g.type&&(c=!0,m=Math.max(x,u),b=Math.min(x+g.nodeSize,f),p=x,h=g),x>=u&&x<=f&&(i&&i===g.type&&(c=!0,r&&n.setNodeMarkup(x,void 0,{...g.attrs,...e})),s&&g.marks.length&&g.marks.forEach(v=>{if(s===v.type&&(c=!0,r)){const w=Math.max(x,u),T=Math.min(x+g.nodeSize,f);n.addMark(w,T,s.create({...v.attrs,...e}))}}))}),h&&(p!==void 0&&r&&n.setNodeMarkup(p,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(g=>{s===g.type&&r&&n.addMark(m,b,s.create({...g.attrs,...e}))}))}),c},_w=(t,e={})=>({state:n,dispatch:o})=>{const r=ot(t,n.schema);return nx(r,e)(n,o)},Aw=(t,e={})=>({state:n,dispatch:o})=>{const r=ot(t,n.schema);return ox(r,e)(n,o)},Mw=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(o=>o.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(o=>o!==e):delete this.callbacks[t]),this}once(t,e){const n=(...o)=>{this.off(t,n),e.apply(this,o)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Ah=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},Iw=(t,e)=>{if(Rl(e))return e.exec(t);const n=e(t);if(!n)return null;const o=[n.text];return o.index=n.index,o.input=t,o.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(n.replaceWith)),o};function ls(t){var e;const{editor:n,from:o,to:r,text:i,rules:s,plugin:l}=t,{view:c}=n;if(c.composing)return!1;const d=c.state.doc.resolve(o);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let u=!1;const f=rw(d)+i;return s.forEach(p=>{if(u)return;const h=Iw(f,p.find);if(!h)return;const m=c.state.tr,b=Yi({state:c.state,transaction:m}),g={from:o-(h[0].length-i.length),to:r},{commands:x,chain:v,can:w}=new Qi({editor:n,state:b});p.handler({state:b,range:g,match:h,commands:x,chain:v,can:w})===null||!m.steps.length||(p.undoable&&m.setMeta(l,{transform:m,from:o,to:r,text:i}),c.dispatch(m),u=!0)}),u}function Ow(t){const{editor:e,rules:n}=t,o=new Ot({state:{init(){return null},apply(r,i,s){const l=r.getMeta(o);if(l)return l;const c=r.getMeta("applyInputRules");return c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=Vl(oe.from(u),s.schema);const{from:f}=c,p=f+u.length;ls({editor:e,from:f,to:p,text:u,rules:n,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,s,l){return ls({editor:e,from:i,to:s,text:l,rules:n,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&ls({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:o})}),!1)},handleKeyDown(r,i){if(i.key!=="Enter")return!1;const{$cursor:s}=r.state.selection;return s?ls({editor:e,from:s.pos,to:s.pos,text:`
360
- `,rules:n,plugin:o}):!1}},isInputRules:!0});return o}function Dw(t){return Object.prototype.toString.call(t).slice(8,-1)}function cs(t){return Dw(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Mh(t,e){const n={...t};return cs(t)&&cs(e)&&Object.keys(e).forEach(o=>{cs(e[o])&&cs(t[o])?n[o]=Mh(t[o],e[o]):n[o]=e[o]}),n}var Wl=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Ue(xe(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Ue(xe(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Mh(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Vr=class jm extends Wl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new jm(n)}static handleExit({editor:e,mark:n}){const{tr:o}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const s=r.marks();if(!!!s.find(d=>d?.type.name===n.name))return!1;const c=s.find(d=>d?.type.name===n.name);return c&&o.removeStoredMark(c),o.insertText(" ",r.pos),e.view.dispatch(o),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Rw(t){return typeof t=="number"}var Pw=class{constructor(t){this.find=t.find,this.handler=t.handler}},Lw=(t,e,n)=>{if(Rl(e))return[...t.matchAll(e)];const o=e(t,n);return o?o.map(r=>{const i=[r.text];return i.index=r.index,i.input=t,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function $w(t){const{editor:e,state:n,from:o,to:r,rule:i,pasteEvent:s,dropEvent:l}=t,{commands:c,chain:d,can:u}=new Qi({editor:e,state:n}),f=[];return n.doc.nodesBetween(o,r,(h,m)=>{var b,g,x,v,w;if((g=(b=h.type)==null?void 0:b.spec)!=null&&g.code||!(h.isText||h.isTextblock||h.isInline))return;const T=(w=(v=(x=h.content)==null?void 0:x.size)!=null?v:h.nodeSize)!=null?w:0,M=Math.max(o,m),A=Math.min(r,m+T);if(M>=A)return;const y=h.isText?h.text||"":h.textBetween(M-m,A-m,void 0,"");Lw(y,i.find,s).forEach(k=>{if(k.index===void 0)return;const O=M+k.index+1,G=O+k[0].length,z={from:n.tr.mapping.map(O),to:n.tr.mapping.map(G)},R=i.handler({state:n,range:z,match:k,commands:c,chain:d,can:u,pasteEvent:s,dropEvent:l});f.push(R)})}),f.every(h=>h!==null)}var ds=null,Vw=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function Bw(t){const{editor:e,rules:n}=t;let o=null,r=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const c=({state:u,from:f,to:p,rule:h,pasteEvt:m})=>{const b=u.tr,g=Yi({state:u,transaction:b});if(!(!$w({editor:e,state:g,from:Math.max(f-1,0),to:p.b-1,rule:h,pasteEvent:m,dropEvent:l})||!b.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,b}};return n.map(u=>new Ot({view(f){const p=m=>{var b;o=(b=f.dom.parentElement)!=null&&b.contains(m.target)?f.dom.parentElement:null,o&&(ds=e)},h=()=>{ds&&(ds=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,p)=>{if(i=o===f.dom.parentElement,l=p,!i){const h=ds;h?.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,p)=>{var h;const m=(h=p.clipboardData)==null?void 0:h.getData("text/html");return s=p,r=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,p,h)=>{const m=f[0],b=m.getMeta("uiEvent")==="paste"&&!r,g=m.getMeta("uiEvent")==="drop"&&!i,x=m.getMeta("applyPasteRules"),v=!!x;if(!b&&!g&&!v)return;if(v){let{text:M}=x;typeof M=="string"?M=M:M=Vl(oe.from(M),h.schema);const{from:A}=x,y=A+M.length,E=Vw(M);return c({rule:u,state:h,from:A,to:{b:y},pasteEvt:E})}const w=p.doc.content.findDiffStart(h.doc.content),T=p.doc.content.findDiffEnd(h.doc.content);if(!(!Rw(w)||!T||w===T.b))return c({rule:u,state:h,from:w,to:T,pasteEvt:s})}}))}var us=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=kh(t),this.schema=Yk(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ss(e.name,this.schema)},o=xe(e,"addCommands",n);return o?{...t,...o()}:t},{})}get plugins(){const{editor:t}=this;return is([...this.extensions].reverse()).flatMap(o=>{const r={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:t,type:ss(o.name,this.schema)},i=[],s=xe(o,"addKeyboardShortcuts",r);let l={};if(o.type==="mark"&&xe(o,"exitable",r)&&(l.ArrowRight=()=>Vr.handleExit({editor:t,mark:o})),s){const p=Object.fromEntries(Object.entries(s()).map(([h,m])=>[h,()=>m({editor:t})]));l={...l,...p}}const c=ZE(l);i.push(c);const d=xe(o,"addInputRules",r);if(vh(o,t.options.enableInputRules)&&d){const p=d();if(p&&p.length){const h=Ow({editor:t,rules:p}),m=Array.isArray(h)?h:[h];i.push(...m)}}const u=xe(o,"addPasteRules",r);if(vh(o,t.options.enablePasteRules)&&u){const p=u();if(p&&p.length){const h=Bw({editor:t,rules:p});i.push(...h)}}const f=xe(o,"addProseMirrorPlugins",r);if(f){const p=f();i.push(...p)}return i})}get attributes(){return bh(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Xo(this.extensions);return Object.fromEntries(e.filter(n=>!!xe(n,"addNodeView")).map(n=>{const o=this.attributes.filter(c=>c.type===n.name),r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ot(n.name,this.schema)},i=xe(n,"addNodeView",r);if(!i)return[];const s=i();if(!s)return[];const l=(c,d,u,f,p)=>{const h=$r(c,o);return s({node:c,view:d,getPos:u,decorations:f,innerDecorations:p,editor:t,extension:n,HTMLAttributes:h})};return[n.name,l]}))}dispatchTransaction(t){const{editor:e}=this;return is([...this.extensions].reverse()).reduceRight((o,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:ss(r.name,this.schema)},s=xe(r,"dispatchTransaction",i);return s?l=>{s.call(i,{transaction:l,next:o})}:o},t)}get markViews(){const{editor:t}=this,{markExtensions:e}=Xo(this.extensions);return Object.fromEntries(e.filter(n=>!!xe(n,"addMarkView")).map(n=>{const o=this.attributes.filter(l=>l.type===n.name),r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Mn(n.name,this.schema)},i=xe(n,"addMarkView",r);if(!i)return[];const s=(l,c,d)=>{const u=$r(l,o);return i()({mark:l,view:c,inline:d,editor:t,extension:n,HTMLAttributes:u,updateAttributes:f=>{Qw(l,t,f)}})};return[n.name,s]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const o={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ss(e.name,this.schema)};e.type==="mark"&&((n=Ue(xe(e,"keepOnSplit",o)))==null||n)&&this.splittableMarks.push(e.name);const r=xe(e,"onBeforeCreate",o),i=xe(e,"onCreate",o),s=xe(e,"onUpdate",o),l=xe(e,"onSelectionUpdate",o),c=xe(e,"onTransaction",o),d=xe(e,"onFocus",o),u=xe(e,"onBlur",o),f=xe(e,"onDestroy",o);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}};us.resolve=kh,us.sort=is,us.flatten=$l;var Fw={};Dl(Fw,{ClipboardTextSerializer:()=>Ih,Commands:()=>Oh,Delete:()=>Dh,Drop:()=>Rh,Editable:()=>Ph,FocusEvents:()=>$h,Keymap:()=>Vh,Paste:()=>Bh,Tabindex:()=>Fh,TextDirection:()=>jh,focusEventsPluginKey:()=>Lh});var Kt=class Um extends Wl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new Um(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Ih=Kt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ot({key:new an("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:o,selection:r}=e,{ranges:i}=r,s=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),c=Sh(n);return wh(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),Oh=Kt.create({name:"commands",addCommands(){return{...ih}}}),Dh=Kt.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,o,r;const i=()=>{var s,l,c,d;if((d=(c=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:c.call(l,t))!=null?d:t.getMeta("y-sync$"))return;const u=mh(t.before,[t,...e]);Ch(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,b)=>{const g=b+m.nodeSize-2,x=h.oldRange.from<=b&&g<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:b,to:g,newFrom:u.mapping.map(b),newTo:u.mapping.map(g),deletedRange:h.oldRange,newRange:h.newRange,partial:!x,editor:this.editor,transaction:t,combinedTransform:u})})});const p=u.mapping;u.steps.forEach((h,m)=>{var b,g;if(h instanceof sn){const x=p.slice(m).map(h.from,-1),v=p.slice(m).map(h.to),w=p.invert().map(x,-1),T=p.invert().map(v),M=(b=u.doc.nodeAt(x-1))==null?void 0:b.marks.some(y=>y.eq(h.mark)),A=(g=u.doc.nodeAt(v))==null?void 0:g.marks.some(y=>y.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:w,to:T},newRange:{from:x,to:v},partial:!!(A||M),editor:this.editor,transaction:t,combinedTransform:u})}})};(r=(o=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:o.async)==null||r?setTimeout(i,0):i()}}),Rh=Kt.create({name:"drop",addProseMirrorPlugins(){return[new Ot({key:new an("tiptapDrop"),props:{handleDrop:(t,e,n,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:o})}}})]}}),Ph=Kt.create({name:"editable",addProseMirrorPlugins(){return[new Ot({key:new an("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Lh=new an("focusEvents"),$h=Kt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ot({key:Lh,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const o=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,n)=>{t.isFocused=!1;const o=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),Vh=Kt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:c,doc:d}=l,{empty:u,$anchor:f}=c,{pos:p,parent:h}=f,m=f.parent.isTextblock&&p>0?l.doc.resolve(p-1):f,b=m.parent.type.spec.isolating,g=f.pos-f.parentOffset,x=b&&m.parent.childCount===1?g===f.pos:Le.atStart(d).from===p;return!u||!h.type.isTextblock||h.textContent.length||!x||x&&f.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),o={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...o},i={...o,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return es()||fh()?i:r},addProseMirrorPlugins(){return[new Ot({key:new an("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(b=>b.getMeta("composition")))return;const o=t.some(b=>b.docChanged)&&!e.doc.eq(n.doc),r=t.some(b=>b.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:s,to:l}=e.selection,c=Le.atStart(e.doc).from,d=Le.atEnd(e.doc).to;if(i||!(s===c&&l===d)||!jl(n.doc))return;const p=n.tr,h=Yi({state:n,transaction:p}),{commands:m}=new Qi({editor:this.editor,state:h});if(m.clearNodes(),!!p.steps.length)return p}})]}}),Bh=Kt.create({name:"paste",addProseMirrorPlugins(){return[new Ot({key:new an("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Fh=Kt.create({name:"tabindex",addProseMirrorPlugins(){return[new Ot({key:new an("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),jh=Kt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Xo(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ot({key:new an("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),jw=class or{constructor(e,n,o=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=o,this.resolvedPos=e,this.editor=n,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,o=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,o=this.to-1}this.editor.commands.insertContentAt({from:n,to:o},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new or(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new or(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new or(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,o)=>{const r=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+o+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(s);if(!r&&l.depth<=this.depth)return;const c=new or(l,this.editor,r,r?n:null);r&&(c.actualDepth=this.depth+1),e.push(new or(l,this.editor,r,r?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let o=null,r=this.parent;for(;r&&!o;){if(r.node.type.name===e)if(Object.keys(n).length>0){const i=r.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){const c=s[l];if(i[c]!==n[c])break}}else o=r;r=r.parent}return o}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},o=!1){let r=[];if(!this.children||this.children.length===0)return r;const i=Object.keys(n);return this.children.forEach(s=>{o&&r.length>0||(s.node.type.name===e&&i.every(c=>n[c]===s.node.attrs[c])&&r.push(s),!(o&&r.length>0)&&(r=r.concat(s.querySelectorAll(e,n,o))))}),r}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},Uw=`.ProseMirror {
342
+ </div>`):k.innerHTML="";return}const T=q.map((F,L)=>{const B=t?`${t}.slots.${w}.${L}`:`slots.${w}.${L}`;return r(F,B)}).join("");k.removeAttribute("z-slot");const H=f.parseFromString(`<template>${T}</template>`,"text/html").querySelector("template");if(H&&H.content)for(k.innerHTML="";H.content.firstChild;)k.appendChild(H.content.firstChild);else k.innerHTML=T})},A=Array.from(h.content.querySelectorAll("[z-slot]"));return _(A),h.innerHTML}function on(n,e){const t=n.split(".");let o=e;for(const r of t)if(o==null||typeof o!="object"||(/^\d+$/.test(r)?o=o[parseInt(r)]:o=o[r],o===void 0))return null;return o}function Rn(){return`zcode-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function Zm(n){return n.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^\s*([a-zA-Z])/,e=>e.toUpperCase())}function eg(n){return Zm(n)}function Lc(n){const e=n.split(".");if(e.length<=2&&e[0]==="page")return null;if(e.includes("slots")){let o=-1;for(let r=e.length-1;r>=0;r--)if(e[r]==="slots"){o=r;break}if(o!==-1&&o<e.length-1){const r=e[e.length-1];if(!isNaN(parseInt(r)))return e.slice(0,o).join(".")}}const t=e.slice(0,-1);return t.length===0?null:t.join(".")}function ea(n,e){const t=[...e.common,...e.individual,...e.special];for(const o of t){const r=o.parts.find(i=>i.id===n);if(r)return r}return null}function ti(n,e=!0){function t(i){return ea(i,n.parts)}function o(i,s="",l=new Set){if(l.has(s))return console.warn(`循環参照を検出しました: ${s}`),`<div class="zcode-error-message">循環参照が検出されました: ${s}</div>`;l.add(s);const c=i.part_id,d=t(c);if(!d)return`<div class="zcode-error-message">パーツが見つかりません: ${c}</div>`;const u=ei(d.body,i,s,t,(f,p)=>o(f,p,l),e,n.images.common,n.images.individual,n.images.special,n.backendData);return e?Rc(u,{"data-zcode-id":i.id,"data-zcode-path":s,"data-zcode-part":c}):u}return{fullPageHtml:a.computed(()=>n.page.map((i,s)=>o(i,`page.${s}`)).join("")),renderComponentToHtml:o,findPart:t}}const ta=a.defineComponent({__name:"ZeroCodePreview",props:{cmsData:{type:Object},allowDynamicContentInteraction:{type:Boolean}},setup(n,{expose:e}){const t=n,{fullPageHtml:o}=ti(t.cmsData,!1),r=a.ref(null),i=a.computed(()=>r.value?.previewArea||null);return e({previewArea:i}),(s,l)=>(a.openBlock(),a.createBlock(Ec,{ref_key:"previewAreaRef",ref:r,"cms-data":n.cmsData,"full-page-html":a.unref(o),"allow-dynamic-content-interaction":n.allowDynamicContentInteraction},null,8,["cms-data","full-page-html","allow-dynamic-content-interaction"]))}}),tg={class:"zcode-toolbar"},ng=["title"],$c=a.defineComponent({__name:"Toolbar",props:{currentMode:{type:String},viewMode:{type:String},availableModes:{type:Array},allowDynamicContentInteraction:{type:Boolean}},emits:["switch-mode","switch-view-mode","open-settings","toggle-dynamic-content"],setup(n,{emit:e}){const t=n,o=e,r=i=>{t.viewMode==="preview"?(o("switch-view-mode","manage"),a.nextTick(()=>{o("switch-mode",i)})):o("switch-mode",i)};return(i,s)=>(a.openBlock(),a.createElementBlock("div",tg,[a.createElementVNode("button",{class:a.normalizeClass([{active:n.viewMode==="preview"},"zcode-view-mode-btn zcode-view-mode-preview"]),onClick:s[0]||(s[0]=l=>i.$emit("switch-view-mode",n.viewMode==="preview"?"manage":"preview"))},[a.createVNode(a.unref(gm),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.viewMode")),1)],2),!n.availableModes||n.availableModes.includes("edit")?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass([{active:n.currentMode==="edit"&&n.viewMode==="manage"},"zcode-mode-btn zcode-mode-edit"]),onClick:s[1]||(s[1]=l=>r("edit"))},[a.createVNode(a.unref(gc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.editMode")),1)],2)):a.createCommentVNode("",!0),!n.availableModes||n.availableModes.includes("add")?(a.openBlock(),a.createElementBlock("button",{key:1,class:a.normalizeClass([{active:n.currentMode==="add"&&n.viewMode==="manage"},"zcode-mode-btn zcode-mode-add"]),onClick:s[2]||(s[2]=l=>r("add"))},[a.createVNode(a.unref(io),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.addMode")),1)],2)):a.createCommentVNode("",!0),!n.availableModes||n.availableModes.includes("reorder")?(a.openBlock(),a.createElementBlock("button",{key:2,class:a.normalizeClass([{active:n.currentMode==="reorder"&&n.viewMode==="manage"},"zcode-mode-btn zcode-mode-reorder"]),onClick:s[3]||(s[3]=l=>r("reorder"))},[a.createVNode(a.unref(Yo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.reorderMode")),1)],2)):a.createCommentVNode("",!0),!n.availableModes||n.availableModes.includes("delete")?(a.openBlock(),a.createElementBlock("button",{key:3,class:a.normalizeClass([{active:n.currentMode==="delete"&&n.viewMode==="manage"},"zcode-mode-btn zcode-mode-delete"]),onClick:s[4]||(s[4]=l=>r("delete"))},[a.createVNode(a.unref(On),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.deleteMode")),1)],2)):a.createCommentVNode("",!0),a.createElementVNode("button",{class:"zcode-settings-btn",title:i.$t("toolbar.settings"),onClick:s[5]||(s[5]=l=>i.$emit("open-settings"))},[a.createVNode(a.unref(bc),{size:16})],8,ng)]))}});function og(n,e){typeof console<"u"&&(console.warn("[intlify] "+n),e&&console.warn(e.stack))}const Vc=typeof window<"u",Pn=(n,e=!1)=>e?Symbol.for(n):Symbol(n),rg=(n,e,t)=>ig({l:n,k:e,s:t}),ig=n=>JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),it=n=>typeof n=="number"&&isFinite(n),sg=n=>Uc(n)==="[object Date]",ni=n=>Uc(n)==="[object RegExp]",oi=n=>$e(n)&&Object.keys(n).length===0,St=Object.assign,ag=Object.create,Be=(n=null)=>ag(n);let Bc;const ri=()=>Bc||(Bc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:Be());function Fc(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\//g,"&#x2F;").replace(/=/g,"&#x3D;")}function jc(n){return n.replace(/&(?![a-zA-Z0-9#]{2,6};)/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function lg(n){return n=n.replace(/(\w+)\s*=\s*"([^"]*)"/g,(o,r,i)=>`${r}="${jc(i)}"`),n=n.replace(/(\w+)\s*=\s*'([^']*)'/g,(o,r,i)=>`${r}='${jc(i)}'`),/\s*on\w+\s*=\s*["']?[^"'>]+["']?/gi.test(n)&&(n=n.replace(/(\s+)(on)(\w+\s*=)/gi,"$1&#111;n$3")),[/(\s+(?:href|src|action|formaction)\s*=\s*["']?)\s*javascript:/gi,/(style\s*=\s*["'][^"']*url\s*\(\s*)javascript:/gi].forEach(o=>{n=n.replace(o,"$1javascript&#58;")}),n}const cg=Object.prototype.hasOwnProperty;function Jt(n,e){return cg.call(n,e)}const rt=Array.isArray,Je=n=>typeof n=="function",xe=n=>typeof n=="string",Ke=n=>typeof n=="boolean",Le=n=>n!==null&&typeof n=="object",dg=n=>Le(n)&&Je(n.then)&&Je(n.catch),Hc=Object.prototype.toString,Uc=n=>Hc.call(n),$e=n=>{if(!Le(n))return!1;const e=Object.getPrototypeOf(n);return e===null||e.constructor===Object},ug=n=>n==null?"":rt(n)||$e(n)&&n.toString===Hc?JSON.stringify(n,null,2):String(n);function fg(n,e=""){return n.reduce((t,o,r)=>r===0?t+o:t+e+o,"")}function ii(n){let e=n;return()=>++e}const si=n=>!Le(n)||rt(n);function ai(n,e){if(si(n)||si(e))throw new Error("Invalid value");const t=[{src:n,des:e}];for(;t.length;){const{src:o,des:r}=t.pop();Object.keys(o).forEach(i=>{i!=="__proto__"&&(Le(o[i])&&!Le(r[i])&&(r[i]=Array.isArray(o[i])?[]:Be()),si(r[i])||si(o[i])?r[i]=o[i]:t.push({src:o[i],des:r[i]}))})}}function pg(n,e,t){return{line:n,column:e,offset:t}}function li(n,e,t){return{start:n,end:e}}const hg=/\{([0-9a-zA-Z]+)\}/g;function Wc(n,...e){return e.length===1&&mg(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),n.replace(hg,(t,o)=>e.hasOwnProperty(o)?e[o]:"")}const qc=Object.assign,Gc=n=>typeof n=="string",mg=n=>n!==null&&typeof n=="object";function Kc(n,e=""){return n.reduce((t,o,r)=>r===0?t+o:t+e+o,"")}const na={USE_MODULO_SYNTAX:1,__EXTEND_POINT__:2},gg={[na.USE_MODULO_SYNTAX]:"Use modulo before '{{0}}'."};function yg(n,e,...t){const o=Wc(gg[n],...t||[]),r={message:String(o),code:n};return e&&(r.location=e),r}const Se={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16,__EXTEND_POINT__:17},bg={[Se.EXPECTED_TOKEN]:"Expected token: '{0}'",[Se.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[Se.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[Se.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[Se.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[Se.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[Se.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[Se.EMPTY_PLACEHOLDER]:"Empty placeholder",[Se.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[Se.INVALID_LINKED_FORMAT]:"Invalid linked format",[Se.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[Se.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[Se.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[Se.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[Se.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[Se.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function No(n,e,t={}){const{domain:o,messages:r,args:i}=t,s=Wc((r||bg)[n]||"",...i||[]),l=new SyntaxError(String(s));return l.code=n,e&&(l.location=e),l.domain=o,l}function xg(n){throw n}const mn=" ",kg="\r",Ct=`
343
+ `,Eg="\u2028",wg="\u2029";function Sg(n){const e=n;let t=0,o=1,r=1,i=0;const s=b=>e[b]===kg&&e[b+1]===Ct,l=b=>e[b]===Ct,c=b=>e[b]===wg,d=b=>e[b]===Eg,u=b=>s(b)||l(b)||c(b)||d(b),f=()=>t,p=()=>o,h=()=>r,m=()=>i,y=b=>s(b)||c(b)||d(b)?Ct:e[b],g=()=>y(t),x=()=>y(t+i);function M(){return i=0,u(t)&&(o++,r=0),s(t)&&t++,t++,r++,e[t]}function E(){return s(t+i)&&i++,i++,e[t+i]}function v(){t=0,o=1,r=1,i=0}function _(b=0){i=b}function A(){const b=t+i;for(;b!==t;)M();i=0}return{index:f,line:p,column:h,peekOffset:m,charAt:y,currentChar:g,currentPeek:x,next:M,peek:E,reset:v,resetPeek:_,skipToPeek:A}}const Ln=void 0,Cg=".",Jc="'",Ng="tokenizer";function Tg(n,e={}){const t=e.location!==!1,o=Sg(n),r=()=>o.index(),i=()=>pg(o.line(),o.column(),o.index()),s=i(),l=r(),c={currentType:14,offset:l,startLoc:s,endLoc:s,lastType:14,lastOffset:l,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},d=()=>c,{onError:u}=e;function f(z,I,G,...pe){const Ae=d();if(I.column+=G,I.offset+=G,u){const ye=t?li(Ae.startLoc,I):null,U=No(z,ye,{domain:Ng,args:pe});u(U)}}function p(z,I,G){z.endLoc=i(),z.currentType=I;const pe={type:I};return t&&(pe.loc=li(z.startLoc,z.endLoc)),G!=null&&(pe.value=G),pe}const h=z=>p(z,14);function m(z,I){return z.currentChar()===I?(z.next(),I):(f(Se.EXPECTED_TOKEN,i(),0,I),"")}function y(z){let I="";for(;z.currentPeek()===mn||z.currentPeek()===Ct;)I+=z.currentPeek(),z.peek();return I}function g(z){const I=y(z);return z.skipToPeek(),I}function x(z){if(z===Ln)return!1;const I=z.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I===95}function M(z){if(z===Ln)return!1;const I=z.charCodeAt(0);return I>=48&&I<=57}function E(z,I){const{currentType:G}=I;if(G!==2)return!1;y(z);const pe=x(z.currentPeek());return z.resetPeek(),pe}function v(z,I){const{currentType:G}=I;if(G!==2)return!1;y(z);const pe=z.currentPeek()==="-"?z.peek():z.currentPeek(),Ae=M(pe);return z.resetPeek(),Ae}function _(z,I){const{currentType:G}=I;if(G!==2)return!1;y(z);const pe=z.currentPeek()===Jc;return z.resetPeek(),pe}function A(z,I){const{currentType:G}=I;if(G!==8)return!1;y(z);const pe=z.currentPeek()===".";return z.resetPeek(),pe}function b(z,I){const{currentType:G}=I;if(G!==9)return!1;y(z);const pe=x(z.currentPeek());return z.resetPeek(),pe}function k(z,I){const{currentType:G}=I;if(!(G===8||G===12))return!1;y(z);const pe=z.currentPeek()===":";return z.resetPeek(),pe}function w(z,I){const{currentType:G}=I;if(G!==10)return!1;const pe=()=>{const ye=z.currentPeek();return ye==="{"?x(z.peek()):ye==="@"||ye==="%"||ye==="|"||ye===":"||ye==="."||ye===mn||!ye?!1:ye===Ct?(z.peek(),pe()):T(z,!1)},Ae=pe();return z.resetPeek(),Ae}function O(z){y(z);const I=z.currentPeek()==="|";return z.resetPeek(),I}function q(z){const I=y(z),G=z.currentPeek()==="%"&&z.peek()==="{";return z.resetPeek(),{isModulo:G,hasSpace:I.length>0}}function T(z,I=!0){const G=(Ae=!1,ye="",U=!1)=>{const X=z.currentPeek();return X==="{"?ye==="%"?!1:Ae:X==="@"||!X?ye==="%"?!0:Ae:X==="%"?(z.peek(),G(Ae,"%",!0)):X==="|"?ye==="%"||U?!0:!(ye===mn||ye===Ct):X===mn?(z.peek(),G(!0,mn,U)):X===Ct?(z.peek(),G(!0,Ct,U)):!0},pe=G();return I&&z.resetPeek(),pe}function R(z,I){const G=z.currentChar();return G===Ln?Ln:I(G)?(z.next(),G):null}function H(z){const I=z.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36}function F(z){return R(z,H)}function L(z){const I=z.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36||I===45}function B(z){return R(z,L)}function te(z){const I=z.charCodeAt(0);return I>=48&&I<=57}function K(z){return R(z,te)}function ae(z){const I=z.charCodeAt(0);return I>=48&&I<=57||I>=65&&I<=70||I>=97&&I<=102}function Q(z){return R(z,ae)}function Z(z){let I="",G="";for(;I=K(z);)G+=I;return G}function Y(z){g(z);const I=z.currentChar();return I!=="%"&&f(Se.EXPECTED_TOKEN,i(),0,I),z.next(),"%"}function J(z){let I="";for(;;){const G=z.currentChar();if(G==="{"||G==="}"||G==="@"||G==="|"||!G)break;if(G==="%")if(T(z))I+=G,z.next();else break;else if(G===mn||G===Ct)if(T(z))I+=G,z.next();else{if(O(z))break;I+=G,z.next()}else I+=G,z.next()}return I}function ee(z){g(z);let I="",G="";for(;I=B(z);)G+=I;return z.currentChar()===Ln&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),G}function de(z){g(z);let I="";return z.currentChar()==="-"?(z.next(),I+=`-${Z(z)}`):I+=Z(z),z.currentChar()===Ln&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),I}function we(z){return z!==Jc&&z!==Ct}function Ne(z){g(z),m(z,"'");let I="",G="";for(;I=R(z,we);)I==="\\"?G+=Pe(z):G+=I;const pe=z.currentChar();return pe===Ct||pe===Ln?(f(Se.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,i(),0),pe===Ct&&(z.next(),m(z,"'")),G):(m(z,"'"),G)}function Pe(z){const I=z.currentChar();switch(I){case"\\":case"'":return z.next(),`\\${I}`;case"u":return C(z,I,4);case"U":return C(z,I,6);default:return f(Se.UNKNOWN_ESCAPE_SEQUENCE,i(),0,I),""}}function C(z,I,G){m(z,I);let pe="";for(let Ae=0;Ae<G;Ae++){const ye=Q(z);if(!ye){f(Se.INVALID_UNICODE_ESCAPE_SEQUENCE,i(),0,`\\${I}${pe}${z.currentChar()}`);break}pe+=ye}return`\\${I}${pe}`}function P(z){return z!=="{"&&z!=="}"&&z!==mn&&z!==Ct}function V(z){g(z);let I="",G="";for(;I=R(z,P);)G+=I;return G}function S(z){let I="",G="";for(;I=F(z);)G+=I;return G}function N(z){const I=G=>{const pe=z.currentChar();return pe==="{"||pe==="%"||pe==="@"||pe==="|"||pe==="("||pe===")"||!pe||pe===mn?G:(G+=pe,z.next(),I(G))};return I("")}function $(z){g(z);const I=m(z,"|");return g(z),I}function ne(z,I){let G=null;switch(z.currentChar()){case"{":return I.braceNest>=1&&f(Se.NOT_ALLOW_NEST_PLACEHOLDER,i(),0),z.next(),G=p(I,2,"{"),g(z),I.braceNest++,G;case"}":return I.braceNest>0&&I.currentType===2&&f(Se.EMPTY_PLACEHOLDER,i(),0),z.next(),G=p(I,3,"}"),I.braceNest--,I.braceNest>0&&g(z),I.inLinked&&I.braceNest===0&&(I.inLinked=!1),G;case"@":return I.braceNest>0&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),G=me(z,I)||h(I),I.braceNest=0,G;default:{let Ae=!0,ye=!0,U=!0;if(O(z))return I.braceNest>0&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),G=p(I,1,$(z)),I.braceNest=0,I.inLinked=!1,G;if(I.braceNest>0&&(I.currentType===5||I.currentType===6||I.currentType===7))return f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),I.braceNest=0,De(z,I);if(Ae=E(z,I))return G=p(I,5,ee(z)),g(z),G;if(ye=v(z,I))return G=p(I,6,de(z)),g(z),G;if(U=_(z,I))return G=p(I,7,Ne(z)),g(z),G;if(!Ae&&!ye&&!U)return G=p(I,13,V(z)),f(Se.INVALID_TOKEN_IN_PLACEHOLDER,i(),0,G.value),g(z),G;break}}return G}function me(z,I){const{currentType:G}=I;let pe=null;const Ae=z.currentChar();switch((G===8||G===9||G===12||G===10)&&(Ae===Ct||Ae===mn)&&f(Se.INVALID_LINKED_FORMAT,i(),0),Ae){case"@":return z.next(),pe=p(I,8,"@"),I.inLinked=!0,pe;case".":return g(z),z.next(),p(I,9,".");case":":return g(z),z.next(),p(I,10,":");default:return O(z)?(pe=p(I,1,$(z)),I.braceNest=0,I.inLinked=!1,pe):A(z,I)||k(z,I)?(g(z),me(z,I)):b(z,I)?(g(z),p(I,12,S(z))):w(z,I)?(g(z),Ae==="{"?ne(z,I)||pe:p(I,11,N(z))):(G===8&&f(Se.INVALID_LINKED_FORMAT,i(),0),I.braceNest=0,I.inLinked=!1,De(z,I))}}function De(z,I){let G={type:14};if(I.braceNest>0)return ne(z,I)||h(I);if(I.inLinked)return me(z,I)||h(I);switch(z.currentChar()){case"{":return ne(z,I)||h(I);case"}":return f(Se.UNBALANCED_CLOSING_BRACE,i(),0),z.next(),p(I,3,"}");case"@":return me(z,I)||h(I);default:{if(O(z))return G=p(I,1,$(z)),I.braceNest=0,I.inLinked=!1,G;const{isModulo:Ae,hasSpace:ye}=q(z);if(Ae)return ye?p(I,0,J(z)):p(I,4,Y(z));if(T(z))return p(I,0,J(z));break}}return G}function Te(){const{currentType:z,offset:I,startLoc:G,endLoc:pe}=c;return c.lastType=z,c.lastOffset=I,c.lastStartLoc=G,c.lastEndLoc=pe,c.offset=r(),c.startLoc=i(),o.currentChar()===Ln?p(c,14):De(o,c)}return{nextToken:Te,currentOffset:r,currentPosition:i,context:d}}const vg="parser",zg=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function Mg(n,e,t){switch(n){case"\\\\":return"\\";case"\\'":return"'";default:{const o=parseInt(e||t,16);return o<=55295||o>=57344?String.fromCodePoint(o):"�"}}}function Ag(n={}){const e=n.location!==!1,{onError:t,onWarn:o}=n;function r(E,v,_,A,...b){const k=E.currentPosition();if(k.offset+=A,k.column+=A,t){const w=e?li(_,k):null,O=No(v,w,{domain:vg,args:b});t(O)}}function i(E,v,_,A,...b){const k=E.currentPosition();if(k.offset+=A,k.column+=A,o){const w=e?li(_,k):null;o(yg(v,w,b))}}function s(E,v,_){const A={type:E};return e&&(A.start=v,A.end=v,A.loc={start:_,end:_}),A}function l(E,v,_,A){e&&(E.end=v,E.loc&&(E.loc.end=_))}function c(E,v){const _=E.context(),A=s(3,_.offset,_.startLoc);return A.value=v,l(A,E.currentOffset(),E.currentPosition()),A}function d(E,v){const _=E.context(),{lastOffset:A,lastStartLoc:b}=_,k=s(5,A,b);return k.index=parseInt(v,10),E.nextToken(),l(k,E.currentOffset(),E.currentPosition()),k}function u(E,v,_){const A=E.context(),{lastOffset:b,lastStartLoc:k}=A,w=s(4,b,k);return w.key=v,_===!0&&(w.modulo=!0),E.nextToken(),l(w,E.currentOffset(),E.currentPosition()),w}function f(E,v){const _=E.context(),{lastOffset:A,lastStartLoc:b}=_,k=s(9,A,b);return k.value=v.replace(zg,Mg),E.nextToken(),l(k,E.currentOffset(),E.currentPosition()),k}function p(E){const v=E.nextToken(),_=E.context(),{lastOffset:A,lastStartLoc:b}=_,k=s(8,A,b);return v.type!==12?(r(E,Se.UNEXPECTED_EMPTY_LINKED_MODIFIER,_.lastStartLoc,0),k.value="",l(k,A,b),{nextConsumeToken:v,node:k}):(v.value==null&&r(E,Se.UNEXPECTED_LEXICAL_ANALYSIS,_.lastStartLoc,0,Xt(v)),k.value=v.value||"",l(k,E.currentOffset(),E.currentPosition()),{node:k})}function h(E,v){const _=E.context(),A=s(7,_.offset,_.startLoc);return A.value=v,l(A,E.currentOffset(),E.currentPosition()),A}function m(E){const v=E.context(),_=s(6,v.offset,v.startLoc);let A=E.nextToken();if(A.type===9){const b=p(E);_.modifier=b.node,A=b.nextConsumeToken||E.nextToken()}switch(A.type!==10&&r(E,Se.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Xt(A)),A=E.nextToken(),A.type===2&&(A=E.nextToken()),A.type){case 11:A.value==null&&r(E,Se.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Xt(A)),_.key=h(E,A.value||"");break;case 5:A.value==null&&r(E,Se.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Xt(A)),_.key=u(E,A.value||"");break;case 6:A.value==null&&r(E,Se.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Xt(A)),_.key=d(E,A.value||"");break;case 7:A.value==null&&r(E,Se.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Xt(A)),_.key=f(E,A.value||"");break;default:{r(E,Se.UNEXPECTED_EMPTY_LINKED_KEY,v.lastStartLoc,0);const b=E.context(),k=s(7,b.offset,b.startLoc);return k.value="",l(k,b.offset,b.startLoc),_.key=k,l(_,b.offset,b.startLoc),{nextConsumeToken:A,node:_}}}return l(_,E.currentOffset(),E.currentPosition()),{node:_}}function y(E){const v=E.context(),_=v.currentType===1?E.currentOffset():v.offset,A=v.currentType===1?v.endLoc:v.startLoc,b=s(2,_,A);b.items=[];let k=null,w=null;do{const T=k||E.nextToken();switch(k=null,T.type){case 0:T.value==null&&r(E,Se.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Xt(T)),b.items.push(c(E,T.value||""));break;case 6:T.value==null&&r(E,Se.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Xt(T)),b.items.push(d(E,T.value||""));break;case 4:w=!0;break;case 5:T.value==null&&r(E,Se.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Xt(T)),b.items.push(u(E,T.value||"",!!w)),w&&(i(E,na.USE_MODULO_SYNTAX,v.lastStartLoc,0,Xt(T)),w=null);break;case 7:T.value==null&&r(E,Se.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Xt(T)),b.items.push(f(E,T.value||""));break;case 8:{const R=m(E);b.items.push(R.node),k=R.nextConsumeToken||null;break}}}while(v.currentType!==14&&v.currentType!==1);const O=v.currentType===1?v.lastOffset:E.currentOffset(),q=v.currentType===1?v.lastEndLoc:E.currentPosition();return l(b,O,q),b}function g(E,v,_,A){const b=E.context();let k=A.items.length===0;const w=s(1,v,_);w.cases=[],w.cases.push(A);do{const O=y(E);k||(k=O.items.length===0),w.cases.push(O)}while(b.currentType!==14);return k&&r(E,Se.MUST_HAVE_MESSAGES_IN_PLURAL,_,0),l(w,E.currentOffset(),E.currentPosition()),w}function x(E){const v=E.context(),{offset:_,startLoc:A}=v,b=y(E);return v.currentType===14?b:g(E,_,A,b)}function M(E){const v=Tg(E,qc({},n)),_=v.context(),A=s(0,_.offset,_.startLoc);return e&&A.loc&&(A.loc.source=E),A.body=x(v),n.onCacheKey&&(A.cacheKey=n.onCacheKey(E)),_.currentType!==14&&r(v,Se.UNEXPECTED_LEXICAL_ANALYSIS,_.lastStartLoc,0,E[_.offset]||""),l(A,v.currentOffset(),v.currentPosition()),A}return{parse:M}}function Xt(n){if(n.type===14)return"EOF";const e=(n.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function Ig(n,e={}){const t={ast:n,helpers:new Set};return{context:()=>t,helper:i=>(t.helpers.add(i),i)}}function Xc(n,e){for(let t=0;t<n.length;t++)oa(n[t],e)}function oa(n,e){switch(n.type){case 1:Xc(n.cases,e),e.helper("plural");break;case 2:Xc(n.items,e);break;case 6:{oa(n.key,e),e.helper("linked"),e.helper("type");break}case 5:e.helper("interpolate"),e.helper("list");break;case 4:e.helper("interpolate"),e.helper("named");break}}function _g(n,e={}){const t=Ig(n);t.helper("normalize"),n.body&&oa(n.body,t);const o=t.context();n.helpers=Array.from(o.helpers)}function Og(n){const e=n.body;return e.type===2?Yc(e):e.cases.forEach(t=>Yc(t)),n}function Yc(n){if(n.items.length===1){const e=n.items[0];(e.type===3||e.type===9)&&(n.static=e.value,delete e.value)}else{const e=[];for(let t=0;t<n.items.length;t++){const o=n.items[t];if(!(o.type===3||o.type===9)||o.value==null)break;e.push(o.value)}if(e.length===n.items.length){n.static=Kc(e);for(let t=0;t<n.items.length;t++){const o=n.items[t];(o.type===3||o.type===9)&&delete o.value}}}}const Dg="minifier";function To(n){switch(n.t=n.type,n.type){case 0:{const e=n;To(e.body),e.b=e.body,delete e.body;break}case 1:{const e=n,t=e.cases;for(let o=0;o<t.length;o++)To(t[o]);e.c=t,delete e.cases;break}case 2:{const e=n,t=e.items;for(let o=0;o<t.length;o++)To(t[o]);e.i=t,delete e.items,e.static&&(e.s=e.static,delete e.static);break}case 3:case 9:case 8:case 7:{const e=n;e.value&&(e.v=e.value,delete e.value);break}case 6:{const e=n;To(e.key),e.k=e.key,delete e.key,e.modifier&&(To(e.modifier),e.m=e.modifier,delete e.modifier);break}case 5:{const e=n;e.i=e.index,delete e.index;break}case 4:{const e=n;e.k=e.key,delete e.key;break}default:throw No(Se.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:Dg,args:[n.type]})}delete n.type}const Rg="parser";function Pg(n,e){const{filename:t,breakLineCode:o,needIndent:r}=e,i=e.location!==!1,s={filename:t,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:r,indentLevel:0};i&&n.loc&&(s.source=n.loc.source);const l=()=>s;function c(y,g){s.code+=y}function d(y,g=!0){const x=g?o:"";c(r?x+" ".repeat(y):x)}function u(y=!0){const g=++s.indentLevel;y&&d(g)}function f(y=!0){const g=--s.indentLevel;y&&d(g)}function p(){d(s.indentLevel)}return{context:l,push:c,indent:u,deindent:f,newline:p,helper:y=>`_${y}`,needIndent:()=>s.needIndent}}function Lg(n,e){const{helper:t}=n;n.push(`${t("linked")}(`),vo(n,e.key),e.modifier?(n.push(", "),vo(n,e.modifier),n.push(", _type")):n.push(", undefined, _type"),n.push(")")}function $g(n,e){const{helper:t,needIndent:o}=n;n.push(`${t("normalize")}([`),n.indent(o());const r=e.items.length;for(let i=0;i<r&&(vo(n,e.items[i]),i!==r-1);i++)n.push(", ");n.deindent(o()),n.push("])")}function Vg(n,e){const{helper:t,needIndent:o}=n;if(e.cases.length>1){n.push(`${t("plural")}([`),n.indent(o());const r=e.cases.length;for(let i=0;i<r&&(vo(n,e.cases[i]),i!==r-1);i++)n.push(", ");n.deindent(o()),n.push("])")}}function Bg(n,e){e.body?vo(n,e.body):n.push("null")}function vo(n,e){const{helper:t}=n;switch(e.type){case 0:Bg(n,e);break;case 1:Vg(n,e);break;case 2:$g(n,e);break;case 6:Lg(n,e);break;case 8:n.push(JSON.stringify(e.value),e);break;case 7:n.push(JSON.stringify(e.value),e);break;case 5:n.push(`${t("interpolate")}(${t("list")}(${e.index}))`,e);break;case 4:n.push(`${t("interpolate")}(${t("named")}(${JSON.stringify(e.key)}))`,e);break;case 9:n.push(JSON.stringify(e.value),e);break;case 3:n.push(JSON.stringify(e.value),e);break;default:throw No(Se.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:Rg,args:[e.type]})}}const Fg=(n,e={})=>{const t=Gc(e.mode)?e.mode:"normal",o=Gc(e.filename)?e.filename:"message.intl";e.sourceMap;const r=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":`
344
+ `,i=e.needIndent?e.needIndent:t!=="arrow",s=n.helpers||[],l=Pg(n,{filename:o,breakLineCode:r,needIndent:i});l.push(t==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),l.indent(i),s.length>0&&(l.push(`const { ${Kc(s.map(u=>`${u}: _${u}`),", ")} } = ctx`),l.newline()),l.push("return "),vo(l,n),l.deindent(i),l.push("}"),delete n.helpers;const{code:c,map:d}=l.context();return{ast:n,code:c,map:d?d.toJSON():void 0}};function jg(n,e={}){const t=qc({},e),o=!!t.jit,r=!!t.minify,i=t.optimize==null?!0:t.optimize,l=Ag(t).parse(n);return o?(i&&Og(l),r&&To(l),{ast:l,code:""}):(_g(l,t),Fg(l,t))}function Hg(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(ri().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(ri().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function rn(n){return Le(n)&&ra(n)===0&&(Jt(n,"b")||Jt(n,"body"))}const Qc=["b","body"];function Ug(n){return $n(n,Qc)}const Zc=["c","cases"];function Wg(n){return $n(n,Zc,[])}const ed=["s","static"];function qg(n){return $n(n,ed)}const td=["i","items"];function Gg(n){return $n(n,td,[])}const nd=["t","type"];function ra(n){return $n(n,nd)}const od=["v","value"];function ci(n,e){const t=$n(n,od);if(t!=null)return t;throw ir(e)}const rd=["m","modifier"];function Kg(n){return $n(n,rd)}const id=["k","key"];function Jg(n){const e=$n(n,id);if(e)return e;throw ir(6)}function $n(n,e,t){for(let o=0;o<e.length;o++){const r=e[o];if(Jt(n,r)&&n[r]!=null)return n[r]}return t}const sd=[...Qc,...Zc,...ed,...td,...id,...rd,...od,...nd];function ir(n){return new Error(`unhandled node type: ${n}`)}const Vn=[];Vn[0]={w:[0],i:[3,0],"[":[4],o:[7]},Vn[1]={w:[1],".":[2],"[":[4],o:[7]},Vn[2]={w:[2],i:[3,0],0:[3,0]},Vn[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},Vn[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},Vn[5]={"'":[4,0],o:8,l:[5,0]},Vn[6]={'"':[4,0],o:8,l:[6,0]};const Xg=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function Yg(n){return Xg.test(n)}function Qg(n){const e=n.charCodeAt(0),t=n.charCodeAt(n.length-1);return e===t&&(e===34||e===39)?n.slice(1,-1):n}function Zg(n){if(n==null)return"o";switch(n.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return n;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function ey(n){const e=n.trim();return n.charAt(0)==="0"&&isNaN(parseInt(n))?!1:Yg(e)?Qg(e):"*"+e}function ty(n){const e=[];let t=-1,o=0,r=0,i,s,l,c,d,u,f;const p=[];p[0]=()=>{s===void 0?s=l:s+=l},p[1]=()=>{s!==void 0&&(e.push(s),s=void 0)},p[2]=()=>{p[0](),r++},p[3]=()=>{if(r>0)r--,o=4,p[0]();else{if(r=0,s===void 0||(s=ey(s),s===!1))return!1;p[1]()}};function h(){const m=n[t+1];if(o===5&&m==="'"||o===6&&m==='"')return t++,l="\\"+m,p[0](),!0}for(;o!==null;)if(t++,i=n[t],!(i==="\\"&&h())){if(c=Zg(i),f=Vn[o],d=f[c]||f.l||8,d===8||(o=d[0],d[1]!==void 0&&(u=p[d[1]],u&&(l=i,u()===!1))))return;if(o===7)return e}}const ad=new Map;function ny(n,e){return Le(n)?n[e]:null}function oy(n,e){if(!Le(n))return null;let t=ad.get(e);if(t||(t=ty(e),t&&ad.set(e,t)),!t)return null;const o=t.length;let r=n,i=0;for(;i<o;){const s=t[i];if(sd.includes(s)&&rn(r))return null;const l=r[s];if(l===void 0||Je(r))return null;r=l,i++}return r}const ry=n=>n,iy=n=>"",sy="text",ay=n=>n.length===0?"":fg(n),ly=ug;function ld(n,e){return n=Math.abs(n),e===2?n?n>1?1:0:1:n?Math.min(n,2):0}function cy(n){const e=it(n.pluralIndex)?n.pluralIndex:-1;return n.named&&(it(n.named.count)||it(n.named.n))?it(n.named.count)?n.named.count:it(n.named.n)?n.named.n:e:e}function dy(n,e){e.count||(e.count=n),e.n||(e.n=n)}function uy(n={}){const e=n.locale,t=cy(n),o=Le(n.pluralRules)&&xe(e)&&Je(n.pluralRules[e])?n.pluralRules[e]:ld,r=Le(n.pluralRules)&&xe(e)&&Je(n.pluralRules[e])?ld:void 0,i=x=>x[o(t,x.length,r)],s=n.list||[],l=x=>s[x],c=n.named||Be();it(n.pluralIndex)&&dy(t,c);const d=x=>c[x];function u(x){const M=Je(n.messages)?n.messages(x):Le(n.messages)?n.messages[x]:!1;return M||(n.parent?n.parent.message(x):iy)}const f=x=>n.modifiers?n.modifiers[x]:ry,p=$e(n.processor)&&Je(n.processor.normalize)?n.processor.normalize:ay,h=$e(n.processor)&&Je(n.processor.interpolate)?n.processor.interpolate:ly,m=$e(n.processor)&&xe(n.processor.type)?n.processor.type:sy,g={list:l,named:d,plural:i,linked:(x,...M)=>{const[E,v]=M;let _="text",A="";M.length===1?Le(E)?(A=E.modifier||A,_=E.type||_):xe(E)&&(A=E||A):M.length===2&&(xe(E)&&(A=E||A),xe(v)&&(_=v||_));const b=u(x)(g),k=_==="vnode"&&rt(b)&&A?b[0]:b;return A?f(A)(k,_):k},message:u,type:m,interpolate:h,normalize:p,values:St(Be(),s,c)};return g}const fy=na.__EXTEND_POINT__,so=ii(fy),py={FALLBACK_TO_TRANSLATE:so(),CANNOT_FORMAT_NUMBER:so(),FALLBACK_TO_NUMBER_FORMAT:so(),CANNOT_FORMAT_DATE:so(),FALLBACK_TO_DATE_FORMAT:so(),EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:so(),__EXTEND_POINT__:so()},cd=Se.__EXTEND_POINT__,ao=ii(cd),Yt={INVALID_ARGUMENT:cd,INVALID_DATE_ARGUMENT:ao(),INVALID_ISO_DATE_ARGUMENT:ao(),NOT_SUPPORT_NON_STRING_MESSAGE:ao(),NOT_SUPPORT_LOCALE_PROMISE_VALUE:ao(),NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:ao(),NOT_SUPPORT_LOCALE_TYPE:ao(),__EXTEND_POINT__:ao()};function sn(n){return No(n,null,void 0)}function ia(n,e){return e.locale!=null?dd(e.locale):dd(n.locale)}let sa;function dd(n){if(xe(n))return n;if(Je(n)){if(n.resolvedOnce&&sa!=null)return sa;if(n.constructor.name==="Function"){const e=n();if(dg(e))throw sn(Yt.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return sa=e}else throw sn(Yt.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw sn(Yt.NOT_SUPPORT_LOCALE_TYPE)}function hy(n,e,t){return[...new Set([t,...rt(e)?e:Le(e)?Object.keys(e):xe(e)?[e]:[t]])]}function ud(n,e,t){const o=xe(t)?t:ui,r=n;r.__localeChainCache||(r.__localeChainCache=new Map);let i=r.__localeChainCache.get(o);if(!i){i=[];let s=[t];for(;rt(s);)s=fd(i,s,e);const l=rt(e)||!$e(e)?e:e.default?e.default:null;s=xe(l)?[l]:l,rt(s)&&fd(i,s,!1),r.__localeChainCache.set(o,i)}return i}function fd(n,e,t){let o=!0;for(let r=0;r<e.length&&Ke(o);r++){const i=e[r];xe(i)&&(o=my(n,e[r],t))}return o}function my(n,e,t){let o;const r=e.split("-");do{const i=r.join("-");o=gy(n,i,t),r.splice(-1,1)}while(r.length&&o===!0);return o}function gy(n,e,t){let o=!1;if(!n.includes(e)&&(o=!0,e)){o=e[e.length-1]!=="!";const r=e.replace(/!/g,"");n.push(r),(rt(t)||$e(t))&&t[r]&&(o=t[r])}return o}const yy="9.14.5",di=-1,ui="en-US",pd="",hd=n=>`${n.charAt(0).toLocaleUpperCase()}${n.substr(1)}`;function by(){return{upper:(n,e)=>e==="text"&&xe(n)?n.toUpperCase():e==="vnode"&&Le(n)&&"__v_isVNode"in n?n.children.toUpperCase():n,lower:(n,e)=>e==="text"&&xe(n)?n.toLowerCase():e==="vnode"&&Le(n)&&"__v_isVNode"in n?n.children.toLowerCase():n,capitalize:(n,e)=>e==="text"&&xe(n)?hd(n):e==="vnode"&&Le(n)&&"__v_isVNode"in n?hd(n.children):n}}let md;function gd(n){md=n}let yd;function xy(n){yd=n}let bd;function ky(n){bd=n}const rA=n=>{};let xd=null;const kd=n=>{xd=n},Ey=()=>xd;let Ed=0;function wy(n={}){const e=Je(n.onWarn)?n.onWarn:og,t=xe(n.version)?n.version:yy,o=xe(n.locale)||Je(n.locale)?n.locale:ui,r=Je(o)?ui:o,i=rt(n.fallbackLocale)||$e(n.fallbackLocale)||xe(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:r,s=$e(n.messages)?n.messages:aa(r),l=$e(n.datetimeFormats)?n.datetimeFormats:aa(r),c=$e(n.numberFormats)?n.numberFormats:aa(r),d=St(Be(),n.modifiers,by()),u=n.pluralRules||Be(),f=Je(n.missing)?n.missing:null,p=Ke(n.missingWarn)||ni(n.missingWarn)?n.missingWarn:!0,h=Ke(n.fallbackWarn)||ni(n.fallbackWarn)?n.fallbackWarn:!0,m=!!n.fallbackFormat,y=!!n.unresolving,g=Je(n.postTranslation)?n.postTranslation:null,x=$e(n.processor)?n.processor:null,M=Ke(n.warnHtmlMessage)?n.warnHtmlMessage:!0,E=!!n.escapeParameter,v=Je(n.messageCompiler)?n.messageCompiler:md,_=Je(n.messageResolver)?n.messageResolver:yd||ny,A=Je(n.localeFallbacker)?n.localeFallbacker:bd||hy,b=Le(n.fallbackContext)?n.fallbackContext:void 0,k=n,w=Le(k.__datetimeFormatters)?k.__datetimeFormatters:new Map,O=Le(k.__numberFormatters)?k.__numberFormatters:new Map,q=Le(k.__meta)?k.__meta:{};Ed++;const T={version:t,cid:Ed,locale:o,fallbackLocale:i,messages:s,modifiers:d,pluralRules:u,missing:f,missingWarn:p,fallbackWarn:h,fallbackFormat:m,unresolving:y,postTranslation:g,processor:x,warnHtmlMessage:M,escapeParameter:E,messageCompiler:v,messageResolver:_,localeFallbacker:A,fallbackContext:b,onWarn:e,__meta:q};return T.datetimeFormats=l,T.numberFormats=c,T.__datetimeFormatters=w,T.__numberFormatters=O,T}const aa=n=>({[n]:Be()});function la(n,e,t,o,r){const{missing:i,onWarn:s}=n;if(i!==null){const l=i(n,t,e,r);return xe(l)?l:e}else return e}function sr(n,e,t){const o=n;o.__localeChainCache=new Map,n.localeFallbacker(n,t,e)}function Sy(n,e){return n===e?!1:n.split("-")[0]===e.split("-")[0]}function Cy(n,e){const t=e.indexOf(n);if(t===-1)return!1;for(let o=t+1;o<e.length;o++)if(Sy(n,e[o]))return!0;return!1}function ca(n){return t=>Ny(t,n)}function Ny(n,e){const t=Ug(e);if(t==null)throw ir(0);if(ra(t)===1){const i=Wg(t);return n.plural(i.reduce((s,l)=>[...s,wd(n,l)],[]))}else return wd(n,t)}function wd(n,e){const t=qg(e);if(t!=null)return n.type==="text"?t:n.normalize([t]);{const o=Gg(e).reduce((r,i)=>[...r,da(n,i)],[]);return n.normalize(o)}}function da(n,e){const t=ra(e);switch(t){case 3:return ci(e,t);case 9:return ci(e,t);case 4:{const o=e;if(Jt(o,"k")&&o.k)return n.interpolate(n.named(o.k));if(Jt(o,"key")&&o.key)return n.interpolate(n.named(o.key));throw ir(t)}case 5:{const o=e;if(Jt(o,"i")&&it(o.i))return n.interpolate(n.list(o.i));if(Jt(o,"index")&&it(o.index))return n.interpolate(n.list(o.index));throw ir(t)}case 6:{const o=e,r=Kg(o),i=Jg(o);return n.linked(da(n,i),r?da(n,r):void 0,n.type)}case 7:return ci(e,t);case 8:return ci(e,t);default:throw new Error(`unhandled node on format message part: ${t}`)}}const Sd=n=>n;let zo=Be();function Cd(n,e={}){let t=!1;const o=e.onError||xg;return e.onError=r=>{t=!0,o(r)},{...jg(n,e),detectError:t}}const Ty=(n,e)=>{if(!xe(n))throw sn(Yt.NOT_SUPPORT_NON_STRING_MESSAGE);{Ke(e.warnHtmlMessage)&&e.warnHtmlMessage;const o=(e.onCacheKey||Sd)(n),r=zo[o];if(r)return r;const{code:i,detectError:s}=Cd(n,e),l=new Function(`return ${i}`)();return s?l:zo[o]=l}};function vy(n,e){if(__INTLIFY_JIT_COMPILATION__&&!__INTLIFY_DROP_MESSAGE_COMPILER__&&xe(n)){Ke(e.warnHtmlMessage)&&e.warnHtmlMessage;const o=(e.onCacheKey||Sd)(n),r=zo[o];if(r)return r;const{ast:i,detectError:s}=Cd(n,{...e,location:!1,jit:!0}),l=ca(i);return s?l:zo[o]=l}else{const t=n.cacheKey;if(t){const o=zo[t];return o||(zo[t]=ca(n))}else return ca(n)}}const Nd=()=>"",gn=n=>Je(n);function Td(n,...e){const{fallbackFormat:t,postTranslation:o,unresolving:r,messageCompiler:i,fallbackLocale:s,messages:l}=n,[c,d]=ua(...e),u=Ke(d.missingWarn)?d.missingWarn:n.missingWarn,f=Ke(d.fallbackWarn)?d.fallbackWarn:n.fallbackWarn,p=Ke(d.escapeParameter)?d.escapeParameter:n.escapeParameter,h=!!d.resolvedMessage,m=xe(d.default)||Ke(d.default)?Ke(d.default)?i?c:()=>c:d.default:t?i?c:()=>c:"",y=t||m!=="",g=ia(n,d);p&&zy(d);let[x,M,E]=h?[c,g,l[g]||Be()]:vd(n,c,g,s,f,u),v=x,_=c;if(!h&&!(xe(v)||rn(v)||gn(v))&&y&&(v=m,_=v),!h&&(!(xe(v)||rn(v)||gn(v))||!xe(M)))return r?di:c;let A=!1;const b=()=>{A=!0},k=gn(v)?v:zd(n,c,M,v,_,b);if(A)return v;const w=Iy(n,M,E,d),O=uy(w),q=My(n,k,O);let T=o?o(q,c):q;return p&&xe(T)&&(T=lg(T)),T}function zy(n){rt(n.list)?n.list=n.list.map(e=>xe(e)?Fc(e):e):Le(n.named)&&Object.keys(n.named).forEach(e=>{xe(n.named[e])&&(n.named[e]=Fc(n.named[e]))})}function vd(n,e,t,o,r,i){const{messages:s,onWarn:l,messageResolver:c,localeFallbacker:d}=n,u=d(n,o,t);let f=Be(),p,h=null;const m="translate";for(let y=0;y<u.length&&(p=u[y],f=s[p]||Be(),(h=c(f,e))===null&&(h=f[e]),!(xe(h)||rn(h)||gn(h)));y++)if(!Cy(p,u)){const g=la(n,e,p,i,m);g!==e&&(h=g)}return[h,p,f]}function zd(n,e,t,o,r,i){const{messageCompiler:s,warnHtmlMessage:l}=n;if(gn(o)){const d=o;return d.locale=d.locale||t,d.key=d.key||e,d}if(s==null){const d=(()=>o);return d.locale=t,d.key=e,d}const c=s(o,Ay(n,t,r,o,l,i));return c.locale=t,c.key=e,c.source=o,c}function My(n,e,t){return e(t)}function ua(...n){const[e,t,o]=n,r=Be();if(!xe(e)&&!it(e)&&!gn(e)&&!rn(e))throw sn(Yt.INVALID_ARGUMENT);const i=it(e)?String(e):(gn(e),e);return it(t)?r.plural=t:xe(t)?r.default=t:$e(t)&&!oi(t)?r.named=t:rt(t)&&(r.list=t),it(o)?r.plural=o:xe(o)?r.default=o:$e(o)&&St(r,o),[i,r]}function Ay(n,e,t,o,r,i){return{locale:e,key:t,warnHtmlMessage:r,onError:s=>{throw i&&i(s),s},onCacheKey:s=>rg(e,t,s)}}function Iy(n,e,t,o){const{modifiers:r,pluralRules:i,messageResolver:s,fallbackLocale:l,fallbackWarn:c,missingWarn:d,fallbackContext:u}=n,p={locale:e,modifiers:r,pluralRules:i,messages:h=>{let m=s(t,h);if(m==null&&u){const[,,y]=vd(u,h,e,l,c,d);m=s(y,h)}if(xe(m)||rn(m)){let y=!1;const x=zd(n,h,e,m,h,()=>{y=!0});return y?Nd:x}else return gn(m)?m:Nd}};return n.processor&&(p.processor=n.processor),o.list&&(p.list=o.list),o.named&&(p.named=o.named),it(o.plural)&&(p.pluralIndex=o.plural),p}function Md(n,...e){const{datetimeFormats:t,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:s}=n,{__datetimeFormatters:l}=n,[c,d,u,f]=fa(...e),p=Ke(u.missingWarn)?u.missingWarn:n.missingWarn;Ke(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn;const h=!!u.part,m=ia(n,u),y=s(n,r,m);if(!xe(c)||c==="")return new Intl.DateTimeFormat(m,f).format(d);let g={},x,M=null;const E="datetime format";for(let A=0;A<y.length&&(x=y[A],g=t[x]||{},M=g[c],!$e(M));A++)la(n,c,x,p,E);if(!$e(M)||!xe(x))return o?di:c;let v=`${x}__${c}`;oi(f)||(v=`${v}__${JSON.stringify(f)}`);let _=l.get(v);return _||(_=new Intl.DateTimeFormat(x,St({},M,f)),l.set(v,_)),h?_.formatToParts(d):_.format(d)}const Ad=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function fa(...n){const[e,t,o,r]=n,i=Be();let s=Be(),l;if(xe(e)){const c=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!c)throw sn(Yt.INVALID_ISO_DATE_ARGUMENT);const d=c[3]?c[3].trim().startsWith("T")?`${c[1].trim()}${c[3].trim()}`:`${c[1].trim()}T${c[3].trim()}`:c[1].trim();l=new Date(d);try{l.toISOString()}catch{throw sn(Yt.INVALID_ISO_DATE_ARGUMENT)}}else if(sg(e)){if(isNaN(e.getTime()))throw sn(Yt.INVALID_DATE_ARGUMENT);l=e}else if(it(e))l=e;else throw sn(Yt.INVALID_ARGUMENT);return xe(t)?i.key=t:$e(t)&&Object.keys(t).forEach(c=>{Ad.includes(c)?s[c]=t[c]:i[c]=t[c]}),xe(o)?i.locale=o:$e(o)&&(s=o),$e(r)&&(s=r),[i.key||"",l,i,s]}function Id(n,e,t){const o=n;for(const r in t){const i=`${e}__${r}`;o.__datetimeFormatters.has(i)&&o.__datetimeFormatters.delete(i)}}function _d(n,...e){const{numberFormats:t,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:s}=n,{__numberFormatters:l}=n,[c,d,u,f]=pa(...e),p=Ke(u.missingWarn)?u.missingWarn:n.missingWarn;Ke(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn;const h=!!u.part,m=ia(n,u),y=s(n,r,m);if(!xe(c)||c==="")return new Intl.NumberFormat(m,f).format(d);let g={},x,M=null;const E="number format";for(let A=0;A<y.length&&(x=y[A],g=t[x]||{},M=g[c],!$e(M));A++)la(n,c,x,p,E);if(!$e(M)||!xe(x))return o?di:c;let v=`${x}__${c}`;oi(f)||(v=`${v}__${JSON.stringify(f)}`);let _=l.get(v);return _||(_=new Intl.NumberFormat(x,St({},M,f)),l.set(v,_)),h?_.formatToParts(d):_.format(d)}const Od=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function pa(...n){const[e,t,o,r]=n,i=Be();let s=Be();if(!it(e))throw sn(Yt.INVALID_ARGUMENT);const l=e;return xe(t)?i.key=t:$e(t)&&Object.keys(t).forEach(c=>{Od.includes(c)?s[c]=t[c]:i[c]=t[c]}),xe(o)?i.locale=o:$e(o)&&(s=o),$e(r)&&(s=r),[i.key||"",l,i,s]}function Dd(n,e,t){const o=n;for(const r in t){const i=`${e}__${r}`;o.__numberFormatters.has(i)&&o.__numberFormatters.delete(i)}}Hg();const _y="9.14.5";function Oy(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(ri().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(ri().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}const Dy=py.__EXTEND_POINT__,yn=ii(Dy);yn(),yn(),yn(),yn(),yn(),yn(),yn(),yn(),yn();const Rd=Yt.__EXTEND_POINT__,zt=ii(Rd),bn={UNEXPECTED_RETURN_TYPE:Rd,INVALID_ARGUMENT:zt(),MUST_BE_CALL_SETUP_TOP:zt(),NOT_INSTALLED:zt(),NOT_AVAILABLE_IN_LEGACY_MODE:zt(),REQUIRED_VALUE:zt(),INVALID_VALUE:zt(),CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:zt(),NOT_INSTALLED_WITH_PROVIDE:zt(),UNEXPECTED_ERROR:zt(),NOT_COMPATIBLE_LEGACY_VUE_I18N:zt(),BRIDGE_SUPPORT_VUE_2_ONLY:zt(),MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION:zt(),NOT_AVAILABLE_COMPOSITION_IN_LEGACY:zt(),__EXTEND_POINT__:zt()};function Bn(n,...e){return No(n,null,void 0)}const ha=Pn("__translateVNode"),ma=Pn("__datetimeParts"),ga=Pn("__numberParts"),Ry=Pn("__setPluralRules"),Py=Pn("__injectWithOption"),ya=Pn("__dispose");function ar(n){if(!Le(n)||rn(n))return n;for(const e in n)if(Jt(n,e))if(!e.includes("."))Le(n[e])&&ar(n[e]);else{const t=e.split("."),o=t.length-1;let r=n,i=!1;for(let s=0;s<o;s++){if(t[s]==="__proto__")throw new Error(`unsafe key: ${t[s]}`);if(t[s]in r||(r[t[s]]=Be()),!Le(r[t[s]])){i=!0;break}r=r[t[s]]}if(i||(rn(r)?sd.includes(t[o])||delete n[e]:(r[t[o]]=n[e],delete n[e])),!rn(r)){const s=r[t[o]];Le(s)&&ar(s)}}return n}function Pd(n,e){const{messages:t,__i18n:o,messageResolver:r,flatJson:i}=e,s=$e(t)?t:rt(o)?Be():{[n]:Be()};if(rt(o)&&o.forEach(l=>{if("locale"in l&&"resource"in l){const{locale:c,resource:d}=l;c?(s[c]=s[c]||Be(),ai(d,s[c])):ai(d,s)}else xe(l)&&ai(JSON.parse(l),s)}),r==null&&i)for(const l in s)Jt(s,l)&&ar(s[l]);return s}function Ld(n){return n.type}function Ly(n,e,t){let o=Le(e.messages)?e.messages:Be();"__i18nGlobal"in t&&(o=Pd(n.locale.value,{messages:o,__i18n:t.__i18nGlobal}));const r=Object.keys(o);r.length&&r.forEach(i=>{n.mergeLocaleMessage(i,o[i])});{if(Le(e.datetimeFormats)){const i=Object.keys(e.datetimeFormats);i.length&&i.forEach(s=>{n.mergeDateTimeFormat(s,e.datetimeFormats[s])})}if(Le(e.numberFormats)){const i=Object.keys(e.numberFormats);i.length&&i.forEach(s=>{n.mergeNumberFormat(s,e.numberFormats[s])})}}}function $d(n){return a.createVNode(a.Text,null,n,0)}const Vd="__INTLIFY_META__",Bd=()=>[],$y=()=>!1;let Fd=0;function jd(n){return((e,t,o,r)=>n(t,o,a.getCurrentInstance()||void 0,r))}const iA=()=>{const n=a.getCurrentInstance();let e=null;return n&&(e=Ld(n)[Vd])?{[Vd]:e}:null};function Hd(n={},e){const{__root:t,__injectWithOption:o}=n,r=t===void 0,i=n.flatJson,s=Vc?a.ref:a.shallowRef,l=!!n.translateExistCompatible;let c=Ke(n.inheritLocale)?n.inheritLocale:!0;const d=s(t&&c?t.locale.value:xe(n.locale)?n.locale:ui),u=s(t&&c?t.fallbackLocale.value:xe(n.fallbackLocale)||rt(n.fallbackLocale)||$e(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:d.value),f=s(Pd(d.value,n)),p=s($e(n.datetimeFormats)?n.datetimeFormats:{[d.value]:{}}),h=s($e(n.numberFormats)?n.numberFormats:{[d.value]:{}});let m=t?t.missingWarn:Ke(n.missingWarn)||ni(n.missingWarn)?n.missingWarn:!0,y=t?t.fallbackWarn:Ke(n.fallbackWarn)||ni(n.fallbackWarn)?n.fallbackWarn:!0,g=t?t.fallbackRoot:Ke(n.fallbackRoot)?n.fallbackRoot:!0,x=!!n.fallbackFormat,M=Je(n.missing)?n.missing:null,E=Je(n.missing)?jd(n.missing):null,v=Je(n.postTranslation)?n.postTranslation:null,_=t?t.warnHtmlMessage:Ke(n.warnHtmlMessage)?n.warnHtmlMessage:!0,A=!!n.escapeParameter;const b=t?t.modifiers:$e(n.modifiers)?n.modifiers:{};let k=n.pluralRules||t&&t.pluralRules,w;w=(()=>{r&&kd(null);const U={version:_y,locale:d.value,fallbackLocale:u.value,messages:f.value,modifiers:b,pluralRules:k,missing:E===null?void 0:E,missingWarn:m,fallbackWarn:y,fallbackFormat:x,unresolving:!0,postTranslation:v===null?void 0:v,warnHtmlMessage:_,escapeParameter:A,messageResolver:n.messageResolver,messageCompiler:n.messageCompiler,__meta:{framework:"vue"}};U.datetimeFormats=p.value,U.numberFormats=h.value,U.__datetimeFormatters=$e(w)?w.__datetimeFormatters:void 0,U.__numberFormatters=$e(w)?w.__numberFormatters:void 0;const X=wy(U);return r&&kd(X),X})(),sr(w,d.value,u.value);function q(){return[d.value,u.value,f.value,p.value,h.value]}const T=a.computed({get:()=>d.value,set:U=>{d.value=U,w.locale=d.value}}),R=a.computed({get:()=>u.value,set:U=>{u.value=U,w.fallbackLocale=u.value,sr(w,d.value,U)}}),H=a.computed(()=>f.value),F=a.computed(()=>p.value),L=a.computed(()=>h.value);function B(){return Je(v)?v:null}function te(U){v=U,w.postTranslation=U}function K(){return M}function ae(U){U!==null&&(E=jd(U)),M=U,w.missing=E}const Q=(U,X,ze,Ve,j,W)=>{q();let re;try{r||(w.fallbackContext=t?Ey():void 0),re=U(w)}finally{r||(w.fallbackContext=void 0)}if(ze!=="translate exists"&&it(re)&&re===di||ze==="translate exists"&&!re){const[ce,ve]=X();return t&&g?Ve(t):j(ce)}else{if(W(re))return re;throw Bn(bn.UNEXPECTED_RETURN_TYPE)}};function Z(...U){return Q(X=>Reflect.apply(Td,null,[X,...U]),()=>ua(...U),"translate",X=>Reflect.apply(X.t,X,[...U]),X=>X,X=>xe(X))}function Y(...U){const[X,ze,Ve]=U;if(Ve&&!Le(Ve))throw Bn(bn.INVALID_ARGUMENT);return Z(X,ze,St({resolvedMessage:!0},Ve||{}))}function J(...U){return Q(X=>Reflect.apply(Md,null,[X,...U]),()=>fa(...U),"datetime format",X=>Reflect.apply(X.d,X,[...U]),()=>pd,X=>xe(X))}function ee(...U){return Q(X=>Reflect.apply(_d,null,[X,...U]),()=>pa(...U),"number format",X=>Reflect.apply(X.n,X,[...U]),()=>pd,X=>xe(X))}function de(U){return U.map(X=>xe(X)||it(X)||Ke(X)?$d(String(X)):X)}const Ne={normalize:de,interpolate:U=>U,type:"vnode"};function Pe(...U){return Q(X=>{let ze;const Ve=X;try{Ve.processor=Ne,ze=Reflect.apply(Td,null,[Ve,...U])}finally{Ve.processor=null}return ze},()=>ua(...U),"translate",X=>X[ha](...U),X=>[$d(X)],X=>rt(X))}function C(...U){return Q(X=>Reflect.apply(_d,null,[X,...U]),()=>pa(...U),"number format",X=>X[ga](...U),Bd,X=>xe(X)||rt(X))}function P(...U){return Q(X=>Reflect.apply(Md,null,[X,...U]),()=>fa(...U),"datetime format",X=>X[ma](...U),Bd,X=>xe(X)||rt(X))}function V(U){k=U,w.pluralRules=k}function S(U,X){return Q(()=>{if(!U)return!1;const ze=xe(X)?X:d.value,Ve=ne(ze),j=w.messageResolver(Ve,U);return l?j!=null:rn(j)||gn(j)||xe(j)},()=>[U],"translate exists",ze=>Reflect.apply(ze.te,ze,[U,X]),$y,ze=>Ke(ze))}function N(U){let X=null;const ze=ud(w,u.value,d.value);for(let Ve=0;Ve<ze.length;Ve++){const j=f.value[ze[Ve]]||{},W=w.messageResolver(j,U);if(W!=null){X=W;break}}return X}function $(U){const X=N(U);return X??(t?t.tm(U)||{}:{})}function ne(U){return f.value[U]||{}}function me(U,X){if(i){const ze={[U]:X};for(const Ve in ze)Jt(ze,Ve)&&ar(ze[Ve]);X=ze[U]}f.value[U]=X,w.messages=f.value}function De(U,X){f.value[U]=f.value[U]||{};const ze={[U]:X};if(i)for(const Ve in ze)Jt(ze,Ve)&&ar(ze[Ve]);X=ze[U],ai(X,f.value[U]),w.messages=f.value}function Te(U){return p.value[U]||{}}function z(U,X){p.value[U]=X,w.datetimeFormats=p.value,Id(w,U,X)}function I(U,X){p.value[U]=St(p.value[U]||{},X),w.datetimeFormats=p.value,Id(w,U,X)}function G(U){return h.value[U]||{}}function pe(U,X){h.value[U]=X,w.numberFormats=h.value,Dd(w,U,X)}function Ae(U,X){h.value[U]=St(h.value[U]||{},X),w.numberFormats=h.value,Dd(w,U,X)}Fd++,t&&Vc&&(a.watch(t.locale,U=>{c&&(d.value=U,w.locale=U,sr(w,d.value,u.value))}),a.watch(t.fallbackLocale,U=>{c&&(u.value=U,w.fallbackLocale=U,sr(w,d.value,u.value))}));const ye={id:Fd,locale:T,fallbackLocale:R,get inheritLocale(){return c},set inheritLocale(U){c=U,U&&t&&(d.value=t.locale.value,u.value=t.fallbackLocale.value,sr(w,d.value,u.value))},get availableLocales(){return Object.keys(f.value).sort()},messages:H,get modifiers(){return b},get pluralRules(){return k||{}},get isGlobal(){return r},get missingWarn(){return m},set missingWarn(U){m=U,w.missingWarn=m},get fallbackWarn(){return y},set fallbackWarn(U){y=U,w.fallbackWarn=y},get fallbackRoot(){return g},set fallbackRoot(U){g=U},get fallbackFormat(){return x},set fallbackFormat(U){x=U,w.fallbackFormat=x},get warnHtmlMessage(){return _},set warnHtmlMessage(U){_=U,w.warnHtmlMessage=U},get escapeParameter(){return A},set escapeParameter(U){A=U,w.escapeParameter=U},t:Z,getLocaleMessage:ne,setLocaleMessage:me,mergeLocaleMessage:De,getPostTranslationHandler:B,setPostTranslationHandler:te,getMissingHandler:K,setMissingHandler:ae,[Ry]:V};return ye.datetimeFormats=F,ye.numberFormats=L,ye.rt=Y,ye.te=S,ye.tm=$,ye.d=J,ye.n=ee,ye.getDateTimeFormat=Te,ye.setDateTimeFormat=z,ye.mergeDateTimeFormat=I,ye.getNumberFormat=G,ye.setNumberFormat=pe,ye.mergeNumberFormat=Ae,ye[Py]=o,ye[ha]=Pe,ye[ma]=P,ye[ga]=C,ye}const ba={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:n=>n==="parent"||n==="global",default:"parent"},i18n:{type:Object}};function Vy({slots:n},e){return e.length===1&&e[0]==="default"?(n.default?n.default():[]).reduce((o,r)=>[...o,...r.type===a.Fragment?r.children:[r]],[]):e.reduce((t,o)=>{const r=n[o];return r&&(t[o]=r()),t},Be())}function Ud(n){return a.Fragment}St({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:n=>it(n)||!isNaN(n)}},ba);function By(n){return rt(n)&&!xe(n[0])}function Wd(n,e,t,o){const{slots:r,attrs:i}=e;return()=>{const s={part:!0};let l=Be();n.locale&&(s.locale=n.locale),xe(n.format)?s.key=n.format:Le(n.format)&&(xe(n.format.key)&&(s.key=n.format.key),l=Object.keys(n.format).reduce((p,h)=>t.includes(h)?St(Be(),p,{[h]:n.format[h]}):p,Be()));const c=o(n.value,s,l);let d=[s.key];rt(c)?d=c.map((p,h)=>{const m=r[p.type],y=m?m({[p.type]:p.value,index:h,parts:c}):[p.value];return By(y)&&(y[0].key=`${p.type}-${h}`),y}):xe(c)&&(d=[c]);const u=St(Be(),i),f=xe(n.tag)||Le(n.tag)?n.tag:Ud();return a.h(f,u,d)}}St({value:{type:Number,required:!0},format:{type:[String,Object]}},ba),St({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},ba);const Fy=Pn("global-vue-i18n");function jy(n={},e){const t=Ke(n.globalInjection)?n.globalInjection:!0,o=!0,r=new Map,[i,s]=Hy(n),l=Pn("");function c(f){return r.get(f)||null}function d(f,p){r.set(f,p)}function u(f){r.delete(f)}{const f={get mode(){return"composition"},get allowComposition(){return o},async install(p,...h){if(p.__VUE_I18N_SYMBOL__=l,p.provide(p.__VUE_I18N_SYMBOL__,f),$e(h[0])){const g=h[0];f.__composerExtend=g.__composerExtend,f.__vueI18nExtend=g.__vueI18nExtend}let m=null;t&&(m=Yy(p,f.global));const y=p.unmount;p.unmount=()=>{m&&m(),f.dispose(),y()}},get global(){return s},dispose(){i.stop()},__instances:r,__getInstance:c,__setInstance:d,__deleteInstance:u};return f}}function Qt(n={}){const e=a.getCurrentInstance();if(e==null)throw Bn(bn.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw Bn(bn.NOT_INSTALLED);const t=Uy(e),o=qy(t),r=Ld(e),i=Wy(n,r);if(i==="global")return Ly(o,n,r),o;if(i==="parent"){let c=Gy(t,e,n.__useComponent);return c==null&&(c=o),c}const s=t;let l=s.__getInstance(e);if(l==null){const c=St({},n);"__i18n"in r&&(c.__i18n=r.__i18n),o&&(c.__root=o),l=Hd(c),s.__composerExtend&&(l[ya]=s.__composerExtend(l)),Jy(s,e,l),s.__setInstance(e,l)}return l}function Hy(n,e,t){const o=a.effectScope();{const r=o.run(()=>Hd(n));if(r==null)throw Bn(bn.UNEXPECTED_ERROR);return[o,r]}}function Uy(n){{const e=a.inject(n.isCE?Fy:n.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw Bn(n.isCE?bn.NOT_INSTALLED_WITH_PROVIDE:bn.UNEXPECTED_ERROR);return e}}function Wy(n,e){return oi(n)?"__i18n"in e?"local":"global":n.useScope?n.useScope:"local"}function qy(n){return n.mode==="composition"?n.global:n.global.__composer}function Gy(n,e,t=!1){let o=null;const r=e.root;let i=Ky(e,t);for(;i!=null;){const s=n;if(n.mode==="composition"&&(o=s.__getInstance(i)),o!=null||r===i)break;i=i.parent}return o}function Ky(n,e=!1){return n==null?null:e&&n.vnode.ctx||n.parent}function Jy(n,e,t){a.onMounted(()=>{},e),a.onUnmounted(()=>{const o=t;n.__deleteInstance(e);const r=o[ya];r&&(r(),delete o[ya])},e)}const Xy=["locale","fallbackLocale","availableLocales"],qd=["t","rt","d","n","tm","te"];function Yy(n,e){const t=Object.create(null);return Xy.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i)throw Bn(bn.UNEXPECTED_ERROR);const s=a.isRef(i.value)?{get(){return i.value.value},set(l){i.value.value=l}}:{get(){return i.get&&i.get()}};Object.defineProperty(t,r,s)}),n.config.globalProperties.$i18n=t,qd.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i||!i.value)throw Bn(bn.UNEXPECTED_ERROR);Object.defineProperty(n.config.globalProperties,`$${r}`,i)}),()=>{delete n.config.globalProperties.$i18n,qd.forEach(r=>{delete n.config.globalProperties[`$${r}`]})}}Oy(),__INTLIFY_JIT_COMPILATION__?gd(vy):gd(Ty),xy(oy),ky(ud);const Gd="zcode-user-settings";function Mo(){try{const n=localStorage.getItem(Gd);return n?JSON.parse(n):{}}catch(n){return console.warn("[ZeroCode] Failed to load user settings:",n),{}}}function xa(n){try{const e=Mo(),t={locale:n.locale??e.locale,cms:n.cms?{...e.cms||{},...n.cms}:e.cms,dev:n.dev?{...e.dev||{},...n.dev}:e.dev};localStorage.setItem(Gd,JSON.stringify(t))}catch(e){console.warn("[ZeroCode] Failed to save user settings:",e)}}function Qy(n=null){const e=Mo();return e.locale!==void 0?e.locale:n}function Kd(){return Mo().cms||{}}function fi(n){const e=Mo();xa({cms:{...e.cms,...n}})}function Zy(n,e){return Kd()[n]??e}function Jd(){return Mo().dev||{}}function ka(n){const e=Mo();xa({dev:{...e.dev,...n}})}function eb(n,e){return Jd()[n]??e}const Xd="zcode-dont-show-css-warning-parts";function tb(){try{return sessionStorage.getItem(Xd)==="true"}catch{return!1}}function nb(n){try{sessionStorage.setItem(Xd,String(n))}catch(e){console.warn("[ZeroCode] Failed to save CSS warning setting:",e)}}const ob={class:"zcode-settings-panel-header"},rb={class:"zcode-settings-panel-header-title",role:"heading","aria-level":"3"},ib={class:"zcode-settings-panel-header-actions"},sb=["value","aria-label"],ab={value:"ja"},lb={value:"en"},cb={class:"zcode-settings-panel-content"},db={key:0},ub={key:0,class:"zcode-setting-item"},fb={class:"zcode-setting-label"},pb=["checked"],hb=["title"],mb={key:0,class:"zcode-setting-description"},gb={key:1,class:"zcode-setting-item"},yb={class:"zcode-setting-label"},bb=["checked"],xb=["title"],kb={key:0,class:"zcode-setting-description"},Eb={key:2,class:"zcode-setting-item"},wb={class:"zcode-setting-label"},Sb=["checked"],Cb=["title"],Nb={key:0,class:"zcode-setting-description"},Tb={key:3,class:"zcode-setting-item"},vb={class:"zcode-setting-label"},zb=["checked"],Mb=["title"],Ab={key:0,class:"zcode-setting-description"},Ib={key:1,class:"zcode-setting-item"},_b={class:"zcode-setting-info"},Yd=a.defineComponent({__name:"SettingsPanel",props:{isOpen:{type:Boolean},viewMode:{type:String},mode:{type:String},allowDynamicContentInteraction:{type:Boolean},devRightPadding:{type:Boolean},enableContextMenu:{type:Boolean},showSaveConfirm:{type:Boolean}},emits:["close","toggle-dynamic-content","toggle-dev-padding","toggle-context-menu","toggle-save-confirm"],setup(n){const e=n,{locale:t}=Qt(),o=a.computed(()=>t.value||"ja");function r(u){const p=u.target.value;t.value=p,xa({locale:p})}const i=a.ref(!1),s=a.ref(!1),l=a.ref(!1),c=a.ref(!1),d=a.computed(()=>e.devRightPadding!==void 0?e.devRightPadding:!1);return(u,f)=>n.isOpen?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-settings-panel-overlay",onClick:f[10]||(f[10]=a.withModifiers(p=>u.$emit("close"),["self"]))},[a.createElementVNode("div",{class:"zcode-settings-panel",onClick:f[9]||(f[9]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",ob,[a.createElementVNode("div",rb,a.toDisplayString(u.$t("settings.title")),1),a.createElementVNode("div",ib,[a.createElementVNode("select",{value:o.value,class:"zcode-language-select","aria-label":u.$t("settings.language.label"),onChange:r},[a.createElementVNode("option",ab,a.toDisplayString(u.$t("settings.language.ja")),1),a.createElementVNode("option",lb,a.toDisplayString(u.$t("settings.language.en")),1)],40,sb),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":"$t('common.close')",onClick:f[0]||(f[0]=p=>u.$emit("close"))},[a.createVNode(a.unref(Ye),{size:18})])])]),a.createElementVNode("div",cb,[n.viewMode==="manage"?(a.openBlock(),a.createElementBlock("div",db,[e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",ub,[a.createElementVNode("label",fb,[a.createElementVNode("input",{type:"checkbox",checked:e.allowDynamicContentInteraction??!1,class:"zcode-setting-checkbox",onChange:f[1]||(f[1]=p=>u.$emit("toggle-dynamic-content",p.target.checked))},null,40,pb),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.enableDynamicContent")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[2]||(f[2]=a.withModifiers(p=>i.value=!i.value,["stop"]))},[a.createVNode(a.unref(_n),{size:16})],8,hb)]),i.value?(a.openBlock(),a.createElementBlock("div",mb,a.toDisplayString(u.$t("settings.enableDynamicContentDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",gb,[a.createElementVNode("label",yb,[a.createElementVNode("input",{type:"checkbox",checked:d.value,class:"zcode-setting-checkbox",onChange:f[3]||(f[3]=p=>u.$emit("toggle-dev-padding",p.target.checked))},null,40,bb),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.devRightPadding")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[4]||(f[4]=a.withModifiers(p=>s.value=!s.value,["stop"]))},[a.createVNode(a.unref(_n),{size:16})],8,xb)]),s.value?(a.openBlock(),a.createElementBlock("div",kb,a.toDisplayString(u.$t("settings.devRightPaddingDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",Eb,[a.createElementVNode("label",wb,[a.createElementVNode("input",{type:"checkbox",checked:e.enableContextMenu??!1,class:"zcode-setting-checkbox",onChange:f[5]||(f[5]=p=>u.$emit("toggle-context-menu",p.target.checked))},null,40,Sb),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.enableContextMenu")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[6]||(f[6]=a.withModifiers(p=>l.value=!l.value,["stop"]))},[a.createVNode(a.unref(_n),{size:16})],8,Cb)]),l.value?(a.openBlock(),a.createElementBlock("div",Nb,a.toDisplayString(u.$t("settings.enableContextMenuDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="dev-tabs"?(a.openBlock(),a.createElementBlock("div",Tb,[a.createElementVNode("label",vb,[a.createElementVNode("input",{type:"checkbox",checked:e.showSaveConfirm??!0,class:"zcode-setting-checkbox",onChange:f[7]||(f[7]=p=>u.$emit("toggle-save-confirm",p.target.checked))},null,40,zb),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.showSaveConfirm")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[8]||(f[8]=a.withModifiers(p=>c.value=!c.value,["stop"]))},[a.createVNode(a.unref(_n),{size:16})],8,Mb)]),c.value?(a.openBlock(),a.createElementBlock("div",Ab,a.toDisplayString(u.$t("settings.showSaveConfirmDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)])):(a.openBlock(),a.createElementBlock("div",Ib,[a.createElementVNode("div",_b,a.toDisplayString(u.$t("settings.previewModeInfo")),1)]))])])])):a.createCommentVNode("",!0)}});function dt(n){this.content=n}dt.prototype={constructor:dt,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var o=t&&t!=n?this.remove(t):this,r=o.find(n),i=o.content.slice();return r==-1?i.push(t||n,e):(i[r+1]=e,t&&(i[r]=t)),new dt(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new dt(t)},addToStart:function(n,e){return new dt([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new dt(t)},addBefore:function(n,e,t){var o=this.remove(e),r=o.content.slice(),i=o.find(n);return r.splice(i==-1?r.length:i,0,e,t),new dt(r)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=dt.from(n),n.size?new dt(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=dt.from(n),n.size?new dt(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=dt.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},dt.from=function(n){if(n instanceof dt)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new dt(e)};function Qd(n,e,t){for(let o=0;;o++){if(o==n.childCount||o==e.childCount)return n.childCount==e.childCount?null:t;let r=n.child(o),i=e.child(o);if(r==i){t+=r.nodeSize;continue}if(!r.sameMarkup(i))return t;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)t++;return t}if(r.content.size||i.content.size){let s=Qd(r.content,i.content,t+1);if(s!=null)return s}t+=r.nodeSize}}function Zd(n,e,t,o){for(let r=n.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:t,b:o};let s=n.child(--r),l=e.child(--i),c=s.nodeSize;if(s==l){t-=c,o-=c;continue}if(!s.sameMarkup(l))return{a:t,b:o};if(s.isText&&s.text!=l.text){let d=0,u=Math.min(s.text.length,l.text.length);for(;d<u&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,t--,o--;return{a:t,b:o}}if(s.content.size||l.content.size){let d=Zd(s.content,l.content,t-1,o-1);if(d)return d}t-=c,o-=c}}class oe{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,t,o,r=0,i){for(let s=0,l=0;l<t;s++){let c=this.content[s],d=l+c.nodeSize;if(d>e&&o(c,r+l,i||null,s)!==!1&&c.content.size){let u=l+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,t-u),o,r+u)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,o,r){let i="",s=!0;return this.nodesBetween(e,t,(l,c)=>{let d=l.isText?l.text.slice(Math.max(e,c)-c,t-c):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=d},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(o)&&(r[r.length-1]=t.withText(t.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new oe(r,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let o=[],r=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],c=s+l.nodeSize;c>e&&((s<e||c>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),o.push(l),r+=l.nodeSize),s=c}return new oe(o,r)}cutByIndex(e,t){return e==t?oe.empty:e==0&&t==this.content.length?this:new oe(this.content.slice(e,t))}replaceChild(e,t){let o=this.content[e];if(o==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-o.nodeSize;return r[e]=t,new oe(r,i)}addToStart(e){return new oe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new oe(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,o=0;t<this.content.length;t++){let r=this.content[t];e(r,o,t),o+=r.nodeSize}}findDiffStart(e,t=0){return Qd(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return Zd(this,e,t,o)}findIndex(e){if(e==0)return pi(0,e);if(e==this.size)return pi(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,o=0;;t++){let r=this.child(t),i=o+r.nodeSize;if(i>=e)return i==e?pi(t+1,i):pi(t,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return oe.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new oe(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return oe.empty;let t,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new oe(t||e,o)}static from(e){if(!e)return oe.empty;if(e instanceof oe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new oe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}oe.empty=new oe([],0);const Ea={index:0,offset:0};function pi(n,e){return Ea.index=n,Ea.offset=e,Ea}function hi(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let o=0;o<n.length;o++)if(!hi(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!hi(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}let Fe=class dc{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),o=!0),t&&t.push(i)}}return t||(t=e.slice()),o||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&hi(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[t.type];if(!o)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=o.create(t.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(t[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return dc.none;if(e instanceof dc)return[e];let t=e.slice();return t.sort((o,r)=>o.type.rank-r.type.rank),t}};Fe.none=[];class mi extends Error{}class fe{constructor(e,t,o){this.content=e,this.openStart=t,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let o=tu(this.content,e+this.openStart,t);return o&&new fe(o,this.openStart,this.openEnd)}removeBetween(e,t){return new fe(eu(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return fe.empty;let o=t.openStart||0,r=t.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new fe(oe.fromJSON(e,t.content),o,r)}static maxOpen(e,t=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)r++;return new fe(e,o,r)}}fe.empty=new fe(oe.empty,0,0);function eu(n,e,t){let{index:o,offset:r}=n.findIndex(e),i=n.maybeChild(o),{index:s,offset:l}=n.findIndex(t);if(r==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(o!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(o,i.copy(eu(i.content,e-r-1,t-r-1)))}function tu(n,e,t,o){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r);if(i==e||s.isText)return o&&!o.canReplace(r,r,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=tu(s.content,e-i-1,t,s);return l&&n.replaceChild(r,s.copy(l))}function Ob(n,e,t){if(t.openStart>n.depth)throw new mi("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new mi("Inconsistent open depths");return nu(n,e,t,0)}function nu(n,e,t,o){let r=n.index(o),i=n.node(o);if(r==e.index(o)&&o<n.depth-t.openStart){let s=nu(n,e,t,o+1);return i.copy(i.content.replaceChild(r,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==o&&e.depth==o){let s=n.parent,l=s.content;return co(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=Db(t,n);return co(i,ru(n,s,l,e,o))}else return co(i,gi(n,e,o))}function ou(n,e){if(!e.type.compatibleContent(n.type))throw new mi("Cannot join "+e.type.name+" onto "+n.type.name)}function wa(n,e,t){let o=n.node(t);return ou(o,e.node(t)),o}function lo(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function lr(n,e,t,o){let r=(e||n).node(t),i=0,s=e?e.index(t):r.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(lo(n.nodeAfter,o),i++));for(let l=i;l<s;l++)lo(r.child(l),o);e&&e.depth==t&&e.textOffset&&lo(e.nodeBefore,o)}function co(n,e){return n.type.checkContent(e),n.copy(e)}function ru(n,e,t,o,r){let i=n.depth>r&&wa(n,e,r+1),s=o.depth>r&&wa(t,o,r+1),l=[];return lr(null,n,r,l),i&&s&&e.index(r)==t.index(r)?(ou(i,s),lo(co(i,ru(n,e,t,o,r+1)),l)):(i&&lo(co(i,gi(n,e,r+1)),l),lr(e,t,r,l),s&&lo(co(s,gi(t,o,r+1)),l)),lr(o,null,r,l),new oe(l)}function gi(n,e,t){let o=[];if(lr(null,n,t,o),n.depth>t){let r=wa(n,e,t+1);lo(co(r,gi(n,e,t+1)),o)}return lr(e,null,t,o),new oe(o)}function Db(n,e){let t=e.depth-n.openStart,r=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)r=e.node(i).copy(oe.from(r));return{start:r.resolveNoCache(n.openStart+t),end:r.resolveNoCache(r.content.size-n.openEnd-t)}}class cr{constructor(e,t,o){this.pos=e,this.path=t,this.parentOffset=o,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],r=e.child(t);return o?e.child(t).cut(o):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let o=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)r+=o.child(i).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Fe.none;if(this.textOffset)return e.child(t).marks;let o=e.maybeChild(t-1),r=e.maybeChild(t);if(!o){let l=o;o=r,r=l}let i=o.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let o=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!t||t(this.node(o))))return new yi(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let o=[],r=0,i=t;for(let s=e;;){let{index:l,offset:c}=s.content.findIndex(i),d=i-c;if(o.push(s,l,r+c),!d||(s=s.child(l),s.isText))break;i=d-1,r+=c+1}return new cr(t,o,i)}static resolveCached(e,t){let o=iu.get(e);if(o)for(let i=0;i<o.elts.length;i++){let s=o.elts[i];if(s.pos==t)return s}else iu.set(e,o=new Rb);let r=o.elts[o.i]=cr.resolve(e,t);return o.i=(o.i+1)%Pb,r}}class Rb{constructor(){this.elts=[],this.i=0}}const Pb=12,iu=new WeakMap;class yi{constructor(e,t,o){this.$from=e,this.$to=t,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Lb=Object.create(null);let Fn=class uc{constructor(e,t,o,r=Fe.none){this.type=e,this.attrs=t,this.marks=r,this.content=o||oe.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,o,r=0){this.content.nodesBetween(e,t,o,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,o,r){return this.content.textBetween(e,t,o,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,o){return this.type==e&&hi(this.attrs,t||e.defaultAttrs||Lb)&&Fe.sameSet(this.marks,o||Fe.none)}copy(e=null){return e==this.content?this:new uc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new uc(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,o=!1){if(e==t)return fe.empty;let r=this.resolve(e),i=this.resolve(t),s=o?0:r.sharedDepth(t),l=r.start(s),d=r.node(s).content.cut(r.pos-l,i.pos-l);return new fe(d,r.depth-s,i.depth-s)}replace(e,t,o){return Ob(this.resolve(e),this.resolve(t),o)}nodeAt(e){for(let t=this;;){let{index:o,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(o),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(t),index:t,offset:o};let r=this.content.child(t-1);return{node:r,index:t-1,offset:o-r.nodeSize}}resolve(e){return cr.resolveCached(this,e)}resolveNoCache(e){return cr.resolve(this,e)}rangeHasMark(e,t,o){let r=!1;return t>e&&this.nodesBetween(e,t,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),su(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,o=oe.empty,r=0,i=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,r,i),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let c=r;c<i;c++)if(!this.type.allowsMarks(o.child(c).marks))return!1;return!0}canReplaceWith(e,t,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(o),s=i&&i.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Fe.none;for(let t=0;t<this.marks.length;t++){let o=this.marks[t];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!Fe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let o;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,o)}let r=oe.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};Fn.prototype.text=void 0;class bi extends Fn{constructor(e,t,o,r){if(super(e,t,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):su(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new bi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new bi(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function su(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class uo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let o=new $b(e,t);if(o.next==null)return uo.empty;let r=au(o);o.next&&o.err("Unexpected trailing text");let i=Wb(Ub(r));return qb(i,o),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,o=e.childCount){let r=this;for(let i=t;r&&i<o;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let o=0;o<e.next.length;o++)if(this.next[t].type==e.next[o].type)return!0;return!1}fillBefore(e,t=!1,o=0){let r=[this];function i(s,l){let c=s.matchFragment(e,o);if(c&&(!t||c.validEnd))return oe.from(l.map(d=>d.createAndFill()));for(let d=0;d<s.next.length;d++){let{type:u,next:f}=s.next[d];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(f)==-1){r.push(f);let p=i(f,l.concat(u));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(e)){let s=[];for(let l=r;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:c}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!r.type||c.validEnd)&&(o.push({match:l.contentMatch,type:l,via:r}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&t(o.next[r].next)}return t(this),e.map((o,r)=>{let i=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)i+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return i}).join(`
345
+ `)}}uo.empty=new uo(!0);class $b{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function au(n){let e=[];do e.push(Vb(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Vb(n){let e=[];do e.push(Bb(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Bb(n){let e=Hb(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Fb(n,e);else break;return e}function lu(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Fb(n,e){let t=lu(n),o=t;return n.eat(",")&&(n.next!="}"?o=lu(n):o=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:o,expr:e}}function jb(n,e){let t=n.nodeTypes,o=t[e];if(o)return[o];let r=[];for(let i in t){let s=t[i];s.isInGroup(e)&&r.push(s)}return r.length==0&&n.err("No node type or group '"+e+"' found"),r}function Hb(n){if(n.eat("(")){let e=au(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=jb(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Ub(n){let e=[[]];return r(i(n,0),t()),e;function t(){return e.push([])-1}function o(s,l,c){let d={term:c,to:l};return e[s].push(d),d}function r(s,l){s.forEach(c=>c.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((c,d)=>c.concat(i(d,l)),[]);if(s.type=="seq")for(let c=0;;c++){let d=i(s.exprs[c],l);if(c==s.exprs.length-1)return d;r(d,l=t())}else if(s.type=="star"){let c=t();return o(l,c),r(i(s.expr,c),c),[o(c)]}else if(s.type=="plus"){let c=t();return r(i(s.expr,l),c),r(i(s.expr,c),c),[o(c)]}else{if(s.type=="opt")return[o(l)].concat(i(s.expr,l));if(s.type=="range"){let c=l;for(let d=0;d<s.min;d++){let u=t();r(i(s.expr,c),u),c=u}if(s.max==-1)r(i(s.expr,c),c);else for(let d=s.min;d<s.max;d++){let u=t();o(c,u),r(i(s.expr,c),u),c=u}return[o(c)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function cu(n,e){return e-n}function du(n,e){let t=[];return o(e),t.sort(cu);function o(r){let i=n[r];if(i.length==1&&!i[0].term)return o(i[0].to);t.push(r);for(let s=0;s<i.length;s++){let{term:l,to:c}=i[s];!l&&t.indexOf(c)==-1&&o(c)}}}function Wb(n){let e=Object.create(null);return t(du(n,0));function t(o){let r=[];o.forEach(s=>{n[s].forEach(({term:l,to:c})=>{if(!l)return;let d;for(let u=0;u<r.length;u++)r[u][0]==l&&(d=r[u][1]);du(n,c).forEach(u=>{d||r.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let i=e[o.join(",")]=new uo(o.indexOf(n.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(cu);i.next.push({type:r[s][0],next:e[l.join(",")]||t(l)})}return i}}function qb(n,e){for(let t=0,o=[n];t<o.length;t++){let r=o[t],i=!r.validEnd,s=[];for(let l=0;l<r.next.length;l++){let{type:c,next:d}=r.next[l];s.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),o.indexOf(d)==-1&&o.push(d)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function uu(n){let e=Object.create(null);for(let t in n){let o=n[t];if(!o.hasDefault)return null;e[t]=o.default}return e}function fu(n,e){let t=Object.create(null);for(let o in n){let r=e&&e[o];if(r===void 0){let i=n[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}t[o]=r}return t}function pu(n,e,t,o){for(let r in e)if(!(r in n))throw new RangeError(`Unsupported attribute ${r} for ${t} of type ${r}`);for(let r in n){let i=n[r];i.validate&&i.validate(e[r])}}function hu(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new Kb(n,o,e[o]);return t}let mu=class rm{constructor(e,t,o){this.name=e,this.schema=t,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=hu(e,o.attrs),this.defaultAttrs=uu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==uo.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:fu(this.attrs,e)}create(e=null,t,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Fn(this,this.computeAttrs(e),oe.from(t),Fe.setFrom(o))}createChecked(e=null,t,o){return t=oe.from(t),this.checkContent(t),new Fn(this,this.computeAttrs(e),t,Fe.setFrom(o))}createAndFill(e=null,t,o){if(e=this.computeAttrs(e),t=oe.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(oe.empty,!0);return i?new Fn(this,e,t.append(i),Fe.setFrom(o)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){pu(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?t&&t.push(e[o]):t||(t=e.slice(0,o));return t?t.length?t:Fe.none:e}static compile(e,t){let o=Object.create(null);e.forEach((i,s)=>o[i]=new rm(i,t,s));let r=t.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function Gb(n,e,t){let o=t.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${n}, got ${i}`)}}class Kb{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?Gb(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class xi{constructor(e,t,o,r){this.name=e,this.rank=t,this.schema=o,this.spec=r,this.attrs=hu(e,r.attrs),this.excluded=null;let i=uu(this.attrs);this.instance=i?new Fe(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Fe(this,fu(this.attrs,e))}static compile(e,t){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new xi(i,r++,t,s)),o}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){pu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class gu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=dt.from(e.nodes),t.marks=dt.from(e.marks||{}),this.nodes=mu.compile(this.spec.nodes,this),this.marks=xi.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=o[s]||(o[s]=uo.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?yu(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:yu(this,s.split(" "))}this.nodeFromJSON=r=>Fn.fromJSON(this,r),this.markFromJSON=r=>Fe.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof mu){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,o,r)}text(e,t){let o=this.nodes.text;return new bi(o,o.defaultAttrs,e,Fe.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function yu(n,e){let t=[];for(let o=0;o<e.length;o++){let r=e[o],i=n.marks[r],s=i;if(i)t.push(i);else for(let l in n.marks){let c=n.marks[l];(r=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(r)>-1)&&t.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return t}function Jb(n){return n.tag!=null}function Xb(n){return n.style!=null}let dr=class fc{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(r=>{if(Jb(r))this.tags.push(r);else if(Xb(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let o=new Eu(this,t,!1);return o.addAll(e,Fe.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new Eu(this,t,!0);return o.addAll(e,Fe.none,t.from,t.to),fe.maxOpen(o.finish())}matchTag(e,t,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(Zb(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,t,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let c=s.getAttrs(t);if(c===!1)continue;s.attrs=c||void 0}return s}}}static schemaRules(e){let t=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<i)break}t.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=wu(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=wu(s)),s.node||s.ignore||s.mark||(s.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new fc(e,fc.schemaRules(e)))}};const bu={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Yb={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},xu={ol:!0,ul:!0},ur=1,Sa=2,fr=4;function ku(n,e,t){return e!=null?(e?ur:0)|(e==="full"?Sa:0):n&&n.whitespace=="pre"?ur|Sa:t&~fr}class ki{constructor(e,t,o,r,i,s){this.type=e,this.attrs=t,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=Fe.none,this.match=i||(s&fr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(oe.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ur)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let t=oe.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(oe.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!bu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Eu{constructor(e,t,o){this.parser=e,this.options=t,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,s=ku(null,t.preserveWhitespace,0)|(o?fr:0);r?i=new ki(r.type,r.attrs,Fe.none,!0,t.topMatch||r.type.contentMatch,s):o?i=new ki(null,null,Fe.none,!0,null,s):i=new ki(e.schema.topNodeType,null,Fe.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let o=e.nodeValue,r=this.top,i=r.options&Sa?"full":this.localPreserveWS||(r.options&ur)>0,{schema:s}=this.parser;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)if(i==="full")o=o.replace(/\r\n?/g,`
346
+ `);else if(s.linebreakReplacement&&/[\r\n]/.test(o)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=o.split(/\r?\n|\r/);for(let c=0;c<l.length;c++)c&&this.insertNode(s.linebreakReplacement.create(),t,!0),l[c]&&this.insertNode(s.text(l[c]),t,!/\S/.test(l[c]));o=""}else o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let l=r.content[r.content.length-1],c=e.previousSibling;(!l||c&&c.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(o=o.slice(1))}o&&this.insertNode(s.text(o),t,!/\S/.test(o)),this.findInText(e)}else this.findInside(e)}addElement(e,t,o){let r=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;xu.hasOwnProperty(s)&&this.parser.normalizeLists&&Qb(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(c?c.ignore:Yb.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let d,u=this.needsBlock;if(bu.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),d=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=c&&c.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),d&&this.sync(i),this.needsBlock=u}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,c,d,c.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
347
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.getPropertyValue(i);if(s)for(let l=void 0;;){let c=this.parser.matchStyle(i,s,this,l);if(!c)break;if(c.ignore)return null;if(c.clearMark?t=t.filter(d=>!c.clearMark(d)):t=t.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)l=c;else break}}return t}addElementByRule(e,t,o,r){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let c=this.enter(s,t.attrs||null,o,t.preserveWhitespace);c&&(i=!0,o=c)}else{let c=this.parser.schema.marks[t.mark];o=o.concat(c.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,o,!1));else{let c=e;typeof t.contentElement=="string"?c=e.querySelector(t.contentElement):typeof t.contentElement=="function"?c=t.contentElement(e):t.contentElement&&(c=t.contentElement),this.findAround(e,c,!0),this.addAll(c,o),this.findAround(e,c,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,o){let r,i;for(let s=this.open,l=0;s>=0;s--){let c=this.nodes[s],d=c.findWrapping(e);if(d&&(!r||r.length>d.length+l)&&(r=d,i=c,!d.length))break;if(c.solid){if(o)break;l+=2}}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)t=this.enterInner(r[s],null,t,!1);return t}insertNode(e,t,o){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t,o);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=Fe.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Su(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,t,o,r){let i=this.findPlace(e.create(t),o,!1);return i&&(i=this.enterInner(e,t,o,!0,r)),i}enterInner(e,t,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=ku(e,i,s.options);s.options&fr&&s.content.length==0&&(l|=fr);let c=Fe.none;return o=o.filter(d=>(s.type?s.type.allowsMarkType(d.type):Su(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new ki(e,t,c,r,null,l)),this.open++,o}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=ur)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let o=this.nodes[t].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==t&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,o){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,c)=>{for(;l>=0;l--){let d=t[l];if(d==""){if(l==t.length-1||l==0)continue;for(;c>=i;c--)if(s(l-1,c))return!0;return!1}else{let u=c>0||c==0&&r?this.nodes[c].type:o&&c>=i?o.node(c-i).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;c--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let t in this.parser.schema.nodes){let o=this.parser.schema.nodes[t];if(o.isTextblock&&o.defaultAttrs)return o}}}function Qb(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&xu.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function Zb(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function wu(n){let e={};for(let t in n)e[t]=n[t];return e}function Su(n,e){let t=e.schema.nodes;for(let o in t){let r=t[o];if(!r.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let c=0;c<l.edgeCount;c++){let{type:d,next:u}=l.edge(c);if(d==e||i.indexOf(u)<0&&s(u))return!0}};if(s(r.contentMatch))return!0}}class fo{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},o){o||(o=Ca(t).createDocumentFragment());let r=o,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,c=0;for(;l<i.length&&c<s.marks.length;){let d=s.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(i[l][0])||d.type.spec.spanning===!1)break;l++,c++}for(;l<i.length;)r=i.pop()[1];for(;c<s.marks.length;){let d=s.marks[c++],u=this.serializeMark(d,s.isInline,t);u&&(i.push([d,r]),r.appendChild(u.dom),r=u.contentDOM||u.dom)}}r.appendChild(this.serializeNodeInner(s,t))}),o}serializeNodeInner(e,t){let{dom:o,contentDOM:r}=Ei(Ca(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return o}serializeNode(e,t={}){let o=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(e,t,o={}){let r=this.marks[e.type.name];return r&&Ei(Ca(o),r(e,t),null,e.attrs)}static renderSpec(e,t,o=null,r){return Ei(e,t,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new fo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Cu(e.nodes);return t.text||(t.text=o=>o.text),t}static marksFromSchema(e){return Cu(e.marks)}}function Cu(n){let e={};for(let t in n){let o=n[t].spec.toDOM;o&&(e[t]=o)}return e}function Ca(n){return n.document||window.document}const Nu=new WeakMap;function e1(n){let e=Nu.get(n);return e===void 0&&Nu.set(n,e=t1(n)),e}function t1(n){let e=null;function t(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)t(o[r]);else for(let r in o)t(o[r])}return t(n),e}function Ei(n,e,t,o){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=e1(o))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(t=r.slice(0,s),r=r.slice(s+1));let l,c=t?n.createElementNS(t,r):n.createElement(r),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let f in d)if(d[f]!=null){let p=f.indexOf(" ");p>0?c.setAttributeNS(f.slice(0,p),f.slice(p+1),d[f]):f=="style"&&c.style?c.style.cssText=d[f]:c.setAttribute(f,d[f])}}for(let f=u;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:h,contentDOM:m}=Ei(n,p,t,o);if(c.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:c,contentDOM:l}}const Tu=65535,vu=Math.pow(2,16);function n1(n,e){return n+e*vu}function zu(n){return n&Tu}function o1(n){return(n-(n&Tu))/vu}const Mu=1,Au=2,wi=4,Iu=8;class Na{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&Iu)>0}get deletedBefore(){return(this.delInfo&(Mu|wi))>0}get deletedAfter(){return(this.delInfo&(Au|wi))>0}get deletedAcross(){return(this.delInfo&wi)>0}}class Dt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Dt.empty)return Dt.empty}recover(e){let t=0,o=zu(e);if(!this.inverted)for(let r=0;r<o;r++)t+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+t+o1(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[l+i],u=this.ranges[l+s],f=c+d;if(e<=f){let p=d?e==c?-1:e==f?1:t:t,h=c+r+(p<0?0:u);if(o)return h;let m=e==(t<0?c:f)?null:n1(l/3,e-c),y=e==c?Au:e==f?Mu:wi;return(t<0?e!=c:e!=f)&&(y|=Iu),new Na(h,y,m)}r+=u-d}return o?e+r:new Na(e+r,0,null)}touches(e,t){let o=0,r=zu(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?o:0);if(c>e)break;let d=this.ranges[l+i],u=c+d;if(e<=u&&l==r*3)return!0;o+=this.ranges[l+s]-d}return!1}forEach(e){let t=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),c=s+(this.inverted?0:i),d=this.ranges[r+t],u=this.ranges[r+o];e(l,l+d,c,c+u),i+=u-d}}invert(){return new Dt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Dt.empty:new Dt(e<0?[0,-e,0]:[0,0,e])}}Dt.empty=new Dt([]);class Si{constructor(e,t,o=0,r=e?e.length:0){this.mirror=t,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Si(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,o=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?o+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,o=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?o-r-1:void 0)}}invert(){let e=new Si;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,t);if(l.recover!=null){let c=this.getMirror(i);if(c!=null&&c>i&&c<this.to){i=c,e=this._maps[c].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new Na(e,r,null)}}const Ta=Object.create(null);class mt{getMap(){return Dt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Ta[t.stepType];if(!o)throw new RangeError(`No step type ${t.stepType} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in Ta)throw new RangeError("Duplicate use of step JSON ID "+e);return Ta[e]=t,t.prototype.jsonID=e,t}}class et{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new et(e,null)}static fail(e){return new et(null,e)}static fromReplace(e,t,o,r){try{return et.ok(e.replace(t,o,r))}catch(i){if(i instanceof mi)return et.fail(i.message);throw i}}}function va(n,e,t){let o=[];for(let r=0;r<n.childCount;r++){let i=n.child(r);i.content.size&&(i=i.copy(va(i.content,e,i))),i.isInline&&(i=e(i,t,r)),o.push(i)}return oe.fromArray(o)}class jn extends mt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new fe(va(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),t.openStart,t.openEnd);return et.fromReplace(e,this.from,this.to,i)}invert(){return new Zt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new jn(t.pos,o.pos,this.mark)}merge(e){return e instanceof jn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new jn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new jn(t.from,t.to,e.markFromJSON(t.mark))}}mt.jsonID("addMark",jn);class Zt extends mt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=new fe(va(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return et.fromReplace(e,this.from,this.to,o)}invert(){return new jn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new Zt(t.pos,o.pos,this.mark)}merge(e){return e instanceof Zt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Zt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Zt(t.from,t.to,e.markFromJSON(t.mark))}}mt.jsonID("removeMark",Zt);class Hn extends mt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return et.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return et.fromReplace(e,this.pos,this.pos+1,new fe(oe.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let o=this.mark.addToSet(t.marks);if(o.length==t.marks.length){for(let r=0;r<t.marks.length;r++)if(!t.marks[r].isInSet(o))return new Hn(this.pos,t.marks[r]);return new Hn(this.pos,this.mark)}}return new po(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Hn(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Hn(t.pos,e.markFromJSON(t.mark))}}mt.jsonID("addNodeMark",Hn);class po extends mt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return et.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return et.fromReplace(e,this.pos,this.pos+1,new fe(oe.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Hn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new po(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new po(t.pos,e.markFromJSON(t.mark))}}mt.jsonID("removeNodeMark",po);class st extends mt{constructor(e,t,o,r=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=r}apply(e){return this.structure&&za(e,this.from,this.to)?et.fail("Structure replace would overwrite content"):et.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Dt([this.from,this.to-this.from,this.slice.size])}invert(e){return new st(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deletedAcross&&o.deletedAcross?null:new st(t.pos,Math.max(t.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof st)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?fe.empty:new fe(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new st(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?fe.empty:new fe(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new st(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new st(t.from,t.to,fe.fromJSON(e,t.slice),!!t.structure)}}mt.jsonID("replace",st);class at extends mt{constructor(e,t,o,r,i,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(za(e,this.from,this.gapFrom)||za(e,this.gapTo,this.to)))return et.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return et.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,t.content);return o?et.fromReplace(e,this.from,this.to,o):et.fail("Content does not fit in gap")}getMap(){return new Dt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new at(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return t.deletedAcross&&o.deletedAcross||r<t.pos||i>o.pos?null:new at(t.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new at(t.from,t.to,t.gapFrom,t.gapTo,fe.fromJSON(e,t.slice),t.insert,!!t.structure)}}mt.jsonID("replaceAround",at);function za(n,e,t){let o=n.resolve(e),r=t-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function r1(n,e,t,o){let r=[],i=[],s,l;n.doc.nodesBetween(e,t,(c,d,u)=>{if(!c.isInline)return;let f=c.marks;if(!o.isInSet(f)&&u.type.allowsMarkType(o.type)){let p=Math.max(d,e),h=Math.min(d+c.nodeSize,t),m=o.addToSet(f);for(let y=0;y<f.length;y++)f[y].isInSet(m)||(s&&s.to==p&&s.mark.eq(f[y])?s.to=h:r.push(s=new Zt(p,h,f[y])));l&&l.to==p?l.to=h:i.push(l=new jn(p,h,o))}}),r.forEach(c=>n.step(c)),i.forEach(c=>n.step(c))}function i1(n,e,t,o){let r=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;i++;let c=null;if(o instanceof xi){let d=s.marks,u;for(;u=o.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else o?o.isInSet(s.marks)&&(c=[o]):c=s.marks;if(c&&c.length){let d=Math.min(l+s.nodeSize,t);for(let u=0;u<c.length;u++){let f=c[u],p;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&f.eq(r[h].style)&&(p=m)}p?(p.to=d,p.step=i):r.push({style:f,from:Math.max(l,e),to:d,step:i})}}}),r.forEach(s=>n.step(new Zt(s.from,s.to,s.style)))}function Ma(n,e,t,o=t.contentMatch,r=!0){let i=n.doc.nodeAt(e),s=[],l=e+1;for(let c=0;c<i.childCount;c++){let d=i.child(c),u=l+d.nodeSize,f=o.matchType(d.type);if(!f)s.push(new st(l,u,fe.empty));else{o=f;for(let p=0;p<d.marks.length;p++)t.allowsMarkType(d.marks[p].type)||n.step(new Zt(l,u,d.marks[p]));if(r&&d.isText&&t.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(d.text);)m||(m=new fe(oe.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),s.push(new st(l+p.index,l+p.index+p[0].length,m))}}l=u}if(!o.validEnd){let c=o.fillBefore(oe.empty,!0);n.replace(l,l,new fe(c,0,0))}for(let c=s.length-1;c>=0;c--)n.step(s[c])}function s1(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Ao(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let o=n.depth,r=0,i=0;;--o){let s=n.$from.node(o),l=n.$from.index(o)+r,c=n.$to.indexAfter(o)-i;if(o<n.depth&&s.canReplace(l,c,t))return o;if(o==0||s.type.spec.isolating||!s1(s,l,c))break;l&&(r=1),c<s.childCount&&(i=1)}return null}function a1(n,e,t){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),c=s,d=l,u=oe.empty,f=0;for(let m=i,y=!1;m>t;m--)y||o.index(m)>0?(y=!0,u=oe.from(o.node(m).copy(u)),f++):c--;let p=oe.empty,h=0;for(let m=i,y=!1;m>t;m--)y||r.after(m+1)<r.end(m)?(y=!0,p=oe.from(r.node(m).copy(p)),h++):d++;n.step(new at(c,d,s,l,new fe(u.append(p),f,h),u.size-f,!0))}function Aa(n,e,t=null,o=n){let r=l1(n,e),i=r&&c1(o,e);return i?r.map(_u).concat({type:e,attrs:t}).concat(i.map(_u)):null}function _u(n){return{type:n,attrs:null}}function l1(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.contentMatchAt(o).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return t.canReplaceWith(o,r,s)?i:null}function c1(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.child(o),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let c=(s.length?s[s.length-1]:e).contentMatch;for(let d=o;c&&d<r;d++)c=c.matchType(t.child(d).type);return!c||!c.validEnd?null:s}function d1(n,e,t){let o=oe.empty;for(let s=t.length-1;s>=0;s--){if(o.size){let l=t[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=oe.from(t[s].type.create(t[s].attrs,o))}let r=e.start,i=e.end;n.step(new at(r,i,r,i,new fe(o,0,0),t.length,!0))}function u1(n,e,t,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let c=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,c)&&f1(n.doc,n.mapping.slice(i).map(l),o)){let d=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?d=!1:!h&&m&&(d=!0)}d===!1&&Du(n,s,l,i),Ma(n,n.mapping.slice(i).map(l,1),o,void 0,d===null);let u=n.mapping.slice(i),f=u.map(l,1),p=u.map(l+s.nodeSize,1);return n.step(new at(f,p,f+1,p-1,new fe(oe.from(o.create(c,null,s.marks)),0,0),1,!0)),d===!0&&Ou(n,s,l,i),!1}})}function Ou(n,e,t,o){e.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let c=n.mapping.slice(o).map(t+1+i+s.index);n.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function Du(n,e,t,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=n.mapping.slice(o).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(`
348
+ `))}})}function f1(n,e,t){let o=n.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,t)}function p1(n,e,t,o,r){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(o,null,r||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new at(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new fe(oe.from(s),0,0),1,!0))}function xn(n,e,t=1,o){let r=n.resolve(e),i=r.depth-t,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let d=r.depth-1,u=t-2;d>i;d--,u--){let f=r.node(d),p=r.index(d);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=o&&o[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let y=o&&o[u]||f;if(!f.canReplace(p+1,f.childCount)||!y.type.validContent(h))return!1}let l=r.indexAfter(i),c=o&&o[0];return r.node(i).canReplaceWith(l,l,c?c.type:r.node(i+1).type)}function h1(n,e,t=1,o){let r=n.doc.resolve(e),i=oe.empty,s=oe.empty;for(let l=r.depth,c=r.depth-t,d=t-1;l>c;l--,d--){i=oe.from(r.node(l).copy(i));let u=o&&o[d];s=oe.from(u?u.type.create(u.attrs,s):r.node(l).copy(s))}n.step(new st(e,e,new fe(i.append(s),t,t),!0))}function Un(n,e){let t=n.resolve(e),o=t.index();return Ru(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(o,o+1)}function m1(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:o}=n.type.schema;for(let r=0;r<e.childCount;r++){let i=e.child(r),s=i.type==o?n.type.schema.nodes.text:i.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function Ru(n,e){return!!(n&&e&&!n.isLeaf&&m1(n,e))}function Ci(n,e,t=-1){let o=n.resolve(e);for(let r=o.depth;;r--){let i,s,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,s=o.nodeAfter):t>0?(i=o.node(r+1),l++,s=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),s=o.node(r+1)),i&&!i.isTextblock&&Ru(i,s)&&o.node(r).canReplace(l,l+1))return e;if(r==0)break;e=t<0?o.before(r):o.after(r)}}function g1(n,e,t){let o=null,{linebreakReplacement:r}=n.doc.type.schema,i=n.doc.resolve(e-t),s=i.node().type;if(r&&s.inlineContent){let u=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);u&&!f?o=!1:!u&&f&&(o=!0)}let l=n.steps.length;if(o===!1){let u=n.doc.resolve(e+t);Du(n,u.node(),u.before(),l)}s.inlineContent&&Ma(n,e+t-1,s,i.node().contentMatchAt(i.index()),o==null);let c=n.mapping.slice(l),d=c.map(e-t);if(n.step(new st(d,c.map(e+t,-1),fe.empty,!0)),o===!0){let u=n.doc.resolve(d);Ou(n,u.node(),u.before(),n.steps.length)}return n}function y1(n,e,t){let o=n.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),t))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,t))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,t))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function b1(n,e,t){let o=n.resolve(e);if(!t.content.size)return e;let r=t.content;for(let i=0;i<t.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let s=o.depth;s>=0;s--){let l=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,c=o.index(s)+(l>0?1:0),d=o.node(s),u=!1;if(i==1)u=d.canReplace(c,c,r);else{let f=d.contentMatchAt(c).findWrapping(r.firstChild.type);u=f&&d.canReplaceWith(c,c,f[0])}if(u)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function Ni(n,e,t=e,o=fe.empty){if(e==t&&!o.size)return null;let r=n.resolve(e),i=n.resolve(t);return Pu(r,i,o)?new st(e,t,o):new x1(r,i,o).fit()}function Pu(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class x1{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=oe.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=oe.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let c=new fe(i,s,l);return e>-1?new at(o.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||o.pos!=this.$to.pos?new st(o.pos,r.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}t=i.content}for(let t=1;t<=2;t++)for(let o=t==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=Ia(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:d}=this.frontier[l],u,f=null;if(t==1&&(s?d.matchType(s.type)||(f=d.fillBefore(oe.from(s),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(t==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:u};if(i&&d.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=Ia(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new fe(e,t+1,Math.max(o,r.size+t>=e.size-o?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=Ia(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new fe(pr(e,t-1,1),t-1,i?t-1:o)}else this.unplaced=new fe(pr(e,t,1),t,o)}placeNodes({sliceDepth:e,frontierDepth:t,parent:o,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let y=0;y<i.length;y++)this.openFrontierNode(i[y]);let s=this.unplaced,l=o?o.content:s.content,c=s.openStart-e,d=0,u=[],{match:f,type:p}=this.frontier[t];if(r){for(let y=0;y<r.childCount;y++)u.push(r.child(y));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;d<l.childCount;){let y=l.child(d),g=f.matchType(y.type);if(!g)break;d++,(d>1||c==0||y.content.size)&&(f=g,u.push(Lu(y.mark(p.allowedMarks(y.marks)),d==1?c:0,d==l.childCount?h:-1)))}let m=d==l.childCount;m||(h=-1),this.placed=hr(this.placed,t,oe.from(u)),this.frontier[t].match=f,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let y=0,g=l;y<h;y++){let x=g.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),g=x.content}this.unplaced=m?e==0?fe.empty:new fe(pr(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new fe(pr(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!_a(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:o,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=_a(e,t,r,o,i);if(s){for(let l=t-1;l>=0;l--){let{match:c,type:d}=this.frontier[l],u=_a(e,l,d,c,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=hr(this.placed,t.depth,t.fit)),e=t.move;for(let o=t.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,t=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=hr(this.placed,this.depth,oe.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(oe.empty,!0);t.childCount&&(this.placed=hr(this.placed,this.frontier.length,t))}}function pr(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(pr(n.firstChild.content,e-1,t)))}function hr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(hr(n.lastChild.content,e-1,t)))}function Ia(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Lu(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,Lu(o.firstChild,e-1,o.childCount==1?t-1:0))),e>0&&(o=n.type.contentMatch.fillBefore(o).append(o),t<=0&&(o=o.append(n.type.contentMatch.matchFragment(o).fillBefore(oe.empty,!0)))),n.copy(o)}function _a(n,e,t,o,r){let i=n.node(e),s=r?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!k1(t,i.content,s)?l:null}function k1(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function E1(n){return n.spec.defining||n.spec.definingForContent}function w1(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),i=n.doc.resolve(t);if(Pu(r,i,o))return n.step(new st(e,t,o));let s=Vu(r,i);s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let p=r.depth,h=r.pos-1;p>0;p--,h--){let m=r.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?l=p:r.before(p)==h&&s.splice(1,0,-p)}let c=s.indexOf(l),d=[],u=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(d.push(m),h==o.openStart)break;p=m.content}for(let p=u-1;p>=0;p--){let h=d[p],m=E1(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))u=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+u+1)%(o.openStart+1),m=d[h];if(m)for(let y=0;y<s.length;y++){let g=s[(y+c)%s.length],x=!0;g<0&&(x=!1,g=-g);let M=r.node(g-1),E=r.index(g-1);if(M.canReplaceWith(E,E,m.type,m.marks))return n.replace(r.before(g),x?i.after(g):t,new fe($u(o.content,0,o.openStart,h),h,o.openEnd))}}let f=n.steps.length;for(let p=s.length-1;p>=0&&(n.replace(e,t,o),!(n.steps.length>f));p--){let h=s[p];h<0||(e=r.before(h),t=i.after(h))}}function $u(n,e,t,o,r){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy($u(i.content,e+1,t,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(oe.empty,!0))}return n}function S1(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=y1(n.doc,e,o.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new fe(oe.from(o),0,0))}function C1(n,e,t){let o=n.doc.resolve(e),r=n.doc.resolve(t),i=Vu(o,r);for(let s=0;s<i.length;s++){let l=i[s],c=s==i.length-1;if(c&&l==0||o.node(l).type.contentMatch.validEnd)return n.delete(o.start(l),r.end(l));if(l>0&&(c||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return n.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&t>o.end(s)&&r.end(s)-t!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return n.delete(o.before(s),t);n.delete(e,t)}function Vu(n,e){let t=[],o=Math.min(n.depth,e.depth);for(let r=o;r>=0;r--){let i=n.start(r);if(i<n.pos-(n.depth-r)||e.end(r)>e.pos+(e.depth-r)||n.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==n.depth&&r==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&t.push(r)}return t}class Io extends mt{constructor(e,t,o){super(),this.pos=e,this.attr=t,this.value=o}apply(e){let t=e.nodeAt(this.pos);if(!t)return et.fail("No node at attribute step's position");let o=Object.create(null);for(let i in t.attrs)o[i]=t.attrs[i];o[this.attr]=this.value;let r=t.type.create(o,null,t.marks);return et.fromReplace(e,this.pos,this.pos+1,new fe(oe.from(r),0,t.isLeaf?0:1))}getMap(){return Dt.empty}invert(e){return new Io(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Io(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Io(t.pos,t.attr,t.value)}}mt.jsonID("attr",Io);class mr extends mt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let o=e.type.create(t,e.content,e.marks);return et.ok(o)}getMap(){return Dt.empty}invert(e){return new mr(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new mr(t.attr,t.value)}}mt.jsonID("docAttr",mr);let _o=class extends Error{};_o=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},_o.prototype=Object.create(Error.prototype),_o.prototype.constructor=_o,_o.prototype.name="TransformError";class Bu{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Si}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new _o(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,o=fe.empty){let r=Ni(this.doc,e,t,o);return r&&this.step(r),this}replaceWith(e,t,o){return this.replace(e,t,new fe(oe.from(o),0,0))}delete(e,t){return this.replace(e,t,fe.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return w1(this,e,t,o),this}replaceRangeWith(e,t,o){return S1(this,e,t,o),this}deleteRange(e,t){return C1(this,e,t),this}lift(e,t){return a1(this,e,t),this}join(e,t=1){return g1(this,e,t),this}wrap(e,t){return d1(this,e,t),this}setBlockType(e,t=e,o,r=null){return u1(this,e,t,o,r),this}setNodeMarkup(e,t,o=null,r){return p1(this,e,t,o,r),this}setNodeAttribute(e,t,o){return this.step(new Io(e,t,o)),this}setDocAttribute(e,t){return this.step(new mr(e,t)),this}addNodeMark(e,t){return this.step(new Hn(e,t)),this}removeNodeMark(e,t){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(t instanceof Fe)t.isInSet(o.marks)&&this.step(new po(e,t));else{let r=o.marks,i,s=[];for(;i=t.isInSet(r);)s.push(new po(e,i)),r=i.removeFromSet(r);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,t=1,o){return h1(this,e,t,o),this}addMark(e,t,o){return r1(this,e,t,o),this}removeMark(e,t,o){return i1(this,e,t,o),this}clearIncompatible(e,t,o){return Ma(this,e,t,o),this}}const Oa=Object.create(null);class Re{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new N1(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=fe.empty){let o=t.content.lastChild,r=null;for(let l=0;l<t.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:c,$to:d}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(c.pos),u.map(d.pos),l?fe.empty:t),l==0&&Hu(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],c=e.mapping.slice(o),d=c.map(s.pos),u=c.map(l.pos);i?e.deleteRange(d,u):(e.replaceRangeWith(d,u,t),Hu(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let r=e.parent.inlineContent?new _e(e):Oo(e.node(0),e.parent,e.pos,e.index(),t,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=t<0?Oo(e.node(0),e.node(i),e.before(i+1),e.index(i),t,o):Oo(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,o);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Rt(e.node(0))}static atStart(e){return Oo(e,e,0,0,1)||new Rt(e)}static atEnd(e){return Oo(e,e,e.content.size,e.childCount,-1)||new Rt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Oa[t.type];if(!o)throw new RangeError(`No selection type ${t.type} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in Oa)throw new RangeError("Duplicate use of selection JSON ID "+e);return Oa[e]=t,t.prototype.jsonID=e,t}getBookmark(){return _e.between(this.$anchor,this.$head).getBookmark()}}Re.prototype.visible=!0;class N1{constructor(e,t){this.$from=e,this.$to=t}}let Fu=!1;function ju(n){!Fu&&!n.parent.inlineContent&&(Fu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class _e extends Re{constructor(e,t=e){ju(e),ju(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let o=e.resolve(t.map(this.head));if(!o.parent.inlineContent)return Re.near(o);let r=e.resolve(t.map(this.anchor));return new _e(r.parent.inlineContent?r:o,o)}replace(e,t=fe.empty){if(super.replace(e,t),t==fe.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof _e&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ti(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new _e(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){let r=e.resolve(t);return new this(r,o==t?r:e.resolve(o))}static between(e,t,o){let r=e.pos-t.pos;if((!o||r)&&(o=r>=0?1:-1),!t.parent.inlineContent){let i=Re.findFrom(t,o,!0)||Re.findFrom(t,-o,!0);if(i)t=i.$head;else return Re.near(t,o)}return e.parent.inlineContent||(r==0?e=t:(e=(Re.findFrom(e,-o,!0)||Re.findFrom(e,o,!0)).$anchor,e.pos<t.pos!=r<0&&(e=t))),new _e(e,t)}}Re.jsonID("text",_e);class Ti{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Ti(e.map(this.anchor),e.map(this.head))}resolve(e){return _e.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ce extends Re{constructor(e){let t=e.nodeAfter,o=e.node(0).resolve(e.pos+t.nodeSize);super(e,o),this.node=t}map(e,t){let{deleted:o,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return o?Re.near(i):new Ce(i)}content(){return new fe(oe.from(this.node),0,0)}eq(e){return e instanceof Ce&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Da(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ce(e.resolve(t.anchor))}static create(e,t){return new Ce(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ce.prototype.visible=!1,Re.jsonID("node",Ce);class Da{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new Ti(o,o):new Da(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&Ce.isSelectable(o)?new Ce(t):Re.near(t)}}class Rt extends Re{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=fe.empty){if(t==fe.empty){e.delete(0,e.doc.content.size);let o=Re.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Rt(e)}map(e){return new Rt(e)}eq(e){return e instanceof Rt}getBookmark(){return T1}}Re.jsonID("all",Rt);const T1={map(){return this},resolve(n){return new Rt(n)}};function Oo(n,e,t,o,r,i=!1){if(e.inlineContent)return _e.create(n,t);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let l=e.child(s);if(l.isAtom){if(!i&&Ce.isSelectable(l))return Ce.create(n,t-(r<0?l.nodeSize:0))}else{let c=Oo(n,l,t+r,r<0?l.childCount:0,r,i);if(c)return c}t+=l.nodeSize*r}return null}function Hu(n,e,t){let o=n.steps.length-1;if(o<e)return;let r=n.steps[o];if(!(r instanceof st||r instanceof at))return;let i=n.mapping.maps[o],s;i.forEach((l,c,d,u)=>{s==null&&(s=u)}),n.setSelection(Re.near(n.doc.resolve(s),t))}const Uu=1,vi=2,Wu=4;class v1 extends Bu{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Uu)&~vi,this.storedMarks=null,this}get selectionSet(){return(this.updated&Uu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=vi,this}ensureMarks(e){return Fe.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&vi)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~vi,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let o=this.selection;return t&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||Fe.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,o){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(o==null&&(o=t),!e)return this.deleteRange(t,o);let i=this.storedMarks;if(!i){let s=this.doc.resolve(t);i=o==t?s.marks():s.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(t,o,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(Re.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Wu,this}get scrolledIntoView(){return(this.updated&Wu)>0}}function qu(n,e){return!e||!n?n:n.bind(e)}class gr{constructor(e,t,o){this.name=e,this.init=qu(t.init,o),this.apply=qu(t.apply,o)}}const z1=[new gr("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new gr("selection",{init(n,e){return n.selection||Re.atStart(e.doc)},apply(n){return n.selection}}),new gr("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new gr("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Ra{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=z1.slice(),t&&t.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new gr(o.key,o.spec.state,o))})}}class Do{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let o=0;o<this.config.plugins.length;o++)if(o!=t){let r=this.config.plugins[o];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],o=this.applyInner(e),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let c=r?r[s].n:0,d=r?r[s].state:this,u=c<t.length&&l.spec.appendTransaction.call(l,c?t.slice(c):t,d,o);if(u&&o.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!r){r=[];for(let f=0;f<this.config.plugins.length;f++)r.push(f<s?{state:o,n:t.length}:{state:this,n:0})}t.push(u),o=o.applyInner(u),i=!0}r&&(r[s]={state:o,n:t.length})}}if(!i)return{state:o,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Do(this.config),o=this.config.fields;for(let r=0;r<o.length;r++){let i=o[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new v1(this)}static create(e){let t=new Ra(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new Do(t);for(let r=0;r<t.fields.length;r++)o[t.fields[r].name]=t.fields[r].init(e,o);return o}reconfigure(e){let t=new Ra(this.schema,e.plugins),o=t.fields,r=new Do(t);for(let i=0;i<o.length;i++){let s=o[i].name;r[s]=this.hasOwnProperty(s)?this[s]:o[i].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[o],i=r.spec.state;i&&i.toJSON&&(t[o]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,o){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new Ra(e.schema,e.plugins),i=new Do(r);return r.fields.forEach(s=>{if(s.name=="doc")i.doc=Fn.fromJSON(e.schema,t.doc);else if(s.name=="selection")i.selection=Re.fromJSON(i.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let l in o){let c=o[l],d=c.spec.state;if(c.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[s.name]=d.fromJSON.call(c,e,t[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function Gu(n,e,t){for(let o in n){let r=n[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=Gu(r,e,{})),t[o]=r}return t}class Mt{constructor(e){this.spec=e,this.props={},e.props&&Gu(e.props,this,this.props),this.key=e.key?e.key.key:Ku("plugin")}getState(e){return e[this.key]}}const Pa=Object.create(null);function Ku(n){return n in Pa?n+"$"+ ++Pa[n]:(Pa[n]=0,n+"$")}class en{constructor(e="key"){this.key=Ku(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const La=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Ju(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Xu=(n,e,t)=>{let o=Ju(n,t);if(!o)return!1;let r=$a(o);if(!r){let s=o.blockRange(),l=s&&Ao(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(sf(n,r,e,-1))return!0;if(o.parent.content.size==0&&(Ro(i,"end")||Ce.isSelectable(i)))for(let s=o.depth;;s--){let l=Ni(n.doc,o.before(s),o.after(s),fe.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=n.tr.step(l);c.setSelection(Ro(i,"end")?Re.findFrom(c.doc.resolve(c.mapping.map(r.pos,-1)),-1):Ce.create(c.doc,r.pos-i.nodeSize)),e(c.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(e&&e(n.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},M1=(n,e,t)=>{let o=Ju(n,t);if(!o)return!1;let r=$a(o);return r?Yu(n,r,e):!1},A1=(n,e,t)=>{let o=Zu(n,t);if(!o)return!1;let r=Va(o);return r?Yu(n,r,e):!1};function Yu(n,e,t){let o=e.nodeBefore,r=o,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let u=r.lastChild;if(!u)return!1;r=u}let s=e.nodeAfter,l=s,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let d=Ni(n.doc,i,c,fe.empty);if(!d||d.from!=i||d instanceof st&&d.slice.size>=c-i)return!1;if(t){let u=n.tr.step(d);u.setSelection(_e.create(u.doc,i)),t(u.scrollIntoView())}return!0}function Ro(n,e,t=!1){for(let o=n;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(t&&o.childCount!=1)return!1}return!1}const Qu=(n,e,t)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):o.parentOffset>0)return!1;i=$a(o)}let s=i&&i.nodeBefore;return!s||!Ce.isSelectable(s)?!1:(e&&e(n.tr.setSelection(Ce.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function $a(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Zu(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const ef=(n,e,t)=>{let o=Zu(n,t);if(!o)return!1;let r=Va(o);if(!r)return!1;let i=r.nodeAfter;if(sf(n,r,e,1))return!0;if(o.parent.content.size==0&&(Ro(i,"start")||Ce.isSelectable(i))){let s=Ni(n.doc,o.before(),o.after(),fe.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(Ro(i,"start")?Re.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):Ce.create(l.doc,l.mapping.map(r.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&r.depth==o.depth-1?(e&&e(n.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},tf=(n,e,t)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):o.parentOffset<o.parent.content.size)return!1;i=Va(o)}let s=i&&i.nodeAfter;return!s||!Ce.isSelectable(s)?!1:(e&&e(n.tr.setSelection(Ce.create(n.doc,i.pos)).scrollIntoView()),!0)};function Va(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const I1=(n,e)=>{let t=n.selection,o=t instanceof Ce,r;if(o){if(t.node.isTextblock||!Un(n.doc,t.from))return!1;r=t.from}else if(r=Ci(n.doc,t.from,-1),r==null)return!1;if(e){let i=n.tr.join(r);o&&i.setSelection(Ce.create(i.doc,r-n.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},_1=(n,e)=>{let t=n.selection,o;if(t instanceof Ce){if(t.node.isTextblock||!Un(n.doc,t.to))return!1;o=t.to}else if(o=Ci(n.doc,t.to,1),o==null)return!1;return e&&e(n.tr.join(o).scrollIntoView()),!0},O1=(n,e)=>{let{$from:t,$to:o}=n.selection,r=t.blockRange(o),i=r&&Ao(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},nf=(n,e)=>{let{$head:t,$anchor:o}=n.selection;return!t.parent.type.spec.code||!t.sameParent(o)?!1:(e&&e(n.tr.insertText(`
349
+ `).scrollIntoView()),!0)};function Ba(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const D1=(n,e)=>{let{$head:t,$anchor:o}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(o))return!1;let r=t.node(-1),i=t.indexAfter(-1),s=Ba(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(e){let l=t.after(),c=n.tr.replaceWith(l,l,s.createAndFill());c.setSelection(Re.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},of=(n,e)=>{let t=n.selection,{$from:o,$to:r}=t;if(t instanceof Rt||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=Ba(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=n.tr.insert(s,i.createAndFill());l.setSelection(_e.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},rf=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(xn(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let o=t.blockRange(),r=o&&Ao(o);return r==null?!1:(e&&e(n.tr.lift(o,r).scrollIntoView()),!0)};function R1(n){return(e,t)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof Ce&&e.selection.node.isBlock)return!o.parentOffset||!xn(e.doc,o.pos)?!1:(t&&t(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],s,l,c=!1,d=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){c=o.end(h)==o.pos+(o.depth-h),d=o.start(h)==o.pos-(o.depth-h),l=Ba(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(c&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof _e||e.selection instanceof Rt)&&u.deleteSelection();let f=u.mapping.map(o.pos),p=xn(u.doc,f,i.length,i);if(p||(i[0]=l?{type:l}:null,p=xn(u.doc,f,i.length,i)),!p)return!1;if(u.split(f,i.length,i),!c&&d&&o.node(s).type!=l){let h=u.mapping.map(o.before(s)),m=u.doc.resolve(h);l&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,l)&&u.setNodeMarkup(u.mapping.map(o.before(s)),l)}return t&&t(u.scrollIntoView()),!0}}const P1=R1(),L1=(n,e)=>{let{$from:t,to:o}=n.selection,r,i=t.sharedDepth(o);return i==0?!1:(r=t.before(i),e&&e(n.tr.setSelection(Ce.create(n.doc,r))),!0)};function $1(n,e,t){let o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(r.isTextblock||Un(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function sf(n,e,t,o){let r=e.nodeBefore,i=e.nodeAfter,s,l,c=r.type.spec.isolating||i.type.spec.isolating;if(!c&&$1(n,e,t))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(s=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(t){let h=e.pos+i.nodeSize,m=oe.empty;for(let x=s.length-1;x>=0;x--)m=oe.from(s[x].create(null,m));m=oe.from(r.copy(m));let y=n.tr.step(new at(e.pos-1,h,e.pos,h,new fe(m,1,0),s.length,!0)),g=y.doc.resolve(h+2*s.length);g.nodeAfter&&g.nodeAfter.type==r.type&&Un(y.doc,g.pos)&&y.join(g.pos),t(y.scrollIntoView())}return!0}let u=i.type.spec.isolating||o>0&&c?null:Re.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),p=f&&Ao(f);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(f,p).scrollIntoView()),!0;if(d&&Ro(i,"start",!0)&&Ro(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let y=i,g=1;for(;!y.isTextblock;y=y.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,y.content)){if(t){let x=oe.empty;for(let E=m.length-1;E>=0;E--)x=oe.from(m[E].copy(x));let M=n.tr.step(new at(e.pos-m.length,e.pos+i.nodeSize,e.pos+g,e.pos+i.nodeSize-g,new fe(x,m.length,0),0,!0));t(M.scrollIntoView())}return!0}}return!1}function af(n){return function(e,t){let o=e.selection,r=n<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(t&&t(e.tr.setSelection(_e.create(e.doc,n<0?r.start(i):r.end(i)))),!0):!1}}const V1=af(-1),B1=af(1);function F1(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,s=r.blockRange(i),l=s&&Aa(s,n,e);return l?(o&&o(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function lf(n,e=null){return function(t,o){let r=!1;for(let i=0;i<t.selection.ranges.length&&!r;i++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[i];t.doc.nodesBetween(s,l,(c,d)=>{if(r)return!1;if(!(!c.isTextblock||c.hasMarkup(n,e)))if(c.type==n)r=!0;else{let u=t.doc.resolve(d),f=u.index();r=u.parent.canReplaceWith(f,f+1,n)}})}if(!r)return!1;if(o){let i=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:c}}=t.selection.ranges[s];i.setBlockType(l,c,n,e)}o(i.scrollIntoView())}return!0}}function Fa(...n){return function(e,t,o){for(let r=0;r<n.length;r++)if(n[r](e,t,o))return!0;return!1}}Fa(La,Xu,Qu),Fa(La,ef,tf),Fa(nf,of,rf,P1),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function j1(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,s=r.blockRange(i);if(!s)return!1;let l=o?t.tr:null;return H1(l,s,n,e)?(o&&o(l.scrollIntoView()),!0):!1}}function H1(n,e,t,o=null){let r=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=s.resolve(e.start-2);i=new yi(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new yi(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=Aa(i,t,o,e);return l?(n&&U1(n,e,l,r,t),!0):!1}function U1(n,e,t,o,r){let i=oe.empty;for(let u=t.length-1;u>=0;u--)i=oe.from(t[u].type.create(t[u].attrs,i));n.step(new at(e.start-(o?2:0),e.end,e.start,e.end,new fe(i,0,0),t.length,!0));let s=0;for(let u=0;u<t.length;u++)t[u].type==r&&(s=u+1);let l=t.length-s,c=e.start+t.length-(o?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,p=!0;u<f;u++,p=!1)!p&&xn(n.doc,c,l)&&(n.split(c,l),c+=2*l),c+=d.child(u).nodeSize;return n}function W1(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==n);return i?t?o.node(i.depth-1).type==n?q1(e,t,n,i):G1(e,t,i):!0:!1}}function q1(n,e,t,o){let r=n.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new at(i-1,s,i,s,new fe(oe.from(t.create(null,o.parent.copy())),1,0),1,!0)),o=new yi(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=Ao(o);if(l==null)return!1;r.lift(o,l);let c=r.doc.resolve(r.mapping.map(i,-1)-1);return Un(r.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&r.join(c.pos),e(r.scrollIntoView()),!0}function G1(n,e,t){let o=n.tr,r=t.parent;for(let h=t.end,m=t.endIndex-1,y=t.startIndex;m>y;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(t.start),s=i.nodeAfter;if(o.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,c=t.endIndex==r.childCount,d=i.node(-1),u=i.index(-1);if(!d.canReplace(u+(l?0:1),u+1,s.content.append(c?oe.empty:oe.from(r))))return!1;let f=i.pos,p=f+s.nodeSize;return o.step(new at(f-(l?1:0),p+(c?1:0),f+1,p-1,new fe((l?oe.empty:oe.from(r.copy(oe.empty))).append(c?oe.empty:oe.from(r.copy(oe.empty))),l?0:1,c?0:1),l?0:1)),e(o.scrollIntoView()),!0}function K1(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,d=>d.childCount>0&&d.firstChild.type==n);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,c=l.child(s-1);if(c.type!=n)return!1;if(t){let d=c.lastChild&&c.lastChild.type==l.type,u=oe.from(d?n.create():null),f=new fe(oe.from(n.create(null,oe.from(l.type.create(null,u)))),d?3:1,0),p=i.start,h=i.end;t(e.tr.step(new at(p-(d?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}const ut=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Po=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let ja=null;const kn=function(n,e,t){let o=ja||(ja=document.createRange());return o.setEnd(n,t??n.nodeValue.length),o.setStart(n,e||0),o},J1=function(){ja=null},ho=function(n,e,t,o){return t&&(cf(n,e,t,o,-1)||cf(n,e,t,o,1))},X1=/^(img|br|input|textarea|hr)$/i;function cf(n,e,t,o,r){for(var i;;){if(n==t&&e==o)return!0;if(e==(r<0?0:Lt(n))){let s=n.parentNode;if(!s||s.nodeType!=1||yr(n)||X1.test(n.nodeName)||n.contentEditable=="false")return!1;e=ut(n)+(r<0?0:1),n=s}else if(n.nodeType==1){let s=n.childNodes[e+(r<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=r;else return!1;else n=s,e=r<0?Lt(n):0}else return!1}}function Lt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Y1(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Lt(n)}else if(n.parentNode&&!yr(n))e=ut(n),n=n.parentNode;else return null}}function Q1(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!yr(n))e=ut(n)+1,n=n.parentNode;else return null}}function Z1(n,e,t){for(let o=e==0,r=e==Lt(n);o||r;){if(n==t)return!0;let i=ut(n);if(n=n.parentNode,!n)return!1;o=o&&i==0,r=r&&i==Lt(n)}}function yr(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const zi=function(n){return n.focusNode&&ho(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function mo(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function e0(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function t0(n,e,t){if(n.caretPositionFromPoint)try{let o=n.caretPositionFromPoint(e,t);if(o)return{node:o.offsetNode,offset:Math.min(Lt(o.offsetNode),o.offset)}}catch{}if(n.caretRangeFromPoint){let o=n.caretRangeFromPoint(e,t);if(o)return{node:o.startContainer,offset:Math.min(Lt(o.startContainer),o.startOffset)}}}const an=typeof navigator<"u"?navigator:null,df=typeof document<"u"?document:null,Wn=an&&an.userAgent||"",Ha=/Edge\/(\d+)/.exec(Wn),uf=/MSIE \d/.exec(Wn),Ua=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Wn),At=!!(uf||Ua||Ha),qn=uf?document.documentMode:Ua?+Ua[1]:Ha?+Ha[1]:0,$t=!At&&/gecko\/(\d+)/i.test(Wn);$t&&+(/Firefox\/(\d+)/.exec(Wn)||[0,0])[1];const Wa=!At&&/Chrome\/(\d+)/.exec(Wn),lt=!!Wa,ff=Wa?+Wa[1]:0,ft=!At&&!!an&&/Apple Computer/.test(an.vendor),Lo=ft&&(/Mobile\/\w+/.test(Wn)||!!an&&an.maxTouchPoints>2),Vt=Lo||(an?/Mac/.test(an.platform):!1),pf=an?/Win/.test(an.platform):!1,En=/Android \d/.test(Wn),br=!!df&&"webkitFontSmoothing"in df.documentElement.style,n0=br?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function o0(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function wn(n,e){return typeof n=="number"?n:n[e]}function r0(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,o=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*o}}function hf(n,e,t){let o=n.someProp("scrollThreshold")||0,r=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let s=t||n.dom;s;){if(s.nodeType!=1){s=Po(s);continue}let l=s,c=l==i.body,d=c?o0(i):r0(l),u=0,f=0;if(e.top<d.top+wn(o,"top")?f=-(d.top-e.top+wn(r,"top")):e.bottom>d.bottom-wn(o,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+wn(r,"top")-d.top:e.bottom-d.bottom+wn(r,"bottom")),e.left<d.left+wn(o,"left")?u=-(d.left-e.left+wn(r,"left")):e.right>d.right-wn(o,"right")&&(u=e.right-d.right+wn(r,"right")),u||f)if(c)i.defaultView.scrollBy(u,f);else{let h=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);let y=l.scrollLeft-h,g=l.scrollTop-m;e={left:e.left-y,top:e.top-g,right:e.right-y,bottom:e.bottom-g}}let p=c?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:Po(s)}}function i0(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),o,r;for(let i=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(i,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let c=l.getBoundingClientRect();if(c.top>=t-20){o=l,r=c.top;break}}return{refDOM:o,refTop:r,stack:mf(n.dom)}}function mf(n){let e=[],t=n.ownerDocument;for(let o=n;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),n!=t);o=Po(o));return e}function s0({refDOM:n,refTop:e,stack:t}){let o=n?n.getBoundingClientRect().top:0;gf(t,o==0?0:o-e)}function gf(n,e){for(let t=0;t<n.length;t++){let{dom:o,top:r,left:i}=n[t];o.scrollTop!=r+e&&(o.scrollTop=r+e),o.scrollLeft!=i&&(o.scrollLeft=i)}}let $o=null;function a0(n){if(n.setActive)return n.setActive();if($o)return n.focus($o);let e=mf(n);n.focus($o==null?{get preventScroll(){return $o={preventScroll:!0},!0}}:void 0),$o||($o=!1,gf(e,0))}function yf(n,e){let t,o=2e8,r,i=0,s=e.top,l=e.top,c,d;for(let u=n.firstChild,f=0;u;u=u.nextSibling,f++){let p;if(u.nodeType==1)p=u.getClientRects();else if(u.nodeType==3)p=kn(u).getClientRects();else continue;for(let h=0;h<p.length;h++){let m=p[h];if(m.top<=s&&m.bottom>=l){s=Math.max(m.bottom,s),l=Math.min(m.top,l);let y=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(y<o){t=u,o=y,r=y&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&y&&(i=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=f+1)}}return!t&&c&&(t=c,r=d,o=0),t&&t.nodeType==3?l0(t,r):!t||o&&t.nodeType==1?{node:n,offset:i}:yf(t,r)}function l0(n,e){let t=n.nodeValue.length,o=document.createRange(),r;for(let i=0;i<t;i++){o.setEnd(n,i+1),o.setStart(n,i);let s=Gn(o,1);if(s.top!=s.bottom&&qa(e,s)){r={node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return o.detach(),r||{node:n,offset:0}}function qa(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function c0(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function d0(n,e,t){let{node:o,offset:r}=yf(e,t),i=-1;if(o.nodeType==1&&!o.firstChild){let s=o.getBoundingClientRect();i=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(o,r,i)}function u0(n,e,t,o){let r=-1;for(let i=e,s=!1;i!=n.dom;){let l=n.docView.nearestDesc(i,!0),c;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((c=l.dom.getBoundingClientRect()).width||c.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&c.left>o.left||c.top>o.top?r=l.posBefore:(!s&&c.right<o.left||c.bottom<o.top)&&(r=l.posAfter),s=!0),!l.contentDOM&&r<0&&!l.node.isText))return(l.node.isBlock?o.top<(c.top+c.bottom)/2:o.left<(c.left+c.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return r>-1?r:n.docView.posFromDOM(e,t,-1)}function bf(n,e,t){let o=n.childNodes.length;if(o&&t.top<t.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-t.top)/(t.bottom-t.top))-2)),i=r;;){let s=n.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(qa(e,d))return bf(s,e,d)}}if((i=(i+1)%o)==r)break}return n}function f0(n,e){let t=n.dom.ownerDocument,o,r=0,i=t0(t,e.left,e.top);i&&({node:o,offset:r}=i);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let d=n.dom.getBoundingClientRect();if(!qa(e,d)||(s=bf(n.dom,e,d),!s))return null}if(ft)for(let d=s;o&&d;d=Po(d))d.draggable&&(o=void 0);if(s=c0(s,e),o){if($t&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let u=o.childNodes[r],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&r++}let d;br&&r&&o.nodeType==1&&(d=o.childNodes[r-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&r--,o==n.dom&&r==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(r==0||o.nodeType!=1||o.childNodes[r-1].nodeName!="BR")&&(l=u0(n,o,r,e))}l==null&&(l=d0(n,s,e));let c=n.docView.nearestDesc(s,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function xf(n){return n.top<n.bottom||n.left<n.right}function Gn(n,e){let t=n.getClientRects();if(t.length){let o=t[e<0?0:t.length-1];if(xf(o))return o}return Array.prototype.find.call(t,xf)||n.getBoundingClientRect()}const p0=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function kf(n,e,t){let{node:o,offset:r,atom:i}=n.docView.domFromPos(e,t<0?-1:1),s=br||$t;if(o.nodeType==3)if(s&&(p0.test(o.nodeValue)||(t<0?!r:r==o.nodeValue.length))){let c=Gn(kn(o,r,r),t);if($t&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let d=Gn(kn(o,r-1,r-1),-1);if(d.top==c.top){let u=Gn(kn(o,r,r+1),-1);if(u.top!=c.top)return xr(u,u.left<d.left)}}return c}else{let c=r,d=r,u=t<0?1:-1;return t<0&&!r?(d++,u=-1):t>=0&&r==o.nodeValue.length?(c--,u=1):t<0?c--:d++,xr(Gn(kn(o,c,d),u),u<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(t<0||r==Lt(o))){let c=o.childNodes[r-1];if(c.nodeType==1)return Ga(c.getBoundingClientRect(),!1)}if(i==null&&r<Lt(o)){let c=o.childNodes[r];if(c.nodeType==1)return Ga(c.getBoundingClientRect(),!0)}return Ga(o.getBoundingClientRect(),t>=0)}if(i==null&&r&&(t<0||r==Lt(o))){let c=o.childNodes[r-1],d=c.nodeType==3?kn(c,Lt(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return xr(Gn(d,1),!1)}if(i==null&&r<Lt(o)){let c=o.childNodes[r];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?kn(c,0,s?0:1):c.nodeType==1?c:null:null;if(d)return xr(Gn(d,-1),!0)}return xr(Gn(o.nodeType==3?kn(o):o,-t),t>=0)}function xr(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function Ga(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Ef(n,e,t){let o=n.state,r=n.root.activeElement;o!=e&&n.updateState(e),r!=n.dom&&n.focus();try{return t()}finally{o!=e&&n.updateState(o),r!=n.dom&&r&&r.focus()}}function h0(n,e,t){let o=e.selection,r=t=="up"?o.$from:o.$to;return Ef(n,e,()=>{let{node:i}=n.docView.domFromPos(r.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=kf(n,r.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let c;if(l.nodeType==1)c=l.getClientRects();else if(l.nodeType==3)c=kn(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(t=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const m0=/[\u0590-\u08ac]/;function g0(n,e,t){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,s=r==o.parent.content.size,l=n.domSelection();return l?!m0.test(o.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:s:Ef(n,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:f}=n.domSelectionRange(),p=l.caretBidiLevel;l.modify("move",t,"character");let h=o.depth?n.docView.domAfterPos(o.before()):n.dom,{focusNode:m,focusOffset:y}=n.domSelectionRange(),g=m&&!h.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==y;try{l.collapse(u,f),c&&(c!=u||d!=f)&&l.extend&&l.extend(c,d)}catch{}return p!=null&&(l.caretBidiLevel=p),g}):o.pos==o.start()||o.pos==o.end()}let wf=null,Sf=null,Cf=!1;function y0(n,e,t){return wf==e&&Sf==t?Cf:(wf=e,Sf=t,Cf=t=="up"||t=="down"?h0(n,e,t):g0(n,e,t))}const Bt=0,Nf=1,go=2,ln=3;class kr{constructor(e,t,o,r){this.parent=e,this.children=t,this.dom=o,this.contentDOM=r,this.dirty=Bt,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,o){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,o=this.posAtStart;;t++){let r=this.children[t];if(r==e)return o;o+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let i,s;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>ut(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!1;break}if(i.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!0;break}if(i.nextSibling)break}}return r??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let o=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),s;if(i&&(!t||i.node))if(o&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))o=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let o=t;o;o=o.parent)if(o==this)return t}posFromDOM(e,t,o){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,o)}return-1}descAt(e){for(let t=0,o=0;t<this.children.length;t++){let r=this.children[t],i=o+r.size;if(o==e&&i!=o){for(;!r.border&&r.children.length;)for(let s=0;s<r.children.length;s++){let l=r.children[s];if(l.size){r=l;break}}return r}if(e<i)return r.descAt(e-o-r.border);o=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,r=0;for(let i=0;o<this.children.length;o++){let s=this.children[o],l=i+s.size;if(l>e||s instanceof zf){r=e-i;break}i=l}if(r)return this.children[o].domFromPos(r-this.children[o].border,t);for(let i;o&&!(i=this.children[o-1]).size&&i instanceof Tf&&i.side>=0;o--);if(t<=0){let i,s=!0;for(;i=o?this.children[o-1]:null,!(!i||i.dom.parentNode==this.contentDOM);o--,s=!1);return i&&t&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?ut(i.dom)+1:0}}else{let i,s=!0;for(;i=o<this.children.length?this.children[o]:null,!(!i||i.dom.parentNode==this.contentDOM);o++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?ut(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=o,l=0;;l++){let c=this.children[l],d=s+c.size;if(r==-1&&e<=d){let u=s+c.border;if(e>=u&&t<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,t,u);e=s;for(let f=l;f>0;f--){let p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=ut(p.dom)+1;break}e-=p.size}r==-1&&(r=0)}if(r>-1&&(d>t||l==this.children.length-1)){t=d;for(let u=l+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=ut(f.dom);break}t+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=d}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:o}=this.domFromPos(e,0);if(t.nodeType!=1||o==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[o]}setSelection(e,t,o,r=!1){let i=Math.min(e,t),s=Math.max(e,t);for(let h=0,m=0;h<this.children.length;h++){let y=this.children[h],g=m+y.size;if(i>m&&s<g)return y.setSelection(e-m-y.border,t-m-y.border,o,r);m=g}let l=this.domFromPos(e,e?-1:1),c=t==e?l:this.domFromPos(t,t?-1:1),d=o.root.getSelection(),u=o.domSelectionRange(),f=!1;if(($t||ft)&&e==t){let{node:h,offset:m}=l;if(h.nodeType==3){if(f=!!(m&&h.nodeValue[m-1]==`
350
+ `),f&&m==h.nodeValue.length)for(let y=h,g;y;y=y.parentNode){if(g=y.nextSibling){g.nodeName=="BR"&&(l=c={node:g.parentNode,offset:ut(g)+1});break}let x=y.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let y=h.childNodes[m-1];f=y&&(y.nodeName=="BR"||y.contentEditable=="false")}}if($t&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(r=!0)}if(!(r||f&&ft)&&ho(l.node,l.offset,u.anchorNode,u.anchorOffset)&&ho(c.node,c.offset,u.focusNode,u.focusOffset))return;let p=!1;if((d.extend||e==t)&&!(f&&$t)){d.collapse(l.node,l.offset);try{e!=t&&d.extend(c.node,c.offset),p=!0}catch{}}if(!p){if(e>t){let m=l;l=c,c=m}let h=document.createRange();h.setEnd(c.node,c.offset),h.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let o=0,r=0;r<this.children.length;r++){let i=this.children[r],s=o+i.size;if(o==s?e<=s&&t>=o:e<s&&t>o){let l=o+i.border,c=s-i.border;if(e>=l&&t<=c){this.dirty=e==o||t==s?go:Nf,e==l&&t==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=ln:i.markDirty(e-l,t-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?go:ln}o=s}this.dirty=go}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let o=e==1?go:Nf;t.dirty<o&&(t.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Tf extends kr{constructor(e,t,o,r){let i,s=t.type.toDOM;if(typeof s=="function"&&(s=s(o,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Bt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class b0 extends kr{constructor(e,t,o,r){super(e,[],t,null),this.textDOM=o,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class yo extends kr{constructor(e,t,o,r,i){super(e,[],o,r),this.mark=t,this.spec=i}static create(e,t,o,r){let i=r.nodeViews[t.type.name],s=i&&i(t,r,o);return(!s||!s.dom)&&(s=fo.renderSpec(document,t.type.spec.toDOM(t,o),null,t.attrs)),new yo(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&ln||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ln&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Bt){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=Bt}}slice(e,t,o){let r=yo.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;t<s&&(i=Ja(i,t,s,o)),e>0&&(i=Ja(i,0,e,o));for(let l=0;l<i.length;l++)i[l].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Kn extends kr{constructor(e,t,o,r,i,s,l,c,d){super(e,[],i,s),this.node=t,this.outerDeco=o,this.innerDeco=r,this.nodeDOM=l}static create(e,t,o,r,i,s){let l=i.nodeViews[t.type.name],c,d=l&&l(t,i,()=>{if(!c)return s;if(c.parent)return c.parent.posBeforeChild(c)},o,r),u=d&&d.dom,f=d&&d.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=fo.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let p=u;return u=If(u,o,t),d?c=new x0(e,t,o,r,u,f||null,p,d,i,s+1):t.isText?new Mi(e,t,o,r,u,p,i):new Kn(e,t,o,r,u,f||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let o=this.children[t];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>oe.empty)}return e}matchesNode(e,t,o){return this.dirty==Bt&&e.eq(this.node)&&Ai(t,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let o=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,c=new E0(this,s&&s.node,e);C0(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?c.syncToMarks(d.spec.marks,o,e,u):d.type.side>=0&&!f&&c.syncToMarks(u==this.node.childCount?Fe.none:this.node.child(u).marks,o,e,u),c.placeWidget(d,e,r)},(d,u,f,p)=>{c.syncToMarks(d.marks,o,e,p);let h;c.findNodeMatch(d,u,f,p)||l&&e.state.selection.from>r&&e.state.selection.to<r+d.nodeSize&&(h=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(d,u,f,h,e)||c.updateNextNode(d,u,f,e,p,r)||c.addNode(d,u,f,e,r),r+=d.nodeSize}),c.syncToMarks([],o,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==go)&&(s&&this.protectLocalComposition(e,s),Mf(this.contentDOM,this.children,e),Lo&&N0(this.dom))}localCompositionInfo(e,t){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof _e)||o<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=T0(this.node.content,s,o-t,r-t);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:o,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new b0(this,i,t,r);e.input.compositionNodes.push(s),this.children=Ja(this.children,o,o+r.length,e,s)}update(e,t,o,r){return this.dirty==ln||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,o,r),!0)}updateInner(e,t,o,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Bt}updateOuterDeco(e){if(Ai(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=Af(this.dom,this.nodeDOM,Ka(this.outerDeco,this.node,t),Ka(e,this.node,t)),this.dom!=o&&(o.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function vf(n,e,t,o,r){If(o,e,n);let i=new Kn(void 0,n,e,t,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class Mi extends Kn{constructor(e,t,o,r,i,s,l){super(e,t,o,r,i,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,o,r){return this.dirty==ln||this.dirty!=Bt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Bt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Bt,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,o){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,o){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new Mi(this.parent,r,this.outerDeco,this.innerDeco,i,i,o)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=ln)}get domAtom(){return!1}isText(e){return this.node.text==e}}class zf extends kr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Bt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class x0 extends Kn{constructor(e,t,o,r,i,s,l,c,d,u){super(e,t,o,r,i,s,l,d,u),this.spec=c}update(e,t,o,r){if(this.dirty==ln)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,o);return i&&this.updateInner(e,t,o,r),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,o,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,o,r){this.spec.setSelection?this.spec.setSelection(e,t,o.root):super.setSelection(e,t,o,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Mf(n,e,t){let o=n.firstChild,r=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==n){for(;l!=o;)o=_f(o),r=!0;o=o.nextSibling}else r=!0,n.insertBefore(l,o);if(s instanceof yo){let c=o?o.previousSibling:n.lastChild;Mf(s.contentDOM,s.children,t),o=c?c.nextSibling:n.firstChild}}for(;o;)o=_f(o),r=!0;r&&t.trackWrites==n&&(t.trackWrites=null)}const Er=function(n){n&&(this.nodeName=n)};Er.prototype=Object.create(null);const bo=[new Er];function Ka(n,e,t){if(n.length==0)return bo;let o=t?bo[0]:new Er,r=[o];for(let i=0;i<n.length;i++){let s=n[i].type.attrs;if(s){s.nodeName&&r.push(o=new Er(s.nodeName));for(let l in s){let c=s[l];c!=null&&(t&&r.length==1&&r.push(o=new Er(e.isInline?"span":"div")),l=="class"?o.class=(o.class?o.class+" ":"")+c:l=="style"?o.style=(o.style?o.style+";":"")+c:l!="nodeName"&&(o[l]=c))}}}return r}function Af(n,e,t,o){if(t==bo&&o==bo)return e;let r=e;for(let i=0;i<o.length;i++){let s=o[i],l=t[i];if(i){let c;l&&l.nodeName==s.nodeName&&r!=n&&(c=r.parentNode)&&c.nodeName.toLowerCase()==s.nodeName||(c=document.createElement(s.nodeName),c.pmIsDeco=!0,c.appendChild(r),l=bo[0]),r=c}k0(r,l||bo[0],s)}return r}function k0(n,e,t){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in t)&&n.removeAttribute(o);for(let o in t)o!="class"&&o!="style"&&o!="nodeName"&&t[o]!=e[o]&&n.setAttribute(o,t[o]);if(e.class!=t.class){let o=e.class?e.class.split(" ").filter(Boolean):[],r=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&n.classList.remove(o[i]);for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&n.classList.add(r[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=o.exec(e.style);)n.style.removeProperty(r[1])}t.style&&(n.style.cssText+=t.style)}}function If(n,e,t){return Af(n,n,bo,Ka(e,t,n.nodeType!=1))}function Ai(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function _f(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class E0{constructor(e,t,o){this.lock=t,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=w0(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let o=e;o<t;o++)this.top.children[o].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,o,r){let i=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;i<l&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=Bt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let c=-1,d=this.top.children.length;r<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let u=this.index;u<d;u++){let f=this.top.children[u];if(f.matchesMark(e[s])&&!this.isLocked(f.dom)){c=u;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let u=yo.create(this.top,e[s],t,o);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,o,r){let i=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,o))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,c=Math.min(this.top.children.length,l+5);l<c;l++){let d=this.top.children[l];if(d.matchesNode(e,t,o)&&!this.preMatch.matched.has(d)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,o,r,i){let s=this.top.children[r];return s.dirty==ln&&s.dom==s.contentDOM&&(s.dirty=go),s.update(e,t,o,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==o)return r}return-1}e=t}}updateNextNode(e,t,o,r,i,s){for(let l=this.index;l<this.top.children.length;l++){let c=this.top.children[l];if(c instanceof Kn){let d=this.preMatch.matched.get(c);if(d!=null&&d!=i)return!1;let u=c.dom,f,p=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=ln&&Ai(t,c.outerDeco));if(!p&&c.update(e,t,o,r))return this.destroyBetween(this.index,l),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!p&&(f=this.recreateWrapper(c,e,t,o,r,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=go,f.updateChildren(r,s+1),f.dirty=Bt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,o,r,i,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Ai(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=Kn.create(this.top,t,o,r,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let c of l.children)c.parent=l}return e.destroy(),l}addNode(e,t,o,r,i){let s=Kn.create(this.top,e,t,o,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,o){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let i=new Tf(this.top,e,t,o);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof yo;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Mi)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ft||lt)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let r=new zf(this.top,[],o,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function w0(n,e){let t=e,o=t.children.length,r=n.childCount,i=new Map,s=[];e:for(;r>0;){let l;for(;;)if(o){let d=t.children[o-1];if(d instanceof yo)t=d,o=d.children.length;else{l=d,o--;break}}else{if(t==e)break e;o=t.parent.children.indexOf(t),t=t.parent}let c=l.node;if(c){if(c!=n.child(r-1))break;--r,i.set(l,r),s.push(l)}}return{index:r,matched:i,matches:s.reverse()}}function S0(n,e){return n.type.side-e.type.side}function C0(n,e,t,o){let r=e.locals(n),i=0;if(r.length==0){for(let d=0;d<n.childCount;d++){let u=n.child(d);o(u,r,e.forChild(i,u),d),i+=u.nodeSize}return}let s=0,l=[],c=null;for(let d=0;;){let u,f;for(;s<r.length&&r[s].to==i;){let g=r[s++];g.widget&&(u?(f||(f=[u])).push(g):u=g)}if(u)if(f){f.sort(S0);for(let g=0;g<f.length;g++)t(f[g],d,!!c)}else t(u,d,!!c);let p,h;if(c)h=-1,p=c,c=null;else if(d<n.childCount)h=d,p=n.child(d++);else break;for(let g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;s<r.length&&r[s].from<=i&&r[s].to>i;)l.push(r[s++]);let m=i+p.nodeSize;if(p.isText){let g=m;s<r.length&&r[s].from<g&&(g=r[s].from);for(let x=0;x<l.length;x++)l[x].to<g&&(g=l[x].to);g<m&&(c=p.cut(g-i),p=p.cut(0,g-i),m=g,h=-1)}else for(;s<r.length&&r[s].to<m;)s++;let y=p.isInline&&!p.isLeaf?l.filter(g=>!g.inline):l.slice();o(p,y,e.forChild(i,p),h),i=m}}function N0(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function T0(n,e,t,o){for(let r=0,i=0;r<n.childCount&&i<=o;){let s=n.child(r++),l=i;if(i+=s.nodeSize,!s.isText)continue;let c=s.text;for(;r<n.childCount;){let d=n.child(r++);if(i+=d.nodeSize,!d.isText)break;c+=d.text}if(i>=t){if(i>=o&&c.slice(o-e.length-l,o-l)==e)return o-e.length;let d=l<o?c.lastIndexOf(e,o-l-1):-1;if(d>=0&&d+e.length+l>=t)return l+d;if(t==o&&c.length>=o+e.length-l&&c.slice(o-l,o-l+e.length)==e)return o}}return-1}function Ja(n,e,t,o,r){let i=[];for(let s=0,l=0;s<n.length;s++){let c=n[s],d=l,u=l+=c.size;d>=t||u<=e?i.push(c):(d<e&&i.push(c.slice(0,e-d,o)),r&&(i.push(r),r=void 0),u>t&&i.push(c.slice(t-d,c.size,o)))}return i}function Xa(n,e=null){let t=n.domSelectionRange(),o=n.state.doc;if(!t.focusNode)return null;let r=n.docView.nearestDesc(t.focusNode),i=r&&r.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=o.resolve(s),c,d;if(zi(t)){for(c=s;r&&!r.node;)r=r.parent;let f=r.node;if(r&&f.isAtom&&Ce.isSelectable(f)&&r.parent&&!(f.isInline&&Z1(t.focusNode,t.focusOffset,r.dom))){let p=r.posBefore;d=new Ce(s==p?l:o.resolve(p))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=s,p=s;for(let h=0;h<t.rangeCount;h++){let m=t.getRangeAt(h);f=Math.min(f,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[c,s]=p==n.state.selection.anchor?[p,f]:[f,p],l=o.resolve(s)}else c=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(c<0)return null}let u=o.resolve(c);if(!d){let f=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;d=Qa(n,u,l,f)}return d}function Of(n){return n.editable?n.hasFocus():Bf(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Sn(n,e=!1){let t=n.state.selection;if(Lf(n,t),!!Of(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&lt){let o=n.domSelectionRange(),r=n.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&ho(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)z0(n);else{let{anchor:o,head:r}=t,i,s;Df&&!(t instanceof _e)&&(t.$from.parent.inlineContent||(i=Rf(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=Rf(n,t.to))),n.docView.setSelection(o,r,n,e),Df&&(i&&Pf(i),s&&Pf(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&v0(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Df=ft||lt&&ff<63;function Rf(n,e){let{node:t,offset:o}=n.docView.domFromPos(e,0),r=o<t.childNodes.length?t.childNodes[o]:null,i=o?t.childNodes[o-1]:null;if(ft&&r&&r.contentEditable=="false")return Ya(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return Ya(r);if(i)return Ya(i)}}function Ya(n){return n.contentEditable="true",ft&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Pf(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function v0(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),o=t.anchorNode,r=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=o||t.anchorOffset!=r)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Of(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function z0(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,o=t.nodeName=="IMG";o?e.collapse(t.parentNode,ut(t)+1):e.collapse(t,0),!o&&!n.state.selection.visible&&At&&qn<=11&&(t.disabled=!0,t.disabled=!1)}function Lf(n,e){if(e instanceof Ce){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&($f(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else $f(n)}function $f(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Qa(n,e,t,o){return n.someProp("createSelectionBetween",r=>r(n,e,t))||_e.between(e,t,o)}function Vf(n){return n.editable&&!n.hasFocus()?!1:Bf(n)}function Bf(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function M0(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return ho(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Za(n,e){let{$anchor:t,$head:o}=n.selection,r=e>0?t.max(o):t.min(o),i=r.parent.inlineContent?r.depth?n.doc.resolve(e>0?r.after():r.before()):null:r;return i&&Re.findFrom(i,e)}function Jn(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Ff(n,e,t){let o=n.state.selection;if(o instanceof _e)if(t.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=n.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return Jn(n,new _e(o.$anchor,s))}else if(o.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let r=Za(n.state,e);return r&&r instanceof Ce?Jn(n,r):!1}else if(!(Vt&&t.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?Ce.isSelectable(i)?Jn(n,new Ce(e<0?n.state.doc.resolve(r.pos-i.nodeSize):r)):br?Jn(n,new _e(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof Ce&&o.node.isInline)return Jn(n,new _e(e>0?o.$to:o.$from));{let r=Za(n.state,e);return r?Jn(n,r):!1}}}function Ii(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function wr(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Vo(n,e){return e<0?A0(n):I0(n)}function A0(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r,i,s=!1;for($t&&t.nodeType==1&&o<Ii(t)&&wr(t.childNodes[o],-1)&&(s=!0);;)if(o>0){if(t.nodeType!=1)break;{let l=t.childNodes[o-1];if(wr(l,-1))r=t,i=--o;else if(l.nodeType==3)t=l,o=t.nodeValue.length;else break}}else{if(jf(t))break;{let l=t.previousSibling;for(;l&&wr(l,-1);)r=t.parentNode,i=ut(l),l=l.previousSibling;if(l)t=l,o=Ii(t);else{if(t=t.parentNode,t==n.dom)break;o=0}}}s?el(n,t,o):r&&el(n,r,i)}function I0(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r=Ii(t),i,s;for(;;)if(o<r){if(t.nodeType!=1)break;let l=t.childNodes[o];if(wr(l,1))i=t,s=++o;else break}else{if(jf(t))break;{let l=t.nextSibling;for(;l&&wr(l,1);)i=l.parentNode,s=ut(l)+1,l=l.nextSibling;if(l)t=l,o=0,r=Ii(t);else{if(t=t.parentNode,t==n.dom)break;o=r=0}}}i&&el(n,i,s)}function jf(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function _0(n,e){for(;n&&e==n.childNodes.length&&!yr(n);)e=ut(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function O0(n,e){for(;n&&!e&&!yr(n);)e=ut(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function el(n,e,t){if(e.nodeType!=3){let i,s;(s=_0(e,t))?(e=s,t=0):(i=O0(e,t))&&(e=i,t=i.nodeValue.length)}let o=n.domSelection();if(!o)return;if(zi(o)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(e,t);n.domObserver.setCurSelection();let{state:r}=n;setTimeout(()=>{n.state==r&&Sn(n)},50)}function Hf(n,e){let t=n.state.doc.resolve(e);if(!(lt||pf)&&t.parent.inlineContent){let r=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Uf(n,e,t){let o=n.state.selection;if(o instanceof _e&&!o.empty||t.indexOf("s")>-1||Vt&&t.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Za(n.state,e);if(s&&s instanceof Ce)return Jn(n,s)}if(!r.parent.inlineContent){let s=e<0?r:i,l=o instanceof Rt?Re.near(s,e):Re.findFrom(s,e);return l?Jn(n,l):!1}return!1}function Wf(n,e){if(!(n.state.selection instanceof _e))return!0;let{$head:t,$anchor:o,empty:r}=n.state.selection;if(!t.sameParent(o))return!0;if(!r)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let s=n.state.tr;return e<0?s.delete(t.pos-i.nodeSize,t.pos):s.delete(t.pos,t.pos+i.nodeSize),n.dispatch(s),!0}return!1}function qf(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function D0(n){if(!ft||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;qf(n,o,"true"),setTimeout(()=>qf(n,o,"false"),20)}return!1}function R0(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function P0(n,e){let t=e.keyCode,o=R0(e);if(t==8||Vt&&t==72&&o=="c")return Wf(n,-1)||Vo(n,-1);if(t==46&&!e.shiftKey||Vt&&t==68&&o=="c")return Wf(n,1)||Vo(n,1);if(t==13||t==27)return!0;if(t==37||Vt&&t==66&&o=="c"){let r=t==37?Hf(n,n.state.selection.from)=="ltr"?-1:1:-1;return Ff(n,r,o)||Vo(n,r)}else if(t==39||Vt&&t==70&&o=="c"){let r=t==39?Hf(n,n.state.selection.from)=="ltr"?1:-1:1;return Ff(n,r,o)||Vo(n,r)}else{if(t==38||Vt&&t==80&&o=="c")return Uf(n,-1,o)||Vo(n,-1);if(t==40||Vt&&t==78&&o=="c")return D0(n)||Uf(n,1,o)||Vo(n,1);if(o==(Vt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function tl(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:o,openStart:r,openEnd:i}=e;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let h=o.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let s=n.someProp("clipboardSerializer")||fo.fromSchema(n.state.schema),l=ep(),c=l.createElement("div");c.appendChild(s.serializeFragment(o,{document:l}));let d=c.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=Qf[d.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=l.createElement(u[h]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),f++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${r} ${i}${f?` -${f}`:""} ${JSON.stringify(t)}`);let p=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
351
+
352
+ `);return{dom:c,text:p,slice:e}}function Gf(n,e,t,o,r){let i=r.parent.type.spec.code,s,l;if(!t&&!e)return null;let c=!!e&&(o||i||!t);if(c){if(n.someProp("transformPastedText",p=>{e=p(e,i||o,n)}),i)return l=new fe(oe.from(n.state.schema.text(e.replace(/\r\n?/g,`
353
+ `))),0,0),n.someProp("transformPasted",p=>{l=p(l,n,!0)}),l;let f=n.someProp("clipboardTextParser",p=>p(e,r,o,n));if(f)l=f;else{let p=r.marks(),{schema:h}=n.state,m=fo.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(y=>{let g=s.appendChild(document.createElement("p"));y&&g.appendChild(m.serializeNode(h.text(y,p)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),s=B0(t),br&&F0(s);let d=s&&s.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||dr.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||u),context:r,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!L0.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)l=j0(Yf(l,+u[1],+u[2]),u[4]);else if(l=fe.maxOpen($0(l.content,r),!0),l.openStart||l.openEnd){let f=0,p=0;for(let h=l.content.firstChild;f<l.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=l.content.lastChild;p<l.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);l=Yf(l,f,p)}return n.someProp("transformPasted",f=>{l=f(l,n,c)}),l}const L0=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function $0(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.index(t)),i,s=[];if(n.forEach(l=>{if(!s)return;let c=r.findWrapping(l.type),d;if(!c)return s=null;if(d=s.length&&i.length&&Jf(c,i,l,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=Xf(s[s.length-1],i.length));let u=Kf(l,c);s.push(u),r=r.matchType(u.type),i=c}}),s)return oe.from(s)}return n}function Kf(n,e,t=0){for(let o=e.length-1;o>=t;o--)n=e[o].create(null,oe.from(n));return n}function Jf(n,e,t,o,r){if(r<n.length&&r<e.length&&n[r]==e[r]){let i=Jf(n,e,t,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==n.length-1?t.type:n[r+1]))return o.copy(o.content.append(oe.from(Kf(t,n,r+1))))}}function Xf(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Xf(n.lastChild,e-1)),o=n.contentMatchAt(n.childCount).fillBefore(oe.empty,!0);return n.copy(t.append(o))}function nl(n,e,t,o,r,i){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(i=0),r<o-1&&(l=nl(l,e,t,o,r+1,i)),r>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(oe.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function Yf(n,e,t){return e<n.openStart&&(n=new fe(nl(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new fe(nl(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Qf={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Zf=null;function ep(){return Zf||(Zf=document.implementation.createHTMLDocument("title"))}let ol=null;function V0(n){let e=window.trustedTypes;return e?(ol||(ol=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),ol.createHTML(n)):n}function B0(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=ep().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(n),r;if((r=o&&Qf[o[1].toLowerCase()])&&(n=r.map(i=>"<"+i+">").join("")+n+r.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=V0(n),r)for(let i=0;i<r.length;i++)t=t.querySelector(r[i])||t;return t}function F0(n){let e=n.querySelectorAll(lt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let o=e[t];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),o)}}function j0(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return n}let{content:r,openStart:i,openEnd:s}=n;for(let l=o.length-2;l>=0;l-=2){let c=t.nodes[o[l]];if(!c||c.hasRequiredAttrs())break;r=oe.from(c.create(o[l+1],r)),i++,s++}return new fe(r,i,s)}const Nt={},Tt={},H0={touchstart:!0,touchmove:!0};class U0{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function W0(n){for(let e in Nt){let t=Nt[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=o=>{G0(n,o)&&!il(n,o)&&(n.editable||!(o.type in Tt))&&t(n,o)},H0[e]?{passive:!0}:void 0)}ft&&n.dom.addEventListener("input",()=>null),rl(n)}function Xn(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function q0(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function rl(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=o=>il(n,o))})}function il(n,e){return n.someProp("handleDOMEvents",t=>{let o=t[e.type];return o?o(n,e)||e.defaultPrevented:!1})}function G0(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function K0(n,e){!il(n,e)&&Nt[e.type]&&(n.editable||!(e.type in Tt))&&Nt[e.type](n,e)}Tt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!np(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(En&&lt&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Lo&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let o=Date.now();n.input.lastIOSEnter=o,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==o&&(n.someProp("handleKeyDown",r=>r(n,mo(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",o=>o(n,t))||P0(n,t)?t.preventDefault():Xn(n,"key")},Tt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},Tt.keypress=(n,e)=>{let t=e;if(np(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Vt&&t.metaKey)return;if(n.someProp("handleKeyPress",r=>r(n,t))){t.preventDefault();return}let o=n.state.selection;if(!(o instanceof _e)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!n.someProp("handleTextInput",s=>s(n,o.$from.pos,o.$to.pos,r,i))&&n.dispatch(i()),t.preventDefault()}};function _i(n){return{left:n.clientX,top:n.clientY}}function J0(n,e){let t=e.x-n.clientX,o=e.y-n.clientY;return t*t+o*o<100}function sl(n,e,t,o,r){if(o==-1)return!1;let i=n.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(n.someProp(e,l=>s>i.depth?l(n,t,i.nodeAfter,i.before(s),r,!0):l(n,t,i.node(s),i.before(s),r,!1)))return!0;return!1}function Bo(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let o=n.state.tr.setSelection(e);o.setMeta("pointer",!0),n.dispatch(o)}function X0(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),o=t.nodeAfter;return o&&o.isAtom&&Ce.isSelectable(o)?(Bo(n,new Ce(t)),!0):!1}function Y0(n,e){if(e==-1)return!1;let t=n.state.selection,o,r;t instanceof Ce&&(o=t.node);let i=n.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(Ce.isSelectable(l)){o&&t.$from.depth>0&&s>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?r=i.before(t.$from.depth):r=i.before(s);break}}return r!=null?(Bo(n,Ce.create(n.state.doc,r)),!0):!1}function Q0(n,e,t,o,r){return sl(n,"handleClickOn",e,t,o)||n.someProp("handleClick",i=>i(n,e,o))||(r?Y0(n,t):X0(n,t))}function Z0(n,e,t,o){return sl(n,"handleDoubleClickOn",e,t,o)||n.someProp("handleDoubleClick",r=>r(n,e,o))}function ex(n,e,t,o){return sl(n,"handleTripleClickOn",e,t,o)||n.someProp("handleTripleClick",r=>r(n,e,o))||tx(n,t,o)}function tx(n,e,t){if(t.button!=0)return!1;let o=n.state.doc;if(e==-1)return o.inlineContent?(Bo(n,_e.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let s=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(s.inlineContent)Bo(n,_e.create(o,l+1,l+1+s.content.size));else if(Ce.isSelectable(s))Bo(n,Ce.create(o,l));else continue;return!0}}function al(n){return Oi(n)}const tp=Vt?"metaKey":"ctrlKey";Nt.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let o=al(n),r=Date.now(),i="singleClick";r-n.input.lastClick.time<500&&J0(t,n.input.lastClick)&&!t[tp]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:r,x:t.clientX,y:t.clientY,type:i,button:t.button};let s=n.posAtCoords(_i(t));s&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new nx(n,s,t,!!o)):(i=="doubleClick"?Z0:ex)(n,s.pos,s.inside,t)?t.preventDefault():Xn(n,"pointer"))};class nx{constructor(e,t,o,r){this.view=e,this.pos=t,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[tp],this.allowDefault=o.shiftKey;let i,s;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let u=e.state.doc.resolve(t.pos);i=u.parent,s=u.depth?u.before():0}const l=r?null:o.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:d}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||d instanceof Ce&&d.from<=s&&d.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&$t&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Xn(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Sn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(_i(e))),this.updateAllowDefault(e),this.allowDefault||!t?Xn(this.view,"pointer"):Q0(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ft&&this.mightDrag&&!this.mightDrag.node.isAtom||lt&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Bo(this.view,Re.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Xn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Xn(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Nt.touchstart=n=>{n.input.lastTouch=Date.now(),al(n),Xn(n,"pointer")},Nt.touchmove=n=>{n.input.lastTouch=Date.now(),Xn(n,"pointer")},Nt.contextmenu=n=>al(n);function np(n,e){return n.composing?!0:ft&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const ox=En?5e3:-1;Tt.compositionstart=Tt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof _e&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||lt&&pf&&rx(n)))n.markCursor=n.state.storedMarks||t.marks(),Oi(n,!0),n.markCursor=null;else if(Oi(n,!e.selection.empty),$t&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let o=n.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else r=s,i=-1}}n.input.composing=!0}op(n,ox)};function rx(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let o=e.childNodes[t];return o.nodeType==1&&o.contentEditable=="false"}Tt.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,op(n,20))};function op(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Oi(n),e))}function rp(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=sx());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function ix(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Y1(e.focusNode,e.focusOffset),o=Q1(e.focusNode,e.focusOffset);if(t&&o&&t!=o){let r=o.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||o==i)return i;if(!r||!r.isText(o.nodeValue))return o;if(n.input.compositionNode==o){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return o}}return t||o}function sx(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Oi(n,e=!1){if(!(En&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),rp(n),e||n.docView&&n.docView.dirty){let t=Xa(n),o=n.state.selection;return t&&!t.eq(o)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function ax(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(e),n.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Sr=At&&qn<15||Lo&&n0<604;Nt.copy=Tt.cut=(n,e)=>{let t=e,o=n.state.selection,r=t.type=="cut";if(o.empty)return;let i=Sr?null:t.clipboardData,s=o.content(),{dom:l,text:c}=tl(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",c)):ax(n,l),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function lx(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function cx(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,o=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),o.parentNode&&o.parentNode.removeChild(o),t?Cr(n,o.value,null,r,e):Cr(n,o.textContent,o.innerHTML,r,e)},50)}function Cr(n,e,t,o,r){let i=Gf(n,e,t,o,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,r,i||fe.empty)))return!0;if(!i)return!1;let s=lx(i),l=s?n.state.tr.replaceSelectionWith(s,o):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ip(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Tt.paste=(n,e)=>{let t=e;if(n.composing&&!En)return;let o=Sr?null:t.clipboardData,r=n.input.shiftKey&&n.input.lastKeyCode!=45;o&&Cr(n,ip(o),o.getData("text/html"),r,t)?t.preventDefault():cx(n,t)};class sp{constructor(e,t,o){this.slice=e,this.move=t,this.node=o}}const dx=Vt?"altKey":"ctrlKey";function ap(n,e){let t=n.someProp("dragCopies",o=>!o(e));return t??!e[dx]}Nt.dragstart=(n,e)=>{let t=e,o=n.input.mouseDown;if(o&&o.done(),!t.dataTransfer)return;let r=n.state.selection,i=r.empty?null:n.posAtCoords(_i(t)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof Ce?r.to-1:r.to))){if(o&&o.mightDrag)s=Ce.create(n.state.doc,o.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(s=Ce.create(n.state.doc,f.posBefore))}}let l=(s||n.state.selection).content(),{dom:c,text:d,slice:u}=tl(n,l);(!t.dataTransfer.files.length||!lt||ff>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Sr?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",Sr||t.dataTransfer.setData("text/plain",d),n.dragging=new sp(u,ap(n,t),s)},Nt.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},Tt.dragover=Tt.dragenter=(n,e)=>e.preventDefault(),Tt.drop=(n,e)=>{try{ux(n,e,n.dragging)}finally{n.dragging=null}};function ux(n,e,t){if(!e.dataTransfer)return;let o=n.posAtCoords(_i(e));if(!o)return;let r=n.state.doc.resolve(o.pos),i=t&&t.slice;i?n.someProp("transformPasted",h=>{i=h(i,n,!1)}):i=Gf(n,ip(e.dataTransfer),Sr?null:e.dataTransfer.getData("text/html"),!1,r);let s=!!(t&&ap(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||fe.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?b1(n.state.doc,r.pos,i):r.pos;l==null&&(l=r.pos);let c=n.state.tr;if(s){let{node:h}=t;h?h.replace(c):c.deleteSelection()}let d=c.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=c.doc;if(u?c.replaceRangeWith(d,d,i.content.firstChild):c.replaceRange(d,d,i),c.doc.eq(f))return;let p=c.doc.resolve(d);if(u&&Ce.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new Ce(p));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,y,g,x)=>h=x),c.setSelection(Qa(n,p,c.doc.resolve(h)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))}Nt.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Sn(n)},20))},Nt.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},Nt.beforeinput=(n,e)=>{if(lt&&En&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:o}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=o||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,mo(8,"Backspace")))))return;let{$cursor:r}=n.state.selection;r&&r.pos>0&&n.dispatch(n.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let n in Tt)Nt[n]=Tt[n];function Nr(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Di{constructor(e,t){this.toDOM=e,this.spec=t||xo,this.side=this.spec.side||0}map(e,t,o,r){let{pos:i,deleted:s}=e.mapResult(t.from+r,this.side<0?-1:1);return s?null:new tn(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof Di&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Nr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Yn{constructor(e,t){this.attrs=e,this.spec=t||xo}map(e,t,o,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-o,s=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new tn(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Yn&&Nr(this.attrs,e.attrs)&&Nr(this.spec,e.spec)}static is(e){return e.type instanceof Yn}destroy(){}}class ll{constructor(e,t){this.attrs=e,this.spec=t||xo}map(e,t,o,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let s=e.mapResult(t.to+r,-1);return s.deleted||s.pos<=i.pos?null:new tn(i.pos-o,s.pos-o,this)}valid(e,t){let{index:o,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(o)).isText&&r+i.nodeSize==t.to}eq(e){return this==e||e instanceof ll&&Nr(this.attrs,e.attrs)&&Nr(this.spec,e.spec)}destroy(){}}class tn{constructor(e,t,o){this.from=e,this.to=t,this.type=o}copy(e,t){return new tn(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,o){return this.type.map(e,this,t,o)}static widget(e,t,o){return new tn(e,e,new Di(t,o))}static inline(e,t,o,r){return new tn(e,t,new Yn(o,r))}static node(e,t,o,r){return new tn(e,t,new ll(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Yn}get widget(){return this.type instanceof Di}}const Fo=[],xo={};class ct{constructor(e,t){this.local=e.length?e:Fo,this.children=t.length?t:Fo}static create(e,t){return t.length?Ri(t,e,0,xo):gt}find(e,t,o){let r=[];return this.findInner(e??0,t??1e9,r,0,o),r}findInner(e,t,o,r,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,o,r+l,i)}}map(e,t,o){return this==gt||e.maps.length==0?this:this.mapInner(e,t,0,0,o||xo)}mapInner(e,t,o,r,i){let s;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,o,r);c&&c.type.valid(t,c)?(s||(s=[])).push(c):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?fx(this.children,s||[],e,t,o,r,i):s?new ct(s.sort(ko),Fo):gt}add(e,t){return t.length?this==gt?ct.create(e,t):this.addInner(e,t,0):this}addInner(e,t,o){let r,i=0;e.forEach((l,c)=>{let d=c+o,u;if(u=cp(t,l,d)){for(r||(r=this.children.slice());i<r.length&&r[i]<c;)i+=3;r[i]==c?r[i+2]=r[i+2].addInner(l,u,d+1):r.splice(i,0,c,c+l.nodeSize,Ri(u,l,d+1,xo)),i+=3}});let s=lp(i?dp(t):t,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new ct(s.length?this.local.concat(s).sort(ko):this.local,r||this.children)}remove(e){return e.length==0||this==gt?this:this.removeInner(e,0)}removeInner(e,t){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let s,l=o[i]+t,c=o[i+1]+t;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>l&&f.to<c&&(e[u]=null,(s||(s=[])).push(f));if(!s)continue;o==this.children&&(o=this.children.slice());let d=o[i+2].removeInner(s,l+1);d!=gt?o[i+2]=d:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<r.length;l++)r[l].eq(s,t)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new ct(r,o):gt}forChild(e,t){if(this==gt)return this;if(t.isLeaf)return ct.empty;let o,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let i=e+1,s=i+t.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<s&&c.to>i&&c.type instanceof Yn){let d=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;d<u&&(r||(r=[])).push(c.copy(d,u))}}if(r){let l=new ct(r.sort(ko),Fo);return o?new Qn([l,o]):l}return o||gt}eq(e){if(this==e)return!0;if(!(e instanceof ct)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return cl(this.localsInner(e))}localsInner(e){if(this==gt)return Fo;if(e.inlineContent||!this.local.some(Yn.is))return this.local;let t=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof Yn||t.push(this.local[o]);return t}forEachSet(e){e(this)}}ct.empty=new ct([],[]),ct.removeOverlap=cl;const gt=ct.empty;class Qn{constructor(e){this.members=e}map(e,t){const o=this.members.map(r=>r.map(e,t,xo));return Qn.from(o)}forChild(e,t){if(t.isLeaf)return ct.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=gt&&(i instanceof Qn?o=o.concat(i.members):o.push(i))}return Qn.from(o)}eq(e){if(!(e instanceof Qn)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{o&&(t=t.slice(),o=!1);for(let s=0;s<i.length;s++)t.push(i[s])}}return t?cl(o?t:t.sort(ko)):Fo}static from(e){switch(e.length){case 0:return gt;case 1:return e[0];default:return new Qn(e.every(t=>t instanceof ct)?e:e.reduce((t,o)=>t.concat(o instanceof ct?o:o.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function fx(n,e,t,o,r,i,s){let l=n.slice();for(let d=0,u=i;d<t.maps.length;d++){let f=0;t.maps[d].forEach((p,h,m,y)=>{let g=y-m-(h-p);for(let x=0;x<l.length;x+=3){let M=l[x+1];if(M<0||p>M+u-f)continue;let E=l[x]+u-f;h>=E?l[x+1]=p<=E?-2:-1:p>=u&&g&&(l[x]+=g,l[x+1]+=g)}f+=g}),u=t.maps[d].map(u,-1)}let c=!1;for(let d=0;d<l.length;d+=3)if(l[d+1]<0){if(l[d+1]==-2){c=!0,l[d+1]=-1;continue}let u=t.map(n[d]+i),f=u-r;if(f<0||f>=o.content.size){c=!0;continue}let p=t.map(n[d+1]+i,-1),h=p-r,{index:m,offset:y}=o.content.findIndex(f),g=o.maybeChild(m);if(g&&y==f&&y+g.nodeSize==h){let x=l[d+2].mapInner(t,g,u+1,n[d]+i+1,s);x!=gt?(l[d]=f,l[d+1]=h,l[d+2]=x):(l[d+1]=-2,c=!0)}else c=!0}if(c){let d=px(l,n,e,t,r,i,s),u=Ri(d,o,0,s);e=u.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,p=0;f<u.children.length;f+=3){let h=u.children[f];for(;p<l.length&&l[p]<h;)p+=3;l.splice(p,0,u.children[f],u.children[f+1],u.children[f+2])}}return new ct(e.sort(ko),l)}function lp(n,e){if(!e||!n.length)return n;let t=[];for(let o=0;o<n.length;o++){let r=n[o];t.push(new tn(r.from+e,r.to+e,r.type))}return t}function px(n,e,t,o,r,i,s){function l(c,d){for(let u=0;u<c.local.length;u++){let f=c.local[u].map(o,r,d);f?t.push(f):s.onRemove&&s.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)l(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<n.length;c+=3)n[c+1]==-1&&l(n[c+2],e[c]+i+1);return t}function cp(n,e,t){if(e.isLeaf)return null;let o=t+e.nodeSize,r=null;for(let i=0,s;i<n.length;i++)(s=n[i])&&s.from>t&&s.to<o&&((r||(r=[])).push(s),n[i]=null);return r}function dp(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Ri(n,e,t,o){let r=[],i=!1;e.forEach((l,c)=>{let d=cp(n,l,c+t);if(d){i=!0;let u=Ri(d,l,t+c+1,o);u!=gt&&r.push(c,c+l.nodeSize,u)}});let s=lp(i?dp(n):n,-t).sort(ko);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(o.onRemove&&o.onRemove(s[l].spec),s.splice(l--,1));return s.length||r.length?new ct(s,r):gt}function ko(n,e){return n.from-e.from||n.to-e.to}function cl(n){let e=n;for(let t=0;t<e.length-1;t++){let o=e[t];if(o.from!=o.to)for(let r=t+1;r<e.length;r++){let i=e[r];if(i.from==o.from){i.to!=o.to&&(e==n&&(e=n.slice()),e[r]=i.copy(i.from,o.to),up(e,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(e==n&&(e=n.slice()),e[t]=o.copy(o.from,i.from),up(e,r,o.copy(i.from,o.to)));break}}}return e}function up(n,e,t){for(;e<n.length&&ko(t,n[e])>0;)e++;n.splice(e,0,t)}function dl(n){let e=[];return n.someProp("decorations",t=>{let o=t(n.state);o&&o!=gt&&e.push(o)}),n.cursorWrapper&&e.push(ct.create(n.state.doc,[n.cursorWrapper.deco])),Qn.from(e)}const hx={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},mx=At&&qn<=11;class gx{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class yx{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new gx,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let r=0;r<o.length;r++)this.queue.push(o[r]);At&&qn<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():ft&&e.composing&&o.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),mx&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,hx)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Vf(this.view)){if(this.suppressingSelectionUpdates)return Sn(this.view);if(At&&qn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ho(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,o;for(let i=e.focusNode;i;i=Po(i))t.add(i);for(let i=e.anchorNode;i;i=Po(i))if(t.has(i)){o=i;break}let r=o&&this.view.docView.nearestDesc(o);if(r&&r.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let o=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&Vf(e)&&!this.ignoreSelectionChange(o),i=-1,s=-1,l=!1,c=[];if(e.editable)for(let u=0;u<t.length;u++){let f=this.registerMutation(t[u],c);f&&(i=i<0?f.from:Math.min(f.from,i),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(l=!0))}if($t&&c.length){let u=c.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,p]=u;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of u){let h=p.parentNode;h&&h.nodeName=="LI"&&(!f||kx(e,f)!=h)&&p.remove()}}}else if((lt||ft)&&c.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of c)if(u.nodeName=="BR"&&u.parentNode){let f=u.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&u.parentNode.removeChild(u)}}let d=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&zi(o)&&(d=Xa(e))&&d.eq(Re.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Sn(e),this.currentSelection.set(o),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,s),bx(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Ex(e,c)),this.handleDOMChange(i,s,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||Sn(e),this.currentSelection.set(o))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let f=e.addedNodes[u];t.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let r=e.previousSibling,i=e.nextSibling;if(At&&qn<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:p}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(r=f),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(i=p)}let s=r&&r.parentNode==e.target?ut(r)+1:0,l=o.localPosFromDOM(e.target,s,-1),c=i&&i.parentNode==e.target?ut(i):e.target.childNodes.length,d=o.localPosFromDOM(e.target,c,1);return{from:l,to:d}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let fp=new WeakMap,pp=!1;function bx(n){if(!fp.has(n)&&(fp.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=$t,pp)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),pp=!0}}function hp(n,e){let t=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return ho(s.node,s.offset,r,i)&&([t,o,r,i]=[r,i,t,o]),{anchorNode:t,anchorOffset:o,focusNode:r,focusOffset:i}}function xx(n,e){if(e.getComposedRanges){let r=e.getComposedRanges(n.root)[0];if(r)return hp(n,r)}let t;function o(r){r.preventDefault(),r.stopImmediatePropagation(),t=r.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",o,!0),t?hp(n,t):null}function kx(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let o=n.docView.nearestDesc(t,!0);if(o&&o.node.isBlock)return t}return null}function Ex(n,e){var t;let{focusNode:o,focusOffset:r}=n.domSelectionRange();for(let i of e)if(((t=i.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let c=l.firstChild;if(!c||c.nodeType!=1||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;l=c}l.insertBefore(i,l.firstChild),o==i&&n.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function wx(n,e,t){let{node:o,fromOffset:r,toOffset:i,from:s,to:l}=n.docView.parseRange(e,t),c=n.domSelectionRange(),d,u=c.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],zi(c)||d.push({node:c.focusNode,offset:c.focusOffset})),lt&&n.input.lastKeyCode===8)for(let g=i;g>r;g--){let x=o.childNodes[g-1],M=x.pmViewDesc;if(x.nodeName=="BR"&&!M){i=g;break}if(!M||M.size)break}let f=n.state.doc,p=n.someProp("domParser")||dr.fromSchema(n.state.schema),h=f.resolve(s),m=null,y=p.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:r,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:Sx,context:h});if(d&&d[0].pos!=null){let g=d[0].pos,x=d[1]&&d[1].pos;x==null&&(x=g),m={anchor:g+s,head:x+s}}return{doc:y,sel:m,from:s,to:l}}function Sx(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(ft&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||ft&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Cx=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Nx(n,e,t,o,r){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let b=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,k=Xa(n,b);if(k&&!n.state.selection.eq(k)){if(lt&&En&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",O=>O(n,mo(13,"Enter"))))return;let w=n.state.tr.setSelection(k);b=="pointer"?w.setMeta("pointer",!0):b=="key"&&w.scrollIntoView(),i&&w.setMeta("composition",i),n.dispatch(w)}return}let s=n.state.doc.resolve(e),l=s.sharedDepth(t);e=s.before(l+1),t=n.state.doc.resolve(t).after(l+1);let c=n.state.selection,d=wx(n,e,t),u=n.state.doc,f=u.slice(d.from,d.to),p,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(p=n.state.selection.to,h="end"):(p=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let m=zx(f.content,d.doc.content,d.from,p,h);if(m&&n.input.domChangeCount++,(Lo&&n.input.lastIOSEnter>Date.now()-225||En)&&r.some(b=>b.nodeType==1&&!Cx.test(b.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",b=>b(n,mo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof _e&&!c.empty&&c.$head.sameParent(c.$anchor)&&!n.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let b=mp(n,n.state.doc,d.sel);if(b&&!b.eq(n.state.selection)){let k=n.state.tr.setSelection(b);i&&k.setMeta("composition",i),n.dispatch(k)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof _e&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=d.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),At&&qn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let y=d.doc.resolveNoCache(m.start-d.from),g=d.doc.resolveNoCache(m.endB-d.from),x=u.resolve(m.start),M=y.sameParent(g)&&y.parent.inlineContent&&x.end()>=m.endA;if((Lo&&n.input.lastIOSEnter>Date.now()-225&&(!M||r.some(b=>b.nodeName=="DIV"||b.nodeName=="P"))||!M&&y.pos<d.doc.content.size&&(!y.sameParent(g)||!y.parent.inlineContent)&&y.pos<g.pos&&!/\S/.test(d.doc.textBetween(y.pos,g.pos,"","")))&&n.someProp("handleKeyDown",b=>b(n,mo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&vx(u,m.start,m.endA,y,g)&&n.someProp("handleKeyDown",b=>b(n,mo(8,"Backspace")))){En&&lt&&n.domObserver.suppressSelectionUpdates();return}lt&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),En&&!M&&y.start()!=g.start()&&g.parentOffset==0&&y.depth==g.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,g=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{n.someProp("handleKeyDown",function(b){return b(n,mo(13,"Enter"))})},20));let E=m.start,v=m.endA,_=b=>{let k=b||n.state.tr.replace(E,v,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let w=mp(n,k.doc,d.sel);w&&!(lt&&n.composing&&w.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(w.head==E||w.head==k.mapping.map(v)-1)||At&&w.empty&&w.head==E)&&k.setSelection(w)}return i&&k.setMeta("composition",i),k.scrollIntoView()},A;if(M)if(y.pos==g.pos){At&&qn<=11&&y.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Sn(n),20));let b=_(n.state.tr.delete(E,v)),k=u.resolve(m.start).marksAcross(u.resolve(m.endA));k&&b.ensureMarks(k),n.dispatch(b)}else if(m.endA==m.endB&&(A=Tx(y.parent.content.cut(y.parentOffset,g.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start())))){let b=_(n.state.tr);A.type=="add"?b.addMark(E,v,A.mark):b.removeMark(E,v,A.mark),n.dispatch(b)}else if(y.parent.child(y.index()).isText&&y.index()==g.index()-(g.textOffset?0:1)){let b=y.parent.textBetween(y.parentOffset,g.parentOffset),k=()=>_(n.state.tr.insertText(b,E,v));n.someProp("handleTextInput",w=>w(n,E,v,b,k))||n.dispatch(k())}else n.dispatch(_());else n.dispatch(_())}function mp(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Qa(n,e.resolve(t.anchor),e.resolve(t.head))}function Tx(n,e){let t=n.firstChild.marks,o=e.firstChild.marks,r=t,i=o,s,l,c;for(let u=0;u<o.length;u++)r=o[u].removeFromSet(r);for(let u=0;u<t.length;u++)i=t[u].removeFromSet(i);if(r.length==1&&i.length==0)l=r[0],s="add",c=u=>u.mark(l.addToSet(u.marks));else if(r.length==0&&i.length==1)l=i[0],s="remove",c=u=>u.mark(l.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(oe.from(d).eq(n))return{mark:l,type:s}}function vx(n,e,t,o,r){if(t-e<=r.pos-o.pos||ul(o,!0,!1)<r.pos)return!1;let i=n.resolve(e);if(!o.parent.isTextblock){let l=i.nodeAfter;return l!=null&&t==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=n.resolve(ul(i,!0,!0));return!s.parent.isTextblock||s.pos>t||ul(s,!0,!1)<t?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function ul(n,e,t){let o=n.depth,r=e?n.end():n.pos;for(;o>0&&(e||n.indexAfter(o)==n.node(o).childCount);)o--,r++,e=!1;if(t){let i=n.node(o).maybeChild(n.indexAfter(o));for(;i&&!i.isLeaf;)i=i.firstChild,r++}return r}function zx(n,e,t,o,r){let i=n.findDiffStart(e,t);if(i==null)return null;let{a:s,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(r=="end"){let c=Math.max(0,i-Math.min(s,l));o-=s+c-i}if(s<i&&n.size<e.size){let c=o<=i&&o>=s?i-o:0;i-=c,i&&i<e.size&&gp(e.textBetween(i-1,i+1))&&(i+=c?1:-1),l=i+(l-s),s=i}else if(l<i){let c=o<=i&&o>=l?i-o:0;i-=c,i&&i<n.size&&gp(n.textBetween(i-1,i+1))&&(i+=c?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function gp(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class yp{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new U0,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(wp),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=kp(this),xp(this),this.nodeViews=Ep(this),this.docView=vf(this.state.doc,bp(this),dl(this),this.dom,this),this.domObserver=new yx(this,(o,r,i,s)=>Nx(this,o,r,i,s)),this.domObserver.start(),W0(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&rl(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(wp),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let o in this._props)t[o]=this._props[o];t.state=this.state;for(let o in e)t[o]=e[o];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var o;let r=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(rp(this),s=!0),this.state=e;let l=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Ep(this);Ax(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&rl(this),this.editable=kp(this),xp(this);let c=dl(this),d=bp(this),u=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,d,c);(f||!e.selection.eq(r.selection))&&(s=!0);let p=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&i0(this);if(s){this.domObserver.stop();let h=f&&(At||lt)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&Mx(r.selection,e.selection);if(f){let m=lt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ix(this)),(i||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=vf(e.doc,d,c,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&M0(this))?Sn(this,h):(Lf(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((o=this.dragging)===null||o===void 0)&&o.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():p&&s0(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof Ce){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&hf(this,t.getBoundingClientRect(),e)}else hf(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let o=this.directPlugins[t];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let o=this.state.plugins[t];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let o=this.pluginViews[t];o.update&&o.update(this,e)}}updateDraggedNode(e,t){let o=e.node,r=-1;if(this.state.doc.nodeAt(o.from)==o.node)r=o.from;else{let i=o.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==o.node&&(r=i)}this.dragging=new sp(e.slice,e.move,r<0?void 0:Ce.create(this.state.doc,r))}someProp(e,t){let o=this._props&&this._props[e],r;if(o!=null&&(r=t?t(o):o))return r;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(r=t?t(l):l))return r}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(r=t?t(l):l))return r}}hasFocus(){if(At){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&a0(this.dom),Sn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return f0(this,e)}coordsAtPos(e,t=1){return kf(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,o=-1){let r=this.docView.posFromDOM(e,t,o);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return y0(this,t||this.state,e)}pasteHTML(e,t){return Cr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Cr(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return tl(this,e)}destroy(){this.docView&&(q0(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],dl(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,J1())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return K0(this,e)}domSelectionRange(){let e=this.domSelection();return e?ft&&this.root.nodeType===11&&e0(this.dom.ownerDocument)==this.dom&&xx(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}yp.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function bp(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let o in t)o=="class"?e.class+=" "+t[o]:o=="style"?e.style=(e.style?e.style+";":"")+t[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(t[o]))}),e.translate||(e.translate="no"),[tn.node(0,n.state.doc.content.size,e)]}function xp(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:tn.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function kp(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Mx(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Ep(n){let e=Object.create(null);function t(o){for(let r in o)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=o[r])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Ax(n,e){let t=0,o=0;for(let r in n){if(n[r]!=e[r])return!0;t++}for(let r in e)o++;return t!=o}function wp(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Zn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Pi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ix=typeof navigator<"u"&&/Mac/.test(navigator.platform),_x=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),pt=0;pt<10;pt++)Zn[48+pt]=Zn[96+pt]=String(pt);for(var pt=1;pt<=24;pt++)Zn[pt+111]="F"+pt;for(var pt=65;pt<=90;pt++)Zn[pt]=String.fromCharCode(pt+32),Pi[pt]=String.fromCharCode(pt);for(var fl in Zn)Pi.hasOwnProperty(fl)||(Pi[fl]=Zn[fl]);function Ox(n){var e=Ix&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||_x&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Pi:Zn)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Dx=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Rx=typeof navigator<"u"&&/Win/.test(navigator.platform);function Px(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let o,r,i,s;for(let l=0;l<e.length-1;l++){let c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))Dx?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+c)}return o&&(t="Alt-"+t),r&&(t="Ctrl-"+t),s&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function Lx(n){let e=Object.create(null);for(let t in n)e[Px(t)]=n[t];return e}function pl(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function $x(n){return new Mt({props:{handleKeyDown:Vx(n)}})}function Vx(n){let e=Lx(n);return function(t,o){let r=Ox(o),i,s=e[pl(r,o)];if(s&&s(t.state,t.dispatch,t))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[pl(r,o,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(Rx&&o.ctrlKey&&o.altKey)&&(i=Zn[o.keyCode])&&i!=r){let l=e[pl(i,o)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var Bx=Object.defineProperty,hl=(n,e)=>{for(var t in e)Bx(n,t,{get:e[t],enumerable:!0})};function Li(n){const{state:e,transaction:t}=n;let{selection:o}=t,{doc:r}=t,{storedMarks:i}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return o},get doc(){return r},get tr(){return o=t.selection,r=t.doc,i=t.storedMarks,t}}}var $i=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:o}=e,{tr:r}=t,i=this.buildProps(r);return Object.fromEntries(Object.entries(n).map(([s,l])=>[s,(...d)=>{const u=l(...d)(i);return!r.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(r),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:o,state:r}=this,{view:i}=o,s=[],l=!!n,c=n||r.tr,d=()=>(!l&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(c),s.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(t).map(([f,p])=>[f,(...m)=>{const y=this.buildProps(c,e),g=p(...m)(y);return s.push(g),u}])),run:d};return u}createCan(n){const{rawCommands:e,state:t}=this,o=!1,r=n||t.tr,i=this.buildProps(r,o);return{...Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...d)=>c(...d)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,o)}}buildProps(n,e=!0){const{rawCommands:t,editor:o,state:r}=this,{view:i}=o,s={tr:n,editor:o,view:i,state:Li({state:r,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([l,c])=>[l,(...d)=>c(...d)(s)]))}};return s}},Sp={};hl(Sp,{blur:()=>Fx,clearContent:()=>jx,clearNodes:()=>Hx,command:()=>Ux,createParagraphNear:()=>Wx,cut:()=>qx,deleteCurrentNode:()=>Gx,deleteNode:()=>Kx,deleteRange:()=>Jx,deleteSelection:()=>Xx,enter:()=>Yx,exitCode:()=>Qx,extendMarkRange:()=>Zx,first:()=>ek,focus:()=>nk,forEach:()=>ok,insertContent:()=>rk,insertContentAt:()=>ak,joinBackward:()=>dk,joinDown:()=>ck,joinForward:()=>uk,joinItemBackward:()=>fk,joinItemForward:()=>pk,joinTextblockBackward:()=>hk,joinTextblockForward:()=>mk,joinUp:()=>lk,keyboardShortcut:()=>yk,lift:()=>bk,liftEmptyBlock:()=>xk,liftListItem:()=>kk,newlineInCode:()=>Ek,resetAttributes:()=>wk,scrollIntoView:()=>Sk,selectAll:()=>Ck,selectNodeBackward:()=>Nk,selectNodeForward:()=>Tk,selectParentNode:()=>vk,selectTextblockEnd:()=>zk,selectTextblockStart:()=>Mk,setContent:()=>Ak,setMark:()=>Xk,setMeta:()=>Yk,setNode:()=>Qk,setNodeSelection:()=>Zk,setTextDirection:()=>eE,setTextSelection:()=>tE,sinkListItem:()=>nE,splitBlock:()=>oE,splitListItem:()=>rE,toggleList:()=>iE,toggleMark:()=>sE,toggleNode:()=>aE,toggleWrap:()=>lE,undoInputRule:()=>cE,unsetAllMarks:()=>dE,unsetMark:()=>uE,unsetTextDirection:()=>fE,updateAttributes:()=>pE,wrapIn:()=>hE,wrapInList:()=>mE});var Fx=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),jx=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),Hx=()=>({state:n,tr:e,dispatch:t})=>{const{selection:o}=e,{ranges:r}=o;return t&&r.forEach(({$from:i,$to:s})=>{n.doc.nodesBetween(i.pos,s.pos,(l,c)=>{if(l.type.isText)return;const{doc:d,mapping:u}=e,f=d.resolve(u.map(c)),p=d.resolve(u.map(c+l.nodeSize)),h=f.blockRange(p);if(!h)return;const m=Ao(h);if(l.type.isTextblock){const{defaultType:y}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,y)}(m||m===0)&&e.lift(h,m)})}),!0},Ux=n=>e=>n(e),Wx=()=>({state:n,dispatch:e})=>of(n,e),qx=(n,e)=>({editor:t,tr:o})=>{const{state:r}=t,i=r.doc.slice(n.from,n.to);o.deleteRange(n.from,n.to);const s=o.mapping.map(e);return o.insert(s,i.content),o.setSelection(new _e(o.doc.resolve(Math.max(s-1,0)))),!0},Gx=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,o=t.$anchor.node();if(o.content.size>0)return!1;const r=n.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const l=r.before(i),c=r.after(i);n.delete(l,c).scrollIntoView()}return!0}return!1};function tt(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var Kx=n=>({tr:e,state:t,dispatch:o})=>{const r=tt(n,t.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r){if(o){const c=i.before(s),d=i.after(s);e.delete(c,d).scrollIntoView()}return!0}return!1},Jx=n=>({tr:e,dispatch:t})=>{const{from:o,to:r}=n;return t&&e.delete(o,r),!0},Xx=()=>({state:n,dispatch:e})=>La(n,e),Yx=()=>({commands:n})=>n.keyboardShortcut("Enter"),Qx=()=>({state:n,dispatch:e})=>D1(n,e);function ml(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Vi(n,e,t={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>t.strict?e[r]===n[r]:ml(e[r])?e[r].test(n[r]):e[r]===n[r]):!0}function Cp(n,e,t={}){return n.find(o=>o.type===e&&Vi(Object.fromEntries(Object.keys(t).map(r=>[r,o.attrs[r]])),t))}function Np(n,e,t={}){return!!Cp(n,e,t)}function gl(n,e,t){var o;if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===e))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===e)||(t=t||((o=r.node.marks[0])==null?void 0:o.attrs),!Cp([...r.node.marks],e,t)))return;let s=r.index,l=n.start()+r.offset,c=s+1,d=l+r.node.nodeSize;for(;s>0&&Np([...n.parent.child(s-1).marks],e,t);)s-=1,l-=n.parent.child(s).nodeSize;for(;c<n.parent.childCount&&Np([...n.parent.child(c).marks],e,t);)d+=n.parent.child(c).nodeSize,c+=1;return{from:l,to:d}}function Cn(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var Zx=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const i=Cn(n,o.schema),{doc:s,selection:l}=t,{$from:c,from:d,to:u}=l;if(r){const f=gl(c,i,e);if(f&&f.from<=d&&f.to>=u){const p=_e.create(s,f.from,f.to);t.setSelection(p)}}return!0},ek=n=>e=>{const t=typeof n=="function"?n(e):n;for(let o=0;o<t.length;o+=1)if(t[o](e))return!0;return!1};function Tp(n){return n instanceof _e}function Eo(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function vp(n,e=null){if(!e)return null;const t=Re.atStart(n),o=Re.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return o;const r=t.from,i=o.to;return e==="all"?_e.create(n,Eo(0,r,i),Eo(n.content.size,r,i)):_e.create(n,Eo(e,r,i),Eo(e,r,i))}function zp(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Bi(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function tk(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var nk=(n=null,e={})=>({editor:t,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(Bi()||zp())&&o.dom.focus(),tk()&&!Bi()&&!zp()&&o.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(o.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(o.hasFocus()&&n===null||n===!1)return!0;if(i&&n===null&&!Tp(t.state.selection))return s(),!0;const l=vp(r.doc,n)||t.state.selection,c=t.state.selection.eq(l);return i&&(c||r.setSelection(l),c&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},ok=(n,e)=>t=>n.every((o,r)=>e(o,{...t,index:r})),rk=(n,e)=>({tr:t,commands:o})=>o.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Mp=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const o=e[t];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?n.removeChild(o):o.nodeType===1&&Mp(o)}return n};function Fi(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Mp(t)}function Tr(n,e,t){if(n instanceof Fn||n instanceof oe)return n;t={slice:!0,parseOptions:{},...t};const o=typeof n=="object"&&n!==null,r=typeof n=="string";if(o)try{if(Array.isArray(n)&&n.length>0)return oe.fromArray(n.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(n);return t.errorOnInvalidContent&&s.check(),s}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),Tr("",e,t)}if(r){if(t.errorOnInvalidContent){let s=!1,l="";const c=new gu({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(s=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(t.slice?dr.fromSchema(c).parseSlice(Fi(n),t.parseOptions):dr.fromSchema(c).parse(Fi(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=dr.fromSchema(e);return t.slice?i.parseSlice(Fi(n),t.parseOptions).content:i.parse(Fi(n),t.parseOptions)}return Tr("",e,t)}function ik(n,e,t){const o=n.steps.length-1;if(o<e)return;const r=n.steps[o];if(!(r instanceof st||r instanceof at))return;const i=n.mapping.maps[o];let s=0;i.forEach((l,c,d,u)=>{s===0&&(s=u)}),n.setSelection(Re.near(n.doc.resolve(s),t))}var sk=n=>!("type"in n),ak=(n,e,t)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const c=g=>{i.emit("contentError",{editor:i,error:g,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Tr(e,i.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(g){c(g)}try{l=Tr(e,i.schema,{parseOptions:d,errorOnInvalidContent:(s=t.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(g){return c(g),!1}let{from:u,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,h=!0;if((sk(l)?l:[l]).forEach(g=>{g.check(),p=p?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),u===f&&h){const{parent:g}=o.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,f+=1)}let y;if(p){if(Array.isArray(e))y=e.map(g=>g.text||"").join("");else if(e instanceof oe){let g="";e.forEach(x=>{x.text&&(g+=x.text)}),y=g}else typeof e=="object"&&e&&e.text?y=e.text:y=e;o.insertText(y,u,f)}else{y=l;const g=o.doc.resolve(u),x=g.node(),M=g.parentOffset===0,E=x.isText||x.isTextblock,v=x.content.size>0;M&&E&&v&&(u=Math.max(0,u-1)),o.replaceWith(u,f,y)}t.updateSelection&&ik(o,o.steps.length-1,-1),t.applyInputRules&&o.setMeta("applyInputRules",{from:u,text:y}),t.applyPasteRules&&o.setMeta("applyPasteRules",{from:u,text:y})}return!0},lk=()=>({state:n,dispatch:e})=>I1(n,e),ck=()=>({state:n,dispatch:e})=>_1(n,e),dk=()=>({state:n,dispatch:e})=>Xu(n,e),uk=()=>({state:n,dispatch:e})=>ef(n,e),fk=()=>({state:n,dispatch:e,tr:t})=>{try{const o=Ci(n.doc,n.selection.$from.pos,-1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},pk=()=>({state:n,dispatch:e,tr:t})=>{try{const o=Ci(n.doc,n.selection.$from.pos,1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},hk=()=>({state:n,dispatch:e})=>M1(n,e),mk=()=>({state:n,dispatch:e})=>A1(n,e);function Ap(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function gk(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let o,r,i,s;for(let l=0;l<e.length-1;l+=1){const c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))Bi()||Ap()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return o&&(t=`Alt-${t}`),r&&(t=`Ctrl-${t}`),s&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}var yk=n=>({editor:e,view:t,tr:o,dispatch:r})=>{const i=gk(n).split(/-(?!$)/),s=i.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{t.someProp("handleKeyDown",d=>d(t,l))});return c?.steps.forEach(d=>{const u=d.map(o.mapping);u&&r&&o.maybeStep(u)}),!0};function eo(n,e,t={}){const{from:o,to:r,empty:i}=n.selection,s=e?tt(e,n.schema):null,l=[];n.doc.nodesBetween(o,r,(f,p)=>{if(f.isText)return;const h=Math.max(o,p),m=Math.min(r,p+f.nodeSize);l.push({node:f,from:h,to:m})});const c=r-o,d=l.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>Vi(f.node.attrs,t,{strict:!1}));return i?!!d.length:d.reduce((f,p)=>f+p.to-p.from,0)>=c}var bk=(n,e={})=>({state:t,dispatch:o})=>{const r=tt(n,t.schema);return eo(t,r,e)?O1(t,o):!1},xk=()=>({state:n,dispatch:e})=>rf(n,e),kk=n=>({state:e,dispatch:t})=>{const o=tt(n,e.schema);return W1(o)(e,t)},Ek=()=>({state:n,dispatch:e})=>nf(n,e);function ji(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Ip(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((o,r)=>(t.includes(r)||(o[r]=n[r]),o),{})}var wk=(n,e)=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=ji(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=tt(n,o.schema)),l==="mark"&&(s=Cn(n,o.schema));let c=!1;return t.selection.ranges.forEach(d=>{o.doc.nodesBetween(d.$from.pos,d.$to.pos,(u,f)=>{i&&i===u.type&&(c=!0,r&&t.setNodeMarkup(f,void 0,Ip(u.attrs,e))),s&&u.marks.length&&u.marks.forEach(p=>{s===p.type&&(c=!0,r&&t.addMark(f,f+u.nodeSize,s.create(Ip(p.attrs,e))))})})}),c},Sk=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Ck=()=>({tr:n,dispatch:e})=>{if(e){const t=new Rt(n.doc);n.setSelection(t)}return!0},Nk=()=>({state:n,dispatch:e})=>Qu(n,e),Tk=()=>({state:n,dispatch:e})=>tf(n,e),vk=()=>({state:n,dispatch:e})=>L1(n,e),zk=()=>({state:n,dispatch:e})=>B1(n,e),Mk=()=>({state:n,dispatch:e})=>V1(n,e);function yl(n,e,t={},o={}){return Tr(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:o.errorOnInvalidContent})}var Ak=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:o={}}={})=>({editor:r,tr:i,dispatch:s,commands:l})=>{const{doc:c}=i;if(o.preserveWhitespace!=="full"){const d=yl(n,r.schema,o,{errorOnInvalidContent:e??r.options.enableContentCheck});return s&&i.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!t),!0}return s&&i.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:c.content.size},n,{parseOptions:o,errorOnInvalidContent:e??r.options.enableContentCheck})};function _p(n,e){const t=Cn(e,n.schema),{from:o,to:r,empty:i}=n.selection,s=[];i?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(o,r,c=>{s.push(...c.marks)});const l=s.find(c=>c.type.name===t.name);return l?{...l.attrs}:{}}function Op(n,e){const t=new Bu(n);return e.forEach(o=>{o.steps.forEach(r=>{t.step(r)})}),t}function Ik(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function _k(n,e,t){const o=[];return n.nodesBetween(e.from,e.to,(r,i)=>{t(r)&&o.push({node:r,pos:i})}),o}function Ok(n,e){for(let t=n.depth;t>0;t-=1){const o=n.node(t);if(e(o))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:o}}}function Hi(n){return e=>Ok(e.$from,n)}function ke(n,e,t){return n.config[e]===void 0&&n.parent?ke(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?ke(n.parent,e,t):null}):n.config[e]}function bl(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},o=ke(e,"addExtensions",t);return o?[e,...bl(o())]:e}).flat(10)}function xl(n,e){const t=fo.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function Dp(n){return typeof n=="function"}function je(n,e=void 0,...t){return Dp(n)?e?n.bind(e)(...t):n(...t):n}function Dk(n={}){return Object.keys(n).length===0&&n.constructor===Object}function jo(n){const e=n.filter(r=>r.type==="extension"),t=n.filter(r=>r.type==="node"),o=n.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:o}}function Rp(n){const e=[],{nodeExtensions:t,markExtensions:o}=jo(n),r=[...t,...o],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:r},c=ke(s,"addGlobalAttributes",l);if(!c)return;c().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([p,h])=>{e.push({type:f,name:p,attribute:{...i,...h}})})})})}),r.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},c=ke(s,"addAttributes",l);if(!c)return;const d=c();Object.entries(d).forEach(([u,f])=>{const p={...i,...f};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:s.name,name:u,attribute:p})})}),e}function It(...n){return n.filter(e=>!!e).reduce((e,t)=>{const o={...e};return Object.entries(t).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const l=i?String(i).split(" "):[],c=o[r]?o[r].split(" "):[],d=l.filter(u=>!c.includes(u));o[r]=[...c,...d].join(" ")}else if(r==="style"){const l=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],c=o[r]?o[r].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;c.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),l.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),o[r]=Array.from(d.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else o[r]=i}),o},{})}function vr(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,o)=>It(t,o),{})}function Rk(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Pp(n,e){return"style"in n?n:{...n,getAttrs:t=>{const o=n.getAttrs?n.getAttrs(t):n.attrs;if(o===!1)return!1;const r=e.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(t):Rk(t.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...o,...r}}}}function Lp(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Dk(t)?!1:t!=null))}function $p(n){var e,t;const o={};return!((e=n?.attribute)!=null&&e.isRequired)&&"default"in(n?.attribute||{})&&(o.default=n.attribute.default),((t=n?.attribute)==null?void 0:t.validate)!==void 0&&(o.validate=n.attribute.validate),[n.name,o]}function Pk(n,e){var t;const o=Rp(n),{nodeExtensions:r,markExtensions:i}=jo(n),s=(t=r.find(d=>ke(d,"topNode")))==null?void 0:t.name,l=Object.fromEntries(r.map(d=>{const u=o.filter(x=>x.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=n.reduce((x,M)=>{const E=ke(M,"extendNodeSchema",f);return{...x,...E?E(d):{}}},{}),h=Lp({...p,content:je(ke(d,"content",f)),marks:je(ke(d,"marks",f)),group:je(ke(d,"group",f)),inline:je(ke(d,"inline",f)),atom:je(ke(d,"atom",f)),selectable:je(ke(d,"selectable",f)),draggable:je(ke(d,"draggable",f)),code:je(ke(d,"code",f)),whitespace:je(ke(d,"whitespace",f)),linebreakReplacement:je(ke(d,"linebreakReplacement",f)),defining:je(ke(d,"defining",f)),isolating:je(ke(d,"isolating",f)),attrs:Object.fromEntries(u.map($p))}),m=je(ke(d,"parseHTML",f));m&&(h.parseDOM=m.map(x=>Pp(x,u)));const y=ke(d,"renderHTML",f);y&&(h.toDOM=x=>y({node:x,HTMLAttributes:vr(x,u)}));const g=ke(d,"renderText",f);return g&&(h.toText=g),[d.name,h]})),c=Object.fromEntries(i.map(d=>{const u=o.filter(g=>g.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=n.reduce((g,x)=>{const M=ke(x,"extendMarkSchema",f);return{...g,...M?M(d):{}}},{}),h=Lp({...p,inclusive:je(ke(d,"inclusive",f)),excludes:je(ke(d,"excludes",f)),group:je(ke(d,"group",f)),spanning:je(ke(d,"spanning",f)),code:je(ke(d,"code",f)),attrs:Object.fromEntries(u.map($p))}),m=je(ke(d,"parseHTML",f));m&&(h.parseDOM=m.map(g=>Pp(g,u)));const y=ke(d,"renderHTML",f);return y&&(h.toDOM=g=>y({mark:g,HTMLAttributes:vr(g,u)})),[d.name,h]}));return new gu({topNode:s,nodes:l,marks:c})}function Lk(n){const e=n.filter((t,o)=>n.indexOf(t)!==o);return Array.from(new Set(e))}function Ui(n){return n.sort((t,o)=>{const r=ke(t,"priority")||100,i=ke(o,"priority")||100;return r>i?-1:r<i?1:0})}function Vp(n){const e=Ui(bl(n)),t=Lk(e.map(o=>o.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),e}function Bp(n,e,t){const{from:o,to:r}=e,{blockSeparator:i=`
354
+
355
+ `,textSerializers:s={}}=t||{};let l="";return n.nodesBetween(o,r,(c,d,u,f)=>{var p;c.isBlock&&d>o&&(l+=i);const h=s?.[c.type.name];if(h)return u&&(l+=h({node:c,pos:d,parent:u,index:f,range:e})),!1;c.isText&&(l+=(p=c?.text)==null?void 0:p.slice(Math.max(o,d)-d,r-d))}),l}function $k(n,e){const t={from:0,to:n.content.size};return Bp(n,t,e)}function Fp(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Vk(n,e){const t=tt(e,n.schema),{from:o,to:r}=n.selection,i=[];n.doc.nodesBetween(o,r,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===t.name);return s?{...s.attrs}:{}}function jp(n,e){const t=ji(typeof e=="string"?e:e.name,n.schema);return t==="node"?Vk(n,e):t==="mark"?_p(n,e):{}}function Bk(n,e=JSON.stringify){const t={};return n.filter(o=>{const r=e(o);return Object.prototype.hasOwnProperty.call(t,r)?!1:t[r]=!0})}function Fk(n){const e=Bk(n);return e.length===1?e:e.filter((t,o)=>!e.filter((i,s)=>s!==o).some(i=>t.oldRange.from>=i.oldRange.from&&t.oldRange.to<=i.oldRange.to&&t.newRange.from>=i.newRange.from&&t.newRange.to<=i.newRange.to))}function Hp(n){const{mapping:e,steps:t}=n,o=[];return e.maps.forEach((r,i)=>{const s=[];if(r.ranges.length)r.forEach((l,c)=>{s.push({from:l,to:c})});else{const{from:l,to:c}=t[i];if(l===void 0||c===void 0)return;s.push({from:l,to:c})}s.forEach(({from:l,to:c})=>{const d=e.slice(i).map(l,-1),u=e.slice(i).map(c),f=e.invert().map(d,-1),p=e.invert().map(u);o.push({oldRange:{from:f,to:p},newRange:{from:d,to:u}})})}),Fk(o)}function kl(n,e,t){const o=[];return n===e?t.resolve(n).marks().forEach(r=>{const i=t.resolve(n),s=gl(i,r.type);s&&o.push({mark:r,...s})}):t.nodesBetween(n,e,(r,i)=>{!r||r?.nodeSize===void 0||o.push(...r.marks.map(s=>({from:i,to:i+r.nodeSize,mark:s})))}),o}var jk=(n,e,t,o=20)=>{const r=n.doc.resolve(t);let i=o,s=null;for(;i>0&&s===null;){const l=r.node(i);l?.type.name===e?s=l:i-=1}return[s,i]};function Wi(n,e){return e.nodes[n]||e.marks[n]||null}function qi(n,e,t){return Object.fromEntries(Object.entries(t).filter(([o])=>{const r=n.find(i=>i.type===e&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}var Hk=(n,e=500)=>{let t="";const o=n.parentOffset;return n.parent.nodesBetween(Math.max(0,o-e),o,(r,i,s,l)=>{var c,d;const u=((d=(c=r.type.spec).toText)==null?void 0:d.call(c,{node:r,pos:i,parent:s,index:l}))||r.textContent||"%leaf%";t+=r.isAtom&&!r.isText?u:u.slice(0,Math.max(0,o-i))}),t};function El(n,e,t={}){const{empty:o,ranges:r}=n.selection,i=e?Cn(e,n.schema):null;if(o)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>i?i.name===f.type.name:!0).find(f=>Vi(f.attrs,t,{strict:!1}));let s=0;const l=[];if(r.forEach(({$from:f,$to:p})=>{const h=f.pos,m=p.pos;n.doc.nodesBetween(h,m,(y,g)=>{if(!y.isText&&!y.marks.length)return;const x=Math.max(h,g),M=Math.min(m,g+y.nodeSize),E=M-x;s+=E,l.push(...y.marks.map(v=>({mark:v,from:x,to:M})))})}),s===0)return!1;const c=l.filter(f=>i?i.name===f.mark.type.name:!0).filter(f=>Vi(f.mark.attrs,t,{strict:!1})).reduce((f,p)=>f+p.to-p.from,0),d=l.filter(f=>i?f.mark.type!==i&&f.mark.type.excludes(i):!0).reduce((f,p)=>f+p.to-p.from,0);return(c>0?c+d:c)>=s}function Uk(n,e,t={}){if(!e)return eo(n,null,t)||El(n,null,t);const o=ji(e,n.schema);return o==="node"?eo(n,e,t):o==="mark"?El(n,e,t):!1}var Wk=(n,e)=>{const{$from:t,$to:o,$anchor:r}=n.selection;if(e){const i=Hi(l=>l.type.name===e)(n.selection);if(!i)return!1;const s=n.doc.resolve(i.pos+1);return r.pos+1===s.end()}return!(o.parentOffset<o.parent.nodeSize-2||t.pos!==o.pos)},qk=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function Up(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function Wp(n,e){const{nodeExtensions:t}=jo(e),o=t.find(s=>s.name===n);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=je(ke(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function wl(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var o;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((o=n.text)!=null?o:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let r=!0;return n.content.forEach(i=>{r!==!1&&(wl(i,{ignoreWhitespace:t,checkChildren:e})||(r=!1))}),r}return!1}var qp=class im{constructor(e){this.position=e}static fromJSON(e){return new im(e.position)}toJSON(){return{position:this.position}}};function Gk(n,e){const t=e.mapping.mapResult(n.position);return{position:new qp(t.pos),mapResult:t}}function Kk(n){return new qp(n)}function Jk(n,e,t){var o;const{selection:r}=e;let i=null;if(Tp(r)&&(i=r.$cursor),i){const l=(o=n.storedMarks)!=null?o:i.marks();return i.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(d=>d.type.excludes(t)))}const{ranges:s}=r;return s.some(({$from:l,$to:c})=>{let d=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,c.pos,(u,f,p)=>{if(d)return!1;if(u.isInline){const h=!p||p.type.allowsMarkType(t),m=!!t.isInSet(u.marks)||!u.marks.some(y=>y.type.excludes(t));d=h&&m}return!d}),d})}var Xk=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=t,{empty:s,ranges:l}=i,c=Cn(n,o.schema);if(r)if(s){const d=_p(o,c);t.addStoredMark(c.create({...d,...e}))}else l.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;o.doc.nodesBetween(u,f,(p,h)=>{const m=Math.max(h,u),y=Math.min(h+p.nodeSize,f);p.marks.find(x=>x.type===c)?p.marks.forEach(x=>{c===x.type&&t.addMark(m,y,c.create({...x.attrs,...e}))}):t.addMark(m,y,c.create(e))})});return Jk(o,t,c)},Yk=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Qk=(n,e={})=>({state:t,dispatch:o,chain:r})=>{const i=tt(n,t.schema);let s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>lf(i,{...s,...e})(t)?!0:l.clearNodes()).command(({state:l})=>lf(i,{...s,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Zk=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,r=Eo(n,0,o.content.size),i=Ce.create(o,r);e.setSelection(i)}return!0},eE=(n,e)=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=o;let s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=i.from,l=i.to),r&&t.doc.nodesBetween(s,l,(c,d)=>{c.isText||t.setNodeMarkup(d,void 0,{...c.attrs,dir:n})}),!0},tE=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,{from:r,to:i}=typeof n=="number"?{from:n,to:n}:n,s=_e.atStart(o).from,l=_e.atEnd(o).to,c=Eo(r,s,l),d=Eo(i,s,l),u=_e.create(o,c,d);e.setSelection(u)}return!0},nE=n=>({state:e,dispatch:t})=>{const o=tt(n,e.schema);return K1(o)(e,t)};function Gp(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const o=t.filter(r=>e?.includes(r.type.name));n.tr.ensureMarks(o)}}var oE=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:l,$to:c}=i,d=r.extensionManager.attributes,u=qi(d,l.node().type.name,l.node().attrs);if(i instanceof Ce&&i.node.isBlock)return!l.parentOffset||!xn(s,l.pos)?!1:(o&&(n&&Gp(t,r.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=c.parentOffset===c.parent.content.size,p=l.depth===0?void 0:Ik(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:u}]:void 0,m=xn(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&xn(e.doc,e.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:u}]:void 0),o){if(m&&(i instanceof _e&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),p&&!f&&!l.parentOffset&&l.parent.type!==p)){const y=e.mapping.map(l.before()),g=e.doc.resolve(y);l.node(-1).canReplaceWith(g.index(),g.index()+1,p)&&e.setNodeMarkup(e.mapping.map(l.before()),p)}n&&Gp(t,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},rE=(n,e={})=>({tr:t,state:o,dispatch:r,editor:i})=>{var s;const l=tt(n,o.schema),{$from:c,$to:d}=o.selection,u=o.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const f=c.node(-1);if(f.type!==l)return!1;const p=i.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(r){let x=oe.empty;const M=c.index(-1)?1:c.index(-2)?2:3;for(let k=c.depth-M;k>=c.depth-3;k-=1)x=oe.from(c.node(k).copy(x));const E=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,v={...qi(p,c.node().type.name,c.node().attrs),...e},_=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(v))||void 0;x=x.append(oe.from(l.createAndFill(null,_)||void 0));const A=c.before(c.depth-(M-1));t.replace(A,c.after(-E),new fe(x,4-M,0));let b=-1;t.doc.nodesBetween(A,t.doc.content.size,(k,w)=>{if(b>-1)return!1;k.isTextblock&&k.content.size===0&&(b=w+1)}),b>-1&&t.setSelection(_e.near(t.doc.resolve(b))),t.scrollIntoView()}return!0}const h=d.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...qi(p,f.type.name,f.attrs),...e},y={...qi(p,c.node().type.name,c.node().attrs),...e};t.delete(c.pos,d.pos);const g=h?[{type:l,attrs:m},{type:h,attrs:y}]:[{type:l,attrs:m}];if(!xn(t.doc,c.pos,2))return!1;if(r){const{selection:x,storedMarks:M}=o,{splittableMarks:E}=i.extensionManager,v=M||x.$to.parentOffset&&x.$from.marks();if(t.split(c.pos,2,g).scrollIntoView(),!v||!r)return!0;const _=v.filter(A=>E.includes(A.type.name));t.ensureMarks(_)}return!0},Sl=(n,e)=>{const t=Hi(s=>s.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return t.node.type===r?.type&&Un(n.doc,t.pos)&&n.join(t.pos),!0},Cl=(n,e)=>{const t=Hi(s=>s.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(t.start).after(t.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return t.node.type===r?.type&&Un(n.doc,o)&&n.join(o),!0},iE=(n,e,t,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:c,commands:d,can:u})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,h=tt(n,s.schema),m=tt(e,s.schema),{selection:y,storedMarks:g}=s,{$from:x,$to:M}=y,E=x.blockRange(M),v=g||y.$to.parentOffset&&y.$from.marks();if(!E)return!1;const _=Hi(A=>Wp(A.type.name,f))(y);if(E.depth>=1&&_&&E.depth-_.depth<=1){if(_.node.type===h)return d.liftListItem(m);if(Wp(_.node.type.name,f)&&h.validContent(_.node.content)&&l)return c().command(()=>(i.setNodeMarkup(_.pos,h),!0)).command(()=>Sl(i,h)).command(()=>Cl(i,h)).run()}return!t||!v||!l?c().command(()=>u().wrapInList(h,o)?!0:d.clearNodes()).wrapInList(h,o).command(()=>Sl(i,h)).command(()=>Cl(i,h)).run():c().command(()=>{const A=u().wrapInList(h,o),b=v.filter(k=>p.includes(k.type.name));return i.ensureMarks(b),A?!0:d.clearNodes()}).wrapInList(h,o).command(()=>Sl(i,h)).command(()=>Cl(i,h)).run()},sE=(n,e={},t={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=t,s=Cn(n,o.schema);return El(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},aE=(n,e,t={})=>({state:o,commands:r})=>{const i=tt(n,o.schema),s=tt(e,o.schema),l=eo(o,i,t);let c;return o.selection.$anchor.sameParent(o.selection.$head)&&(c=o.selection.$anchor.parent.attrs),l?r.setNode(s,c):r.setNode(i,{...c,...t})},lE=(n,e={})=>({state:t,commands:o})=>{const r=tt(n,t.schema);return eo(t,r,e)?o.lift(r):o.wrapIn(r,e)},cE=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let o=0;o<t.length;o+=1){const r=t[o];let i;if(r.spec.isInputRules&&(i=r.getState(n))){if(e){const s=n.tr,l=i.transform;for(let c=l.steps.length-1;c>=0;c-=1)s.step(l.steps[c].invert(l.docs[c]));if(i.text){const c=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,n.schema.text(i.text,c))}else s.delete(i.from,i.to)}return!0}}return!1},dE=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:o,ranges:r}=t;return o||e&&r.forEach(i=>{n.removeMark(i.$from.pos,i.$to.pos)}),!0},uE=(n,e={})=>({tr:t,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,c=Cn(n,o.schema),{$from:d,empty:u,ranges:f}=l;if(!r)return!0;if(u&&s){let{from:p,to:h}=l;const m=(i=d.marks().find(g=>g.type===c))==null?void 0:i.attrs,y=gl(d,c,m);y&&(p=y.from,h=y.to),t.removeMark(p,h,c)}else f.forEach(p=>{t.removeMark(p.$from.pos,p.$to.pos,c)});return t.removeStoredMark(c),!0},fE=n=>({tr:e,state:t,dispatch:o})=>{const{selection:r}=t;let i,s;return typeof n=="number"?(i=n,s=n):n&&"from"in n&&"to"in n?(i=n.from,s=n.to):(i=r.from,s=r.to),o&&e.doc.nodesBetween(i,s,(l,c)=>{if(l.isText)return;const d={...l.attrs};delete d.dir,e.setNodeMarkup(c,void 0,d)}),!0},pE=(n,e={})=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=ji(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=tt(n,o.schema)),l==="mark"&&(s=Cn(n,o.schema));let c=!1;return t.selection.ranges.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;let p,h,m,y;t.selection.empty?o.doc.nodesBetween(u,f,(g,x)=>{i&&i===g.type&&(c=!0,m=Math.max(x,u),y=Math.min(x+g.nodeSize,f),p=x,h=g)}):o.doc.nodesBetween(u,f,(g,x)=>{x<u&&i&&i===g.type&&(c=!0,m=Math.max(x,u),y=Math.min(x+g.nodeSize,f),p=x,h=g),x>=u&&x<=f&&(i&&i===g.type&&(c=!0,r&&t.setNodeMarkup(x,void 0,{...g.attrs,...e})),s&&g.marks.length&&g.marks.forEach(M=>{if(s===M.type&&(c=!0,r)){const E=Math.max(x,u),v=Math.min(x+g.nodeSize,f);t.addMark(E,v,s.create({...M.attrs,...e}))}}))}),h&&(p!==void 0&&r&&t.setNodeMarkup(p,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(g=>{s===g.type&&r&&t.addMark(m,y,s.create({...g.attrs,...e}))}))}),c},hE=(n,e={})=>({state:t,dispatch:o})=>{const r=tt(n,t.schema);return F1(r,e)(t,o)},mE=(n,e={})=>({state:t,dispatch:o})=>{const r=tt(n,t.schema);return j1(r,e)(t,o)},gE=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(o=>o.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(o=>o!==e):delete this.callbacks[n]),this}once(n,e){const t=(...o)=>{this.off(n,t),e.apply(this,o)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},Kp=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},yE=(n,e)=>{if(ml(e))return e.exec(n);const t=e(n);if(!t)return null;const o=[t.text];return o.index=t.index,o.input=n,o.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(t.replaceWith)),o};function Gi(n){var e;const{editor:t,from:o,to:r,text:i,rules:s,plugin:l}=n,{view:c}=t;if(c.composing)return!1;const d=c.state.doc.resolve(o);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let u=!1;const f=Hk(d)+i;return s.forEach(p=>{if(u)return;const h=yE(f,p.find);if(!h)return;const m=c.state.tr,y=Li({state:c.state,transaction:m}),g={from:o-(h[0].length-i.length),to:r},{commands:x,chain:M,can:E}=new $i({editor:t,state:y});p.handler({state:y,range:g,match:h,commands:x,chain:M,can:E})===null||!m.steps.length||(p.undoable&&m.setMeta(l,{transform:m,from:o,to:r,text:i}),c.dispatch(m),u=!0)}),u}function bE(n){const{editor:e,rules:t}=n,o=new Mt({state:{init(){return null},apply(r,i,s){const l=r.getMeta(o);if(l)return l;const c=r.getMeta("applyInputRules");return c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=xl(oe.from(u),s.schema);const{from:f}=c,p=f+u.length;Gi({editor:e,from:f,to:p,text:u,rules:t,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,s,l){return Gi({editor:e,from:i,to:s,text:l,rules:t,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&Gi({editor:e,from:i.pos,to:i.pos,text:"",rules:t,plugin:o})}),!1)},handleKeyDown(r,i){if(i.key!=="Enter")return!1;const{$cursor:s}=r.state.selection;return s?Gi({editor:e,from:s.pos,to:s.pos,text:`
356
+ `,rules:t,plugin:o}):!1}},isInputRules:!0});return o}function xE(n){return Object.prototype.toString.call(n).slice(8,-1)}function Ki(n){return xE(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Jp(n,e){const t={...n};return Ki(n)&&Ki(e)&&Object.keys(e).forEach(o=>{Ki(e[o])&&Ki(n[o])?t[o]=Jp(n[o],e[o]):t[o]=e[o]}),t}var Nl=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...je(ke(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...je(ke(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>Jp(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},zr=class sm extends Nl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new sm(t)}static handleExit({editor:e,mark:t}){const{tr:o}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const s=r.marks();if(!!!s.find(d=>d?.type.name===t.name))return!1;const c=s.find(d=>d?.type.name===t.name);return c&&o.removeStoredMark(c),o.insertText(" ",r.pos),e.view.dispatch(o),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function kE(n){return typeof n=="number"}var EE=class{constructor(n){this.find=n.find,this.handler=n.handler}},wE=(n,e,t)=>{if(ml(e))return[...n.matchAll(e)];const o=e(n,t);return o?o.map(r=>{const i=[r.text];return i.index=r.index,i.input=n,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function SE(n){const{editor:e,state:t,from:o,to:r,rule:i,pasteEvent:s,dropEvent:l}=n,{commands:c,chain:d,can:u}=new $i({editor:e,state:t}),f=[];return t.doc.nodesBetween(o,r,(h,m)=>{var y,g,x,M,E;if((g=(y=h.type)==null?void 0:y.spec)!=null&&g.code||!(h.isText||h.isTextblock||h.isInline))return;const v=(E=(M=(x=h.content)==null?void 0:x.size)!=null?M:h.nodeSize)!=null?E:0,_=Math.max(o,m),A=Math.min(r,m+v);if(_>=A)return;const b=h.isText?h.text||"":h.textBetween(_-m,A-m,void 0,"");wE(b,i.find,s).forEach(w=>{if(w.index===void 0)return;const O=_+w.index+1,q=O+w[0].length,T={from:t.tr.mapping.map(O),to:t.tr.mapping.map(q)},R=i.handler({state:t,range:T,match:w,commands:c,chain:d,can:u,pasteEvent:s,dropEvent:l});f.push(R)})}),f.every(h=>h!==null)}var Ji=null,CE=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function NE(n){const{editor:e,rules:t}=n;let o=null,r=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const c=({state:u,from:f,to:p,rule:h,pasteEvt:m})=>{const y=u.tr,g=Li({state:u,transaction:y});if(!(!SE({editor:e,state:g,from:Math.max(f-1,0),to:p.b-1,rule:h,pasteEvent:m,dropEvent:l})||!y.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,y}};return t.map(u=>new Mt({view(f){const p=m=>{var y;o=(y=f.dom.parentElement)!=null&&y.contains(m.target)?f.dom.parentElement:null,o&&(Ji=e)},h=()=>{Ji&&(Ji=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,p)=>{if(i=o===f.dom.parentElement,l=p,!i){const h=Ji;h?.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,p)=>{var h;const m=(h=p.clipboardData)==null?void 0:h.getData("text/html");return s=p,r=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,p,h)=>{const m=f[0],y=m.getMeta("uiEvent")==="paste"&&!r,g=m.getMeta("uiEvent")==="drop"&&!i,x=m.getMeta("applyPasteRules"),M=!!x;if(!y&&!g&&!M)return;if(M){let{text:_}=x;typeof _=="string"?_=_:_=xl(oe.from(_),h.schema);const{from:A}=x,b=A+_.length,k=CE(_);return c({rule:u,state:h,from:A,to:{b},pasteEvt:k})}const E=p.doc.content.findDiffStart(h.doc.content),v=p.doc.content.findDiffEnd(h.doc.content);if(!(!kE(E)||!v||E===v.b))return c({rule:u,state:h,from:E,to:v,pasteEvt:s})}}))}var Xi=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=Vp(n),this.schema=Pk(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Wi(e.name,this.schema)},o=ke(e,"addCommands",t);return o?{...n,...o()}:n},{})}get plugins(){const{editor:n}=this;return Ui([...this.extensions].reverse()).flatMap(o=>{const r={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:n,type:Wi(o.name,this.schema)},i=[],s=ke(o,"addKeyboardShortcuts",r);let l={};if(o.type==="mark"&&ke(o,"exitable",r)&&(l.ArrowRight=()=>zr.handleExit({editor:n,mark:o})),s){const p=Object.fromEntries(Object.entries(s()).map(([h,m])=>[h,()=>m({editor:n})]));l={...l,...p}}const c=$x(l);i.push(c);const d=ke(o,"addInputRules",r);if(Up(o,n.options.enableInputRules)&&d){const p=d();if(p&&p.length){const h=bE({editor:n,rules:p}),m=Array.isArray(h)?h:[h];i.push(...m)}}const u=ke(o,"addPasteRules",r);if(Up(o,n.options.enablePasteRules)&&u){const p=u();if(p&&p.length){const h=NE({editor:n,rules:p});i.push(...h)}}const f=ke(o,"addProseMirrorPlugins",r);if(f){const p=f();i.push(...p)}return i})}get attributes(){return Rp(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=jo(this.extensions);return Object.fromEntries(e.filter(t=>!!ke(t,"addNodeView")).map(t=>{const o=this.attributes.filter(c=>c.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:tt(t.name,this.schema)},i=ke(t,"addNodeView",r);if(!i)return[];const s=i();if(!s)return[];const l=(c,d,u,f,p)=>{const h=vr(c,o);return s({node:c,view:d,getPos:u,decorations:f,innerDecorations:p,editor:n,extension:t,HTMLAttributes:h})};return[t.name,l]}))}dispatchTransaction(n){const{editor:e}=this;return Ui([...this.extensions].reverse()).reduceRight((o,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Wi(r.name,this.schema)},s=ke(r,"dispatchTransaction",i);return s?l=>{s.call(i,{transaction:l,next:o})}:o},n)}get markViews(){const{editor:n}=this,{markExtensions:e}=jo(this.extensions);return Object.fromEntries(e.filter(t=>!!ke(t,"addMarkView")).map(t=>{const o=this.attributes.filter(l=>l.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Cn(t.name,this.schema)},i=ke(t,"addMarkView",r);if(!i)return[];const s=(l,c,d)=>{const u=vr(l,o);return i()({mark:l,view:c,inline:d,editor:n,extension:t,HTMLAttributes:u,updateAttributes:f=>{LE(l,n,f)}})};return[t.name,s]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const o={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Wi(e.name,this.schema)};e.type==="mark"&&((t=je(ke(e,"keepOnSplit",o)))==null||t)&&this.splittableMarks.push(e.name);const r=ke(e,"onBeforeCreate",o),i=ke(e,"onCreate",o),s=ke(e,"onUpdate",o),l=ke(e,"onSelectionUpdate",o),c=ke(e,"onTransaction",o),d=ke(e,"onFocus",o),u=ke(e,"onBlur",o),f=ke(e,"onDestroy",o);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}};Xi.resolve=Vp,Xi.sort=Ui,Xi.flatten=bl;var TE={};hl(TE,{ClipboardTextSerializer:()=>Xp,Commands:()=>Yp,Delete:()=>Qp,Drop:()=>Zp,Editable:()=>eh,FocusEvents:()=>nh,Keymap:()=>oh,Paste:()=>rh,Tabindex:()=>ih,TextDirection:()=>sh,focusEventsPluginKey:()=>th});var Ft=class am extends Nl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new am(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Xp=Ft.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Mt({key:new en("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:o,selection:r}=e,{ranges:i}=r,s=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),c=Fp(t);return Bp(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),Yp=Ft.create({name:"commands",addCommands(){return{...Sp}}}),Qp=Ft.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,o,r;const i=()=>{var s,l,c,d;if((d=(c=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:c.call(l,n))!=null?d:n.getMeta("y-sync$"))return;const u=Op(n.before,[n,...e]);Hp(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,y)=>{const g=y+m.nodeSize-2,x=h.oldRange.from<=y&&g<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:y,to:g,newFrom:u.mapping.map(y),newTo:u.mapping.map(g),deletedRange:h.oldRange,newRange:h.newRange,partial:!x,editor:this.editor,transaction:n,combinedTransform:u})})});const p=u.mapping;u.steps.forEach((h,m)=>{var y,g;if(h instanceof Zt){const x=p.slice(m).map(h.from,-1),M=p.slice(m).map(h.to),E=p.invert().map(x,-1),v=p.invert().map(M),_=(y=u.doc.nodeAt(x-1))==null?void 0:y.marks.some(b=>b.eq(h.mark)),A=(g=u.doc.nodeAt(M))==null?void 0:g.marks.some(b=>b.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:E,to:v},newRange:{from:x,to:M},partial:!!(A||_),editor:this.editor,transaction:n,combinedTransform:u})}})};(r=(o=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:o.async)==null||r?setTimeout(i,0):i()}}),Zp=Ft.create({name:"drop",addProseMirrorPlugins(){return[new Mt({key:new en("tiptapDrop"),props:{handleDrop:(n,e,t,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:o})}}})]}}),eh=Ft.create({name:"editable",addProseMirrorPlugins(){return[new Mt({key:new en("editable"),props:{editable:()=>this.editor.options.editable}})]}}),th=new en("focusEvents"),nh=Ft.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Mt({key:th,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const o=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,t)=>{n.isFocused=!1;const o=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),oh=Ft.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:c,doc:d}=l,{empty:u,$anchor:f}=c,{pos:p,parent:h}=f,m=f.parent.isTextblock&&p>0?l.doc.resolve(p-1):f,y=m.parent.type.spec.isolating,g=f.pos-f.parentOffset,x=y&&m.parent.childCount===1?g===f.pos:Re.atStart(d).from===p;return!u||!h.type.isTextblock||h.textContent.length||!x||x&&f.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),o={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...o},i={...o,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Bi()||Ap()?i:r},addProseMirrorPlugins(){return[new Mt({key:new en("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(y=>y.getMeta("composition")))return;const o=n.some(y=>y.docChanged)&&!e.doc.eq(t.doc),r=n.some(y=>y.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:s,to:l}=e.selection,c=Re.atStart(e.doc).from,d=Re.atEnd(e.doc).to;if(i||!(s===c&&l===d)||!wl(t.doc))return;const p=t.tr,h=Li({state:t,transaction:p}),{commands:m}=new $i({editor:this.editor,state:h});if(m.clearNodes(),!!p.steps.length)return p}})]}}),rh=Ft.create({name:"paste",addProseMirrorPlugins(){return[new Mt({key:new en("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),ih=Ft.create({name:"tabindex",addProseMirrorPlugins(){return[new Mt({key:new en("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),sh=Ft.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=jo(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Mt({key:new en("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),vE=class Jo{constructor(e,t,o=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=o,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,o=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,o=this.to-1}this.editor.commands.insertContentAt({from:t,to:o},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Jo(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Jo(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Jo(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,o)=>{const r=t.isBlock&&!t.isTextblock,i=t.isAtom&&!t.isText,s=this.pos+o+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(s);if(!r&&l.depth<=this.depth)return;const c=new Jo(l,this.editor,r,r?t:null);r&&(c.actualDepth=this.depth+1),e.push(new Jo(l,this.editor,r,r?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let o=null,r=this.parent;for(;r&&!o;){if(r.node.type.name===e)if(Object.keys(t).length>0){const i=r.node.attrs,s=Object.keys(t);for(let l=0;l<s.length;l+=1){const c=s[l];if(i[c]!==t[c])break}}else o=r;r=r.parent}return o}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},o=!1){let r=[];if(!this.children||this.children.length===0)return r;const i=Object.keys(t);return this.children.forEach(s=>{o&&r.length>0||(s.node.type.name===e&&i.every(c=>t[c]===s.node.attrs[c])&&r.push(s),!(o&&r.length>0)&&(r=r.concat(s.querySelectorAll(e,t,o))))}),r}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},zE=`.ProseMirror {
361
357
  position: relative;
362
358
  }
363
359
 
@@ -427,53 +423,53 @@ img.ProseMirror-separator {
427
423
 
428
424
  .ProseMirror-focused .ProseMirror-gapcursor {
429
425
  display: block;
430
- }`;function Hw(t,e,n){const o=document.querySelector("style[data-tiptap-style]");if(o!==null)return o;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute("data-tiptap-style",""),r.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(r),r}var Ww=class extends Mw{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:lw,createMappablePosition:cw},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const n=this.createDoc(),o=ch(n,this.options.autofocus);this.editorState=jo.create({doc:n,schema:this.schema,selection:o||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=Hw(Uw,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,n)=>{if(this.editorView)return this.editorView[n];if(n==="state")return this.editorState;if(n in e)return Reflect.get(e,n);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${n}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,n){const o=gh(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let o=n;if([].concat(e).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;o=o.filter(l=>!l.key.startsWith(s))}),n.length===o.length)return;const r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}createExtensionManager(){var e,n;const r=[...this.options.enableCoreExtensions?[Ph,Ih.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:n.blockSeparator}),Oh,$h,Vh,Fh,Rh,Bh,Dh,jh.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new us(r,this)}createCommandManager(){this.commandManager=new Qi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Ll(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(n){if(!(n instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(n.message))throw n;this.emit("contentError",{editor:this,error:n,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(o=>o.name!=="collaboration"),this.createExtensionManager()}}),e=Ll(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:n,enableExtensionDispatchTransaction:o}=this.options,r=n.dispatchTransaction||this.dispatchTransaction.bind(this),i=o?this.extensionManager.dispatchTransaction(r):r;this.editorView=new Zp(e,{...n,attributes:{role:"textbox",...n?.attributes},dispatchTransaction:i,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(u=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(u)});return}const{state:n,transactions:o}=this.state.applyTransaction(e),r=!this.state.selection.eq(n.selection),i=o.includes(e),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),!i)return;this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:o.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const l=o.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),c=l?.getMeta("focus"),d=l?.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:l}),d&&this.emit("blur",{editor:this,event:d.event,transaction:l}),!(e.getMeta("preventUpdate")||!o.some(u=>u.docChanged)||s.doc.eq(n.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:o.slice(1)})}getAttributes(e){return Nh(this.state,e)}isActive(e,n){const o=typeof e=="string"?e:null,r=typeof e=="string"?n:e;return iw(this.state,o,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Vl(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
426
+ }`;function ME(n,e,t){const o=document.querySelector("style[data-tiptap-style]");if(o!==null)return o;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute("data-tiptap-style",""),r.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(r),r}var AE=class extends gE{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Gk,createMappablePosition:Kk},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const t=this.createDoc(),o=vp(t,this.options.autofocus);this.editorState=Do.create({doc:t,schema:this.schema,selection:o||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=ME(zE,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const o=Dp(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let o=t;if([].concat(e).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;o=o.filter(l=>!l.key.startsWith(s))}),t.length===o.length)return;const r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}createExtensionManager(){var e,t;const r=[...this.options.enableCoreExtensions?[eh,Xp.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),Yp,nh,oh,ih,Zp,rh,Qp,sh.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new Xi(r,this)}createCommandManager(){this.commandManager=new $i({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=yl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(o=>o.name!=="collaboration"),this.createExtensionManager()}}),e=yl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:o}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=o?this.extensionManager.dispatchTransaction(r):r;this.editorView=new yp(e,{...t,attributes:{role:"textbox",...t?.attributes},dispatchTransaction:i,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(u=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(u)});return}const{state:t,transactions:o}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=o.includes(e),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:o.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const l=o.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),c=l?.getMeta("focus"),d=l?.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:l}),d&&this.emit("blur",{editor:this,event:d.event,transaction:l}),!(e.getMeta("preventUpdate")||!o.some(u=>u.docChanged)||s.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:o.slice(1)})}getAttributes(e){return jp(this.state,e)}isActive(e,t){const o=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return Uk(this.state,o,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return xl(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
431
427
 
432
- `,textSerializers:o={}}=e||{};return Zk(this.state.doc,{blockSeparator:n,textSerializers:{...Sh(this.schema),...o}})}get isEmpty(){return jl(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,n;return(n=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?n:!0}$node(e,n){var o;return((o=this.$doc)==null?void 0:o.querySelector(e,n))||null}$nodes(e,n){var o;return((o=this.$doc)==null?void 0:o.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new jw(n,this)}get $doc(){return this.$pos(0)}};function Br(t){return new Ah({find:t.find,handler:({state:e,range:n,match:o})=>{const r=Ue(t.getAttributes,void 0,o);if(r===!1||r===null)return null;const{tr:i}=e,s=o[o.length-1],l=o[0];if(s){const c=l.search(/\S/),d=n.from+l.indexOf(s),u=d+s.length;if(Bl(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(b=>b===t.type&&b!==h.mark.type)).filter(h=>h.to>d).length)return null;u<n.to&&i.delete(u,n.to),d>n.from&&i.delete(n.from+c,d);const p=n.from+c+s.length;i.addMark(n.from+c,p,t.type.create(r||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function Fr(t){return new Ah({find:t.find,handler:({state:e,range:n,match:o,chain:r})=>{const i=Ue(t.getAttributes,void 0,o)||{},s=e.tr.delete(n.from,n.to),c=s.doc.resolve(n.from).blockRange(),d=c&&Xa(c,t.type,i);if(!d)return null;if(s.wrap(c,d),t.keepMarks&&t.editor){const{selection:f,storedMarks:p}=e,{splittableMarks:h}=t.editor.extensionManager,m=p||f.$to.parentOffset&&f.$from.marks();if(m){const b=m.filter(g=>h.includes(g.type.name));s.ensureMarks(b)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(f,i).run()}const u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Jn(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(o,u))&&s.join(n.from-1)},undoable:t.undoable})}var Gw={};Dl(Gw,{createAtomBlockMarkdownSpec:()=>qw,createBlockMarkdownSpec:()=>Kw,createInlineMarkdownSpec:()=>Yw,parseAttributes:()=>Gl,parseIndentedBlocks:()=>Kl,renderNestedMarkdownContent:()=>Jl,serializeAttributes:()=>ql});function Gl(t){if(!t?.trim())return{};const e={},n=[],o=t.replace(/["']([^"']*)["']/g,d=>(n.push(d),`__QUOTED_${n.length-1}__`)),r=o.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(r){const d=r.map(u=>u.trim().slice(1));e.class=d.join(" ")}const i=o.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(o.matchAll(s)).forEach(([,d,u])=>{var f;const p=parseInt(((f=u.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),h=n[p];h&&(e[d]=h.slice(1,-1))});const c=o.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return c&&c.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function ql(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(o=>e.push(`.${o}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,o])=>{n==="class"||n==="id"||(o===!0?e.push(n):o!==!1&&o!=null&&e.push(`${n}="${String(o)}"`))}),e.join(" ")}function qw(t){const{nodeName:e,name:n,parseAttributes:o=Gl,serializeAttributes:r=ql,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=t,c=n||e,d=u=>{if(!l)return u;const f={};return l.forEach(p=>{p in u&&(f[p]=u[p])}),f};return{parseMarkdown:(u,f)=>{const p={...i,...u.attributes};return f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(u){var f;const p=new RegExp(`^:::${c}(?:\\s|$)`,"m"),h=(f=u.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(u,f,p){const h=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.match(h);if(!m)return;const b=m[1]||"",g=o(b);if(!s.find(v=>!(v in g)))return{type:e,raw:m[0],attributes:g}}},renderMarkdown:u=>{const f=d(u.attrs||{}),p=r(f),h=p?` {${p}}`:"";return`:::${c}${h} :::`}}}function Kw(t){const{nodeName:e,name:n,getContent:o,parseAttributes:r=Gl,serializeAttributes:i=ql,defaultAttributes:s={},content:l="block",allowedAttributes:c}=t,d=n||e,u=f=>{if(!c)return f;const p={};return c.forEach(h=>{h in f&&(p[h]=f[h])}),p};return{parseMarkdown:(f,p)=>{let h;if(o){const b=o(f);h=typeof b=="string"?[{type:"text",text:b}]:b}else l==="block"?h=p.parseChildren(f.tokens||[]):h=p.parseInline(f.tokens||[]);const m={...s,...f.attributes};return p.createNode(e,m,h)},markdownTokenizer:{name:e,level:"block",start(f){var p;const h=new RegExp(`^:::${d}`,"m"),m=(p=f.match(h))==null?void 0:p.index;return m!==void 0?m:-1},tokenize(f,p,h){var m;const b=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=f.match(b);if(!g)return;const[x,v=""]=g,w=r(v);let T=1;const M=x.length;let A="";const y=/^:::([\w-]*)(\s.*)?/gm,E=f.slice(M);for(y.lastIndex=0;;){const k=y.exec(E);if(k===null)break;const O=k.index,G=k[1];if(!((m=k[2])!=null&&m.endsWith(":::"))){if(G)T+=1;else if(T-=1,T===0){const z=E.slice(0,O);A=z.trim();const R=f.slice(0,M+O+k[0].length);let W=[];if(A)if(l==="block")for(W=h.blockTokens(z),W.forEach(H=>{H.text&&(!H.tokens||H.tokens.length===0)&&(H.tokens=h.inlineTokens(H.text))});W.length>0;){const H=W[W.length-1];if(H.type==="paragraph"&&(!H.text||H.text.trim()===""))W.pop();else break}else W=h.inlineTokens(A);return{type:e,raw:R,attributes:w,content:A,tokens:W}}}}}},renderMarkdown:(f,p)=>{const h=u(f.attrs||{}),m=i(h),b=m?` {${m}}`:"",g=p.renderChildren(f.content||[],`
428
+ `,textSerializers:o={}}=e||{};return $k(this.state.doc,{blockSeparator:t,textSerializers:{...Fp(this.schema),...o}})}get isEmpty(){return wl(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var o;return((o=this.$doc)==null?void 0:o.querySelector(e,t))||null}$nodes(e,t){var o;return((o=this.$doc)==null?void 0:o.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new vE(t,this)}get $doc(){return this.$pos(0)}};function Mr(n){return new Kp({find:n.find,handler:({state:e,range:t,match:o})=>{const r=je(n.getAttributes,void 0,o);if(r===!1||r===null)return null;const{tr:i}=e,s=o[o.length-1],l=o[0];if(s){const c=l.search(/\S/),d=t.from+l.indexOf(s),u=d+s.length;if(kl(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(y=>y===n.type&&y!==h.mark.type)).filter(h=>h.to>d).length)return null;u<t.to&&i.delete(u,t.to),d>t.from&&i.delete(t.from+c,d);const p=t.from+c+s.length;i.addMark(t.from+c,p,n.type.create(r||{})),i.removeStoredMark(n.type)}},undoable:n.undoable})}function Ar(n){return new Kp({find:n.find,handler:({state:e,range:t,match:o,chain:r})=>{const i=je(n.getAttributes,void 0,o)||{},s=e.tr.delete(t.from,t.to),c=s.doc.resolve(t.from).blockRange(),d=c&&Aa(c,n.type,i);if(!d)return null;if(s.wrap(c,d),n.keepMarks&&n.editor){const{selection:f,storedMarks:p}=e,{splittableMarks:h}=n.editor.extensionManager,m=p||f.$to.parentOffset&&f.$from.marks();if(m){const y=m.filter(g=>h.includes(g.type.name));s.ensureMarks(y)}}if(n.keepAttributes){const f=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(f,i).run()}const u=s.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Un(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(o,u))&&s.join(t.from-1)},undoable:n.undoable})}var IE={};hl(IE,{createAtomBlockMarkdownSpec:()=>_E,createBlockMarkdownSpec:()=>OE,createInlineMarkdownSpec:()=>PE,parseAttributes:()=>Tl,parseIndentedBlocks:()=>zl,renderNestedMarkdownContent:()=>Ml,serializeAttributes:()=>vl});function Tl(n){if(!n?.trim())return{};const e={},t=[],o=n.replace(/["']([^"']*)["']/g,d=>(t.push(d),`__QUOTED_${t.length-1}__`)),r=o.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(r){const d=r.map(u=>u.trim().slice(1));e.class=d.join(" ")}const i=o.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(o.matchAll(s)).forEach(([,d,u])=>{var f;const p=parseInt(((f=u.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),h=t[p];h&&(e[d]=h.slice(1,-1))});const c=o.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return c&&c.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function vl(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(o=>e.push(`.${o}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,o])=>{t==="class"||t==="id"||(o===!0?e.push(t):o!==!1&&o!=null&&e.push(`${t}="${String(o)}"`))}),e.join(" ")}function _E(n){const{nodeName:e,name:t,parseAttributes:o=Tl,serializeAttributes:r=vl,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=n,c=t||e,d=u=>{if(!l)return u;const f={};return l.forEach(p=>{p in u&&(f[p]=u[p])}),f};return{parseMarkdown:(u,f)=>{const p={...i,...u.attributes};return f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(u){var f;const p=new RegExp(`^:::${c}(?:\\s|$)`,"m"),h=(f=u.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(u,f,p){const h=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.match(h);if(!m)return;const y=m[1]||"",g=o(y);if(!s.find(M=>!(M in g)))return{type:e,raw:m[0],attributes:g}}},renderMarkdown:u=>{const f=d(u.attrs||{}),p=r(f),h=p?` {${p}}`:"";return`:::${c}${h} :::`}}}function OE(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=Tl,serializeAttributes:i=vl,defaultAttributes:s={},content:l="block",allowedAttributes:c}=n,d=t||e,u=f=>{if(!c)return f;const p={};return c.forEach(h=>{h in f&&(p[h]=f[h])}),p};return{parseMarkdown:(f,p)=>{let h;if(o){const y=o(f);h=typeof y=="string"?[{type:"text",text:y}]:y}else l==="block"?h=p.parseChildren(f.tokens||[]):h=p.parseInline(f.tokens||[]);const m={...s,...f.attributes};return p.createNode(e,m,h)},markdownTokenizer:{name:e,level:"block",start(f){var p;const h=new RegExp(`^:::${d}`,"m"),m=(p=f.match(h))==null?void 0:p.index;return m!==void 0?m:-1},tokenize(f,p,h){var m;const y=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=f.match(y);if(!g)return;const[x,M=""]=g,E=r(M);let v=1;const _=x.length;let A="";const b=/^:::([\w-]*)(\s.*)?/gm,k=f.slice(_);for(b.lastIndex=0;;){const w=b.exec(k);if(w===null)break;const O=w.index,q=w[1];if(!((m=w[2])!=null&&m.endsWith(":::"))){if(q)v+=1;else if(v-=1,v===0){const T=k.slice(0,O);A=T.trim();const R=f.slice(0,_+O+w[0].length);let H=[];if(A)if(l==="block")for(H=h.blockTokens(T),H.forEach(F=>{F.text&&(!F.tokens||F.tokens.length===0)&&(F.tokens=h.inlineTokens(F.text))});H.length>0;){const F=H[H.length-1];if(F.type==="paragraph"&&(!F.text||F.text.trim()===""))H.pop();else break}else H=h.inlineTokens(A);return{type:e,raw:R,attributes:E,content:A,tokens:H}}}}}},renderMarkdown:(f,p)=>{const h=u(f.attrs||{}),m=i(h),y=m?` {${m}}`:"",g=p.renderChildren(f.content||[],`
433
429
 
434
- `);return`:::${d}${b}
430
+ `);return`:::${d}${y}
435
431
 
436
432
  ${g}
437
433
 
438
- :::`}}}function Jw(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let o=n.exec(t);for(;o!==null;){const[,r,i,s]=o;e[r]=i||s,o=n.exec(t)}return e}function Xw(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function Yw(t){const{nodeName:e,name:n,getContent:o,parseAttributes:r=Jw,serializeAttributes:i=Xw,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:c}=t,d=n||e,u=p=>{if(!c)return p;const h={};return c.forEach(m=>{const b=typeof m=="string"?m:m.name,g=typeof m=="string"?void 0:m.skipIfDefault;if(b in p){const x=p[b];if(g!==void 0&&x===g)return;h[b]=x}}),h},f=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,h)=>{const m={...s,...p.attributes};if(l)return h.createNode(e,m);const b=o?o(p):p.content||"";return b?h.createNode(e,m,[h.createTextNode(b)]):h.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(p){const h=l?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=p.match(h),b=m?.index;return b!==void 0?b:-1},tokenize(p,h,m){const b=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),g=p.match(b);if(!g)return;let x="",v="";if(l){const[,T]=g;v=T}else{const[,T,M]=g;v=T,x=M||""}const w=r(v.trim());return{type:e,raw:g[0],content:x.trim(),attributes:w}}},renderMarkdown:p=>{let h="";o?h=o(p):p.content&&p.content.length>0&&(h=p.content.filter(x=>x.type==="text").map(x=>x.text).join(""));const m=u(p.attrs||{}),b=i(m),g=b?` ${b}`:"";return l?`[${d}${g}]`:`[${d}${g}]${h}[/${d}]`}}}function Kl(t,e,n){var o,r,i,s;const l=t.split(`
434
+ :::`}}}function DE(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let o=t.exec(n);for(;o!==null;){const[,r,i,s]=o;e[r]=i||s,o=t.exec(n)}return e}function RE(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function PE(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=DE,serializeAttributes:i=RE,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:c}=n,d=t||e,u=p=>{if(!c)return p;const h={};return c.forEach(m=>{const y=typeof m=="string"?m:m.name,g=typeof m=="string"?void 0:m.skipIfDefault;if(y in p){const x=p[y];if(g!==void 0&&x===g)return;h[y]=x}}),h},f=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,h)=>{const m={...s,...p.attributes};if(l)return h.createNode(e,m);const y=o?o(p):p.content||"";return y?h.createNode(e,m,[h.createTextNode(y)]):h.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(p){const h=l?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=p.match(h),y=m?.index;return y!==void 0?y:-1},tokenize(p,h,m){const y=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),g=p.match(y);if(!g)return;let x="",M="";if(l){const[,v]=g;M=v}else{const[,v,_]=g;M=v,x=_||""}const E=r(M.trim());return{type:e,raw:g[0],content:x.trim(),attributes:E}}},renderMarkdown:p=>{let h="";o?h=o(p):p.content&&p.content.length>0&&(h=p.content.filter(x=>x.type==="text").map(x=>x.text).join(""));const m=u(p.attrs||{}),y=i(m),g=y?` ${y}`:"";return l?`[${d}${g}]`:`[${d}${g}]${h}[/${d}]`}}}function zl(n,e,t){var o,r,i,s;const l=n.split(`
439
435
  `),c=[];let d="",u=0;const f=e.baseIndentSize||2;for(;u<l.length;){const p=l[u],h=p.match(e.itemPattern);if(!h){if(c.length>0)break;if(p.trim()===""){u+=1,d=`${d}${p}
440
- `;continue}else return}const m=e.extractItemData(h),{indentLevel:b,mainContent:g}=m;d=`${d}${p}
441
- `;const x=[g];for(u+=1;u<l.length;){const M=l[u];if(M.trim()===""){const y=l.slice(u+1).findIndex(O=>O.trim()!=="");if(y===-1)break;if((((r=(o=l[u+1+y].match(/^(\s*)/))==null?void 0:o[1])==null?void 0:r.length)||0)>b){x.push(M),d=`${d}${M}
442
- `,u+=1;continue}else break}if((((s=(i=M.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:s.length)||0)>b)x.push(M),d=`${d}${M}
443
- `,u+=1;else break}let v;const w=x.slice(1);if(w.length>0){const M=w.map(A=>A.slice(b+f)).join(`
444
- `);M.trim()&&(e.customNestedParser?v=e.customNestedParser(M):v=n.blockTokens(M))}const T=e.createToken(m,v);c.push(T)}if(c.length!==0)return{items:c,raw:d}}function Jl(t,e,n,o){if(!t||!Array.isArray(t.content))return"";const r=typeof n=="function"?n(o):n,[i,...s]=t.content,l=e.renderChildren([i]),c=[`${r}${l}`];return s&&s.length>0&&s.forEach(d=>{const u=e.renderChildren([d]);if(u){const f=u.split(`
436
+ `;continue}else return}const m=e.extractItemData(h),{indentLevel:y,mainContent:g}=m;d=`${d}${p}
437
+ `;const x=[g];for(u+=1;u<l.length;){const _=l[u];if(_.trim()===""){const b=l.slice(u+1).findIndex(O=>O.trim()!=="");if(b===-1)break;if((((r=(o=l[u+1+b].match(/^(\s*)/))==null?void 0:o[1])==null?void 0:r.length)||0)>y){x.push(_),d=`${d}${_}
438
+ `,u+=1;continue}else break}if((((s=(i=_.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:s.length)||0)>y)x.push(_),d=`${d}${_}
439
+ `,u+=1;else break}let M;const E=x.slice(1);if(E.length>0){const _=E.map(A=>A.slice(y+f)).join(`
440
+ `);_.trim()&&(e.customNestedParser?M=e.customNestedParser(_):M=t.blockTokens(_))}const v=e.createToken(m,M);c.push(v)}if(c.length!==0)return{items:c,raw:d}}function Ml(n,e,t,o){if(!n||!Array.isArray(n.content))return"";const r=typeof t=="function"?t(o):t,[i,...s]=n.content,l=e.renderChildren([i]),c=[`${r}${l}`];return s&&s.length>0&&s.forEach(d=>{const u=e.renderChildren([d]);if(u){const f=u.split(`
445
441
  `).map(p=>p?e.indent(p):"").join(`
446
442
  `);c.push(f)}}),c.join(`
447
- `)}function Qw(t,e,n={}){const{state:o}=e,{doc:r,tr:i}=o,s=t;r.descendants((l,c)=>{const d=i.mapping.map(c),u=i.mapping.map(c)+l.nodeSize;let f=null;if(l.marks.forEach(h=>{if(h!==s)return!1;f=h}),!f)return;let p=!1;if(Object.keys(n).forEach(h=>{n[h]!==f.attrs[h]&&(p=!0)}),p){const h=t.type.create({...t.attrs,...n});i.removeMark(d,u,t.type),i.addMark(d,u,h)}}),i.docChanged&&e.view.dispatch(i)}var In=class Hm extends Wl{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new Hm(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Yo(t){return new Pw({find:t.find,handler:({state:e,range:n,match:o,pasteEvent:r})=>{const i=Ue(t.getAttributes,void 0,o,r);if(i===!1||i===null)return null;const{tr:s}=e,l=o[o.length-1],c=o[0];let d=n.to;if(l){const u=c.search(/\S/),f=n.from+c.indexOf(l),p=f+l.length;if(Bl(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(g=>g===t.type&&g!==m.mark.type)).filter(m=>m.to>f).length)return null;p<n.to&&s.delete(p,n.to),f>n.from&&s.delete(n.from+u,f),d=n.from+u+l.length,s.addMark(n.from+u,d,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function Uh(t){return a.customRef((e,n)=>({get(){return e(),t},set(o){t=o,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}var Zw=class extends Ww{constructor(t={}){return super(t),this.contentComponent=null,this.appContext=null,this.reactiveState=Uh(this.view.state),this.reactiveExtensionStorage=Uh(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),a.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(t,e){const n=super.registerPlugin(t,e);return this.reactiveState&&(this.reactiveState.value=n),n}unregisterPlugin(t){const e=super.unregisterPlugin(t);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},eS=a.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=a.ref(),n=a.getCurrentInstance();return a.watchEffect(()=>{const o=t.editor;o&&o.options.element&&e.value&&a.nextTick(()=>{var r;if(!e.value||!((r=o.view.dom)!=null&&r.parentNode))return;const i=a.unref(e.value);e.value.append(...o.view.dom.parentNode.childNodes),o.contentComponent=n.ctx._,n&&(o.appContext={...n.appContext,provides:n.provides}),o.setOptions({element:i}),o.createNodeViews()})}),a.onBeforeUnmount(()=>{const o=t.editor;o&&(o.contentComponent=null,o.appContext=null)}),{rootEl:e}},render(){return a.h("div",{ref:t=>{this.rootEl=t}})}});a.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return a.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),a.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var t,e;return a.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(t=this.$slots).default)==null?void 0:e.call(t))}});var tS=(t={})=>{const e=a.shallowRef();return a.onMounted(()=>{e.value=new Zw(t)}),a.onBeforeUnmount(()=>{var n,o,r,i;const s=(o=(n=e.value)==null?void 0:n.view.dom)==null?void 0:o.parentNode,l=s?.cloneNode(!0);(r=s?.parentNode)==null||r.replaceChild(l,s),(i=e.value)==null||i.destroy()}),e};a.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return a.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var nS=In.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
443
+ `)}function LE(n,e,t={}){const{state:o}=e,{doc:r,tr:i}=o,s=n;r.descendants((l,c)=>{const d=i.mapping.map(c),u=i.mapping.map(c)+l.nodeSize;let f=null;if(l.marks.forEach(h=>{if(h!==s)return!1;f=h}),!f)return;let p=!1;if(Object.keys(t).forEach(h=>{t[h]!==f.attrs[h]&&(p=!0)}),p){const h=n.type.create({...n.attrs,...t});i.removeMark(d,u,n.type),i.addMark(d,u,h)}}),i.docChanged&&e.view.dispatch(i)}var Nn=class lm extends Nl{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new lm(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Ho(n){return new EE({find:n.find,handler:({state:e,range:t,match:o,pasteEvent:r})=>{const i=je(n.getAttributes,void 0,o,r);if(i===!1||i===null)return null;const{tr:s}=e,l=o[o.length-1],c=o[0];let d=t.to;if(l){const u=c.search(/\S/),f=t.from+c.indexOf(l),p=f+l.length;if(kl(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(g=>g===n.type&&g!==m.mark.type)).filter(m=>m.to>f).length)return null;p<t.to&&s.delete(p,t.to),f>t.from&&s.delete(t.from+u,f),d=t.from+u+l.length,s.addMark(t.from+u,d,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function ah(n){return a.customRef((e,t)=>({get(){return e(),n},set(o){n=o,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var $E=class extends AE{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=ah(this.view.state),this.reactiveExtensionStorage=ah(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),a.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(n,e){const t=super.registerPlugin(n,e);return this.reactiveState&&(this.reactiveState.value=t),t}unregisterPlugin(n){const e=super.unregisterPlugin(n);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},VE=a.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=a.ref(),t=a.getCurrentInstance();return a.watchEffect(()=>{const o=n.editor;o&&o.options.element&&e.value&&a.nextTick(()=>{var r;if(!e.value||!((r=o.view.dom)!=null&&r.parentNode))return;const i=a.unref(e.value);e.value.append(...o.view.dom.parentNode.childNodes),o.contentComponent=t.ctx._,t&&(o.appContext={...t.appContext,provides:t.provides}),o.setOptions({element:i}),o.createNodeViews()})}),a.onBeforeUnmount(()=>{const o=n.editor;o&&(o.contentComponent=null,o.appContext=null)}),{rootEl:e}},render(){return a.h("div",{ref:n=>{this.rootEl=n}})}});a.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return a.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),a.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return a.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(n=this.$slots).default)==null?void 0:e.call(n))}});var BE=(n={})=>{const e=a.shallowRef();return a.onMounted(()=>{e.value=new $E(n)}),a.onBeforeUnmount(()=>{var t,o,r,i;const s=(o=(t=e.value)==null?void 0:t.view.dom)==null?void 0:o.parentNode,l=s?.cloneNode(!0);(r=s?.parentNode)==null||r.replaceChild(l,s),(i=e.value)==null||i.destroy()}),e};a.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return a.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var FE=Nn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
448
444
 
449
- `):""}),oS=nS,rS=In.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Rt(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];return n.length===1&&n[0].type==="image"?e.parseChildren([n[0]]):e.createNode("paragraph",void 0,e.parseInline(n))},renderMarkdown:(t,e)=>!t||!Array.isArray(t.content)?"":e.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),iS=rS,sS=In.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),aS=sS,Hh=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...o}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,o,n]},lS=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,cS=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,dS=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,uS=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,fS=Vr.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return Hh("strong",{...Rt(this.options.HTMLAttributes,t),children:Hh("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Br({find:lS,type:this.type}),Br({find:dS,type:this.type})]},addPasteRules(){return[Yo({find:cS,type:this.type}),Yo({find:uS,type:this.type})]}}),pS=fS,hS=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,mS=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,gS=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,bS=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,yS=Vr.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Rt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Br({find:hS,type:this.type}),Br({find:gS,type:this.type})]},addPasteRules(){return[Yo({find:mS,type:this.type}),Yo({find:bS,type:this.type})]}}),xS=yS,ES=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,kS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,wS=Vr.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Rt(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Br({find:ES,type:this.type})]},addPasteRules(){return[Yo({find:kS,type:this.type})]}}),SS=wS,NS=Object.defineProperty,CS=(t,e)=>{for(var n in e)NS(t,n,{get:e[n],enumerable:!0})},vS="listItem",Wh="textStyle",Gh=/^\s*([-+*])\s$/,qh=In.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Rt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
450
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(vS,this.editor.getAttributes(Wh)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Fr({find:Gh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Fr({find:Gh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Wh),editor:this.editor})),[t]}}),Kh=In.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Rt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(r=>r.type==="paragraph"))n=e.parseChildren(t.tokens);else{const r=t.tokens[0];if(r&&r.type==="text"&&r.tokens&&r.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(r.tokens)}],t.tokens.length>1){const s=t.tokens.slice(1),l=e.parseChildren(s);n.push(...l)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>Jl(t,e,o=>o.parentType==="bulletList"?"- ":o.parentType==="orderedList"?`${o.index+1}. `:"- ",n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),TS={};CS(TS,{findListItemPos:()=>jr,getNextListDepth:()=>Xl,handleBackspace:()=>Yl,handleDelete:()=>Ql,hasListBefore:()=>Jh,hasListItemAfter:()=>zS,hasListItemBefore:()=>Xh,listItemHasSubList:()=>Yh,nextListIsDeeper:()=>Qh,nextListIsHigher:()=>Zh});var jr=(t,e)=>{const{$from:n}=e.selection,o=ot(t,e.schema);let r=null,i=n.depth,s=n.pos,l=null;for(;i>0&&l===null;)r=n.node(i),r.type===o?l=i:(i-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},Xl=(t,e)=>{const n=jr(t,e);if(!n)return!1;const[,o]=ow(e,t,n.$pos.pos+4);return o},Jh=(t,e,n)=>{const{$anchor:o}=t.selection,r=Math.max(0,o.pos-2),i=t.doc.resolve(r).node();return!(!i||!n.includes(i.type.name))},Xh=(t,e)=>{var n;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-2);return!(r.index()===0||((n=r.nodeBefore)==null?void 0:n.type.name)!==t)},Yh=(t,e,n)=>{if(!n)return!1;const o=ot(t,e.schema);let r=!1;return n.descendants(i=>{i.type===o&&(r=!0)}),r},Yl=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!io(t.state,e)&&Jh(t.state,e,n)){const{$anchor:l}=t.state.selection,c=t.state.doc.resolve(l.before()-1),d=[];c.node().descendants((p,h)=>{p.type.name===e&&d.push({node:p,pos:h})});const u=d.at(-1);if(!u)return!1;const f=t.state.doc.resolve(c.start()+u.pos+1);return t.chain().cut({from:l.start()-1,to:l.end()+1},f.end()).joinForward().run()}if(!io(t.state,e)||!aw(t.state))return!1;const o=jr(e,t.state);if(!o)return!1;const i=t.state.doc.resolve(o.$pos.pos-2).node(o.depth),s=Yh(e,t.state,i);return Xh(e,t.state)&&!s?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},Qh=(t,e)=>{const n=Xl(t,e),o=jr(t,e);return!o||!n?!1:n>o.depth},Zh=(t,e)=>{const n=Xl(t,e),o=jr(t,e);return!o||!n?!1:n<o.depth},Ql=(t,e)=>{if(!io(t.state,e)||!sw(t.state,e))return!1;const{selection:n}=t.state,{$from:o,$to:r}=n;return!n.empty&&o.sameParent(r)?!1:Qh(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():Zh(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},zS=(t,e)=>{var n;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-o.parentOffset-2);return!(r.index()===r.parent.childCount-1||((n=r.nodeAfter)==null?void 0:n.type.name)!==t)},_S=Kt.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Ql(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Ql(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:o})=>{t.state.schema.nodes[n]!==void 0&&Yl(t,n,o)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:o})=>{t.state.schema.nodes[n]!==void 0&&Yl(t,n,o)&&(e=!0)}),e}}}}),em=/^(\s*)(\d+)\.\s+(.*)$/,AS=/^\s/;function MS(t){const e=[];let n=0,o=0;for(;n<t.length;){const r=t[n],i=r.match(em);if(!i)break;const[,s,l,c]=i,d=s.length;let u=c,f=n+1;const p=[r];for(;f<t.length;){const h=t[f];if(h.match(em))break;if(h.trim()==="")p.push(h),u+=`
451
- `,f+=1;else if(h.match(AS))p.push(h),u+=`
445
+ `):""}),jE=FE,HE=Nn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",It(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),UE=HE,WE=Nn.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),qE=WE,lh=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...o}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,o,t]},GE=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,KE=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,JE=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,XE=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,YE=zr.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return lh("strong",{...It(this.options.HTMLAttributes,n),children:lh("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Mr({find:GE,type:this.type}),Mr({find:JE,type:this.type})]},addPasteRules(){return[Ho({find:KE,type:this.type}),Ho({find:XE,type:this.type})]}}),QE=YE,ZE=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,ew=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,tw=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,nw=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,ow=zr.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",It(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Mr({find:ZE,type:this.type}),Mr({find:tw,type:this.type})]},addPasteRules(){return[Ho({find:ew,type:this.type}),Ho({find:nw,type:this.type})]}}),rw=ow,iw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,sw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,aw=zr.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",It(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Mr({find:iw,type:this.type})]},addPasteRules(){return[Ho({find:sw,type:this.type})]}}),lw=aw,cw=Object.defineProperty,dw=(n,e)=>{for(var t in e)cw(n,t,{get:e[t],enumerable:!0})},uw="listItem",ch="textStyle",dh=/^\s*([-+*])\s$/,uh=Nn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",It(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
446
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(uw,this.editor.getAttributes(ch)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Ar({find:dh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Ar({find:dh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ch),editor:this.editor})),[n]}}),fh=Nn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",It(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(r=>r.type==="paragraph"))t=e.parseChildren(n.tokens);else{const r=n.tokens[0];if(r&&r.type==="text"&&r.tokens&&r.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(r.tokens)}],n.tokens.length>1){const s=n.tokens.slice(1),l=e.parseChildren(s);t.push(...l)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>Ml(n,e,o=>o.parentType==="bulletList"?"- ":o.parentType==="orderedList"?`${o.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),fw={};dw(fw,{findListItemPos:()=>Ir,getNextListDepth:()=>Al,handleBackspace:()=>Il,handleDelete:()=>_l,hasListBefore:()=>ph,hasListItemAfter:()=>pw,hasListItemBefore:()=>hh,listItemHasSubList:()=>mh,nextListIsDeeper:()=>gh,nextListIsHigher:()=>yh});var Ir=(n,e)=>{const{$from:t}=e.selection,o=tt(n,e.schema);let r=null,i=t.depth,s=t.pos,l=null;for(;i>0&&l===null;)r=t.node(i),r.type===o?l=i:(i-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},Al=(n,e)=>{const t=Ir(n,e);if(!t)return!1;const[,o]=jk(e,n,t.$pos.pos+4);return o},ph=(n,e,t)=>{const{$anchor:o}=n.selection,r=Math.max(0,o.pos-2),i=n.doc.resolve(r).node();return!(!i||!t.includes(i.type.name))},hh=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-2);return!(r.index()===0||((t=r.nodeBefore)==null?void 0:t.type.name)!==n)},mh=(n,e,t)=>{if(!t)return!1;const o=tt(n,e.schema);let r=!1;return t.descendants(i=>{i.type===o&&(r=!0)}),r},Il=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!eo(n.state,e)&&ph(n.state,e,t)){const{$anchor:l}=n.state.selection,c=n.state.doc.resolve(l.before()-1),d=[];c.node().descendants((p,h)=>{p.type.name===e&&d.push({node:p,pos:h})});const u=d.at(-1);if(!u)return!1;const f=n.state.doc.resolve(c.start()+u.pos+1);return n.chain().cut({from:l.start()-1,to:l.end()+1},f.end()).joinForward().run()}if(!eo(n.state,e)||!qk(n.state))return!1;const o=Ir(e,n.state);if(!o)return!1;const i=n.state.doc.resolve(o.$pos.pos-2).node(o.depth),s=mh(e,n.state,i);return hh(e,n.state)&&!s?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},gh=(n,e)=>{const t=Al(n,e),o=Ir(n,e);return!o||!t?!1:t>o.depth},yh=(n,e)=>{const t=Al(n,e),o=Ir(n,e);return!o||!t?!1:t<o.depth},_l=(n,e)=>{if(!eo(n.state,e)||!Wk(n.state,e))return!1;const{selection:t}=n.state,{$from:o,$to:r}=t;return!t.empty&&o.sameParent(r)?!1:gh(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():yh(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},pw=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-o.parentOffset-2);return!(r.index()===r.parent.childCount-1||((t=r.nodeAfter)==null?void 0:t.type.name)!==n)},hw=Ft.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&_l(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&_l(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&Il(n,t,o)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&Il(n,t,o)&&(e=!0)}),e}}}}),bh=/^(\s*)(\d+)\.\s+(.*)$/,mw=/^\s/;function gw(n){const e=[];let t=0,o=0;for(;t<n.length;){const r=n[t],i=r.match(bh);if(!i)break;const[,s,l,c]=i,d=s.length;let u=c,f=t+1;const p=[r];for(;f<n.length;){const h=n[f];if(h.match(bh))break;if(h.trim()==="")p.push(h),u+=`
447
+ `,f+=1;else if(h.match(mw))p.push(h),u+=`
452
448
  ${h.slice(d+2)}`,f+=1;else break}e.push({indent:d,number:parseInt(l,10),content:u.trim(),raw:p.join(`
453
- `)}),o=f,n=f}return[e,o]}function tm(t,e,n){var o;const r=[];let i=0;for(;i<t.length;){const s=t[i];if(s.indent===e){const l=s.content.split(`
454
- `),c=((o=l[0])==null?void 0:o.trim())||"",d=[];c&&d.push({type:"paragraph",raw:c,tokens:n.inlineTokens(c)});const u=l.slice(1).join(`
455
- `).trim();if(u){const h=n.blockTokens(u);d.push(...h)}let f=i+1;const p=[];for(;f<t.length&&t[f].indent>e;)p.push(t[f]),f+=1;if(p.length>0){const h=Math.min(...p.map(b=>b.indent)),m=tm(p,h,n);d.push({type:"list",ordered:!0,start:p[0].number,items:m,raw:p.map(b=>b.raw).join(`
456
- `)})}r.push({type:"list_item",raw:s.raw,tokens:d}),i=f}else i+=1}return r}function IS(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const o=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(r=>{if(r.type==="paragraph"||r.type==="list"||r.type==="blockquote"||r.type==="code")o.push(...e.parseChildren([r]));else if(r.type==="text"&&r.tokens){const i=e.parseChildren([r]);o.push({type:"paragraph",content:i})}else{const i=e.parseChildren([r]);i.length>0&&o.push(...i)}}),{type:"listItem",content:o}})}var OS="listItem",nm="textStyle",om=/^(\d+)\.\s$/,rm=In.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Rt(this.options.HTMLAttributes,n),0]:["ol",Rt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,o=t.items?IS(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:o}:{type:"orderedList",content:o}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
457
- `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var o;const r=t.split(`
458
- `),[i,s]=MS(r);if(i.length===0)return;const l=tm(i,0,n);return l.length===0?void 0:{type:"list",ordered:!0,start:((o=i[0])==null?void 0:o.number)||1,items:l,raw:r.slice(0,s).join(`
459
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(OS,this.editor.getAttributes(nm)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Fr({find:om,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Fr({find:om,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(nm)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),DS=/^\s*(\[([( |x])?\])\s$/,RS=In.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Rt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const o=e.parseChildren(t.nestedTokens);n.push(...o)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const r=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Jl(t,e,r)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:o})=>{const r=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),c=document.createElement("div"),d=f=>{var p,h;l.ariaLabel=((h=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:h.call(p,f,l.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};d(t),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",f=>f.preventDefault()),l.addEventListener("change",f=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:p}=f.target;o.isEditable&&typeof n=="function"&&o.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const m=n();if(typeof m!="number")return!1;const b=h.doc.nodeAt(m);return h.setNodeMarkup(m,void 0,{...b?.attrs,checked:p}),!0}).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{r.setAttribute(f,p)}),r.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,s),r.append(i,c),Object.entries(e).forEach(([f,p])=>{r.setAttribute(f,p)});let u=new Set(Object.keys(e));return{dom:r,contentDOM:c,update:f=>{if(f.type!==this.type)return!1;r.dataset.checked=f.attrs.checked,l.checked=f.attrs.checked,d(f);const p=o.extensionManager.attributes,h=$r(f,p),m=new Set(Object.keys(h)),b=this.options.HTMLAttributes;return u.forEach(g=>{m.has(g)||(g in b?r.setAttribute(g,b[g]):r.removeAttribute(g))}),Object.entries(h).forEach(([g,x])=>{x==null?g in b?r.setAttribute(g,b[g]):r.removeAttribute(g):r.setAttribute(g,x)}),u=m,!0}}}},addInputRules(){return[Fr({find:DS,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),PS=In.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Rt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
460
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const o=i=>{const s=Kl(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,c)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:c}),customNestedParser:o},n);return s?[{type:"taskList",raw:s.raw,items:s.items}]:n.blockTokens(i)},r=Kl(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:o},n);if(r)return{type:"taskList",raw:r.raw,items:r.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Kt.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(qh.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Kh.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(_S.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(rm.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(RS.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(PS.configure(this.options.taskList)),t}});var LS=qh,$S=rm,VS=Kh,BS=In.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Rt(this.options.HTMLAttributes,t)]},renderText(){return`
449
+ `)}),o=f,t=f}return[e,o]}function xh(n,e,t){var o;const r=[];let i=0;for(;i<n.length;){const s=n[i];if(s.indent===e){const l=s.content.split(`
450
+ `),c=((o=l[0])==null?void 0:o.trim())||"",d=[];c&&d.push({type:"paragraph",raw:c,tokens:t.inlineTokens(c)});const u=l.slice(1).join(`
451
+ `).trim();if(u){const h=t.blockTokens(u);d.push(...h)}let f=i+1;const p=[];for(;f<n.length&&n[f].indent>e;)p.push(n[f]),f+=1;if(p.length>0){const h=Math.min(...p.map(y=>y.indent)),m=xh(p,h,t);d.push({type:"list",ordered:!0,start:p[0].number,items:m,raw:p.map(y=>y.raw).join(`
452
+ `)})}r.push({type:"list_item",raw:s.raw,tokens:d}),i=f}else i+=1}return r}function yw(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const o=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(r=>{if(r.type==="paragraph"||r.type==="list"||r.type==="blockquote"||r.type==="code")o.push(...e.parseChildren([r]));else if(r.type==="text"&&r.tokens){const i=e.parseChildren([r]);o.push({type:"paragraph",content:i})}else{const i=e.parseChildren([r]);i.length>0&&o.push(...i)}}),{type:"listItem",content:o}})}var bw="listItem",kh="textStyle",Eh=/^(\d+)\.\s$/,wh=Nn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",It(this.options.HTMLAttributes,t),0]:["ol",It(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,o=n.items?yw(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:o}:{type:"orderedList",content:o}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
453
+ `):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e?.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var o;const r=n.split(`
454
+ `),[i,s]=gw(r);if(i.length===0)return;const l=xh(i,0,t);return l.length===0?void 0:{type:"list",ordered:!0,start:((o=i[0])==null?void 0:o.number)||1,items:l,raw:r.slice(0,s).join(`
455
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(bw,this.editor.getAttributes(kh)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Ar({find:Eh,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Ar({find:Eh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(kh)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),xw=/^\s*(\[([( |x])?\])\s$/,kw=Nn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",It(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const o=e.parseChildren(n.nestedTokens);t.push(...o)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const r=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Ml(n,e,r)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:o})=>{const r=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),c=document.createElement("div"),d=f=>{var p,h;l.ariaLabel=((h=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:h.call(p,f,l.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};d(n),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",f=>f.preventDefault()),l.addEventListener("change",f=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:p}=f.target;o.isEditable&&typeof t=="function"&&o.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const m=t();if(typeof m!="number")return!1;const y=h.doc.nodeAt(m);return h.setNodeMarkup(m,void 0,{...y?.attrs,checked:p}),!0}).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,p)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{r.setAttribute(f,p)}),r.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,i.append(l,s),r.append(i,c),Object.entries(e).forEach(([f,p])=>{r.setAttribute(f,p)});let u=new Set(Object.keys(e));return{dom:r,contentDOM:c,update:f=>{if(f.type!==this.type)return!1;r.dataset.checked=f.attrs.checked,l.checked=f.attrs.checked,d(f);const p=o.extensionManager.attributes,h=vr(f,p),m=new Set(Object.keys(h)),y=this.options.HTMLAttributes;return u.forEach(g=>{m.has(g)||(g in y?r.setAttribute(g,y[g]):r.removeAttribute(g))}),Object.entries(h).forEach(([g,x])=>{x==null?g in y?r.setAttribute(g,y[g]):r.removeAttribute(g):r.setAttribute(g,x)}),u=m,!0}}}},addInputRules(){return[Ar({find:xw,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),Ew=Nn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",It(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
456
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const o=i=>{const s=zl(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,c)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:c}),customNestedParser:o},t);return s?[{type:"taskList",raw:s.raw,items:s.items}]:t.blockTokens(i)},r=zl(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:t.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:o},t);if(r)return{type:"taskList",raw:r.raw,items:r.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ft.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(uh.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(fh.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(hw.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(wh.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(kw.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Ew.configure(this.options.taskList)),n}});var ww=uh,Sw=wh,Cw=fh,Nw=Nn.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",It(this.options.HTMLAttributes,n)]},renderText(){return`
461
457
  `},renderMarkdown:()=>`
462
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:o})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:r,storedMarks:i}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=o.extensionManager,c=i||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:u})=>{if(u&&c&&s){const f=c.filter(p=>l.includes(p.type.name));d.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),FS=BS;const jS="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",US="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Zl="numeric",ec="ascii",tc="alpha",Ur="asciinumeric",Hr="alphanumeric",nc="domain",im="emoji",HS="scheme",WS="slashscheme",oc="whitespace";function GS(t,e){return t in e||(e[t]=[]),e[t]}function _o(t,e,n){e[Zl]&&(e[Ur]=!0,e[Hr]=!0),e[ec]&&(e[Ur]=!0,e[tc]=!0),e[Ur]&&(e[Hr]=!0),e[tc]&&(e[Hr]=!0),e[Hr]&&(e[nc]=!0),e[im]&&(e[nc]=!0);for(const o in e){const r=GS(o,n);r.indexOf(t)<0&&r.push(t)}}function qS(t,e){const n={};for(const o in e)e[o].indexOf(t)>=0&&(n[o]=!0);return n}function Pt(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Pt.groups={},Pt.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let o=0;o<e.jr.length;o++){const r=e.jr[o][0],i=e.jr[o][1];if(i&&r.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,o){for(let r=0;r<t.length;r++)this.tt(t[r],e,n,o)},tr(t,e,n,o){o=o||Pt.groups;let r;return e&&e.j?r=e:(r=new Pt(e),n&&o&&_o(e,n,o)),this.jr.push([t,r]),r},ts(t,e,n,o){let r=this;const i=t.length;if(!i)return r;for(let s=0;s<i-1;s++)r=r.tt(t[s]);return r.tt(t[i-1],e,n,o)},tt(t,e,n,o){o=o||Pt.groups;const r=this;if(e&&e.j)return r.j[t]=e,e;const i=e;let s,l=r.go(t);if(l?(s=new Pt,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new Pt,i){if(o)if(s.t&&typeof s.t=="string"){const c=Object.assign(qS(s.t,o),n);_o(i,c,o)}else n&&_o(i,n,o);s.t=i}return r.j[t]=s,s}};const Ie=(t,e,n,o,r)=>t.ta(e,n,o,r),Ye=(t,e,n,o,r)=>t.tr(e,n,o,r),sm=(t,e,n,o,r)=>t.ts(e,n,o,r),re=(t,e,n,o,r)=>t.tt(e,n,o,r),On="WORD",rc="UWORD",am="ASCIINUMERICAL",lm="ALPHANUMERICAL",Wr="LOCALHOST",ic="TLD",sc="UTLD",fs="SCHEME",Qo="SLASH_SCHEME",ac="NUM",lc="WS",cc="NL",Gr="OPENBRACE",qr="CLOSEBRACE",ps="OPENBRACKET",hs="CLOSEBRACKET",ms="OPENPAREN",gs="CLOSEPAREN",bs="OPENANGLEBRACKET",ys="CLOSEANGLEBRACKET",xs="FULLWIDTHLEFTPAREN",Es="FULLWIDTHRIGHTPAREN",ks="LEFTCORNERBRACKET",ws="RIGHTCORNERBRACKET",Ss="LEFTWHITECORNERBRACKET",Ns="RIGHTWHITECORNERBRACKET",Cs="FULLWIDTHLESSTHAN",vs="FULLWIDTHGREATERTHAN",Ts="AMPERSAND",zs="APOSTROPHE",_s="ASTERISK",so="AT",As="BACKSLASH",Ms="BACKTICK",Is="CARET",ao="COLON",dc="COMMA",Os="DOLLAR",gn="DOT",Ds="EQUALS",uc="EXCLAMATION",Jt="HYPHEN",Kr="PERCENT",Rs="PIPE",Ps="PLUS",Ls="POUND",Jr="QUERY",fc="QUOTE",cm="FULLWIDTHMIDDLEDOT",pc="SEMI",bn="SLASH",Xr="TILDE",$s="UNDERSCORE",dm="EMOJI",Vs="SYM";var um=Object.freeze({__proto__:null,ALPHANUMERICAL:lm,AMPERSAND:Ts,APOSTROPHE:zs,ASCIINUMERICAL:am,ASTERISK:_s,AT:so,BACKSLASH:As,BACKTICK:Ms,CARET:Is,CLOSEANGLEBRACKET:ys,CLOSEBRACE:qr,CLOSEBRACKET:hs,CLOSEPAREN:gs,COLON:ao,COMMA:dc,DOLLAR:Os,DOT:gn,EMOJI:dm,EQUALS:Ds,EXCLAMATION:uc,FULLWIDTHGREATERTHAN:vs,FULLWIDTHLEFTPAREN:xs,FULLWIDTHLESSTHAN:Cs,FULLWIDTHMIDDLEDOT:cm,FULLWIDTHRIGHTPAREN:Es,HYPHEN:Jt,LEFTCORNERBRACKET:ks,LEFTWHITECORNERBRACKET:Ss,LOCALHOST:Wr,NL:cc,NUM:ac,OPENANGLEBRACKET:bs,OPENBRACE:Gr,OPENBRACKET:ps,OPENPAREN:ms,PERCENT:Kr,PIPE:Rs,PLUS:Ps,POUND:Ls,QUERY:Jr,QUOTE:fc,RIGHTCORNERBRACKET:ws,RIGHTWHITECORNERBRACKET:Ns,SCHEME:fs,SEMI:pc,SLASH:bn,SLASH_SCHEME:Qo,SYM:Vs,TILDE:Xr,TLD:ic,UNDERSCORE:$s,UTLD:sc,UWORD:rc,WORD:On,WS:lc});const Dn=/[a-z]/,Yr=new RegExp("\\p{L}","u"),hc=new RegExp("\\p{Emoji}","u"),Rn=/\d/,mc=/\s/,fm="\r",gc=`
463
- `,KS="️",JS="‍",bc="";let Bs=null,Fs=null;function XS(t=[]){const e={};Pt.groups=e;const n=new Pt;Bs==null&&(Bs=hm(jS)),Fs==null&&(Fs=hm(US)),re(n,"'",zs),re(n,"{",Gr),re(n,"}",qr),re(n,"[",ps),re(n,"]",hs),re(n,"(",ms),re(n,")",gs),re(n,"<",bs),re(n,">",ys),re(n,"(",xs),re(n,")",Es),re(n,"「",ks),re(n,"」",ws),re(n,"『",Ss),re(n,"』",Ns),re(n,"<",Cs),re(n,">",vs),re(n,"&",Ts),re(n,"*",_s),re(n,"@",so),re(n,"`",Ms),re(n,"^",Is),re(n,":",ao),re(n,",",dc),re(n,"$",Os),re(n,".",gn),re(n,"=",Ds),re(n,"!",uc),re(n,"-",Jt),re(n,"%",Kr),re(n,"|",Rs),re(n,"+",Ps),re(n,"#",Ls),re(n,"?",Jr),re(n,'"',fc),re(n,"/",bn),re(n,";",pc),re(n,"~",Xr),re(n,"_",$s),re(n,"\\",As),re(n,"・",cm);const o=Ye(n,Rn,ac,{[Zl]:!0});Ye(o,Rn,o);const r=Ye(o,Dn,am,{[Ur]:!0}),i=Ye(o,Yr,lm,{[Hr]:!0}),s=Ye(n,Dn,On,{[ec]:!0});Ye(s,Rn,r),Ye(s,Dn,s),Ye(r,Rn,r),Ye(r,Dn,r);const l=Ye(n,Yr,rc,{[tc]:!0});Ye(l,Dn),Ye(l,Rn,i),Ye(l,Yr,l),Ye(i,Rn,i),Ye(i,Dn),Ye(i,Yr,i);const c=re(n,gc,cc,{[oc]:!0}),d=re(n,fm,lc,{[oc]:!0}),u=Ye(n,mc,lc,{[oc]:!0});re(n,bc,u),re(d,gc,c),re(d,bc,u),Ye(d,mc,u),re(u,fm),re(u,gc),Ye(u,mc,u),re(u,bc,u);const f=Ye(n,hc,dm,{[im]:!0});re(f,"#"),Ye(f,hc,f),re(f,KS,f);const p=re(f,JS);re(p,"#"),Ye(p,hc,f);const h=[[Dn,s],[Rn,r]],m=[[Dn,null],[Yr,l],[Rn,i]];for(let b=0;b<Bs.length;b++)lo(n,Bs[b],ic,On,h);for(let b=0;b<Fs.length;b++)lo(n,Fs[b],sc,rc,m);_o(ic,{tld:!0,ascii:!0},e),_o(sc,{utld:!0,alpha:!0},e),lo(n,"file",fs,On,h),lo(n,"mailto",fs,On,h),lo(n,"http",Qo,On,h),lo(n,"https",Qo,On,h),lo(n,"ftp",Qo,On,h),lo(n,"ftps",Qo,On,h),_o(fs,{scheme:!0,ascii:!0},e),_o(Qo,{slashscheme:!0,ascii:!0},e),t=t.sort((b,g)=>b[0]>g[0]?1:-1);for(let b=0;b<t.length;b++){const g=t[b][0],v=t[b][1]?{[HS]:!0}:{[WS]:!0};g.indexOf("-")>=0?v[nc]=!0:Dn.test(g)?Rn.test(g)?v[Ur]=!0:v[ec]=!0:v[Zl]=!0,sm(n,g,g,v)}return sm(n,"localhost",Wr,{ascii:!0}),n.jd=new Pt(Vs),{start:n,tokens:Object.assign({groups:e},um)}}function pm(t,e){const n=YS(e.replace(/[A-Z]/g,l=>l.toLowerCase())),o=n.length,r=[];let i=0,s=0;for(;s<o;){let l=t,c=null,d=0,u=null,f=-1,p=-1;for(;s<o&&(c=l.go(n[s]));)l=c,l.accepts()?(f=0,p=0,u=l):f>=0&&(f+=n[s].length,p++),d+=n[s].length,i+=n[s].length,s++;i-=f,s-=p,d-=f,r.push({t:u.t,v:e.slice(i-d,i),s:i-d,e:i})}return r}function YS(t){const e=[],n=t.length;let o=0;for(;o<n;){let r=t.charCodeAt(o),i,s=r<55296||r>56319||o+1===n||(i=t.charCodeAt(o+1))<56320||i>57343?t[o]:t.slice(o,o+2);e.push(s),o+=s.length}return e}function lo(t,e,n,o,r){let i;const s=e.length;for(let l=0;l<s-1;l++){const c=e[l];t.j[c]?i=t.j[c]:(i=new Pt(o),i.jr=r.slice(),t.j[c]=i),t=i}return i=new Pt(n),i.jr=r.slice(),t.j[e[s-1]]=i,i}function hm(t){const e=[],n=[];let o=0,r="0123456789";for(;o<t.length;){let i=0;for(;r.indexOf(t[o+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(o,o+i),10);s>0;s--)n.pop();o+=i}else n.push(t[o]),o++}return e}const Qr={defaultProtocol:"http",events:null,format:mm,formatHref:mm,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function yc(t,e=null){let n=Object.assign({},Qr);t&&(n=Object.assign(n,t instanceof yc?t.o:t));const o=n.ignoreTags,r=[];for(let i=0;i<o.length;i++)r.push(o[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=r}yc.prototype={o:Qr,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const o=e!=null;let r=this.o[t];return r&&(typeof r=="object"?(r=n.t in r?r[n.t]:Qr[t],typeof r=="function"&&o&&(r=r(e,n))):typeof r=="function"&&o&&(r=r(e,n.t,n)),r)},getObj(t,e,n){let o=this.o[t];return typeof o=="function"&&e!=null&&(o=o(e,n.t,n)),o},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function mm(t){return t}function gm(t,e){this.t="token",this.v=t,this.tk=e}gm.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),o=t.get("format",e,this);return n&&o.length>n?o.substring(0,n)+"…":o},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Qr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),o=t.get("formatHref",n,this),r=t.get("tagName",n,e),i=this.toFormattedString(t),s={},l=t.get("className",n,e),c=t.get("target",n,e),d=t.get("rel",n,e),u=t.getObj("attributes",n,e),f=t.getObj("events",n,e);return s.href=o,l&&(s.class=l),c&&(s.target=c),d&&(s.rel=d),u&&Object.assign(s,u),{tagName:r,attributes:s,content:i,eventListeners:f}}};function js(t,e){class n extends gm{constructor(r,i){super(r,i),this.t=t}}for(const o in e)n.prototype[o]=e[o];return n.t=t,n}const bm=js("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ym=js("text"),QS=js("nl"),Us=js("url",{isLink:!0,toHref(t=Qr.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Wr&&t[1].t===ao}}),Xt=t=>new Pt(t);function ZS({groups:t}){const e=t.domain.concat([Ts,_s,so,As,Ms,Is,Os,Ds,Jt,ac,Kr,Rs,Ps,Ls,bn,Vs,Xr,$s]),n=[zs,ao,dc,gn,uc,Kr,Jr,fc,pc,bs,ys,Gr,qr,hs,ps,ms,gs,xs,Es,ks,ws,Ss,Ns,Cs,vs],o=[Ts,zs,_s,As,Ms,Is,Os,Ds,Jt,Gr,qr,Kr,Rs,Ps,Ls,Jr,bn,Vs,Xr,$s],r=Xt(),i=re(r,Xr);Ie(i,o,i),Ie(i,t.domain,i);const s=Xt(),l=Xt(),c=Xt();Ie(r,t.domain,s),Ie(r,t.scheme,l),Ie(r,t.slashscheme,c),Ie(s,o,i),Ie(s,t.domain,s);const d=re(s,so);re(i,so,d),re(l,so,d),re(c,so,d);const u=re(i,gn);Ie(u,o,i),Ie(u,t.domain,i);const f=Xt();Ie(d,t.domain,f),Ie(f,t.domain,f);const p=re(f,gn);Ie(p,t.domain,f);const h=Xt(bm);Ie(p,t.tld,h),Ie(p,t.utld,h),re(d,Wr,h);const m=re(f,Jt);re(m,Jt,m),Ie(m,t.domain,f),Ie(h,t.domain,f),re(h,gn,p),re(h,Jt,m);const b=re(h,ao);Ie(b,t.numeric,bm);const g=re(s,Jt),x=re(s,gn);re(g,Jt,g),Ie(g,t.domain,s),Ie(x,o,i),Ie(x,t.domain,s);const v=Xt(Us);Ie(x,t.tld,v),Ie(x,t.utld,v),Ie(v,t.domain,s),Ie(v,o,i),re(v,gn,x),re(v,Jt,g),re(v,so,d);const w=re(v,ao),T=Xt(Us);Ie(w,t.numeric,T);const M=Xt(Us),A=Xt();Ie(M,e,M),Ie(M,n,A),Ie(A,e,M),Ie(A,n,A),re(v,bn,M),re(T,bn,M);const y=re(l,ao),E=re(c,ao),k=re(E,bn),O=re(k,bn);Ie(l,t.domain,s),re(l,gn,x),re(l,Jt,g),Ie(c,t.domain,s),re(c,gn,x),re(c,Jt,g),Ie(y,t.domain,M),re(y,bn,M),re(y,Jr,M),Ie(O,t.domain,M),Ie(O,e,M),re(O,bn,M);const G=[[Gr,qr],[ps,hs],[ms,gs],[bs,ys],[xs,Es],[ks,ws],[Ss,Ns],[Cs,vs]];for(let z=0;z<G.length;z++){const[R,W]=G[z],H=re(M,R);re(A,R,H),re(H,W,M);const L=Xt(Us);Ie(H,e,L);const j=Xt();Ie(H,n),Ie(L,e,L),Ie(L,n,j),Ie(j,e,L),Ie(j,n,j),re(L,W,M),re(j,W,M)}return re(r,Wr,v),re(r,cc,QS),{start:r,tokens:um}}function eN(t,e,n){let o=n.length,r=0,i=[],s=[];for(;r<o;){let l=t,c=null,d=null,u=0,f=null,p=-1;for(;r<o&&!(c=l.go(n[r].t));)s.push(n[r++]);for(;r<o&&(d=c||l.go(n[r].t));)c=null,l=d,l.accepts()?(p=0,f=l):p>=0&&p++,r++,u++;if(p<0)r-=u,r<o&&(s.push(n[r]),r++);else{s.length>0&&(i.push(xc(ym,e,s)),s=[]),r-=p,u-=p;const h=f.t,m=n.slice(r-u,r);i.push(xc(h,e,m))}}return s.length>0&&i.push(xc(ym,e,s)),i}function xc(t,e,n){const o=n[0].s,r=n[n.length-1].e,i=e.slice(o,r);return new t(i,n)}const tN=typeof console<"u"&&console&&console.warn||(()=>{}),nN="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",We={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function oN(){return Pt.groups={},We.scanner=null,We.parser=null,We.tokenQueue=[],We.pluginQueue=[],We.customSchemes=[],We.initialized=!1,We}function xm(t,e=!1){if(We.initialized&&tN(`linkifyjs: already initialized - will not register custom scheme "${t}" ${nN}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
458
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:o})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:r,storedMarks:i}=t;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=o.extensionManager,c=i||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:u})=>{if(u&&c&&s){const f=c.filter(p=>l.includes(p.type.name));d.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Tw=Nw;const vw="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",zw="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Ol="numeric",Dl="ascii",Rl="alpha",_r="asciinumeric",Or="alphanumeric",Pl="domain",Sh="emoji",Mw="scheme",Aw="slashscheme",Ll="whitespace";function Iw(n,e){return n in e||(e[n]=[]),e[n]}function wo(n,e,t){e[Ol]&&(e[_r]=!0,e[Or]=!0),e[Dl]&&(e[_r]=!0,e[Rl]=!0),e[_r]&&(e[Or]=!0),e[Rl]&&(e[Or]=!0),e[Or]&&(e[Pl]=!0),e[Sh]&&(e[Pl]=!0);for(const o in e){const r=Iw(o,t);r.indexOf(n)<0&&r.push(n)}}function _w(n,e){const t={};for(const o in e)e[o].indexOf(n)>=0&&(t[o]=!0);return t}function _t(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}_t.groups={},_t.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let o=0;o<e.jr.length;o++){const r=e.jr[o][0],i=e.jr[o][1];if(i&&r.test(n))return i}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,o){for(let r=0;r<n.length;r++)this.tt(n[r],e,t,o)},tr(n,e,t,o){o=o||_t.groups;let r;return e&&e.j?r=e:(r=new _t(e),t&&o&&wo(e,t,o)),this.jr.push([n,r]),r},ts(n,e,t,o){let r=this;const i=n.length;if(!i)return r;for(let s=0;s<i-1;s++)r=r.tt(n[s]);return r.tt(n[i-1],e,t,o)},tt(n,e,t,o){o=o||_t.groups;const r=this;if(e&&e.j)return r.j[n]=e,e;const i=e;let s,l=r.go(n);if(l?(s=new _t,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new _t,i){if(o)if(s.t&&typeof s.t=="string"){const c=Object.assign(_w(s.t,o),t);wo(i,c,o)}else t&&wo(i,t,o);s.t=i}return r.j[n]=s,s}};const Ie=(n,e,t,o,r)=>n.ta(e,t,o,r),Xe=(n,e,t,o,r)=>n.tr(e,t,o,r),Ch=(n,e,t,o,r)=>n.ts(e,t,o,r),ie=(n,e,t,o,r)=>n.tt(e,t,o,r),Tn="WORD",$l="UWORD",Nh="ASCIINUMERICAL",Th="ALPHANUMERICAL",Dr="LOCALHOST",Vl="TLD",Bl="UTLD",Yi="SCHEME",Uo="SLASH_SCHEME",Fl="NUM",jl="WS",Hl="NL",Rr="OPENBRACE",Pr="CLOSEBRACE",Qi="OPENBRACKET",Zi="CLOSEBRACKET",es="OPENPAREN",ts="CLOSEPAREN",ns="OPENANGLEBRACKET",rs="CLOSEANGLEBRACKET",is="FULLWIDTHLEFTPAREN",ss="FULLWIDTHRIGHTPAREN",as="LEFTCORNERBRACKET",ls="RIGHTCORNERBRACKET",cs="LEFTWHITECORNERBRACKET",ds="RIGHTWHITECORNERBRACKET",us="FULLWIDTHLESSTHAN",fs="FULLWIDTHGREATERTHAN",ps="AMPERSAND",hs="APOSTROPHE",ms="ASTERISK",to="AT",gs="BACKSLASH",ys="BACKTICK",bs="CARET",no="COLON",Ul="COMMA",xs="DOLLAR",cn="DOT",ks="EQUALS",Wl="EXCLAMATION",jt="HYPHEN",Lr="PERCENT",Es="PIPE",ws="PLUS",Ss="POUND",$r="QUERY",ql="QUOTE",vh="FULLWIDTHMIDDLEDOT",Gl="SEMI",dn="SLASH",Vr="TILDE",Cs="UNDERSCORE",zh="EMOJI",Ns="SYM";var Mh=Object.freeze({__proto__:null,ALPHANUMERICAL:Th,AMPERSAND:ps,APOSTROPHE:hs,ASCIINUMERICAL:Nh,ASTERISK:ms,AT:to,BACKSLASH:gs,BACKTICK:ys,CARET:bs,CLOSEANGLEBRACKET:rs,CLOSEBRACE:Pr,CLOSEBRACKET:Zi,CLOSEPAREN:ts,COLON:no,COMMA:Ul,DOLLAR:xs,DOT:cn,EMOJI:zh,EQUALS:ks,EXCLAMATION:Wl,FULLWIDTHGREATERTHAN:fs,FULLWIDTHLEFTPAREN:is,FULLWIDTHLESSTHAN:us,FULLWIDTHMIDDLEDOT:vh,FULLWIDTHRIGHTPAREN:ss,HYPHEN:jt,LEFTCORNERBRACKET:as,LEFTWHITECORNERBRACKET:cs,LOCALHOST:Dr,NL:Hl,NUM:Fl,OPENANGLEBRACKET:ns,OPENBRACE:Rr,OPENBRACKET:Qi,OPENPAREN:es,PERCENT:Lr,PIPE:Es,PLUS:ws,POUND:Ss,QUERY:$r,QUOTE:ql,RIGHTCORNERBRACKET:ls,RIGHTWHITECORNERBRACKET:ds,SCHEME:Yi,SEMI:Gl,SLASH:dn,SLASH_SCHEME:Uo,SYM:Ns,TILDE:Vr,TLD:Vl,UNDERSCORE:Cs,UTLD:Bl,UWORD:$l,WORD:Tn,WS:jl});const vn=/[a-z]/,Br=new RegExp("\\p{L}","u"),Kl=new RegExp("\\p{Emoji}","u"),zn=/\d/,Jl=/\s/,Ah="\r",Xl=`
459
+ `,Ow="️",Dw="‍",Yl="";let Ts=null,vs=null;function Rw(n=[]){const e={};_t.groups=e;const t=new _t;Ts==null&&(Ts=_h(vw)),vs==null&&(vs=_h(zw)),ie(t,"'",hs),ie(t,"{",Rr),ie(t,"}",Pr),ie(t,"[",Qi),ie(t,"]",Zi),ie(t,"(",es),ie(t,")",ts),ie(t,"<",ns),ie(t,">",rs),ie(t,"(",is),ie(t,")",ss),ie(t,"「",as),ie(t,"」",ls),ie(t,"『",cs),ie(t,"』",ds),ie(t,"<",us),ie(t,">",fs),ie(t,"&",ps),ie(t,"*",ms),ie(t,"@",to),ie(t,"`",ys),ie(t,"^",bs),ie(t,":",no),ie(t,",",Ul),ie(t,"$",xs),ie(t,".",cn),ie(t,"=",ks),ie(t,"!",Wl),ie(t,"-",jt),ie(t,"%",Lr),ie(t,"|",Es),ie(t,"+",ws),ie(t,"#",Ss),ie(t,"?",$r),ie(t,'"',ql),ie(t,"/",dn),ie(t,";",Gl),ie(t,"~",Vr),ie(t,"_",Cs),ie(t,"\\",gs),ie(t,"・",vh);const o=Xe(t,zn,Fl,{[Ol]:!0});Xe(o,zn,o);const r=Xe(o,vn,Nh,{[_r]:!0}),i=Xe(o,Br,Th,{[Or]:!0}),s=Xe(t,vn,Tn,{[Dl]:!0});Xe(s,zn,r),Xe(s,vn,s),Xe(r,zn,r),Xe(r,vn,r);const l=Xe(t,Br,$l,{[Rl]:!0});Xe(l,vn),Xe(l,zn,i),Xe(l,Br,l),Xe(i,zn,i),Xe(i,vn),Xe(i,Br,i);const c=ie(t,Xl,Hl,{[Ll]:!0}),d=ie(t,Ah,jl,{[Ll]:!0}),u=Xe(t,Jl,jl,{[Ll]:!0});ie(t,Yl,u),ie(d,Xl,c),ie(d,Yl,u),Xe(d,Jl,u),ie(u,Ah),ie(u,Xl),Xe(u,Jl,u),ie(u,Yl,u);const f=Xe(t,Kl,zh,{[Sh]:!0});ie(f,"#"),Xe(f,Kl,f),ie(f,Ow,f);const p=ie(f,Dw);ie(p,"#"),Xe(p,Kl,f);const h=[[vn,s],[zn,r]],m=[[vn,null],[Br,l],[zn,i]];for(let y=0;y<Ts.length;y++)oo(t,Ts[y],Vl,Tn,h);for(let y=0;y<vs.length;y++)oo(t,vs[y],Bl,$l,m);wo(Vl,{tld:!0,ascii:!0},e),wo(Bl,{utld:!0,alpha:!0},e),oo(t,"file",Yi,Tn,h),oo(t,"mailto",Yi,Tn,h),oo(t,"http",Uo,Tn,h),oo(t,"https",Uo,Tn,h),oo(t,"ftp",Uo,Tn,h),oo(t,"ftps",Uo,Tn,h),wo(Yi,{scheme:!0,ascii:!0},e),wo(Uo,{slashscheme:!0,ascii:!0},e),n=n.sort((y,g)=>y[0]>g[0]?1:-1);for(let y=0;y<n.length;y++){const g=n[y][0],M=n[y][1]?{[Mw]:!0}:{[Aw]:!0};g.indexOf("-")>=0?M[Pl]=!0:vn.test(g)?zn.test(g)?M[_r]=!0:M[Dl]=!0:M[Ol]=!0,Ch(t,g,g,M)}return Ch(t,"localhost",Dr,{ascii:!0}),t.jd=new _t(Ns),{start:t,tokens:Object.assign({groups:e},Mh)}}function Ih(n,e){const t=Pw(e.replace(/[A-Z]/g,l=>l.toLowerCase())),o=t.length,r=[];let i=0,s=0;for(;s<o;){let l=n,c=null,d=0,u=null,f=-1,p=-1;for(;s<o&&(c=l.go(t[s]));)l=c,l.accepts()?(f=0,p=0,u=l):f>=0&&(f+=t[s].length,p++),d+=t[s].length,i+=t[s].length,s++;i-=f,s-=p,d-=f,r.push({t:u.t,v:e.slice(i-d,i),s:i-d,e:i})}return r}function Pw(n){const e=[],t=n.length;let o=0;for(;o<t;){let r=n.charCodeAt(o),i,s=r<55296||r>56319||o+1===t||(i=n.charCodeAt(o+1))<56320||i>57343?n[o]:n.slice(o,o+2);e.push(s),o+=s.length}return e}function oo(n,e,t,o,r){let i;const s=e.length;for(let l=0;l<s-1;l++){const c=e[l];n.j[c]?i=n.j[c]:(i=new _t(o),i.jr=r.slice(),n.j[c]=i),n=i}return i=new _t(t),i.jr=r.slice(),n.j[e[s-1]]=i,i}function _h(n){const e=[],t=[];let o=0,r="0123456789";for(;o<n.length;){let i=0;for(;r.indexOf(n[o+i])>=0;)i++;if(i>0){e.push(t.join(""));for(let s=parseInt(n.substring(o,o+i),10);s>0;s--)t.pop();o+=i}else t.push(n[o]),o++}return e}const Fr={defaultProtocol:"http",events:null,format:Oh,formatHref:Oh,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ql(n,e=null){let t=Object.assign({},Fr);n&&(t=Object.assign(t,n instanceof Ql?n.o:n));const o=t.ignoreTags,r=[];for(let i=0;i<o.length;i++)r.push(o[i].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=r}Ql.prototype={o:Fr,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const o=e!=null;let r=this.o[n];return r&&(typeof r=="object"?(r=t.t in r?r[t.t]:Fr[n],typeof r=="function"&&o&&(r=r(e,t))):typeof r=="function"&&o&&(r=r(e,t.t,t)),r)},getObj(n,e,t){let o=this.o[n];return typeof o=="function"&&e!=null&&(o=o(e,t.t,t)),o},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function Oh(n){return n}function Dh(n,e){this.t="token",this.v=n,this.tk=e}Dh.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),o=n.get("format",e,this);return t&&o.length>t?o.substring(0,t)+"…":o},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=Fr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),o=n.get("formatHref",t,this),r=n.get("tagName",t,e),i=this.toFormattedString(n),s={},l=n.get("className",t,e),c=n.get("target",t,e),d=n.get("rel",t,e),u=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return s.href=o,l&&(s.class=l),c&&(s.target=c),d&&(s.rel=d),u&&Object.assign(s,u),{tagName:r,attributes:s,content:i,eventListeners:f}}};function zs(n,e){class t extends Dh{constructor(r,i){super(r,i),this.t=n}}for(const o in e)t.prototype[o]=e[o];return t.t=n,t}const Rh=zs("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Ph=zs("text"),Lw=zs("nl"),Ms=zs("url",{isLink:!0,toHref(n=Fr.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Dr&&n[1].t===no}}),Ht=n=>new _t(n);function $w({groups:n}){const e=n.domain.concat([ps,ms,to,gs,ys,bs,xs,ks,jt,Fl,Lr,Es,ws,Ss,dn,Ns,Vr,Cs]),t=[hs,no,Ul,cn,Wl,Lr,$r,ql,Gl,ns,rs,Rr,Pr,Zi,Qi,es,ts,is,ss,as,ls,cs,ds,us,fs],o=[ps,hs,ms,gs,ys,bs,xs,ks,jt,Rr,Pr,Lr,Es,ws,Ss,$r,dn,Ns,Vr,Cs],r=Ht(),i=ie(r,Vr);Ie(i,o,i),Ie(i,n.domain,i);const s=Ht(),l=Ht(),c=Ht();Ie(r,n.domain,s),Ie(r,n.scheme,l),Ie(r,n.slashscheme,c),Ie(s,o,i),Ie(s,n.domain,s);const d=ie(s,to);ie(i,to,d),ie(l,to,d),ie(c,to,d);const u=ie(i,cn);Ie(u,o,i),Ie(u,n.domain,i);const f=Ht();Ie(d,n.domain,f),Ie(f,n.domain,f);const p=ie(f,cn);Ie(p,n.domain,f);const h=Ht(Rh);Ie(p,n.tld,h),Ie(p,n.utld,h),ie(d,Dr,h);const m=ie(f,jt);ie(m,jt,m),Ie(m,n.domain,f),Ie(h,n.domain,f),ie(h,cn,p),ie(h,jt,m);const y=ie(h,no);Ie(y,n.numeric,Rh);const g=ie(s,jt),x=ie(s,cn);ie(g,jt,g),Ie(g,n.domain,s),Ie(x,o,i),Ie(x,n.domain,s);const M=Ht(Ms);Ie(x,n.tld,M),Ie(x,n.utld,M),Ie(M,n.domain,s),Ie(M,o,i),ie(M,cn,x),ie(M,jt,g),ie(M,to,d);const E=ie(M,no),v=Ht(Ms);Ie(E,n.numeric,v);const _=Ht(Ms),A=Ht();Ie(_,e,_),Ie(_,t,A),Ie(A,e,_),Ie(A,t,A),ie(M,dn,_),ie(v,dn,_);const b=ie(l,no),k=ie(c,no),w=ie(k,dn),O=ie(w,dn);Ie(l,n.domain,s),ie(l,cn,x),ie(l,jt,g),Ie(c,n.domain,s),ie(c,cn,x),ie(c,jt,g),Ie(b,n.domain,_),ie(b,dn,_),ie(b,$r,_),Ie(O,n.domain,_),Ie(O,e,_),ie(O,dn,_);const q=[[Rr,Pr],[Qi,Zi],[es,ts],[ns,rs],[is,ss],[as,ls],[cs,ds],[us,fs]];for(let T=0;T<q.length;T++){const[R,H]=q[T],F=ie(_,R);ie(A,R,F),ie(F,H,_);const L=Ht(Ms);Ie(F,e,L);const B=Ht();Ie(F,t),Ie(L,e,L),Ie(L,t,B),Ie(B,e,L),Ie(B,t,B),ie(L,H,_),ie(B,H,_)}return ie(r,Dr,M),ie(r,Hl,Lw),{start:r,tokens:Mh}}function Vw(n,e,t){let o=t.length,r=0,i=[],s=[];for(;r<o;){let l=n,c=null,d=null,u=0,f=null,p=-1;for(;r<o&&!(c=l.go(t[r].t));)s.push(t[r++]);for(;r<o&&(d=c||l.go(t[r].t));)c=null,l=d,l.accepts()?(p=0,f=l):p>=0&&p++,r++,u++;if(p<0)r-=u,r<o&&(s.push(t[r]),r++);else{s.length>0&&(i.push(Zl(Ph,e,s)),s=[]),r-=p,u-=p;const h=f.t,m=t.slice(r-u,r);i.push(Zl(h,e,m))}}return s.length>0&&i.push(Zl(Ph,e,s)),i}function Zl(n,e,t){const o=t[0].s,r=t[t.length-1].e,i=e.slice(o,r);return new n(i,t)}const Bw=typeof console<"u"&&console&&console.warn||(()=>{}),Fw="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",We={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function jw(){return _t.groups={},We.scanner=null,We.parser=null,We.tokenQueue=[],We.pluginQueue=[],We.customSchemes=[],We.initialized=!1,We}function Lh(n,e=!1){if(We.initialized&&Bw(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Fw}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
464
460
  1. Must only contain digits, lowercase ASCII letters or "-"
465
461
  2. Cannot start or end with "-"
466
- 3. "-" cannot repeat`);We.customSchemes.push([t,e])}function rN(){We.scanner=XS(We.customSchemes);for(let t=0;t<We.tokenQueue.length;t++)We.tokenQueue[t][1]({scanner:We.scanner});We.parser=ZS(We.scanner.tokens);for(let t=0;t<We.pluginQueue.length;t++)We.pluginQueue[t][1]({scanner:We.scanner,parser:We.parser});return We.initialized=!0,We}function Ec(t){return We.initialized||rN(),eN(We.parser.start,t,pm(We.scanner.start,t))}Ec.scan=pm;function Em(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const o=new yc(n),r=Ec(t),i=[];for(let s=0;s<r.length;s++){const l=r[s];l.isLink&&(!e||l.t===e)&&o.check(l)&&i.push(l.toFormattedObject(o))}return i}var kc="[\0-   ᠎ -\u2029  ]",iN=new RegExp(kc),sN=new RegExp(`${kc}$`),aN=new RegExp(kc,"g");function lN(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function cN(t){return new Ot({key:new an("autolink"),appendTransaction:(e,n,o)=>{const r=e.some(d=>d.docChanged)&&!n.doc.eq(o.doc),i=e.some(d=>d.getMeta("preventAutolink"));if(!r||i)return;const{tr:s}=o,l=mh(n.doc,[...e]);if(Ch(l).forEach(({newRange:d})=>{const u=qk(o.doc,d,h=>h.isTextblock);let f,p;if(u.length>1)f=u[0],p=o.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const h=o.doc.textBetween(d.from,d.to," "," ");if(!sN.test(h))return;f=u[0],p=o.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&p){const h=p.split(iN).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],b=f.pos+p.lastIndexOf(m);if(!m)return!1;const g=Ec(m).map(x=>x.toObject(t.defaultProtocol));if(!lN(g))return!1;g.filter(x=>x.isLink).map(x=>({...x,from:b+x.start+1,to:b+x.end+1})).filter(x=>o.schema.marks.code?!o.doc.rangeHasMark(x.from,x.to,o.schema.marks.code):!0).filter(x=>t.validate(x.value)).filter(x=>t.shouldAutoLink(x.value)).forEach(x=>{Bl(x.from,x.to,o.doc).some(v=>v.mark.type===t.type)||s.addMark(x.from,x.to,t.type.create({href:x.href}))})}}),!!s.steps.length)return s}})}function dN(t){return new Ot({key:new an("handleClickLink"),props:{handleClick:(e,n,o)=>{var r,i;if(o.button!==0||!e.editable)return!1;let s=!1;if(t.enableClickSelection&&(s=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){let l=null;if(o.target instanceof HTMLAnchorElement)l=o.target;else{let f=o.target;const p=[];for(;f.nodeName!=="DIV";)p.push(f),f=f.parentNode;l=p.find(h=>h.nodeName==="A")}if(!l)return s;const c=Nh(e.state,t.type.name),d=(r=l?.href)!=null?r:c.href,u=(i=l?.target)!=null?i:c.target;l&&d&&(window.open(d,u),s=!0)}return s}}})}function uN(t){return new Ot({key:new an("handlePasteLink"),props:{handlePaste:(e,n,o)=>{const{shouldAutoLink:r}=t,{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let c="";o.content.forEach(u=>{c+=u.textContent});const d=Em(c,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===c);return!c||!d||r!==void 0&&!r(d.value)?!1:t.editor.commands.setMark(t.type,{href:d.href})}}})}function Ao(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(o=>{const r=typeof o=="string"?o:o.scheme;r&&n.push(r)}),!t||t.replace(aN,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var fN=Vr.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){xm(t);return}xm(t.scheme,t.optionalSlashes)})},onDestroy(){oN()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Ao(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const r=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Ao(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Ao(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Rt(this.options.HTMLAttributes,t),0]:["a",Rt(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n;const o=((n=t.attrs)==null?void 0:n.href)||"";return`[${e.renderChildren(t)}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:o=>!!Ao(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:o=>!!Ao(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Yo({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:o}=this.options,r=Em(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Ao(s,n),protocols:n,defaultProtocol:o}));r.length&&r.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(cN({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!Ao(r,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(dN({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(uN({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),pN=fN;const hN={class:"zcode-rich-text-editor"},mN={key:0,class:"zcode-rich-text-toolbar"},gN=a.defineComponent({__name:"RichTextEditor",props:{modelValue:{type:String},placeholder:{type:String}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=e,r=tS({extensions:[oS,iS,aS,pS,xS,SS,LS,$S,VS,FS,pN.configure({openOnClick:!1,HTMLAttributes:{class:"zcode-link"}})],content:n.modelValue||"",editorProps:{attributes:{class:"zcode-tiptap-editor","data-placeholder":n.placeholder||"テキストを入力..."}},onUpdate:({editor:s})=>{const l=s.getHTML();o("update:modelValue",l)}});a.watch(()=>n.modelValue,s=>{r.value&&r.value.getHTML()!==s&&r.value.commands.setContent(s||"")});const i=()=>{if(!r.value)return;const s=r.value.getAttributes("link").href,l=window.prompt("URLを入力してください",s);if(l!==null){if(l===""){r.value.chain().focus().extendMarkRange("link").unsetLink().run();return}r.value.chain().focus().extendMarkRange("link").setLink({href:l}).run()}};return a.onUnmounted(()=>{r.value&&r.value.destroy()}),(s,l)=>(a.openBlock(),a.createElementBlock("div",hN,[a.unref(r)?(a.openBlock(),a.createElementBlock("div",mN,[a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("bold")},"zcode-toolbar-btn"]),title:"太字",onClick:l[0]||(l[0]=c=>a.unref(r).chain().focus().toggleBold().run())},[a.createVNode(a.unref(Jm),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("italic")},"zcode-toolbar-btn"]),title:"斜体",onClick:l[1]||(l[1]=c=>a.unref(r).chain().focus().toggleItalic().run())},[a.createVNode(a.unref(Zm),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("strike")},"zcode-toolbar-btn"]),title:"取り消し線",onClick:l[2]||(l[2]=c=>a.unref(r).chain().focus().toggleStrike().run())},[a.createVNode(a.unref(rg),{size:16})],2),l[5]||(l[5]=a.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("bulletList")},"zcode-toolbar-btn"]),title:"箇条書き",onClick:l[3]||(l[3]=c=>a.unref(r).chain().focus().toggleBulletList().run())},[a.createVNode(a.unref(ng),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("orderedList")},"zcode-toolbar-btn"]),title:"番号付きリスト",onClick:l[4]||(l[4]=c=>a.unref(r).chain().focus().toggleOrderedList().run())},[a.createVNode(a.unref(tg),{size:16})],2),l[6]||(l[6]=a.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("link")},"zcode-toolbar-btn"]),title:"リンク",onClick:i},[a.createVNode(a.unref(eg),{size:16})],2)])):a.createCommentVNode("",!0),a.createVNode(a.unref(eS),{editor:a.unref(r),class:"zcode-rich-text-editor-content"},null,8,["editor"])]))}}),bN={class:"zcode-image-modal-header"},yN={class:"zcode-image-modal-header-title",role:"heading","aria-level":"3"},xN=["aria-label"],EN={key:0,class:"zcode-image-current"},kN={class:"zcode-image-current-title",role:"heading","aria-level":"4"},wN={class:"zcode-image-current-item"},SN=["src","alt"],NN={class:"zcode-image-current-name"},CN={class:"zcode-image-tabs"},vN={class:"zcode-image-grid"},TN=["onClick"],zN=["src","alt"],_N={class:"zcode-image-name"},AN={class:"zcode-image-add"},MN={class:"zcode-image-modal-actions"},IN=a.defineComponent({__name:"ImageSelectModal",props:{isOpen:{type:Boolean},imagesCommon:{type:Array},imagesIndividual:{type:Array},imagesSpecial:{type:Array},currentValue:{type:String}},emits:["update:model-value","add-image","delete-image","close"],setup(t,{emit:e}){const{t:n}=rn(),o=t,r=e,i=a.ref("common"),s=a.ref(null),l=a.ref(o.currentValue||null),c=a.computed(()=>i.value==="common"?o.imagesCommon:i.value==="individual"?o.imagesIndividual:o.imagesSpecial),d=()=>o.currentValue&&[...o.imagesCommon,...o.imagesIndividual,...o.imagesSpecial].find(g=>g.id===o.currentValue)||null,u=b=>{l.value=b.id},f=()=>{l.value&&(r("update:model-value",l.value),m())},p=()=>{l.value&&confirm(n("imagesManager.deleteImageFromModalConfirm"))&&(r("delete-image",l.value),l.value=null)},h=b=>{const x=b.target.files?.[0];if(!x)return;const v=new FileReader;v.onload=w=>{const T=w.target?.result,M={id:`img-${Date.now()}`,name:x.name,url:T,mimeType:x.type,needsUpload:!0},A=i.value==="common"?"common":i.value==="individual"?"individual":"special";r("add-image",M,A),l.value=M.id},v.readAsDataURL(x)},m=()=>{r("close")};return(b,g)=>t.isOpen?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:a.withModifiers(m,["self"])},[a.createElementVNode("div",{class:"zcode-image-modal-content",onClick:g[4]||(g[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",bN,[a.createElementVNode("div",yN,a.toDisplayString(b.$t("imagesManager.selectImage")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":b.$t("common.close"),onClick:m},[a.createVNode(a.unref(Qe),{size:18})],8,xN)]),t.currentValue&&d()?(a.openBlock(),a.createElementBlock("div",EN,[a.createElementVNode("div",kN,a.toDisplayString(b.$t("imagesManager.currentlySelected")),1),a.createElementVNode("div",wN,[a.createElementVNode("img",{src:d()?.url,alt:d()?.name||"",class:"zcode-image-current-item-img"},null,8,SN),a.createElementVNode("div",NN,a.toDisplayString(d()?.name),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",CN,[a.createElementVNode("button",{class:a.normalizeClass([{active:i.value==="common"},"zcode-image-tab"]),onClick:g[0]||(g[0]=x=>i.value="common")},a.toDisplayString(b.$t("dataViewer.common")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:i.value==="individual"},"zcode-image-tab"]),onClick:g[1]||(g[1]=x=>i.value="individual")},a.toDisplayString(b.$t("dataViewer.individual")),3),t.imagesSpecial.length>0?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass([{active:i.value==="special"},"zcode-image-tab"]),onClick:g[2]||(g[2]=x=>i.value="special")},a.toDisplayString(b.$t("dataViewer.special")),3)):a.createCommentVNode("",!0)]),a.createElementVNode("div",vN,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(c.value,x=>(a.openBlock(),a.createElementBlock("div",{key:x.id,class:a.normalizeClass([{selected:l.value===x.id},"zcode-image-item"]),onClick:v=>u(x)},[a.createElementVNode("img",{src:x.url,alt:x.name,class:"zcode-image-item-img"},null,8,zN),a.createElementVNode("div",_N,a.toDisplayString(x.name),1)],10,TN))),128))]),a.createElementVNode("div",AN,[a.createElementVNode("input",{ref_key:"fileInput",ref:s,type:"file",accept:"image/*",style:{display:"none"},onChange:h},null,544),a.createElementVNode("button",{class:"zcode-image-add-btn",onClick:g[3]||(g[3]=x=>s.value?.click())},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(b.$t("imagesManager.addImage")),1)])]),a.createElementVNode("div",MN,[l.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-btn-primary zcode-image-modal-actions-btn",onClick:f},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(b.$t("imagesManager.select")),1)])):a.createCommentVNode("",!0),l.value?(a.openBlock(),a.createElementBlock("button",{key:1,class:"zcode-btn-danger zcode-image-modal-actions-btn",onClick:p},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(b.$t("common.delete")),1)])):a.createCommentVNode("",!0)])])])):a.createCommentVNode("",!0)}}),ON={class:"zcode-edit-panel-header"},DN={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},RN=["aria-label"],PN={key:0,class:"zcode-parent-selector"},LN={key:1,class:"zcode-group-tabs"},$N=["onClick"],VN={key:2,class:"zcode-field-editor"},BN={class:"zcode-field-item-title",role:"heading","aria-level":"4"},FN={key:0,class:"zcode-text-editor"},jN=["value","placeholder","maxlength","readonly","disabled","onInput"],UN={key:0,class:"zcode-field-error-message"},HN={key:1,class:"zcode-field-counter"},WN={key:1,class:"zcode-text-editor"},GN=["value","placeholder","maxlength","readonly","disabled","onInput"],qN={key:0,class:"zcode-field-error-message"},KN={key:1,class:"zcode-field-counter"},JN={key:2,class:"zcode-rich-text-editor-wrapper"},XN={key:0,class:"zcode-field-error-message"},YN={key:3,class:"zcode-radio-editor"},QN={class:"zcode-radio-group"},ZN=["onUpdate:modelValue","name","value","onChange"],eC={class:"zcode-radio-item-label"},tC={key:4,class:"zcode-checkbox-editor"},nC={class:"zcode-checkbox-group"},oC=["onUpdate:modelValue","value","onChange"],rC={class:"zcode-checkbox-item-label"},iC={key:5,class:"zcode-select-editor"},sC=["onUpdate:modelValue","onChange"],aC=["value"],lC={key:6,class:"zcode-select-editor"},cC=["onUpdate:modelValue","size","onChange"],dC=["value"],uC={key:7,class:"zcode-tag-editor"},fC=["onUpdate:modelValue","onChange"],pC=["value"],hC={class:"zcode-tag-preview"},mC={key:8,class:"zcode-boolean-editor"},gC={class:"zcode-checkbox-item"},bC=["onUpdate:modelValue","onChange"],yC={class:"zcode-checkbox-item-label"},xC={key:9,class:"zcode-image-editor"},EC={class:"zcode-image-editor-buttons"},kC=["onClick"],wC=["title","onClick"],SC={key:0,class:"zcode-image-preview"},NC=["src","alt"],CC={key:3,class:"zcode-edit-fields"},vC={class:"zcode-edit-fields-text"},TC={class:"zcode-edit-fields-text"},zC=a.defineComponent({__name:"EditPanel",props:{editingComponent:{type:[Object,null]},editingAvailableFields:{type:Array},fieldErrors:{type:Object},currentMode:{type:String},canSelectParent:{type:Boolean},imagesCommon:{type:Array},imagesIndividual:{type:Array},imagesSpecial:{type:Array}},emits:["close","select-parent","save-field","add-image","delete-image"],setup(t,{emit:e}){const n=t,o=a.ref("all"),r=a.computed(()=>{const y=new Map;return n.editingAvailableFields.forEach(E=>{const k=E.groupName||"other";y.set(k,(y.get(k)||0)+1)}),Array.from(y.entries()).map(([E,k])=>({name:E,count:k}))}),i=a.computed(()=>r.value.length>1),s=a.computed(()=>!i.value||o.value==="all"?n.editingAvailableFields:n.editingAvailableFields.filter(y=>(y.groupName||"other")===o.value));a.watch(()=>i.value,y=>{y?o.value="all":o.value=void 0},{immediate:!0}),a.watch(()=>n.editingAvailableFields,()=>{if(i.value){if(o.value==="all")return;r.value.some(E=>E.name===o.value)||(o.value="all")}},{deep:!0});const l=e,c=a.ref({});function d(y){const E=y.label||y.fieldName,k=y.currentValue,O=y.type==="rich"&&typeof k=="string"&&k.trim()==="<p></p>"?"":k??"";return y.required&&(O===""||O===void 0||O===null)?`${E}は必須です`:typeof y.maxLength=="number"&&y.maxLength>0&&String(O).length>y.maxLength?`${E}は${y.maxLength}文字以内で入力してください`:null}function u(y,E){E?c.value[y]=E:delete c.value[y]}function f(y){return c.value[y]||n.fieldErrors?.[y]||null}const p=a.ref(!1),h=a.ref(null),m=y=>{h.value=y,p.value=!0},b=()=>{p.value=!1,h.value=null},g=y=>{y.currentValue="",l("save-field",y)},x=y=>{h.value&&(h.value.currentValue=y||"",l("save-field",h.value))},v=(y,E)=>{l("add-image",y,E)},w=y=>{l("delete-image",y),h.value?.currentValue===y&&(h.value.currentValue="",l("save-field",h.value))},T=y=>y&&[...n.imagesCommon,...n.imagesIndividual,...n.imagesSpecial].find(O=>O.id===y)?.url||null,M=(y,E)=>{const k=E.target;y.currentValue=k.value,u(y.fieldName,d(y)),l("save-field",y)},A=(y,E)=>{y.optional&&E===""?y.currentValue=void 0:y.currentValue=E,u(y.fieldName,d(y)),l("save-field",y)};return(y,E)=>t.editingComponent&&t.currentMode==="edit"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-edit-panel",onClick:E[3]||(E[3]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",ON,[a.createElementVNode("div",DN,a.toDisplayString(y.$t("editPanel.editing",{type:t.editingComponent.type})),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":y.$t("common.close"),onClick:E[0]||(E[0]=k=>y.$emit("close"))},[a.createVNode(a.unref(Qe),{size:18})],8,RN)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",PN,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:E[1]||(E[1]=k=>y.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(y.$t("addPanel.selectParent")),1)])])):a.createCommentVNode("",!0),i.value?(a.openBlock(),a.createElementBlock("div",LN,[a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="all"},"zcode-group-tab"]),onClick:E[2]||(E[2]=k=>o.value="all")}," all ",2),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,k=>(a.openBlock(),a.createElementBlock("button",{key:k.name,class:a.normalizeClass([{active:o.value===k.name},"zcode-group-tab"]),onClick:O=>o.value=k.name},a.toDisplayString(k.name),11,$N))),128))])):a.createCommentVNode("",!0),s.value.length>0?(a.openBlock(),a.createElementBlock("div",VN,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.value,k=>(a.openBlock(),a.createElementBlock("div",{key:k.fieldName,class:"zcode-field-item"},[a.createElementVNode("div",BN,a.toDisplayString(k.label),1),k.type==="text"?(a.openBlock(),a.createElementBlock("div",FN,[a.createElementVNode("input",{type:"text",value:k.currentValue??"",placeholder:k.defaultValue,maxlength:k.maxLength,readonly:k.readonly,disabled:k.disabled,class:a.normalizeClass([{"zcode-field-error":f(k.fieldName)},"zcode-text-input"]),onInput:O=>M(k,O)},null,42,jN),f(k.fieldName)?(a.openBlock(),a.createElementBlock("div",UN,a.toDisplayString(f(k.fieldName)),1)):a.createCommentVNode("",!0),k.maxLength?(a.openBlock(),a.createElementBlock("div",HN,a.toDisplayString(String(k.currentValue??"").length)+" / "+a.toDisplayString(k.maxLength),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),k.type==="textarea"?(a.openBlock(),a.createElementBlock("div",WN,[a.createElementVNode("textarea",{value:k.currentValue??"",placeholder:k.defaultValue,maxlength:k.maxLength,readonly:k.readonly,disabled:k.disabled,class:a.normalizeClass([{"zcode-field-error":f(k.fieldName)},"zcode-textarea"]),rows:"4",onInput:O=>M(k,O)},null,42,GN),f(k.fieldName)?(a.openBlock(),a.createElementBlock("div",qN,a.toDisplayString(f(k.fieldName)),1)):a.createCommentVNode("",!0),k.maxLength?(a.openBlock(),a.createElementBlock("div",KN,a.toDisplayString(String(k.currentValue??"").length)+" / "+a.toDisplayString(k.maxLength),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),k.type==="rich"?(a.openBlock(),a.createElementBlock("div",JN,[a.createVNode(gN,{"model-value":k.currentValue??"",placeholder:k.defaultValue,"onUpdate:modelValue":O=>A(k,O)},null,8,["model-value","placeholder","onUpdate:modelValue"]),f(k.fieldName)?(a.openBlock(),a.createElementBlock("div",XN,a.toDisplayString(f(k.fieldName)),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),k.type==="radio"?(a.openBlock(),a.createElementBlock("div",YN,[a.createElementVNode("div",QN,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(k.options,O=>(a.openBlock(),a.createElementBlock("label",{key:O,class:"zcode-radio-item"},[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":G=>k.currentValue=G,type:"radio",name:k.fieldName,value:O,onChange:G=>y.$emit("save-field",k)},null,40,ZN),[[a.vModelRadio,k.currentValue]]),a.createElementVNode("span",eC,a.toDisplayString(O),1)]))),128))])])):a.createCommentVNode("",!0),k.type==="checkbox"?(a.openBlock(),a.createElementBlock("div",tC,[a.createElementVNode("div",nC,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(k.options,O=>(a.openBlock(),a.createElementBlock("label",{key:O,class:"zcode-checkbox-item"},[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":G=>k.currentValue=G,type:"checkbox",value:O,onChange:G=>y.$emit("save-field",k)},null,40,oC),[[a.vModelCheckbox,k.currentValue]]),a.createElementVNode("span",rC,a.toDisplayString(O),1)]))),128))])])):a.createCommentVNode("",!0),k.type==="select"?(a.openBlock(),a.createElementBlock("div",iC,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":O=>k.currentValue=O,class:"zcode-select",onChange:O=>y.$emit("save-field",k)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(k.options,O=>(a.openBlock(),a.createElementBlock("option",{key:O,value:O},a.toDisplayString(O),9,aC))),128))],40,sC),[[a.vModelSelect,k.currentValue]])])):a.createCommentVNode("",!0),k.type==="select-multiple"?(a.openBlock(),a.createElementBlock("div",lC,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":O=>k.currentValue=O,class:"zcode-select",multiple:"",size:Math.min(k.options?.length||3,5),onChange:O=>y.$emit("save-field",k)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(k.options,O=>(a.openBlock(),a.createElementBlock("option",{key:O,value:O},a.toDisplayString(O),9,dC))),128))],40,cC),[[a.vModelSelect,k.currentValue]])])):a.createCommentVNode("",!0),k.type==="tag"?(a.openBlock(),a.createElementBlock("div",uC,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":O=>k.currentValue=O,class:"zcode-select",onChange:O=>y.$emit("save-field",k)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(k.options,O=>(a.openBlock(),a.createElementBlock("option",{key:O,value:O},a.toDisplayString(O),9,pC))),128))],40,fC),[[a.vModelSelect,k.currentValue]]),a.createElementVNode("div",hC,[E[4]||(E[4]=a.createTextVNode(" 現在のタグ: ",-1)),a.createElementVNode("code",null,"<"+a.toDisplayString(k.currentValue)+">",1)])])):a.createCommentVNode("",!0),k.type==="boolean"?(a.openBlock(),a.createElementBlock("div",mC,[a.createElementVNode("label",gC,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":O=>k.currentValue=O,type:"checkbox",onChange:O=>y.$emit("save-field",k)},null,40,bC),[[a.vModelCheckbox,k.currentValue]]),a.createElementVNode("span",yC,a.toDisplayString(k.label)+"を表示",1)])])):a.createCommentVNode("",!0),k.type==="image"?(a.openBlock(),a.createElementBlock("div",xC,[a.createElementVNode("div",EC,[a.createElementVNode("button",{class:"zcode-image-select-btn",onClick:O=>m(k)},[a.createVNode(a.unref(Rc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(k.currentValue?y.$t("editPanel.replaceImage"):y.$t("editPanel.selectImage")),1)],8,kC),k.currentValue?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-image-clear-btn",title:y.$t("editPanel.clearImageTitle"),onClick:O=>g(k)},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(y.$t("editPanel.clearImage")),1)],8,wC)):a.createCommentVNode("",!0)]),T(k.currentValue)?(a.openBlock(),a.createElementBlock("div",SC,[a.createElementVNode("img",{src:T(k.currentValue)||"",alt:k.label,class:"zcode-image-preview-img"},null,8,NC)])):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)]))),128))])):!i.value||s.value.length===0?(a.openBlock(),a.createElementBlock("div",CC,[a.createElementVNode("div",vC,a.toDisplayString(y.$t("editPanel.id",{id:t.editingComponent.id})),1),a.createElementVNode("div",TC," Type: "+a.toDisplayString(t.editingComponent.type),1)])):a.createCommentVNode("",!0),a.createVNode(IN,{"is-open":p.value,"images-common":t.imagesCommon,"images-individual":t.imagesIndividual,"images-special":t.imagesSpecial,"current-value":h.value?.currentValue||void 0,"onUpdate:modelValue":x,onAddImage:v,onDeleteImage:w,onClose:b},null,8,["is-open","images-common","images-individual","images-special","current-value"])])):a.createCommentVNode("",!0)}}),_C={class:"zcode-delete-panel-header"},AC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},MC=["aria-label"],IC={key:0,class:"zcode-parent-selector"},OC={class:"zcode-delete-panel-content"},DC={class:"zcode-delete-warning"},RC={class:"zcode-delete-warning-text"},PC={class:"zcode-delete-actions"},LC=a.defineComponent({__name:"DeletePanel",props:{deleteConfirmComponent:{type:[Object,null]},currentMode:{type:String},canSelectParent:{type:Boolean}},emits:["confirm","cancel","select-parent"],setup(t){return(e,n)=>t.deleteConfirmComponent&&t.currentMode==="delete"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-delete-panel",onClick:n[4]||(n[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",_C,[a.createElementVNode("div",AC,a.toDisplayString(e.$t("deletePanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:n[0]||(n[0]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:18})],8,MC)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",IC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:n[1]||(n[1]=o=>e.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("deletePanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",OC,[a.createElementVNode("div",DC,[a.createVNode(a.unref(Vc),{size:20,class:"zcode-delete-warning-icon"}),a.createElementVNode("div",RC,a.toDisplayString(e.$t("deletePanel.confirmMessage")),1)]),a.createElementVNode("div",PC,[a.createElementVNode("button",{class:"zcode-btn-danger",onClick:n[2]||(n[2]=o=>e.$emit("confirm"))},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("common.delete")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel",onClick:n[3]||(n[3]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)}}),$C={class:"zcode-reorder-panel-header"},VC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},BC=["aria-label"],FC={key:0,class:"zcode-parent-selector"},jC={class:"zcode-reorder-panel-content"},UC={class:"zcode-reorder-panel-content-text"},HC={class:"zcode-reorder-source"},WC=a.defineComponent({__name:"ReorderPanel",props:{reorderSourcePath:{type:String},currentMode:{type:String},canSelectParent:{type:Boolean}},emits:["cancel","select-parent"],setup(t){return(e,n)=>t.reorderSourcePath&&t.currentMode==="reorder"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-reorder-panel",onClick:n[2]||(n[2]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",$C,[a.createElementVNode("div",VC,a.toDisplayString(e.$t("reorderPanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:n[0]||(n[0]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:18})],8,BC)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",FC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:n[1]||(n[1]=o=>e.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("reorderPanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",jC,[a.createElementVNode("div",UC,a.toDisplayString(e.$t("reorderPanel.instruction")),1),a.createElementVNode("div",HC,a.toDisplayString(e.$t("reorderPanel.source",{path:t.reorderSourcePath})),1)])])):a.createCommentVNode("",!0)}}),GC={class:"zcode-add-panel-header"},qC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},KC=["aria-label"],JC={key:0,class:"zcode-parent-selector"},XC={class:"zcode-part-category-tabs"},YC=["onClick"],QC={key:1,class:"zcode-type-tabs"},ZC=["onClick"],ev={class:"zcode-add-panel-content"},tv={class:"zcode-part-list"},nv={class:"zcode-part-type-section"},ov={class:"zcode-type-section-title",role:"heading","aria-level":"3"},rv={class:"zcode-type-section-description"},iv={key:0,class:"zcode-module-buttons"},sv={class:"zcode-module-preview-header"},av={class:"zcode-module-preview-label zcode-module-preview-label-header"},lv=["aria-label"],cv=["innerHTML"],dv={key:1,class:"zcode-empty-parts"},uv={class:"zcode-empty-parts-text"},fv={class:"zcode-type-section-title",role:"heading","aria-level":"3"},pv={key:0,class:"zcode-type-section-description"},hv={class:"zcode-module-buttons"},mv=["onClick"],gv={class:"zcode-module-preview-header"},bv={class:"zcode-module-preview-label zcode-module-preview-label-header"},yv=["aria-label","onClick"],xv=["innerHTML"],Ev={key:0,class:"zcode-empty-parts"},kv={class:"zcode-empty-parts-text"},wv={key:2,class:"zcode-insert-position"},Sv={class:"zcode-insert-header"},Nv={class:"zcode-keep-adding-label zcode-keep-adding-label-position"},Cv=["checked"],vv={class:"zcode-insert-buttons"},Tv={class:"zcode-preview-modal-header"},zv={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},_v=["innerHTML"],Av=a.defineComponent({__name:"AddPanel",props:{addTargetPath:{type:[String,null]},addPartCategory:{type:String},addTypeTab:{type:[String,null]},addSelectedPart:{type:[Object,null]},addSelectedType:{type:[Object,null]},clickedComponent:{type:[Object,null]},availablePartTypes:{type:Array},groupedPartsByType:{type:Array},canSelectParent:{type:Boolean},getPartPreviewHtml:{type:Function},getClickedComponentPreviewHtml:{type:Function},keepAdding:{type:Boolean},hasSpecialParts:{type:Boolean},config:{type:Object}},emits:["cancel","select-parent","category-tab-click","type-tab-click","select-part","confirm-add","update-keep-adding"],setup(t){const e=t,n=a.computed(()=>e.config?.categoryOrder||"common"),o=a.computed(()=>{const d=[];return n.value==="individual"?(d.push("individual","common"),e.hasSpecialParts&&d.push("special")):n.value==="special"?(e.hasSpecialParts&&d.push("special"),d.push("common","individual")):(d.push("common","individual"),e.hasSpecialParts&&d.push("special")),d}),r=a.ref(!1),i=a.ref(null);function s(d,u){i.value={type:d,part:u,isActiveParts:!1},r.value=!0}function l(){e.addSelectedType&&e.addSelectedPart&&(i.value={type:e.addSelectedType,part:e.addSelectedPart,isActiveParts:!0},r.value=!0)}function c(){r.value=!1,i.value=null}return(d,u)=>t.addTargetPath?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-add-panel",onClick:u[9]||(u[9]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",GC,[a.createElementVNode("div",qC,a.toDisplayString(d.$t("addPanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":d.$t("common.close"),onClick:u[0]||(u[0]=f=>d.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:18})],8,KC)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",JC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:u[1]||(u[1]=f=>d.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(d.$t("addPanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",XC,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.value,f=>(a.openBlock(),a.createElementBlock("button",{key:f,class:a.normalizeClass([{active:t.addPartCategory===f&&t.addTypeTab!=="selected"},"zcode-category-tab"]),onClick:p=>d.$emit("category-tab-click",f)},a.toDisplayString(f==="common"?d.$t("addPanel.category.common"):f==="individual"?d.$t("addPanel.category.individual"):d.$t("dataViewer.special")),11,YC))),128)),a.createElementVNode("button",{class:a.normalizeClass([{active:t.addTypeTab==="selected"},"zcode-category-tab"]),onClick:u[2]||(u[2]=f=>d.$emit("type-tab-click","selected"))},a.toDisplayString(d.$t("addPanel.category.selected")),3)]),t.availablePartTypes.length>0&&t.addTypeTab!=="selected"?(a.openBlock(),a.createElementBlock("div",QC,[a.createElementVNode("button",{class:a.normalizeClass([{active:t.addTypeTab==="all"},"zcode-type-tab"]),onClick:u[3]||(u[3]=f=>d.$emit("type-tab-click","all"))}," all ",2),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.availablePartTypes,f=>(a.openBlock(),a.createElementBlock("button",{key:f,class:a.normalizeClass([{active:t.addTypeTab===f},"zcode-type-tab"]),onClick:p=>d.$emit("type-tab-click",f)},a.toDisplayString(f),11,ZC))),128))])):a.createCommentVNode("",!0),a.createElementVNode("div",ev,[a.createElementVNode("div",tv,[a.withDirectives(a.createElementVNode("div",nv,[a.createElementVNode("div",ov,a.toDisplayString(d.$t("addPanel.activeParts")),1),a.createElementVNode("div",rv,a.toDisplayString(d.$t("addPanel.activePartsDescription")),1),t.clickedComponent&&t.addSelectedPart&&t.addSelectedType?(a.openBlock(),a.createElementBlock("div",iv,[a.createElementVNode("div",{class:a.normalizeClass([{active:!0},"zcode-module-preview"])},[a.createElementVNode("div",sv,[a.createElementVNode("div",av,a.toDisplayString(d.$t("addPanel.activeParts")),1),a.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:u[4]||(u[4]=a.withModifiers(f=>l(),["stop"]))},[a.createVNode(a.unref(Bc),{size:14})],8,lv)]),a.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:t.getClickedComponentPreviewHtml()},null,8,cv)])])):(a.openBlock(),a.createElementBlock("div",dv,[a.createElementVNode("div",uv,a.toDisplayString(d.$t("addPanel.clickPartInPreview")),1)]))],512),[[a.vShow,t.addTypeTab==="selected"]]),a.withDirectives(a.createElementVNode("div",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.groupedPartsByType,f=>(a.openBlock(),a.createElementBlock("div",{key:f.type,class:"zcode-part-type-section"},[a.createElementVNode("div",fv,a.toDisplayString(f.type),1),f.description?(a.openBlock(),a.createElementBlock("div",pv,a.toDisplayString(f.description),1)):a.createCommentVNode("",!0),a.createElementVNode("div",hv,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(f.parts,p=>(a.openBlock(),a.createElementBlock("div",{key:p.title,class:a.normalizeClass([{active:t.addTypeTab==="selected"&&t.clickedComponent?.part_id===p.id&&t.clickedComponent?.id?!0:t.addTypeTab!=="selected"&&t.addSelectedPart?.id===p.id},"zcode-module-preview"]),onClick:h=>d.$emit("select-part",f.typeData,p)},[a.createElementVNode("div",gv,[a.createElementVNode("div",bv,a.toDisplayString(p.title),1),a.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:a.withModifiers(h=>s(f.typeData,p),["stop"])},[a.createVNode(a.unref(Bc),{size:14})],8,yv)]),a.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:t.getPartPreviewHtml(f.typeData,p)},null,8,xv)],10,mv))),128))])]))),128)),t.groupedPartsByType.length===0&&!t.addSelectedPart?(a.openBlock(),a.createElementBlock("div",Ev,[a.createElementVNode("div",kv,a.toDisplayString(d.$t("addPanel.noPartsAvailable")),1)])):a.createCommentVNode("",!0)],512),[[a.vShow,t.addTypeTab!=="selected"]])])]),t.addSelectedPart?(a.openBlock(),a.createElementBlock("div",wv,[a.createElementVNode("div",Sv,[u[10]||(u[10]=a.createElementVNode("div",{class:"zcode-insert-position-title",role:"heading","aria-level":"4"}," 追加位置を選択 ",-1)),a.createElementVNode("label",Nv,[a.createElementVNode("input",{type:"checkbox",checked:t.keepAdding,class:"zcode-keep-adding-checkbox",onChange:u[5]||(u[5]=f=>d.$emit("update-keep-adding",f.target.checked))},null,40,Cv),a.createElementVNode("span",null,a.toDisplayString(d.$t("addPanel.continueAdding")),1)])]),a.createElementVNode("div",vv,[a.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-before",onClick:u[6]||(u[6]=f=>d.$emit("confirm-add","before"))},a.toDisplayString(d.$t("addPanel.addBefore")),1),a.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-after",onClick:u[7]||(u[7]=f=>d.$emit("confirm-add","after"))},a.toDisplayString(d.$t("addPanel.addAfter")),1)])])):a.createCommentVNode("",!0),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[r.value&&i.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:c},[a.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:u[8]||(u[8]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",Tv,[a.createElementVNode("div",zv,a.toDisplayString(d.$t("common.preview"))+": "+a.toDisplayString(i.value.isActiveParts?d.$t("addPanel.activeParts"):i.value.part.title),1),a.createElementVNode("button",{class:"zcode-close-btn",onClick:c},[a.createVNode(a.unref(Qe),{size:18})])]),a.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:i.value.isActiveParts?t.getClickedComponentPreviewHtml():t.getPartPreviewHtml(i.value.type,i.value.part)},null,8,_v)])])):a.createCommentVNode("",!0)]))])):a.createCommentVNode("",!0)}}),Mv=a.defineComponent({__name:"ContextMenu",props:{isVisible:{type:Boolean},position:{type:Object},currentMode:{type:String}},emits:["select-mode","close"],setup(t,{emit:e}){const n=e;function o(i){n("select-mode",i),n("close")}function r(){n("close")}return(i,s)=>t.isVisible?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-context-menu",style:a.normalizeStyle({left:`${t.position.x}px`,top:`${t.position.y}px`}),onClick:s[4]||(s[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="edit"}]),onClick:s[0]||(s[0]=l=>o("edit"))},[a.createVNode(a.unref(Pc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.edit")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="add"}]),onClick:s[1]||(s[1]=l=>o("add"))},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.add")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="reorder"}]),onClick:s[2]||(s[2]=l=>o("reorder"))},[a.createVNode(a.unref(ir),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.reorder")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="delete"}]),onClick:s[3]||(s[3]=l=>o("delete"))},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.delete")),1)],2),s[5]||(s[5]=a.createElementVNode("div",{class:"zcode-context-menu-divider"},null,-1)),a.createElementVNode("button",{class:"zcode-context-menu-item",onClick:r},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.close")),1)])],4)):a.createCommentVNode("",!0)}});function Iv(t){if(t.defaultValue!==void 0&&t.defaultValue!=="")switch(t.type){case"rich":return`<p>${t.defaultValue}</p>`;case"image":return t.defaultValue;default:return t.defaultValue}switch(t.type){case"text":case"textarea":return"";case"rich":return"<p></p>";case"radio":case"select":return t.options?.[0]||"";case"checkbox":case"select-multiple":return[];case"boolean":return!0;case"image":return"";default:return""}}function Ov(t,e){const n=ha(t.part_id,e);if(!n)return;Fn(n.body).forEach(r=>{r.optional||t[r.fieldName]===void 0&&(t[r.fieldName]=Iv(r))})}function Dv(t){function e(n){Ov(n,t.parts),n.slots&&Object.values(n.slots).forEach(o=>{(Array.isArray(o)?o:o?.children||[]).forEach(i=>{e(i)})})}t.page.forEach(n=>{e(n)})}function km(t){const e=a.reactive({page:[],css:{common:void 0,individual:void 0,special:void 0},parts:{common:[],individual:[],special:[]},images:{common:[],individual:[],special:[]},backendData:void 0});function n(){try{const i=t.page?JSON.parse(t.page):[],s=t.partsCommon?JSON.parse(t.partsCommon):[],l=t.partsIndividual?JSON.parse(t.partsIndividual):[],c=t.partsSpecial?JSON.parse(t.partsSpecial):[],d=t.imagesCommon?JSON.parse(t.imagesCommon):[],u=t.imagesIndividual?JSON.parse(t.imagesIndividual):[],f=t.imagesSpecial?JSON.parse(t.imagesSpecial):[],p=t.cssCommon!==void 0?t.cssCommon:void 0,h=t.cssIndividual!==void 0?t.cssIndividual:void 0,m=t.cssSpecial!==void 0?t.cssSpecial:void 0,b=t.backendData?JSON.parse(t.backendData):void 0;Object.assign(e,{page:i,css:{common:p,individual:h,special:m},parts:{common:s,individual:l,special:c},images:{common:d,individual:u,special:f},backendData:b}),Dv(e)}catch(i){console.error("Failed to parse props:",i)}}function o(i){if(!i)return e;const s=i.split(".");let l=e;for(const c of s)if(l==null||typeof l!="object"||(l=l[c],l===void 0))return;return l}function r(i,s){if(typeof i=="string"){const l=i.split(".");let c=e;for(let d=0;d<l.length-1;d++){const u=c[l[d]];if(u==null||typeof u!="object")return;c=u}c[l[l.length-1]]=s}else Object.assign(e,i)}return{cmsData:e,loadDataFromProps:n,getData:o,setData:r}}function Rv(){const t=a.ref("edit"),e=a.ref(!1);function n(o){t.value=o}return{currentMode:t,switchMode:n,allowDynamicContentInteraction:e}}function wm(t){const e=document.documentElement,o={edit:"--zcode-color-edit",add:"--zcode-color-add",reorder:"--zcode-color-reorder",delete:"--zcode-color-delete"}[t]||"--zcode-color-edit";return getComputedStyle(e).getPropertyValue(o).trim()||"#3b82f6"}function Yt(t,e){const n=wm(e);t.classList.remove("zcode-outline-active-edit","zcode-outline-active-add","zcode-outline-active-reorder","zcode-outline-active-delete"),t.classList.add(`zcode-outline-active-${e}`),t.style.outlineColor=n,t.style.outlineStyle="solid"}function Qt(t){t.style.outline="",t.style.outlineOffset="",t.classList.remove("zcode-outline-active-edit","zcode-outline-active-add","zcode-outline-active-reorder","zcode-outline-active-delete")}function wc(t,e){const n=wm(e);t.style.outline=`2px dashed ${n}`,t.style.outlineOffset="2px"}function yn(t){t.style.outline="",t.style.outlineOffset=""}function Pv(t,e){const n=a.ref(null),o=a.ref(-1),r=a.ref(""),i=a.ref([]);function s(u){const f=u.part_id,p=t.parts,h=[...p.common,...p.individual];let m=null;for(const g of h){const x=g.parts.find(v=>v.id===f);if(x){m=x;break}}return m?Fn(m.body).map(g=>{const x={fieldName:g.fieldName,groupName:g.groupName,label:Pg(g.fieldName),required:g.required,maxLength:g.maxLength,readonly:g.readonly,disabled:g.disabled};if(g.type==="text")return{...x,type:"text",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue};if(g.type==="textarea")return{...x,type:"textarea",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="rich")return{...x,type:"rich",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="radio")return{...x,type:"radio",options:g.options,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.options?.[0]};if(g.type==="boolean")return{...x,type:"boolean",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:!0};if(g.type==="image")return{...x,type:"image",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="select")return{...x,type:"select",options:g.options,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.options?.[0]};if(g.type==="select-multiple")return{...x,type:"select-multiple",options:g.options,optional:g.optional,currentValue:Array.isArray(u[g.fieldName])?u[g.fieldName]:[]};if(g.type==="tag"){const v=["h1","h2","h3","h4","h5","h6","div","p","span","li","ul","ol","section","article","aside","nav","header","footer","main","figure","figcaption","blockquote","pre","code","table","thead","tbody","tr","th","td"],w=g.options||v;return{...x,type:"tag",options:w,defaultValue:g.defaultValue||"div",currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.defaultValue||"div"}}else return{...x,type:"checkbox",options:g.options,optional:g.optional,currentValue:Array.isArray(u[g.fieldName])?u[g.fieldName]:[]}}):[]}function l(u,f){if(r.value===u){d();return}const p=u.split(".");let h=-1;if(p[0]==="page"&&p.length>=2&&(h=parseInt(p[1])),r.value&&e.value){const m=e.value.querySelector(`[data-zcode-path="${r.value}"]`);m&&Qt(m)}n.value=f,o.value=h,r.value=u,i.value=s(f),a.nextTick(()=>{if(e.value&&r.value===u){const m=e.value.querySelector(`[data-zcode-path="${u}"]`);m&&(Yt(m,"edit"),ar(m))}})}function c(u){if(n.value&&r.value){const f=dn(r.value,t);f&&(u.optional&&(u.currentValue===""||u.currentValue===null)?f[u.fieldName]=void 0:f[u.fieldName]=u.currentValue)}}function d(){if(r.value&&e.value){const u=e.value.querySelector(`[data-zcode-path="${r.value}"]`);u&&Qt(u)}n.value=null,r.value="",i.value=[]}return{editingComponent:n,editingComponentIndex:o,editingComponentPath:r,editingAvailableFields:i,handleEditClick:l,saveFieldEdit:c,closeEditPanel:d}}function Lv(t,e,n,o){const r=a.ref(null),i=a.ref(null),s=a.ref(null),l=a.ref(o?.categoryOrder==="individual"?"individual":o?.categoryOrder==="special"?"special":"common"),c=a.ref("all"),d=a.ref(null),u=a.ref(!1);function f(z){if(z.includes(".slots.")){const R=z.split(".");let W=-1;for(let H=R.length-1;H>=0;H--)if(R[H]==="slots"){W=H;break}if(W!==-1&&W+1<R.length)return R.slice(0,W+2).join(".")}return z}const p=a.computed(()=>{const z=t.parts,R=l.value==="common"?z.common:l.value==="individual"?z.individual:z.special;if(r.value&&r.value.includes(".slots.")){const H=[...z.common,...z.individual,...z.special],L=f(r.value);return b(L,H,R)}return[...new Set(R.map(H=>H.type))]});function h(z,R){const W=z.split(".");let H=-1;for(let Y=W.length-1;Y>=0;Y--)if(W[Y]==="slots"){H=Y;break}if(H===-1)return null;const L=W.slice(0,H).join("."),j=W[H+1],Z=dn(L,t);if(!Z)return null;const K=Z.part_id;let ae=null;for(const Y of R)if(Y.parts.some(J=>J.id===K)){ae=Y;break}if(!ae)return null;const X=(ae.parts.find(Y=>Y.id===K)||ae.parts[0])?.slots?.[j];if(X){const Y=X.allowedParts;if(Y&&Array.isArray(Y))return Y}return null}const m=a.computed(()=>{const z=t.parts,R=l.value==="common"?z.common:l.value==="individual"?z.individual:z.special,W=p.value;let H=R.filter(K=>W.includes(K.type));c.value&&c.value!=="all"&&c.value!=="selected"&&(H=H.filter(K=>K.type===c.value));const L=[...z.common,...z.individual],j=r.value&&r.value.includes(".slots.")?h(f(r.value),L):null,Z=new Map;return H.forEach(K=>{Z.has(K.type)||Z.set(K.type,{type:K,parts:[]});const ae=Z.get(K.type);j!==null?j.length>0&&K.parts.forEach(ee=>{j.includes(ee.id)&&ae.parts.push(ee)}):K.parts.forEach(ee=>{ee.slotOnly||ae.parts.push(ee)})}),Array.from(Z.values()).map(K=>({type:K.type.type,description:K.type.description,typeData:K.type,parts:K.parts}))});function b(z,R,W){const H=z.split(".");let L=-1;for(let J=H.length-1;J>=0;J--)if(H[J]==="slots"){L=J;break}if(L===-1)return[...new Set(W.map(J=>J.type))];const j=H.slice(0,L).join("."),Z=H[L+1],K=dn(j,t);if(!K)return[...new Set(W.map(J=>J.type))];const ae=K.part_id;let ee=null,X=null;for(const J of R){const Q=J.parts.find(de=>de.id===ae);if(Q){ee=J,X=Q;break}}if(!ee||!X)return[...new Set(W.map(J=>J.type))];const Y=X?.slots?.[Z];if(Y){const J=Y.allowedParts;if(J&&Array.isArray(J)){const Q=new Set;R.forEach(ke=>{ke.parts.forEach(Te=>{J.includes(Te.id)&&Q.add(ke.type)})});let de=Array.from(Q);return de=de.filter(ke=>W.some(Te=>Te.type===ke)),de}}return[...new Set(W.map(J=>J.type))]}function g(z,R=!1){if(r.value===z){O();return}if(r.value&&e.value){const de=e.value.querySelector(`[data-zcode-path="${r.value}"]`);de&&Qt(de);const ke=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);ke&&Qt(ke)}r.value=z,c.value="all",l.value="common",i.value=null,s.value=null;const W=dn(z,t);W&&W.part_id?d.value=W:d.value=null;const H=t.parts,L=H.common,j=H.individual,Z=H.special;let K=[],ae=[];if(z.includes(".slots.")){const de=[...L,...j,...Z],ke=f(z);K=b(ke,de,L),ae=b(ke,de,j)}else K=[...new Set(L.map(de=>de.type))],ae=[...new Set(j.map(de=>de.type))];const ee=K.length>0,X=ae.length>0,Y=Z.length>0,J=o?.categoryOrder;let Q;J==="special"&&Y?Q="special":J==="individual"&&X?Q="individual":J==="common"&&ee||ee?Q="common":X?Q="individual":Y?Q="special":Q="common",l.value=Q,a.nextTick(()=>{if(e.value&&r.value===z){const de=e.value.querySelector(`[data-zcode-path="${z}"]`);if(de)Yt(de,"add"),ar(de);else{const ke=f(z);if(ke!==z){const Te=e.value.querySelector(`[data-zcode-slot-path="${ke}"]`);Te&&(Yt(Te,"add"),ar(Te))}}}})}function x(z){l.value=z,c.value="all",i.value=null,s.value=null,u.value=!1}function v(z){if(c.value=z,z==="selected"&&d.value&&d.value.part_id){const R=t.parts,W=[...R.common,...R.individual,...R.special];for(const H of W){const L=H.parts.find(j=>j.id===d.value.part_id);if(L){i.value=H,s.value=L;break}}}else z!=="selected"&&(i.value=null,s.value=null);u.value=!1}function w(z,R){const W=M(z,R);return n(W,"")}function T(){return d.value?n(d.value,""):""}function M(z,R){const W=y(z,!1,new Set,R.id);return W.id="preview",W}function A(z,R){if(s.value?.id===R.id){i.value=null,s.value=null;return}i.value=z,s.value=R,c.value==="selected"&&(c.value="all"),u.value=!1}function y(z,R=!1,W=new Set,H){const L=H?z.parts.find(X=>X.id===H)||z.parts[0]:R&&s.value?s.value:z.parts[0];if(!L)throw new Error(`Part not found for type: ${z.type}`);const j=`${z.id}:${L.id}`;if(W.has(j)){const X=Fn(L.body),Y={};return X.forEach(J=>{J.optional?Y[J.fieldName]=void 0:J.type==="text"?Y[J.fieldName]=J.defaultValue:J.type==="radio"?Y[J.fieldName]=J.options?.[0]:J.type==="checkbox"?Y[J.fieldName]=[]:J.type==="boolean"?Y[J.fieldName]=!0:J.type==="rich"?Y[J.fieldName]=J.defaultValue?`<p>${J.defaultValue}</p>`:"<p></p>":J.type==="image"&&(Y[J.fieldName]=J.defaultValue||"")}),{id:jn(),part_id:L.id,...Y}}W.add(j);const Z=Fn(L.body),K={};Z.forEach(X=>{X.optional?K[X.fieldName]=void 0:X.type==="text"?K[X.fieldName]=X.defaultValue:X.type==="radio"?K[X.fieldName]=X.options?.[0]:X.type==="checkbox"?K[X.fieldName]=[]:X.type==="boolean"?K[X.fieldName]=!0:X.type==="rich"?K[X.fieldName]=X.defaultValue?`<p>${X.defaultValue}</p>`:"<p></p>":X.type==="image"&&(K[X.fieldName]=X.defaultValue||"")});const ae={id:jn(),part_id:L.id,...K},ee=L.slots;if(ee){const X={};Object.entries(ee).forEach(([Y,J])=>{const Q=J.allowedParts;if(Q&&Q.length===1){const de=Q[0],ke=t.parts,Te=[...ke.common,...ke.individual,...ke.special];let $e=null,N=null;for(const P of Te){const V=P.parts.find(S=>S.id===de);if(V){$e=P,N=V;break}}if($e&&N){const P=y($e,!1,W,N.id);X[Y]=[P]}else X[Y]=[]}else X[Y]=[]}),Object.keys(X).length>0&&(ae.slots=X)}return ae}function E(z){return y(z,!0)}function k(z){if(!i.value||!s.value||!r.value){console.error("Missing required values:",{addSelectedType:i.value,addSelectedPart:s.value,addTargetPath:r.value});return}let R;if(c.value==="selected"&&d.value){if(R=JSON.parse(JSON.stringify(d.value)),R.id=jn(),R.slots){const L=j=>{j.forEach(Z=>{Z.id=jn(),Z.slots&&Object.values(Z.slots).forEach(K=>{Array.isArray(K)?L(K):K&&typeof K=="object"&&K.children&&L(K.children||[])})})};Object.values(R.slots).forEach(j=>{Array.isArray(j)?L(j):j&&typeof j=="object"&&j.children&&L(j.children||[])})}}else R=E(i.value);const W=r.value,H=W.split(".");if(H[0]==="page"&&H.length===2){const L=parseInt(H[1]);z==="before"?(t.page.splice(L,0,R),u.value&&(r.value=`page.${L+1}`)):t.page.splice(L+1,0,R)}else if(H.includes("slots")){const L=f(W),j=L.split(".");let Z=-1;for(let Q=j.length-1;Q>=0;Q--)if(j[Q]==="slots"){Z=Q;break}if(Z===-1||Z>=j.length-1){console.error("Invalid slot path:",L);return}const K=j.slice(0,Z).join("."),ae=j[Z+1],ee=W!==L?parseInt(H[H.length-1]):-1,X=dn(K,t);if(!X){console.error("Parent component not found:",K);return}X.slots||(X.slots={});const Y=X.slots[ae];let J=[];if(Array.isArray(Y)?J=Y:Y&&typeof Y=="object"&&Y.children?(J=Y.children||[],Y.children||(Y.children=[])):(X.slots[ae]=[],J=X.slots[ae]),ee===-1)J.push(R);else if(z==="before"){if(J.splice(ee,0,R),u.value){const Q=f(W);if(W!==Q){const de=[...H];de[de.length-1]=String(ee+1),r.value=de.join(".")}else{const ke=[...Q.split(".")];ke.push("0"),r.value=ke.join(".")}}}else J.splice(ee+1,0,R);Array.isArray(X.slots[ae])||(X.slots[ae].children=J)}if(d.value||c.value==="selected"&&(c.value="all"),!u.value)O();else if(z==="before"&&e.value&&r.value){const L=e.value.querySelector(`[data-zcode-path="${W}"]`);L&&Qt(L),a.nextTick(()=>{if(e.value&&r.value){const j=e.value.querySelector(`[data-zcode-path="${r.value}"]`);j&&Yt(j,"add")}})}}function O(){if(r.value&&e.value){const z=e.value.querySelector(`[data-zcode-path="${r.value}"]`);z&&Qt(z);const R=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);R&&Qt(R)}r.value=null,i.value=null,s.value=null,d.value=null,l.value="common",c.value="all",u.value=!1}const G=a.computed(()=>t.parts.special.length>0);return{addTargetPath:r,addSelectedType:i,addSelectedPart:s,clickedComponent:d,addPartCategory:l,addTypeTab:c,keepAdding:u,availablePartTypes:p,groupedPartsByType:m,hasSpecialParts:G,handleAddClick:g,handleCategoryTabClick:x,handleTypeTabClick:v,selectPart:A,getPartPreviewHtml:w,getClickedComponentPreviewHtml:T,confirmAddPart:k,cancelAdd:O}}function $v(t,e,n,o){const r=a.ref(null),i=a.ref("");function s(f,p){if(i.value===f){u();return}if(i.value&&e.value){const h=e.value.querySelector(`[data-zcode-path="${i.value}"]`);h&&Qt(h)}r.value=p,i.value=f,o(()=>{if(e.value&&i.value===f){const h=e.value.querySelector(`[data-zcode-path="${f}"]`);h&&(Yt(h,"delete"),ar(h))}})}function l(){if(!i.value)return;const f=i.value,p=f.split(".");let h=null,m=null;if(p.length===2&&p[0]==="page"){const b=parseInt(p[1]);!isNaN(b)&&b>=0&&b<t.page.length&&(t.page.splice(b,1),t.page.length===0&&o(()=>{n("add")}))}else if(p.length>2&&p[0]==="page"){const b=parseInt(p[1]);if(isNaN(b)||b<0||b>=t.page.length){console.error("Invalid top-level index:",b),u();return}let g=t.page[b];const x=p.slice(2);x.length>=3&&x[0]==="slots"&&(m=x[1],h=`page.${b}`);for(let w=0;w<x.length-1;w++){if(!g||typeof g!="object"){console.error("Invalid path:",f),u();return}g=g[x[w]]}const v=x[x.length-1];if(g&&typeof g=="object")if(Array.isArray(g)){const w=parseInt(v);!isNaN(w)&&w>=0&&w<g.length?g.splice(w,1):console.error("Invalid array index:",v)}else v in g?delete g[v]:console.error("Field not found:",f);else console.error("Invalid current object:",f)}h&&m&&o(()=>{c(h,m)}),u()}function c(f,p){const h=dn(f,t);if(!h)return;const m=h.slots;if(!m||!Array.isArray(m[p]))return;const b=m[p];if(b.length===0){const g=h.part_id,x=t.parts,v=[...x.common,...x.individual];let w=null,T=null;for(const A of v){const y=A.parts.find(E=>E.id===g);if(y){w=A,T=y;break}}if(!w||!T)return;const M=T?.slots?.[p];if(M){const A=M.allowedParts;if(A&&A.length===1){const y=A[0];let E=null,k=null;for(const O of v){const G=O.parts.find(z=>z.id===y);if(G){E=O,k=G;break}}if(E&&k){const O=d(E,k.id);b.push(O)}}}}}function d(f,p){const h=p&&f.parts.find(v=>v.id===p)||f.parts[0];if(!h)throw new Error(`Part not found for type: ${f.type}`);const m=Fn(h.body),b={};m.forEach(v=>{v.optional?b[v.fieldName]=void 0:v.type==="text"?b[v.fieldName]=v.defaultValue:v.type==="radio"?b[v.fieldName]=v.options?.[0]:v.type==="checkbox"?b[v.fieldName]=[]:v.type==="boolean"?b[v.fieldName]=!0:v.type==="rich"?b[v.fieldName]=v.defaultValue?`<p>${v.defaultValue}</p>`:"<p></p>":v.type==="image"&&(b[v.fieldName]=v.defaultValue||"")});const g={id:jn(),part_id:h.id,...b},x=h.slots;if(x){const v={};Object.entries(x).forEach(([w,T])=>{const M=T.allowedParts;if(M&&M.length===1){const A=M[0],y=t.parts,E=[...y.common,...y.individual];let k=null,O=null;for(const G of E){const z=G.parts.find(R=>R.id===A);if(z){k=G,O=z;break}}if(k&&O){const G=d(k,O.id);v[w]=[G]}else v[w]=[]}else v[w]=[]}),Object.keys(v).length>0&&(g.slots=v)}return g}function u(){if(i.value&&e.value){const f=e.value.querySelector(`[data-zcode-path="${i.value}"]`);f&&Qt(f)}r.value=null,i.value=""}return{deleteConfirmComponent:r,deleteConfirmPath:i,handleDeleteClick:s,confirmDelete:l,cancelDelete:u}}function Vv(t,e){const n=a.ref("");function o(l,c){if(!l||!c)return!1;const d=l.split("."),u=c.split(".");if(d.length!==u.length||l===c)return!1;if(d.includes("slots")&&u.includes("slots")){let f=-1,p=-1;for(let x=d.length-1;x>=0;x--)if(d[x]==="slots"){f=x;break}for(let x=u.length-1;x>=0;x--)if(u[x]==="slots"){p=x;break}if(f===-1||p===-1)return!1;const h=d.slice(0,f).join("."),m=u.slice(0,p).join(".");if(h!==m)return!1;const b=d[f+1],g=u[p+1];return b===g}if(d.length>2){const f=d.slice(0,-1).join("."),p=u.slice(0,-1).join(".");if(f!==p)return!1}return!0}function r(l){if(!l)return;if(!n.value){const d=od(l);if(d&&e.value){const u=e.value.querySelector(`[data-zcode-path="${d}"]`);u&&yn(u)}if(n.value=l,e.value){const u=e.value.querySelector(`[data-zcode-path="${l}"]`);u&&(Yt(u,"reorder"),ar(u))}return}if(n.value===l){i();return}if(!o(n.value,l)){alert("この要素とは並べ替えできません。同じ階層の要素を選択してください。"),i();return}s(n.value,l)||alert("並べ替えに失敗しました。同じ階層の要素を選択してください。"),i()}function i(){if(n.value&&e.value){const l=e.value.querySelector(`[data-zcode-path="${n.value}"]`);l&&Qt(l)}n.value=""}function s(l,c){const d=l.split("."),u=c.split(".");if(d.length===2&&u.length===2&&d[0]==="page"&&u[0]==="page"){const f=parseInt(d[1]),p=parseInt(u[1]);if(!isNaN(f)&&!isNaN(p)&&f!==p){const h=[...t.page],[m]=h.splice(f,1);return h.splice(p,0,m),t.page=h,!0}return!1}else if(d.includes("slots")&&u.includes("slots")){let f=-1,p=-1;for(let y=d.length-1;y>=0;y--)if(d[y]==="slots"){f=y;break}for(let y=u.length-1;y>=0;y--)if(u[y]==="slots"){p=y;break}if(f===-1||p===-1)return!1;const h=d.slice(0,f).join("."),m=u.slice(0,p).join(".");if(h!==m)return!1;const b=d[f+1],g=u[p+1];if(b!==g)return!1;const x=parseInt(d[d.length-1]),v=parseInt(u[u.length-1]);if(isNaN(x)||isNaN(v)||x===v)return!1;const w=dn(h,t);if(!w||!w.slots||!w.slots[b])return!1;const T=w.slots[b];let M=[];if(Array.isArray(T))M=T;else if(T&&typeof T=="object"&&T.children)M=T.children||[];else return!1;const[A]=M.splice(x,1);return M.splice(v,0,A),!Array.isArray(T)&&typeof T=="object"&&T.children&&(T.children=M),!0}else if(d.length>2&&u.length>2){const f=d.slice(0,-1).join("."),p=u.slice(0,-1).join(".");if(f===p){const h=parseInt(d[d.length-1]),m=parseInt(u[u.length-1]);if(!isNaN(h)&&!isNaN(m)&&h!==m){const b=parseInt(d[1]);let g=t.page[b];for(let x=2;x<d.length-1;x++)g=g[d[x]];if(Array.isArray(g)){const[x]=g.splice(h,1);return g.splice(m,0,x),!0}}}}return!1}return{reorderSourcePath:n,handleReorderClick:r,canReorderWith:o,cancelReorder:i}}function Bv(t,e,n,o,r,i,s,l,c){const d=a.computed(()=>o.value?od(o.value):null),u=a.computed(()=>{if(!d.value)return!1;const p=dn(d.value,t);return p!=null});function f(){if(!d.value)return;const p=d.value;if(!e.value||!e.value.querySelector(`[data-zcode-path="${p}"]`))return;const m=dn(p,t);if(m){if(o.value&&e.value){const b=e.value.querySelector(`[data-zcode-path="${o.value}"]`);b&&yn(b)}switch(n.value){case"edit":r(p,m);break;case"add":i(p,!0);break;case"reorder":if(c.value){const b=e.value.querySelector(`[data-zcode-path="${c.value}"]`);b&&Qt(b),c.value=""}s(p);break;case"delete":l(p,m);break}}}return{parentPath:d,canSelectParent:u,selectParentElement:f}}function Fv(t,e,n,o,r,i,s,l,c,d,u,f,p,h){const m=new Map;function b(){if(!e.value)return;g();const x=e.value.querySelectorAll("[data-zcode-id]"),v=y=>{const E=y.target;if(!E)return;const k=E.closest("[data-zcode-add-slot]");if(!k)return;const O=k.closest("[data-zcode-slot-path]"),G=O?.getAttribute("data-zcode-slot-path");if(!G)return;y.preventDefault(),y.stopPropagation(),y.stopImmediatePropagation();const z=()=>{const R=e.value?.querySelector(`[data-zcode-slot-path="${G}"]`);R&&(yn(R),Yt(R,"add"))};if(O&&yn(O),n.value!=="add"){p("add"),a.nextTick(()=>{c(G),a.nextTick(()=>{z()})});return}z(),a.nextTick(()=>{c(G),a.nextTick(()=>{z()})})};let w=null;const T=y=>o.value===y||r.value===y||i.value===y||s.value===y,M=y=>{const k=y.target;if(!k)return;const O=k.closest("[data-zcode-slot-path]");if(!O){if(w){const z=w.getAttribute("data-zcode-slot-path")||"";(!z||!T(z))&&yn(w),w=null}return}if(w===O)return;if(w){const z=w.getAttribute("data-zcode-slot-path")||"";(!z||!T(z))&&yn(w)}w=O;const G=O.getAttribute("data-zcode-slot-path")||"";G&&!T(G)&&wc(O,n.value)},A=y=>{const E=y,k=E.target;if(!k)return;const O=E.relatedTarget,G=k.closest("[data-zcode-slot-path]");if(!G||O&&G.contains(O))return;const z=G.getAttribute("data-zcode-slot-path")||"";(!z||!T(z))&&yn(G),w===G&&(w=null)};e.value.addEventListener("click",v,!0),e.value.addEventListener("mouseover",M,!0),e.value.addEventListener("mouseout",A,!0),m.set(e.value,[{type:"click",listener:v,options:!0},{type:"mouseover",listener:M,options:!0},{type:"mouseout",listener:A,options:!0}]),x.forEach(y=>{const E=y,k=E.getAttribute("data-zcode-path");if(!k)return;const O=W=>{const H=W.target,j=H?.closest("[data-zcode-path]")?.getAttribute("data-zcode-path");if(j&&j!==k)return;H?.closest("a[href]")&&(h.value||W.preventDefault()),h.value||(W.stopPropagation(),W.stopImmediatePropagation());const K=dn(k,t);if(K)switch(yn(E),n.value){case"edit":l(k,K);break;case"add":c(k);break;case"reorder":if(i.value){const ae=i.value.split("."),ee=k.split(".");if(ae.length!==ee.length&&ae.indexOf("rows")!==-1){const Y=ee.indexOf("cells");if(Y!==-1){let J=-1;for(let Q=Y-1;Q>=0;Q--)if(ee[Q]==="slots"){J=Q;break}if(J!==-1){const Q=ee.slice(0,J).join(".");if(Q&&f(i.value,Q)){d(Q);return}}}}}d(k);break;case"delete":u(k,K);break}},G=W=>{if(o.value===W||r.value===W||i.value===W||s.value===W)return!0;if(W.includes(".slots.")){const L=W.split(".");let j=-1;for(let Z=L.length-1;Z>=0;Z--)if(L[Z]==="slots"){j=Z;break}if(j!==-1&&j+1<L.length){const Z=L.slice(0,j+2).join(".");return r.value===Z||o.value===Z||i.value===Z||s.value===Z}}return!1},z=()=>{G(k)||(n.value==="reorder"&&i.value?f(i.value,k)&&wc(E,n.value):wc(E,n.value)),n.value==="reorder"?E.style.cursor=i.value&&f(i.value,k)?"move":i.value?"not-allowed":"move":E.style.cursor="pointer"},R=()=>{G(k)||yn(E),E.style.cursor=""};E.addEventListener("click",O,!0),E.addEventListener("mouseenter",z),E.addEventListener("mouseleave",R),m.set(E,[{type:"click",listener:O,options:!0},{type:"mouseenter",listener:z},{type:"mouseleave",listener:R}])}),a.nextTick(()=>{a.nextTick(()=>{if(n.value==="edit"&&o.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${o.value}"]`);y&&Yt(y,"edit")}if(n.value==="add"&&r.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${r.value}"]`);if(y)Yt(y,"add");else{const E=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);E&&Yt(E,"add")}}if(n.value==="reorder"&&i.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${i.value}"]`);y&&Yt(y,"reorder")}if(n.value==="delete"&&s.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${s.value}"]`);y&&Yt(y,"delete")}})})}function g(){m.forEach((x,v)=>{x.forEach(({type:w,listener:T,options:M})=>{v.removeEventListener(w,T,M)})}),m.clear()}return{setupClickHandlers:b,cleanupEventListeners:g}}function jv(t,e,n,o,r,i,s,l,c,d,u,f,p){function h(m){t.value&&t.value.querySelectorAll("[data-zcode-path], [data-zcode-slot-path]").forEach(g=>{Qt(g),yn(g)}),e.value==="edit"&&o.value?(l.value=null,o.value=""):e.value==="add"&&r.value?(r.value=null,c.value=null,d.value=null,u.value="common",f.value=null):e.value==="reorder"&&i.value?i.value="":e.value==="delete"&&s.value&&p(),n(m)}return{switchMode:h}}function Uv(t,e,n){const o=a.ref(!1),r=a.ref({x:0,y:0});function i(p){!e.value||!t.value||!p.target.closest("[data-zcode-path]")||(p.preventDefault(),p.stopPropagation(),r.value={x:p.clientX,y:p.clientY},o.value=!0)}function s(p){n(p),o.value=!1}function l(){o.value=!1}function c(p){p.target.closest(".zcode-context-menu")||l()}function d(p){p.target.closest(".zcode-context-menu")||l()}function u(){!t.value||!e.value||(t.value.addEventListener("contextmenu",i),document.addEventListener("click",c),document.addEventListener("contextmenu",d))}function f(){t.value&&(t.value.removeEventListener("contextmenu",i),document.removeEventListener("click",c),document.removeEventListener("contextmenu",d))}return{isVisible:o,position:r,handleModeSelect:s,closeMenu:l,setupContextMenu:u,cleanupContextMenu:f}}function Hv(t){const e=t;if(!e||!e.page||!Array.isArray(e.page))return!1;for(const n of e.page)if(!n.id||!n.part_id)return!1;return!0}function Sc(t,e){const n=[],o=(r,i)=>{Object.keys(r).forEach(s=>{s.includes("image")&&r[s]===t&&n.push({path:i,component:r,fieldName:s})}),r.slots&&Object.entries(r.slots).forEach(([s,l])=>{Array.isArray(l)&&l.forEach((c,d)=>{o(c,`${i}.slots.${s}.${d}`)})})};return e.forEach((r,i)=>{o(r,`page.${i}`)}),n}const Wv={key:0,class:"zcode-save-banner zcode-save-banner--error",role:"alert"},Gv={class:"zcode-save-banner-text"},qv=["aria-label"],Kv={key:1,class:"zcode-save-controls-fixed"},Jv={class:"zcode-save-confirm-dialog"},Xv={class:"zcode-save-confirm-dialog-header"},Yv={class:"zcode-save-confirm-dialog-title"},Qv={class:"zcode-save-confirm-dialog-body"},Zv={class:"zcode-save-confirm-dialog-footer"},Hs=a.defineComponent({__name:"ZeroCodeCMS",props:{locale:{type:String},page:{type:String},cssCommon:{type:String},cssIndividual:{type:String},cssSpecial:{type:String},partsCommon:{type:String},partsIndividual:{type:String},partsSpecial:{type:String},imagesCommon:{type:String},imagesIndividual:{type:String},imagesSpecial:{type:String},config:{type:String},endpoints:{type:String},backendData:{type:String}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.ref("manage"),i=a.ref(!1),l=(ce=>{if(!ce)return{};try{return JSON.parse(ce)}catch(ue){return console.warn("[ZeroCodeCMS] Failed to parse config:",ue),{}}})(o.config),c=(ce,ue,ye)=>{const Ge=Au();return Ge[ce]!==void 0?Ge[ce]:ye!==void 0?ye:ue},d=a.ref(c("devRightPadding",!1,l.cms?.devRightPadding)),u=a.ref(c("enableContextMenu",!1,l.cms?.enableContextMenu)),f=a.ref(c("showSaveConfirm",!0,l.cms?.showSaveConfirm)),p=a.computed(()=>d.value),h=a.ref(!1),{cmsData:m,loadDataFromProps:b,getData:g,setData:x}=km(o),{fullPageHtml:v,renderComponentToHtml:w}=fi(m,!0);function T(ce){if(ce!=="css")return ce?g(ce):g()}const M=a.ref(null),A=a.ref(null),y=a.computed(()=>A.value?.previewArea||null),{currentMode:E,switchMode:k,allowDynamicContentInteraction:O}=Rv(),G=c("allowDynamicContentInteraction",!1,l.cms?.allowDynamicContentInteraction),z=a.ref(G);O.value=G;let R=!1;a.watch(r,(ce,ue)=>{ce==="preview"?(R=z.value,z.value=!0,O.value=!0,a.nextTick(()=>{st()})):ue==="preview"&&(z.value=R,O.value=R,a.nextTick(()=>{st()})),Ln("view-mode-changed",{mode:ce,previousMode:ue})});const{editingComponent:W,editingComponentPath:H,editingAvailableFields:L,handleEditClick:j,saveFieldEdit:Z,closeEditPanel:K}=Pv(m,y),ae=a.ref({}),ee=a.ref([]),X=a.ref({visible:!1,message:""});function Y(ce){if(ce?.fieldName&&ae.value[ce.fieldName]){const ue={...ae.value};delete ue[ce.fieldName],ae.value=ue}Z(ce)}const{addTargetPath:J,addSelectedType:Q,addSelectedPart:de,clickedComponent:ke,addPartCategory:Te,addTypeTab:$e,keepAdding:N,availablePartTypes:P,groupedPartsByType:V,hasSpecialParts:S,handleAddClick:C,handleCategoryTabClick:$,handleTypeTabClick:te,selectPart:ge,getPartPreviewHtml:Re,getClickedComponentPreviewHtml:ve,confirmAddPart:_,cancelAdd:I}=Lv(m,y,w,l),{reorderSourcePath:q,handleReorderClick:pe,canReorderWith:Ae,cancelReorder:ze}=Vv(m,y),{deleteConfirmComponent:Se,deleteConfirmPath:F,handleDeleteClick:ne,confirmDelete:Me,cancelDelete:B}=$v(m,y,k,a.nextTick),{switchMode:U}=jv(y,E,k,H,J,q,F,W,Q,de,Te,$e,B),ie=a.computed(()=>E.value==="edit"&&H.value?H.value:E.value==="add"&&J.value?J.value:E.value==="reorder"&&q.value?q.value:E.value==="delete"&&F.value?F.value:null),{canSelectParent:le,selectParentElement:we}=Bv(m,y,E,ie,j,C,pe,ne,q),Fe=a.computed(()=>!!(W.value||J.value||q.value||Se.value)),st=()=>{if(y.value){const ce=y.value.getRootNode();if(ce instanceof ShadowRoot){let Ge=0;const et=()=>{Ge++;const At=ce;if(typeof At.__zcmsSetAllowDynamicContentInteraction=="function"){At.__zcmsSetAllowDynamicContentInteraction(z.value);return}Ge<30&&setTimeout(et,50)};et()}}},{setupClickHandlers:xn,cleanupEventListeners:oi}=Fv(m,y,E,H,J,q,F,j,C,pe,ne,Ae,U,z),{isVisible:Tc,position:Zo,handleModeSelect:er,closeMenu:zc,setupContextMenu:Pn,cleanupContextMenu:ri}=Uv(y,u,U);function Ln(ce,ue){const ye=En();if(ye){const et=new CustomEvent(ce,{detail:ue,bubbles:!0,composed:!0});ye.dispatchEvent(et);return}const Ge=new CustomEvent(ce,{detail:ue,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(Ge)}function Ze(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function En(){if(M.value){const ue=M.value.getRootNode();if(ue instanceof ShadowRoot&&ue.host)return ue.host;const ye=M.value.closest?.("zcode-cms")||M.value.closest?.("zcode-editor");if(ye)return ye}const ce=a.getCurrentInstance();if(ce){const ue=ce.vnode.el;if(ue instanceof HTMLElement){const ye=ue.getRootNode();if(ye instanceof ShadowRoot&&ye.host)return ye.host;const Ge=ue.closest?.("zcode-cms")||ue.closest?.("zcode-editor");return Ge||null}if(ue instanceof Node){const ye=ue.getRootNode();if(ye instanceof ShadowRoot&&ye.host)return ye.host}}return null}function Xs(ce){return typeof ce=="object"&&ce!==null}function Ys(ce){return Array.isArray(ce)?ce.filter(ue=>Xs(ue)).map(ue=>({path:typeof ue.path=="string"?ue.path:void 0,field:typeof ue.field=="string"?ue.field:void 0,message:typeof ue.message=="string"?ue.message:void 0,code:typeof ue.code=="string"?ue.code:void 0})):[]}function tr(ce){if(!ce){ae.value={};return}const ue={};for(const ye of ee.value){const Ge=typeof ye?.path=="string"?ye.path:null,et=typeof ye?.field=="string"?ye.field:null,At=typeof ye?.message=="string"?ye.message:null;!et||!At||Ge&&Ge!==ce||(ue[et]=At)}ae.value=ue}const Qs=(ce,ue)=>{ue==="common"?m.images.common.push(ce):ue==="individual"?m.images.individual.push(ce):m.images.special.push(ce)},Zs=ce=>{Sc(ce,m.page).forEach(et=>{Object.keys(et.component).forEach(At=>{At.includes("image")&&et.component[At]===ce&&(et.component[At]="")})});const ye=m.images.common.findIndex(et=>et.id===ce);ye!==-1&&m.images.common.splice(ye,1);const Ge=m.images.individual.findIndex(et=>et.id===ce);Ge!==-1&&m.images.individual.splice(Ge,1)};function ea(ce){const ue=ce.detail;if(!Xs(ue))return;const ye=ue;if(ye.ok===!0){X.value.visible=!1,X.value.message="",ee.value=[],ae.value={};return}if(ye.ok!==!1)return;const Ge=Ys(ye.errors);ee.value=Ge;const et=Ge.length,At=typeof Ge[0]?.message=="string"&&Ge[0].message?Ge[0].message:null;X.value.visible=!0,X.value.requestId=typeof ye.requestId=="string"?ye.requestId:void 0,X.value.target=typeof ye.target=="string"?ye.target:void 0,X.value.message=At?n("editor.saveFailedWithMessage",{count:et,message:At}):n("editor.saveFailedWithCount",{count:et}),tr(H.value||null)}a.onMounted(()=>{b(),a.nextTick(()=>{xn(),u.value&&Pn(),st(),Ln("zcode-dom-updated",{})});const ce=En();ce&&ce.addEventListener("save-result",ea)}),a.onUnmounted(()=>{oi(),ri();const ce=En();ce&&ce.removeEventListener("save-result",ea)}),a.watch(()=>H.value,ce=>{tr(ce||null)}),a.watch([()=>o.page,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial],()=>{b()}),a.watch(m,()=>{a.nextTick(()=>{xn(),Ln("zcode-dom-updated",{})})},{deep:!0}),a.watch([r,y],([ce,ue])=>{ce==="manage"&&ue?a.nextTick(()=>{xn(),u.value&&Pn(),st(),Ln("zcode-dom-updated",{})}):ri()}),a.watch(E,()=>{a.nextTick(()=>{Ln("zcode-dom-updated",{})})}),a.watch(d,ce=>{vi({devRightPadding:ce})}),a.watch(z,ce=>{r.value==="manage"&&vi({allowDynamicContentInteraction:ce}),O.value=ce,a.nextTick(()=>{xn(),st(),Ln("zcode-dom-updated",{})})}),a.watch(u,ce=>{vi({enableContextMenu:ce}),ce?a.nextTick(()=>{Pn()}):ri()}),a.watch(f,ce=>{vi({showSaveConfirm:ce})});function Zt(){if(!f.value){kn();return}h.value=!0}function kn(){const ce=Ze();Ln("save-request",{requestId:ce,source:"cms",targets:["page","images-common","images-individual"],timestamp:Date.now()})}function ta(){h.value=!1,kn()}function ii(){h.value=!1}return e({getData:T,setData:x,validateData:Hv,cmsData:m,currentMode:E,switchMode:U,allowDynamicContentInteraction:z,devRightPadding:d,devRightPaddingValue:p,settingsPanelOpen:i}),(ce,ue)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"containerRef",ref:M,class:a.normalizeClass(["zcode-cms-container",{"zcode-dev-padding":d.value&&Fe.value}])},[a.createVNode(rd,{"current-mode":a.unref(E),"view-mode":r.value,"allow-dynamic-content-interaction":z.value,onSwitchMode:a.unref(U),onSwitchViewMode:ue[0]||(ue[0]=ye=>r.value=ye),onOpenSettings:ue[1]||(ue[1]=ye=>i.value=!0)},null,8,["current-mode","view-mode","allow-dynamic-content-interaction","onSwitchMode"]),X.value.visible?(a.openBlock(),a.createElementBlock("div",Wv,[a.createElementVNode("div",Gv,a.toDisplayString(X.value.message),1),a.createElementVNode("button",{class:"zcode-save-banner-close","aria-label":ce.$t("common.close"),onClick:ue[2]||(ue[2]=ye=>X.value.visible=!1)}," × ",8,qv)])):a.createCommentVNode("",!0),r.value==="manage"?(a.openBlock(),a.createElementBlock("div",Kv,[a.createElementVNode("button",{class:"zcode-save-btn",onClick:Zt},[a.createVNode(a.unref(Lc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(ce.$t("common.save")),1)])])):a.createCommentVNode("",!0),r.value==="preview"?(a.openBlock(),a.createBlock(ma,{key:2,"cms-data":a.unref(m),"allow-dynamic-content-interaction":!0},null,8,["cms-data"])):a.createCommentVNode("",!0),r.value==="manage"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:3},[a.createVNode(Fc,{ref_key:"previewAreaRef",ref:A,"cms-data":a.unref(m),"full-page-html":a.unref(v),"on-add-click":a.unref(C),"allow-dynamic-content-interaction":z.value},null,8,["cms-data","full-page-html","on-add-click","allow-dynamic-content-interaction"]),a.createVNode(zC,{"editing-component":a.unref(W),"editing-available-fields":a.unref(L),"field-errors":ae.value,"current-mode":a.unref(E),"can-select-parent":a.unref(le),"images-common":a.unref(m).images.common,"images-individual":a.unref(m).images.individual,"images-special":a.unref(m).images.special,onClose:a.unref(K),onSelectParent:a.unref(we),onSaveField:Y,onAddImage:Qs,onDeleteImage:Zs},null,8,["editing-component","editing-available-fields","field-errors","current-mode","can-select-parent","images-common","images-individual","images-special","onClose","onSelectParent"]),a.createVNode(LC,{"delete-confirm-component":a.unref(Se),"current-mode":a.unref(E),"can-select-parent":a.unref(le),onConfirm:a.unref(Me),onCancel:a.unref(B),onSelectParent:a.unref(we)},null,8,["delete-confirm-component","current-mode","can-select-parent","onConfirm","onCancel","onSelectParent"]),a.createVNode(WC,{"reorder-source-path":a.unref(q),"current-mode":a.unref(E),"can-select-parent":a.unref(le),onCancel:a.unref(ze),onSelectParent:a.unref(we)},null,8,["reorder-source-path","current-mode","can-select-parent","onCancel","onSelectParent"]),a.createVNode(Av,{"add-target-path":a.unref(J),"add-part-category":a.unref(Te),"add-type-tab":a.unref($e),"add-selected-part":a.unref(de),"add-selected-type":a.unref(Q),"has-special-parts":a.unref(S),"clicked-component":a.unref(ke),"available-part-types":a.unref(P),config:a.unref(l),"grouped-parts-by-type":a.unref(V),"can-select-parent":a.unref(le),"get-part-preview-html":a.unref(Re),"get-clicked-component-preview-html":a.unref(ve),"keep-adding":a.unref(N),onCancel:a.unref(I),onSelectParent:a.unref(we),onCategoryTabClick:a.unref($),onTypeTabClick:a.unref(te),onSelectPart:a.unref(ge),onConfirmAdd:a.unref(_),onUpdateKeepAdding:ue[3]||(ue[3]=ye=>N.value=ye)},null,8,["add-target-path","add-part-category","add-type-tab","add-selected-part","add-selected-type","has-special-parts","clicked-component","available-part-types","config","grouped-parts-by-type","can-select-parent","get-part-preview-html","get-clicked-component-preview-html","keep-adding","onCancel","onSelectParent","onCategoryTabClick","onTypeTabClick","onSelectPart","onConfirmAdd"])],64)):a.createCommentVNode("",!0),a.createVNode(Ou,{"is-open":i.value,"view-mode":r.value,mode:"toolbar","allow-dynamic-content-interaction":z.value,"dev-right-padding":p.value,"enable-context-menu":u.value,"show-save-confirm":f.value,onClose:ue[4]||(ue[4]=ye=>i.value=!1),onToggleDynamicContent:ue[5]||(ue[5]=ye=>z.value=ye),onToggleDevPadding:ue[6]||(ue[6]=ye=>d.value=ye),onToggleContextMenu:ue[7]||(ue[7]=ye=>u.value=ye),onToggleSaveConfirm:ue[8]||(ue[8]=ye=>f.value=ye)},null,8,["is-open","view-mode","allow-dynamic-content-interaction","dev-right-padding","enable-context-menu","show-save-confirm"]),a.createVNode(Mv,{"is-visible":a.unref(Tc),position:a.unref(Zo),"current-mode":a.unref(E),onSelectMode:a.unref(er),onClose:a.unref(zc)},null,8,["is-visible","position","current-mode","onSelectMode","onClose"]),h.value?(a.openBlock(),a.createElementBlock("div",{key:4,class:"zcode-save-confirm-dialog-overlay",onClick:a.withModifiers(ii,["self"])},[a.createElementVNode("div",Jv,[a.createElementVNode("div",Xv,[a.createElementVNode("div",Yv,a.toDisplayString(ce.$t("saveConfirm.title")),1)]),a.createElementVNode("div",Qv,[a.createElementVNode("p",null,a.toDisplayString(ce.$t("saveConfirm.simpleMessage")),1)]),a.createElementVNode("div",Zv,[a.createElementVNode("button",{class:"zcode-btn-secondary",onClick:ii},a.toDisplayString(ce.$t("common.cancel")),1),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:ta},a.toDisplayString(ce.$t("saveConfirm.saveButton")),1)])])])):a.createCommentVNode("",!0)],2))}}),Sm=":root{--zcode-color-edit: #3b82f6;--zcode-color-add: #10b981;--zcode-color-reorder: #f59e0b;--zcode-color-delete: #ef4444;--zcode-color-edit-hover: #2563eb;--zcode-color-edit-bg: #eff6ff;--zcode-color-edit-bg-active: #dbeafe;--zcode-color-edit-border-hover: #93c5fd;--zcode-color-add-hover: #059669;--zcode-color-add-bg: #ecfdf5;--zcode-color-add-bg-active: #d1fae5;--zcode-color-add-border-hover: #6ee7b7;--zcode-color-reorder-bg: #fffbeb;--zcode-color-reorder-bg-active: #fef3c7;--zcode-color-reorder-border-hover: #fcd34d;--zcode-color-delete-hover: #dc2626;--zcode-color-delete-bg: #fef2f2;--zcode-color-delete-bg-active: #fee2e2;--zcode-color-delete-border-hover: #fca5a5}[class*=zcode-]{box-sizing:border-box}[class*=zcode-]:before,[class*=zcode-]:after{box-sizing:border-box}.zcode-empty-state{text-align:center;padding:60px 20px;color:#666}.zcode-empty-state-btn{margin-top:20px;padding:10px 20px;font-size:16px;background:#42b983;color:#fff;border:none;border-radius:4px;cursor:pointer;transition:background .2s}.zcode-empty-state-btn:hover{background:#359268}.zcode-edit-panel,.zcode-add-panel,.zcode-reorder-panel,.zcode-delete-panel{position:fixed;top:0;right:0;width:375px;height:100vh;background:#fff;box-shadow:-2px 0 8px #0000001a;overflow:hidden;display:flex;flex-direction:column;z-index:1002}.zcode-edit-panel-header,.zcode-add-panel-header,.zcode-reorder-panel-header,.zcode-delete-panel-header{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-shrink:0}.zcode-panel-header-title{margin:0;font-size:14px;font-weight:600;color:#1f2937}.zcode-edit-panel-header .zcode-panel-header-title{color:var(--zcode-color-edit)}.zcode-add-panel-header .zcode-panel-header-title{color:var(--zcode-color-add)}.zcode-reorder-panel-header .zcode-panel-header-title{color:var(--zcode-color-reorder)}.zcode-delete-panel-header .zcode-panel-header-title{color:var(--zcode-color-delete)}.zcode-close-btn{background:none;border:none;cursor:pointer;color:#6b7280;padding:4px 8px;line-height:1;display:flex;align-items:center;justify-content:center}.zcode-close-btn:hover{color:#1f2937}.zcode-edit-fields{padding:16px;font-size:14px;color:#6b7280;overflow-y:auto;flex:1}.zcode-add-panel-content{overflow-y:auto;flex:1}.zcode-edit-fields-text{margin:8px 0}.zcode-component-developer{border:1px dashed #ccc;padding:10px}.zcode-error-message{padding:20px;background:#fff3cd;border:1px solid #ffc107;border-radius:4px;color:#856404}.zcode-for-item{margin-bottom:10px}.zcode-field-editor{padding:16px;overflow-y:auto}.zcode-field-item-title{margin:0 0 15px;color:#2c3e50;font-size:16px;border-bottom:1px solid #eee;padding-bottom:8px}.zcode-field-editor-label{display:block;margin-bottom:8px;font-weight:500;color:#555}.zcode-text-editor{margin-bottom:20px}.zcode-text-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;transition:border-color .2s;box-sizing:border-box}.zcode-text-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-field-error{border-color:#ef4444!important;background-color:#fef2f2}.zcode-field-error-message{margin-top:6px;font-size:12px;color:#ef4444;line-height:1.4}.zcode-field-counter{margin-top:6px;font-size:12px;color:#6b7280;text-align:right}.zcode-text-input:disabled,.zcode-textarea:disabled{opacity:.7;cursor:not-allowed}.zcode-text-input[readonly],.zcode-textarea[readonly]{background-color:#f3f4f6;cursor:default}.zcode-radio-editor{margin-top:12px;margin-bottom:12px}.zcode-radio-group{display:flex;flex-direction:column;gap:6px}.zcode-radio-item{display:flex;align-items:center;gap:6px;cursor:pointer;margin-bottom:0;font-weight:400;color:inherit}.zcode-radio-item input[type=radio]{margin:0;cursor:pointer}.zcode-radio-item input[type=radio]:focus{outline:2px solid var(--zcode-color-edit);outline-offset:2px}.zcode-radio-item-label{font-size:14px;color:#4b5563}.zcode-checkbox-editor{margin-top:12px;margin-bottom:12px}.zcode-checkbox-item{display:flex;align-items:center;gap:6px;cursor:pointer;margin-bottom:0;font-weight:400;color:inherit}.zcode-checkbox-item input[type=checkbox]{margin:0;cursor:pointer}.zcode-checkbox-item input[type=checkbox]:focus{outline:2px solid var(--zcode-color-edit);outline-offset:2px}.zcode-checkbox-item-label{font-size:14px;color:#4b5563}.zcode-edit-actions{display:flex;gap:10px;margin-top:20px}.zcode-save-btn{flex:1;background:var(--zcode-color-edit);color:#fff;border:none;padding:10px 16px;border-radius:4px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-save-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-cancel-btn{flex:1;background:#f8f9fa;color:#6c757d;border:1px solid #dee2e6;padding:10px 16px;border-radius:4px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-cancel-btn:hover{background:#e9ecef}[data-zcode-id],[data-zcode-slot-path]{transition:outline .2s;cursor:pointer;position:relative}[data-zcode-id].zcode-outline-active-edit,[data-zcode-id].zcode-outline-active-add,[data-zcode-id].zcode-outline-active-reorder,[data-zcode-id].zcode-outline-active-delete,[data-zcode-slot-path].zcode-outline-active-edit,[data-zcode-slot-path].zcode-outline-active-add,[data-zcode-slot-path].zcode-outline-active-reorder,[data-zcode-slot-path].zcode-outline-active-delete{outline-style:solid;animation:zcode-outline-pulse-edit 1.5s ease-in-out infinite}[data-zcode-id].zcode-outline-active-edit{animation-name:zcode-outline-pulse-edit}[data-zcode-id].zcode-outline-active-add{animation-name:zcode-outline-pulse-add}[data-zcode-id].zcode-outline-active-reorder{animation-name:zcode-outline-pulse-reorder}[data-zcode-id].zcode-outline-active-delete{animation-name:zcode-outline-pulse-delete}[data-zcode-slot-path].zcode-outline-active-edit{animation-name:zcode-outline-pulse-edit}[data-zcode-slot-path].zcode-outline-active-add{animation-name:zcode-outline-pulse-add}[data-zcode-slot-path].zcode-outline-active-reorder{animation-name:zcode-outline-pulse-reorder}[data-zcode-slot-path].zcode-outline-active-delete{animation-name:zcode-outline-pulse-delete}@keyframes zcode-outline-pulse-edit{0%{outline-width:4px;outline-offset:2px;outline-color:#3cd7f6}25%{outline-width:4px;outline-offset:2px;outline-color:#3c83f6}50%{outline-width:4px;outline-offset:2px;outline-color:#493cf6}75%{outline-width:4px;outline-offset:2px;outline-color:#3c83f6}to{outline-width:4px;outline-offset:2px;outline-color:#3cd7f6}}@keyframes zcode-outline-pulse-add{0%{outline-width:4px;outline-offset:2px;outline-color:#0fb82b}25%{outline-width:4px;outline-offset:2px;outline-color:#0fb880}50%{outline-width:4px;outline-offset:2px;outline-color:#0f9cb8}75%{outline-width:4px;outline-offset:2px;outline-color:#0fb880}to{outline-width:4px;outline-offset:2px;outline-color:#0fb82b}}@keyframes zcode-outline-pulse-reorder{0%{outline-width:4px;outline-offset:2px;outline-color:#f5800a}25%{outline-width:4px;outline-offset:2px;outline-color:#f59f0a}50%{outline-width:4px;outline-offset:2px;outline-color:#f5be0a}75%{outline-width:4px;outline-offset:2px;outline-color:#f59f0a}to{outline-width:4px;outline-offset:2px;outline-color:#f5800a}}@keyframes zcode-outline-pulse-delete{0%{outline-width:4px;outline-offset:2px;outline-color:#ef437c}25%{outline-width:4px;outline-offset:2px;outline-color:#ef4343}50%{outline-width:4px;outline-offset:2px;outline-color:#ef7c43}75%{outline-width:4px;outline-offset:2px;outline-color:#ef4343}to{outline-width:4px;outline-offset:2px;outline-color:#ef437c}}.zcode-view-mode-toggle{display:flex;gap:8px}.zcode-view-mode-btn{display:flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid #e5e7eb;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s;font-size:14px;font-weight:500}.zcode-dev-header{display:flex;align-items:center;justify-content:flex-start;padding:8px 16px;background:#f9fafb;border-bottom:1px solid #e5e7eb}.zcode-toolbar{position:sticky;top:0;display:flex;align-items:center;gap:8px;width:fit-content;background:#fffc;margin-bottom:10px;padding:8px 16px;border-radius:8px;box-shadow:0 2px 8px #0000001a;z-index:1001}.zcode-save-banner{position:sticky;top:54px;display:flex;align-items:flex-start;justify-content:space-between;gap:12px;width:min(720px,calc(100% - 32px));margin:0 0 10px;padding:10px 12px;border-radius:10px;border:1px solid transparent;z-index:1001;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.zcode-save-banner--error{border-color:#fecaca;background:#fef2f2e6;color:#991b1b}.zcode-save-banner-text{font-size:13px;line-height:1.4;word-break:break-word}.zcode-save-banner-close{flex:0 0 auto;width:28px;height:28px;border-radius:8px;border:1px solid rgba(0,0,0,.06);background:#fffc;color:inherit;cursor:pointer}.zcode-save-banner-close:hover{background:#fff}.zcode-toolbar-separator{width:1px;height:24px;background-color:#e5e7eb;margin:0 4px}.zcode-dynamic-content-toggle-label{display:flex;align-items:center;gap:6px;padding:4px 8px;border-radius:4px;cursor:pointer;font-size:14px;color:#374151;-webkit-user-select:none;user-select:none}.zcode-dynamic-content-toggle-label:hover{background-color:#f3f4f6}.zcode-dynamic-content-toggle-checkbox{margin:0;cursor:pointer}.zcode-dev-container .zcode-cms-container .zcode-toolbar{display:none}.zcode-template-tabs{display:inline-flex;gap:6px;margin-right:8px}.zcode-template-tab{padding:6px 10px;border:1px solid #d1d5db;border-radius:6px;background:#fff;font-size:12px;color:#374151;cursor:pointer}.zcode-template-tab.active{background:#111827;border-color:#111827;color:#fff;font-weight:600}.zcode-css-inline-note{flex-shrink:0;margin:0 0 12px;padding:10px 12px;border:1px solid #fde68a;background:#fffbeb;border-radius:8px;color:#92400e;font-size:12px;line-height:1.6}.zcode-part-editor-preview-tab{border:1px solid #e5e7eb;border-radius:8px;background:#fff;padding:16px;min-height:240px;cursor:pointer}.zcode-part-editor-preview-hint{margin-top:10px;font-size:12px;color:#6b7280}.zcode-part-editor-pane{border:1px solid #e5e7eb;border-radius:8px;background:#fff;overflow:hidden;display:flex;flex-direction:column;min-height:0;min-width:0;flex:1}.zcode-part-editor-pane-header{padding:10px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;align-items:center;justify-content:space-between;gap:10px}.zcode-part-editor-pane-header-actions{display:flex;align-items:center;gap:8px;min-width:0}.zcode-css-warning-compact{display:flex;align-items:center;gap:6px;padding:6px 10px;background:#fffbeb;border:1px solid #fde68a;border-radius:6px;font-size:12px;color:#92400e}.zcode-css-warning-compact-icon{flex-shrink:0;color:#f59e0b}.zcode-css-warning-compact-text{white-space:nowrap;font-weight:500}.zcode-part-editor-pane-body{flex:1;min-height:0;overflow:hidden;padding:12px;display:flex;flex-direction:column}.zcode-part-editor-slots-toggle{width:100%;border:1px solid #e5e7eb;border-radius:8px;background:#f9fafb;padding:10px 12px;display:flex;align-items:center;justify-content:space-between;cursor:pointer;font-size:13px;font-weight:600;color:#374151}.zcode-part-editor-slots-toggle:hover{background:#f3f4f6}.zcode-part-editor-slots-toggle-icon{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;border-radius:999px;border:1px solid #d1d5db;background:#fff;color:#6b7280;font-size:16px;font-weight:400}.zcode-part-editor-slots-toggle-icon.open{transform:rotate(45deg)}.zcode-part-editor-slots-body{margin-top:10px}.zcode-part-editor-topbar{margin-bottom:16px}.zcode-part-editor-topfields{display:grid;grid-template-columns:1fr 1fr;gap:12px}.zcode-part-editor-slots-top{margin-top:12px}.zcode-part-editor-slots-bottom{margin-top:24px;padding-top:24px;border-top:1px solid #e5e7eb}.zcode-save-controls-fixed{position:fixed;bottom:20px;left:20px;display:flex;align-items:center;gap:8px;padding:12px 20px;background:#fffc;border-radius:8px;box-shadow:0 4px 12px #00000026;z-index:1000}.zcode-save-btn{display:flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid var(--zcode-color-edit);border-radius:6px;background:var(--zcode-color-edit);color:#fff;font-size:14px;cursor:pointer;transition:all .2s}.zcode-save-btn:hover{background:var(--zcode-color-edit-hover);border-color:var(--zcode-color-edit-hover)}.zcode-mode-btn{padding:8px 16px;border:2px solid #ddd;border-radius:6px;background:#fff;cursor:pointer;font-weight:500;transition:all .2s;font-size:14px;display:flex;align-items:center;gap:6px}.zcode-mode-btn:hover{background:#f3f4f6}.zcode-mode-edit:hover{color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg);border-color:var(--zcode-color-edit-border-hover)}.zcode-mode-reorder:hover{color:var(--zcode-color-reorder);background:var(--zcode-color-reorder-bg);border-color:var(--zcode-color-reorder-border-hover)}.zcode-mode-add:hover{color:var(--zcode-color-add);background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-border-hover)}.zcode-mode-delete:hover{color:var(--zcode-color-delete);background:var(--zcode-color-delete-bg);border-color:var(--zcode-color-delete-border-hover)}.zcode-mode-btn.active{border-color:currentColor;font-weight:600}.zcode-mode-edit.active{color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg-active);border-color:var(--zcode-color-edit)}.zcode-mode-reorder.active{color:var(--zcode-color-reorder);background:var(--zcode-color-reorder-bg-active);border-color:var(--zcode-color-reorder)}.zcode-mode-add.active{color:var(--zcode-color-add);background:var(--zcode-color-add-bg-active);border-color:var(--zcode-color-add)}.zcode-mode-delete.active{color:var(--zcode-color-delete);background:var(--zcode-color-delete-bg-active);border-color:var(--zcode-color-delete)}.zcode-view-mode-btn{padding:8px 16px;border:2px solid #ddd;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s;font-size:14px;font-weight:500;display:flex;align-items:center;gap:6px}.zcode-view-mode-btn:hover{background:#f9fafb;border-color:#d1d5db;color:#374151}.zcode-view-mode-btn.active{background:#3b82f6;color:#fff;border-color:#3b82f6}.zcode-view-mode-btn.active:hover{background:#2563eb;border-color:#2563eb}.zcode-settings-btn{display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:2px solid #ddd;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s}.zcode-settings-btn:hover{background:#f9fafb;border-color:#d1d5db;color:#374151}.zcode-settings-panel-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000}.zcode-settings-panel{background:#fff;border-radius:8px;box-shadow:0 10px 25px #0003;width:90%;max-width:500px;max-height:80vh;overflow-y:auto}.zcode-settings-panel-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid #e5e7eb;gap:12px}.zcode-settings-panel-header-title{margin:0;font-size:18px;font-weight:600;color:#111827;flex:1}.zcode-settings-panel-header-actions{display:flex;align-items:center;gap:12px}.zcode-language-select{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;color:#374151;cursor:pointer;transition:border-color .2s}.zcode-language-select:hover{border-color:#9ca3af}.zcode-language-select:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.zcode-settings-panel-content{padding:20px}.zcode-setting-item{margin-bottom:24px}.zcode-setting-item:last-child{margin-bottom:0}.zcode-setting-label{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:#374151;cursor:pointer;-webkit-user-select:none;user-select:none}.zcode-setting-checkbox{width:18px;height:18px;cursor:pointer}.zcode-info-btn{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;margin-left:auto;background:none;border:none;color:#6b7280;cursor:pointer;border-radius:4px;transition:color .2s}.zcode-info-btn:hover{color:#374151}.zcode-setting-description{margin:8px 0 0 26px;font-size:13px;color:#6b7280;line-height:1.5}.zcode-setting-info{margin:0;padding:12px;background:#f3f4f6;border-radius:6px;font-size:13px}.zcode-delete-panel-content{padding:16px;flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:16px}.zcode-delete-warning{display:flex;align-items:flex-start;gap:12px;padding:12px;background:var(--zcode-color-delete-bg);border:1px solid var(--zcode-color-delete-border-hover);border-radius:6px;color:var(--zcode-color-delete)}.zcode-delete-warning svg{flex-shrink:0;margin-top:2px}.zcode-delete-warning p{margin:0;font-size:14px;font-weight:500;line-height:1.5}.zcode-delete-actions{display:flex;gap:8px;margin-top:16px}.zcode-btn-danger{flex:1;padding:10px;background:var(--zcode-color-delete);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:600;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-danger:hover{background:var(--zcode-color-delete-hover)}.zcode-btn-cancel{flex:1;padding:10px;background:#e5e7eb;color:#374151;border:none;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-cancel:hover{background:#d1d5db}.zcode-parent-selector{padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-parent-select-btn{width:100%;padding:8px 12px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-parent-select-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-reorder-panel-content{padding:16px;flex:1;overflow-y:auto}.zcode-reorder-panel-content-text{margin:8px 0;color:#374151}.zcode-reorder-source{font-family:monospace;font-size:12px;color:#1f2937}.zcode-field-item{margin-bottom:20px}.zcode-field-item-title{margin:0 0 8px;font-size:14px;color:#374151;font-weight:600}.zcode-group-tabs{display:flex;gap:4px;padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;flex-shrink:0;-webkit-overflow-scrolling:touch}.zcode-group-tab{padding:6px 12px;font-size:13px;font-weight:500;color:#6b7280;background:#fff;border:1px solid #d1d5db;border-radius:4px;cursor:pointer;transition:all .2s;display:flex;align-items:center;gap:4px}.zcode-group-tab:hover{background:#f3f4f6;border-color:#9ca3af;color:#374151}.zcode-group-tab.active{background:var(--zcode-color-edit);border-color:var(--zcode-color-edit);color:#fff}.zcode-group-tab.active:hover{background:var(--zcode-color-edit-hover);border-color:var(--zcode-color-edit-hover)}@media(max-width:768px){.zcode-edit-panel,.zcode-add-panel,.zcode-reorder-panel,.zcode-delete-panel{width:100%;height:auto;position:fixed;inset:auto 0 0;border-radius:12px 12px 0 0;max-height:60vh;box-shadow:0 -4px 12px #00000026;z-index:1002;animation:zcode-slide-in-up .3s ease-out}@keyframes zcode-slide-in-up{0%{transform:translateY(100%)}to{transform:translateY(0)}}.zcode-insert-position{width:100%;right:0}.zcode-edit-actions{flex-direction:column;gap:12px}.zcode-edit-actions-btn{padding:10px 16px;font-size:14px}.zcode-toolbar{top:0;left:10px;right:10px;flex-wrap:nowrap;padding:6px 8px;gap:4px;overflow-x:auto;-webkit-overflow-scrolling:touch}.zcode-toolbar-btn{width:32px;height:32px;padding:0}.zcode-toolbar-btn-text{display:none}.zcode-view-mode-btn,.zcode-mode-btn{width:32px;height:32px;padding:0;justify-content:center}.zcode-view-mode-btn span,.zcode-mode-btn span{display:none}.zcode-settings-btn{width:36px;height:36px}.zcode-delete-dialog-content{width:95%;padding:16px}.zcode-save-controls-fixed{bottom:20px;left:20px;padding:0;background:transparent;box-shadow:none}.zcode-save-btn{width:48px;height:48px;padding:0;border-radius:50%;box-shadow:0 4px 12px #00000040;display:flex;align-items:center;justify-content:center;gap:0}.zcode-save-btn span{display:none}.zcode-save-btn svg{width:20px;height:20px}.zcode-edit-panel-header,.zcode-add-panel-header,.zcode-reorder-panel-header,.zcode-delete-panel-header{padding:10px 12px}.zcode-edit-fields{padding:12px}.zcode-field-item{margin-bottom:20px}.zcode-text-input,.zcode-textarea,.zcode-select,select{font-size:16px;padding:8px 12px}.zcode-textarea{min-height:100px}.zcode-btn,.zcode-btn-primary,.zcode-btn-danger,.zcode-btn-cancel{padding:10px}.zcode-group-tab,.zcode-image-select-btn,.zcode-image-clear-btn,.zcode-parent-select-btn{padding:8px 12px}}.zcode-part-category-tabs{display:flex;gap:4px;padding:8px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-shrink:0}.zcode-category-tab{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:13px;font-weight:500;color:#6b7280;transition:all .2s}.zcode-category-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-category-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-type-tabs{display:flex;gap:4px;padding:8px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;flex-shrink:0;-webkit-overflow-scrolling:touch}.zcode-type-tab{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:12px;font-weight:500;color:#6b7280;transition:all .2s;white-space:nowrap}.zcode-type-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-type-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-part-list{flex:1;overflow-y:auto;padding:12px}.zcode-part-type-section{margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #e5e7eb}.zcode-part-type-section:last-child{border-bottom:none;margin-bottom:0}.zcode-type-section-title{font-size:14px;font-weight:600;color:#1f2937;margin:0 0 6px}.zcode-type-section-description{font-size:12px;color:#6b7280;margin:0 0 8px;line-height:1.5}.zcode-module-buttons{display:grid;grid-template-columns:1fr;gap:6px}.zcode-empty-parts{text-align:center;padding:40px 20px;color:#9ca3af}.zcode-empty-parts-text{margin:0;font-size:14px}.zcode-module-preview{border:2px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;transition:all .2s;overflow:hidden;display:flex;flex-direction:column}.zcode-module-preview:hover{border-color:#9ca3af;box-shadow:0 4px 6px #0000001a}.zcode-module-preview.active{border-color:var(--zcode-color-add);box-shadow:0 0 0 3px #10b9811a}.zcode-module-preview-label{padding:6px 10px;background:#f9fafb;border-bottom:1px solid #e5e7eb;font-size:11px;font-weight:600;color:#374151;text-align:center}.zcode-module-preview.active .zcode-module-preview-label{background:var(--zcode-color-add);color:#fff}.zcode-module-preview-header{display:flex;align-items:center;justify-content:space-between;padding:0;background:#f9fafb;border-bottom:1px solid #e5e7eb}.zcode-module-preview-header .zcode-module-preview-label{flex:1;padding:4px 8px;background:transparent;border-bottom:none;text-align:left}.zcode-module-preview-icon-btn{border:none;background:transparent;padding:0 6px 0 0;cursor:pointer;color:#6b7280;display:flex;align-items:center;justify-content:center}.zcode-module-preview-icon-btn:hover{color:#111827}.zcode-module-preview.active .zcode-module-preview-header{background:var(--zcode-color-add)}.zcode-module-preview.active .zcode-module-preview-header .zcode-module-preview-label{color:#fff}.zcode-module-preview.active .zcode-module-preview-icon-btn{color:#ecfeff}.zcode-module-preview-content{padding:0;flex:1;overflow:hidden;overflow-y:hidden}.zcode-module-preview-content *{max-width:100%}.zcode-copy-notice{display:flex;align-items:center;gap:8px;padding:8px 12px;background:#f0f9ff;border:1px solid #bae6fd;border-radius:4px;margin-bottom:12px}.zcode-copy-notice-icon{flex-shrink:0;color:#0ea5e9}.zcode-copy-notice-text{margin:0;font-size:13px;color:#075985}.zcode-insert-position{padding:12px 20px;border-top:1px solid #e5e7eb;background:#fff}.zcode-insert-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;gap:16px}.zcode-insert-position-title{margin:0;font-size:14px;font-weight:600;color:#374151;flex-shrink:0}.zcode-keep-adding-label-position{margin-top:0;flex-shrink:0;white-space:nowrap}.zcode-keep-adding-label{display:flex;align-items:center;gap:6px;font-size:14px;cursor:pointer;-webkit-user-select:none;user-select:none}.zcode-keep-adding-checkbox{width:16px;height:16px;cursor:pointer}.zcode-insert-buttons{display:flex;gap:8px}.zcode-insert-btn{flex:1;padding:12px 16px;border:2px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:14px;font-weight:600;color:#374151;transition:all .2s}.zcode-insert-btn:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-insert-before{border-color:var(--zcode-color-add);color:var(--zcode-color-add)}.zcode-insert-before:hover{background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-hover)}.zcode-insert-after{border-color:var(--zcode-color-add);color:var(--zcode-color-add)}.zcode-insert-after:hover{background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-hover)}.zcode-empty-slot{padding:20px;text-align:center;border:2px dashed #d1d5db;border-radius:8px;background:#f9fafb}.zcode-add-slot-btn{padding:8px 16px;background:var(--zcode-color-add);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-add-slot-btn:hover{background:var(--zcode-color-add-hover)}.zcode-add-btn{padding:10px 20px;font-size:16px;background:var(--zcode-color-add);color:#fff;border:none;border-radius:6px;cursor:pointer;transition:background .2s;font-weight:500}.zcode-add-btn:hover{background:var(--zcode-color-add-hover)}@media(max-width:768px){.zcode-part-category-tabs,.zcode-type-tabs{padding:8px 12px}.zcode-part-list,.zcode-part-item{padding:12px}}.zcode-rich-text-editor{border:1px solid #d1d5db;border-radius:6px;overflow:hidden;background:#fff}.zcode-rich-text-toolbar{display:flex;align-items:center;gap:4px;padding:8px;border-bottom:1px solid #d1d5db;background:#f9fafb;flex-wrap:wrap}.zcode-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid #d1d5db;border-radius:4px;background:#fff;cursor:pointer;font-size:14px;transition:all .2s;padding:0}.zcode-toolbar-btn:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-toolbar-btn.is-active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit)}.zcode-toolbar-divider{width:1px;height:24px;background:#d1d5db;margin:0 4px}.zcode-rich-text-editor-content{min-height:200px;max-height:400px;overflow-y:auto;padding:12px}.zcode-tiptap-editor{outline:none;white-space:pre-wrap}.zcode-tiptap-editor p.is-editor-empty:first-child:before{content:attr(data-placeholder);float:left;color:#9ca3af;pointer-events:none;height:0}.zcode-tiptap-editor p{margin:.5em 0}.zcode-tiptap-editor ul,.zcode-tiptap-editor ol{padding-left:1.5em;margin:.5em 0}.zcode-tiptap-editor ul{list-style-type:disc}.zcode-tiptap-editor ol{list-style-type:decimal}.zcode-rich-text-editor-content ul{list-style-type:disc}.zcode-rich-text-editor-content ol{list-style-type:decimal}.zcode-rich-text-editor-content ul,.zcode-rich-text-editor-content ol{padding-left:1.5em;margin:.5em 0}.zcode-tiptap-editor a.zcode-link{color:var(--zcode-color-edit);text-decoration:underline}.zcode-tiptap-editor strong{font-weight:600}.zcode-tiptap-editor em{font-style:italic}.zcode-tiptap-editor s{text-decoration:line-through}.zcode-image-editor{margin-bottom:16px}.zcode-image-editor-input{width:100%;margin-bottom:8px}.zcode-image-editor-buttons{display:flex;gap:8px;margin-bottom:12px}.zcode-image-select-btn{flex:1;padding:8px 16px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-image-select-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-image-clear-btn{flex:1;padding:8px 12px;background:#ef4444;color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-image-clear-btn:hover{background:#dc2626}.zcode-image-preview{margin-top:12px;border:1px solid #d1d5db;border-radius:6px;padding:8px;background:#f9fafb;display:flex;justify-content:center;align-items:center}.zcode-image-preview-img{max-width:100%;max-height:200px;object-fit:contain;border-radius:4px}.zcode-image-modal{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000;padding:20px}.zcode-image-modal-content{background:#fff;border-radius:12px;box-shadow:0 4px 16px #0003;max-width:800px;width:90%;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-image-modal-content[data-edit-mode]{max-width:500px;width:100%;border-radius:8px;box-shadow:0 10px 40px #0003}.zcode-image-modal-header{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid #e5e7eb}.zcode-image-modal-header-title{margin:0;font-size:20px;font-weight:600;color:#1f2937}.zcode-image-current{padding:16px 24px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-image-current-title{margin:0 0 12px;font-size:14px;font-weight:600;color:#6b7280}.zcode-image-current-item{display:flex;align-items:center;gap:12px}.zcode-image-current-item-img{width:60px;height:60px;object-fit:cover;border-radius:6px;border:1px solid #d1d5db}.zcode-image-current-name{font-size:14px;color:#374151;font-weight:500}.zcode-image-tabs{display:flex;border-bottom:1px solid #e5e7eb;padding:0 24px}.zcode-image-tab{padding:12px 20px;background:none;border:none;border-bottom:2px solid transparent;cursor:pointer;font-size:14px;font-weight:500;color:#6b7280;transition:all .2s}.zcode-image-tab:hover{color:#1f2937;background:#f9fafb}.zcode-image-tab.active{color:var(--zcode-color-edit);border-bottom-color:var(--zcode-color-edit)}.zcode-image-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:16px;padding:24px;overflow-y:auto;flex:1}.zcode-image-name{padding:8px;font-size:12px;color:#374151;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.zcode-image-add{padding:16px 24px;border-top:1px solid #e5e7eb;background:#f9fafb}.zcode-image-add-btn{width:100%;padding:10px 16px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:8px}.zcode-image-add-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-image-modal-actions{display:flex;gap:8px;padding:16px 24px;border-top:1px solid #e5e7eb;background:#fff}.zcode-image-modal-actions-btn{flex:1}.zcode-dev-container{width:100%;min-height:100vh;display:flex;flex-direction:column;position:relative}.zcode-cms-container.zcode-dev-padding{padding-right:375px}@media(max-width:768px){.zcode-cms-container.zcode-dev-padding{padding-right:0;padding-bottom:60vh}.zcode-dev-header{flex-direction:column;align-items:stretch;padding:0;gap:8px;background:none;border-bottom:none;box-shadow:none}.zcode-dev-tab{border-bottom:1px solid #e5e7eb}}.zcode-dev-container>zcode-cms{display:block}.zcode-loading-message{padding:40px;text-align:center;color:#6b7280}.zcode-loading-message-text{margin:8px 0;font-size:14px}.zcode-dev-tabs{display:flex;gap:8px;padding:0;flex-shrink:0;width:100%;box-sizing:border-box;background:#f9fafb;justify-content:space-between}.zcode-dev-tab{padding:10px 20px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-weight:500;font-size:14px;transition:background .15s ease,border-color .15s ease,color .15s ease,box-shadow .15s ease;display:flex;align-items:center;gap:6px;color:#6b7280;flex:1 1 0;justify-content:center;text-align:center}.zcode-dev-settings-btn{flex:0 0 auto;padding:6px;min-width:32px;justify-content:center;border-radius:4px;font-size:12px}.zcode-dev-tab:hover{background:#f3f4f6;border-color:#9ca3af;box-shadow:0 1px 3px #0f172a14}.zcode-dev-tab.active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit);font-weight:600;box-shadow:0 2px 6px #2563eb40}@media(max-width:768px){.zcode-dev-tabs{display:grid;grid-template-columns:repeat(2,1fr);gap:6px;background:transparent}.zcode-dev-tab{width:auto;flex:none;justify-content:flex-start;text-align:left;padding:10px 12px;font-size:13px}.zcode-dev-tab.zcode-dev-settings-btn{display:none}}.zcode-dev-settings-btn-fixed{display:none}@media(max-width:768px){.zcode-dev-settings-btn-fixed{position:fixed;bottom:20px;right:20px;width:48px;height:48px;padding:0;border:2px solid #d1d5db;border-radius:50%;background:#fff;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 12px #00000040;z-index:1000;transition:all .2s ease}.zcode-dev-settings-btn-fixed:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-dev-settings-btn-fixed svg{width:20px;height:20px}}.zcode-parts-manager{width:100%;background:#fff}.zcode-parts-manager-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center}.zcode-parts-manager-header-title{margin:0;font-size:18px;color:#1f2937}.zcode-parts-category-tabs,.zcode-images-category-tabs{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-parts-add-wrapper,.zcode-images-add-wrapper{display:flex;align-items:center;flex-shrink:0}.zcode-parts-category-tab-group,.zcode-images-category-tab-group{display:flex;gap:4px}.zcode-parts-manager-content{display:flex;flex-direction:column}.zcode-parts-list-header{padding:16px;border-bottom:1px solid #e5e7eb;display:flex;justify-content:space-between;align-items:center;background:#fff}.zcode-parts-list-header-title{margin:0;font-size:14px;font-weight:600;color:#1f2937}.zcode-parts-items{padding:16px}.zcode-part-item{padding:16px;border:1px solid #e5e7eb;border-radius:8px;cursor:pointer;transition:all .2s;background:#fff;height:100%;display:flex;flex-direction:column;position:relative}.zcode-part-item:hover{border-color:#d1d5db;box-shadow:0 2px 8px #0000001a}.zcode-part-item.zcode-reorder-source{border-color:var(--zcode-color-reorder);background:#f59e0b05;box-shadow:0 0 0 1px #f59e0b1a}.zcode-reorder-source-indicator{position:absolute;top:-10px;right:10px;background:var(--zcode-color-reorder);color:#fff;padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600;z-index:10}.zcode-part-item-add{border:2px dashed #d1d5db;background:#f9fafb;display:flex;align-items:center;justify-content:center;min-height:120px;cursor:pointer}.zcode-part-item-add:hover{border-color:var(--zcode-color-add);background:var(--zcode-color-add-bg);transform:translateY(-2px)}.zcode-part-item-add-content{display:flex;flex-direction:column;align-items:center;gap:8px;color:#6b7280;font-size:14px;font-weight:500}.zcode-part-item-add:hover .zcode-part-item-add-content{color:var(--zcode-color-add)}.zcode-part-item-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.zcode-part-item-actions{display:flex;gap:4px;align-items:center}.zcode-action-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-action-btn:hover{background:#e5e7eb;color:#374151}.zcode-action-btn.active{background:var(--zcode-color-reorder);color:#fff}.zcode-action-btn.zcode-delete-btn:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-part-duplicate-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-part-duplicate-btn:hover{background:var(--zcode-color-add-bg);color:var(--zcode-color-add)}.zcode-part-type{font-weight:600;font-size:14px;color:#1f2937}.zcode-part-actions{display:flex;gap:4px}.zcode-part-edit-btn,.zcode-part-delete-btn,.zcode-module-delete-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-part-edit-btn:hover{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit)}.zcode-part-delete-btn:hover,.zcode-module-delete-btn:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-part-description{font-size:13px;color:#6b7280;margin-bottom:4px}.zcode-description-empty{color:#9ca3af;font-style:italic}.zcode-part-modules{font-size:12px;color:#9ca3af}.zcode-part-type-group{margin-bottom:24px}.zcode-part-type-title{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:16px;font-weight:600;color:#1f2937;margin:0 0 12px;padding-bottom:8px;border-bottom:2px solid #e5e7eb}.zcode-part-type-actions{display:flex;align-items:center;gap:4px}.zcode-part-type-edit-btn{padding:4px 8px;border:1px solid #e5e7eb;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;transition:all .2s}.zcode-part-type-edit-btn:hover{background:var(--zcode-color-edit-bg);border-color:var(--zcode-color-edit-border-hover);color:var(--zcode-color-edit)}.zcode-part-type-items{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}.zcode-part-preview{margin-top:12px;padding:8px;border:1px solid #e5e7eb;border-radius:6px;background:#f9fafb;max-height:150px;overflow:hidden;flex:1;min-height:0}.zcode-part-preview-content{font-size:11px;line-height:1.4;pointer-events:none;transform:scale(.75);transform-origin:top left;width:133.33%}.zcode-required{color:#ef4444;margin-left:2px}.zcode-part-modal{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000;padding:20px}.zcode-part-modal-content{background:#fff;border-radius:8px;box-shadow:0 10px 40px #0003;width:100%;max-width:95vw;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-part-editor{display:flex;flex-direction:column;overflow:hidden;height:100%}.zcode-part-editor-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-part-editor-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-part-editor-form{flex:1;overflow-y:auto;padding:24px 24px 80px}.zcode-part-editor-main{display:grid;grid-template-columns:1fr 1fr;gap:24px;align-items:stretch;min-height:0}.zcode-part-editor-fields{display:flex;flex-direction:column;gap:16px}.zcode-part-editor-preview{border:1px solid #e5e7eb;border-radius:8px;padding:16px;background:#f9fafb;position:sticky;top:0;max-height:calc(90vh - 200px);display:flex;flex-direction:column}.zcode-part-editor-preview-title{margin:0 0 12px;font-size:14px;font-weight:600;color:#1f2937}.zcode-preview-module-selector{margin-bottom:12px}.zcode-select-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;cursor:pointer}.zcode-select-input:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-editing-preview-content{flex:1;overflow-y:auto;padding:12px;background:#fff;border-radius:6px;min-height:200px;transform:scale(.9);transform-origin:top left;width:111.11%}.zcode-preview-empty{flex:1;display:flex;align-items:center;justify-content:center;color:#9ca3af;font-size:14px}.zcode-preview-modal{position:fixed;inset:0;background:#000c;display:flex;align-items:center;justify-content:center;z-index:3000;padding:20px}.zcode-preview-modal-content{background:#fff;border-radius:8px;width:90%;max-width:1200px;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-preview-modal-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-preview-modal-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-preview-modal-body{padding:24px;overflow-y:auto;flex:1}.zcode-help-modal-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:10000;padding:20px}.zcode-help-modal{background:#fff;border-radius:8px;width:90%;max-width:800px;max-height:80vh;overflow:auto;box-shadow:0 20px 25px -5px #0000001a}.zcode-help-modal-header{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid #e5e7eb;background:#f9fafb;position:sticky;top:0;z-index:1}.zcode-help-modal-header-title{margin:0;font-size:18px;font-weight:600;color:#1f2937;display:flex;align-items:center;gap:8px}.zcode-css-warning-modal-title-icon{color:#f59e0b;flex-shrink:0}.zcode-help-modal-body{padding:24px}.zcode-help-table{width:100%;border-collapse:collapse;margin-bottom:24px}.zcode-help-table-cell{padding:14px 16px;text-align:left;border-bottom:1px solid #e5e7eb;border-right:1px solid #e5e7eb;vertical-align:top}.zcode-help-table-cell:last-child{border-right:none}.zcode-help-table-header{background:#f9fafb;font-weight:600;color:#374151;font-size:13px;text-transform:uppercase;letter-spacing:.5px}.zcode-help-table-data{font-size:14px;color:#4b5563;line-height:1.6}.zcode-help-table-data:first-child{width:35%}.zcode-help-table-data:nth-child(2){width:30%}.zcode-help-table-data:nth-child(3){width:35%}.zcode-help-table-code{background:#f3f4f6;padding:3px 8px;border-radius:4px;font-size:13px;color:#dc2626;font-family:Courier New,Courier,monospace;white-space:nowrap;border:1px solid #e5e7eb}.zcode-help-table-row:hover{background:#fafafa}.zcode-help-section{background:#f9fafb;padding:12px 16px;border-radius:6px;border:1px solid #e5e7eb;margin-bottom:16px}.zcode-help-section:last-child{margin-bottom:0}.zcode-help-section-title{margin:0 0 8px;color:#374151;font-size:14px;font-weight:600}.zcode-help-section-list{margin:0;padding-left:0;list-style-position:inside}.zcode-help-section-item{margin-bottom:6px;color:#6b7280;font-size:13px;line-height:1.6}.zcode-help-section-item:last-child{margin-bottom:0}.zcode-help-section-code{background:#f3f4f6;padding:2px 6px;border-radius:3px;font-size:12px;color:#dc2626;font-family:Courier New,Courier,monospace;border:1px solid #e5e7eb}.zcode-slots-config{display:flex;flex-direction:column;gap:16px}.zcode-slot-config-item{border:1px solid #e5e7eb;border-radius:6px;padding:12px;background:#f9fafb}.zcode-slot-config-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #e5e7eb}.zcode-slot-config-header-title{font-size:14px;color:#1f2937}.zcode-slot-config-body{display:flex;flex-direction:column;gap:8px}.zcode-slot-config-body-label{font-size:12px;font-weight:600;color:#6b7280;margin-bottom:4px}.zcode-checkbox-group{display:flex;flex-direction:column;gap:6px}.zcode-checkbox-item{display:flex;align-items:center;gap:6px;cursor:pointer}.zcode-checkbox-item:hover{background-color:transparent}.zcode-checkbox{width:16px;height:16px;cursor:pointer;accent-color:var(--zcode-color-edit);flex-shrink:0}.zcode-checkbox-item span{font-size:13px;color:#374151;-webkit-user-select:none;user-select:none}.zcode-module-slots-config{margin-top:16px;padding-top:16px;border-top:1px solid #e5e7eb}.zcode-slot-add-section{margin-top:16px;padding:12px;border:1px dashed #d1d5db;border-radius:6px;background:#f9fafb}.zcode-slot-add-section-label{display:block;font-size:13px;font-weight:600;color:#374151;margin-bottom:8px}.zcode-slot-add-controls{display:flex;gap:8px;align-items:center}.zcode-select-input{flex:1;padding:8px 12px;border:1px solid #d1d5db;border-radius:4px;background:#fff;font-size:14px;color:#1f2937;cursor:pointer;transition:border-color .2s}.zcode-select-input:hover{border-color:#9ca3af}.zcode-select-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-select{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;color:#1f2937;cursor:pointer;transition:border-color .2s}.zcode-select:hover{border-color:#9ca3af}.zcode-select:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-select[multiple]{padding:4px;cursor:default}.zcode-select-option{padding:6px 8px;border-radius:4px;margin:2px 0}.zcode-select-option:checked{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit)}.zcode-tag-editor{display:flex;flex-direction:column;gap:8px}.zcode-tag-preview{font-size:12px;color:#6b7280;padding:4px 8px;background-color:#f3f4f6;border-radius:4px;font-family:Courier New,monospace}.zcode-tag-preview code{background-color:transparent;padding:0;color:#374151;font-weight:600}.zcode-slot-add-empty{margin-top:16px;padding:12px;text-align:center;color:#6b7280;font-size:13px;font-style:italic}.zcode-module-slots-config-label{font-size:13px;font-weight:600;color:#374151;margin-bottom:8px;display:block}.zcode-form-hint{font-size:12px;color:#6b7280;margin-top:4px;margin-bottom:12px;font-style:italic}.zcode-btn-small{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s;font-size:12px}.zcode-btn-small:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-module-item.active{border-color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg)}.zcode-module-delete-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-module-delete-btn:hover:not(:disabled){background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-module-delete-btn:disabled{opacity:.4;cursor:not-allowed}.zcode-module-actions{display:flex;gap:4px;align-items:center}.zcode-module-duplicate-btn,.zcode-module-copy-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-module-duplicate-btn:hover:not(:disabled),.zcode-module-copy-btn:hover:not(:disabled){background:var(--zcode-color-add-bg);color:var(--zcode-color-add)}.zcode-module-copy-btn:disabled{opacity:.4;cursor:not-allowed}.zcode-form-field{margin-bottom:16px}.zcode-form-field-label{display:block;font-size:14px;font-weight:500;color:#374151;margin-bottom:6px}.zcode-form-field-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}.zcode-form-field-header>.zcode-form-field-label:first-child{margin-bottom:0}.zcode-form-field-actions{display:flex;align-items:center;gap:8px}.zcode-help-btn{display:flex;align-items:center;justify-content:center;padding:4px;background:transparent;border:none;color:#6b7280;cursor:pointer;border-radius:4px;transition:all .2s}.zcode-help-btn:hover{color:#374151;background:transparent}.zcode-checkbox-label{display:flex;align-items:center;gap:6px;cursor:pointer;-webkit-user-select:none;user-select:none;margin-bottom:0}.zcode-checkbox-label-inline{margin-bottom:0}.zcode-checkbox-input{width:16px;height:16px;cursor:pointer;margin:0}.zcode-checkbox-label span{font-size:13px;color:#6b7280;font-weight:400}.zcode-text-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;transition:border-color .2s}.zcode-text-input:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-monaco-editor{width:100%;flex:1;min-height:0;display:flex;flex-direction:column}.zcode-monaco-editor .monaco-editor-wrapper{flex:1;min-height:0;display:flex;flex-direction:column}.zcode-monaco-editor .monaco-editor-container{border:1px solid #d1d5db;border-radius:4px;flex:1;min-height:0;max-height:none!important}.zcode-textarea{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;font-family:monospace;resize:vertical;transition:border-color .2s}.zcode-textarea:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-modules-list{margin-bottom:12px}.zcode-module-item{padding:12px;border:1px solid #e5e7eb;border-radius:6px;margin-bottom:12px;background:#f9fafb;cursor:pointer;transition:all .2s}.zcode-module-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.zcode-module-title{font-weight:600;font-size:14px;color:#1f2937}.zcode-module-body{display:flex;flex-direction:column;gap:8px}.zcode-module-body-label{font-size:12px;font-weight:500;color:#6b7280}.zcode-part-editor-actions{display:flex;gap:8px;padding:16px 24px;border-top:1px solid #e5e7eb;background:#fff;flex-shrink:0}.zcode-part-editor-actions-btn{flex:1}.zcode-part-editor-actions-btn-primary,.zcode-btn-primary{padding:10px 20px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:600;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-parts-new-btn{padding:7px 12px;font-size:13px;border-radius:4px;white-space:nowrap;flex-shrink:0}.zcode-images-add-btn{padding:7px 12px;font-size:13px;border-radius:4px}.zcode-btn-primary:hover{background:var(--zcode-color-edit-hover)}.zcode-btn-secondary{padding:8px 16px;background:#f3f4f6;color:#374151;border:1px solid #d1d5db;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:all .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-secondary:hover{background:#e5e7eb;border-color:#9ca3af}.zcode-page-css-panel{width:100%;background:#fff;display:flex;flex-direction:column;height:100%;flex:1;min-height:0}.zcode-warning-banner{padding:16px;background:#fff3cd;border-bottom:1px solid #ffc107;display:flex;gap:12px}.zcode-warning-icon{font-size:20px;flex-shrink:0}.zcode-warning-content{flex:1}.zcode-warning-title{margin:0 0 8px;font-size:14px;font-weight:700;color:#856404}.zcode-warning-list{margin:0;padding-left:20px;font-size:13px;color:#856404;line-height:1.6}.zcode-warning-list li{margin-bottom:4px}.zcode-warning-list strong{font-weight:700}.zcode-warning-inline{padding:12px;background:#fff3cd;border:1px solid #ffc107;border-radius:6px;margin-bottom:16px;display:flex;gap:12px}.zcode-warning-inline .zcode-warning-icon{font-size:18px;flex-shrink:0}.zcode-warning-inline .zcode-warning-content{flex:1}.zcode-warning-inline .zcode-warning-title{margin:0 0 8px;font-size:13px;font-weight:700;color:#856404}.zcode-warning-inline .zcode-warning-text{font-size:12px;color:#856404;line-height:1.6}.zcode-warning-inline .zcode-warning-text ul{margin:0;padding-left:20px}.zcode-warning-inline .zcode-warning-text li{margin-bottom:4px}.zcode-css-warning-modal{max-width:500px}.zcode-css-warning-modal-footer{display:flex;flex-direction:column;justify-content:center;align-items:center;padding:16px 24px;border-top:1px solid #e5e7eb;background:#f9fafb}.zcode-css-warning-modal .zcode-warning-content{padding:0}.zcode-css-warning-modal .zcode-warning-list{margin:0;padding-left:20px;font-size:14px;color:#856404;line-height:1.8;list-style-type:disc;list-style-position:outside}.zcode-css-warning-modal .zcode-warning-list li{margin-bottom:8px;list-style-type:disc}.zcode-css-warning-modal .zcode-warning-list strong{font-weight:700;color:#92400e}.zcode-page-css-content{display:flex;flex:1;overflow:hidden}.zcode-page-css-parts-selector{width:280px;border-right:1px solid #e5e7eb;display:flex;flex-direction:column;overflow:hidden;background:#f9fafb}.zcode-search-box{padding:12px;border-bottom:1px solid #e5e7eb;background:#fff}.zcode-search-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff}.zcode-search-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-parts-list{flex:1;overflow-y:auto;padding:12px}.zcode-parts-section{margin-bottom:24px}.zcode-parts-section:last-child{margin-bottom:0}.zcode-parts-section-title{margin:0 0 8px;padding:8px 12px;font-size:12px;font-weight:700;color:#6b7280;text-transform:uppercase;letter-spacing:.05em;background:#fff;border-radius:4px}.zcode-part-item{padding:12px;border:1px solid #e5e7eb;border-radius:6px;cursor:pointer;transition:all .2s;background:#fff;margin-bottom:8px}.zcode-part-item:hover{border-color:#d1d5db;box-shadow:0 2px 4px #0000000d}.zcode-part-item-selected{border-color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg);box-shadow:0 0 0 2px #3b82f633}.zcode-part-item-title{font-size:14px;font-weight:600;color:#1f2937;margin-bottom:4px}.zcode-part-item-id{font-size:12px;color:#6b7280;font-family:monospace}.zcode-page-css-preview{flex:1;border-right:1px solid #e5e7eb;display:flex;flex-direction:column;overflow:hidden;background:#f9fafb}.zcode-preview-container{flex:1;overflow:auto;padding:24px}.zcode-preview-content{max-width:800px;margin:0 auto;background:#fff;padding:24px;border-radius:8px;box-shadow:0 2px 8px #0000001a}.zcode-preview-content [data-zcode-highlight=true]{outline:3px solid var(--zcode-color-edit);outline-offset:4px;background:var(--zcode-color-edit-bg)}.zcode-page-css-editor{width:100%;display:flex;flex-direction:column;overflow:hidden;background:#fff;flex:1;min-height:0}.zcode-page-css-editor .zcode-form-field{flex:1;display:flex;flex-direction:column;padding:16px;overflow:hidden}.zcode-page-css-editor .zcode-form-field label{margin-bottom:8px;font-size:14px;font-weight:600;color:#1f2937}.zcode-page-css-editor .monaco-editor-wrapper{flex:1;min-height:0}.zcode-page-css-editor .monaco-editor-container{height:100%;min-height:320px;max-height:none}.zcode-page-css-actions{padding:16px;border-top:1px solid #e5e7eb;display:flex;gap:8px;justify-content:flex-end;flex-shrink:0}.zcode-page-css-actions .zcode-btn-primary,.zcode-page-css-actions .zcode-btn-secondary{flex:1}.zcode-images-manager{width:100%;background:#fff}.zcode-images-manager-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center}.zcode-images-manager-header-title{margin:0;font-size:18px;color:#1f2937}.zcode-images-manager-content{display:flex;flex-direction:column}.zcode-images-grid{padding:16px;display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:16px;align-content:start}.zcode-image-item{position:relative;border:2px solid #e5e7eb;border-radius:8px;cursor:pointer;background:#f9fafb;display:flex;flex-direction:column;overflow:hidden}.zcode-image-item>img{width:100%;height:150px;object-fit:cover;display:block;flex-shrink:0}.zcode-image-item:hover{border-color:#d1d5db;box-shadow:0 2px 8px #0000001a}.zcode-image-item.zcode-reorder-source{border-color:var(--zcode-color-reorder);background:#f59e0b05;box-shadow:0 0 0 1px #f59e0b1a}.zcode-image-item.selected{border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f633}.zcode-image-item-clickable{cursor:pointer}.zcode-image-item-img{width:100%;height:150px;object-fit:cover;display:block}.zcode-image-item-overlay{position:absolute;inset:0;pointer-events:none}.zcode-image-item-actions{position:absolute;top:8px;right:8px;display:flex;gap:4px;opacity:0;pointer-events:auto}.zcode-image-item:hover .zcode-image-item-actions{opacity:1}.zcode-image-edit-btn,.zcode-image-delete-btn{padding:8px;border:none;border-radius:4px;background:#ffffffe6;color:#374151;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-image-edit-btn:hover{background:#fff;color:var(--zcode-color-edit)}.zcode-image-delete-btn:hover{background:#fff;color:var(--zcode-color-delete)}.zcode-image-item-name{padding:8px;font-size:12px;color:#374151;text-align:center;background:#fff;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:break-all;overflow-wrap:break-word;max-width:100%}.zcode-image-editor-panel{position:static;width:auto;height:auto;background:transparent;box-shadow:none;display:block;z-index:auto}.zcode-image-editor-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-image-editor-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-image-editor-form{flex:1;overflow-y:auto;padding:16px}.zcode-image-preview-large{margin-bottom:16px;border:1px solid #e5e7eb;border-radius:6px;padding:8px;background:#f9fafb;display:flex;justify-content:center;align-items:center}.zcode-image-preview-large-img{max-width:100%;max-height:200px;object-fit:contain;border-radius:4px}.zcode-image-editor-actions{display:flex;gap:8px;margin-top:16px;padding-top:16px;border-top:1px solid #e5e7eb}.zcode-image-editor-actions-btn{flex:1}@media(max-width:768px){.zcode-part-type-items{grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:12px}.zcode-part-modal{padding:10px}.zcode-part-modal-content{max-width:100%;max-height:95vh}.zcode-part-editor-main,.zcode-part-editor-topfields{grid-template-columns:1fr}.zcode-part-editor-preview{position:relative;max-height:400px}.zcode-images-grid{grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:12px}}.zcode-data-viewer{border-top:1px solid #e5e7eb;background:#fff;display:flex;flex-direction:column;min-height:200px;flex-shrink:0;height:100%;overflow:hidden}.zcode-data-viewer-header{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;padding:8px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-data-viewer-content-tabs{display:flex;gap:4px}.zcode-data-viewer-content-tab{padding:6px 12px;font-size:13px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;font-weight:500;transition:all .2s}.zcode-data-viewer-content-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-data-viewer-content-tab.active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit)}.zcode-data-viewer-tabs{display:flex;gap:4px;align-items:center}.zcode-data-viewer-tab{padding:6px 12px;font-size:13px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;font-weight:500;transition:all .2s}.zcode-data-viewer-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-data-viewer-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-data-viewer-error{padding:12px 16px;background:#fee;color:#c33;border-bottom:1px solid #e5e7eb;font-size:13px}.zcode-data-viewer-content{flex:1;overflow:auto;position:relative}.zcode-data-viewer-display-wrapper{position:relative;width:100%;height:100%}.zcode-data-viewer-display{margin:0;padding:16px;font-family:Monaco,Menlo,Ubuntu Mono,monospace;font-size:13px;line-height:1.6;color:#f9fafb;background:#111827;white-space:pre;overflow-x:auto;border-top:1px solid #374151}.zcode-data-viewer-copy-btn{position:absolute;top:12px;right:12px;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid rgba(255,255,255,.2);border-radius:4px;background:#111827cc;color:#f9fafb;cursor:pointer;transition:all .2s;z-index:10}.zcode-data-viewer-copy-btn:hover{background:#111827f2;border-color:#ffffff4d;color:#fff}.zcode-data-viewer-copy-btn:active{transform:scale(.95)}.zcode-input-readonly,.zcode-textarea-readonly{display:none}.zcode-dev-container .zcode-input-readonly,.zcode-dev-container .zcode-textarea-readonly{display:block;background-color:#f3f4f6;color:#6b7280;border-color:#d1d5db;cursor:default;pointer-events:none}.zcode-context-menu{position:fixed;background:#fff;border:1px solid #e5e7eb;border-radius:6px;box-shadow:0 4px 12px #00000026;padding:4px;z-index:10000;min-width:160px}.zcode-context-menu-item{display:flex;align-items:center;gap:8px;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;border-radius:4px;font-size:14px;color:#374151;transition:background .2s}.zcode-context-menu-item:hover{background:#f3f4f6}.zcode-context-menu-item.active{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit);font-weight:500}.zcode-context-menu-divider{height:1px;background:#e5e7eb;margin:4px 0}.zcode-save-confirm-dialog-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:10000}.zcode-save-confirm-dialog{background:#fff;border-radius:8px;box-shadow:0 10px 25px #0003;max-width:500px;width:90%;max-height:80vh;display:flex;flex-direction:column}.zcode-save-confirm-dialog-header{padding:16px 20px;border-bottom:1px solid #e5e7eb}.zcode-save-confirm-dialog-title{font-size:18px;font-weight:600;color:#111827}.zcode-save-confirm-dialog-body{padding:20px;flex:1;overflow-y:auto}.zcode-save-confirm-dialog-body p{margin:0 0 12px;font-size:14px;color:#374151}.zcode-save-confirm-targets{list-style:none;padding:0;margin:12px 0}.zcode-save-confirm-targets li{padding:8px 12px;background:#f9fafb;border-radius:4px;margin-bottom:8px;font-size:14px;color:#374151}.zcode-save-confirm-targets li:last-child{margin-bottom:0}.zcode-save-confirm-dialog-footer{padding:16px 20px;border-top:1px solid #e5e7eb;display:flex;justify-content:flex-end;gap:12px}.zcode-btn-secondary{padding:8px 16px;background:#fff;border:1px solid #d1d5db;border-radius:6px;font-size:14px;cursor:pointer;color:#374151;transition:background-color .2s,border-color .2s}.zcode-btn-secondary:hover{background:#f9fafb;border-color:#9ca3af}.zcode-btn-primary{padding:8px 16px;background:#3b82f6;border:none;border-radius:6px;font-size:14px;cursor:pointer;color:#fff;transition:background-color .2s}.zcode-btn-primary:hover{background:#2563eb}@media(max-width:768px){.zcode-save-confirm-dialog{width:95%;max-height:90vh}.zcode-save-confirm-dialog-header{padding:12px 16px}.zcode-save-confirm-dialog-body{padding:16px}.zcode-save-confirm-dialog-footer{padding:12px 16px;flex-direction:column-reverse}.zcode-btn-secondary,.zcode-btn-primary{width:100%}.zcode-text-input,.zcode-textarea,.zcode-select,select{font-size:16px}}",eT={common:{close:"閉じる",save:"保存",cancel:"キャンセル",delete:"削除",edit:"編集",add:"追加",reorder:"並べ替え",preview:"プレビュー",settings:"設定",manage:"管理",view:"表示",confirm:"確定",clear:"クリア",select:"選択",replace:"差し替え",copy:"コピー",copied:"コピーしました"},toolbar:{editMode:"編集",addMode:"追加",reorderMode:"並べ替え",deleteMode:"削除",viewMode:"表示",settings:"設定"},settings:{title:"設定",language:{label:"言語",ja:"日本語",en:"English"},enableDynamicContent:"ページの動作を有効にする",enableDynamicContentDescription:"アコーディオン、タブ、モーダル、リンクなどの動的コンテンツの動作を有効にします。",devRightPadding:"編集パネル分の余白をつける",devRightPaddingDescription:"編集パネル表示時にコンテンツの右側に余白を追加します。",enableContextMenu:"右クリックメニューを有効にする",enableContextMenuDescription:"コンテンツ上で右クリックすると、編集・追加・並べ替え・削除のモードを切り替えるメニューが表示されます。",showSaveConfirm:"保存時の確認ダイアログを表示する",showSaveConfirmDescription:"保存ボタンをクリックした際に、保存対象を確認するダイアログを表示します。",previewModeInfo:"表示モードでは動的コンテンツ(アコーディオン、タブ、モーダル、リンクなど)は常に有効です。",noSettings:"設定項目はありません。"},addPanel:{title:"追加",selectParent:"親要素を選択",category:{common:"共通",individual:"個別",selected:"選択したパーツ"},typeAll:"all",activeParts:"active parts",activePartsDescription:"プレビューエリアでクリックしたパーツを、現在のデータを含む状態で追加できます。",clickPartInPreview:"プレビューエリアでパーツをクリックしてください",noPartsAvailable:"利用可能なパーツがありません",addBefore:"前に追加",addAfter:"後に追加",continueAdding:"パーツ追加を続ける"},editPanel:{title:"編集中",editing:"編集中: {type}",id:"ID: {id}",selectImage:"画像を選択",replaceImage:"差し替え",clearImage:"クリア",clearImageTitle:"画像をクリア",noFields:"編集可能なフィールドがありません"},deletePanel:{title:"削除確認",confirmMessage:"このパーツを削除しますか?",selectParent:"親要素を選択"},reorderPanel:{title:"並べ替え: 移動元を選択中",instruction:"移動先の要素をクリックしてください",source:"移動元: {path}",selectParent:"親要素を選択"},saveConfirm:{title:"保存の確認",message:"以下のデータを保存しますか?",simpleMessage:"保存しますか?",targets:{page:"ページデータ","parts-common":"パーツ(共通)","parts-individual":"パーツ(個別)","parts-special":"パーツ(特別)","parts-common-css":"CSS(共通)","parts-individual-css":"CSS(個別)","parts-special-css":"CSS(特別)","images-common":"画像(共通)","images-individual":"画像(個別)","images-special":"画像(特別)"},saveButton:"保存する"},partsManager:{createType:"タイプ追加",editType:"タイプ編集",typeName:"タイプ名",typeDescription:"説明",typeNamePlaceholder:"例: hero, features",typeDescriptionPlaceholder:"タイプの説明",editPart:"パーツ編集: {title}",partTitle:"タイトル",partDescription:"説明",partDescriptionPlaceholder:"パーツの説明",deletePartConfirm:`パーツ {number} を削除しますか?
467
- (タイプには他のパーツが残ります)`,deleteTypeConfirm:"このタイプを削除しますか?",deleteTypeWithUsagesConfirm:"タイプ「{type}」は{count}箇所で使用されています。削除しますか?",deleteSlotConfirm:"スロット「{slotName}」を削除しますか?",selectImage:"画像選択",addPart:"パーツを追加",editTypeButton:"タイプ全体を編集",reorderType:"タイプを並べ替え",deleteTypeButton:"このタイプを削除(全パーツ含む)",editPartButton:"パーツを編集",reorderPart:"並べ替え",deletePartButton:"削除",source:"移動元",noDescription:"説明なし",partNumber:"パーツ {current} / {total}",allowedParts:"許可されるパーツ",searchParts:"パーツを検索...",addSlot:"スロットを追加",selectSlot:"スロットを選択...",defaultSlot:"デフォルトスロット",codeEdit:"コード編集",cssEditInfo:"CSS編集について",templateSuggestions:"予測変換",preview:"プレビュー:",cssEditWarning:"CSS編集について",cssEditWarningMessageCommon:"ここで編集したCSSは、すべてのページに適用される想定です。既存のCSSファイル(common.cssなど)がある場合、それらを上書きする可能性があります。",cssEditWarningMessageIndividual:"ここで編集したCSSは、ページタイプごとに適用される想定です。既存のCSSファイル(page.cssなど)がある場合、それらを上書きする可能性があります。",cssEditWarningMessageSpecial:"ここで編集したCSSは、動的ページごとに適用される想定です。既存のCSSファイル(shop111.cssなど)がある場合、それらを上書きする可能性があります。",understood:"了解しました",dontShowAgain:"次回から表示しない",templateHelp:{textField:"テキストフィールド",richText:"リッチテキスト",textarea:"複数行テキスト",image:"画像選択",radio:"ラジオボタン",checkbox:"チェックボックス",selectSingle:"セレクトボックス(単一選択)",selectMultiple:"セレクトボックス(複数選択)",conditional:"条件分岐(表示/非表示)",slot:"スロット(子要素挿入)",note:"補足",suggestionNote:"予測変換を有効にすると、<code>$</code>、<code>(</code>、<code>z</code>を入力時に自動補完が表示されます",fieldNameNote:"フィールド名は英数字とアンダースコアが使用できます",defaultValueNote:"デフォルト値は省略可能です(空文字になります)"},validationError:"エラー:",dangerousTagWarning:"<{tag}> タグが含まれています。",dangerousAttrWarning:"{attr} 属性が含まれています。",slotSettings:"スロット設定",slot:"スロット",templateHelpButton:"テンプレート記法のヘルプ",clickToEnlarge:"クリックで拡大"},imagesManager:{addImage:"画像追加",editImage:"画像編集",imageId:"画像ID",imageName:"画像名",altText:"Alt属性",deleteImageConfirm:"この画像を削除しますか?",deleteImageWithUsagesConfirm:"この画像は{count}箇所で使用されています。削除しますか?",deleteImageFromModalConfirm:"この画像を削除しますか?",addImageFailed:"画像の追加に失敗しました",selectImage:"画像を選択",currentlySelected:"現在選択中",select:"選択"},dataViewer:{page:"ページ",parts:"パーツ",images:"画像",common:"共通",individual:"個別",special:"特別",json:"JSON",html:"HTML",categoryInfo:{title:"カテゴリの役割について",common:{title:"共通",description:"サイト全体で共有されるパーツ・画像を想定しています。すべてのページで使用できる想定です。"},individual:{title:"個別",description:"ページタイプごとに共有されるパーツ・画像を想定しています。同じページタイプのすべてのページで使用できる想定です。"},special:{title:"特別",description:"動的ページ(例:店舗ごと、商品ごと)や特定の条件で使用されるパーツ・画像を想定しています。ルートモデルバインディングなどで動的に生成されるページで使用できる想定です。"}}},contextMenu:{edit:"編集",add:"追加",reorder:"並べ替え",delete:"削除",close:"閉じる"},editor:{pageManagement:"ページ管理",partsManagement:"パーツ管理",imagesManagement:"画像管理",dataViewer:"データビューアー",loading:"データを読み込み中..."}},tT={common:{close:"Close",save:"Save",cancel:"Cancel",delete:"Delete",edit:"Edit",add:"Add",reorder:"Reorder",preview:"Preview",settings:"Settings",manage:"Manage",view:"View",confirm:"Confirm",clear:"Clear",select:"Select",replace:"Replace",copy:"Copy",copied:"Copied"},toolbar:{editMode:"Edit",addMode:"Add",reorderMode:"Reorder",deleteMode:"Delete",viewMode:"View",settings:"Settings"},settings:{title:"Settings",language:{label:"Language",ja:"Japanese",en:"English"},enableDynamicContent:"Enable page interactions",enableDynamicContentDescription:"Enables interactions for dynamic content such as accordions, tabs, modals, and links.",devRightPadding:"Add padding for edit panel",devRightPaddingDescription:"Adds right padding to content when the edit panel is displayed.",enableContextMenu:"Enable right-click menu",enableContextMenuDescription:"Right-clicking on content displays a menu to switch between edit, add, reorder, and delete modes.",showSaveConfirm:"Show save confirmation dialog",showSaveConfirmDescription:"Displays a dialog to confirm save targets when clicking the save button.",previewModeInfo:"Dynamic content (accordions, tabs, modals, links, etc.) is always enabled in preview mode.",noSettings:"No settings available."},addPanel:{title:"Add",selectParent:"Select parent element",category:{common:"Common",individual:"Individual",selected:"Selected part"},typeAll:"all",activeParts:"active parts",activePartsDescription:"You can add the part clicked in the preview area with its current data included.",clickPartInPreview:"Please click a part in the preview area",noPartsAvailable:"No parts available",addBefore:"Add before",addAfter:"Add after",continueAdding:"Continue adding parts"},editPanel:{title:"Editing",editing:"Editing: {type}",id:"ID: {id}",selectImage:"Select image",replaceImage:"Replace",clearImage:"Clear",clearImageTitle:"Clear image",noFields:"No editable fields available"},deletePanel:{title:"Delete confirmation",confirmMessage:"Do you want to delete this part?",selectParent:"Select parent element"},reorderPanel:{title:"Reorder: Source selected",instruction:"Click the destination element",source:"Source: {path}",selectParent:"Select parent element"},saveConfirm:{title:"Save confirmation",message:"Do you want to save the following data?",simpleMessage:"Do you want to save?",targets:{page:"Page data","parts-common":"Parts (Common)","parts-individual":"Parts (Individual)","parts-special":"Parts (Special)","images-common":"Images (Common)","images-individual":"Images (Individual)","images-special":"Images (Special)","parts-common-css":"CSS (Common)","parts-individual-css":"CSS (Individual)","parts-special-css":"CSS (Special)"},saveButton:"Save"},partsManager:{createType:"Create new type",editType:"Edit type",typeName:"Type name",typeDescription:"Description",typeNamePlaceholder:"Example: hero, features",typeDescriptionPlaceholder:"Type description",editPart:"Edit part: {title}",partTitle:"Title",partDescription:"Description",partDescriptionPlaceholder:"Part description",deletePartConfirm:`Do you want to delete part {number}?
468
- (Other parts in the type will remain)`,deleteTypeConfirm:"Do you want to delete this type?",deleteTypeWithUsagesConfirm:'Type "{type}" is used in {count} places. Do you want to delete it?',deleteSlotConfirm:'Do you want to delete slot "{slotName}"?',selectImage:"Select image",addPart:"Add part",editTypeButton:"Edit type",reorderType:"Reorder type",deleteTypeButton:"Delete this type (all parts included)",editPartButton:"Edit part",reorderPart:"Reorder",deletePartButton:"Delete",source:"Source",noDescription:"No description",partNumber:"Part {current} / {total}",allowedParts:"Allowed parts",searchParts:"Search parts...",addSlot:"Add slot",selectSlot:"Select slot...",defaultSlot:"Default slot",codeEdit:"Code editor",cssEditInfo:"About CSS editing",templateSuggestions:"Template suggestions",preview:"Preview:",cssEditWarning:"About CSS editing",cssEditWarningMessageCommon:"CSS edited here is intended to apply to all pages. If existing CSS files (e.g., common.css) exist, they may be overwritten.",cssEditWarningMessageIndividual:"CSS edited here is intended to apply per page type. If existing CSS files (e.g., page.css) exist, they may be overwritten.",cssEditWarningMessageSpecial:"CSS edited here is intended to apply per dynamic page. If existing CSS files (e.g., shop111.css) exist, they may be overwritten.",dontShowAgain:"Don't show again",templateHelp:{textField:"Text field",richText:"Rich text",textarea:"Multi-line text",image:"Image selection",radio:"Radio button",checkbox:"Checkbox",selectSingle:"Select box (single)",selectMultiple:"Select box (multiple)",conditional:"Conditional (show/hide)",slot:"Slot (child insertion)",note:"Note",suggestionNote:"When template suggestions are enabled, autocomplete will appear when typing <code>$</code>, <code>(</code>, or <code>z</code>",fieldNameNote:"Field names can use alphanumeric characters and underscores",defaultValueNote:"Default values are optional (will be empty string if omitted)"},validationError:"Error:",dangerousTagWarning:"<{tag}> tag is included.",dangerousAttrWarning:"{attr} attribute is included.",slotSettings:"Slot settings",slot:"Slot",templateHelpTitle:"Template Syntax Help",clickToEnlarge:"Click to enlarge",understood:"Understood",syntax:"Syntax",description:"Description",example:"Example",templateHelpButton:"Template syntax help"},imagesManager:{addImage:"Add image",editImage:"Edit image",imageId:"Image ID",imageName:"Image name",altText:"Alt attribute",deleteImageConfirm:"Do you want to delete this image?",deleteImageWithUsagesConfirm:"This image is used in {count} places. Do you want to delete it?",deleteImageFromModalConfirm:"Do you want to delete this image?",addImageFailed:"Failed to add image",selectImage:"Select image",currentlySelected:"Currently selected",select:"Select"},dataViewer:{page:"Page",parts:"Parts",images:"Images",common:"Common",individual:"Individual",special:"Special",json:"JSON",html:"HTML",categoryInfo:{title:"About Category Roles",common:{title:"Common",description:"Intended for parts and images shared across the entire site. Assumed to be usable on all pages."},individual:{title:"Individual",description:"Intended for parts and images shared per page type. Assumed to be usable on all pages of the same page type."},special:{title:"Special",description:"Intended for parts and images used for dynamic pages (e.g., per store, per product) or under specific conditions. Assumed to be usable on pages dynamically generated with route model binding, etc."}}},contextMenu:{edit:"Edit",add:"Add",reorder:"Reorder",delete:"Delete",close:"Close"},editor:{pageManagement:"Page Management",partsManagement:"Parts Management",imagesManagement:"Images Management",dataViewer:"Data Viewer",loading:"Loading data...",saveFailed:"Save failed",saveFailedWithCount:"Save failed ({count} items)",saveFailedWithMessage:"Save failed ({count} items): {message}",noSaveTargets:"No save targets"}};function nT(t="ja"){return o1({locale:t,fallbackLocale:"ja",messages:{ja:eT,en:tT},globalInjection:!0})}const Nm={UNDEFINED_PROPERTIES:"Cannot read properties of undefined",APP_REFERENCE:"app"};function Cm(){if(typeof window>"u")return;const t=window;t.__zcodeI18nErrorHandlerSetup||(window.addEventListener("unhandledrejection",e=>{if(e.reason&&typeof e.reason=="object"&&"message"in e.reason){const n=String(e.reason.message);if(n.includes(Nm.UNDEFINED_PROPERTIES)&&n.includes(Nm.APP_REFERENCE)){e.preventDefault();return}}}),t.__zcodeI18nErrorHandlerSetup=!0)}function oT(){if(typeof window>"u")return;const t=window;t.__VUE_I18N_FULL_INSTALL__=!1,t.__INTLIFY_PROD_DEVTOOLS__=!1,t.__VUE_I18N_PROD_DEVTOOLS__=!1}function Ws(t,e="ja"){const n=p1(null);if(n)return n;const o=t.getAttribute("locale");return o==="ja"||o==="en"?o:e}function Gs(t,e){oT();const n=nT(e);try{t.use(n)}catch(o){console.warn("[ZeroCode] Failed to setup i18n:",o)}}Cm();class rT extends HTMLElement{app=null;componentInstance=null;_shadowRoot=null;constructor(){super()}connectedCallback(){if(this.app)return;this.getAttribute("use-shadow-dom")!=="false"?(this.setupShadowDOM(),window.addEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this))):(this.setupLightDOM(),window.addEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this)))}setupLightDOM(){const e=this.getAttribute("page")||"[]",n=this.getAttribute("css-common"),o=this.getAttribute("css-individual"),r=this.getAttribute("css-special"),i=this.getAttribute("parts-common")||"[]",s=this.getAttribute("parts-individual")||"[]",l=this.getAttribute("parts-special")||"[]",c=this.getAttribute("images-common")||"[]",d=this.getAttribute("images-individual")||"[]",u=this.getAttribute("images-special")||"[]",f=Array.from(this.querySelectorAll('[slot="script"]'));f.length>0&&(this.__savedScriptSlots=f.map(h=>({src:h.src,type:h.type,async:h.async,defer:h.defer,integrity:h.integrity,crossOrigin:h.crossOrigin})));const p=Ws(this);this.app=a.createApp(Hs,{locale:p,page:e,cssCommon:n,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:s,partsSpecial:l,imagesCommon:c,imagesIndividual:d,imagesSpecial:u,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}),Gs(this.app,p),this.componentInstance=this.app.mount(this),this.injectLightDOMCSS()}setupShadowDOM(){const e=this.shadowRoot,n=!!e;e?(this._shadowRoot=e,this.clearScripts()):(this._shadowRoot=this.attachShadow({mode:"open"}),this.injectCSS());const o=this.getAttribute("page")||"[]",r=this.getAttribute("css-common"),i=this.getAttribute("css-individual"),s=this.getAttribute("css-special"),l=this.getAttribute("parts-common")||"[]",c=this.getAttribute("parts-individual")||"[]",d=this.getAttribute("parts-special")||"[]",u=this.getAttribute("images-common")||"[]",f=this.getAttribute("images-individual")||"[]",p=this.getAttribute("images-special")||"[]",h=Ws(this);this.app=a.createApp(Hs,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:s,partsCommon:l,partsIndividual:c,partsSpecial:d,imagesCommon:u,imagesIndividual:f,imagesSpecial:p,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}),Gs(this.app,h),this.componentInstance=this.app.mount(this._shadowRoot),requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{this.injectScript(n)},100)})})}injectCSS(){if(!this._shadowRoot)return;const e=document.createElement("style");e.textContent=Sm,this._shadowRoot.appendChild(e),this.querySelectorAll('[slot="css"]').forEach(o=>{const r=o.cloneNode(!0);r.removeAttribute("slot"),this._shadowRoot.appendChild(r),o.remove()})}injectLightDOMCSS(){this.querySelectorAll('[slot="css"]').forEach(n=>{const o=n.cloneNode(!0);o.removeAttribute("slot"),document.head.appendChild(o)})}clearScripts(){if(!this._shadowRoot)return;this._shadowRoot.querySelectorAll("script").forEach(n=>{n.remove()})}injectScript(e=!1){if(!this._shadowRoot)return;const n=this.querySelectorAll('[slot="script"]'),o=Array.from(n),r=[],i=[];o.forEach(c=>{const d=c;if(!d.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}d.src.includes("jquery")||d.src.includes("code.jquery.com")?r.push(d):i.push(d)});const s=c=>{let d=c.src;if(e)try{const f=new URL(c.src,window.location.href);f.searchParams.set("_t",Date.now().toString()),d=f.toString()}catch{d=c.src+(c.src.includes("?")?"&":"?")+"_t="+Date.now()}const u=document.createElement("script");return u.src=d,c.type&&(u.type=c.type),c.async&&(u.async=!0),c.defer&&(u.defer=!0),c.integrity&&(u.integrity=c.integrity),c.crossOrigin&&(u.crossOrigin=c.crossOrigin),u.onerror=f=>{console.error(`Failed to load script: ${c.src}`,f)},u},l=()=>{o.forEach(c=>{c.remove()})};if(r.length>0){let c=0;const d=r.length;r.forEach(u=>{const f=s(u);f.onload=()=>{c++,c===d&&(Mo(this._shadowRoot,e),setTimeout(()=>{i.forEach(p=>{this._shadowRoot.appendChild(s(p))}),l()},50))},this._shadowRoot.appendChild(f)})}else Mo(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(s(c))}),l()}injectLightDOMScripts(){let e=[];if(this.__savedScriptSlots&&this.__savedScriptSlots.length>0)e=this.__savedScriptSlots.map(i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s});else{const i=this.querySelectorAll('[slot="script"]');e=Array.from(i)}const n=[],o=[];e.forEach(i=>{const s=i;if(!s.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}s.src.includes("jquery")||s.src.includes("code.jquery.com")?n.push(s):o.push(s)});const r=i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},s};if(n.length>0){let i=0;const s=n.length;n.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===s&&requestAnimationFrame(()=>{o.forEach(d=>{document.body.appendChild(r(d))})})},document.body.appendChild(c)})}else o.forEach(i=>{document.body.appendChild(r(i))})}getData(e){return this.componentInstance&&this.componentInstance.getData?this.componentInstance.getData(e):null}setData(e,n){return this.componentInstance&&this.componentInstance.setData?this.componentInstance.setData(e,n):!1}get allowDynamicContentInteraction(){if(this.componentInstance){const e=this.componentInstance.allowDynamicContentInteraction;if(e!==void 0)return e&&typeof e=="object"&&"value"in e?e.value:e}return!0}set allowDynamicContentInteraction(e){if(this.componentInstance){const n=this.componentInstance.allowDynamicContentInteraction;n!==void 0&&(n&&typeof n=="object"&&"value"in n?n.value=e:this.componentInstance.allowDynamicContentInteraction=e)}}disconnectedCallback(){if(this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot){if(this._shadowRoot.__zecEventListeners){const e=this._shadowRoot.__zecEventListeners,n=this._shadowRoot;e.forEach(o=>{o.forEach(r=>{n.removeEventListener(r.eventName,r.handler,!0)})}),e.clear()}if(window.__zecShadowRoots){const e=window.__zecShadowRoots,n=this._shadowRoot;for(const[o,r]of e.entries())r===n&&e.delete(o)}}this._shadowRoot=null,window.removeEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this)),window.removeEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this))}handleDOMUpdated(){if(!this._shadowRoot||this.getAttribute("use-shadow-dom")!=="true")return;this._shadowRoot.__zecJQueryExtended&&delete this._shadowRoot.__zecJQueryExtended;const e=this._shadowRoot.querySelector("script[data-zec-shadow-extension]");e&&e.remove(),Mo(this._shadowRoot,!0)}handleLightDOMUpdated(){this.getAttribute("use-shadow-dom")!=="true"&&(this.__lightDOMScriptsLoaded||(this.injectLightDOMScripts(),this.__lightDOMScriptsLoaded=!0))}static get observedAttributes(){return["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data","use-shadow-dom"]}attributeChangedCallback(e,n,o){if(n!==o){if(e==="use-shadow-dom"){this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot&&(this._shadowRoot.innerHTML="",this._shadowRoot=null),this.connectedCallback();return}this.app&&(this.app.unmount(),this.app=null,this.componentInstance=null,this.connectedCallback())}}}customElements.get("zcode-cms")||customElements.define("zcode-cms",rT);function iT(t){const{t:e}=rn(),n=a.ref("common"),o=a.ref(null),r=a.ref(null),i=a.ref(null),s=a.ref(null),l=a.ref(!1),c=a.ref(null),d=a.ref(null),{renderComponentToHtml:u}=fi(t,!1),f=a.computed(()=>{const N=t.parts;return n.value==="common"?N.common:n.value==="individual"?N.individual:N.special}),p=a.computed(()=>{const N=f.value,P=new Map;return N.forEach(V=>{P.has(V.type)||P.set(V.type,[]),V.parts.forEach((S,C)=>{P.get(V.type).push({type:V,partIndex:C})})}),Array.from(P.entries()).map(([V,S])=>({type:V,parts:S.map(C=>({...C.type,_partIndex:C.partIndex,_displayPart:C.type.parts[C.partIndex]}))}))});function h(){const N=t.parts;return n.value==="common"?N.common:n.value==="individual"?N.individual:N.special}function m(N){return f.value.find(P=>P.type===N)||null}function b(N){return i.value&&i.value.partIndex===N&&i.value.part.slots||null}function g(N,P,V){if(i.value&&i.value.partIndex===N){const S=i.value.part;return S.slots||(S.slots={}),V(S.slots),!0}return!1}function x(N){const P={};return N.forEach(V=>{if(V.optional)P[V.fieldName]=void 0;else switch(V.type){case"text":P[V.fieldName]=V.defaultValue||"";break;case"radio":P[V.fieldName]=V.options?.[0]||"";break;case"checkbox":P[V.fieldName]=[];break;case"boolean":P[V.fieldName]=!0;break;case"rich":P[V.fieldName]=V.defaultValue?`<p>${V.defaultValue}</p>`:"<p></p>";break;case"image":P[V.fieldName]=V.defaultValue||"";break}}),P}function v(N){o.value=N,r.value=null,l.value=!1}function w(){r.value=a.reactive({id:jn(),type:"",description:"",parts:[{id:jn(),title:"part_1",description:"",body:"<div>{$content:コンテンツを入力}</div>"}]}),s.value="type",l.value=!0,o.value=null}function T(N){r.value=a.reactive(JSON.parse(JSON.stringify(N))),s.value="type",l.value=!1,o.value=N}function M(N,P){const V=N.parts[P];if(!V)return;const S=JSON.parse(JSON.stringify(V));S.slots||(S.slots={}),i.value={type:a.reactive(JSON.parse(JSON.stringify(N))),partIndex:P,part:a.reactive(S)},s.value="part"}async function A(N){const P=m(N.type);if(!P)return;const V=a.reactive(JSON.parse(JSON.stringify(P))),S={id:jn(),title:`part_${V.parts.length+1}`,description:"",body:"<div>{$content:コンテンツを入力}</div>"};V.parts.push(S);const C=V.parts.length-1;await a.nextTick(),i.value={type:V,partIndex:C,part:a.reactive(JSON.parse(JSON.stringify(S))),isNewPart:!0},s.value="part"}async function y(){if(!r.value)return;const N=$e(r.value);if(!N.valid){alert(e("partsManager.validationError")+`
469
- `+N.errors.join(`
470
- `));return}const P=JSON.parse(JSON.stringify(a.toRaw(r.value))),V=h();if(l.value)V.push(P);else{const S=V.findIndex(C=>C.id===r.value.id);S!==-1&&(V[S]=P)}await a.nextTick(),f.value,p.value,r.value=null,s.value=null,l.value=!1}function E(N){const P=[],V=N.toLowerCase(),S=["script","iframe","object","embed"],C=["onclick","onerror","onload","onmouseover","onfocus","onblur"];return S.forEach($=>{V.includes(`<${$}`)&&P.push(e("partsManager.dangerousTagWarning",{tag:$}))}),C.forEach($=>{V.includes(`${$}=`)&&P.push(e("partsManager.dangerousAttrWarning",{attr:$}))}),{hasWarning:P.length>0,messages:P}}async function k(){if(!i.value)return;const N=i.value.part.body||"",P=E(N);if(P.hasWarning&&!confirm(`テンプレートにセキュリティ上注意が必要な記述が含まれています。
462
+ 3. "-" cannot repeat`);We.customSchemes.push([n,e])}function Hw(){We.scanner=Rw(We.customSchemes);for(let n=0;n<We.tokenQueue.length;n++)We.tokenQueue[n][1]({scanner:We.scanner});We.parser=$w(We.scanner.tokens);for(let n=0;n<We.pluginQueue.length;n++)We.pluginQueue[n][1]({scanner:We.scanner,parser:We.parser});return We.initialized=!0,We}function ec(n){return We.initialized||Hw(),Vw(We.parser.start,n,Ih(We.scanner.start,n))}ec.scan=Ih;function $h(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const o=new Ql(t),r=ec(n),i=[];for(let s=0;s<r.length;s++){const l=r[s];l.isLink&&(!e||l.t===e)&&o.check(l)&&i.push(l.toFormattedObject(o))}return i}var tc="[\0-   ᠎ -\u2029  ]",Uw=new RegExp(tc),Ww=new RegExp(`${tc}$`),qw=new RegExp(tc,"g");function Gw(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function Kw(n){return new Mt({key:new en("autolink"),appendTransaction:(e,t,o)=>{const r=e.some(d=>d.docChanged)&&!t.doc.eq(o.doc),i=e.some(d=>d.getMeta("preventAutolink"));if(!r||i)return;const{tr:s}=o,l=Op(t.doc,[...e]);if(Hp(l).forEach(({newRange:d})=>{const u=_k(o.doc,d,h=>h.isTextblock);let f,p;if(u.length>1)f=u[0],p=o.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const h=o.doc.textBetween(d.from,d.to," "," ");if(!Ww.test(h))return;f=u[0],p=o.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&p){const h=p.split(Uw).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],y=f.pos+p.lastIndexOf(m);if(!m)return!1;const g=ec(m).map(x=>x.toObject(n.defaultProtocol));if(!Gw(g))return!1;g.filter(x=>x.isLink).map(x=>({...x,from:y+x.start+1,to:y+x.end+1})).filter(x=>o.schema.marks.code?!o.doc.rangeHasMark(x.from,x.to,o.schema.marks.code):!0).filter(x=>n.validate(x.value)).filter(x=>n.shouldAutoLink(x.value)).forEach(x=>{kl(x.from,x.to,o.doc).some(M=>M.mark.type===n.type)||s.addMark(x.from,x.to,n.type.create({href:x.href}))})}}),!!s.steps.length)return s}})}function Jw(n){return new Mt({key:new en("handleClickLink"),props:{handleClick:(e,t,o)=>{var r,i;if(o.button!==0||!e.editable)return!1;let s=!1;if(n.enableClickSelection&&(s=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){let l=null;if(o.target instanceof HTMLAnchorElement)l=o.target;else{let f=o.target;const p=[];for(;f.nodeName!=="DIV";)p.push(f),f=f.parentNode;l=p.find(h=>h.nodeName==="A")}if(!l)return s;const c=jp(e.state,n.type.name),d=(r=l?.href)!=null?r:c.href,u=(i=l?.target)!=null?i:c.target;l&&d&&(window.open(d,u),s=!0)}return s}}})}function Xw(n){return new Mt({key:new en("handlePasteLink"),props:{handlePaste:(e,t,o)=>{const{shouldAutoLink:r}=n,{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let c="";o.content.forEach(u=>{c+=u.textContent});const d=$h(c,{defaultProtocol:n.defaultProtocol}).find(u=>u.isLink&&u.value===c);return!c||!d||r!==void 0&&!r(d.value)?!1:n.editor.commands.setMark(n.type,{href:d.href})}}})}function So(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(o=>{const r=typeof o=="string"?o:o.scheme;r&&t.push(r)}),!n||n.replace(qw,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Yw=zr.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){Lh(n);return}Lh(n.scheme,n.optionalSlashes)})},onDestroy(){jw()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!So(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const r=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!So(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!So(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",It(this.options.HTMLAttributes,n),0]:["a",It(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t;const o=((t=n.attrs)==null?void 0:t.href)||"";return`[${e.renderChildren(n)}](${o})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:o=>!!So(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:o=>!!So(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Ho({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:o}=this.options,r=$h(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!So(s,t),protocols:t,defaultProtocol:o}));r.length&&r.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(Kw({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!So(r,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(Jw({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(Xw({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),Qw=Yw;const Zw={class:"zcode-rich-text-editor"},eS={key:0,class:"zcode-rich-text-toolbar"},tS=a.defineComponent({__name:"RichTextEditor",props:{modelValue:{type:String},placeholder:{type:String}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,r=BE({extensions:[jE,UE,qE,QE,rw,lw,ww,Sw,Cw,Tw,Qw.configure({openOnClick:!1,HTMLAttributes:{class:"zcode-link"}})],content:t.modelValue||"",editorProps:{attributes:{class:"zcode-tiptap-editor","data-placeholder":t.placeholder||"テキストを入力..."}},onUpdate:({editor:s})=>{const l=s.getHTML();o("update:modelValue",l)}});a.watch(()=>t.modelValue,s=>{r.value&&r.value.getHTML()!==s&&r.value.commands.setContent(s||"")});const i=()=>{if(!r.value)return;const s=r.value.getAttributes("link").href,l=window.prompt("URLを入力してください",s);if(l!==null){if(l===""){r.value.chain().focus().extendMarkRange("link").unsetLink().run();return}r.value.chain().focus().extendMarkRange("link").setLink({href:l}).run()}};return a.onUnmounted(()=>{r.value&&r.value.destroy()}),(s,l)=>(a.openBlock(),a.createElementBlock("div",Zw,[a.unref(r)?(a.openBlock(),a.createElementBlock("div",eS,[a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("bold")},"zcode-toolbar-btn"]),title:"太字",onClick:l[0]||(l[0]=c=>a.unref(r).chain().focus().toggleBold().run())},[a.createVNode(a.unref(pm),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("italic")},"zcode-toolbar-btn"]),title:"斜体",onClick:l[1]||(l[1]=c=>a.unref(r).chain().focus().toggleItalic().run())},[a.createVNode(a.unref(ym),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("strike")},"zcode-toolbar-btn"]),title:"取り消し線",onClick:l[2]||(l[2]=c=>a.unref(r).chain().focus().toggleStrike().run())},[a.createVNode(a.unref(wm),{size:16})],2),l[5]||(l[5]=a.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("bulletList")},"zcode-toolbar-btn"]),title:"箇条書き",onClick:l[3]||(l[3]=c=>a.unref(r).chain().focus().toggleBulletList().run())},[a.createVNode(a.unref(km),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("orderedList")},"zcode-toolbar-btn"]),title:"番号付きリスト",onClick:l[4]||(l[4]=c=>a.unref(r).chain().focus().toggleOrderedList().run())},[a.createVNode(a.unref(xm),{size:16})],2),l[6]||(l[6]=a.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("link")},"zcode-toolbar-btn"]),title:"リンク",onClick:i},[a.createVNode(a.unref(bm),{size:16})],2)])):a.createCommentVNode("",!0),a.createVNode(a.unref(VE),{editor:a.unref(r),class:"zcode-rich-text-editor-content"},null,8,["editor"])]))}}),nS={class:"zcode-image-modal-header"},oS={class:"zcode-image-modal-header-title",role:"heading","aria-level":"3"},rS=["aria-label"],iS={key:0,class:"zcode-image-current"},sS={class:"zcode-image-current-title",role:"heading","aria-level":"4"},aS={class:"zcode-image-current-item"},lS=["src","alt"],cS={class:"zcode-image-current-name"},dS={class:"zcode-image-tabs"},uS={class:"zcode-image-grid"},fS=["onClick"],pS=["src","alt"],hS={class:"zcode-image-name"},mS={class:"zcode-image-add"},gS={class:"zcode-image-modal-actions"},yS=a.defineComponent({__name:"ImageSelectModal",props:{isOpen:{type:Boolean},imagesCommon:{type:Array},imagesIndividual:{type:Array},imagesSpecial:{type:Array},currentValue:{type:String}},emits:["update:model-value","add-image","delete-image","close"],setup(n,{emit:e}){const{t}=Qt(),o=n,r=e,i=a.ref("common"),s=a.ref(null),l=a.ref(o.currentValue||null),c=a.computed(()=>i.value==="common"?o.imagesCommon:i.value==="individual"?o.imagesIndividual:o.imagesSpecial),d=()=>o.currentValue&&[...o.imagesCommon,...o.imagesIndividual,...o.imagesSpecial].find(g=>g.id===o.currentValue)||null,u=y=>{l.value=y.id},f=()=>{l.value&&(r("update:model-value",l.value),m())},p=()=>{l.value&&confirm(t("imagesManager.deleteImageFromModalConfirm"))&&(r("delete-image",l.value),l.value=null)},h=y=>{const x=y.target.files?.[0];if(!x)return;const M=new FileReader;M.onload=E=>{const v=E.target?.result,_={id:`img-${Date.now()}`,name:x.name,url:v,mimeType:x.type,needsUpload:!0},A=i.value==="common"?"common":i.value==="individual"?"individual":"special";r("add-image",_,A),l.value=_.id},M.readAsDataURL(x)},m=()=>{r("close")};return(y,g)=>n.isOpen?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:a.withModifiers(m,["self"])},[a.createElementVNode("div",{class:"zcode-image-modal-content",onClick:g[4]||(g[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",nS,[a.createElementVNode("div",oS,a.toDisplayString(y.$t("imagesManager.selectImage")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":y.$t("common.close"),onClick:m},[a.createVNode(a.unref(Ye),{size:18})],8,rS)]),n.currentValue&&d()?(a.openBlock(),a.createElementBlock("div",iS,[a.createElementVNode("div",sS,a.toDisplayString(y.$t("imagesManager.currentlySelected")),1),a.createElementVNode("div",aS,[a.createElementVNode("img",{src:d()?.url,alt:d()?.name||"",class:"zcode-image-current-item-img"},null,8,lS),a.createElementVNode("div",cS,a.toDisplayString(d()?.name),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",dS,[a.createElementVNode("button",{class:a.normalizeClass([{active:i.value==="common"},"zcode-image-tab"]),onClick:g[0]||(g[0]=x=>i.value="common")},a.toDisplayString(y.$t("dataViewer.common")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:i.value==="individual"},"zcode-image-tab"]),onClick:g[1]||(g[1]=x=>i.value="individual")},a.toDisplayString(y.$t("dataViewer.individual")),3),n.imagesSpecial.length>0?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass([{active:i.value==="special"},"zcode-image-tab"]),onClick:g[2]||(g[2]=x=>i.value="special")},a.toDisplayString(y.$t("dataViewer.special")),3)):a.createCommentVNode("",!0)]),a.createElementVNode("div",uS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(c.value,x=>(a.openBlock(),a.createElementBlock("div",{key:x.id,class:a.normalizeClass([{selected:l.value===x.id},"zcode-image-item"]),onClick:M=>u(x)},[a.createElementVNode("img",{src:x.url,alt:x.name,class:"zcode-image-item-img"},null,8,pS),a.createElementVNode("div",hS,a.toDisplayString(x.name),1)],10,fS))),128))]),a.createElementVNode("div",mS,[a.createElementVNode("input",{ref_key:"fileInput",ref:s,type:"file",accept:"image/*",style:{display:"none"},onChange:h},null,544),a.createElementVNode("button",{class:"zcode-image-add-btn",onClick:g[3]||(g[3]=x=>s.value?.click())},[a.createVNode(a.unref(io),{size:16}),a.createElementVNode("span",null,a.toDisplayString(y.$t("imagesManager.addImage")),1)])]),a.createElementVNode("div",gS,[l.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-btn-primary zcode-image-modal-actions-btn",onClick:f},[a.createVNode(a.unref(Qo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(y.$t("imagesManager.select")),1)])):a.createCommentVNode("",!0),l.value?(a.openBlock(),a.createElementBlock("button",{key:1,class:"zcode-btn-danger zcode-image-modal-actions-btn",onClick:p},[a.createVNode(a.unref(On),{size:16}),a.createElementVNode("span",null,a.toDisplayString(y.$t("common.delete")),1)])):a.createCommentVNode("",!0)])])])):a.createCommentVNode("",!0)}}),bS={class:"zcode-edit-panel-header"},xS={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},kS=["aria-label"],ES={key:0,class:"zcode-parent-selector"},wS={key:1,class:"zcode-group-tabs"},SS=["onClick"],CS={key:2,class:"zcode-field-editor"},NS={class:"zcode-field-item-title",role:"heading","aria-level":"4"},TS={key:0,class:"zcode-text-editor"},vS=["value","placeholder","maxlength","readonly","disabled","onInput"],zS={key:0,class:"zcode-field-error-message"},MS={key:1,class:"zcode-field-counter"},AS={key:1,class:"zcode-text-editor"},IS=["value","placeholder","maxlength","readonly","disabled","onInput"],_S={key:0,class:"zcode-field-error-message"},OS={key:1,class:"zcode-field-counter"},DS={key:2,class:"zcode-rich-text-editor-wrapper"},RS={key:0,class:"zcode-field-error-message"},PS={key:3,class:"zcode-radio-editor"},LS={class:"zcode-radio-group"},$S=["onUpdate:modelValue","name","value","onChange"],VS={class:"zcode-radio-item-label"},BS={key:4,class:"zcode-checkbox-editor"},FS={class:"zcode-checkbox-group"},jS=["onUpdate:modelValue","value","onChange"],HS={class:"zcode-checkbox-item-label"},US={key:5,class:"zcode-select-editor"},WS=["onUpdate:modelValue","onChange"],qS=["value"],GS={key:6,class:"zcode-select-editor"},KS=["onUpdate:modelValue","size","onChange"],JS=["value"],XS={key:7,class:"zcode-tag-editor"},YS=["onUpdate:modelValue","onChange"],QS=["value"],ZS={class:"zcode-tag-preview"},eC={key:8,class:"zcode-boolean-editor"},tC={class:"zcode-checkbox-item"},nC=["onUpdate:modelValue","onChange"],oC={class:"zcode-checkbox-item-label"},rC={key:9,class:"zcode-image-editor"},iC={class:"zcode-image-editor-buttons"},sC=["onClick"],aC=["title","onClick"],lC={key:0,class:"zcode-image-preview"},cC=["src","alt"],dC={key:3,class:"zcode-edit-fields"},uC={class:"zcode-edit-fields-text"},fC={class:"zcode-edit-fields-text"},pC=a.defineComponent({__name:"EditPanel",props:{editingComponent:{type:[Object,null]},editingAvailableFields:{type:Array},fieldErrors:{type:Object},currentMode:{type:String},canSelectParent:{type:Boolean},imagesCommon:{type:Array},imagesIndividual:{type:Array},imagesSpecial:{type:Array}},emits:["close","select-parent","save-field","add-image","delete-image"],setup(n,{emit:e}){const t=n,o=a.ref("all"),r=a.computed(()=>{const b=new Map;return t.editingAvailableFields.forEach(k=>{const w=k.groupName||"other";b.set(w,(b.get(w)||0)+1)}),Array.from(b.entries()).map(([k,w])=>({name:k,count:w}))}),i=a.computed(()=>r.value.length>1),s=a.computed(()=>!i.value||o.value==="all"?t.editingAvailableFields:t.editingAvailableFields.filter(b=>(b.groupName||"other")===o.value));a.watch(()=>i.value,b=>{b?o.value="all":o.value=void 0},{immediate:!0}),a.watch(()=>t.editingAvailableFields,()=>{if(i.value){if(o.value==="all")return;r.value.some(k=>k.name===o.value)||(o.value="all")}},{deep:!0});const l=e,c=a.ref({});function d(b){const k=b.label||b.fieldName,w=b.currentValue,O=b.type==="rich"&&typeof w=="string"&&w.trim()==="<p></p>"?"":w??"";return b.required&&(O===""||O===void 0||O===null)?`${k}は必須です`:typeof b.maxLength=="number"&&b.maxLength>0&&String(O).length>b.maxLength?`${k}は${b.maxLength}文字以内で入力してください`:null}function u(b,k){k?c.value[b]=k:delete c.value[b]}function f(b){return c.value[b]||t.fieldErrors?.[b]||null}const p=a.ref(!1),h=a.ref(null),m=b=>{h.value=b,p.value=!0},y=()=>{p.value=!1,h.value=null},g=b=>{b.currentValue="",l("save-field",b)},x=b=>{h.value&&(h.value.currentValue=b||"",l("save-field",h.value))},M=(b,k)=>{l("add-image",b,k)},E=b=>{l("delete-image",b),h.value?.currentValue===b&&(h.value.currentValue="",l("save-field",h.value))},v=b=>b&&[...t.imagesCommon,...t.imagesIndividual,...t.imagesSpecial].find(O=>O.id===b)?.url||null,_=(b,k)=>{const w=k.target;b.currentValue=w.value,u(b.fieldName,d(b)),l("save-field",b)},A=(b,k)=>{b.optional&&k===""?b.currentValue=void 0:b.currentValue=k,u(b.fieldName,d(b)),l("save-field",b)};return(b,k)=>n.editingComponent&&n.currentMode==="edit"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-edit-panel",onClick:k[3]||(k[3]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",bS,[a.createElementVNode("div",xS,a.toDisplayString(b.$t("editPanel.editing",{type:n.editingComponent.type})),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":b.$t("common.close"),onClick:k[0]||(k[0]=w=>b.$emit("close"))},[a.createVNode(a.unref(Ye),{size:18})],8,kS)]),n.canSelectParent?(a.openBlock(),a.createElementBlock("div",ES,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:k[1]||(k[1]=w=>b.$emit("select-parent"))},[a.createVNode(a.unref(Jr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(b.$t("addPanel.selectParent")),1)])])):a.createCommentVNode("",!0),i.value?(a.openBlock(),a.createElementBlock("div",wS,[a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="all"},"zcode-group-tab"]),onClick:k[2]||(k[2]=w=>o.value="all")}," all ",2),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,w=>(a.openBlock(),a.createElementBlock("button",{key:w.name,class:a.normalizeClass([{active:o.value===w.name},"zcode-group-tab"]),onClick:O=>o.value=w.name},a.toDisplayString(w.name),11,SS))),128))])):a.createCommentVNode("",!0),s.value.length>0?(a.openBlock(),a.createElementBlock("div",CS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.value,w=>(a.openBlock(),a.createElementBlock("div",{key:w.fieldName,class:"zcode-field-item"},[a.createElementVNode("div",NS,a.toDisplayString(w.label),1),w.type==="text"?(a.openBlock(),a.createElementBlock("div",TS,[a.createElementVNode("input",{type:"text",value:w.currentValue??"",placeholder:w.defaultValue,maxlength:w.maxLength,readonly:w.readonly,disabled:w.disabled,class:a.normalizeClass([{"zcode-field-error":f(w.fieldName)},"zcode-text-input"]),onInput:O=>_(w,O)},null,42,vS),f(w.fieldName)?(a.openBlock(),a.createElementBlock("div",zS,a.toDisplayString(f(w.fieldName)),1)):a.createCommentVNode("",!0),w.maxLength?(a.openBlock(),a.createElementBlock("div",MS,a.toDisplayString(String(w.currentValue??"").length)+" / "+a.toDisplayString(w.maxLength),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),w.type==="textarea"?(a.openBlock(),a.createElementBlock("div",AS,[a.createElementVNode("textarea",{value:w.currentValue??"",placeholder:w.defaultValue,maxlength:w.maxLength,readonly:w.readonly,disabled:w.disabled,class:a.normalizeClass([{"zcode-field-error":f(w.fieldName)},"zcode-textarea"]),rows:"4",onInput:O=>_(w,O)},null,42,IS),f(w.fieldName)?(a.openBlock(),a.createElementBlock("div",_S,a.toDisplayString(f(w.fieldName)),1)):a.createCommentVNode("",!0),w.maxLength?(a.openBlock(),a.createElementBlock("div",OS,a.toDisplayString(String(w.currentValue??"").length)+" / "+a.toDisplayString(w.maxLength),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),w.type==="rich"?(a.openBlock(),a.createElementBlock("div",DS,[a.createVNode(tS,{"model-value":w.currentValue??"",placeholder:w.defaultValue,"onUpdate:modelValue":O=>A(w,O)},null,8,["model-value","placeholder","onUpdate:modelValue"]),f(w.fieldName)?(a.openBlock(),a.createElementBlock("div",RS,a.toDisplayString(f(w.fieldName)),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),w.type==="radio"?(a.openBlock(),a.createElementBlock("div",PS,[a.createElementVNode("div",LS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(w.options,O=>(a.openBlock(),a.createElementBlock("label",{key:O,class:"zcode-radio-item"},[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":q=>w.currentValue=q,type:"radio",name:w.fieldName,value:O,onChange:q=>b.$emit("save-field",w)},null,40,$S),[[a.vModelRadio,w.currentValue]]),a.createElementVNode("span",VS,a.toDisplayString(O),1)]))),128))])])):a.createCommentVNode("",!0),w.type==="checkbox"?(a.openBlock(),a.createElementBlock("div",BS,[a.createElementVNode("div",FS,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(w.options,O=>(a.openBlock(),a.createElementBlock("label",{key:O,class:"zcode-checkbox-item"},[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":q=>w.currentValue=q,type:"checkbox",value:O,onChange:q=>b.$emit("save-field",w)},null,40,jS),[[a.vModelCheckbox,w.currentValue]]),a.createElementVNode("span",HS,a.toDisplayString(O),1)]))),128))])])):a.createCommentVNode("",!0),w.type==="select"?(a.openBlock(),a.createElementBlock("div",US,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":O=>w.currentValue=O,class:"zcode-select",onChange:O=>b.$emit("save-field",w)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(w.options,O=>(a.openBlock(),a.createElementBlock("option",{key:O,value:O},a.toDisplayString(O),9,qS))),128))],40,WS),[[a.vModelSelect,w.currentValue]])])):a.createCommentVNode("",!0),w.type==="select-multiple"?(a.openBlock(),a.createElementBlock("div",GS,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":O=>w.currentValue=O,class:"zcode-select",multiple:"",size:Math.min(w.options?.length||3,5),onChange:O=>b.$emit("save-field",w)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(w.options,O=>(a.openBlock(),a.createElementBlock("option",{key:O,value:O},a.toDisplayString(O),9,JS))),128))],40,KS),[[a.vModelSelect,w.currentValue]])])):a.createCommentVNode("",!0),w.type==="tag"?(a.openBlock(),a.createElementBlock("div",XS,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":O=>w.currentValue=O,class:"zcode-select",onChange:O=>b.$emit("save-field",w)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(w.options,O=>(a.openBlock(),a.createElementBlock("option",{key:O,value:O},a.toDisplayString(O),9,QS))),128))],40,YS),[[a.vModelSelect,w.currentValue]]),a.createElementVNode("div",ZS,[k[4]||(k[4]=a.createTextVNode(" 現在のタグ: ",-1)),a.createElementVNode("code",null,"<"+a.toDisplayString(w.currentValue)+">",1)])])):a.createCommentVNode("",!0),w.type==="boolean"?(a.openBlock(),a.createElementBlock("div",eC,[a.createElementVNode("label",tC,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":O=>w.currentValue=O,type:"checkbox",onChange:O=>b.$emit("save-field",w)},null,40,nC),[[a.vModelCheckbox,w.currentValue]]),a.createElementVNode("span",oC,a.toDisplayString(w.label)+"を表示",1)])])):a.createCommentVNode("",!0),w.type==="image"?(a.openBlock(),a.createElementBlock("div",rC,[a.createElementVNode("div",iC,[a.createElementVNode("button",{class:"zcode-image-select-btn",onClick:O=>m(w)},[a.createVNode(a.unref(mc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(w.currentValue?b.$t("editPanel.replaceImage"):b.$t("editPanel.selectImage")),1)],8,sC),w.currentValue?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-image-clear-btn",title:b.$t("editPanel.clearImageTitle"),onClick:O=>g(w)},[a.createVNode(a.unref(Ye),{size:16}),a.createElementVNode("span",null,a.toDisplayString(b.$t("editPanel.clearImage")),1)],8,aC)):a.createCommentVNode("",!0)]),v(w.currentValue)?(a.openBlock(),a.createElementBlock("div",lC,[a.createElementVNode("img",{src:v(w.currentValue)||"",alt:w.label,class:"zcode-image-preview-img"},null,8,cC)])):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)]))),128))])):!i.value||s.value.length===0?(a.openBlock(),a.createElementBlock("div",dC,[a.createElementVNode("div",uC,a.toDisplayString(b.$t("editPanel.id",{id:n.editingComponent.id})),1),a.createElementVNode("div",fC," Type: "+a.toDisplayString(n.editingComponent.type),1)])):a.createCommentVNode("",!0),a.createVNode(yS,{"is-open":p.value,"images-common":n.imagesCommon,"images-individual":n.imagesIndividual,"images-special":n.imagesSpecial,"current-value":h.value?.currentValue||void 0,"onUpdate:modelValue":x,onAddImage:M,onDeleteImage:E,onClose:y},null,8,["is-open","images-common","images-individual","images-special","current-value"])])):a.createCommentVNode("",!0)}}),hC={class:"zcode-delete-panel-header"},mC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},gC=["aria-label"],yC={key:0,class:"zcode-parent-selector"},bC={class:"zcode-delete-panel-content"},xC={class:"zcode-delete-warning"},kC={class:"zcode-delete-warning-text"},EC={class:"zcode-delete-actions"},wC=a.defineComponent({__name:"DeletePanel",props:{deleteConfirmComponent:{type:[Object,null]},currentMode:{type:String},canSelectParent:{type:Boolean}},emits:["confirm","cancel","select-parent"],setup(n){return(e,t)=>n.deleteConfirmComponent&&n.currentMode==="delete"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-delete-panel",onClick:t[4]||(t[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",hC,[a.createElementVNode("div",mC,a.toDisplayString(e.$t("deletePanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:t[0]||(t[0]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Ye),{size:18})],8,gC)]),n.canSelectParent?(a.openBlock(),a.createElementBlock("div",yC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:t[1]||(t[1]=o=>e.$emit("select-parent"))},[a.createVNode(a.unref(Jr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("deletePanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",bC,[a.createElementVNode("div",xC,[a.createVNode(a.unref(xc),{size:20,class:"zcode-delete-warning-icon"}),a.createElementVNode("div",kC,a.toDisplayString(e.$t("deletePanel.confirmMessage")),1)]),a.createElementVNode("div",EC,[a.createElementVNode("button",{class:"zcode-btn-danger",onClick:t[2]||(t[2]=o=>e.$emit("confirm"))},[a.createVNode(a.unref(On),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("common.delete")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel",onClick:t[3]||(t[3]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Ye),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)}}),SC={class:"zcode-reorder-panel-header"},CC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},NC=["aria-label"],TC={key:0,class:"zcode-parent-selector"},vC={class:"zcode-reorder-panel-content"},zC={class:"zcode-reorder-panel-content-text"},MC={class:"zcode-reorder-source"},AC=a.defineComponent({__name:"ReorderPanel",props:{reorderSourcePath:{type:String},currentMode:{type:String},canSelectParent:{type:Boolean}},emits:["cancel","select-parent"],setup(n){return(e,t)=>n.reorderSourcePath&&n.currentMode==="reorder"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-reorder-panel",onClick:t[2]||(t[2]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",SC,[a.createElementVNode("div",CC,a.toDisplayString(e.$t("reorderPanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:t[0]||(t[0]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Ye),{size:18})],8,NC)]),n.canSelectParent?(a.openBlock(),a.createElementBlock("div",TC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:t[1]||(t[1]=o=>e.$emit("select-parent"))},[a.createVNode(a.unref(Jr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("reorderPanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",vC,[a.createElementVNode("div",zC,a.toDisplayString(e.$t("reorderPanel.instruction")),1),a.createElementVNode("div",MC,a.toDisplayString(e.$t("reorderPanel.source",{path:n.reorderSourcePath})),1)])])):a.createCommentVNode("",!0)}}),IC={class:"zcode-add-panel-header"},_C={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},OC=["aria-label"],DC={key:0,class:"zcode-parent-selector"},RC={class:"zcode-part-category-tabs"},PC=["onClick"],LC={key:1,class:"zcode-type-tabs"},$C=["onClick"],VC={class:"zcode-add-panel-content"},BC={class:"zcode-part-list"},FC={class:"zcode-part-type-section"},jC={class:"zcode-type-section-title",role:"heading","aria-level":"3"},HC={class:"zcode-type-section-description"},UC={key:0,class:"zcode-module-buttons"},WC={class:"zcode-module-preview-header"},qC={class:"zcode-module-preview-label zcode-module-preview-label-header"},GC=["aria-label"],KC=["innerHTML"],JC={key:1,class:"zcode-empty-parts"},XC={class:"zcode-empty-parts-text"},YC={class:"zcode-type-section-title",role:"heading","aria-level":"3"},QC={key:0,class:"zcode-type-section-description"},ZC={class:"zcode-module-buttons"},eN=["onClick"],tN={class:"zcode-module-preview-header"},nN={class:"zcode-module-preview-label zcode-module-preview-label-header"},oN=["aria-label","onClick"],rN=["innerHTML"],iN={key:0,class:"zcode-empty-parts"},sN={class:"zcode-empty-parts-text"},aN={key:2,class:"zcode-insert-position"},lN={class:"zcode-insert-header"},cN={class:"zcode-keep-adding-label zcode-keep-adding-label-position"},dN=["checked"],uN={class:"zcode-insert-buttons"},fN={class:"zcode-preview-modal-header"},pN={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},hN=["innerHTML"],mN=a.defineComponent({__name:"AddPanel",props:{addTargetPath:{type:[String,null]},addPartCategory:{type:String},addTypeTab:{type:[String,null]},addSelectedPart:{type:[Object,null]},addSelectedType:{type:[Object,null]},clickedComponent:{type:[Object,null]},availablePartTypes:{type:Array},groupedPartsByType:{type:Array},canSelectParent:{type:Boolean},getPartPreviewHtml:{type:Function},getClickedComponentPreviewHtml:{type:Function},keepAdding:{type:Boolean},hasSpecialParts:{type:Boolean},config:{type:Object}},emits:["cancel","select-parent","category-tab-click","type-tab-click","select-part","confirm-add","update-keep-adding"],setup(n){const e=n,t=a.computed(()=>e.config?.categoryOrder||"common"),o=a.computed(()=>{const d=[];return t.value==="individual"?(d.push("individual","common"),e.hasSpecialParts&&d.push("special")):t.value==="special"?(e.hasSpecialParts&&d.push("special"),d.push("common","individual")):(d.push("common","individual"),e.hasSpecialParts&&d.push("special")),d}),r=a.ref(!1),i=a.ref(null);function s(d,u){i.value={type:d,part:u,isActiveParts:!1},r.value=!0}function l(){e.addSelectedType&&e.addSelectedPart&&(i.value={type:e.addSelectedType,part:e.addSelectedPart,isActiveParts:!0},r.value=!0)}function c(){r.value=!1,i.value=null}return(d,u)=>n.addTargetPath?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-add-panel",onClick:u[9]||(u[9]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",IC,[a.createElementVNode("div",_C,a.toDisplayString(d.$t("addPanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":d.$t("common.close"),onClick:u[0]||(u[0]=f=>d.$emit("cancel"))},[a.createVNode(a.unref(Ye),{size:18})],8,OC)]),n.canSelectParent?(a.openBlock(),a.createElementBlock("div",DC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:u[1]||(u[1]=f=>d.$emit("select-parent"))},[a.createVNode(a.unref(Jr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(d.$t("addPanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",RC,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.value,f=>(a.openBlock(),a.createElementBlock("button",{key:f,class:a.normalizeClass([{active:n.addPartCategory===f&&n.addTypeTab!=="selected"},"zcode-category-tab"]),onClick:p=>d.$emit("category-tab-click",f)},a.toDisplayString(f==="common"?d.$t("addPanel.category.common"):f==="individual"?d.$t("addPanel.category.individual"):d.$t("dataViewer.special")),11,PC))),128)),a.createElementVNode("button",{class:a.normalizeClass([{active:n.addTypeTab==="selected"},"zcode-category-tab"]),onClick:u[2]||(u[2]=f=>d.$emit("type-tab-click","selected"))},a.toDisplayString(d.$t("addPanel.category.selected")),3)]),n.availablePartTypes.length>0&&n.addTypeTab!=="selected"?(a.openBlock(),a.createElementBlock("div",LC,[a.createElementVNode("button",{class:a.normalizeClass([{active:n.addTypeTab==="all"},"zcode-type-tab"]),onClick:u[3]||(u[3]=f=>d.$emit("type-tab-click","all"))}," all ",2),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.availablePartTypes,f=>(a.openBlock(),a.createElementBlock("button",{key:f,class:a.normalizeClass([{active:n.addTypeTab===f},"zcode-type-tab"]),onClick:p=>d.$emit("type-tab-click",f)},a.toDisplayString(f),11,$C))),128))])):a.createCommentVNode("",!0),a.createElementVNode("div",VC,[a.createElementVNode("div",BC,[a.withDirectives(a.createElementVNode("div",FC,[a.createElementVNode("div",jC,a.toDisplayString(d.$t("addPanel.activeParts")),1),a.createElementVNode("div",HC,a.toDisplayString(d.$t("addPanel.activePartsDescription")),1),n.clickedComponent&&n.addSelectedPart&&n.addSelectedType?(a.openBlock(),a.createElementBlock("div",UC,[a.createElementVNode("div",{class:a.normalizeClass([{active:!0},"zcode-module-preview"])},[a.createElementVNode("div",WC,[a.createElementVNode("div",qC,a.toDisplayString(d.$t("addPanel.activeParts")),1),a.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:u[4]||(u[4]=a.withModifiers(f=>l(),["stop"]))},[a.createVNode(a.unref(kc),{size:14})],8,GC)]),a.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:n.getClickedComponentPreviewHtml()},null,8,KC)])])):(a.openBlock(),a.createElementBlock("div",JC,[a.createElementVNode("div",XC,a.toDisplayString(d.$t("addPanel.clickPartInPreview")),1)]))],512),[[a.vShow,n.addTypeTab==="selected"]]),a.withDirectives(a.createElementVNode("div",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.groupedPartsByType,f=>(a.openBlock(),a.createElementBlock("div",{key:f.type,class:"zcode-part-type-section"},[a.createElementVNode("div",YC,a.toDisplayString(f.type),1),f.description?(a.openBlock(),a.createElementBlock("div",QC,a.toDisplayString(f.description),1)):a.createCommentVNode("",!0),a.createElementVNode("div",ZC,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(f.parts,p=>(a.openBlock(),a.createElementBlock("div",{key:p.title,class:a.normalizeClass([{active:n.addTypeTab==="selected"&&n.clickedComponent?.part_id===p.id&&n.clickedComponent?.id?!0:n.addTypeTab!=="selected"&&n.addSelectedPart?.id===p.id},"zcode-module-preview"]),onClick:h=>d.$emit("select-part",f.typeData,p)},[a.createElementVNode("div",tN,[a.createElementVNode("div",nN,a.toDisplayString(p.title),1),a.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:a.withModifiers(h=>s(f.typeData,p),["stop"])},[a.createVNode(a.unref(kc),{size:14})],8,oN)]),a.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:n.getPartPreviewHtml(f.typeData,p)},null,8,rN)],10,eN))),128))])]))),128)),n.groupedPartsByType.length===0&&!n.addSelectedPart?(a.openBlock(),a.createElementBlock("div",iN,[a.createElementVNode("div",sN,a.toDisplayString(d.$t("addPanel.noPartsAvailable")),1)])):a.createCommentVNode("",!0)],512),[[a.vShow,n.addTypeTab!=="selected"]])])]),n.addSelectedPart?(a.openBlock(),a.createElementBlock("div",aN,[a.createElementVNode("div",lN,[u[10]||(u[10]=a.createElementVNode("div",{class:"zcode-insert-position-title",role:"heading","aria-level":"4"}," 追加位置を選択 ",-1)),a.createElementVNode("label",cN,[a.createElementVNode("input",{type:"checkbox",checked:n.keepAdding,class:"zcode-keep-adding-checkbox",onChange:u[5]||(u[5]=f=>d.$emit("update-keep-adding",f.target.checked))},null,40,dN),a.createElementVNode("span",null,a.toDisplayString(d.$t("addPanel.continueAdding")),1)])]),a.createElementVNode("div",uN,[a.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-before",onClick:u[6]||(u[6]=f=>d.$emit("confirm-add","before"))},a.toDisplayString(d.$t("addPanel.addBefore")),1),a.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-after",onClick:u[7]||(u[7]=f=>d.$emit("confirm-add","after"))},a.toDisplayString(d.$t("addPanel.addAfter")),1)])])):a.createCommentVNode("",!0),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[r.value&&i.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:c},[a.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:u[8]||(u[8]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",fN,[a.createElementVNode("div",pN,a.toDisplayString(d.$t("common.preview"))+": "+a.toDisplayString(i.value.isActiveParts?d.$t("addPanel.activeParts"):i.value.part.title),1),a.createElementVNode("button",{class:"zcode-close-btn",onClick:c},[a.createVNode(a.unref(Ye),{size:18})])]),a.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:i.value.isActiveParts?n.getClickedComponentPreviewHtml():n.getPartPreviewHtml(i.value.type,i.value.part)},null,8,hN)])])):a.createCommentVNode("",!0)]))])):a.createCommentVNode("",!0)}}),gN=a.defineComponent({__name:"ContextMenu",props:{isVisible:{type:Boolean},position:{type:Object},currentMode:{type:String}},emits:["select-mode","close"],setup(n,{emit:e}){const t=e;function o(i){t("select-mode",i),t("close")}function r(){t("close")}return(i,s)=>n.isVisible?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-context-menu",style:a.normalizeStyle({left:`${n.position.x}px`,top:`${n.position.y}px`}),onClick:s[4]||(s[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:n.currentMode==="edit"}]),onClick:s[0]||(s[0]=l=>o("edit"))},[a.createVNode(a.unref(gc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.edit")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:n.currentMode==="add"}]),onClick:s[1]||(s[1]=l=>o("add"))},[a.createVNode(a.unref(io),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.add")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:n.currentMode==="reorder"}]),onClick:s[2]||(s[2]=l=>o("reorder"))},[a.createVNode(a.unref(Yo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.reorder")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:n.currentMode==="delete"}]),onClick:s[3]||(s[3]=l=>o("delete"))},[a.createVNode(a.unref(On),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.delete")),1)],2),s[5]||(s[5]=a.createElementVNode("div",{class:"zcode-context-menu-divider"},null,-1)),a.createElementVNode("button",{class:"zcode-context-menu-item",onClick:r},[a.createVNode(a.unref(Ye),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.close")),1)])],4)):a.createCommentVNode("",!0)}});function yN(n){if(n.defaultValue!==void 0&&n.defaultValue!=="")switch(n.type){case"rich":return`<p>${n.defaultValue}</p>`;case"image":return n.defaultValue;default:return n.defaultValue}switch(n.type){case"text":case"textarea":return"";case"rich":return"<p></p>";case"radio":case"select":return n.options?.[0]||"";case"checkbox":case"select-multiple":return[];case"boolean":return!0;case"image":return"";default:return""}}function bN(n,e){const t=ea(n.part_id,e);if(!t)return;Dn(t.body).forEach(r=>{r.optional||n[r.fieldName]===void 0&&(n[r.fieldName]=yN(r))})}function xN(n){function e(t){bN(t,n.parts),t.slots&&Object.values(t.slots).forEach(o=>{(Array.isArray(o)?o:o?.children||[]).forEach(i=>{e(i)})})}n.page.forEach(t=>{e(t)})}function Vh(n){const e=a.reactive({page:[],css:{common:void 0,individual:void 0,special:void 0},parts:{common:[],individual:[],special:[]},images:{common:[],individual:[],special:[]},backendData:void 0});function t(){try{const i=n.page?JSON.parse(n.page):[],s=n.partsCommon?JSON.parse(n.partsCommon):[],l=n.partsIndividual?JSON.parse(n.partsIndividual):[],c=n.partsSpecial?JSON.parse(n.partsSpecial):[],d=n.imagesCommon?JSON.parse(n.imagesCommon):[],u=n.imagesIndividual?JSON.parse(n.imagesIndividual):[],f=n.imagesSpecial?JSON.parse(n.imagesSpecial):[],p=n.cssCommon!==void 0?n.cssCommon:void 0,h=n.cssIndividual!==void 0?n.cssIndividual:void 0,m=n.cssSpecial!==void 0?n.cssSpecial:void 0,y=n.backendData?JSON.parse(n.backendData):void 0;Object.assign(e,{page:i,css:{common:p,individual:h,special:m},parts:{common:s,individual:l,special:c},images:{common:d,individual:u,special:f},backendData:y}),xN(e)}catch(i){console.error("Failed to parse props:",i)}}function o(i){if(!i)return e;const s=i.split(".");let l=e;for(const c of s)if(l==null||typeof l!="object"||(l=l[c],l===void 0))return;return l}function r(i,s){if(typeof i=="string"){const l=i.split(".");let c=e;for(let d=0;d<l.length-1;d++){const u=c[l[d]];if(u==null||typeof u!="object")return;c=u}c[l[l.length-1]]=s}else Object.assign(e,i)}return{cmsData:e,loadDataFromProps:t,getData:o,setData:r}}function kN(){const n=a.ref("edit"),e=a.ref(!1);function t(o){n.value=o}return{currentMode:n,switchMode:t,allowDynamicContentInteraction:e}}function Bh(n){const e=document.documentElement,o={edit:"--zcode-color-edit",add:"--zcode-color-add",reorder:"--zcode-color-reorder",delete:"--zcode-color-delete"}[n]||"--zcode-color-edit";return getComputedStyle(e).getPropertyValue(o).trim()||"#3b82f6"}function Ut(n,e){const t=Bh(e);n.classList.remove("zcode-outline-active-edit","zcode-outline-active-add","zcode-outline-active-reorder","zcode-outline-active-delete"),n.classList.add(`zcode-outline-active-${e}`),n.style.outlineColor=t,n.style.outlineStyle="solid"}function Wt(n){n.style.outline="",n.style.outlineOffset="",n.classList.remove("zcode-outline-active-edit","zcode-outline-active-add","zcode-outline-active-reorder","zcode-outline-active-delete")}function nc(n,e){const t=Bh(e);n.style.outline=`2px dashed ${t}`,n.style.outlineOffset="2px"}function un(n){n.style.outline="",n.style.outlineOffset=""}function EN(n,e){const t=a.ref(null),o=a.ref(-1),r=a.ref(""),i=a.ref([]);function s(u){const f=u.part_id,p=n.parts,h=[...p.common,...p.individual];let m=null;for(const g of h){const x=g.parts.find(M=>M.id===f);if(x){m=x;break}}return m?Dn(m.body).map(g=>{const x={fieldName:g.fieldName,groupName:g.groupName,label:eg(g.fieldName),required:g.required,maxLength:g.maxLength,readonly:g.readonly,disabled:g.disabled};if(g.type==="text")return{...x,type:"text",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue};if(g.type==="textarea")return{...x,type:"textarea",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="rich")return{...x,type:"rich",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="radio")return{...x,type:"radio",options:g.options,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.options?.[0]};if(g.type==="boolean")return{...x,type:"boolean",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:!0};if(g.type==="image")return{...x,type:"image",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="select")return{...x,type:"select",options:g.options,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.options?.[0]};if(g.type==="select-multiple")return{...x,type:"select-multiple",options:g.options,optional:g.optional,currentValue:Array.isArray(u[g.fieldName])?u[g.fieldName]:[]};if(g.type==="tag"){const M=["h1","h2","h3","h4","h5","h6","div","p","span","li","ul","ol","section","article","aside","nav","header","footer","main","figure","figcaption","blockquote","pre","code","table","thead","tbody","tr","th","td"],E=g.options||M;return{...x,type:"tag",options:E,defaultValue:g.defaultValue||"div",currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.defaultValue||"div"}}else return{...x,type:"checkbox",options:g.options,optional:g.optional,currentValue:Array.isArray(u[g.fieldName])?u[g.fieldName]:[]}}):[]}function l(u,f){if(r.value===u){d();return}const p=u.split(".");let h=-1;if(p[0]==="page"&&p.length>=2&&(h=parseInt(p[1])),r.value&&e.value){const m=e.value.querySelector(`[data-zcode-path="${r.value}"]`);m&&Wt(m)}t.value=f,o.value=h,r.value=u,i.value=s(f),a.nextTick(()=>{if(e.value&&r.value===u){const m=e.value.querySelector(`[data-zcode-path="${u}"]`);m&&(Ut(m,"edit"),Zo(m))}})}function c(u){if(t.value&&r.value){const f=on(r.value,n);f&&(u.optional&&(u.currentValue===""||u.currentValue===null)?f[u.fieldName]=void 0:f[u.fieldName]=u.currentValue)}}function d(){if(r.value&&e.value){const u=e.value.querySelector(`[data-zcode-path="${r.value}"]`);u&&Wt(u)}t.value=null,r.value="",i.value=[]}return{editingComponent:t,editingComponentIndex:o,editingComponentPath:r,editingAvailableFields:i,handleEditClick:l,saveFieldEdit:c,closeEditPanel:d}}function wN(n,e,t,o){const r=a.ref(null),i=a.ref(null),s=a.ref(null),l=a.ref(o?.categoryOrder==="individual"?"individual":o?.categoryOrder==="special"?"special":"common"),c=a.ref("all"),d=a.ref(null),u=a.ref(!1);function f(T){if(T.includes(".slots.")){const R=T.split(".");let H=-1;for(let F=R.length-1;F>=0;F--)if(R[F]==="slots"){H=F;break}if(H!==-1&&H+1<R.length)return R.slice(0,H+2).join(".")}return T}const p=a.computed(()=>{const T=n.parts,R=l.value==="common"?T.common:l.value==="individual"?T.individual:T.special;if(r.value&&r.value.includes(".slots.")){const F=[...T.common,...T.individual,...T.special],L=f(r.value);return y(L,F,R)}return[...new Set(R.map(F=>F.type))]});function h(T,R){const H=T.split(".");let F=-1;for(let Y=H.length-1;Y>=0;Y--)if(H[Y]==="slots"){F=Y;break}if(F===-1)return null;const L=H.slice(0,F).join("."),B=H[F+1],te=on(L,n);if(!te)return null;const K=te.part_id;let ae=null;for(const Y of R)if(Y.parts.some(J=>J.id===K)){ae=Y;break}if(!ae)return null;const Z=(ae.parts.find(Y=>Y.id===K)||ae.parts[0])?.slots?.[B];if(Z){const Y=Z.allowedParts;if(Y&&Array.isArray(Y))return Y}return null}const m=a.computed(()=>{const T=n.parts,R=l.value==="common"?T.common:l.value==="individual"?T.individual:T.special,H=p.value;let F=R.filter(K=>H.includes(K.type));c.value&&c.value!=="all"&&c.value!=="selected"&&(F=F.filter(K=>K.type===c.value));const L=[...T.common,...T.individual],B=r.value&&r.value.includes(".slots.")?h(f(r.value),L):null,te=new Map;return F.forEach(K=>{te.has(K.type)||te.set(K.type,{type:K,parts:[]});const ae=te.get(K.type);B!==null?B.length>0&&K.parts.forEach(Q=>{B.includes(Q.id)&&ae.parts.push(Q)}):K.parts.forEach(Q=>{Q.slotOnly||ae.parts.push(Q)})}),Array.from(te.values()).map(K=>({type:K.type.type,description:K.type.description,typeData:K.type,parts:K.parts}))});function y(T,R,H){const F=T.split(".");let L=-1;for(let J=F.length-1;J>=0;J--)if(F[J]==="slots"){L=J;break}if(L===-1)return[...new Set(H.map(J=>J.type))];const B=F.slice(0,L).join("."),te=F[L+1],K=on(B,n);if(!K)return[...new Set(H.map(J=>J.type))];const ae=K.part_id;let Q=null,Z=null;for(const J of R){const ee=J.parts.find(de=>de.id===ae);if(ee){Q=J,Z=ee;break}}if(!Q||!Z)return[...new Set(H.map(J=>J.type))];const Y=Z?.slots?.[te];if(Y){const J=Y.allowedParts;if(J&&Array.isArray(J)){const ee=new Set;R.forEach(we=>{we.parts.forEach(Ne=>{J.includes(Ne.id)&&ee.add(we.type)})});let de=Array.from(ee);return de=de.filter(we=>H.some(Ne=>Ne.type===we)),de}}return[...new Set(H.map(J=>J.type))]}function g(T,R=!1){if(r.value===T){O();return}if(r.value&&e.value){const de=e.value.querySelector(`[data-zcode-path="${r.value}"]`);de&&Wt(de);const we=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);we&&Wt(we)}r.value=T,c.value="all",l.value="common",i.value=null,s.value=null;const H=on(T,n);H&&H.part_id?d.value=H:d.value=null;const F=n.parts,L=F.common,B=F.individual,te=F.special;let K=[],ae=[];if(T.includes(".slots.")){const de=[...L,...B,...te],we=f(T);K=y(we,de,L),ae=y(we,de,B)}else K=[...new Set(L.map(de=>de.type))],ae=[...new Set(B.map(de=>de.type))];const Q=K.length>0,Z=ae.length>0,Y=te.length>0,J=o?.categoryOrder;let ee;J==="special"&&Y?ee="special":J==="individual"&&Z?ee="individual":J==="common"&&Q||Q?ee="common":Z?ee="individual":Y?ee="special":ee="common",l.value=ee,a.nextTick(()=>{if(e.value&&r.value===T){const de=e.value.querySelector(`[data-zcode-path="${T}"]`);if(de)Ut(de,"add"),Zo(de);else{const we=f(T);if(we!==T){const Ne=e.value.querySelector(`[data-zcode-slot-path="${we}"]`);Ne&&(Ut(Ne,"add"),Zo(Ne))}}}})}function x(T){l.value=T,c.value="all",i.value=null,s.value=null,u.value=!1}function M(T){if(c.value=T,T==="selected"&&d.value&&d.value.part_id){const R=n.parts,H=[...R.common,...R.individual,...R.special];for(const F of H){const L=F.parts.find(B=>B.id===d.value.part_id);if(L){i.value=F,s.value=L;break}}}else T!=="selected"&&(i.value=null,s.value=null);u.value=!1}function E(T,R){const H=_(T,R);return t(H,"")}function v(){return d.value?t(d.value,""):""}function _(T,R){const H=b(T,!1,new Set,R.id);return H.id="preview",H}function A(T,R){if(s.value?.id===R.id){i.value=null,s.value=null;return}i.value=T,s.value=R,c.value==="selected"&&(c.value="all"),u.value=!1}function b(T,R=!1,H=new Set,F){const L=F?T.parts.find(Z=>Z.id===F)||T.parts[0]:R&&s.value?s.value:T.parts[0];if(!L)throw new Error(`Part not found for type: ${T.type}`);const B=`${T.id}:${L.id}`;if(H.has(B)){const Z=Dn(L.body),Y={};return Z.forEach(J=>{J.optional?Y[J.fieldName]=void 0:J.type==="text"?Y[J.fieldName]=J.defaultValue:J.type==="radio"?Y[J.fieldName]=J.options?.[0]:J.type==="checkbox"?Y[J.fieldName]=[]:J.type==="boolean"?Y[J.fieldName]=!0:J.type==="rich"?Y[J.fieldName]=J.defaultValue?`<p>${J.defaultValue}</p>`:"<p></p>":J.type==="image"&&(Y[J.fieldName]=J.defaultValue||"")}),{id:Rn(),part_id:L.id,...Y}}H.add(B);const te=Dn(L.body),K={};te.forEach(Z=>{Z.optional?K[Z.fieldName]=void 0:Z.type==="text"?K[Z.fieldName]=Z.defaultValue:Z.type==="radio"?K[Z.fieldName]=Z.options?.[0]:Z.type==="checkbox"?K[Z.fieldName]=[]:Z.type==="boolean"?K[Z.fieldName]=!0:Z.type==="rich"?K[Z.fieldName]=Z.defaultValue?`<p>${Z.defaultValue}</p>`:"<p></p>":Z.type==="image"&&(K[Z.fieldName]=Z.defaultValue||"")});const ae={id:Rn(),part_id:L.id,...K},Q=L.slots;if(Q){const Z={};Object.entries(Q).forEach(([Y,J])=>{const ee=J.allowedParts;if(ee&&ee.length===1){const de=ee[0],we=n.parts,Ne=[...we.common,...we.individual,...we.special];let Pe=null,C=null;for(const P of Ne){const V=P.parts.find(S=>S.id===de);if(V){Pe=P,C=V;break}}if(Pe&&C){const P=b(Pe,!1,H,C.id);Z[Y]=[P]}else Z[Y]=[]}else Z[Y]=[]}),Object.keys(Z).length>0&&(ae.slots=Z)}return ae}function k(T){return b(T,!0)}function w(T){if(!i.value||!s.value||!r.value){console.error("Missing required values:",{addSelectedType:i.value,addSelectedPart:s.value,addTargetPath:r.value});return}let R;if(c.value==="selected"&&d.value){if(R=JSON.parse(JSON.stringify(d.value)),R.id=Rn(),R.slots){const L=B=>{B.forEach(te=>{te.id=Rn(),te.slots&&Object.values(te.slots).forEach(K=>{Array.isArray(K)?L(K):K&&typeof K=="object"&&K.children&&L(K.children||[])})})};Object.values(R.slots).forEach(B=>{Array.isArray(B)?L(B):B&&typeof B=="object"&&B.children&&L(B.children||[])})}}else R=k(i.value);const H=r.value,F=H.split(".");if(F[0]==="page"&&F.length===2){const L=parseInt(F[1]);T==="before"?(n.page.splice(L,0,R),u.value&&(r.value=`page.${L+1}`)):n.page.splice(L+1,0,R)}else if(F.includes("slots")){const L=f(H),B=L.split(".");let te=-1;for(let ee=B.length-1;ee>=0;ee--)if(B[ee]==="slots"){te=ee;break}if(te===-1||te>=B.length-1){console.error("Invalid slot path:",L);return}const K=B.slice(0,te).join("."),ae=B[te+1],Q=H!==L?parseInt(F[F.length-1]):-1,Z=on(K,n);if(!Z){console.error("Parent component not found:",K);return}Z.slots||(Z.slots={});const Y=Z.slots[ae];let J=[];if(Array.isArray(Y)?J=Y:Y&&typeof Y=="object"&&Y.children?(J=Y.children||[],Y.children||(Y.children=[])):(Z.slots[ae]=[],J=Z.slots[ae]),Q===-1)J.push(R);else if(T==="before"){if(J.splice(Q,0,R),u.value){const ee=f(H);if(H!==ee){const de=[...F];de[de.length-1]=String(Q+1),r.value=de.join(".")}else{const we=[...ee.split(".")];we.push("0"),r.value=we.join(".")}}}else J.splice(Q+1,0,R);Array.isArray(Z.slots[ae])||(Z.slots[ae].children=J)}if(d.value||c.value==="selected"&&(c.value="all"),!u.value)O();else if(T==="before"&&e.value&&r.value){const L=e.value.querySelector(`[data-zcode-path="${H}"]`);L&&Wt(L),a.nextTick(()=>{if(e.value&&r.value){const B=e.value.querySelector(`[data-zcode-path="${r.value}"]`);B&&Ut(B,"add")}})}}function O(){if(r.value&&e.value){const T=e.value.querySelector(`[data-zcode-path="${r.value}"]`);T&&Wt(T);const R=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);R&&Wt(R)}r.value=null,i.value=null,s.value=null,d.value=null,l.value="common",c.value="all",u.value=!1}const q=a.computed(()=>n.parts.special.length>0);return{addTargetPath:r,addSelectedType:i,addSelectedPart:s,clickedComponent:d,addPartCategory:l,addTypeTab:c,keepAdding:u,availablePartTypes:p,groupedPartsByType:m,hasSpecialParts:q,handleAddClick:g,handleCategoryTabClick:x,handleTypeTabClick:M,selectPart:A,getPartPreviewHtml:E,getClickedComponentPreviewHtml:v,confirmAddPart:w,cancelAdd:O}}function SN(n,e,t,o){const r=a.ref(null),i=a.ref("");function s(f,p){if(i.value===f){u();return}if(i.value&&e.value){const h=e.value.querySelector(`[data-zcode-path="${i.value}"]`);h&&Wt(h)}r.value=p,i.value=f,o(()=>{if(e.value&&i.value===f){const h=e.value.querySelector(`[data-zcode-path="${f}"]`);h&&(Ut(h,"delete"),Zo(h))}})}function l(){if(!i.value)return;const f=i.value,p=f.split(".");let h=null,m=null;if(p.length===2&&p[0]==="page"){const y=parseInt(p[1]);!isNaN(y)&&y>=0&&y<n.page.length&&(n.page.splice(y,1),n.page.length===0&&o(()=>{t("add")}))}else if(p.length>2&&p[0]==="page"){const y=parseInt(p[1]);if(isNaN(y)||y<0||y>=n.page.length){console.error("Invalid top-level index:",y),u();return}let g=n.page[y];const x=p.slice(2);x.length>=3&&x[0]==="slots"&&(m=x[1],h=`page.${y}`);for(let E=0;E<x.length-1;E++){if(!g||typeof g!="object"){console.error("Invalid path:",f),u();return}g=g[x[E]]}const M=x[x.length-1];if(g&&typeof g=="object")if(Array.isArray(g)){const E=parseInt(M);!isNaN(E)&&E>=0&&E<g.length?g.splice(E,1):console.error("Invalid array index:",M)}else M in g?delete g[M]:console.error("Field not found:",f);else console.error("Invalid current object:",f)}h&&m&&o(()=>{c(h,m)}),u()}function c(f,p){const h=on(f,n);if(!h)return;const m=h.slots;if(!m||!Array.isArray(m[p]))return;const y=m[p];if(y.length===0){const g=h.part_id,x=n.parts,M=[...x.common,...x.individual];let E=null,v=null;for(const A of M){const b=A.parts.find(k=>k.id===g);if(b){E=A,v=b;break}}if(!E||!v)return;const _=v?.slots?.[p];if(_){const A=_.allowedParts;if(A&&A.length===1){const b=A[0];let k=null,w=null;for(const O of M){const q=O.parts.find(T=>T.id===b);if(q){k=O,w=q;break}}if(k&&w){const O=d(k,w.id);y.push(O)}}}}}function d(f,p){const h=p&&f.parts.find(M=>M.id===p)||f.parts[0];if(!h)throw new Error(`Part not found for type: ${f.type}`);const m=Dn(h.body),y={};m.forEach(M=>{M.optional?y[M.fieldName]=void 0:M.type==="text"?y[M.fieldName]=M.defaultValue:M.type==="radio"?y[M.fieldName]=M.options?.[0]:M.type==="checkbox"?y[M.fieldName]=[]:M.type==="boolean"?y[M.fieldName]=!0:M.type==="rich"?y[M.fieldName]=M.defaultValue?`<p>${M.defaultValue}</p>`:"<p></p>":M.type==="image"&&(y[M.fieldName]=M.defaultValue||"")});const g={id:Rn(),part_id:h.id,...y},x=h.slots;if(x){const M={};Object.entries(x).forEach(([E,v])=>{const _=v.allowedParts;if(_&&_.length===1){const A=_[0],b=n.parts,k=[...b.common,...b.individual];let w=null,O=null;for(const q of k){const T=q.parts.find(R=>R.id===A);if(T){w=q,O=T;break}}if(w&&O){const q=d(w,O.id);M[E]=[q]}else M[E]=[]}else M[E]=[]}),Object.keys(M).length>0&&(g.slots=M)}return g}function u(){if(i.value&&e.value){const f=e.value.querySelector(`[data-zcode-path="${i.value}"]`);f&&Wt(f)}r.value=null,i.value=""}return{deleteConfirmComponent:r,deleteConfirmPath:i,handleDeleteClick:s,confirmDelete:l,cancelDelete:u}}function CN(n,e){const t=a.ref("");function o(l,c){if(!l||!c)return!1;const d=l.split("."),u=c.split(".");if(d.length!==u.length||l===c)return!1;if(d.includes("slots")&&u.includes("slots")){let f=-1,p=-1;for(let x=d.length-1;x>=0;x--)if(d[x]==="slots"){f=x;break}for(let x=u.length-1;x>=0;x--)if(u[x]==="slots"){p=x;break}if(f===-1||p===-1)return!1;const h=d.slice(0,f).join("."),m=u.slice(0,p).join(".");if(h!==m)return!1;const y=d[f+1],g=u[p+1];return y===g}if(d.length>2){const f=d.slice(0,-1).join("."),p=u.slice(0,-1).join(".");if(f!==p)return!1}return!0}function r(l){if(!l)return;if(!t.value){const d=Lc(l);if(d&&e.value){const u=e.value.querySelector(`[data-zcode-path="${d}"]`);u&&un(u)}if(t.value=l,e.value){const u=e.value.querySelector(`[data-zcode-path="${l}"]`);u&&(Ut(u,"reorder"),Zo(u))}return}if(t.value===l){i();return}if(!o(t.value,l)){alert("この要素とは並べ替えできません。同じ階層の要素を選択してください。"),i();return}s(t.value,l)||alert("並べ替えに失敗しました。同じ階層の要素を選択してください。"),i()}function i(){if(t.value&&e.value){const l=e.value.querySelector(`[data-zcode-path="${t.value}"]`);l&&Wt(l)}t.value=""}function s(l,c){const d=l.split("."),u=c.split(".");if(d.length===2&&u.length===2&&d[0]==="page"&&u[0]==="page"){const f=parseInt(d[1]),p=parseInt(u[1]);if(!isNaN(f)&&!isNaN(p)&&f!==p){const h=[...n.page],[m]=h.splice(f,1);return h.splice(p,0,m),n.page=h,!0}return!1}else if(d.includes("slots")&&u.includes("slots")){let f=-1,p=-1;for(let b=d.length-1;b>=0;b--)if(d[b]==="slots"){f=b;break}for(let b=u.length-1;b>=0;b--)if(u[b]==="slots"){p=b;break}if(f===-1||p===-1)return!1;const h=d.slice(0,f).join("."),m=u.slice(0,p).join(".");if(h!==m)return!1;const y=d[f+1],g=u[p+1];if(y!==g)return!1;const x=parseInt(d[d.length-1]),M=parseInt(u[u.length-1]);if(isNaN(x)||isNaN(M)||x===M)return!1;const E=on(h,n);if(!E||!E.slots||!E.slots[y])return!1;const v=E.slots[y];let _=[];if(Array.isArray(v))_=v;else if(v&&typeof v=="object"&&v.children)_=v.children||[];else return!1;const[A]=_.splice(x,1);return _.splice(M,0,A),!Array.isArray(v)&&typeof v=="object"&&v.children&&(v.children=_),!0}else if(d.length>2&&u.length>2){const f=d.slice(0,-1).join("."),p=u.slice(0,-1).join(".");if(f===p){const h=parseInt(d[d.length-1]),m=parseInt(u[u.length-1]);if(!isNaN(h)&&!isNaN(m)&&h!==m){const y=parseInt(d[1]);let g=n.page[y];for(let x=2;x<d.length-1;x++)g=g[d[x]];if(Array.isArray(g)){const[x]=g.splice(h,1);return g.splice(m,0,x),!0}}}}return!1}return{reorderSourcePath:t,handleReorderClick:r,canReorderWith:o,cancelReorder:i}}function NN(n,e,t,o,r,i,s,l,c){const d=a.computed(()=>o.value?Lc(o.value):null),u=a.computed(()=>{if(!d.value)return!1;const p=on(d.value,n);return p!=null});function f(){if(!d.value)return;const p=d.value;if(!e.value||!e.value.querySelector(`[data-zcode-path="${p}"]`))return;const m=on(p,n);if(m){if(o.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${o.value}"]`);y&&un(y)}switch(t.value){case"edit":r(p,m);break;case"add":i(p,!0);break;case"reorder":if(c.value){const y=e.value.querySelector(`[data-zcode-path="${c.value}"]`);y&&Wt(y),c.value=""}s(p);break;case"delete":l(p,m);break}}}return{parentPath:d,canSelectParent:u,selectParentElement:f}}function TN(n,e,t,o,r,i,s,l,c,d,u,f,p,h){const m=new Map;function y(){if(!e.value)return;g();const x=e.value.querySelectorAll("[data-zcode-id]"),M=b=>{const k=b.target;if(!k)return;const w=k.closest("[data-zcode-add-slot]");if(!w)return;const O=w.closest("[data-zcode-slot-path]"),q=O?.getAttribute("data-zcode-slot-path");if(!q)return;b.preventDefault(),b.stopPropagation(),b.stopImmediatePropagation();const T=()=>{const R=e.value?.querySelector(`[data-zcode-slot-path="${q}"]`);R&&(un(R),Ut(R,"add"))};if(O&&un(O),t.value!=="add"){p("add"),a.nextTick(()=>{c(q),a.nextTick(()=>{T()})});return}T(),a.nextTick(()=>{c(q),a.nextTick(()=>{T()})})};let E=null;const v=b=>o.value===b||r.value===b||i.value===b||s.value===b,_=b=>{const w=b.target;if(!w)return;const O=w.closest("[data-zcode-slot-path]");if(!O){if(E){const T=E.getAttribute("data-zcode-slot-path")||"";(!T||!v(T))&&un(E),E=null}return}if(E===O)return;if(E){const T=E.getAttribute("data-zcode-slot-path")||"";(!T||!v(T))&&un(E)}E=O;const q=O.getAttribute("data-zcode-slot-path")||"";q&&!v(q)&&nc(O,t.value)},A=b=>{const k=b,w=k.target;if(!w)return;const O=k.relatedTarget,q=w.closest("[data-zcode-slot-path]");if(!q||O&&q.contains(O))return;const T=q.getAttribute("data-zcode-slot-path")||"";(!T||!v(T))&&un(q),E===q&&(E=null)};e.value.addEventListener("click",M,!0),e.value.addEventListener("mouseover",_,!0),e.value.addEventListener("mouseout",A,!0),m.set(e.value,[{type:"click",listener:M,options:!0},{type:"mouseover",listener:_,options:!0},{type:"mouseout",listener:A,options:!0}]),x.forEach(b=>{const k=b,w=k.getAttribute("data-zcode-path");if(!w)return;const O=H=>{const F=H.target,B=F?.closest("[data-zcode-path]")?.getAttribute("data-zcode-path");if(B&&B!==w)return;F?.closest("a[href]")&&(h.value||H.preventDefault()),h.value||(H.stopPropagation(),H.stopImmediatePropagation());const K=on(w,n);if(K)switch(un(k),t.value){case"edit":l(w,K);break;case"add":c(w);break;case"reorder":if(i.value){const ae=i.value.split("."),Q=w.split(".");if(ae.length!==Q.length&&ae.indexOf("rows")!==-1){const Y=Q.indexOf("cells");if(Y!==-1){let J=-1;for(let ee=Y-1;ee>=0;ee--)if(Q[ee]==="slots"){J=ee;break}if(J!==-1){const ee=Q.slice(0,J).join(".");if(ee&&f(i.value,ee)){d(ee);return}}}}}d(w);break;case"delete":u(w,K);break}},q=H=>{if(o.value===H||r.value===H||i.value===H||s.value===H)return!0;if(H.includes(".slots.")){const L=H.split(".");let B=-1;for(let te=L.length-1;te>=0;te--)if(L[te]==="slots"){B=te;break}if(B!==-1&&B+1<L.length){const te=L.slice(0,B+2).join(".");return r.value===te||o.value===te||i.value===te||s.value===te}}return!1},T=()=>{q(w)||(t.value==="reorder"&&i.value?f(i.value,w)&&nc(k,t.value):nc(k,t.value)),t.value==="reorder"?k.style.cursor=i.value&&f(i.value,w)?"move":i.value?"not-allowed":"move":k.style.cursor="pointer"},R=()=>{q(w)||un(k),k.style.cursor=""};k.addEventListener("click",O,!0),k.addEventListener("mouseenter",T),k.addEventListener("mouseleave",R),m.set(k,[{type:"click",listener:O,options:!0},{type:"mouseenter",listener:T},{type:"mouseleave",listener:R}])}),a.nextTick(()=>{a.nextTick(()=>{if(t.value==="edit"&&o.value&&e.value){const b=e.value.querySelector(`[data-zcode-path="${o.value}"]`);b&&Ut(b,"edit")}if(t.value==="add"&&r.value&&e.value){const b=e.value.querySelector(`[data-zcode-path="${r.value}"]`);if(b)Ut(b,"add");else{const k=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);k&&Ut(k,"add")}}if(t.value==="reorder"&&i.value&&e.value){const b=e.value.querySelector(`[data-zcode-path="${i.value}"]`);b&&Ut(b,"reorder")}if(t.value==="delete"&&s.value&&e.value){const b=e.value.querySelector(`[data-zcode-path="${s.value}"]`);b&&Ut(b,"delete")}})})}function g(){m.forEach((x,M)=>{x.forEach(({type:E,listener:v,options:_})=>{M.removeEventListener(E,v,_)})}),m.clear()}return{setupClickHandlers:y,cleanupEventListeners:g}}function vN(n,e,t,o,r,i,s,l,c,d,u,f,p){function h(m){n.value&&n.value.querySelectorAll("[data-zcode-path], [data-zcode-slot-path]").forEach(g=>{Wt(g),un(g)}),e.value==="edit"&&o.value?(l.value=null,o.value=""):e.value==="add"&&r.value?(r.value=null,c.value=null,d.value=null,u.value="common",f.value=null):e.value==="reorder"&&i.value?i.value="":e.value==="delete"&&s.value&&p(),t(m)}return{switchMode:h}}function zN(n,e,t){const o=a.ref(!1),r=a.ref({x:0,y:0});function i(p){!e.value||!n.value||!p.target.closest("[data-zcode-path]")||(p.preventDefault(),p.stopPropagation(),r.value={x:p.clientX,y:p.clientY},o.value=!0)}function s(p){t(p),o.value=!1}function l(){o.value=!1}function c(p){p.target.closest(".zcode-context-menu")||l()}function d(p){p.target.closest(".zcode-context-menu")||l()}function u(){!n.value||!e.value||(n.value.addEventListener("contextmenu",i),document.addEventListener("click",c),document.addEventListener("contextmenu",d))}function f(){n.value&&(n.value.removeEventListener("contextmenu",i),document.removeEventListener("click",c),document.removeEventListener("contextmenu",d))}return{isVisible:o,position:r,handleModeSelect:s,closeMenu:l,setupContextMenu:u,cleanupContextMenu:f}}function MN(n){const e=n;if(!e||!e.page||!Array.isArray(e.page))return!1;for(const t of e.page)if(!t.id||!t.part_id)return!1;return!0}function oc(n,e){const t=[],o=(r,i)=>{Object.keys(r).forEach(s=>{s.includes("image")&&r[s]===n&&t.push({path:i,component:r,fieldName:s})}),r.slots&&Object.entries(r.slots).forEach(([s,l])=>{Array.isArray(l)&&l.forEach((c,d)=>{o(c,`${i}.slots.${s}.${d}`)})})};return e.forEach((r,i)=>{o(r,`page.${i}`)}),t}const AN={key:0,class:"zcode-save-banner zcode-save-banner--error",role:"alert"},IN={class:"zcode-save-banner-text"},_N=["aria-label"],ON={key:1,class:"zcode-save-controls-fixed"},DN={class:"zcode-save-confirm-dialog"},RN={class:"zcode-save-confirm-dialog-header"},PN={class:"zcode-save-confirm-dialog-title"},LN={class:"zcode-save-confirm-dialog-body"},$N={class:"zcode-save-confirm-dialog-footer"},As=a.defineComponent({__name:"ZeroCodeCMS",props:{locale:{type:String},page:{type:String},cssCommon:{type:String},cssIndividual:{type:String},cssSpecial:{type:String},partsCommon:{type:String},partsIndividual:{type:String},partsSpecial:{type:String},imagesCommon:{type:String},imagesIndividual:{type:String},imagesSpecial:{type:String},config:{type:String},endpoints:{type:String},backendData:{type:String}},setup(n,{expose:e}){const{t}=Qt(),o=n,r=a.ref("manage"),i=a.ref(!1),l=(le=>{if(!le)return{};try{return JSON.parse(le)}catch(ue){return console.warn("[ZeroCodeCMS] Failed to parse config:",ue),{}}})(o.config),c=(le,ue,be)=>{const qe=Kd();return qe[le]!==void 0?qe[le]:be!==void 0?be:ue},d=a.ref(c("devRightPadding",!1,l.cms?.devRightPadding)),u=a.ref(c("enableContextMenu",!1,l.cms?.enableContextMenu)),f=a.ref(c("showSaveConfirm",!0,l.cms?.showSaveConfirm)),p=a.computed(()=>d.value),h=a.ref(!1),{cmsData:m,loadDataFromProps:y,getData:g,setData:x}=Vh(o),{fullPageHtml:M,renderComponentToHtml:E}=ti(m,!0);function v(le){if(le!=="css")return le?g(le):g()}const _=a.ref(null),A=a.ref(null),b=a.computed(()=>A.value?.previewArea||null),{currentMode:k,switchMode:w,allowDynamicContentInteraction:O}=kN(),q=c("allowDynamicContentInteraction",!1,l.cms?.allowDynamicContentInteraction),T=a.ref(q);O.value=q;let R=!1;a.watch(r,(le,ue)=>{le==="preview"?(R=T.value,T.value=!0,O.value=!0,a.nextTick(()=>{yt()})):ue==="preview"&&(T.value=R,O.value=R,a.nextTick(()=>{yt()})),An("view-mode-changed",{mode:le,previousMode:ue})});const{editingComponent:H,editingComponentPath:F,editingAvailableFields:L,handleEditClick:B,saveFieldEdit:te,closeEditPanel:K}=EN(m,b),ae=a.ref({}),Q=a.ref([]),Z=a.ref({visible:!1,message:""});function Y(le){if(le?.fieldName&&ae.value[le.fieldName]){const ue={...ae.value};delete ue[le.fieldName],ae.value=ue}te(le)}const{addTargetPath:J,addSelectedType:ee,addSelectedPart:de,clickedComponent:we,addPartCategory:Ne,addTypeTab:Pe,keepAdding:C,availablePartTypes:P,groupedPartsByType:V,hasSpecialParts:S,handleAddClick:N,handleCategoryTabClick:$,handleTypeTabClick:ne,selectPart:me,getPartPreviewHtml:De,getClickedComponentPreviewHtml:Te,confirmAddPart:z,cancelAdd:I}=wN(m,b,E,l),{reorderSourcePath:G,handleReorderClick:pe,canReorderWith:Ae,cancelReorder:ye}=CN(m,b),{deleteConfirmComponent:U,deleteConfirmPath:X,handleDeleteClick:ze,confirmDelete:Ve,cancelDelete:j}=SN(m,b,w,a.nextTick),{switchMode:W}=vN(b,k,w,F,J,G,X,H,ee,de,Ne,Pe,j),re=a.computed(()=>k.value==="edit"&&F.value?F.value:k.value==="add"&&J.value?J.value:k.value==="reorder"&&G.value?G.value:k.value==="delete"&&X.value?X.value:null),{canSelectParent:ce,selectParentElement:ve}=NN(m,b,k,re,B,N,pe,ze,G),He=a.computed(()=>!!(H.value||J.value||G.value||U.value)),yt=()=>{if(b.value){const le=b.value.getRootNode();if(le instanceof ShadowRoot){let qe=0;const Ze=()=>{qe++;const vt=le;if(typeof vt.__zcmsSetAllowDynamicContentInteraction=="function"){vt.__zcmsSetAllowDynamicContentInteraction(T.value);return}qe<30&&setTimeout(Ze,50)};Ze()}}},{setupClickHandlers:fn,cleanupEventListeners:qr}=TN(m,b,k,F,J,G,X,B,N,pe,ze,Ae,W,T),{isVisible:ac,position:Wo,handleModeSelect:qo,closeMenu:lc,setupContextMenu:Mn,cleanupContextMenu:Gr}=zN(b,u,W);function An(le,ue){const be=pn();if(be){const Ze=new CustomEvent(le,{detail:ue,bubbles:!0,composed:!0});be.dispatchEvent(Ze);return}const qe=new CustomEvent(le,{detail:ue,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(qe)}function Qe(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function pn(){if(_.value){const ue=_.value.getRootNode();if(ue instanceof ShadowRoot&&ue.host)return ue.host;const be=_.value.closest?.("zcode-cms")||_.value.closest?.("zcode-editor");if(be)return be}const le=a.getCurrentInstance();if(le){const ue=le.vnode.el;if(ue instanceof HTMLElement){const be=ue.getRootNode();if(be instanceof ShadowRoot&&be.host)return be.host;const qe=ue.closest?.("zcode-cms")||ue.closest?.("zcode-editor");return qe||null}if(ue instanceof Node){const be=ue.getRootNode();if(be instanceof ShadowRoot&&be.host)return be.host}}return null}function Ps(le){return typeof le=="object"&&le!==null}function Ls(le){return Array.isArray(le)?le.filter(ue=>Ps(ue)).map(ue=>({path:typeof ue.path=="string"?ue.path:void 0,field:typeof ue.field=="string"?ue.field:void 0,message:typeof ue.message=="string"?ue.message:void 0,code:typeof ue.code=="string"?ue.code:void 0})):[]}function Go(le){if(!le){ae.value={};return}const ue={};for(const be of Q.value){const qe=typeof be?.path=="string"?be.path:null,Ze=typeof be?.field=="string"?be.field:null,vt=typeof be?.message=="string"?be.message:null;!Ze||!vt||qe&&qe!==le||(ue[Ze]=vt)}ae.value=ue}const $s=(le,ue)=>{ue==="common"?m.images.common.push(le):ue==="individual"?m.images.individual.push(le):m.images.special.push(le)},Vs=le=>{oc(le,m.page).forEach(Ze=>{Object.keys(Ze.component).forEach(vt=>{vt.includes("image")&&Ze.component[vt]===le&&(Ze.component[vt]="")})});const be=m.images.common.findIndex(Ze=>Ze.id===le);be!==-1&&m.images.common.splice(be,1);const qe=m.images.individual.findIndex(Ze=>Ze.id===le);qe!==-1&&m.images.individual.splice(qe,1)};function Bs(le){const ue=le.detail;if(!Ps(ue))return;const be=ue;if(be.ok===!0){Z.value.visible=!1,Z.value.message="",Q.value=[],ae.value={};return}if(be.ok!==!1)return;const qe=Ls(be.errors);Q.value=qe;const Ze=qe.length,vt=typeof qe[0]?.message=="string"&&qe[0].message?qe[0].message:null;Z.value.visible=!0,Z.value.requestId=typeof be.requestId=="string"?be.requestId:void 0,Z.value.target=typeof be.target=="string"?be.target:void 0,Z.value.message=vt?t("editor.saveFailedWithMessage",{count:Ze,message:vt}):t("editor.saveFailedWithCount",{count:Ze}),Go(F.value||null)}a.onMounted(()=>{y(),a.nextTick(()=>{fn(),u.value&&Mn(),yt(),An("zcode-dom-updated",{})});const le=pn();le&&le.addEventListener("save-result",Bs)}),a.onUnmounted(()=>{qr(),Gr();const le=pn();le&&le.removeEventListener("save-result",Bs)}),a.watch(()=>F.value,le=>{Go(le||null)}),a.watch([()=>o.page,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial],()=>{y()}),a.watch(m,()=>{a.nextTick(()=>{fn(),An("zcode-dom-updated",{})})},{deep:!0}),a.watch([r,b],([le,ue])=>{le==="manage"&&ue?a.nextTick(()=>{fn(),u.value&&Mn(),yt(),An("zcode-dom-updated",{})}):Gr()}),a.watch(k,()=>{a.nextTick(()=>{An("zcode-dom-updated",{})})}),a.watch(d,le=>{fi({devRightPadding:le})}),a.watch(T,le=>{r.value==="manage"&&fi({allowDynamicContentInteraction:le}),O.value=le,a.nextTick(()=>{fn(),yt(),An("zcode-dom-updated",{})})}),a.watch(u,le=>{fi({enableContextMenu:le}),le?a.nextTick(()=>{Mn()}):Gr()}),a.watch(f,le=>{fi({showSaveConfirm:le})});function qt(){if(!f.value){hn();return}h.value=!0}function hn(){const le=Qe();An("save-request",{requestId:le,source:"cms",targets:["page","images-common","images-individual"],timestamp:Date.now()})}function Fs(){h.value=!1,hn()}function Kr(){h.value=!1}return e({getData:v,setData:x,validateData:MN,cmsData:m,currentMode:k,switchMode:W,allowDynamicContentInteraction:T,devRightPadding:d,devRightPaddingValue:p,settingsPanelOpen:i}),(le,ue)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"containerRef",ref:_,class:a.normalizeClass(["zcode-cms-container",{"zcode-dev-padding":d.value&&He.value}])},[a.createVNode($c,{"current-mode":a.unref(k),"view-mode":r.value,"allow-dynamic-content-interaction":T.value,onSwitchMode:a.unref(W),onSwitchViewMode:ue[0]||(ue[0]=be=>r.value=be),onOpenSettings:ue[1]||(ue[1]=be=>i.value=!0)},null,8,["current-mode","view-mode","allow-dynamic-content-interaction","onSwitchMode"]),Z.value.visible?(a.openBlock(),a.createElementBlock("div",AN,[a.createElementVNode("div",IN,a.toDisplayString(Z.value.message),1),a.createElementVNode("button",{class:"zcode-save-banner-close","aria-label":le.$t("common.close"),onClick:ue[2]||(ue[2]=be=>Z.value.visible=!1)}," × ",8,_N)])):a.createCommentVNode("",!0),r.value==="manage"?(a.openBlock(),a.createElementBlock("div",ON,[a.createElementVNode("button",{class:"zcode-save-btn",onClick:qt},[a.createVNode(a.unref(yc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(le.$t("common.save")),1)])])):a.createCommentVNode("",!0),r.value==="preview"?(a.openBlock(),a.createBlock(ta,{key:2,"cms-data":a.unref(m),"allow-dynamic-content-interaction":!0},null,8,["cms-data"])):a.createCommentVNode("",!0),r.value==="manage"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:3},[a.createVNode(Ec,{ref_key:"previewAreaRef",ref:A,"cms-data":a.unref(m),"full-page-html":a.unref(M),"on-add-click":a.unref(N),"allow-dynamic-content-interaction":T.value},null,8,["cms-data","full-page-html","on-add-click","allow-dynamic-content-interaction"]),a.createVNode(pC,{"editing-component":a.unref(H),"editing-available-fields":a.unref(L),"field-errors":ae.value,"current-mode":a.unref(k),"can-select-parent":a.unref(ce),"images-common":a.unref(m).images.common,"images-individual":a.unref(m).images.individual,"images-special":a.unref(m).images.special,onClose:a.unref(K),onSelectParent:a.unref(ve),onSaveField:Y,onAddImage:$s,onDeleteImage:Vs},null,8,["editing-component","editing-available-fields","field-errors","current-mode","can-select-parent","images-common","images-individual","images-special","onClose","onSelectParent"]),a.createVNode(wC,{"delete-confirm-component":a.unref(U),"current-mode":a.unref(k),"can-select-parent":a.unref(ce),onConfirm:a.unref(Ve),onCancel:a.unref(j),onSelectParent:a.unref(ve)},null,8,["delete-confirm-component","current-mode","can-select-parent","onConfirm","onCancel","onSelectParent"]),a.createVNode(AC,{"reorder-source-path":a.unref(G),"current-mode":a.unref(k),"can-select-parent":a.unref(ce),onCancel:a.unref(ye),onSelectParent:a.unref(ve)},null,8,["reorder-source-path","current-mode","can-select-parent","onCancel","onSelectParent"]),a.createVNode(mN,{"add-target-path":a.unref(J),"add-part-category":a.unref(Ne),"add-type-tab":a.unref(Pe),"add-selected-part":a.unref(de),"add-selected-type":a.unref(ee),"has-special-parts":a.unref(S),"clicked-component":a.unref(we),"available-part-types":a.unref(P),config:a.unref(l),"grouped-parts-by-type":a.unref(V),"can-select-parent":a.unref(ce),"get-part-preview-html":a.unref(De),"get-clicked-component-preview-html":a.unref(Te),"keep-adding":a.unref(C),onCancel:a.unref(I),onSelectParent:a.unref(ve),onCategoryTabClick:a.unref($),onTypeTabClick:a.unref(ne),onSelectPart:a.unref(me),onConfirmAdd:a.unref(z),onUpdateKeepAdding:ue[3]||(ue[3]=be=>C.value=be)},null,8,["add-target-path","add-part-category","add-type-tab","add-selected-part","add-selected-type","has-special-parts","clicked-component","available-part-types","config","grouped-parts-by-type","can-select-parent","get-part-preview-html","get-clicked-component-preview-html","keep-adding","onCancel","onSelectParent","onCategoryTabClick","onTypeTabClick","onSelectPart","onConfirmAdd"])],64)):a.createCommentVNode("",!0),a.createVNode(Yd,{"is-open":i.value,"view-mode":r.value,mode:"toolbar","allow-dynamic-content-interaction":T.value,"dev-right-padding":p.value,"enable-context-menu":u.value,"show-save-confirm":f.value,onClose:ue[4]||(ue[4]=be=>i.value=!1),onToggleDynamicContent:ue[5]||(ue[5]=be=>T.value=be),onToggleDevPadding:ue[6]||(ue[6]=be=>d.value=be),onToggleContextMenu:ue[7]||(ue[7]=be=>u.value=be),onToggleSaveConfirm:ue[8]||(ue[8]=be=>f.value=be)},null,8,["is-open","view-mode","allow-dynamic-content-interaction","dev-right-padding","enable-context-menu","show-save-confirm"]),a.createVNode(gN,{"is-visible":a.unref(ac),position:a.unref(Wo),"current-mode":a.unref(k),onSelectMode:a.unref(qo),onClose:a.unref(lc)},null,8,["is-visible","position","current-mode","onSelectMode","onClose"]),h.value?(a.openBlock(),a.createElementBlock("div",{key:4,class:"zcode-save-confirm-dialog-overlay",onClick:a.withModifiers(Kr,["self"])},[a.createElementVNode("div",DN,[a.createElementVNode("div",RN,[a.createElementVNode("div",PN,a.toDisplayString(le.$t("saveConfirm.title")),1)]),a.createElementVNode("div",LN,[a.createElementVNode("p",null,a.toDisplayString(le.$t("saveConfirm.simpleMessage")),1)]),a.createElementVNode("div",$N,[a.createElementVNode("button",{class:"zcode-btn-secondary",onClick:Kr},a.toDisplayString(le.$t("common.cancel")),1),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:Fs},a.toDisplayString(le.$t("saveConfirm.saveButton")),1)])])])):a.createCommentVNode("",!0)],2))}}),Fh=":root{--zcode-color-edit: #3b82f6;--zcode-color-add: #10b981;--zcode-color-reorder: #f59e0b;--zcode-color-delete: #ef4444;--zcode-color-edit-hover: #2563eb;--zcode-color-edit-bg: #eff6ff;--zcode-color-edit-bg-active: #dbeafe;--zcode-color-edit-border-hover: #93c5fd;--zcode-color-add-hover: #059669;--zcode-color-add-bg: #ecfdf5;--zcode-color-add-bg-active: #d1fae5;--zcode-color-add-border-hover: #6ee7b7;--zcode-color-reorder-bg: #fffbeb;--zcode-color-reorder-bg-active: #fef3c7;--zcode-color-reorder-border-hover: #fcd34d;--zcode-color-delete-hover: #dc2626;--zcode-color-delete-bg: #fef2f2;--zcode-color-delete-bg-active: #fee2e2;--zcode-color-delete-border-hover: #fca5a5}[class*=zcode-]{box-sizing:border-box}[class*=zcode-]:before,[class*=zcode-]:after{box-sizing:border-box}.zcode-empty-state{text-align:center;padding:60px 20px;color:#666}.zcode-empty-state-btn{margin-top:20px;padding:10px 20px;font-size:16px;background:#42b983;color:#fff;border:none;border-radius:4px;cursor:pointer;transition:background .2s}.zcode-empty-state-btn:hover{background:#359268}.zcode-edit-panel,.zcode-add-panel,.zcode-reorder-panel,.zcode-delete-panel{position:fixed;top:0;right:0;width:375px;height:100vh;background:#fff;box-shadow:-2px 0 8px #0000001a;overflow:hidden;display:flex;flex-direction:column;z-index:1002}.zcode-edit-panel-header,.zcode-add-panel-header,.zcode-reorder-panel-header,.zcode-delete-panel-header{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-shrink:0}.zcode-panel-header-title{margin:0;font-size:14px;font-weight:600;color:#1f2937}.zcode-edit-panel-header .zcode-panel-header-title{color:var(--zcode-color-edit)}.zcode-add-panel-header .zcode-panel-header-title{color:var(--zcode-color-add)}.zcode-reorder-panel-header .zcode-panel-header-title{color:var(--zcode-color-reorder)}.zcode-delete-panel-header .zcode-panel-header-title{color:var(--zcode-color-delete)}.zcode-close-btn{background:none;border:none;cursor:pointer;color:#6b7280;padding:4px 8px;line-height:1;display:flex;align-items:center;justify-content:center}.zcode-close-btn:hover{color:#1f2937}.zcode-edit-fields{padding:16px;font-size:14px;color:#6b7280;overflow-y:auto;flex:1}.zcode-add-panel-content{overflow-y:auto;flex:1}.zcode-edit-fields-text{margin:8px 0}.zcode-component-developer{border:1px dashed #ccc;padding:10px}.zcode-error-message{padding:20px;background:#fff3cd;border:1px solid #ffc107;border-radius:4px;color:#856404}.zcode-for-item{margin-bottom:10px}.zcode-field-editor{padding:16px;overflow-y:auto}.zcode-field-item-title{margin:0 0 15px;color:#2c3e50;font-size:16px;border-bottom:1px solid #eee;padding-bottom:8px}.zcode-field-editor-label{display:block;margin-bottom:8px;font-weight:500;color:#555}.zcode-text-editor{margin-bottom:20px}.zcode-text-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;transition:border-color .2s;box-sizing:border-box}.zcode-text-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-field-error{border-color:#ef4444!important;background-color:#fef2f2}.zcode-field-error-message{margin-top:6px;font-size:12px;color:#ef4444;line-height:1.4}.zcode-field-counter{margin-top:6px;font-size:12px;color:#6b7280;text-align:right}.zcode-text-input:disabled,.zcode-textarea:disabled{opacity:.7;cursor:not-allowed}.zcode-text-input[readonly],.zcode-textarea[readonly]{background-color:#f3f4f6;cursor:default}.zcode-radio-editor{margin-top:12px;margin-bottom:12px}.zcode-radio-group{display:flex;flex-direction:column;gap:6px}.zcode-radio-item{display:flex;align-items:center;gap:6px;cursor:pointer;margin-bottom:0;font-weight:400;color:inherit}.zcode-radio-item input[type=radio]{margin:0;cursor:pointer}.zcode-radio-item input[type=radio]:focus{outline:2px solid var(--zcode-color-edit);outline-offset:2px}.zcode-radio-item-label{font-size:14px;color:#4b5563}.zcode-checkbox-editor{margin-top:12px;margin-bottom:12px}.zcode-checkbox-item{display:flex;align-items:center;gap:6px;cursor:pointer;margin-bottom:0;font-weight:400;color:inherit}.zcode-checkbox-item input[type=checkbox]{margin:0;cursor:pointer}.zcode-checkbox-item input[type=checkbox]:focus{outline:2px solid var(--zcode-color-edit);outline-offset:2px}.zcode-checkbox-item-label{font-size:14px;color:#4b5563}.zcode-edit-actions{display:flex;gap:10px;margin-top:20px}.zcode-save-btn{flex:1;background:var(--zcode-color-edit);color:#fff;border:none;padding:10px 16px;border-radius:4px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-save-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-cancel-btn{flex:1;background:#f8f9fa;color:#6c757d;border:1px solid #dee2e6;padding:10px 16px;border-radius:4px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-cancel-btn:hover{background:#e9ecef}[data-zcode-id],[data-zcode-slot-path]{transition:outline .2s;cursor:pointer;position:relative}[data-zcode-id].zcode-outline-active-edit,[data-zcode-id].zcode-outline-active-add,[data-zcode-id].zcode-outline-active-reorder,[data-zcode-id].zcode-outline-active-delete,[data-zcode-slot-path].zcode-outline-active-edit,[data-zcode-slot-path].zcode-outline-active-add,[data-zcode-slot-path].zcode-outline-active-reorder,[data-zcode-slot-path].zcode-outline-active-delete{outline-style:solid;animation:zcode-outline-pulse-edit 1.5s ease-in-out infinite}[data-zcode-id].zcode-outline-active-edit{animation-name:zcode-outline-pulse-edit}[data-zcode-id].zcode-outline-active-add{animation-name:zcode-outline-pulse-add}[data-zcode-id].zcode-outline-active-reorder{animation-name:zcode-outline-pulse-reorder}[data-zcode-id].zcode-outline-active-delete{animation-name:zcode-outline-pulse-delete}[data-zcode-slot-path].zcode-outline-active-edit{animation-name:zcode-outline-pulse-edit}[data-zcode-slot-path].zcode-outline-active-add{animation-name:zcode-outline-pulse-add}[data-zcode-slot-path].zcode-outline-active-reorder{animation-name:zcode-outline-pulse-reorder}[data-zcode-slot-path].zcode-outline-active-delete{animation-name:zcode-outline-pulse-delete}@keyframes zcode-outline-pulse-edit{0%{outline-width:4px;outline-offset:2px;outline-color:#3cd7f6}25%{outline-width:4px;outline-offset:2px;outline-color:#3c83f6}50%{outline-width:4px;outline-offset:2px;outline-color:#493cf6}75%{outline-width:4px;outline-offset:2px;outline-color:#3c83f6}to{outline-width:4px;outline-offset:2px;outline-color:#3cd7f6}}@keyframes zcode-outline-pulse-add{0%{outline-width:4px;outline-offset:2px;outline-color:#0fb82b}25%{outline-width:4px;outline-offset:2px;outline-color:#0fb880}50%{outline-width:4px;outline-offset:2px;outline-color:#0f9cb8}75%{outline-width:4px;outline-offset:2px;outline-color:#0fb880}to{outline-width:4px;outline-offset:2px;outline-color:#0fb82b}}@keyframes zcode-outline-pulse-reorder{0%{outline-width:4px;outline-offset:2px;outline-color:#f5800a}25%{outline-width:4px;outline-offset:2px;outline-color:#f59f0a}50%{outline-width:4px;outline-offset:2px;outline-color:#f5be0a}75%{outline-width:4px;outline-offset:2px;outline-color:#f59f0a}to{outline-width:4px;outline-offset:2px;outline-color:#f5800a}}@keyframes zcode-outline-pulse-delete{0%{outline-width:4px;outline-offset:2px;outline-color:#ef437c}25%{outline-width:4px;outline-offset:2px;outline-color:#ef4343}50%{outline-width:4px;outline-offset:2px;outline-color:#ef7c43}75%{outline-width:4px;outline-offset:2px;outline-color:#ef4343}to{outline-width:4px;outline-offset:2px;outline-color:#ef437c}}.zcode-view-mode-toggle{display:flex;gap:8px}.zcode-view-mode-btn{display:flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid #e5e7eb;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s;font-size:14px;font-weight:500}.zcode-dev-header{display:flex;align-items:center;justify-content:flex-start;padding:8px 16px;background:#f9fafb;border-bottom:1px solid #e5e7eb}.zcode-toolbar{position:sticky;top:0;display:flex;align-items:center;gap:8px;width:fit-content;background:#fffc;margin-bottom:10px;padding:8px 16px;border-radius:8px;box-shadow:0 2px 8px #0000001a;z-index:1001}.zcode-save-banner{position:sticky;top:54px;display:flex;align-items:flex-start;justify-content:space-between;gap:12px;width:min(720px,calc(100% - 32px));margin:0 0 10px;padding:10px 12px;border-radius:10px;border:1px solid transparent;z-index:1001;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.zcode-save-banner--error{border-color:#fecaca;background:#fef2f2e6;color:#991b1b}.zcode-save-banner-text{font-size:13px;line-height:1.4;word-break:break-word}.zcode-save-banner-close{flex:0 0 auto;width:28px;height:28px;border-radius:8px;border:1px solid rgba(0,0,0,.06);background:#fffc;color:inherit;cursor:pointer}.zcode-save-banner-close:hover{background:#fff}.zcode-toolbar-separator{width:1px;height:24px;background-color:#e5e7eb;margin:0 4px}.zcode-dynamic-content-toggle-label{display:flex;align-items:center;gap:6px;padding:4px 8px;border-radius:4px;cursor:pointer;font-size:14px;color:#374151;-webkit-user-select:none;user-select:none}.zcode-dynamic-content-toggle-label:hover{background-color:#f3f4f6}.zcode-dynamic-content-toggle-checkbox{margin:0;cursor:pointer}.zcode-dev-container .zcode-cms-container .zcode-toolbar{display:none}.zcode-template-tabs{display:inline-flex;gap:6px;margin-right:8px}.zcode-template-tab{padding:6px 10px;border:1px solid #d1d5db;border-radius:6px;background:#fff;font-size:12px;color:#374151;cursor:pointer}.zcode-template-tab.active{background:#111827;border-color:#111827;color:#fff;font-weight:600}.zcode-css-inline-note{flex-shrink:0;margin:0 0 12px;padding:10px 12px;border:1px solid #fde68a;background:#fffbeb;border-radius:8px;color:#92400e;font-size:12px;line-height:1.6}.zcode-part-editor-preview-tab{border:1px solid #e5e7eb;border-radius:8px;background:#fff;padding:16px;min-height:240px;cursor:pointer}.zcode-part-editor-preview-hint{margin-top:10px;font-size:12px;color:#6b7280}.zcode-part-editor-pane{border:1px solid #e5e7eb;border-radius:8px;background:#fff;overflow:hidden;display:flex;flex-direction:column;min-height:0;min-width:0;flex:1}.zcode-part-editor-pane-header{padding:10px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;align-items:center;justify-content:space-between;gap:10px}.zcode-part-editor-pane-header-actions{display:flex;align-items:center;gap:8px;min-width:0}.zcode-css-warning-compact{display:flex;align-items:center;gap:6px;padding:6px 10px;background:#fffbeb;border:1px solid #fde68a;border-radius:6px;font-size:12px;color:#92400e}.zcode-css-warning-compact-icon{flex-shrink:0;color:#f59e0b}.zcode-css-warning-compact-text{white-space:nowrap;font-weight:500}.zcode-part-editor-pane-body{flex:1;min-height:0;overflow:hidden;padding:12px;display:flex;flex-direction:column}.zcode-part-editor-slots-toggle{width:100%;border:1px solid #e5e7eb;border-radius:8px;background:#f9fafb;padding:10px 12px;display:flex;align-items:center;justify-content:space-between;cursor:pointer;font-size:13px;font-weight:600;color:#374151}.zcode-part-editor-slots-toggle:hover{background:#f3f4f6}.zcode-part-editor-slots-toggle-icon{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;border-radius:999px;border:1px solid #d1d5db;background:#fff;color:#6b7280;font-size:16px;font-weight:400}.zcode-part-editor-slots-toggle-icon.open{transform:rotate(45deg)}.zcode-part-editor-slots-body{margin-top:10px}.zcode-part-editor-topbar{margin-bottom:16px}.zcode-part-editor-topfields{display:grid;grid-template-columns:1fr 1fr;gap:12px}.zcode-part-editor-slots-top{margin-top:12px}.zcode-part-editor-slots-bottom{margin-top:24px;padding-top:24px;border-top:1px solid #e5e7eb}.zcode-save-controls-fixed{position:fixed;bottom:20px;left:20px;display:flex;align-items:center;gap:8px;padding:12px 20px;background:#fffc;border-radius:8px;box-shadow:0 4px 12px #00000026;z-index:1000}.zcode-save-btn{display:flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid var(--zcode-color-edit);border-radius:6px;background:var(--zcode-color-edit);color:#fff;font-size:14px;cursor:pointer;transition:all .2s}.zcode-save-btn:hover{background:var(--zcode-color-edit-hover);border-color:var(--zcode-color-edit-hover)}.zcode-mode-btn{padding:8px 16px;border:2px solid #ddd;border-radius:6px;background:#fff;cursor:pointer;font-weight:500;transition:all .2s;font-size:14px;display:flex;align-items:center;gap:6px}.zcode-mode-btn:hover{background:#f3f4f6}.zcode-mode-edit:hover{color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg);border-color:var(--zcode-color-edit-border-hover)}.zcode-mode-reorder:hover{color:var(--zcode-color-reorder);background:var(--zcode-color-reorder-bg);border-color:var(--zcode-color-reorder-border-hover)}.zcode-mode-add:hover{color:var(--zcode-color-add);background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-border-hover)}.zcode-mode-delete:hover{color:var(--zcode-color-delete);background:var(--zcode-color-delete-bg);border-color:var(--zcode-color-delete-border-hover)}.zcode-mode-btn.active{border-color:currentColor;font-weight:600}.zcode-mode-edit.active{color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg-active);border-color:var(--zcode-color-edit)}.zcode-mode-reorder.active{color:var(--zcode-color-reorder);background:var(--zcode-color-reorder-bg-active);border-color:var(--zcode-color-reorder)}.zcode-mode-add.active{color:var(--zcode-color-add);background:var(--zcode-color-add-bg-active);border-color:var(--zcode-color-add)}.zcode-mode-delete.active{color:var(--zcode-color-delete);background:var(--zcode-color-delete-bg-active);border-color:var(--zcode-color-delete)}.zcode-view-mode-btn{padding:8px 16px;border:2px solid #ddd;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s;font-size:14px;font-weight:500;display:flex;align-items:center;gap:6px}.zcode-view-mode-btn:hover{background:#f9fafb;border-color:#d1d5db;color:#374151}.zcode-view-mode-btn.active{background:#3b82f6;color:#fff;border-color:#3b82f6}.zcode-view-mode-btn.active:hover{background:#2563eb;border-color:#2563eb}.zcode-settings-btn{display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:2px solid #ddd;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s}.zcode-settings-btn:hover{background:#f9fafb;border-color:#d1d5db;color:#374151}.zcode-settings-panel-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000}.zcode-settings-panel{background:#fff;border-radius:8px;box-shadow:0 10px 25px #0003;width:90%;max-width:500px;max-height:80vh;overflow-y:auto}.zcode-settings-panel-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid #e5e7eb;gap:12px}.zcode-settings-panel-header-title{margin:0;font-size:18px;font-weight:600;color:#111827;flex:1}.zcode-settings-panel-header-actions{display:flex;align-items:center;gap:12px}.zcode-language-select{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;color:#374151;cursor:pointer;transition:border-color .2s}.zcode-language-select:hover{border-color:#9ca3af}.zcode-language-select:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.zcode-settings-panel-content{padding:20px}.zcode-setting-item{margin-bottom:24px}.zcode-setting-item:last-child{margin-bottom:0}.zcode-setting-label{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:#374151;cursor:pointer;-webkit-user-select:none;user-select:none}.zcode-setting-checkbox{width:18px;height:18px;cursor:pointer}.zcode-info-btn{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;margin-left:auto;background:none;border:none;color:#6b7280;cursor:pointer;border-radius:4px;transition:color .2s}.zcode-info-btn:hover{color:#374151}.zcode-setting-description{margin:8px 0 0 26px;font-size:13px;color:#6b7280;line-height:1.5}.zcode-setting-info{margin:0;padding:12px;background:#f3f4f6;border-radius:6px;font-size:13px}.zcode-delete-panel-content{padding:16px;flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:16px}.zcode-delete-warning{display:flex;align-items:flex-start;gap:12px;padding:12px;background:var(--zcode-color-delete-bg);border:1px solid var(--zcode-color-delete-border-hover);border-radius:6px;color:var(--zcode-color-delete)}.zcode-delete-warning svg{flex-shrink:0;margin-top:2px}.zcode-delete-warning p{margin:0;font-size:14px;font-weight:500;line-height:1.5}.zcode-delete-actions{display:flex;gap:8px;margin-top:16px}.zcode-btn-danger{flex:1;padding:10px;background:var(--zcode-color-delete);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:600;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-danger:hover{background:var(--zcode-color-delete-hover)}.zcode-btn-cancel{flex:1;padding:10px;background:#e5e7eb;color:#374151;border:none;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-cancel:hover{background:#d1d5db}.zcode-parent-selector{padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-parent-select-btn{width:100%;padding:8px 12px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-parent-select-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-reorder-panel-content{padding:16px;flex:1;overflow-y:auto}.zcode-reorder-panel-content-text{margin:8px 0;color:#374151}.zcode-reorder-source{font-family:monospace;font-size:12px;color:#1f2937}.zcode-field-item{margin-bottom:20px}.zcode-field-item-title{margin:0 0 8px;font-size:14px;color:#374151;font-weight:600}.zcode-group-tabs{display:flex;gap:4px;padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;flex-shrink:0;-webkit-overflow-scrolling:touch}.zcode-group-tab{padding:6px 12px;font-size:13px;font-weight:500;color:#6b7280;background:#fff;border:1px solid #d1d5db;border-radius:4px;cursor:pointer;transition:all .2s;display:flex;align-items:center;gap:4px}.zcode-group-tab:hover{background:#f3f4f6;border-color:#9ca3af;color:#374151}.zcode-group-tab.active{background:var(--zcode-color-edit);border-color:var(--zcode-color-edit);color:#fff}.zcode-group-tab.active:hover{background:var(--zcode-color-edit-hover);border-color:var(--zcode-color-edit-hover)}@media(max-width:768px){.zcode-edit-panel,.zcode-add-panel,.zcode-reorder-panel,.zcode-delete-panel{width:100%;height:auto;position:fixed;inset:auto 0 0;border-radius:12px 12px 0 0;max-height:60vh;box-shadow:0 -4px 12px #00000026;z-index:1002;animation:zcode-slide-in-up .3s ease-out}@keyframes zcode-slide-in-up{0%{transform:translateY(100%)}to{transform:translateY(0)}}.zcode-insert-position{width:100%;right:0}.zcode-edit-actions{flex-direction:column;gap:12px}.zcode-edit-actions-btn{padding:10px 16px;font-size:14px}.zcode-toolbar{top:0;left:10px;right:10px;flex-wrap:nowrap;padding:6px 8px;gap:4px;overflow-x:auto;-webkit-overflow-scrolling:touch}.zcode-toolbar-btn{width:32px;height:32px;padding:0}.zcode-toolbar-btn-text{display:none}.zcode-view-mode-btn,.zcode-mode-btn{width:32px;height:32px;padding:0;justify-content:center}.zcode-view-mode-btn span,.zcode-mode-btn span{display:none}.zcode-settings-btn{width:36px;height:36px}.zcode-delete-dialog-content{width:95%;padding:16px}.zcode-save-controls-fixed{bottom:20px;left:20px;padding:0;background:transparent;box-shadow:none}.zcode-save-btn{width:48px;height:48px;padding:0;border-radius:50%;box-shadow:0 4px 12px #00000040;display:flex;align-items:center;justify-content:center;gap:0}.zcode-save-btn span{display:none}.zcode-save-btn svg{width:20px;height:20px}.zcode-edit-panel-header,.zcode-add-panel-header,.zcode-reorder-panel-header,.zcode-delete-panel-header{padding:10px 12px}.zcode-edit-fields{padding:12px}.zcode-field-item{margin-bottom:20px}.zcode-text-input,.zcode-textarea,.zcode-select,select{font-size:16px;padding:8px 12px}.zcode-textarea{min-height:100px}.zcode-btn,.zcode-btn-primary,.zcode-btn-danger,.zcode-btn-cancel{padding:10px}.zcode-group-tab,.zcode-image-select-btn,.zcode-image-clear-btn,.zcode-parent-select-btn{padding:8px 12px}}.zcode-part-category-tabs{display:flex;gap:4px;padding:8px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-shrink:0}.zcode-category-tab{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:13px;font-weight:500;color:#6b7280;transition:all .2s}.zcode-category-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-category-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-type-tabs{display:flex;gap:4px;padding:8px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;flex-shrink:0;-webkit-overflow-scrolling:touch}.zcode-type-tab{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:12px;font-weight:500;color:#6b7280;transition:all .2s;white-space:nowrap}.zcode-type-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-type-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-part-list{flex:1;overflow-y:auto;padding:12px}.zcode-part-type-section{margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #e5e7eb}.zcode-part-type-section:last-child{border-bottom:none;margin-bottom:0}.zcode-type-section-title{font-size:14px;font-weight:600;color:#1f2937;margin:0 0 6px}.zcode-type-section-description{font-size:12px;color:#6b7280;margin:0 0 8px;line-height:1.5}.zcode-module-buttons{display:grid;grid-template-columns:1fr;gap:6px}.zcode-empty-parts{text-align:center;padding:40px 20px;color:#9ca3af}.zcode-empty-parts-text{margin:0;font-size:14px}.zcode-module-preview{border:2px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;transition:all .2s;overflow:hidden;display:flex;flex-direction:column}.zcode-module-preview:hover{border-color:#9ca3af;box-shadow:0 4px 6px #0000001a}.zcode-module-preview.active{border-color:var(--zcode-color-add);box-shadow:0 0 0 3px #10b9811a}.zcode-module-preview-label{padding:6px 10px;background:#f9fafb;border-bottom:1px solid #e5e7eb;font-size:11px;font-weight:600;color:#374151;text-align:center}.zcode-module-preview.active .zcode-module-preview-label{background:var(--zcode-color-add);color:#fff}.zcode-module-preview-header{display:flex;align-items:center;justify-content:space-between;padding:0;background:#f9fafb;border-bottom:1px solid #e5e7eb}.zcode-module-preview-header .zcode-module-preview-label{flex:1;padding:4px 8px;background:transparent;border-bottom:none;text-align:left}.zcode-module-preview-icon-btn{border:none;background:transparent;padding:0 6px 0 0;cursor:pointer;color:#6b7280;display:flex;align-items:center;justify-content:center}.zcode-module-preview-icon-btn:hover{color:#111827}.zcode-module-preview.active .zcode-module-preview-header{background:var(--zcode-color-add)}.zcode-module-preview.active .zcode-module-preview-header .zcode-module-preview-label{color:#fff}.zcode-module-preview.active .zcode-module-preview-icon-btn{color:#ecfeff}.zcode-module-preview-content{padding:0;flex:1;overflow:hidden;overflow-y:hidden}.zcode-module-preview-content *{max-width:100%}.zcode-copy-notice{display:flex;align-items:center;gap:8px;padding:8px 12px;background:#f0f9ff;border:1px solid #bae6fd;border-radius:4px;margin-bottom:12px}.zcode-copy-notice-icon{flex-shrink:0;color:#0ea5e9}.zcode-copy-notice-text{margin:0;font-size:13px;color:#075985}.zcode-insert-position{padding:12px 20px;border-top:1px solid #e5e7eb;background:#fff}.zcode-insert-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;gap:16px}.zcode-insert-position-title{margin:0;font-size:14px;font-weight:600;color:#374151;flex-shrink:0}.zcode-keep-adding-label-position{margin-top:0;flex-shrink:0;white-space:nowrap}.zcode-keep-adding-label{display:flex;align-items:center;gap:6px;font-size:14px;cursor:pointer;-webkit-user-select:none;user-select:none}.zcode-keep-adding-checkbox{width:16px;height:16px;cursor:pointer}.zcode-insert-buttons{display:flex;gap:8px}.zcode-insert-btn{flex:1;padding:12px 16px;border:2px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:14px;font-weight:600;color:#374151;transition:all .2s}.zcode-insert-btn:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-insert-before{border-color:var(--zcode-color-add);color:var(--zcode-color-add)}.zcode-insert-before:hover{background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-hover)}.zcode-insert-after{border-color:var(--zcode-color-add);color:var(--zcode-color-add)}.zcode-insert-after:hover{background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-hover)}.zcode-empty-slot{padding:20px;text-align:center;border:2px dashed #d1d5db;border-radius:8px;background:#f9fafb}.zcode-add-slot-btn{padding:8px 16px;background:var(--zcode-color-add);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-add-slot-btn:hover{background:var(--zcode-color-add-hover)}.zcode-add-btn{padding:10px 20px;font-size:16px;background:var(--zcode-color-add);color:#fff;border:none;border-radius:6px;cursor:pointer;transition:background .2s;font-weight:500}.zcode-add-btn:hover{background:var(--zcode-color-add-hover)}@media(max-width:768px){.zcode-part-category-tabs,.zcode-type-tabs{padding:8px 12px}.zcode-part-list,.zcode-part-item{padding:12px}}.zcode-rich-text-editor{border:1px solid #d1d5db;border-radius:6px;overflow:hidden;background:#fff}.zcode-rich-text-toolbar{display:flex;align-items:center;gap:4px;padding:8px;border-bottom:1px solid #d1d5db;background:#f9fafb;flex-wrap:wrap}.zcode-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid #d1d5db;border-radius:4px;background:#fff;cursor:pointer;font-size:14px;transition:all .2s;padding:0}.zcode-toolbar-btn:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-toolbar-btn.is-active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit)}.zcode-toolbar-divider{width:1px;height:24px;background:#d1d5db;margin:0 4px}.zcode-rich-text-editor-content{min-height:200px;max-height:400px;overflow-y:auto;padding:12px}.zcode-tiptap-editor{outline:none;white-space:pre-wrap}.zcode-tiptap-editor p.is-editor-empty:first-child:before{content:attr(data-placeholder);float:left;color:#9ca3af;pointer-events:none;height:0}.zcode-tiptap-editor p{margin:.5em 0}.zcode-tiptap-editor ul,.zcode-tiptap-editor ol{padding-left:1.5em;margin:.5em 0}.zcode-tiptap-editor ul{list-style-type:disc}.zcode-tiptap-editor ol{list-style-type:decimal}.zcode-rich-text-editor-content ul{list-style-type:disc}.zcode-rich-text-editor-content ol{list-style-type:decimal}.zcode-rich-text-editor-content ul,.zcode-rich-text-editor-content ol{padding-left:1.5em;margin:.5em 0}.zcode-tiptap-editor a.zcode-link{color:var(--zcode-color-edit);text-decoration:underline}.zcode-tiptap-editor strong{font-weight:600}.zcode-tiptap-editor em{font-style:italic}.zcode-tiptap-editor s{text-decoration:line-through}.zcode-image-editor{margin-bottom:16px}.zcode-image-editor-input{width:100%;margin-bottom:8px}.zcode-image-editor-buttons{display:flex;gap:8px;margin-bottom:12px}.zcode-image-select-btn{flex:1;padding:8px 16px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-image-select-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-image-clear-btn{flex:1;padding:8px 12px;background:#ef4444;color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-image-clear-btn:hover{background:#dc2626}.zcode-image-preview{margin-top:12px;border:1px solid #d1d5db;border-radius:6px;padding:8px;background:#f9fafb;display:flex;justify-content:center;align-items:center}.zcode-image-preview-img{max-width:100%;max-height:200px;object-fit:contain;border-radius:4px}.zcode-image-modal{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000;padding:20px}.zcode-image-modal-content{background:#fff;border-radius:12px;box-shadow:0 4px 16px #0003;max-width:800px;width:90%;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-image-modal-content[data-edit-mode]{max-width:500px;width:100%;border-radius:8px;box-shadow:0 10px 40px #0003}.zcode-image-modal-header{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid #e5e7eb}.zcode-image-modal-header-title{margin:0;font-size:20px;font-weight:600;color:#1f2937}.zcode-image-current{padding:16px 24px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-image-current-title{margin:0 0 12px;font-size:14px;font-weight:600;color:#6b7280}.zcode-image-current-item{display:flex;align-items:center;gap:12px}.zcode-image-current-item-img{width:60px;height:60px;object-fit:cover;border-radius:6px;border:1px solid #d1d5db}.zcode-image-current-name{font-size:14px;color:#374151;font-weight:500}.zcode-image-tabs{display:flex;border-bottom:1px solid #e5e7eb;padding:0 24px}.zcode-image-tab{padding:12px 20px;background:none;border:none;border-bottom:2px solid transparent;cursor:pointer;font-size:14px;font-weight:500;color:#6b7280;transition:all .2s}.zcode-image-tab:hover{color:#1f2937;background:#f9fafb}.zcode-image-tab.active{color:var(--zcode-color-edit);border-bottom-color:var(--zcode-color-edit)}.zcode-image-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:16px;padding:24px;overflow-y:auto;flex:1}.zcode-image-name{padding:8px;font-size:12px;color:#374151;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.zcode-image-add{padding:16px 24px;border-top:1px solid #e5e7eb;background:#f9fafb}.zcode-image-add-btn{width:100%;padding:10px 16px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:8px}.zcode-image-add-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-image-modal-actions{display:flex;gap:8px;padding:16px 24px;border-top:1px solid #e5e7eb;background:#fff}.zcode-image-modal-actions-btn{flex:1}.zcode-dev-container{width:100%;min-height:100vh;display:flex;flex-direction:column;position:relative}.zcode-cms-container.zcode-dev-padding{padding-right:375px}@media(max-width:768px){.zcode-cms-container.zcode-dev-padding{padding-right:0;padding-bottom:60vh}.zcode-dev-header{flex-direction:column;align-items:stretch;padding:0;gap:8px;background:none;border-bottom:none;box-shadow:none}.zcode-dev-tab{border-bottom:1px solid #e5e7eb}}.zcode-dev-container>zcode-cms{display:block}.zcode-loading-message{padding:40px;text-align:center;color:#6b7280}.zcode-loading-message-text{margin:8px 0;font-size:14px}.zcode-dev-tabs{display:flex;gap:8px;padding:0;flex-shrink:0;width:100%;box-sizing:border-box;background:#f9fafb;justify-content:space-between}.zcode-dev-tab{padding:10px 20px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-weight:500;font-size:14px;transition:background .15s ease,border-color .15s ease,color .15s ease,box-shadow .15s ease;display:flex;align-items:center;gap:6px;color:#6b7280;flex:1 1 0;justify-content:center;text-align:center}.zcode-dev-settings-btn{flex:0 0 auto;padding:6px;min-width:32px;justify-content:center;border-radius:4px;font-size:12px}.zcode-dev-tab:hover{background:#f3f4f6;border-color:#9ca3af;box-shadow:0 1px 3px #0f172a14}.zcode-dev-tab.active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit);font-weight:600;box-shadow:0 2px 6px #2563eb40}@media(max-width:768px){.zcode-dev-tabs{display:grid;grid-template-columns:repeat(2,1fr);gap:6px;background:transparent}.zcode-dev-tab{width:auto;flex:none;justify-content:flex-start;text-align:left;padding:10px 12px;font-size:13px}.zcode-dev-tab.zcode-dev-settings-btn{display:none}}.zcode-dev-settings-btn-fixed{display:none}@media(max-width:768px){.zcode-dev-settings-btn-fixed{position:fixed;bottom:20px;right:20px;width:48px;height:48px;padding:0;border:2px solid #d1d5db;border-radius:50%;background:#fff;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 12px #00000040;z-index:1000;transition:all .2s ease}.zcode-dev-settings-btn-fixed:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-dev-settings-btn-fixed svg{width:20px;height:20px}}.zcode-parts-manager{width:100%;background:#fff}.zcode-parts-manager-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center}.zcode-parts-manager-header-title{margin:0;font-size:18px;color:#1f2937}.zcode-parts-category-tabs,.zcode-images-category-tabs{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-parts-add-wrapper,.zcode-images-add-wrapper{display:flex;align-items:center;flex-shrink:0}.zcode-parts-category-tab-group,.zcode-images-category-tab-group{display:flex;gap:4px}.zcode-parts-manager-content{display:flex;flex-direction:column}.zcode-parts-list-header{padding:16px;border-bottom:1px solid #e5e7eb;display:flex;justify-content:space-between;align-items:center;background:#fff}.zcode-parts-list-header-title{margin:0;font-size:14px;font-weight:600;color:#1f2937}.zcode-parts-items{padding:16px}.zcode-part-item{padding:16px;border:1px solid #e5e7eb;border-radius:8px;cursor:pointer;transition:all .2s;background:#fff;height:100%;display:flex;flex-direction:column;position:relative}.zcode-part-item:hover{border-color:#d1d5db;box-shadow:0 2px 8px #0000001a}.zcode-part-item.zcode-reorder-source{border-color:var(--zcode-color-reorder);background:#f59e0b05;box-shadow:0 0 0 1px #f59e0b1a}.zcode-reorder-source-indicator{position:absolute;top:-10px;right:10px;background:var(--zcode-color-reorder);color:#fff;padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600;z-index:10}.zcode-part-item-add{border:2px dashed #d1d5db;background:#f9fafb;display:flex;align-items:center;justify-content:center;min-height:120px;cursor:pointer}.zcode-part-item-add:hover{border-color:var(--zcode-color-add);background:var(--zcode-color-add-bg);transform:translateY(-2px)}.zcode-part-item-add-content{display:flex;flex-direction:column;align-items:center;gap:8px;color:#6b7280;font-size:14px;font-weight:500}.zcode-part-item-add:hover .zcode-part-item-add-content{color:var(--zcode-color-add)}.zcode-part-item-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.zcode-part-item-actions{display:flex;gap:4px;align-items:center}.zcode-action-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-action-btn:hover{background:#e5e7eb;color:#374151}.zcode-action-btn.active{background:var(--zcode-color-reorder);color:#fff}.zcode-action-btn.zcode-delete-btn:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-part-duplicate-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-part-duplicate-btn:hover{background:var(--zcode-color-add-bg);color:var(--zcode-color-add)}.zcode-part-type{font-weight:600;font-size:14px;color:#1f2937}.zcode-part-actions{display:flex;gap:4px}.zcode-part-edit-btn,.zcode-part-delete-btn,.zcode-module-delete-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-part-edit-btn:hover{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit)}.zcode-part-delete-btn:hover,.zcode-module-delete-btn:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-part-description{font-size:13px;color:#6b7280;margin-bottom:4px}.zcode-description-empty{color:#9ca3af;font-style:italic}.zcode-part-modules{font-size:12px;color:#9ca3af}.zcode-part-type-group{margin-bottom:24px}.zcode-part-type-title{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:16px;font-weight:600;color:#1f2937;margin:0 0 12px;padding-bottom:8px;border-bottom:2px solid #e5e7eb}.zcode-part-type-actions{display:flex;align-items:center;gap:4px}.zcode-part-type-edit-btn{padding:4px 8px;border:1px solid #e5e7eb;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;transition:all .2s}.zcode-part-type-edit-btn:hover{background:var(--zcode-color-edit-bg);border-color:var(--zcode-color-edit-border-hover);color:var(--zcode-color-edit)}.zcode-part-type-items{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}.zcode-part-preview{margin-top:12px;padding:8px;border:1px solid #e5e7eb;border-radius:6px;background:#f9fafb;max-height:150px;overflow:hidden;flex:1;min-height:0}.zcode-part-preview-content{font-size:11px;line-height:1.4;pointer-events:none;transform:scale(.75);transform-origin:top left;width:133.33%}.zcode-required{color:#ef4444;margin-left:2px}.zcode-part-modal{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000;padding:20px}.zcode-part-modal-content{background:#fff;border-radius:8px;box-shadow:0 10px 40px #0003;width:100%;max-width:95vw;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-part-editor{display:flex;flex-direction:column;overflow:hidden;height:100%}.zcode-part-editor-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-part-editor-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-part-editor-form{flex:1;overflow-y:auto;padding:24px 24px 80px}.zcode-part-editor-main{display:grid;grid-template-columns:1fr 1fr;gap:24px;align-items:stretch;min-height:0}.zcode-part-editor-fields{display:flex;flex-direction:column;gap:16px}.zcode-part-editor-preview{border:1px solid #e5e7eb;border-radius:8px;padding:16px;background:#f9fafb;position:sticky;top:0;max-height:calc(90vh - 200px);display:flex;flex-direction:column}.zcode-part-editor-preview-title{margin:0 0 12px;font-size:14px;font-weight:600;color:#1f2937}.zcode-preview-module-selector{margin-bottom:12px}.zcode-select-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;cursor:pointer}.zcode-select-input:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-editing-preview-content{flex:1;overflow-y:auto;padding:12px;background:#fff;border-radius:6px;min-height:200px;transform:scale(.9);transform-origin:top left;width:111.11%}.zcode-preview-empty{flex:1;display:flex;align-items:center;justify-content:center;color:#9ca3af;font-size:14px}.zcode-preview-modal{position:fixed;inset:0;background:#000c;display:flex;align-items:center;justify-content:center;z-index:3000;padding:20px}.zcode-preview-modal-content{background:#fff;border-radius:8px;width:90%;max-width:1200px;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-preview-modal-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-preview-modal-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-preview-modal-body{padding:24px;overflow-y:auto;flex:1}.zcode-help-modal-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:10000;padding:20px}.zcode-help-modal{background:#fff;border-radius:8px;width:90%;max-width:800px;max-height:80vh;overflow:auto;box-shadow:0 20px 25px -5px #0000001a}.zcode-help-modal-header{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid #e5e7eb;background:#f9fafb;position:sticky;top:0;z-index:1}.zcode-help-modal-header-title{margin:0;font-size:18px;font-weight:600;color:#1f2937;display:flex;align-items:center;gap:8px}.zcode-css-warning-modal-title-icon{color:#f59e0b;flex-shrink:0}.zcode-help-modal-body{padding:24px}.zcode-help-table{width:100%;border-collapse:collapse;margin-bottom:24px}.zcode-help-table-cell{padding:14px 16px;text-align:left;border-bottom:1px solid #e5e7eb;border-right:1px solid #e5e7eb;vertical-align:top}.zcode-help-table-cell:last-child{border-right:none}.zcode-help-table-header{background:#f9fafb;font-weight:600;color:#374151;font-size:13px;text-transform:uppercase;letter-spacing:.5px}.zcode-help-table-data{font-size:14px;color:#4b5563;line-height:1.6}.zcode-help-table-data:first-child{width:35%}.zcode-help-table-data:nth-child(2){width:30%}.zcode-help-table-data:nth-child(3){width:35%}.zcode-help-table-code{background:#f3f4f6;padding:3px 8px;border-radius:4px;font-size:13px;color:#dc2626;font-family:Courier New,Courier,monospace;white-space:nowrap;border:1px solid #e5e7eb}.zcode-help-table-row:hover{background:#fafafa}.zcode-help-section{background:#f9fafb;padding:12px 16px;border-radius:6px;border:1px solid #e5e7eb;margin-bottom:16px}.zcode-help-section:last-child{margin-bottom:0}.zcode-help-section-title{margin:0 0 8px;color:#374151;font-size:14px;font-weight:600}.zcode-help-section-list{margin:0;padding-left:0;list-style-position:inside}.zcode-help-section-item{margin-bottom:6px;color:#6b7280;font-size:13px;line-height:1.6}.zcode-help-section-item:last-child{margin-bottom:0}.zcode-help-section-code{background:#f3f4f6;padding:2px 6px;border-radius:3px;font-size:12px;color:#dc2626;font-family:Courier New,Courier,monospace;border:1px solid #e5e7eb}.zcode-slots-config{display:flex;flex-direction:column;gap:16px}.zcode-slot-config-item{border:1px solid #e5e7eb;border-radius:6px;padding:12px;background:#f9fafb}.zcode-slot-config-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #e5e7eb}.zcode-slot-config-header-title{font-size:14px;color:#1f2937}.zcode-slot-config-body{display:flex;flex-direction:column;gap:8px}.zcode-slot-config-body-label{font-size:12px;font-weight:600;color:#6b7280;margin-bottom:4px}.zcode-checkbox-group{display:flex;flex-direction:column;gap:6px}.zcode-checkbox-item{display:flex;align-items:center;gap:6px;cursor:pointer}.zcode-checkbox-item:hover{background-color:transparent}.zcode-checkbox{width:16px;height:16px;cursor:pointer;accent-color:var(--zcode-color-edit);flex-shrink:0}.zcode-checkbox-item span{font-size:13px;color:#374151;-webkit-user-select:none;user-select:none}.zcode-module-slots-config{margin-top:16px;padding-top:16px;border-top:1px solid #e5e7eb}.zcode-slot-add-section{margin-top:16px;padding:12px;border:1px dashed #d1d5db;border-radius:6px;background:#f9fafb}.zcode-slot-add-section-label{display:block;font-size:13px;font-weight:600;color:#374151;margin-bottom:8px}.zcode-slot-add-controls{display:flex;gap:8px;align-items:center}.zcode-select-input{flex:1;padding:8px 12px;border:1px solid #d1d5db;border-radius:4px;background:#fff;font-size:14px;color:#1f2937;cursor:pointer;transition:border-color .2s}.zcode-select-input:hover{border-color:#9ca3af}.zcode-select-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-select{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;color:#1f2937;cursor:pointer;transition:border-color .2s}.zcode-select:hover{border-color:#9ca3af}.zcode-select:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-select[multiple]{padding:4px;cursor:default}.zcode-select-option{padding:6px 8px;border-radius:4px;margin:2px 0}.zcode-select-option:checked{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit)}.zcode-tag-editor{display:flex;flex-direction:column;gap:8px}.zcode-tag-preview{font-size:12px;color:#6b7280;padding:4px 8px;background-color:#f3f4f6;border-radius:4px;font-family:Courier New,monospace}.zcode-tag-preview code{background-color:transparent;padding:0;color:#374151;font-weight:600}.zcode-slot-add-empty{margin-top:16px;padding:12px;text-align:center;color:#6b7280;font-size:13px;font-style:italic}.zcode-module-slots-config-label{font-size:13px;font-weight:600;color:#374151;margin-bottom:8px;display:block}.zcode-form-hint{font-size:12px;color:#6b7280;margin-top:4px;margin-bottom:12px;font-style:italic}.zcode-btn-small{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s;font-size:12px}.zcode-btn-small:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-module-item.active{border-color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg)}.zcode-module-delete-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-module-delete-btn:hover:not(:disabled){background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-module-delete-btn:disabled{opacity:.4;cursor:not-allowed}.zcode-module-actions{display:flex;gap:4px;align-items:center}.zcode-module-duplicate-btn,.zcode-module-copy-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-module-duplicate-btn:hover:not(:disabled),.zcode-module-copy-btn:hover:not(:disabled){background:var(--zcode-color-add-bg);color:var(--zcode-color-add)}.zcode-module-copy-btn:disabled{opacity:.4;cursor:not-allowed}.zcode-form-field{margin-bottom:16px}.zcode-form-field-label{display:block;font-size:14px;font-weight:500;color:#374151;margin-bottom:6px}.zcode-form-field-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}.zcode-form-field-header>.zcode-form-field-label:first-child{margin-bottom:0}.zcode-form-field-actions{display:flex;align-items:center;gap:8px}.zcode-help-btn{display:flex;align-items:center;justify-content:center;padding:4px;background:transparent;border:none;color:#6b7280;cursor:pointer;border-radius:4px;transition:all .2s}.zcode-help-btn:hover{color:#374151;background:transparent}.zcode-checkbox-label{display:flex;align-items:center;gap:6px;cursor:pointer;-webkit-user-select:none;user-select:none;margin-bottom:0}.zcode-checkbox-label-inline{margin-bottom:0}.zcode-checkbox-input{width:16px;height:16px;cursor:pointer;margin:0}.zcode-checkbox-label span{font-size:13px;color:#6b7280;font-weight:400}.zcode-text-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;transition:border-color .2s}.zcode-text-input:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-monaco-editor{width:100%;flex:1;min-height:0;display:flex;flex-direction:column}.zcode-monaco-editor .monaco-editor-wrapper{flex:1;min-height:0;display:flex;flex-direction:column}.zcode-monaco-editor .monaco-editor-container{border:1px solid #d1d5db;border-radius:4px;flex:1;min-height:0;max-height:none!important}.zcode-textarea{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;font-family:monospace;resize:vertical;transition:border-color .2s}.zcode-textarea:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-modules-list{margin-bottom:12px}.zcode-module-item{padding:12px;border:1px solid #e5e7eb;border-radius:6px;margin-bottom:12px;background:#f9fafb;cursor:pointer;transition:all .2s}.zcode-module-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.zcode-module-title{font-weight:600;font-size:14px;color:#1f2937}.zcode-module-body{display:flex;flex-direction:column;gap:8px}.zcode-module-body-label{font-size:12px;font-weight:500;color:#6b7280}.zcode-part-editor-actions{display:flex;gap:8px;padding:16px 24px;border-top:1px solid #e5e7eb;background:#fff;flex-shrink:0}.zcode-part-editor-actions-btn{flex:1}.zcode-part-editor-actions-btn-primary,.zcode-btn-primary{padding:10px 20px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:600;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-parts-new-btn{padding:7px 12px;font-size:13px;border-radius:4px;white-space:nowrap;flex-shrink:0}.zcode-images-add-btn{padding:7px 12px;font-size:13px;border-radius:4px}.zcode-btn-primary:hover{background:var(--zcode-color-edit-hover)}.zcode-btn-secondary{padding:8px 16px;background:#f3f4f6;color:#374151;border:1px solid #d1d5db;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:all .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-secondary:hover{background:#e5e7eb;border-color:#9ca3af}.zcode-page-css-panel{width:100%;background:#fff;display:flex;flex-direction:column;height:100%;flex:1;min-height:0}.zcode-warning-banner{padding:16px;background:#fff3cd;border-bottom:1px solid #ffc107;display:flex;gap:12px}.zcode-warning-icon{font-size:20px;flex-shrink:0}.zcode-warning-content{flex:1}.zcode-warning-title{margin:0 0 8px;font-size:14px;font-weight:700;color:#856404}.zcode-warning-list{margin:0;padding-left:20px;font-size:13px;color:#856404;line-height:1.6}.zcode-warning-list li{margin-bottom:4px}.zcode-warning-list strong{font-weight:700}.zcode-warning-inline{padding:12px;background:#fff3cd;border:1px solid #ffc107;border-radius:6px;margin-bottom:16px;display:flex;gap:12px}.zcode-warning-inline .zcode-warning-icon{font-size:18px;flex-shrink:0}.zcode-warning-inline .zcode-warning-content{flex:1}.zcode-warning-inline .zcode-warning-title{margin:0 0 8px;font-size:13px;font-weight:700;color:#856404}.zcode-warning-inline .zcode-warning-text{font-size:12px;color:#856404;line-height:1.6}.zcode-warning-inline .zcode-warning-text ul{margin:0;padding-left:20px}.zcode-warning-inline .zcode-warning-text li{margin-bottom:4px}.zcode-css-warning-modal{max-width:500px}.zcode-css-warning-modal-footer{display:flex;flex-direction:column;justify-content:center;align-items:center;padding:16px 24px;border-top:1px solid #e5e7eb;background:#f9fafb}.zcode-css-warning-modal .zcode-warning-content{padding:0}.zcode-css-warning-modal .zcode-warning-list{margin:0;padding-left:20px;font-size:14px;color:#856404;line-height:1.8;list-style-type:disc;list-style-position:outside}.zcode-css-warning-modal .zcode-warning-list li{margin-bottom:8px;list-style-type:disc}.zcode-css-warning-modal .zcode-warning-list strong{font-weight:700;color:#92400e}.zcode-page-css-content{display:flex;flex:1;overflow:hidden}.zcode-page-css-parts-selector{width:280px;border-right:1px solid #e5e7eb;display:flex;flex-direction:column;overflow:hidden;background:#f9fafb}.zcode-search-box{padding:12px;border-bottom:1px solid #e5e7eb;background:#fff}.zcode-search-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff}.zcode-search-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-parts-list{flex:1;overflow-y:auto;padding:12px}.zcode-parts-section{margin-bottom:24px}.zcode-parts-section:last-child{margin-bottom:0}.zcode-parts-section-title{margin:0 0 8px;padding:8px 12px;font-size:12px;font-weight:700;color:#6b7280;text-transform:uppercase;letter-spacing:.05em;background:#fff;border-radius:4px}.zcode-part-item{padding:12px;border:1px solid #e5e7eb;border-radius:6px;cursor:pointer;transition:all .2s;background:#fff;margin-bottom:8px}.zcode-part-item:hover{border-color:#d1d5db;box-shadow:0 2px 4px #0000000d}.zcode-part-item-selected{border-color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg);box-shadow:0 0 0 2px #3b82f633}.zcode-part-item-title{font-size:14px;font-weight:600;color:#1f2937;margin-bottom:4px}.zcode-part-item-id{font-size:12px;color:#6b7280;font-family:monospace}.zcode-page-css-preview{flex:1;border-right:1px solid #e5e7eb;display:flex;flex-direction:column;overflow:hidden;background:#f9fafb}.zcode-preview-container{flex:1;overflow:auto;padding:24px}.zcode-preview-content{max-width:800px;margin:0 auto;background:#fff;padding:24px;border-radius:8px;box-shadow:0 2px 8px #0000001a}.zcode-preview-content [data-zcode-highlight=true]{outline:3px solid var(--zcode-color-edit);outline-offset:4px;background:var(--zcode-color-edit-bg)}.zcode-page-css-editor{width:100%;display:flex;flex-direction:column;overflow:hidden;background:#fff;flex:1;min-height:0}.zcode-page-css-editor .zcode-form-field{flex:1;display:flex;flex-direction:column;padding:16px;overflow:hidden}.zcode-page-css-editor .zcode-form-field label{margin-bottom:8px;font-size:14px;font-weight:600;color:#1f2937}.zcode-page-css-editor .monaco-editor-wrapper{flex:1;min-height:0}.zcode-page-css-editor .monaco-editor-container{height:100%;min-height:320px;max-height:none}.zcode-page-css-actions{padding:16px;border-top:1px solid #e5e7eb;display:flex;gap:8px;justify-content:flex-end;flex-shrink:0}.zcode-page-css-actions .zcode-btn-primary,.zcode-page-css-actions .zcode-btn-secondary{flex:1}.zcode-images-manager{width:100%;background:#fff}.zcode-images-manager-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center}.zcode-images-manager-header-title{margin:0;font-size:18px;color:#1f2937}.zcode-images-manager-content{display:flex;flex-direction:column}.zcode-images-grid{padding:16px;display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:16px;align-content:start}.zcode-image-item{position:relative;border:2px solid #e5e7eb;border-radius:8px;cursor:pointer;background:#f9fafb;display:flex;flex-direction:column;overflow:hidden}.zcode-image-item>img{width:100%;height:150px;object-fit:cover;display:block;flex-shrink:0}.zcode-image-item:hover{border-color:#d1d5db;box-shadow:0 2px 8px #0000001a}.zcode-image-item.zcode-reorder-source{border-color:var(--zcode-color-reorder);background:#f59e0b05;box-shadow:0 0 0 1px #f59e0b1a}.zcode-image-item.selected{border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f633}.zcode-image-item-clickable{cursor:pointer}.zcode-image-item-img{width:100%;height:150px;object-fit:cover;display:block}.zcode-image-item-overlay{position:absolute;inset:0;pointer-events:none}.zcode-image-item-actions{position:absolute;top:8px;right:8px;display:flex;gap:4px;opacity:0;pointer-events:auto}.zcode-image-item:hover .zcode-image-item-actions{opacity:1}.zcode-image-edit-btn,.zcode-image-delete-btn{padding:8px;border:none;border-radius:4px;background:#ffffffe6;color:#374151;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-image-edit-btn:hover{background:#fff;color:var(--zcode-color-edit)}.zcode-image-delete-btn:hover{background:#fff;color:var(--zcode-color-delete)}.zcode-image-item-name{padding:8px;font-size:12px;color:#374151;text-align:center;background:#fff;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:break-all;overflow-wrap:break-word;max-width:100%}.zcode-image-editor-panel{position:static;width:auto;height:auto;background:transparent;box-shadow:none;display:block;z-index:auto}.zcode-image-editor-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-image-editor-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-image-editor-form{flex:1;overflow-y:auto;padding:16px}.zcode-image-preview-large{margin-bottom:16px;border:1px solid #e5e7eb;border-radius:6px;padding:8px;background:#f9fafb;display:flex;justify-content:center;align-items:center}.zcode-image-preview-large-img{max-width:100%;max-height:200px;object-fit:contain;border-radius:4px}.zcode-image-editor-actions{display:flex;gap:8px;margin-top:16px;padding-top:16px;border-top:1px solid #e5e7eb}.zcode-image-editor-actions-btn{flex:1}@media(max-width:768px){.zcode-part-type-items{grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:12px}.zcode-part-modal{padding:10px}.zcode-part-modal-content{max-width:100%;max-height:95vh}.zcode-part-editor-main,.zcode-part-editor-topfields{grid-template-columns:1fr}.zcode-part-editor-preview{position:relative;max-height:400px}.zcode-images-grid{grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:12px}}.zcode-data-viewer{border-top:1px solid #e5e7eb;background:#fff;display:flex;flex-direction:column;min-height:200px;flex-shrink:0;height:100%;overflow:hidden}.zcode-data-viewer-header{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;padding:8px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-data-viewer-content-tabs{display:flex;gap:4px}.zcode-data-viewer-content-tab{padding:6px 12px;font-size:13px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;font-weight:500;transition:all .2s}.zcode-data-viewer-content-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-data-viewer-content-tab.active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit)}.zcode-data-viewer-tabs{display:flex;gap:4px;align-items:center}.zcode-data-viewer-tab{padding:6px 12px;font-size:13px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;font-weight:500;transition:all .2s}.zcode-data-viewer-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-data-viewer-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-data-viewer-error{padding:12px 16px;background:#fee;color:#c33;border-bottom:1px solid #e5e7eb;font-size:13px}.zcode-data-viewer-content{flex:1;overflow:auto;position:relative}.zcode-data-viewer-display-wrapper{position:relative;width:100%;height:100%}.zcode-data-viewer-display{margin:0;padding:16px;font-family:Monaco,Menlo,Ubuntu Mono,monospace;font-size:13px;line-height:1.6;color:#f9fafb;background:#111827;white-space:pre;overflow-x:auto;border-top:1px solid #374151}.zcode-data-viewer-copy-btn{position:absolute;top:12px;right:12px;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid rgba(255,255,255,.2);border-radius:4px;background:#111827cc;color:#f9fafb;cursor:pointer;transition:all .2s;z-index:10}.zcode-data-viewer-copy-btn:hover{background:#111827f2;border-color:#ffffff4d;color:#fff}.zcode-data-viewer-copy-btn:active{transform:scale(.95)}.zcode-input-readonly,.zcode-textarea-readonly{display:none}.zcode-dev-container .zcode-input-readonly,.zcode-dev-container .zcode-textarea-readonly{display:block;background-color:#f3f4f6;color:#6b7280;border-color:#d1d5db;cursor:default;pointer-events:none}.zcode-context-menu{position:fixed;background:#fff;border:1px solid #e5e7eb;border-radius:6px;box-shadow:0 4px 12px #00000026;padding:4px;z-index:10000;min-width:160px}.zcode-context-menu-item{display:flex;align-items:center;gap:8px;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;border-radius:4px;font-size:14px;color:#374151;transition:background .2s}.zcode-context-menu-item:hover{background:#f3f4f6}.zcode-context-menu-item.active{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit);font-weight:500}.zcode-context-menu-divider{height:1px;background:#e5e7eb;margin:4px 0}.zcode-save-confirm-dialog-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:10000}.zcode-save-confirm-dialog{background:#fff;border-radius:8px;box-shadow:0 10px 25px #0003;max-width:500px;width:90%;max-height:80vh;display:flex;flex-direction:column}.zcode-save-confirm-dialog-header{padding:16px 20px;border-bottom:1px solid #e5e7eb}.zcode-save-confirm-dialog-title{font-size:18px;font-weight:600;color:#111827}.zcode-save-confirm-dialog-body{padding:20px;flex:1;overflow-y:auto}.zcode-save-confirm-dialog-body p{margin:0 0 12px;font-size:14px;color:#374151}.zcode-save-confirm-targets{list-style:none;padding:0;margin:12px 0}.zcode-save-confirm-targets li{padding:8px 12px;background:#f9fafb;border-radius:4px;margin-bottom:8px;font-size:14px;color:#374151}.zcode-save-confirm-targets li:last-child{margin-bottom:0}.zcode-save-confirm-dialog-footer{padding:16px 20px;border-top:1px solid #e5e7eb;display:flex;justify-content:flex-end;gap:12px}.zcode-btn-secondary{padding:8px 16px;background:#fff;border:1px solid #d1d5db;border-radius:6px;font-size:14px;cursor:pointer;color:#374151;transition:background-color .2s,border-color .2s}.zcode-btn-secondary:hover{background:#f9fafb;border-color:#9ca3af}.zcode-btn-primary{padding:8px 16px;background:#3b82f6;border:none;border-radius:6px;font-size:14px;cursor:pointer;color:#fff;transition:background-color .2s}.zcode-btn-primary:hover{background:#2563eb}@media(max-width:768px){.zcode-save-confirm-dialog{width:95%;max-height:90vh}.zcode-save-confirm-dialog-header{padding:12px 16px}.zcode-save-confirm-dialog-body{padding:16px}.zcode-save-confirm-dialog-footer{padding:12px 16px;flex-direction:column-reverse}.zcode-btn-secondary,.zcode-btn-primary{width:100%}.zcode-text-input,.zcode-textarea,.zcode-select,select{font-size:16px}}",VN={common:{close:"閉じる",save:"保存",cancel:"キャンセル",delete:"削除",edit:"編集",add:"追加",reorder:"並べ替え",preview:"プレビュー",settings:"設定",manage:"管理",view:"表示",confirm:"確定",clear:"クリア",select:"選択",replace:"差し替え",copy:"コピー",copied:"コピーしました"},toolbar:{editMode:"編集",addMode:"追加",reorderMode:"並べ替え",deleteMode:"削除",viewMode:"表示",settings:"設定"},settings:{title:"設定",language:{label:"言語",ja:"日本語",en:"English"},enableDynamicContent:"ページの動作を有効にする",enableDynamicContentDescription:"アコーディオン、タブ、モーダル、リンクなどの動的コンテンツの動作を有効にします。",devRightPadding:"編集パネル分の余白をつける",devRightPaddingDescription:"編集パネル表示時にコンテンツの右側に余白を追加します。",enableContextMenu:"右クリックメニューを有効にする",enableContextMenuDescription:"コンテンツ上で右クリックすると、編集・追加・並べ替え・削除のモードを切り替えるメニューが表示されます。",showSaveConfirm:"保存時の確認ダイアログを表示する",showSaveConfirmDescription:"保存ボタンをクリックした際に、保存対象を確認するダイアログを表示します。",previewModeInfo:"表示モードでは動的コンテンツ(アコーディオン、タブ、モーダル、リンクなど)は常に有効です。",noSettings:"設定項目はありません。"},addPanel:{title:"追加",selectParent:"親要素を選択",category:{common:"共通",individual:"個別",selected:"選択したパーツ"},typeAll:"all",activeParts:"active parts",activePartsDescription:"プレビューエリアでクリックしたパーツを、現在のデータを含む状態で追加できます。",clickPartInPreview:"プレビューエリアでパーツをクリックしてください",noPartsAvailable:"利用可能なパーツがありません",addBefore:"前に追加",addAfter:"後に追加",continueAdding:"パーツ追加を続ける"},editPanel:{title:"編集中",editing:"編集中: {type}",id:"ID: {id}",selectImage:"画像を選択",replaceImage:"差し替え",clearImage:"クリア",clearImageTitle:"画像をクリア",noFields:"編集可能なフィールドがありません"},deletePanel:{title:"削除確認",confirmMessage:"このパーツを削除しますか?",selectParent:"親要素を選択"},reorderPanel:{title:"並べ替え: 移動元を選択中",instruction:"移動先の要素をクリックしてください",source:"移動元: {path}",selectParent:"親要素を選択"},saveConfirm:{title:"保存の確認",message:"以下のデータを保存しますか?",simpleMessage:"保存しますか?",targets:{page:"ページデータ","parts-common":"パーツ(共通)","parts-individual":"パーツ(個別)","parts-special":"パーツ(特別)","parts-common-css":"CSS(共通)","parts-individual-css":"CSS(個別)","parts-special-css":"CSS(特別)","images-common":"画像(共通)","images-individual":"画像(個別)","images-special":"画像(特別)"},saveButton:"保存する"},partsManager:{createType:"タイプ追加",editType:"タイプ編集",typeName:"タイプ名",typeDescription:"説明",typeNamePlaceholder:"例: hero, features",typeDescriptionPlaceholder:"タイプの説明",editPart:"パーツ編集: {title}",partTitle:"タイトル",partDescription:"説明",partDescriptionPlaceholder:"パーツの説明",deletePartConfirm:`パーツ {number} を削除しますか?
463
+ (タイプには他のパーツが残ります)`,deleteTypeConfirm:"このタイプを削除しますか?",deleteTypeWithUsagesConfirm:"タイプ「{type}」は{count}箇所で使用されています。削除しますか?",deleteSlotConfirm:"スロット「{slotName}」を削除しますか?",selectImage:"画像選択",addPart:"パーツを追加",editTypeButton:"タイプ全体を編集",reorderType:"タイプを並べ替え",deleteTypeButton:"このタイプを削除(全パーツ含む)",editPartButton:"パーツを編集",reorderPart:"並べ替え",deletePartButton:"削除",source:"移動元",noDescription:"説明なし",partNumber:"パーツ {current} / {total}",allowedParts:"許可されるパーツ",searchParts:"パーツを検索...",addSlot:"スロットを追加",selectSlot:"スロットを選択...",defaultSlot:"デフォルトスロット",codeEdit:"コード編集",cssEditInfo:"CSS編集について",templateSuggestions:"予測変換",preview:"プレビュー:",cssEditWarning:"CSS編集について",cssEditWarningMessageCommon:"ここで編集したCSSは、すべてのページに適用される想定です。既存のCSSファイル(common.cssなど)がある場合、それらを上書きする可能性があります。",cssEditWarningMessageIndividual:"ここで編集したCSSは、ページタイプごとに適用される想定です。既存のCSSファイル(page.cssなど)がある場合、それらを上書きする可能性があります。",cssEditWarningMessageSpecial:"ここで編集したCSSは、動的ページごとに適用される想定です。既存のCSSファイル(shop111.cssなど)がある場合、それらを上書きする可能性があります。",understood:"了解しました",dontShowAgain:"次回から表示しない",templateHelp:{textField:"テキストフィールド",richText:"リッチテキスト",textarea:"複数行テキスト",image:"画像選択",radio:"ラジオボタン",checkbox:"チェックボックス",selectSingle:"セレクトボックス(単一選択)",selectMultiple:"セレクトボックス(複数選択)",conditional:"条件分岐(表示/非表示)",slot:"スロット(子要素挿入)",note:"補足",suggestionNote:"予測変換を有効にすると、<code>$</code>、<code>(</code>、<code>z</code>を入力時に自動補完が表示されます",fieldNameNote:"フィールド名は英数字とアンダースコアが使用できます",defaultValueNote:"デフォルト値は省略可能です(空文字になります)"},validationError:"エラー:",dangerousTagWarning:"<{tag}> タグが含まれています。",dangerousAttrWarning:"{attr} 属性が含まれています。",slotSettings:"スロット設定",slot:"スロット",templateHelpButton:"テンプレート記法のヘルプ",clickToEnlarge:"クリックで拡大"},imagesManager:{addImage:"画像追加",editImage:"画像編集",imageId:"画像ID",imageName:"画像名",altText:"Alt属性",deleteImageConfirm:"この画像を削除しますか?",deleteImageWithUsagesConfirm:"この画像は{count}箇所で使用されています。削除しますか?",deleteImageFromModalConfirm:"この画像を削除しますか?",addImageFailed:"画像の追加に失敗しました",selectImage:"画像を選択",currentlySelected:"現在選択中",select:"選択"},dataViewer:{page:"ページ",parts:"パーツ",images:"画像",common:"共通",individual:"個別",special:"特別",json:"JSON",html:"HTML",categoryInfo:{title:"カテゴリの役割について",common:{title:"共通",description:"サイト全体で共有されるパーツ・画像を想定しています。すべてのページで使用できる想定です。"},individual:{title:"個別",description:"ページタイプごとに共有されるパーツ・画像を想定しています。同じページタイプのすべてのページで使用できる想定です。"},special:{title:"特別",description:"動的ページ(例:店舗ごと、商品ごと)や特定の条件で使用されるパーツ・画像を想定しています。ルートモデルバインディングなどで動的に生成されるページで使用できる想定です。"}}},contextMenu:{edit:"編集",add:"追加",reorder:"並べ替え",delete:"削除",close:"閉じる"},editor:{pageManagement:"ページ管理",partsManagement:"パーツ管理",imagesManagement:"画像管理",dataViewer:"データビューアー",loading:"データを読み込み中..."}},BN={common:{close:"Close",save:"Save",cancel:"Cancel",delete:"Delete",edit:"Edit",add:"Add",reorder:"Reorder",preview:"Preview",settings:"Settings",manage:"Manage",view:"View",confirm:"Confirm",clear:"Clear",select:"Select",replace:"Replace",copy:"Copy",copied:"Copied"},toolbar:{editMode:"Edit",addMode:"Add",reorderMode:"Reorder",deleteMode:"Delete",viewMode:"View",settings:"Settings"},settings:{title:"Settings",language:{label:"Language",ja:"Japanese",en:"English"},enableDynamicContent:"Enable page interactions",enableDynamicContentDescription:"Enables interactions for dynamic content such as accordions, tabs, modals, and links.",devRightPadding:"Add padding for edit panel",devRightPaddingDescription:"Adds right padding to content when the edit panel is displayed.",enableContextMenu:"Enable right-click menu",enableContextMenuDescription:"Right-clicking on content displays a menu to switch between edit, add, reorder, and delete modes.",showSaveConfirm:"Show save confirmation dialog",showSaveConfirmDescription:"Displays a dialog to confirm save targets when clicking the save button.",previewModeInfo:"Dynamic content (accordions, tabs, modals, links, etc.) is always enabled in preview mode.",noSettings:"No settings available."},addPanel:{title:"Add",selectParent:"Select parent element",category:{common:"Common",individual:"Individual",selected:"Selected part"},typeAll:"all",activeParts:"active parts",activePartsDescription:"You can add the part clicked in the preview area with its current data included.",clickPartInPreview:"Please click a part in the preview area",noPartsAvailable:"No parts available",addBefore:"Add before",addAfter:"Add after",continueAdding:"Continue adding parts"},editPanel:{title:"Editing",editing:"Editing: {type}",id:"ID: {id}",selectImage:"Select image",replaceImage:"Replace",clearImage:"Clear",clearImageTitle:"Clear image",noFields:"No editable fields available"},deletePanel:{title:"Delete confirmation",confirmMessage:"Do you want to delete this part?",selectParent:"Select parent element"},reorderPanel:{title:"Reorder: Source selected",instruction:"Click the destination element",source:"Source: {path}",selectParent:"Select parent element"},saveConfirm:{title:"Save confirmation",message:"Do you want to save the following data?",simpleMessage:"Do you want to save?",targets:{page:"Page data","parts-common":"Parts (Common)","parts-individual":"Parts (Individual)","parts-special":"Parts (Special)","images-common":"Images (Common)","images-individual":"Images (Individual)","images-special":"Images (Special)","parts-common-css":"CSS (Common)","parts-individual-css":"CSS (Individual)","parts-special-css":"CSS (Special)"},saveButton:"Save"},partsManager:{createType:"Create new type",editType:"Edit type",typeName:"Type name",typeDescription:"Description",typeNamePlaceholder:"Example: hero, features",typeDescriptionPlaceholder:"Type description",editPart:"Edit part: {title}",partTitle:"Title",partDescription:"Description",partDescriptionPlaceholder:"Part description",deletePartConfirm:`Do you want to delete part {number}?
464
+ (Other parts in the type will remain)`,deleteTypeConfirm:"Do you want to delete this type?",deleteTypeWithUsagesConfirm:'Type "{type}" is used in {count} places. Do you want to delete it?',deleteSlotConfirm:'Do you want to delete slot "{slotName}"?',selectImage:"Select image",addPart:"Add part",editTypeButton:"Edit type",reorderType:"Reorder type",deleteTypeButton:"Delete this type (all parts included)",editPartButton:"Edit part",reorderPart:"Reorder",deletePartButton:"Delete",source:"Source",noDescription:"No description",partNumber:"Part {current} / {total}",allowedParts:"Allowed parts",searchParts:"Search parts...",addSlot:"Add slot",selectSlot:"Select slot...",defaultSlot:"Default slot",codeEdit:"Code editor",cssEditInfo:"About CSS editing",templateSuggestions:"Template suggestions",preview:"Preview:",cssEditWarning:"About CSS editing",cssEditWarningMessageCommon:"CSS edited here is intended to apply to all pages. If existing CSS files (e.g., common.css) exist, they may be overwritten.",cssEditWarningMessageIndividual:"CSS edited here is intended to apply per page type. If existing CSS files (e.g., page.css) exist, they may be overwritten.",cssEditWarningMessageSpecial:"CSS edited here is intended to apply per dynamic page. If existing CSS files (e.g., shop111.css) exist, they may be overwritten.",dontShowAgain:"Don't show again",templateHelp:{textField:"Text field",richText:"Rich text",textarea:"Multi-line text",image:"Image selection",radio:"Radio button",checkbox:"Checkbox",selectSingle:"Select box (single)",selectMultiple:"Select box (multiple)",conditional:"Conditional (show/hide)",slot:"Slot (child insertion)",note:"Note",suggestionNote:"When template suggestions are enabled, autocomplete will appear when typing <code>$</code>, <code>(</code>, or <code>z</code>",fieldNameNote:"Field names can use alphanumeric characters and underscores",defaultValueNote:"Default values are optional (will be empty string if omitted)"},validationError:"Error:",dangerousTagWarning:"<{tag}> tag is included.",dangerousAttrWarning:"{attr} attribute is included.",slotSettings:"Slot settings",slot:"Slot",templateHelpTitle:"Template Syntax Help",clickToEnlarge:"Click to enlarge",understood:"Understood",syntax:"Syntax",description:"Description",example:"Example",templateHelpButton:"Template syntax help"},imagesManager:{addImage:"Add image",editImage:"Edit image",imageId:"Image ID",imageName:"Image name",altText:"Alt attribute",deleteImageConfirm:"Do you want to delete this image?",deleteImageWithUsagesConfirm:"This image is used in {count} places. Do you want to delete it?",deleteImageFromModalConfirm:"Do you want to delete this image?",addImageFailed:"Failed to add image",selectImage:"Select image",currentlySelected:"Currently selected",select:"Select"},dataViewer:{page:"Page",parts:"Parts",images:"Images",common:"Common",individual:"Individual",special:"Special",json:"JSON",html:"HTML",categoryInfo:{title:"About Category Roles",common:{title:"Common",description:"Intended for parts and images shared across the entire site. Assumed to be usable on all pages."},individual:{title:"Individual",description:"Intended for parts and images shared per page type. Assumed to be usable on all pages of the same page type."},special:{title:"Special",description:"Intended for parts and images used for dynamic pages (e.g., per store, per product) or under specific conditions. Assumed to be usable on pages dynamically generated with route model binding, etc."}}},contextMenu:{edit:"Edit",add:"Add",reorder:"Reorder",delete:"Delete",close:"Close"},editor:{pageManagement:"Page Management",partsManagement:"Parts Management",imagesManagement:"Images Management",dataViewer:"Data Viewer",loading:"Loading data...",saveFailed:"Save failed",saveFailedWithCount:"Save failed ({count} items)",saveFailedWithMessage:"Save failed ({count} items): {message}",noSaveTargets:"No save targets"}};function FN(n="ja"){return jy({locale:n,fallbackLocale:"ja",messages:{ja:VN,en:BN},globalInjection:!0})}const jh={UNDEFINED_PROPERTIES:"Cannot read properties of undefined",APP_REFERENCE:"app"};function Hh(){if(typeof window>"u")return;const n=window;n.__zcodeI18nErrorHandlerSetup||(window.addEventListener("unhandledrejection",e=>{if(e.reason&&typeof e.reason=="object"&&"message"in e.reason){const t=String(e.reason.message);if(t.includes(jh.UNDEFINED_PROPERTIES)&&t.includes(jh.APP_REFERENCE)){e.preventDefault();return}}}),n.__zcodeI18nErrorHandlerSetup=!0)}function jN(){if(typeof window>"u")return;const n=window;n.__VUE_I18N_FULL_INSTALL__=!1,n.__INTLIFY_PROD_DEVTOOLS__=!1,n.__VUE_I18N_PROD_DEVTOOLS__=!1}function Is(n,e="ja"){const t=Qy(null);if(t)return t;const o=n.getAttribute("locale");return o==="ja"||o==="en"?o:e}function _s(n,e){jN();const t=FN(e);try{n.use(t)}catch(o){console.warn("[ZeroCode] Failed to setup i18n:",o)}}Hh();class HN extends HTMLElement{app=null;componentInstance=null;_shadowRoot=null;constructor(){super()}connectedCallback(){if(this.app)return;this.getAttribute("use-shadow-dom")!=="false"?(this.setupShadowDOM(),window.addEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this))):(this.setupLightDOM(),window.addEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this)))}setupLightDOM(){const e=this.getAttribute("page")||"[]",t=this.getAttribute("css-common"),o=this.getAttribute("css-individual"),r=this.getAttribute("css-special"),i=this.getAttribute("parts-common")||"[]",s=this.getAttribute("parts-individual")||"[]",l=this.getAttribute("parts-special")||"[]",c=this.getAttribute("images-common")||"[]",d=this.getAttribute("images-individual")||"[]",u=this.getAttribute("images-special")||"[]",f=Array.from(this.querySelectorAll('[slot="script"]'));f.length>0&&(this.__savedScriptSlots=f.map(h=>({src:h.src,type:h.type,async:h.async,defer:h.defer,integrity:h.integrity,crossOrigin:h.crossOrigin})));const p=Is(this);this.app=a.createApp(As,{locale:p,page:e,cssCommon:t,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:s,partsSpecial:l,imagesCommon:c,imagesIndividual:d,imagesSpecial:u,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}),_s(this.app,p),this.componentInstance=this.app.mount(this),this.injectLightDOMCSS()}setupShadowDOM(){const e=this.shadowRoot,t=!!e;e?(this._shadowRoot=e,this.clearScripts()):(this._shadowRoot=this.attachShadow({mode:"open"}),this.injectCSS());const o=this.getAttribute("page")||"[]",r=this.getAttribute("css-common"),i=this.getAttribute("css-individual"),s=this.getAttribute("css-special"),l=this.getAttribute("parts-common")||"[]",c=this.getAttribute("parts-individual")||"[]",d=this.getAttribute("parts-special")||"[]",u=this.getAttribute("images-common")||"[]",f=this.getAttribute("images-individual")||"[]",p=this.getAttribute("images-special")||"[]",h=Is(this);this.app=a.createApp(As,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:s,partsCommon:l,partsIndividual:c,partsSpecial:d,imagesCommon:u,imagesIndividual:f,imagesSpecial:p,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}),_s(this.app,h),this.componentInstance=this.app.mount(this._shadowRoot),requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{this.injectScript(t)},100)})})}injectCSS(){if(!this._shadowRoot)return;const e=document.createElement("style");e.textContent=Fh,this._shadowRoot.appendChild(e),this.querySelectorAll('[slot="css"]').forEach(o=>{const r=o.cloneNode(!0);r.removeAttribute("slot"),this._shadowRoot.appendChild(r),o.remove()})}injectLightDOMCSS(){this.querySelectorAll('[slot="css"]').forEach(t=>{const o=t.cloneNode(!0);o.removeAttribute("slot"),document.head.appendChild(o)})}clearScripts(){if(!this._shadowRoot)return;this._shadowRoot.querySelectorAll("script").forEach(t=>{t.remove()})}injectScript(e=!1){if(!this._shadowRoot)return;const t=this.querySelectorAll('[slot="script"]'),o=Array.from(t),r=[],i=[];o.forEach(c=>{const d=c;if(!d.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}d.src.includes("jquery")||d.src.includes("code.jquery.com")?r.push(d):i.push(d)});const s=c=>{let d=c.src;if(e)try{const f=new URL(c.src,window.location.href);f.searchParams.set("_t",Date.now().toString()),d=f.toString()}catch{d=c.src+(c.src.includes("?")?"&":"?")+"_t="+Date.now()}const u=document.createElement("script");return u.src=d,c.type&&(u.type=c.type),c.async&&(u.async=!0),c.defer&&(u.defer=!0),c.integrity&&(u.integrity=c.integrity),c.crossOrigin&&(u.crossOrigin=c.crossOrigin),u.onerror=f=>{console.error(`Failed to load script: ${c.src}`,f)},u},l=()=>{o.forEach(c=>{c.remove()})};if(r.length>0){let c=0;const d=r.length;r.forEach(u=>{const f=s(u);f.onload=()=>{c++,c===d&&(Co(this._shadowRoot,e),setTimeout(()=>{i.forEach(p=>{this._shadowRoot.appendChild(s(p))}),l()},50))},this._shadowRoot.appendChild(f)})}else Co(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(s(c))}),l()}injectLightDOMScripts(){let e=[];if(this.__savedScriptSlots&&this.__savedScriptSlots.length>0)e=this.__savedScriptSlots.map(i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s});else{const i=this.querySelectorAll('[slot="script"]');e=Array.from(i)}const t=[],o=[];e.forEach(i=>{const s=i;if(!s.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}s.src.includes("jquery")||s.src.includes("code.jquery.com")?t.push(s):o.push(s)});const r=i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},s};if(t.length>0){let i=0;const s=t.length;t.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===s&&requestAnimationFrame(()=>{o.forEach(d=>{document.body.appendChild(r(d))})})},document.body.appendChild(c)})}else o.forEach(i=>{document.body.appendChild(r(i))})}getData(e){return this.componentInstance&&this.componentInstance.getData?this.componentInstance.getData(e):null}setData(e,t){return this.componentInstance&&this.componentInstance.setData?this.componentInstance.setData(e,t):!1}get allowDynamicContentInteraction(){if(this.componentInstance){const e=this.componentInstance.allowDynamicContentInteraction;if(e!==void 0)return e&&typeof e=="object"&&"value"in e?e.value:e}return!0}set allowDynamicContentInteraction(e){if(this.componentInstance){const t=this.componentInstance.allowDynamicContentInteraction;t!==void 0&&(t&&typeof t=="object"&&"value"in t?t.value=e:this.componentInstance.allowDynamicContentInteraction=e)}}disconnectedCallback(){if(this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot){if(this._shadowRoot.__zecEventListeners){const e=this._shadowRoot.__zecEventListeners,t=this._shadowRoot;e.forEach(o=>{o.forEach(r=>{t.removeEventListener(r.eventName,r.handler,!0)})}),e.clear()}if(window.__zecShadowRoots){const e=window.__zecShadowRoots,t=this._shadowRoot;for(const[o,r]of e.entries())r===t&&e.delete(o)}}this._shadowRoot=null,window.removeEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this)),window.removeEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this))}handleDOMUpdated(){if(!this._shadowRoot||this.getAttribute("use-shadow-dom")!=="true")return;this._shadowRoot.__zecJQueryExtended&&delete this._shadowRoot.__zecJQueryExtended;const e=this._shadowRoot.querySelector("script[data-zec-shadow-extension]");e&&e.remove(),Co(this._shadowRoot,!0)}handleLightDOMUpdated(){this.getAttribute("use-shadow-dom")!=="true"&&(this.__lightDOMScriptsLoaded||(this.injectLightDOMScripts(),this.__lightDOMScriptsLoaded=!0))}static get observedAttributes(){return["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data","use-shadow-dom"]}attributeChangedCallback(e,t,o){if(t!==o){if(e==="use-shadow-dom"){this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot&&(this._shadowRoot.innerHTML="",this._shadowRoot=null),this.connectedCallback();return}this.app&&(this.app.unmount(),this.app=null,this.componentInstance=null,this.connectedCallback())}}}customElements.get("zcode-cms")||customElements.define("zcode-cms",HN);function UN(n){const{t:e}=Qt(),t=a.ref("common"),o=a.ref(null),r=a.ref(null),i=a.ref(null),s=a.ref(null),l=a.ref(!1),c=a.ref(null),d=a.ref(null),{renderComponentToHtml:u}=ti(n,!1),f=a.computed(()=>{const C=n.parts;return t.value==="common"?C.common:t.value==="individual"?C.individual:C.special}),p=a.computed(()=>{const C=f.value,P=new Map;return C.forEach(V=>{P.has(V.type)||P.set(V.type,[]),V.parts.forEach((S,N)=>{P.get(V.type).push({type:V,partIndex:N})})}),Array.from(P.entries()).map(([V,S])=>({type:V,parts:S.map(N=>({...N.type,_partIndex:N.partIndex,_displayPart:N.type.parts[N.partIndex]}))}))});function h(){const C=n.parts;return t.value==="common"?C.common:t.value==="individual"?C.individual:C.special}function m(C){return f.value.find(P=>P.type===C)||null}function y(C){return i.value&&i.value.partIndex===C&&i.value.part.slots||null}function g(C,P,V){if(i.value&&i.value.partIndex===C){const S=i.value.part;return S.slots||(S.slots={}),V(S.slots),!0}return!1}function x(C){const P={};return C.forEach(V=>{if(V.optional)P[V.fieldName]=void 0;else switch(V.type){case"text":P[V.fieldName]=V.defaultValue||"";break;case"radio":P[V.fieldName]=V.options?.[0]||"";break;case"checkbox":P[V.fieldName]=[];break;case"boolean":P[V.fieldName]=!0;break;case"rich":P[V.fieldName]=V.defaultValue?`<p>${V.defaultValue}</p>`:"<p></p>";break;case"image":P[V.fieldName]=V.defaultValue||"";break}}),P}function M(C){o.value=C,r.value=null,l.value=!1}function E(){r.value=a.reactive({id:Rn(),type:"",description:"",parts:[{id:Rn(),title:"part_1",description:"",body:"<div>{$content:コンテンツを入力}</div>"}]}),s.value="type",l.value=!0,o.value=null}function v(C){r.value=a.reactive(JSON.parse(JSON.stringify(C))),s.value="type",l.value=!1,o.value=C}function _(C,P){const V=C.parts[P];if(!V)return;const S=JSON.parse(JSON.stringify(V));S.slots||(S.slots={}),i.value={type:a.reactive(JSON.parse(JSON.stringify(C))),partIndex:P,part:a.reactive(S)},s.value="part"}async function A(C){const P=m(C.type);if(!P)return;const V=a.reactive(JSON.parse(JSON.stringify(P))),S={id:Rn(),title:`part_${V.parts.length+1}`,description:"",body:"<div>{$content:コンテンツを入力}</div>"};V.parts.push(S);const N=V.parts.length-1;await a.nextTick(),i.value={type:V,partIndex:N,part:a.reactive(JSON.parse(JSON.stringify(S))),isNewPart:!0},s.value="part"}async function b(){if(!r.value)return;const C=Pe(r.value);if(!C.valid){alert(e("partsManager.validationError")+`
465
+ `+C.errors.join(`
466
+ `));return}const P=JSON.parse(JSON.stringify(a.toRaw(r.value))),V=h();if(l.value)V.push(P);else{const S=V.findIndex(N=>N.id===r.value.id);S!==-1&&(V[S]=P)}await a.nextTick(),f.value,p.value,r.value=null,s.value=null,l.value=!1}function k(C){const P=[],V=C.toLowerCase(),S=["script","iframe","object","embed"],N=["onclick","onerror","onload","onmouseover","onfocus","onblur"];return S.forEach($=>{V.includes(`<${$}`)&&P.push(e("partsManager.dangerousTagWarning",{tag:$}))}),N.forEach($=>{V.includes(`${$}=`)&&P.push(e("partsManager.dangerousAttrWarning",{attr:$}))}),{hasWarning:P.length>0,messages:P}}async function w(){if(!i.value)return;const C=i.value.part.body||"",P=k(C);if(P.hasWarning&&!confirm(`テンプレートにセキュリティ上注意が必要な記述が含まれています。
471
467
 
472
468
  ${P.messages.join(`
473
469
  `)}
474
470
 
475
- このまま保存しますか?`))return;const V=h(),S=V.findIndex(te=>te.id===i.value.type.id);if(S===-1)return;const C=V[S],$=JSON.parse(JSON.stringify(a.toRaw(i.value.part)));i.value.isNewPart?C.parts.push($):C.parts[i.value.partIndex]=$,await a.nextTick(),f.value,p.value,i.value=null,s.value=null}function O(N){const P=f.value.find(V=>V.id===N.id);if(P){if(N._partIndex!==void 0&&N._partIndex!==null)if(P.parts.length>1)P.parts.splice(N._partIndex,1);else{const V=f.value.findIndex(S=>S.id===N.id);V!==-1&&f.value.splice(V,1)}else{const V=f.value.findIndex(S=>S.id===N.id);V!==-1&&f.value.splice(V,1)}o.value=null,r.value=null}}function G(N){const P=[],V=(S,C)=>{const $=S.part_id,te=t.parts,ge=[...te.common,...te.individual];for(const Re of ge)if(Re.parts.find(_=>_.id===$)&&Re.type===N){P.push({path:C,component:S});break}S.slots&&Object.entries(S.slots).forEach(([Re,ve])=>{Array.isArray(ve)&&ve.forEach((_,I)=>{V(_,`${C}.slots.${Re}.${I}`)})})};return t.page.forEach((S,C)=>{V(S,`page.${C}`)}),P}function z(N,P){const V=Fn(P.body),S=x(V),C={id:"preview",part_id:P.id,...S},$=new Set;$.add(`${N.id}:${P.id}`);const te=P.slots;if(te){const ge={};Object.entries(te).forEach(([Re,ve])=>{const _=ve.allowedParts;if(_&&_.length>0){const I=_[_.length-1],q=t.parts,pe=[...q.common,...q.individual];let Ae=null,ze=null;for(const Se of pe){const F=Se.parts.find(ne=>ne.id===I);if(F){Ae=Se,ze=F;break}}if(Ae&&ze){const Se=R(Ae,ze.id,$);ge[Re]=[Se]}else ge[Re]=[]}else ge[Re]=[]}),Object.keys(ge).length>0&&(C.slots=ge)}return C}function R(N,P,V=new Set){const S=P&&N.parts.find(ve=>ve.id===P)||N.parts[0];if(!S)throw new Error(`Part not found for type: ${N.type}`);const C=`${N.id}:${S.id}`;if(V.has(C)){const ve=Fn(S.body),_=x(ve);return{id:"preview",part_id:S.id,..._}}V.add(C);const $=Fn(S.body),te=x($),ge={id:"preview",part_id:S.id,...te},Re=S.slots;if(Re){const ve={};Object.entries(Re).forEach(([_,I])=>{const q=I.allowedParts;if(q&&q.length>0){const pe=q[q.length-1],Ae=t.parts,ze=[...Ae.common,...Ae.individual];let Se=null,F=null;for(const ne of ze){const Me=ne.parts.find(B=>B.id===pe);if(Me){Se=ne,F=Me;break}}if(Se&&F){const ne=R(Se,F.id,V);ve[_]=[ne]}else ve[_]=[]}else ve[_]=[]}),Object.keys(ve).length>0&&(ge.slots=ve)}return ge}function W(N,P){if(!P)return"";const V=z(N,P);return ui(P.body,V,"",S=>{const C=t.parts,$=[...C.common,...C.individual,...C.special];for(const te of $){const ge=te.parts.find(Re=>Re.id===S);if(ge)return ge}return null},(S,C)=>u(S,C),!1,t.images.common,t.images.individual,t.images.special)}function H(N){const P=[];try{const C=new DOMParser().parseFromString(`<template>${N}</template>`,"text/html").querySelector("template");if(!C)return P;C.content.querySelectorAll("[z-slot]").forEach(te=>{const ge=te.getAttribute("z-slot")||"default";P.includes(ge)||P.push(ge)})}catch(V){console.error("Failed to parse template:",V)}return P}function L(N){if(i.value&&i.value.partIndex===N){const P=i.value.part.body,V=H(P),S=Object.keys(i.value.part.slots||{});return V.filter(C=>!S.includes(C))}return[]}function j(N,P){let V=P||null;if(!V&&(V=prompt("スロット名を入力してください:"),!V?.trim()))return;g(N,V.trim(),C=>{if(C[V.trim()]){alert("このスロット名は既に存在します");return}C[V.trim()]={}})||alert("パーツが見つかりません")}function Z(N,P){b(N)?.[P]&&confirm(`スロット「${P}」を削除しますか?`)&&g(N,P,S=>{delete S[P]})}function K(N,P,V){g(N,P,C=>{C[P]&&(C[P].allowedParts=V)})||console.warn(`Failed to update allowed parts for slot ${P}`)}function ae(N,P){if(!c.value){c.value={type:N.type,partIndex:P};return}if(c.value.type===N.type&&c.value.partIndex===P){Y();return}const V=c.value,S={type:N.type,partIndex:P};if(!ee(V,S)){alert("同じタイプ内のパーツのみ並べ替えできます"),Y();return}X(V,S),Y()}function ee(N,P){return!(N.type!==P.type||N.partIndex===P.partIndex)}function X(N,P){const V=h(),S=V.findIndex(ge=>ge.type===N.type);if(S===-1)return;const $=V[S].parts,[te]=$.splice(N.partIndex,1);$.splice(P.partIndex,0,te)}function Y(){c.value=null}function J(N){const P=h(),V=G(N);if(V.length>0){if(!confirm(`タイプ「${N}」は${V.length}箇所で使用されています。削除しますか?`))return}else if(!confirm(`タイプ「${N}」を削除しますか?`))return;for(let S=P.length-1;S>=0;S--)P[S].type===N&&P.splice(S,1)}function Q(N,P){if(N===P)return;const V=h(),S=new Map,C=[];V.forEach(ve=>{S.has(ve.type)||(S.set(ve.type,[]),C.push(ve.type)),S.get(ve.type).push(ve)});const $=C.map(ve=>({type:ve,types:S.get(ve)})),te=$.findIndex(ve=>ve.type===N),ge=$.findIndex(ve=>ve.type===P);if(te===-1||ge===-1)return;const[Re]=$.splice(te,1);$.splice(ge,0,Re),V.splice(0,V.length),$.forEach(ve=>{ve.types.forEach(_=>V.push(_))})}function de(N){if(!d.value){d.value=N;return}if(d.value===N){d.value=null;return}Q(d.value,N),d.value=null}function ke(){r.value=null,s.value=null,l.value=!1}function Te(){i.value=null,s.value=null}function $e(N){const P=[];if(!N.type||N.type.trim()==="")P.push("タイプ名は必須です");else if(l.value){const V=t.parts;[...V.common,...V.individual].some($=>$.type===N.type.trim())&&P.push(`タイプ「${N.type}」は既に存在します`)}return!N.parts||N.parts.length===0?P.push("最低1つのパーツが必要です"):N.parts.forEach((V,S)=>{(!V.title||V.title.trim()==="")&&P.push(`パーツ ${S+1} のタイトルは必須です`),(!V.body||V.body.trim()==="")&&P.push(`パーツ ${S+1} のテンプレートは必須です`)}),{valid:P.length===0,errors:P}}return{reorderSourcePart:c,handleReorderClick:ae,canReorderParts:ee,cancelReorder:Y,activeCategory:n,selectedType:o,editingType:r,editingPart:i,editingLevel:s,isCreatingNew:l,currentTypes:f,groupedPartsByType:p,selectType:v,startCreating:w,startEditingType:T,startEditingPart:M,addPartToType:A,saveType:y,savePart:k,deletePart:O,checkTypeUsage:G,cancelEditingType:ke,cancelEditingPart:Te,getPartPreviewHtml:W,validateType:$e,addPartSlot:j,removePartSlot:Z,updatePartSlotAllowedParts:K,getAvailableSlotsForPart:L,extractSlotsFromTemplate:H,reorderSourceType:d,startReorderType:de,deletePartType:J}}function vm(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=Array(e);n<e;n++)o[n]=t[n];return o}function sT(t){if(Array.isArray(t))return t}function aT(t,e,n){return(e=hT(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lT(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var o,r,i,s,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(o=i.call(n)).done)&&(l.push(o.value),l.length!==e);c=!0);}catch(u){d=!0,r=u}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(d)throw r}}return l}}function cT(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
476
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tm(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function zm(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Tm(Object(n),!0).forEach(function(o){aT(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tm(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function dT(t,e){if(t==null)return{};var n,o,r=uT(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)n=i[o],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function uT(t,e){if(t==null)return{};var n={};for(var o in t)if({}.hasOwnProperty.call(t,o)){if(e.indexOf(o)!==-1)continue;n[o]=t[o]}return n}function fT(t,e){return sT(t)||lT(t,e)||mT(t,e)||cT()}function pT(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function hT(t){var e=pT(t,"string");return typeof e=="symbol"?e:e+""}function mT(t,e){if(t){if(typeof t=="string")return vm(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vm(t,e):void 0}}function gT(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _m(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Am(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?_m(Object(n),!0).forEach(function(o){gT(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_m(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function bT(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(o){return e.reduceRight(function(r,i){return i(r)},o)}}function Zr(t){return function e(){for(var n=this,o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return r.length>=t.length?t.apply(this,r):function(){for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];return e.apply(n,[].concat(r,l))}}}function qs(t){return{}.toString.call(t).includes("Object")}function yT(t){return!Object.keys(t).length}function ei(t){return typeof t=="function"}function xT(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ET(t,e){return qs(e)||co("changeType"),Object.keys(e).some(function(n){return!xT(t,n)})&&co("changeField"),e}function kT(t){ei(t)||co("selectorType")}function wT(t){ei(t)||qs(t)||co("handlerType"),qs(t)&&Object.values(t).some(function(e){return!ei(e)})&&co("handlersType")}function ST(t){t||co("initialIsRequired"),qs(t)||co("initialType"),yT(t)&&co("initialContent")}function NT(t,e){throw new Error(t[e]||t.default)}var CT={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},co=Zr(NT)(CT),Ks={changes:ET,selector:kT,handler:wT,initial:ST};function vT(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ks.initial(t),Ks.handler(e);var n={current:t},o=Zr(_T)(n,e),r=Zr(zT)(n),i=Zr(Ks.changes)(t),s=Zr(TT)(n);function l(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(u){return u};return Ks.selector(d),d(n.current)}function c(d){bT(o,r,i,s)(d)}return[l,c]}function TT(t,e){return ei(e)?e(t.current):e}function zT(t,e){return t.current=Am(Am({},t.current),e),e}function _T(t,e,n){return ei(e)?e(t.current):Object.keys(n).forEach(function(o){var r;return(r=e[o])===null||r===void 0?void 0:r.call(e,t.current[o])}),n}var AT={create:vT},MT={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function IT(t){return function e(){for(var n=this,o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return r.length>=t.length?t.apply(this,r):function(){for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];return e.apply(n,[].concat(r,l))}}}function OT(t){return{}.toString.call(t).includes("Object")}function DT(t){return t||Im("configIsRequired"),OT(t)||Im("configType"),t.urls?(RT(),{paths:{vs:t.urls.monacoBase}}):t}function RT(){console.warn(Mm.deprecation)}function PT(t,e){throw new Error(t[e]||t.default)}var Mm={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
471
+ このまま保存しますか?`))return;const V=h(),S=V.findIndex(ne=>ne.id===i.value.type.id);if(S===-1)return;const N=V[S],$=JSON.parse(JSON.stringify(a.toRaw(i.value.part)));i.value.isNewPart?N.parts.push($):N.parts[i.value.partIndex]=$,await a.nextTick(),f.value,p.value,i.value=null,s.value=null}function O(C){const P=f.value.find(V=>V.id===C.id);if(P){if(C._partIndex!==void 0&&C._partIndex!==null)if(P.parts.length>1)P.parts.splice(C._partIndex,1);else{const V=f.value.findIndex(S=>S.id===C.id);V!==-1&&f.value.splice(V,1)}else{const V=f.value.findIndex(S=>S.id===C.id);V!==-1&&f.value.splice(V,1)}o.value=null,r.value=null}}function q(C){const P=[],V=(S,N)=>{const $=S.part_id,ne=n.parts,me=[...ne.common,...ne.individual];for(const De of me)if(De.parts.find(z=>z.id===$)&&De.type===C){P.push({path:N,component:S});break}S.slots&&Object.entries(S.slots).forEach(([De,Te])=>{Array.isArray(Te)&&Te.forEach((z,I)=>{V(z,`${N}.slots.${De}.${I}`)})})};return n.page.forEach((S,N)=>{V(S,`page.${N}`)}),P}function T(C,P){const V=Dn(P.body),S=x(V),N={id:"preview",part_id:P.id,...S},$=new Set;$.add(`${C.id}:${P.id}`);const ne=P.slots;if(ne){const me={};Object.entries(ne).forEach(([De,Te])=>{const z=Te.allowedParts;if(z&&z.length>0){const I=z[z.length-1],G=n.parts,pe=[...G.common,...G.individual];let Ae=null,ye=null;for(const U of pe){const X=U.parts.find(ze=>ze.id===I);if(X){Ae=U,ye=X;break}}if(Ae&&ye){const U=R(Ae,ye.id,$);me[De]=[U]}else me[De]=[]}else me[De]=[]}),Object.keys(me).length>0&&(N.slots=me)}return N}function R(C,P,V=new Set){const S=P&&C.parts.find(Te=>Te.id===P)||C.parts[0];if(!S)throw new Error(`Part not found for type: ${C.type}`);const N=`${C.id}:${S.id}`;if(V.has(N)){const Te=Dn(S.body),z=x(Te);return{id:"preview",part_id:S.id,...z}}V.add(N);const $=Dn(S.body),ne=x($),me={id:"preview",part_id:S.id,...ne},De=S.slots;if(De){const Te={};Object.entries(De).forEach(([z,I])=>{const G=I.allowedParts;if(G&&G.length>0){const pe=G[G.length-1],Ae=n.parts,ye=[...Ae.common,...Ae.individual];let U=null,X=null;for(const ze of ye){const Ve=ze.parts.find(j=>j.id===pe);if(Ve){U=ze,X=Ve;break}}if(U&&X){const ze=R(U,X.id,V);Te[z]=[ze]}else Te[z]=[]}else Te[z]=[]}),Object.keys(Te).length>0&&(me.slots=Te)}return me}function H(C,P){if(!P)return"";const V=T(C,P);return ei(P.body,V,"",S=>{const N=n.parts,$=[...N.common,...N.individual,...N.special];for(const ne of $){const me=ne.parts.find(De=>De.id===S);if(me)return me}return null},(S,N)=>u(S,N),!1,n.images.common,n.images.individual,n.images.special)}function F(C){const P=[];try{const N=new DOMParser().parseFromString(`<template>${C}</template>`,"text/html").querySelector("template");if(!N)return P;N.content.querySelectorAll("[z-slot]").forEach(ne=>{const me=ne.getAttribute("z-slot")||"default";P.includes(me)||P.push(me)})}catch(V){console.error("Failed to parse template:",V)}return P}function L(C){if(i.value&&i.value.partIndex===C){const P=i.value.part.body,V=F(P),S=Object.keys(i.value.part.slots||{});return V.filter(N=>!S.includes(N))}return[]}function B(C,P){let V=P||null;if(!V&&(V=prompt("スロット名を入力してください:"),!V?.trim()))return;g(C,V.trim(),N=>{if(N[V.trim()]){alert("このスロット名は既に存在します");return}N[V.trim()]={}})||alert("パーツが見つかりません")}function te(C,P){y(C)?.[P]&&confirm(`スロット「${P}」を削除しますか?`)&&g(C,P,S=>{delete S[P]})}function K(C,P,V){g(C,P,N=>{N[P]&&(N[P].allowedParts=V)})||console.warn(`Failed to update allowed parts for slot ${P}`)}function ae(C,P){if(!c.value){c.value={type:C.type,partIndex:P};return}if(c.value.type===C.type&&c.value.partIndex===P){Y();return}const V=c.value,S={type:C.type,partIndex:P};if(!Q(V,S)){alert("同じタイプ内のパーツのみ並べ替えできます"),Y();return}Z(V,S),Y()}function Q(C,P){return!(C.type!==P.type||C.partIndex===P.partIndex)}function Z(C,P){const V=h(),S=V.findIndex(me=>me.type===C.type);if(S===-1)return;const $=V[S].parts,[ne]=$.splice(C.partIndex,1);$.splice(P.partIndex,0,ne)}function Y(){c.value=null}function J(C){const P=h(),V=q(C);if(V.length>0){if(!confirm(`タイプ「${C}」は${V.length}箇所で使用されています。削除しますか?`))return}else if(!confirm(`タイプ「${C}」を削除しますか?`))return;for(let S=P.length-1;S>=0;S--)P[S].type===C&&P.splice(S,1)}function ee(C,P){if(C===P)return;const V=h(),S=new Map,N=[];V.forEach(Te=>{S.has(Te.type)||(S.set(Te.type,[]),N.push(Te.type)),S.get(Te.type).push(Te)});const $=N.map(Te=>({type:Te,types:S.get(Te)})),ne=$.findIndex(Te=>Te.type===C),me=$.findIndex(Te=>Te.type===P);if(ne===-1||me===-1)return;const[De]=$.splice(ne,1);$.splice(me,0,De),V.splice(0,V.length),$.forEach(Te=>{Te.types.forEach(z=>V.push(z))})}function de(C){if(!d.value){d.value=C;return}if(d.value===C){d.value=null;return}ee(d.value,C),d.value=null}function we(){r.value=null,s.value=null,l.value=!1}function Ne(){i.value=null,s.value=null}function Pe(C){const P=[];if(!C.type||C.type.trim()==="")P.push("タイプ名は必須です");else if(l.value){const V=n.parts;[...V.common,...V.individual].some($=>$.type===C.type.trim())&&P.push(`タイプ「${C.type}」は既に存在します`)}return!C.parts||C.parts.length===0?P.push("最低1つのパーツが必要です"):C.parts.forEach((V,S)=>{(!V.title||V.title.trim()==="")&&P.push(`パーツ ${S+1} のタイトルは必須です`),(!V.body||V.body.trim()==="")&&P.push(`パーツ ${S+1} のテンプレートは必須です`)}),{valid:P.length===0,errors:P}}return{reorderSourcePart:c,handleReorderClick:ae,canReorderParts:Q,cancelReorder:Y,activeCategory:t,selectedType:o,editingType:r,editingPart:i,editingLevel:s,isCreatingNew:l,currentTypes:f,groupedPartsByType:p,selectType:M,startCreating:E,startEditingType:v,startEditingPart:_,addPartToType:A,saveType:b,savePart:w,deletePart:O,checkTypeUsage:q,cancelEditingType:we,cancelEditingPart:Ne,getPartPreviewHtml:H,validateType:Pe,addPartSlot:B,removePartSlot:te,updatePartSlotAllowedParts:K,getAvailableSlotsForPart:L,extractSlotsFromTemplate:F,reorderSourceType:d,startReorderType:de,deletePartType:J}}function Uh(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,o=Array(e);t<e;t++)o[t]=n[t];return o}function WN(n){if(Array.isArray(n))return n}function qN(n,e,t){return(e=ZN(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function GN(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var o,r,i,s,l=[],c=!0,d=!1;try{if(i=(t=t.call(n)).next,e!==0)for(;!(c=(o=i.call(t)).done)&&(l.push(o.value),l.length!==e);c=!0);}catch(u){d=!0,r=u}finally{try{if(!c&&t.return!=null&&(s=t.return(),Object(s)!==s))return}finally{if(d)throw r}}return l}}function KN(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
472
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Wh(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,o)}return t}function qh(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Wh(Object(t),!0).forEach(function(o){qN(n,o,t[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Wh(Object(t)).forEach(function(o){Object.defineProperty(n,o,Object.getOwnPropertyDescriptor(t,o))})}return n}function JN(n,e){if(n==null)return{};var t,o,r=XN(n,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);for(o=0;o<i.length;o++)t=i[o],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(r[t]=n[t])}return r}function XN(n,e){if(n==null)return{};var t={};for(var o in n)if({}.hasOwnProperty.call(n,o)){if(e.indexOf(o)!==-1)continue;t[o]=n[o]}return t}function YN(n,e){return WN(n)||GN(n,e)||eT(n,e)||KN()}function QN(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var o=t.call(n,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function ZN(n){var e=QN(n,"string");return typeof e=="symbol"?e:e+""}function eT(n,e){if(n){if(typeof n=="string")return Uh(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Uh(n,e):void 0}}function tT(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gh(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,o)}return t}function Kh(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Gh(Object(t),!0).forEach(function(o){tT(n,o,t[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Gh(Object(t)).forEach(function(o){Object.defineProperty(n,o,Object.getOwnPropertyDescriptor(t,o))})}return n}function nT(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return function(o){return e.reduceRight(function(r,i){return i(r)},o)}}function jr(n){return function e(){for(var t=this,o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return r.length>=n.length?n.apply(this,r):function(){for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];return e.apply(t,[].concat(r,l))}}}function Os(n){return{}.toString.call(n).includes("Object")}function oT(n){return!Object.keys(n).length}function Hr(n){return typeof n=="function"}function rT(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function iT(n,e){return Os(e)||ro("changeType"),Object.keys(e).some(function(t){return!rT(n,t)})&&ro("changeField"),e}function sT(n){Hr(n)||ro("selectorType")}function aT(n){Hr(n)||Os(n)||ro("handlerType"),Os(n)&&Object.values(n).some(function(e){return!Hr(e)})&&ro("handlersType")}function lT(n){n||ro("initialIsRequired"),Os(n)||ro("initialType"),oT(n)&&ro("initialContent")}function cT(n,e){throw new Error(n[e]||n.default)}var dT={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},ro=jr(cT)(dT),Ds={changes:iT,selector:sT,handler:aT,initial:lT};function uT(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ds.initial(n),Ds.handler(e);var t={current:n},o=jr(hT)(t,e),r=jr(pT)(t),i=jr(Ds.changes)(n),s=jr(fT)(t);function l(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(u){return u};return Ds.selector(d),d(t.current)}function c(d){nT(o,r,i,s)(d)}return[l,c]}function fT(n,e){return Hr(e)?e(n.current):e}function pT(n,e){return n.current=Kh(Kh({},n.current),e),e}function hT(n,e,t){return Hr(e)?e(n.current):Object.keys(t).forEach(function(o){var r;return(r=e[o])===null||r===void 0?void 0:r.call(e,n.current[o])}),t}var mT={create:uT},gT={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function yT(n){return function e(){for(var t=this,o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return r.length>=n.length?n.apply(this,r):function(){for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];return e.apply(t,[].concat(r,l))}}}function bT(n){return{}.toString.call(n).includes("Object")}function xT(n){return n||Xh("configIsRequired"),bT(n)||Xh("configType"),n.urls?(kT(),{paths:{vs:n.urls.monacoBase}}):n}function kT(){console.warn(Jh.deprecation)}function ET(n,e){throw new Error(n[e]||n.default)}var Jh={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
477
473
  You are using deprecated way of configuration.
478
474
 
479
475
  Instead of using
@@ -482,8 +478,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
482
478
  monaco.config({ paths: { vs: '...' } })
483
479
 
484
480
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
485
- `},Im=IT(PT)(Mm),LT={config:DT},$T=function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return function(r){return n.reduceRight(function(i,s){return s(i)},r)}};function Om(t,e){return Object.keys(e).forEach(function(n){e[n]instanceof Object&&t[n]&&Object.assign(e[n],Om(t[n],e[n]))}),zm(zm({},t),e)}var VT={type:"cancelation",msg:"operation is manually canceled"};function Nc(t){var e=!1,n=new Promise(function(o,r){t.then(function(i){return e?r(VT):o(i)}),t.catch(r)});return n.cancel=function(){return e=!0},n}var BT=["monaco"],FT=AT.create({config:MT,isInitialized:!1,resolve:null,reject:null,monaco:null}),Dm=fT(FT,2),ti=Dm[0],Js=Dm[1];function jT(t){var e=LT.config(t),n=e.monaco,o=dT(e,BT);Js(function(r){return{config:Om(r.config,o),monaco:n}})}function UT(){var t=ti(function(e){var n=e.monaco,o=e.isInitialized,r=e.resolve;return{monaco:n,isInitialized:o,resolve:r}});if(!t.isInitialized){if(Js({isInitialized:!0}),t.monaco)return t.resolve(t.monaco),Nc(Cc);if(window.monaco&&window.monaco.editor)return Rm(window.monaco),t.resolve(window.monaco),Nc(Cc);$T(HT,GT)(qT)}return Nc(Cc)}function HT(t){return document.body.appendChild(t)}function WT(t){var e=document.createElement("script");return t&&(e.src=t),e}function GT(t){var e=ti(function(o){var r=o.config,i=o.reject;return{config:r,reject:i}}),n=WT("".concat(e.config.paths.vs,"/loader.js"));return n.onload=function(){return t()},n.onerror=e.reject,n}function qT(){var t=ti(function(n){var o=n.config,r=n.resolve,i=n.reject;return{config:o,resolve:r,reject:i}}),e=window.require;e.config(t.config),e(["vs/editor/editor.main"],function(n){var o=n.m||n;Rm(o),t.resolve(o)},function(n){t.reject(n)})}function Rm(t){ti().monaco||Js({monaco:t})}function KT(){return ti(function(t){var e=t.monaco;return e})}var Cc=new Promise(function(t,e){return Js({resolve:t,reject:e})}),JT={config:jT,init:UT,__getMonacoInstance:KT};const XT={class:"monaco-editor-wrapper"},YT={key:0,class:"monaco-editor-error"},Pm=((t,e)=>{const n=t.__vccOpts||t;for(const[o,r]of e)n[o]=r;return n})(a.defineComponent({__name:"MonacoEditor",props:{modelValue:{type:String},language:{type:String},theme:{type:String},readOnly:{type:Boolean},minimap:{type:Boolean},height:{type:String},autoHeight:{type:Boolean},maxHeight:{type:Number},enableSuggestions:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=e,r=a.ref(null),i=a.ref(null);let s=null,l=null,c=!1,d=[];function u(){const p=r.value;if(!p)return;const h=p.getRootNode();if(!(h instanceof ShadowRoot))return;const m=h;Array.from(document.head.querySelectorAll('style, link[rel="stylesheet"]')).filter(x=>{if(x.tagName==="LINK"){const w=x.href||"";return w.includes("monaco")||w.includes("/vs/")||w.includes("vs/")}const v=x.textContent||"";return v.includes(".monaco-editor")||v.includes(".monaco-editor-background")}).forEach(x=>{if(x.tagName==="LINK"){const w=x.href;if(!!m.querySelector(`link[rel="stylesheet"][href="${w}"]`))return}else{const w=x.getAttribute("data-name")||"";if(w&&!!m.querySelector(`style[data-name="${w}"]`))return}const v=x.cloneNode(!0);v.setAttribute("data-zcode-monaco-style","true"),m.appendChild(v),d.push(v)})}function f(){if(!(!s||!r.value||!l)&&n.autoHeight!==!1)try{const p=s.getOption(l.editor.EditorOption.lineHeight)||19;let b=(s.getModel()?.getLineCount()||1)*p+20;n.maxHeight!==void 0&&(b=Math.min(b,n.maxHeight)),r.value.style.height=`${b}px`,s.layout()}catch{r.value.style.height="200px"}}return a.onMounted(async()=>{if(r.value)try{l=await JT.init(),u(),l.languages.registerCompletionItemProvider("html",{provideCompletionItems:(h,m)=>{const b=h.getWordUntilPosition(m),g={startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:b.startColumn,endColumn:b.endColumn},x=h.getValueInRange({startLineNumber:m.lineNumber,startColumn:Math.max(1,m.column-10),endLineNumber:m.lineNumber,endColumn:m.column}),v=[];return(x.endsWith("$")||x.endsWith("{$"))&&v.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:textarea}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:textarea}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストエリアフィールド: {$変数名:デフォルト値:textarea}",detail:"テンプレート記法 - テキストエリア",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:rich}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:image}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}}),(x.endsWith("(")||x.endsWith("$("))&&v.push({label:"($field:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"ラジオボタン: ($フィールド名:選択肢1|選択肢2)",detail:"テンプレート記法 - ラジオボタン",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"チェックボックス: ($フィールド名:選択肢1,選択肢2)",detail:"テンプレート記法 - チェックボックス",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field@:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(単一選択): ($フィールド名@:選択肢1|選択肢2)",detail:"テンプレート記法 - セレクトボックス",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field@:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(複数選択): ($フィールド名@:選択肢1,選択肢2)",detail:"テンプレート記法 - セレクトボックス(複数)",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}}),(x.endsWith("z-")||x.endsWith(" z-"))&&v.push({label:'z-if="show_xxx"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-if="show_${1:field}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"条件分岐: z-if属性(フィールドがtrueの場合に表示)",detail:"テンプレート記法 - 条件分岐",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-2,endColumn:m.column}},{label:'z-slot="slotName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-2,endColumn:m.column}}),v.length===0&&v.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:g},{label:"{$field:default:rich}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:g},{label:"{$field:default:image}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:g},{label:"($field:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"ラジオボタン: ($フィールド名:選択肢1|選択肢2)",detail:"テンプレート記法 - ラジオボタン",range:g},{label:"($field:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"チェックボックス: ($フィールド名:選択肢1,選択肢2)",detail:"テンプレート記法 - チェックボックス",range:g},{label:"($field@:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(単一選択): ($フィールド名@:選択肢1|選択肢2)",detail:"テンプレート記法 - セレクトボックス",range:g},{label:"($field@:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(複数選択): ($フィールド名@:選択肢1,選択肢2)",detail:"テンプレート記法 - セレクトボックス(複数)",range:g},{label:'z-if="show_xxx"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-if="show_${1:field}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"条件分岐: z-if属性(フィールドがtrueの場合に表示)",detail:"テンプレート記法 - 条件分岐",range:g},{label:'z-tag="$tagName:h1|h2|h3"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-tag="$${1:tagName}:${2:h1|h2|h3}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"タグ名を動的に変更(選択肢を指定可能)",detail:"テンプレート記法 - タグ名の動的変更",range:g},{label:'z-empty="$fieldName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-empty="$${1:fieldName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"オプショナルフィールドが空の場合、親要素を削除",detail:"テンプレート記法 - 条件分岐(空の場合削除)",range:g},{label:'z-slot="slotName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:g}),{suggestions:v}},triggerCharacters:["$","(","z"]});const p=n.enableSuggestions!==!1;s=l.editor.create(r.value,{value:n.modelValue||"",language:n.language||"html",theme:n.theme||"vs-dark",readOnly:n.readOnly||!1,minimap:{enabled:n.minimap===!0},automaticLayout:!0,fontSize:14,tabSize:2,wordWrap:"off",scrollBeyondLastLine:!1,formatOnPaste:!0,formatOnType:!0,lineNumbers:"on",folding:!0,suggestOnTriggerCharacters:p,quickSuggestions:p?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:p,acceptSuggestionOnEnter:p?"on":"off",suggestSelection:"first",mouseWheelScrollSensitivity:1,fastScrollSensitivity:5,scrollbar:{alwaysConsumeMouseWheel:!1}}),s.onDidChangeModelContent(()=>{if(!c){const h=s.getValue();o("update:modelValue",h),f()}}),f()}catch(p){i.value=`Monaco Editorの読み込みに失敗しました: ${p}`,console.error("Monaco Editor error:",p)}}),a.watch(()=>n.modelValue,async p=>{s&&s.getValue()!==p&&(c=!0,await a.nextTick(),s.setValue(p||""),c=!1,f())}),a.watch(()=>n.enableSuggestions,p=>{if(s&&l){const h=p!==!1;s.updateOptions({suggestOnTriggerCharacters:h,quickSuggestions:h?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:h,acceptSuggestionOnEnter:h?"on":"off"})}}),a.onUnmounted(()=>{s&&(s.dispose(),s=null),d.forEach(p=>p.remove()),d=[]}),(p,h)=>(a.openBlock(),a.createElementBlock("div",XT,[a.createElementVNode("div",{ref_key:"editorContainer",ref:r,class:"monaco-editor-container"},null,512),i.value?(a.openBlock(),a.createElementBlock("div",YT,a.toDisplayString(i.value),1)):a.createCommentVNode("",!0)]))}}),[["styles",[".monaco-editor-wrapper{width:100%}.monaco-editor-container{width:100%;min-height:100px;max-height:400px;border:1px solid #d1d5db;border-radius:4px;overflow:hidden}.monaco-editor-error{padding:8px;background:#fee;color:#c33;border-radius:4px;margin-top:8px;font-size:12px}"]]]),QT={class:"zcode-parts-manager"},ZT={class:"zcode-parts-category-tabs"},ez={class:"zcode-parts-category-tab-group"},tz=["onClick"],nz=["title"],oz={class:"zcode-parts-add-wrapper"},rz={class:"zcode-parts-manager-content"},iz={class:"zcode-parts-items"},sz={class:"zcode-part-type-title",role:"heading","aria-level":"5"},az={class:"zcode-part-type-actions"},lz=["title","onClick"],cz=["title","onClick"],dz=["title","onClick"],uz={class:"zcode-part-type-items"},fz=["onClick"],pz={key:0,class:"zcode-reorder-source-indicator"},hz={class:"zcode-part-item-header"},mz={class:"zcode-part-type"},gz={class:"zcode-part-item-actions"},bz=["title","onClick"],yz=["title","onClick"],xz=["title","onClick"],Ez={class:"zcode-part-item-content"},kz={class:"zcode-part-modules"},wz={key:0,class:"zcode-part-preview"},Sz=["innerHTML"],Nz=["onClick"],Cz={class:"zcode-part-item-add-content"},vz={class:"zcode-part-editor-header"},Tz={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},zz=["aria-label"],_z={class:"zcode-part-editor-form"},Az={class:"zcode-form-field"},Mz=["placeholder"],Iz={class:"zcode-form-field"},Oz=["placeholder"],Dz={class:"zcode-part-editor-actions"},Rz={class:"zcode-part-editor-header"},Pz={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},Lz=["aria-label"],$z={class:"zcode-part-editor-form"},Vz={class:"zcode-part-editor-topbar"},Bz={class:"zcode-part-editor-topfields"},Fz={class:"zcode-form-field"},jz={class:"zcode-form-field"},Uz=["placeholder"],Hz={class:"zcode-part-editor-main"},Wz={class:"zcode-part-editor-pane zcode-part-editor-pane--code"},Gz={class:"zcode-part-editor-pane-header"},qz=["aria-label"],Kz=["aria-selected"],Jz=["aria-selected"],Xz={class:"zcode-part-editor-pane-header-actions"},Yz={key:0,class:"zcode-css-warning-compact"},Qz={class:"zcode-css-warning-compact-text"},Zz=["title"],e_={key:1,class:"zcode-checkbox-label zcode-checkbox-label-inline"},t_=["title"],n_={class:"zcode-part-editor-pane-body"},o_={class:"zcode-part-editor-pane zcode-part-editor-pane--side"},r_={class:"zcode-part-editor-pane-body"},i_=["innerHTML"],s_={class:"zcode-part-editor-preview-hint"},a_={key:0,class:"zcode-part-editor-slots-bottom"},l_={class:"zcode-slots-config"},c_={class:"zcode-slot-config-header"},d_={class:"zcode-slot-config-title"},u_=["onClick"],f_={class:"zcode-slot-config-body"},p_={class:"zcode-checkbox-group"},h_=["onUpdate:modelValue","placeholder"],m_=["checked","onChange"],g_={key:0,class:"zcode-slot-add-section"},b_={class:"zcode-slot-add-controls"},y_={value:""},x_=["value"],E_=["disabled"],k_={class:"zcode-part-editor-actions"},w_={class:"zcode-preview-modal-header"},S_={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},N_=["innerHTML"],C_={class:"zcode-help-modal-header"},v_={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},T_=["aria-label"],z_={class:"zcode-help-modal-body"},__={class:"zcode-warning-content"},A_={class:"zcode-warning-text"},M_={class:"zcode-warning-list"},I_={class:"zcode-css-warning-modal-footer"},O_={class:"zcode-checkbox-label",style:{"margin-bottom":"12px"}},D_={class:"zcode-help-modal-header"},R_={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},P_=["aria-label"],L_={class:"zcode-help-modal-body"},$_={class:"zcode-help-section"},V_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},B_={class:"zcode-help-section-item"},F_={class:"zcode-help-section"},j_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},U_={class:"zcode-help-section-item"},H_={class:"zcode-help-section"},W_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},G_={class:"zcode-help-section-item"},q_={class:"zcode-help-modal-header"},K_={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},J_=["aria-label"],X_={class:"zcode-help-modal-body"},Y_={class:"zcode-help-table"},Q_={class:"zcode-help-section"},Z_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},eA={role:"list",class:"zcode-help-section-list"},tA=["innerHTML"],nA={role:"listitem",class:"zcode-help-section-item"},oA={role:"listitem",class:"zcode-help-section-item"},rA=a.defineComponent({__name:"PartsManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.ref(!1),i=a.ref(m1("enableTemplateSuggestions",!1)),s=a.ref(!1),l=a.ref(!1),c=a.ref(!1),d=a.ref(g1()),u=a.ref("html"),f=a.ref(""),p=a.ref(""),h={common:"zcode-css-style-parts-manager-preview-common",individual:"zcode-css-style-parts-manager-preview-individual",special:"zcode-css-style-parts-manager-preview-special"},m=new Map,b=a.computed(()=>O.value==="common"?o.cmsData.css?.common??"":O.value==="individual"?o.cmsData.css?.individual??"":o.cmsData.css?.special??"");function g(B){["common","individual","special"].forEach(ie=>{const le=B[ie];if(!le||!le.trim()){const Fe=m.get(ie);Fe&&(Fe.remove(),m.delete(ie));return}let we=m.get(ie);we||(we=document.createElement("style"),we.id=h[ie],we.setAttribute("data-zcode-css","true"),we.setAttribute("data-zcode-css-parts-preview","true"),we.setAttribute("data-zcode-css-category",ie),we.parentNode||document.head.appendChild(we),m.set(ie,we)),we.textContent=le})}function x(){m.forEach(B=>{B.remove()}),m.clear()}function v(){s.value=!0}function w(){s.value=!1}function T(){(O.value==="common"||O.value==="individual"||O.value==="special")&&(l.value=!0)}function M(){l.value=!1,b1(d.value)}a.watch(i,B=>{Ba({enableTemplateSuggestions:B})});const A=a.computed(()=>o.config?.categoryOrder||"common"),y=a.computed(()=>{const B=[],U=o.cmsData.parts.special.length>0;return A.value==="individual"?(B.push("individual","common"),U&&B.push("special")):A.value==="special"?(U&&B.push("special"),B.push("common","individual")):(B.push("common","individual"),U&&B.push("special")),B}),{reorderSourcePart:E,handleReorderClick:k,activeCategory:O,editingType:G,editingPart:z,editingLevel:R,isCreatingNew:W,groupedPartsByType:H,startCreating:L,startEditingType:j,startEditingPart:Z,addPartToType:K,saveType:ae,savePart:ee,deletePart:X,checkTypeUsage:Y,cancelEditingType:J,cancelEditingPart:Q,getPartPreviewHtml:de,addPartSlot:ke,removePartSlot:Te,updatePartSlotAllowedParts:$e,getAvailableSlotsForPart:N,extractSlotsFromTemplate:P,reorderSourceType:V,startReorderType:S,deletePartType:C}=iT(o.cmsData);o.config?.categoryOrder==="individual"&&(O.value="individual");const $=a.computed(()=>(R?.value??R)==="part"&&!!z.value);a.watch(()=>$.value,B=>{if(!B){x();return}a.nextTick(()=>{const U=b.value;p.value=U,f.value=U,g({common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special})})},{immediate:!0}),a.watch(()=>O.value,()=>{$.value&&a.nextTick(()=>{const B=b.value;p.value=B,f.value=B})}),a.watch([()=>f.value,()=>$.value,()=>O.value],([B,U,ie])=>{U&&a.nextTick(()=>{const le={common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special};ie==="common"?le.common=B??"":ie==="individual"?le.individual=B??"":le.special=B??"",g(le)})});async function te(){await ee(),!z.value&&o.cmsData.css&&(O.value==="common"?o.cmsData.css.common=f.value:O.value==="individual"?o.cmsData.css.individual=f.value:o.cmsData.css.special=f.value,p.value=f.value)}function ge(){f.value=p.value,x(),r.value=!1,Q()}a.onBeforeUnmount(()=>{x()}),a.watch(()=>z.value,B=>{B&&(u.value="html")}),a.watch(()=>u.value,B=>{B==="css"&&$.value&&(O.value==="common"||O.value==="individual"||O.value==="special")&&!d.value&&a.nextTick(()=>{T()})}),e({activeCategory:O});async function Re(){await ae()}const ve=a.computed(()=>z.value?N(z.value.partIndex):[]),_=a.computed(()=>{if(!z.value)return!1;const B=z.value.part.body,U=B?P(B).length>0:!1,ie=z.value.part.slots&&Object.keys(z.value.part.slots).length>0;return U||ie}),I=a.ref(""),q=()=>{!I.value||!z.value||(ke(z.value.partIndex,I.value),I.value="")};a.watch(()=>z.value?.part.body,()=>{I.value=""});const pe=a.computed(()=>{const B=[],U=o.cmsData.parts;return[...U.common,...U.individual,...U.special||[]].forEach(le=>{le.parts.forEach(we=>{B.push({id:we.id,title:we.title,typeName:le.type,description:we.description})})}),B.sort((le,we)=>le.typeName!==we.typeName?le.typeName.localeCompare(we.typeName):le.title.localeCompare(we.title))}),Ae=a.ref({}),ze=B=>{const U=Ae.value[B]||"";if(!U)return pe.value;const ie=U.toLowerCase();return pe.value.filter(le=>le.title.toLowerCase().includes(ie)||le.typeName.toLowerCase().includes(ie))},Se=B=>{if(!z.value)return[];const U=z.value.part.slots?.[B];return U?U.allowedParts||[]:[]},F=(B,U,ie)=>{if(!z.value)return;const le=ie.target.checked,Fe=z.value.part.slots?.[B]?.allowedParts||[];let st;le?st=[...Fe,U]:st=Fe.filter(xn=>xn!==U),$e(z.value.partIndex,B,st)};function ne(B,U){const ie=["zcode-part-item"];return E.value&&E.value.type===B.type&&E.value.partIndex===U&&ie.push("zcode-reorder-source"),ie.join(" ")}function Me(B){const U=B._partIndex,ie=U!=null,le=ie&&U!==void 0?U+1:0,we=B.parts.length;if(ie&&we>1){if(!confirm(n("partsManager.deletePartConfirm",{number:le})))return}else{const Fe=Y(B.type);if(Fe.length>0){if(!confirm(n("partsManager.deleteTypeWithUsagesConfirm",{type:B.type,count:Fe.length})))return}else if(!confirm(n("partsManager.deleteTypeConfirm")))return}X(B)}return(B,U)=>(a.openBlock(),a.createElementBlock("div",QT,[a.createElementVNode("div",ZT,[a.createElementVNode("div",ez,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(y.value,ie=>(a.openBlock(),a.createElementBlock("button",{key:ie,class:a.normalizeClass([{active:a.unref(O)===ie},"zcode-category-tab"]),onClick:le=>O.value=ie},a.toDisplayString(ie==="common"?B.$t("dataViewer.common"):ie==="individual"?B.$t("dataViewer.individual"):B.$t("dataViewer.special")),11,tz))),128)),a.createElementVNode("button",{class:"zcode-help-btn",title:B.$t("dataViewer.categoryInfo.title"),onClick:U[0]||(U[0]=ie=>c.value=!0)},[a.createVNode(a.unref(Vn),{size:14})],8,nz)]),a.createElementVNode("div",oz,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-parts-new-btn",onClick:U[1]||(U[1]=(...ie)=>a.unref(L)&&a.unref(L)(...ie))},[a.createVNode(a.unref(uo),{size:14}),a.createElementVNode("span",null,a.toDisplayString(B.$t("partsManager.createType")),1)])])]),a.createElementVNode("div",rz,[a.createElementVNode("div",iz,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(H),ie=>(a.openBlock(),a.createElementBlock("div",{key:ie.type,class:"zcode-part-type-group"},[a.createElementVNode("div",sz,[a.createTextVNode(a.toDisplayString(ie.type)+" ",1),a.createElementVNode("div",az,[ie.parts.length>0?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-part-type-edit-btn",title:B.$t("partsManager.editTypeButton"),onClick:a.withModifiers(le=>a.unref(j)(ie.parts[0]),["stop"])},[a.createVNode(a.unref(oa),{size:14})],8,lz)):a.createCommentVNode("",!0),a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(V)===ie.type}]),title:B.$t("partsManager.reorderType"),onClick:a.withModifiers(le=>a.unref(S)(ie.type),["stop"])},[a.createVNode(a.unref(ir),{size:14})],10,cz),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:B.$t("partsManager.deleteTypeButton"),onClick:a.withModifiers(le=>a.unref(C)(ie.type),["stop"])},[a.createVNode(a.unref(Bn),{size:14})],8,dz)])]),a.createElementVNode("div",uz,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(ie.parts,(le,we)=>(a.openBlock(),a.createElementBlock("div",{key:`${ie.type}-${we}`,class:a.normalizeClass(ne(le,le._partIndex??0)),onClick:Fe=>a.unref(Z)(le,le._partIndex??0)},[a.unref(E)&&a.unref(E).type===le.type&&a.unref(E).partIndex===(le._partIndex??0)?(a.openBlock(),a.createElementBlock("div",pz,a.toDisplayString(B.$t("partsManager.source")),1)):a.createCommentVNode("",!0),a.createElementVNode("div",hz,[a.createElementVNode("span",mz,a.toDisplayString(le._displayPart?.title||le.type),1),a.createElementVNode("div",gz,[a.createElementVNode("button",{class:"zcode-action-btn",title:B.$t("partsManager.editPartButton"),onClick:a.withModifiers(Fe=>a.unref(Z)(le,le._partIndex??0),["stop"])},[a.createVNode(a.unref(oa),{size:14})],8,bz),a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(E)?.type===le.type&&a.unref(E)?.partIndex===(le._partIndex??0)}]),title:B.$t("partsManager.reorderPart"),onClick:a.withModifiers(Fe=>a.unref(k)(le,le._partIndex??0),["stop"])},[a.createVNode(a.unref(ir),{size:14})],10,yz),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:B.$t("partsManager.deletePartButton"),onClick:a.withModifiers(Fe=>Me({...le,_partIndex:le._partIndex??0}),["stop"])},[a.createVNode(a.unref(Bn),{size:14})],8,xz)])]),a.createElementVNode("div",Ez,[a.createElementVNode("div",{class:a.normalizeClass(["zcode-part-description",{"zcode-description-empty":!le._displayPart?.description&&!le.description}])},a.toDisplayString(le._displayPart?.description||le.description||B.$t("partsManager.noDescription")),3),a.createElementVNode("div",kz,a.toDisplayString(B.$t("partsManager.partNumber",{current:(le._partIndex??0)+1,total:le.parts.length})),1),le._displayPart?(a.openBlock(),a.createElementBlock("div",wz,[a.createElementVNode("div",{class:"zcode-part-preview-content",innerHTML:a.unref(de)(le,le._displayPart)},null,8,Sz)])):a.createCommentVNode("",!0)])],10,fz))),128)),ie.parts.length>0?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-item zcode-part-item-add",onClick:a.withModifiers(le=>a.unref(K)(ie.parts[0]),["stop"])},[a.createElementVNode("div",Cz,[a.createVNode(a.unref(uo),{size:20}),a.createElementVNode("span",null,a.toDisplayString(B.$t("partsManager.addPart")),1)])],8,Nz)):a.createCommentVNode("",!0)])]))),128))]),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(G)&&(a.unref(R)==="type"||a.unref(W))?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:U[7]||(U[7]=a.withModifiers((...ie)=>a.unref(J)&&a.unref(J)(...ie),["self"]))},[a.createElementVNode("div",{class:"zcode-part-modal-content",onClick:U[6]||(U[6]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",vz,[a.createElementVNode("div",Tz,a.toDisplayString(a.unref(W)?B.$t("partsManager.createType"):B.$t("partsManager.editType")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":B.$t("common.close"),onClick:U[2]||(U[2]=(...ie)=>a.unref(J)&&a.unref(J)(...ie))},[a.createVNode(a.unref(Qe),{size:18})],8,zz)]),a.createElementVNode("div",_z,[a.createElementVNode("div",Az,[a.createElementVNode("label",null,[a.createTextVNode(a.toDisplayString(B.$t("partsManager.typeName"))+" ",1),U[27]||(U[27]=a.createElementVNode("span",{class:"zcode-required"},"*",-1))]),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":U[3]||(U[3]=ie=>a.unref(G).type=ie),type:"text",placeholder:B.$t("partsManager.typeNamePlaceholder"),class:"zcode-text-input",required:""},null,8,Mz),[[a.vModelText,a.unref(G).type]])]),a.createElementVNode("div",Iz,[a.createElementVNode("label",null,a.toDisplayString(B.$t("partsManager.typeDescription")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":U[4]||(U[4]=ie=>a.unref(G).description=ie),type:"text",placeholder:B.$t("partsManager.typeDescriptionPlaceholder"),class:"zcode-text-input"},null,8,Oz),[[a.vModelText,a.unref(G).description]])])]),a.createElementVNode("div",Dz,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:Re},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(B.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:U[5]||(U[5]=(...ie)=>a.unref(J)&&a.unref(J)(...ie))},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(B.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(z)&&a.unref(R)==="part"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:a.withModifiers(ge,["self"])},[a.createElementVNode("div",{class:"zcode-part-modal-content",onClick:U[17]||(U[17]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",Rz,[a.createElementVNode("div",Pz,a.toDisplayString(B.$t("partsManager.editPart",{title:a.unref(z).part.title})),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":B.$t("common.close"),onClick:ge},[a.createVNode(a.unref(Qe),{size:18})],8,Lz)]),a.createElementVNode("div",$z,[a.createElementVNode("div",Vz,[a.createElementVNode("div",Bz,[a.createElementVNode("div",Fz,[a.createElementVNode("label",null,[a.createTextVNode(a.toDisplayString(B.$t("partsManager.partTitle"))+" ",1),U[28]||(U[28]=a.createElementVNode("span",{class:"zcode-required"},"*",-1))]),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":U[8]||(U[8]=ie=>a.unref(z).part.title=ie),type:"text",class:"zcode-text-input",required:""},null,512),[[a.vModelText,a.unref(z).part.title]])]),a.createElementVNode("div",jz,[a.createElementVNode("label",null,a.toDisplayString(B.$t("partsManager.partDescription")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":U[9]||(U[9]=ie=>a.unref(z).part.description=ie),type:"text",class:"zcode-text-input",placeholder:B.$t("partsManager.partDescriptionPlaceholder")},null,8,Uz),[[a.vModelText,a.unref(z).part.description]])])])]),a.createElementVNode("div",Hz,[a.createElementVNode("div",Wz,[a.createElementVNode("div",Gz,[a.createElementVNode("div",{class:"zcode-template-tabs",role:"tablist","aria-label":B.$t("partsManager.codeEdit")},[a.createElementVNode("button",{type:"button",class:a.normalizeClass(["zcode-template-tab",{active:u.value==="html"}]),role:"tab","aria-selected":u.value==="html",onClick:U[10]||(U[10]=ie=>u.value="html")}," HTML ",10,Kz),a.createElementVNode("button",{type:"button",class:a.normalizeClass(["zcode-template-tab",{active:u.value==="css"}]),role:"tab","aria-selected":u.value==="css",onClick:U[11]||(U[11]=ie=>u.value="css")}," CSS ",10,Jz)],8,qz),a.createElementVNode("div",Xz,[u.value==="css"?(a.openBlock(),a.createElementBlock("div",Yz,[a.createVNode(a.unref(na),{size:14,class:"zcode-css-warning-compact-icon"}),a.createElementVNode("span",Qz,a.toDisplayString(B.$t("partsManager.cssEditInfo")),1),a.createElementVNode("button",{class:"zcode-help-btn",type:"button",title:B.$t("partsManager.cssEditWarning"),onClick:T},[a.createVNode(a.unref(Vn),{size:14})],8,Zz)])):a.createCommentVNode("",!0),u.value==="html"?(a.openBlock(),a.createElementBlock("label",e_,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":U[12]||(U[12]=ie=>i.value=ie),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[a.vModelCheckbox,i.value]]),a.createElementVNode("span",null,a.toDisplayString(B.$t("partsManager.templateSuggestions")),1)])):a.createCommentVNode("",!0),u.value==="html"?(a.openBlock(),a.createElementBlock("button",{key:2,class:"zcode-help-btn",type:"button",title:B.$t("partsManager.templateHelpButton"),onClick:v},[a.createVNode(a.unref(Vn),{size:16})],8,t_)):a.createCommentVNode("",!0)])]),a.createElementVNode("div",n_,[u.value==="html"?(a.openBlock(),a.createBlock(Pm,{key:0,modelValue:a.unref(z).part.body,"onUpdate:modelValue":U[13]||(U[13]=ie=>a.unref(z).part.body=ie),language:"html",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":i.value,class:"zcode-monaco-editor"},null,8,["modelValue","enable-suggestions"])):(a.openBlock(),a.createBlock(Pm,{key:1,modelValue:f.value,"onUpdate:modelValue":U[14]||(U[14]=ie=>f.value=ie),language:"css",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":!0,class:"zcode-monaco-editor"},null,8,["modelValue"]))])]),a.createElementVNode("div",o_,[a.createElementVNode("div",r_,[a.createElementVNode("div",{class:"zcode-part-editor-preview-tab",onClick:U[15]||(U[15]=ie=>r.value=!0),innerHTML:a.unref(de)(a.unref(z).type,a.unref(z).part)},null,8,i_),a.createElementVNode("div",s_,a.toDisplayString(B.$t("partsManager.clickToEnlarge")),1)])])]),_.value?(a.openBlock(),a.createElementBlock("div",a_,[a.createElementVNode("div",l_,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(z).part.slots||{},(ie,le)=>(a.openBlock(),a.createElementBlock("div",{key:`part-${a.unref(z).partIndex}-${le}`,class:"zcode-slot-config-item"},[a.createElementVNode("div",c_,[a.createElementVNode("div",d_,a.toDisplayString(B.$t("partsManager.slot"))+": "+a.toDisplayString(le),1),a.createElementVNode("button",{class:"zcode-btn-small",onClick:we=>a.unref(Te)(a.unref(z).partIndex,le)},[a.createVNode(a.unref(Bn),{size:12})],8,u_)]),a.createElementVNode("div",f_,[a.createElementVNode("label",null,a.toDisplayString(B.$t("partsManager.allowedParts")),1),a.createElementVNode("div",p_,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":we=>Ae.value[le]=we,type:"text",placeholder:B.$t("partsManager.searchParts"),class:"zcode-text-input",style:{"margin-bottom":"8px"}},null,8,h_),[[a.vModelText,Ae.value[le]]]),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(ze(le),we=>(a.openBlock(),a.createElementBlock("label",{key:`allowed-${le}-${we.typeName}-${we.id}`,class:"zcode-checkbox-item"},[a.createElementVNode("input",{type:"checkbox",checked:Se(le).includes(we.id),class:"zcode-checkbox",onChange:Fe=>F(le,we.id,Fe)},null,40,m_),a.createElementVNode("span",null,a.toDisplayString(we.title)+" ("+a.toDisplayString(we.typeName)+")",1)]))),128))])])]))),128)),ve.value.length>0?(a.openBlock(),a.createElementBlock("div",g_,[a.createElementVNode("label",null,a.toDisplayString(B.$t("partsManager.addSlot")),1),a.createElementVNode("div",b_,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":U[16]||(U[16]=ie=>I.value=ie),class:"zcode-select-input"},[a.createElementVNode("option",y_,a.toDisplayString(B.$t("partsManager.selectSlot")),1),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(ve.value,ie=>(a.openBlock(),a.createElementBlock("option",{key:ie,value:ie},a.toDisplayString(ie==="default"?B.$t("partsManager.defaultSlot"):ie),9,x_))),128))],512),[[a.vModelSelect,I.value]]),a.createElementVNode("button",{disabled:!I.value,class:"zcode-btn-secondary",onClick:q},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(B.$t("common.add")),1)],8,E_)])])):a.createCommentVNode("",!0)])])):a.createCommentVNode("",!0)]),a.createElementVNode("div",k_,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:te},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(B.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:ge},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(B.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[r.value&&a.unref(z)?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:U[20]||(U[20]=ie=>r.value=!1)},[a.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:U[19]||(U[19]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",w_,[a.createElementVNode("div",S_,a.toDisplayString(B.$t("partsManager.preview"))+" "+a.toDisplayString(a.unref(z).part.title),1),a.createElementVNode("button",{class:"zcode-close-btn",onClick:U[18]||(U[18]=ie=>r.value=!1)},[a.createVNode(a.unref(Qe),{size:18})])]),a.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:a.unref(de)(a.unref(z).type,a.unref(z).part)},null,8,N_)])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[l.value&&(a.unref(O)==="common"||a.unref(O)==="individual"||a.unref(O)==="special")?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:a.withModifiers(M,["self"])},[a.createElementVNode("div",{class:"zcode-help-modal zcode-css-warning-modal",onClick:U[22]||(U[22]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",C_,[a.createElementVNode("div",v_,[a.createVNode(a.unref(Vc),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString(B.$t("partsManager.cssEditWarning")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":B.$t("common.close"),onClick:M},[a.createVNode(a.unref(Qe),{size:20})],8,T_)]),a.createElementVNode("div",z_,[a.createElementVNode("div",__,[a.createElementVNode("div",A_,[a.createElementVNode("ul",M_,[a.createElementVNode("li",null,[a.unref(O)==="common"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createTextVNode(a.toDisplayString(B.$t("partsManager.cssEditWarningMessageCommon")),1)],64)):a.unref(O)==="individual"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createTextVNode(a.toDisplayString(B.$t("partsManager.cssEditWarningMessageIndividual")),1)],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:2},[a.createTextVNode(a.toDisplayString(B.$t("partsManager.cssEditWarningMessageSpecial")),1)],64))])])])])]),a.createElementVNode("div",I_,[a.createElementVNode("label",O_,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":U[21]||(U[21]=ie=>d.value=ie),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[a.vModelCheckbox,d.value]]),a.createElementVNode("span",null,a.toDisplayString(B.$t("partsManager.dontShowAgain")),1)]),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:M},a.toDisplayString(B.$t("partsManager.understood")),1)])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[c.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:U[25]||(U[25]=a.withModifiers(ie=>c.value=!1,["self"]))},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:U[24]||(U[24]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",D_,[a.createElementVNode("div",R_,[a.createVNode(a.unref(na),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString(B.$t("dataViewer.categoryInfo.title")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":B.$t("common.close"),onClick:U[23]||(U[23]=ie=>c.value=!1)},[a.createVNode(a.unref(Qe),{size:18})],8,P_)]),a.createElementVNode("div",L_,[a.createElementVNode("div",$_,[a.createElementVNode("div",V_,a.toDisplayString(B.$t("dataViewer.categoryInfo.common.title")),1),a.createElementVNode("div",B_,a.toDisplayString(B.$t("dataViewer.categoryInfo.common.description")),1)]),a.createElementVNode("div",F_,[a.createElementVNode("div",j_,a.toDisplayString(B.$t("dataViewer.categoryInfo.individual.title")),1),a.createElementVNode("div",U_,a.toDisplayString(B.$t("dataViewer.categoryInfo.individual.description")),1)]),a.createElementVNode("div",H_,[a.createElementVNode("div",W_,a.toDisplayString(B.$t("dataViewer.categoryInfo.special.title")),1),a.createElementVNode("div",G_,a.toDisplayString(B.$t("dataViewer.categoryInfo.special.description")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[s.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:w},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:U[26]||(U[26]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",q_,[a.createElementVNode("div",K_,a.toDisplayString(B.$t("partsManager.templateHelpTitle")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":B.$t("common.close"),onClick:w},[a.createVNode(a.unref(Qe),{size:20})],8,J_)]),a.createElementVNode("div",X_,[a.createElementVNode("table",Y_,[a.createElementVNode("thead",null,[a.createElementVNode("tr",null,[a.createElementVNode("th",null,a.toDisplayString(B.$t("partsManager.syntax")),1),a.createElementVNode("th",null,a.toDisplayString(B.$t("partsManager.description")),1),a.createElementVNode("th",null,a.toDisplayString(B.$t("partsManager.example")),1)])]),a.createElementVNode("tbody",null,[a.createElementVNode("tr",null,[U[29]||(U[29]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default}")],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.textField")),1),U[30]||(U[30]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$title:タイトル}")],-1))]),a.createElementVNode("tr",null,[U[31]||(U[31]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:rich}")],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.richText")),1),U[32]||(U[32]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$content:本文:rich}")],-1))]),a.createElementVNode("tr",null,[U[33]||(U[33]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:textarea}")],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.textarea")),1),U[34]||(U[34]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$description:説明:textarea}")],-1))]),a.createElementVNode("tr",null,[U[35]||(U[35]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:image}")],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.image")),1),U[36]||(U[36]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$hero:default.jpg:image}")],-1))]),a.createElementVNode("tr",null,[U[37]||(U[37]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field:option1|option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.radio")),1),U[38]||(U[38]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($color:red|blue|green)")],-1))]),a.createElementVNode("tr",null,[U[39]||(U[39]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field:option1,option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.checkbox")),1),U[40]||(U[40]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($features:fast,secure)")],-1))]),a.createElementVNode("tr",null,[U[41]||(U[41]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field@:option1|option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.selectSingle")),1),U[42]||(U[42]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($size@:S|M|L)")],-1))]),a.createElementVNode("tr",null,[U[43]||(U[43]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field@:option1,option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.selectMultiple")),1),U[44]||(U[44]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($tags@:tag1,tag2,tag3)")],-1))]),a.createElementVNode("tr",null,[U[45]||(U[45]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'z-if="show_field"')],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.conditional")),1),U[46]||(U[46]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'<div z-if="show_content">...</div>')],-1))]),a.createElementVNode("tr",null,[U[47]||(U[47]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'z-slot="name"')],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.slot")),1),U[48]||(U[48]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'<div z-slot="content"></div>')],-1))])])]),a.createElementVNode("div",Q_,[a.createElementVNode("div",Z_,a.toDisplayString(B.$t("partsManager.templateHelp.note")),1),a.createElementVNode("div",eA,[a.createElementVNode("div",{role:"listitem",class:"zcode-help-section-item",innerHTML:B.$t("partsManager.templateHelp.suggestionNote")},null,8,tA),a.createElementVNode("div",nA,a.toDisplayString(B.$t("partsManager.templateHelp.fieldNameNote")),1),a.createElementVNode("div",oA,a.toDisplayString(B.$t("partsManager.templateHelp.defaultValueNote")),1)])])])])])):a.createCommentVNode("",!0)]))])]))}});function iA(t){const e=a.ref("common"),n=a.ref(null),o=a.ref(null),r=a.ref(!1),i=a.ref(null),s=a.computed(()=>e.value==="common"?t.images.common:e.value==="individual"?t.images.individual:t.images.special);function l(x){n.value=x,o.value=null,r.value=!1}function c(x){return new Promise((v,w)=>{const T=new FileReader;T.onload=M=>{const A=M.target?.result,y={id:`img-${Date.now()}`,name:x.name,url:A,mimeType:x.type,needsUpload:!0};e.value==="common"?t.images.common.push(y):e.value==="individual"?t.images.individual.push(y):t.images.special.push(y),v(y)},T.onerror=w,T.readAsDataURL(x)})}function d(x){Sc(x,t.page).forEach(A=>{Object.keys(A.component).forEach(y=>{y.includes("image")&&A.component[y]===x&&(A.component[y]="")})});const w=t.images.common.findIndex(A=>A.id===x);w!==-1&&t.images.common.splice(w,1);const T=t.images.individual.findIndex(A=>A.id===x);T!==-1&&t.images.individual.splice(T,1);const M=t.images.special.findIndex(A=>A.id===x);M!==-1&&t.images.special.splice(M,1),n.value?.id===x&&(n.value=null)}function u(x){o.value={...x},r.value=!1,n.value=x}function f(){if(!o.value)return;let x;e.value==="common"?x=t.images.common:e.value==="individual"?x=t.images.individual:x=t.images.special;const v=x.findIndex(w=>w.id===o.value.id);v!==-1&&(x[v]=o.value),o.value=null,r.value=!1}function p(){o.value=null,r.value=!1}function h(x){return Sc(x,t.page)}function m(x){if(!i.value){i.value=x;return}if(i.value===x){g();return}b(i.value,x),g()}function b(x,v){let w;e.value==="common"?w=t.images.common:e.value==="individual"?w=t.images.individual:w=t.images.special;const T=w.findIndex(y=>y.id===x),M=w.findIndex(y=>y.id===v);if(T===-1||M===-1)return;const[A]=w.splice(T,1);w.splice(M,0,A)}function g(){i.value=null}return{reorderSourceImage:i,handleReorderClick:m,cancelReorder:g,activeCategory:e,selectedImage:n,editingImage:o,isCreatingNew:r,currentImages:s,selectImage:l,addImage:c,deleteImage:d,startEditing:u,saveImage:f,cancelEditing:p,checkImageUsage:h}}const sA={class:"zcode-images-manager"},aA={class:"zcode-images-category-tabs"},lA={class:"zcode-images-category-tab-group"},cA=["onClick"],dA=["title"],uA={class:"zcode-images-add-wrapper"},fA={class:"zcode-images-manager-content"},pA={class:"zcode-images-grid"},hA=["onClick"],mA={key:0,class:"zcode-reorder-source-indicator"},gA=["src","alt"],bA={class:"zcode-image-item-overlay"},yA={class:"zcode-image-item-actions"},xA=["title","onClick"],EA=["title","onClick"],kA={class:"zcode-image-item-name"},wA={class:"zcode-image-editor-header"},SA={class:"zcode-image-editor-header-title",role:"heading","aria-level":"4"},NA=["aria-label"],CA={class:"zcode-image-editor-form"},vA={class:"zcode-image-preview-large"},TA=["src","alt"],zA={class:"zcode-form-field"},_A={class:"zcode-form-field"},AA={class:"zcode-image-editor-actions"},MA={class:"zcode-help-modal-header"},IA={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},OA=["aria-label"],DA={class:"zcode-help-modal-body"},RA={class:"zcode-help-section"},PA={class:"zcode-help-section-title",role:"heading","aria-level":"4"},LA={class:"zcode-help-section-item"},$A={class:"zcode-help-section"},VA={class:"zcode-help-section-title",role:"heading","aria-level":"4"},BA={class:"zcode-help-section-item"},FA={class:"zcode-help-section"},jA={class:"zcode-help-section-title",role:"heading","aria-level":"4"},UA={class:"zcode-help-section-item"},HA=a.defineComponent({__name:"ImagesManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.ref(null),i=a.ref(!1),s=a.computed(()=>o.config?.categoryOrder||"common"),l=a.computed(()=>{const A=[],y=o.cmsData.images.special.length>0;return s.value==="individual"?(A.push("individual","common"),y&&A.push("special")):s.value==="special"?(y&&A.push("special"),A.push("common","individual")):(A.push("common","individual"),y&&A.push("special")),A}),{reorderSourceImage:c,handleReorderClick:d,activeCategory:u,editingImage:f,currentImages:p,addImage:h,deleteImage:m,startEditing:b,saveImage:g,cancelEditing:x,checkImageUsage:v}=iA(o.cmsData);o.config?.categoryOrder==="individual"?u.value="individual":o.config?.categoryOrder==="special"&&(u.value="special"),e({activeCategory:u});async function w(A){const y=A.target,E=y.files?.[0];if(E)try{await h(E),y&&(y.value="")}catch(k){console.error("画像追加エラー:",k),alert(n("imagesManager.addImageFailed"))}}function T(A){const y=["zcode-image-item"];return c.value===A.id&&y.push("zcode-reorder-source"),y.join(" ")}function M(A){const y=v(A.id);if(y.length>0){if(!confirm(n("imagesManager.deleteImageWithUsagesConfirm",{count:y.length})))return}else if(!confirm(n("imagesManager.deleteImageConfirm")))return;m(A.id)}return(A,y)=>(a.openBlock(),a.createElementBlock("div",sA,[a.createElementVNode("div",aA,[a.createElementVNode("div",lA,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(l.value,E=>(a.openBlock(),a.createElementBlock("button",{key:E,class:a.normalizeClass([{active:a.unref(u)===E},"zcode-category-tab"]),onClick:k=>u.value=E},a.toDisplayString(E==="common"?A.$t("dataViewer.common"):E==="individual"?A.$t("dataViewer.individual"):A.$t("dataViewer.special")),11,cA))),128)),a.createElementVNode("button",{class:"zcode-help-btn",title:A.$t("dataViewer.categoryInfo.title"),onClick:y[0]||(y[0]=E=>i.value=!0)},[a.createVNode(a.unref(Vn),{size:14})],8,dA)]),a.createElementVNode("div",uA,[a.createElementVNode("input",{ref_key:"fileInput",ref:r,type:"file",accept:"image/*",style:{display:"none"},onChange:w},null,544),a.createElementVNode("button",{class:"zcode-btn-primary zcode-images-add-btn",onClick:y[1]||(y[1]=E=>r.value?.click())},[a.createVNode(a.unref(uo),{size:14}),a.createElementVNode("span",null,a.toDisplayString(A.$t("imagesManager.addImage")),1)])])]),a.createElementVNode("div",fA,[a.createElementVNode("div",pA,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(p),E=>(a.openBlock(),a.createElementBlock("div",{key:E.id,class:a.normalizeClass(T(E)),onClick:k=>a.unref(b)(E)},[a.unref(c)===E.id?(a.openBlock(),a.createElementBlock("div",mA,a.toDisplayString(A.$t("partsManager.source")),1)):a.createCommentVNode("",!0),a.createElementVNode("img",{src:E.url,alt:E.name},null,8,gA),a.createElementVNode("div",bA,[a.createElementVNode("div",yA,[a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(c)===E.id}]),title:A.$t("partsManager.reorderPart"),onClick:a.withModifiers(k=>a.unref(d)(E.id),["stop"])},[a.createVNode(a.unref(ir),{size:16})],10,xA),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:A.$t("partsManager.deletePartButton"),onClick:a.withModifiers(k=>M(E),["stop"])},[a.createVNode(a.unref(Bn),{size:16})],8,EA)])]),a.createElementVNode("div",kA,a.toDisplayString(E.name),1)],10,hA))),128))])]),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(f)?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:y[8]||(y[8]=a.withModifiers((...E)=>a.unref(x)&&a.unref(x)(...E),["self"]))},[a.createElementVNode("div",{class:"zcode-image-modal-content","data-edit-mode":"",onClick:y[7]||(y[7]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",wA,[a.createElementVNode("div",SA,a.toDisplayString(A.$t("imagesManager.editImage")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":A.$t("common.close"),onClick:y[2]||(y[2]=(...E)=>a.unref(x)&&a.unref(x)(...E))},[a.createVNode(a.unref(Qe),{size:18})],8,NA)]),a.createElementVNode("div",CA,[a.createElementVNode("div",vA,[a.createElementVNode("img",{src:a.unref(f).url,alt:a.unref(f).name,class:"zcode-image-preview-large-img"},null,8,TA)]),a.createElementVNode("div",zA,[a.createElementVNode("label",null,a.toDisplayString(A.$t("imagesManager.imageId")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":y[3]||(y[3]=E=>a.unref(f).id=E),type:"text",class:"zcode-text-input",disabled:""},null,512),[[a.vModelText,a.unref(f).id]])]),a.createElementVNode("div",_A,[a.createElementVNode("label",null,a.toDisplayString(A.$t("imagesManager.imageName")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":y[4]||(y[4]=E=>a.unref(f).name=E),type:"text",class:"zcode-text-input"},null,512),[[a.vModelText,a.unref(f).name]])]),a.createElementVNode("div",AA,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-image-editor-actions-btn",onClick:y[5]||(y[5]=(...E)=>a.unref(g)&&a.unref(g)(...E))},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(A.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-image-editor-actions-btn",onClick:y[6]||(y[6]=(...E)=>a.unref(x)&&a.unref(x)(...E))},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(A.$t("common.cancel")),1)])])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[i.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:y[11]||(y[11]=a.withModifiers(E=>i.value=!1,["self"]))},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:y[10]||(y[10]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",MA,[a.createElementVNode("div",IA,[a.createVNode(a.unref(na),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString(A.$t("dataViewer.categoryInfo.title")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":A.$t("common.close"),onClick:y[9]||(y[9]=E=>i.value=!1)},[a.createVNode(a.unref(Qe),{size:18})],8,OA)]),a.createElementVNode("div",DA,[a.createElementVNode("div",RA,[a.createElementVNode("div",PA,a.toDisplayString(A.$t("dataViewer.categoryInfo.common.title")),1),a.createElementVNode("div",LA,a.toDisplayString(A.$t("dataViewer.categoryInfo.common.description")),1)]),a.createElementVNode("div",$A,[a.createElementVNode("div",VA,a.toDisplayString(A.$t("dataViewer.categoryInfo.individual.title")),1),a.createElementVNode("div",BA,a.toDisplayString(A.$t("dataViewer.categoryInfo.individual.description")),1)]),a.createElementVNode("div",FA,[a.createElementVNode("div",jA,a.toDisplayString(A.$t("dataViewer.categoryInfo.special.title")),1),a.createElementVNode("div",UA,a.toDisplayString(A.$t("dataViewer.categoryInfo.special.description")),1)])])])])):a.createCommentVNode("",!0)]))]))}}),WA={class:"zcode-data-viewer"},GA={class:"zcode-data-viewer-header"},qA={class:"zcode-data-viewer-content-tabs"},KA={class:"zcode-data-viewer-tabs"},JA=["onClick"],XA={class:"zcode-data-viewer-content"},YA={class:"zcode-data-viewer-display-wrapper"},QA={class:"zcode-data-viewer-display"},ZA=["title"],eM=a.defineComponent({__name:"DataViewer",props:{cmsData:{type:Object},config:{type:Object}},setup(t,{expose:e}){const n=t,o=a.ref("page"),r=a.ref("json"),i=a.ref(!1),s=a.computed(()=>n.config?.categoryOrder||"common"),l=a.computed(()=>{const v=[],w=o.value==="parts"?n.cmsData.parts.special.length>0:n.cmsData.images.special.length>0;return s.value==="individual"?(v.push("individual","common"),w&&v.push("special")):s.value==="special"?(w&&v.push("special"),v.push("common","individual")):(v.push("common","individual"),w&&v.push("special")),v}),c=a.ref(n.config?.categoryOrder==="individual"?"individual":n.config?.categoryOrder==="special"?"special":"common"),{fullPageHtml:d}=fi(n.cmsData,!1),u=a.computed(()=>{switch(o.value){case"page":return n.cmsData.page;case"parts":return c.value==="common"?n.cmsData.parts.common:c.value==="individual"?n.cmsData.parts.individual:n.cmsData.parts.special;case"images":return c.value==="common"?n.cmsData.images.common:c.value==="individual"?n.cmsData.images.individual:n.cmsData.images.special;default:return null}}),f=a.ref("");let p="";function h(){try{const v=u.value,w=JSON.stringify(v,null,2);if(w===p)return;f.value=w,p=w}catch{f.value=String(u.value),p=f.value}}function m(v){let w=v.replace(/\\\\/g,"\0").replace(/\\u([0-9a-fA-F]{4})/g,(T,M)=>String.fromCharCode(parseInt(M,16))).replace(/\\n/g,`
486
- `).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\\//g,"/").replace(/\u0000/g,"\\");return w=w.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"),w}function b(v){if(!v)return"";const T=v.replace(/>\s+</g,"><").replace(/></g,`>
481
+ `},Xh=yT(ET)(Jh),wT={config:xT},ST=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return function(r){return t.reduceRight(function(i,s){return s(i)},r)}};function Yh(n,e){return Object.keys(e).forEach(function(t){e[t]instanceof Object&&n[t]&&Object.assign(e[t],Yh(n[t],e[t]))}),qh(qh({},n),e)}var CT={type:"cancelation",msg:"operation is manually canceled"};function rc(n){var e=!1,t=new Promise(function(o,r){n.then(function(i){return e?r(CT):o(i)}),n.catch(r)});return t.cancel=function(){return e=!0},t}var NT=["monaco"],TT=mT.create({config:gT,isInitialized:!1,resolve:null,reject:null,monaco:null}),Qh=YN(TT,2),Ur=Qh[0],Rs=Qh[1];function vT(n){var e=wT.config(n),t=e.monaco,o=JN(e,NT);Rs(function(r){return{config:Yh(r.config,o),monaco:t}})}function zT(){var n=Ur(function(e){var t=e.monaco,o=e.isInitialized,r=e.resolve;return{monaco:t,isInitialized:o,resolve:r}});if(!n.isInitialized){if(Rs({isInitialized:!0}),n.monaco)return n.resolve(n.monaco),rc(ic);if(window.monaco&&window.monaco.editor)return Zh(window.monaco),n.resolve(window.monaco),rc(ic);ST(MT,IT)(_T)}return rc(ic)}function MT(n){return document.body.appendChild(n)}function AT(n){var e=document.createElement("script");return n&&(e.src=n),e}function IT(n){var e=Ur(function(o){var r=o.config,i=o.reject;return{config:r,reject:i}}),t=AT("".concat(e.config.paths.vs,"/loader.js"));return t.onload=function(){return n()},t.onerror=e.reject,t}function _T(){var n=Ur(function(t){var o=t.config,r=t.resolve,i=t.reject;return{config:o,resolve:r,reject:i}}),e=window.require;e.config(n.config),e(["vs/editor/editor.main"],function(t){var o=t.m||t;Zh(o),n.resolve(o)},function(t){n.reject(t)})}function Zh(n){Ur().monaco||Rs({monaco:n})}function OT(){return Ur(function(n){var e=n.monaco;return e})}var ic=new Promise(function(n,e){return Rs({resolve:n,reject:e})}),DT={config:vT,init:zT,__getMonacoInstance:OT};const RT={class:"monaco-editor-wrapper"},PT={key:0,class:"monaco-editor-error"},em=((n,e)=>{const t=n.__vccOpts||n;for(const[o,r]of e)t[o]=r;return t})(a.defineComponent({__name:"MonacoEditor",props:{modelValue:{type:String},language:{type:String},theme:{type:String},readOnly:{type:Boolean},minimap:{type:Boolean},height:{type:String},autoHeight:{type:Boolean},maxHeight:{type:Number},enableSuggestions:{type:Boolean}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,r=a.ref(null),i=a.ref(null);let s=null,l=null,c=!1,d=[];function u(){const p=r.value;if(!p)return;const h=p.getRootNode();if(!(h instanceof ShadowRoot))return;const m=h;Array.from(document.head.querySelectorAll('style, link[rel="stylesheet"]')).filter(x=>{if(x.tagName==="LINK"){const E=x.href||"";return E.includes("monaco")||E.includes("/vs/")||E.includes("vs/")}const M=x.textContent||"";return M.includes(".monaco-editor")||M.includes(".monaco-editor-background")}).forEach(x=>{if(x.tagName==="LINK"){const E=x.href;if(!!m.querySelector(`link[rel="stylesheet"][href="${E}"]`))return}else{const E=x.getAttribute("data-name")||"";if(E&&!!m.querySelector(`style[data-name="${E}"]`))return}const M=x.cloneNode(!0);M.setAttribute("data-zcode-monaco-style","true"),m.appendChild(M),d.push(M)})}function f(){if(!(!s||!r.value||!l)&&t.autoHeight!==!1)try{const p=s.getOption(l.editor.EditorOption.lineHeight)||19;let y=(s.getModel()?.getLineCount()||1)*p+20;t.maxHeight!==void 0&&(y=Math.min(y,t.maxHeight)),r.value.style.height=`${y}px`,s.layout()}catch{r.value.style.height="200px"}}return a.onMounted(async()=>{if(r.value)try{l=await DT.init(),u(),l.languages.registerCompletionItemProvider("html",{provideCompletionItems:(h,m)=>{const y=h.getWordUntilPosition(m),g={startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:y.startColumn,endColumn:y.endColumn},x=h.getValueInRange({startLineNumber:m.lineNumber,startColumn:Math.max(1,m.column-10),endLineNumber:m.lineNumber,endColumn:m.column}),M=[];return(x.endsWith("$")||x.endsWith("{$"))&&M.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:textarea}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:textarea}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストエリアフィールド: {$変数名:デフォルト値:textarea}",detail:"テンプレート記法 - テキストエリア",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:rich}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:image}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}}),(x.endsWith("(")||x.endsWith("$("))&&M.push({label:"($field:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"ラジオボタン: ($フィールド名:選択肢1|選択肢2)",detail:"テンプレート記法 - ラジオボタン",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"チェックボックス: ($フィールド名:選択肢1,選択肢2)",detail:"テンプレート記法 - チェックボックス",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field@:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(単一選択): ($フィールド名@:選択肢1|選択肢2)",detail:"テンプレート記法 - セレクトボックス",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field@:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(複数選択): ($フィールド名@:選択肢1,選択肢2)",detail:"テンプレート記法 - セレクトボックス(複数)",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}}),(x.endsWith("z-")||x.endsWith(" z-"))&&M.push({label:'z-if="show_xxx"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-if="show_${1:field}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"条件分岐: z-if属性(フィールドがtrueの場合に表示)",detail:"テンプレート記法 - 条件分岐",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-2,endColumn:m.column}},{label:'z-slot="slotName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-2,endColumn:m.column}}),M.length===0&&M.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:g},{label:"{$field:default:rich}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:g},{label:"{$field:default:image}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:g},{label:"($field:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"ラジオボタン: ($フィールド名:選択肢1|選択肢2)",detail:"テンプレート記法 - ラジオボタン",range:g},{label:"($field:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"チェックボックス: ($フィールド名:選択肢1,選択肢2)",detail:"テンプレート記法 - チェックボックス",range:g},{label:"($field@:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(単一選択): ($フィールド名@:選択肢1|選択肢2)",detail:"テンプレート記法 - セレクトボックス",range:g},{label:"($field@:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(複数選択): ($フィールド名@:選択肢1,選択肢2)",detail:"テンプレート記法 - セレクトボックス(複数)",range:g},{label:'z-if="show_xxx"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-if="show_${1:field}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"条件分岐: z-if属性(フィールドがtrueの場合に表示)",detail:"テンプレート記法 - 条件分岐",range:g},{label:'z-tag="$tagName:h1|h2|h3"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-tag="$${1:tagName}:${2:h1|h2|h3}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"タグ名を動的に変更(選択肢を指定可能)",detail:"テンプレート記法 - タグ名の動的変更",range:g},{label:'z-empty="$fieldName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-empty="$${1:fieldName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"オプショナルフィールドが空の場合、親要素を削除",detail:"テンプレート記法 - 条件分岐(空の場合削除)",range:g},{label:'z-slot="slotName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:g}),{suggestions:M}},triggerCharacters:["$","(","z"]});const p=t.enableSuggestions!==!1;s=l.editor.create(r.value,{value:t.modelValue||"",language:t.language||"html",theme:t.theme||"vs-dark",readOnly:t.readOnly||!1,minimap:{enabled:t.minimap===!0},automaticLayout:!0,fontSize:14,tabSize:2,wordWrap:"off",scrollBeyondLastLine:!1,formatOnPaste:!0,formatOnType:!0,lineNumbers:"on",folding:!0,suggestOnTriggerCharacters:p,quickSuggestions:p?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:p,acceptSuggestionOnEnter:p?"on":"off",suggestSelection:"first",mouseWheelScrollSensitivity:1,fastScrollSensitivity:5,scrollbar:{alwaysConsumeMouseWheel:!1}}),s.onDidChangeModelContent(()=>{if(!c){const h=s.getValue();o("update:modelValue",h),f()}}),f()}catch(p){i.value=`Monaco Editorの読み込みに失敗しました: ${p}`,console.error("Monaco Editor error:",p)}}),a.watch(()=>t.modelValue,async p=>{s&&s.getValue()!==p&&(c=!0,await a.nextTick(),s.setValue(p||""),c=!1,f())}),a.watch(()=>t.enableSuggestions,p=>{if(s&&l){const h=p!==!1;s.updateOptions({suggestOnTriggerCharacters:h,quickSuggestions:h?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:h,acceptSuggestionOnEnter:h?"on":"off"})}}),a.onUnmounted(()=>{s&&(s.dispose(),s=null),d.forEach(p=>p.remove()),d=[]}),(p,h)=>(a.openBlock(),a.createElementBlock("div",RT,[a.createElementVNode("div",{ref_key:"editorContainer",ref:r,class:"monaco-editor-container"},null,512),i.value?(a.openBlock(),a.createElementBlock("div",PT,a.toDisplayString(i.value),1)):a.createCommentVNode("",!0)]))}}),[["styles",[".monaco-editor-wrapper{width:100%}.monaco-editor-container{width:100%;min-height:100px;max-height:400px;border:1px solid #d1d5db;border-radius:4px;overflow:hidden}.monaco-editor-error{padding:8px;background:#fee;color:#c33;border-radius:4px;margin-top:8px;font-size:12px}"]]]),LT={class:"zcode-parts-manager"},$T={class:"zcode-parts-category-tabs"},VT={class:"zcode-parts-category-tab-group"},BT=["onClick"],FT=["title"],jT={class:"zcode-parts-add-wrapper"},HT={class:"zcode-parts-manager-content"},UT={class:"zcode-parts-items"},WT={class:"zcode-part-type-title",role:"heading","aria-level":"5"},qT={class:"zcode-part-type-actions"},GT=["title","onClick"],KT=["title","onClick"],JT=["title","onClick"],XT={class:"zcode-part-type-items"},YT=["onClick"],QT={key:0,class:"zcode-reorder-source-indicator"},ZT={class:"zcode-part-item-header"},ev={class:"zcode-part-type"},tv={class:"zcode-part-item-actions"},nv=["title","onClick"],ov=["title","onClick"],rv=["title","onClick"],iv={class:"zcode-part-item-content"},sv={class:"zcode-part-modules"},av={key:0,class:"zcode-part-preview"},lv=["innerHTML"],cv=["onClick"],dv={class:"zcode-part-item-add-content"},uv={class:"zcode-part-editor-header"},fv={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},pv=["aria-label"],hv={class:"zcode-part-editor-form"},mv={class:"zcode-form-field"},gv=["placeholder"],yv={class:"zcode-form-field"},bv=["placeholder"],xv={class:"zcode-part-editor-actions"},kv={class:"zcode-part-editor-header"},Ev={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},wv=["aria-label"],Sv={class:"zcode-part-editor-form"},Cv={class:"zcode-part-editor-topbar"},Nv={class:"zcode-part-editor-topfields"},Tv={class:"zcode-form-field"},vv={class:"zcode-form-field"},zv=["placeholder"],Mv={class:"zcode-part-editor-main"},Av={class:"zcode-part-editor-pane zcode-part-editor-pane--code"},Iv={class:"zcode-part-editor-pane-header"},_v=["aria-label"],Ov=["aria-selected"],Dv=["aria-selected"],Rv={class:"zcode-part-editor-pane-header-actions"},Pv={key:0,class:"zcode-css-warning-compact"},Lv={class:"zcode-css-warning-compact-text"},$v=["title"],Vv={key:1,class:"zcode-checkbox-label zcode-checkbox-label-inline"},Bv=["title"],Fv={class:"zcode-part-editor-pane-body"},jv={class:"zcode-part-editor-pane zcode-part-editor-pane--side"},Hv={class:"zcode-part-editor-pane-body"},Uv=["innerHTML"],Wv={class:"zcode-part-editor-preview-hint"},qv={key:0,class:"zcode-part-editor-slots-bottom"},Gv={class:"zcode-slots-config"},Kv={class:"zcode-slot-config-header"},Jv={class:"zcode-slot-config-title"},Xv=["onClick"],Yv={class:"zcode-slot-config-body"},Qv={class:"zcode-checkbox-group"},Zv=["onUpdate:modelValue","placeholder"],ez=["checked","onChange"],tz={key:0,class:"zcode-slot-add-section"},nz={class:"zcode-slot-add-controls"},oz={value:""},rz=["value"],iz=["disabled"],sz={class:"zcode-part-editor-actions"},az={class:"zcode-preview-modal-header"},lz={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},cz=["innerHTML"],dz={class:"zcode-help-modal-header"},uz={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},fz=["aria-label"],pz={class:"zcode-help-modal-body"},hz={class:"zcode-warning-content"},mz={class:"zcode-warning-text"},gz={class:"zcode-warning-list"},yz={class:"zcode-css-warning-modal-footer"},bz={class:"zcode-checkbox-label",style:{"margin-bottom":"12px"}},xz={class:"zcode-help-modal-header"},kz={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},Ez=["aria-label"],wz={class:"zcode-help-modal-body"},Sz={class:"zcode-help-section"},Cz={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Nz={class:"zcode-help-section-item"},Tz={class:"zcode-help-section"},vz={class:"zcode-help-section-title",role:"heading","aria-level":"4"},zz={class:"zcode-help-section-item"},Mz={class:"zcode-help-section"},Az={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Iz={class:"zcode-help-section-item"},_z={class:"zcode-help-modal-header"},Oz={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},Dz=["aria-label"],Rz={class:"zcode-help-modal-body"},Pz={class:"zcode-help-table"},Lz={class:"zcode-help-section"},$z={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Vz={role:"list",class:"zcode-help-section-list"},Bz=["innerHTML"],Fz={role:"listitem",class:"zcode-help-section-item"},jz={role:"listitem",class:"zcode-help-section-item"},Hz=a.defineComponent({__name:"PartsManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(n,{expose:e}){const{t}=Qt(),o=n,r=a.ref(!1),i=a.ref(eb("enableTemplateSuggestions",!1)),s=a.ref(!1),l=a.ref(!1),c=a.ref(!1),d=a.ref(tb()),u=a.ref("html"),f=a.ref(""),p=a.ref(""),h={common:"zcode-css-style-parts-manager-preview-common",individual:"zcode-css-style-parts-manager-preview-individual",special:"zcode-css-style-parts-manager-preview-special"},m=new Map,y=a.computed(()=>O.value==="common"?o.cmsData.css?.common??"":O.value==="individual"?o.cmsData.css?.individual??"":o.cmsData.css?.special??"");function g(j){["common","individual","special"].forEach(re=>{const ce=j[re];if(!ce||!ce.trim()){const He=m.get(re);He&&(He.remove(),m.delete(re));return}let ve=m.get(re);ve||(ve=document.createElement("style"),ve.id=h[re],ve.setAttribute("data-zcode-css","true"),ve.setAttribute("data-zcode-css-parts-preview","true"),ve.setAttribute("data-zcode-css-category",re),ve.parentNode||document.head.appendChild(ve),m.set(re,ve)),ve.textContent=ce})}function x(){m.forEach(j=>{j.remove()}),m.clear()}function M(){s.value=!0}function E(){s.value=!1}function v(){(O.value==="common"||O.value==="individual"||O.value==="special")&&(l.value=!0)}function _(){l.value=!1,nb(d.value)}a.watch(i,j=>{ka({enableTemplateSuggestions:j})});const A=a.computed(()=>o.config?.categoryOrder||"common"),b=a.computed(()=>{const j=[],W=o.cmsData.parts.special.length>0;return A.value==="individual"?(j.push("individual","common"),W&&j.push("special")):A.value==="special"?(W&&j.push("special"),j.push("common","individual")):(j.push("common","individual"),W&&j.push("special")),j}),{reorderSourcePart:k,handleReorderClick:w,activeCategory:O,editingType:q,editingPart:T,editingLevel:R,isCreatingNew:H,groupedPartsByType:F,startCreating:L,startEditingType:B,startEditingPart:te,addPartToType:K,saveType:ae,savePart:Q,deletePart:Z,checkTypeUsage:Y,cancelEditingType:J,cancelEditingPart:ee,getPartPreviewHtml:de,addPartSlot:we,removePartSlot:Ne,updatePartSlotAllowedParts:Pe,getAvailableSlotsForPart:C,extractSlotsFromTemplate:P,reorderSourceType:V,startReorderType:S,deletePartType:N}=UN(o.cmsData);o.config?.categoryOrder==="individual"&&(O.value="individual");const $=a.computed(()=>(R?.value??R)==="part"&&!!T.value);a.watch(()=>$.value,j=>{if(!j){x();return}a.nextTick(()=>{const W=y.value;p.value=W,f.value=W,g({common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special})})},{immediate:!0}),a.watch(()=>O.value,()=>{$.value&&a.nextTick(()=>{const j=y.value;p.value=j,f.value=j})}),a.watch([()=>f.value,()=>$.value,()=>O.value],([j,W,re])=>{W&&a.nextTick(()=>{const ce={common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special};re==="common"?ce.common=j??"":re==="individual"?ce.individual=j??"":ce.special=j??"",g(ce)})});async function ne(){await Q(),!T.value&&o.cmsData.css&&(O.value==="common"?o.cmsData.css.common=f.value:O.value==="individual"?o.cmsData.css.individual=f.value:o.cmsData.css.special=f.value,p.value=f.value)}function me(){f.value=p.value,x(),r.value=!1,ee()}a.onBeforeUnmount(()=>{x()}),a.watch(()=>T.value,j=>{j&&(u.value="html")}),a.watch(()=>u.value,j=>{j==="css"&&$.value&&(O.value==="common"||O.value==="individual"||O.value==="special")&&!d.value&&a.nextTick(()=>{v()})}),e({activeCategory:O});async function De(){await ae()}const Te=a.computed(()=>T.value?C(T.value.partIndex):[]),z=a.computed(()=>{if(!T.value)return!1;const j=T.value.part.body,W=j?P(j).length>0:!1,re=T.value.part.slots&&Object.keys(T.value.part.slots).length>0;return W||re}),I=a.ref(""),G=()=>{!I.value||!T.value||(we(T.value.partIndex,I.value),I.value="")};a.watch(()=>T.value?.part.body,()=>{I.value=""});const pe=a.computed(()=>{const j=[],W=o.cmsData.parts;return[...W.common,...W.individual,...W.special||[]].forEach(ce=>{ce.parts.forEach(ve=>{j.push({id:ve.id,title:ve.title,typeName:ce.type,description:ve.description})})}),j.sort((ce,ve)=>ce.typeName!==ve.typeName?ce.typeName.localeCompare(ve.typeName):ce.title.localeCompare(ve.title))}),Ae=a.ref({}),ye=j=>{const W=Ae.value[j]||"";if(!W)return pe.value;const re=W.toLowerCase();return pe.value.filter(ce=>ce.title.toLowerCase().includes(re)||ce.typeName.toLowerCase().includes(re))},U=j=>{if(!T.value)return[];const W=T.value.part.slots?.[j];return W?W.allowedParts||[]:[]},X=(j,W,re)=>{if(!T.value)return;const ce=re.target.checked,He=T.value.part.slots?.[j]?.allowedParts||[];let yt;ce?yt=[...He,W]:yt=He.filter(fn=>fn!==W),Pe(T.value.partIndex,j,yt)};function ze(j,W){const re=["zcode-part-item"];return k.value&&k.value.type===j.type&&k.value.partIndex===W&&re.push("zcode-reorder-source"),re.join(" ")}function Ve(j){const W=j._partIndex,re=W!=null,ce=re&&W!==void 0?W+1:0,ve=j.parts.length;if(re&&ve>1){if(!confirm(t("partsManager.deletePartConfirm",{number:ce})))return}else{const He=Y(j.type);if(He.length>0){if(!confirm(t("partsManager.deleteTypeWithUsagesConfirm",{type:j.type,count:He.length})))return}else if(!confirm(t("partsManager.deleteTypeConfirm")))return}Z(j)}return(j,W)=>(a.openBlock(),a.createElementBlock("div",LT,[a.createElementVNode("div",$T,[a.createElementVNode("div",VT,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(b.value,re=>(a.openBlock(),a.createElementBlock("button",{key:re,class:a.normalizeClass([{active:a.unref(O)===re},"zcode-category-tab"]),onClick:ce=>O.value=re},a.toDisplayString(re==="common"?j.$t("dataViewer.common"):re==="individual"?j.$t("dataViewer.individual"):j.$t("dataViewer.special")),11,BT))),128)),a.createElementVNode("button",{class:"zcode-help-btn",title:j.$t("dataViewer.categoryInfo.title"),onClick:W[0]||(W[0]=re=>c.value=!0)},[a.createVNode(a.unref(_n),{size:14})],8,FT)]),a.createElementVNode("div",jT,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-parts-new-btn",onClick:W[1]||(W[1]=(...re)=>a.unref(L)&&a.unref(L)(...re))},[a.createVNode(a.unref(io),{size:14}),a.createElementVNode("span",null,a.toDisplayString(j.$t("partsManager.createType")),1)])])]),a.createElementVNode("div",HT,[a.createElementVNode("div",UT,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(F),re=>(a.openBlock(),a.createElementBlock("div",{key:re.type,class:"zcode-part-type-group"},[a.createElementVNode("div",WT,[a.createTextVNode(a.toDisplayString(re.type)+" ",1),a.createElementVNode("div",qT,[re.parts.length>0?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-part-type-edit-btn",title:j.$t("partsManager.editTypeButton"),onClick:a.withModifiers(ce=>a.unref(B)(re.parts[0]),["stop"])},[a.createVNode(a.unref(Hs),{size:14})],8,GT)):a.createCommentVNode("",!0),a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(V)===re.type}]),title:j.$t("partsManager.reorderType"),onClick:a.withModifiers(ce=>a.unref(S)(re.type),["stop"])},[a.createVNode(a.unref(Yo),{size:14})],10,KT),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:j.$t("partsManager.deleteTypeButton"),onClick:a.withModifiers(ce=>a.unref(N)(re.type),["stop"])},[a.createVNode(a.unref(On),{size:14})],8,JT)])]),a.createElementVNode("div",XT,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(re.parts,(ce,ve)=>(a.openBlock(),a.createElementBlock("div",{key:`${re.type}-${ve}`,class:a.normalizeClass(ze(ce,ce._partIndex??0)),onClick:He=>a.unref(te)(ce,ce._partIndex??0)},[a.unref(k)&&a.unref(k).type===ce.type&&a.unref(k).partIndex===(ce._partIndex??0)?(a.openBlock(),a.createElementBlock("div",QT,a.toDisplayString(j.$t("partsManager.source")),1)):a.createCommentVNode("",!0),a.createElementVNode("div",ZT,[a.createElementVNode("span",ev,a.toDisplayString(ce._displayPart?.title||ce.type),1),a.createElementVNode("div",tv,[a.createElementVNode("button",{class:"zcode-action-btn",title:j.$t("partsManager.editPartButton"),onClick:a.withModifiers(He=>a.unref(te)(ce,ce._partIndex??0),["stop"])},[a.createVNode(a.unref(Hs),{size:14})],8,nv),a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(k)?.type===ce.type&&a.unref(k)?.partIndex===(ce._partIndex??0)}]),title:j.$t("partsManager.reorderPart"),onClick:a.withModifiers(He=>a.unref(w)(ce,ce._partIndex??0),["stop"])},[a.createVNode(a.unref(Yo),{size:14})],10,ov),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:j.$t("partsManager.deletePartButton"),onClick:a.withModifiers(He=>Ve({...ce,_partIndex:ce._partIndex??0}),["stop"])},[a.createVNode(a.unref(On),{size:14})],8,rv)])]),a.createElementVNode("div",iv,[a.createElementVNode("div",{class:a.normalizeClass(["zcode-part-description",{"zcode-description-empty":!ce._displayPart?.description&&!ce.description}])},a.toDisplayString(ce._displayPart?.description||ce.description||j.$t("partsManager.noDescription")),3),a.createElementVNode("div",sv,a.toDisplayString(j.$t("partsManager.partNumber",{current:(ce._partIndex??0)+1,total:ce.parts.length})),1),ce._displayPart?(a.openBlock(),a.createElementBlock("div",av,[a.createElementVNode("div",{class:"zcode-part-preview-content",innerHTML:a.unref(de)(ce,ce._displayPart)},null,8,lv)])):a.createCommentVNode("",!0)])],10,YT))),128)),re.parts.length>0?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-item zcode-part-item-add",onClick:a.withModifiers(ce=>a.unref(K)(re.parts[0]),["stop"])},[a.createElementVNode("div",dv,[a.createVNode(a.unref(io),{size:20}),a.createElementVNode("span",null,a.toDisplayString(j.$t("partsManager.addPart")),1)])],8,cv)):a.createCommentVNode("",!0)])]))),128))]),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(q)&&(a.unref(R)==="type"||a.unref(H))?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:W[7]||(W[7]=a.withModifiers((...re)=>a.unref(J)&&a.unref(J)(...re),["self"]))},[a.createElementVNode("div",{class:"zcode-part-modal-content",onClick:W[6]||(W[6]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",uv,[a.createElementVNode("div",fv,a.toDisplayString(a.unref(H)?j.$t("partsManager.createType"):j.$t("partsManager.editType")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":j.$t("common.close"),onClick:W[2]||(W[2]=(...re)=>a.unref(J)&&a.unref(J)(...re))},[a.createVNode(a.unref(Ye),{size:18})],8,pv)]),a.createElementVNode("div",hv,[a.createElementVNode("div",mv,[a.createElementVNode("label",null,[a.createTextVNode(a.toDisplayString(j.$t("partsManager.typeName"))+" ",1),W[27]||(W[27]=a.createElementVNode("span",{class:"zcode-required"},"*",-1))]),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":W[3]||(W[3]=re=>a.unref(q).type=re),type:"text",placeholder:j.$t("partsManager.typeNamePlaceholder"),class:"zcode-text-input",required:""},null,8,gv),[[a.vModelText,a.unref(q).type]])]),a.createElementVNode("div",yv,[a.createElementVNode("label",null,a.toDisplayString(j.$t("partsManager.typeDescription")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":W[4]||(W[4]=re=>a.unref(q).description=re),type:"text",placeholder:j.$t("partsManager.typeDescriptionPlaceholder"),class:"zcode-text-input"},null,8,bv),[[a.vModelText,a.unref(q).description]])])]),a.createElementVNode("div",xv,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:De},[a.createVNode(a.unref(Qo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(j.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:W[5]||(W[5]=(...re)=>a.unref(J)&&a.unref(J)(...re))},[a.createVNode(a.unref(Ye),{size:16}),a.createElementVNode("span",null,a.toDisplayString(j.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(T)&&a.unref(R)==="part"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:a.withModifiers(me,["self"])},[a.createElementVNode("div",{class:"zcode-part-modal-content",onClick:W[17]||(W[17]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",kv,[a.createElementVNode("div",Ev,a.toDisplayString(j.$t("partsManager.editPart",{title:a.unref(T).part.title})),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":j.$t("common.close"),onClick:me},[a.createVNode(a.unref(Ye),{size:18})],8,wv)]),a.createElementVNode("div",Sv,[a.createElementVNode("div",Cv,[a.createElementVNode("div",Nv,[a.createElementVNode("div",Tv,[a.createElementVNode("label",null,[a.createTextVNode(a.toDisplayString(j.$t("partsManager.partTitle"))+" ",1),W[28]||(W[28]=a.createElementVNode("span",{class:"zcode-required"},"*",-1))]),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":W[8]||(W[8]=re=>a.unref(T).part.title=re),type:"text",class:"zcode-text-input",required:""},null,512),[[a.vModelText,a.unref(T).part.title]])]),a.createElementVNode("div",vv,[a.createElementVNode("label",null,a.toDisplayString(j.$t("partsManager.partDescription")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":W[9]||(W[9]=re=>a.unref(T).part.description=re),type:"text",class:"zcode-text-input",placeholder:j.$t("partsManager.partDescriptionPlaceholder")},null,8,zv),[[a.vModelText,a.unref(T).part.description]])])])]),a.createElementVNode("div",Mv,[a.createElementVNode("div",Av,[a.createElementVNode("div",Iv,[a.createElementVNode("div",{class:"zcode-template-tabs",role:"tablist","aria-label":j.$t("partsManager.codeEdit")},[a.createElementVNode("button",{type:"button",class:a.normalizeClass(["zcode-template-tab",{active:u.value==="html"}]),role:"tab","aria-selected":u.value==="html",onClick:W[10]||(W[10]=re=>u.value="html")}," HTML ",10,Ov),a.createElementVNode("button",{type:"button",class:a.normalizeClass(["zcode-template-tab",{active:u.value==="css"}]),role:"tab","aria-selected":u.value==="css",onClick:W[11]||(W[11]=re=>u.value="css")}," CSS ",10,Dv)],8,_v),a.createElementVNode("div",Rv,[u.value==="css"?(a.openBlock(),a.createElementBlock("div",Pv,[a.createVNode(a.unref(js),{size:14,class:"zcode-css-warning-compact-icon"}),a.createElementVNode("span",Lv,a.toDisplayString(j.$t("partsManager.cssEditInfo")),1),a.createElementVNode("button",{class:"zcode-help-btn",type:"button",title:j.$t("partsManager.cssEditWarning"),onClick:v},[a.createVNode(a.unref(_n),{size:14})],8,$v)])):a.createCommentVNode("",!0),u.value==="html"?(a.openBlock(),a.createElementBlock("label",Vv,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":W[12]||(W[12]=re=>i.value=re),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[a.vModelCheckbox,i.value]]),a.createElementVNode("span",null,a.toDisplayString(j.$t("partsManager.templateSuggestions")),1)])):a.createCommentVNode("",!0),u.value==="html"?(a.openBlock(),a.createElementBlock("button",{key:2,class:"zcode-help-btn",type:"button",title:j.$t("partsManager.templateHelpButton"),onClick:M},[a.createVNode(a.unref(_n),{size:16})],8,Bv)):a.createCommentVNode("",!0)])]),a.createElementVNode("div",Fv,[u.value==="html"?(a.openBlock(),a.createBlock(em,{key:0,modelValue:a.unref(T).part.body,"onUpdate:modelValue":W[13]||(W[13]=re=>a.unref(T).part.body=re),language:"html",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":i.value,class:"zcode-monaco-editor"},null,8,["modelValue","enable-suggestions"])):(a.openBlock(),a.createBlock(em,{key:1,modelValue:f.value,"onUpdate:modelValue":W[14]||(W[14]=re=>f.value=re),language:"css",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":!0,class:"zcode-monaco-editor"},null,8,["modelValue"]))])]),a.createElementVNode("div",jv,[a.createElementVNode("div",Hv,[a.createElementVNode("div",{class:"zcode-part-editor-preview-tab",onClick:W[15]||(W[15]=re=>r.value=!0),innerHTML:a.unref(de)(a.unref(T).type,a.unref(T).part)},null,8,Uv),a.createElementVNode("div",Wv,a.toDisplayString(j.$t("partsManager.clickToEnlarge")),1)])])]),z.value?(a.openBlock(),a.createElementBlock("div",qv,[a.createElementVNode("div",Gv,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(T).part.slots||{},(re,ce)=>(a.openBlock(),a.createElementBlock("div",{key:`part-${a.unref(T).partIndex}-${ce}`,class:"zcode-slot-config-item"},[a.createElementVNode("div",Kv,[a.createElementVNode("div",Jv,a.toDisplayString(j.$t("partsManager.slot"))+": "+a.toDisplayString(ce),1),a.createElementVNode("button",{class:"zcode-btn-small",onClick:ve=>a.unref(Ne)(a.unref(T).partIndex,ce)},[a.createVNode(a.unref(On),{size:12})],8,Xv)]),a.createElementVNode("div",Yv,[a.createElementVNode("label",null,a.toDisplayString(j.$t("partsManager.allowedParts")),1),a.createElementVNode("div",Qv,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":ve=>Ae.value[ce]=ve,type:"text",placeholder:j.$t("partsManager.searchParts"),class:"zcode-text-input",style:{"margin-bottom":"8px"}},null,8,Zv),[[a.vModelText,Ae.value[ce]]]),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(ye(ce),ve=>(a.openBlock(),a.createElementBlock("label",{key:`allowed-${ce}-${ve.typeName}-${ve.id}`,class:"zcode-checkbox-item"},[a.createElementVNode("input",{type:"checkbox",checked:U(ce).includes(ve.id),class:"zcode-checkbox",onChange:He=>X(ce,ve.id,He)},null,40,ez),a.createElementVNode("span",null,a.toDisplayString(ve.title)+" ("+a.toDisplayString(ve.typeName)+")",1)]))),128))])])]))),128)),Te.value.length>0?(a.openBlock(),a.createElementBlock("div",tz,[a.createElementVNode("label",null,a.toDisplayString(j.$t("partsManager.addSlot")),1),a.createElementVNode("div",nz,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":W[16]||(W[16]=re=>I.value=re),class:"zcode-select-input"},[a.createElementVNode("option",oz,a.toDisplayString(j.$t("partsManager.selectSlot")),1),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(Te.value,re=>(a.openBlock(),a.createElementBlock("option",{key:re,value:re},a.toDisplayString(re==="default"?j.$t("partsManager.defaultSlot"):re),9,rz))),128))],512),[[a.vModelSelect,I.value]]),a.createElementVNode("button",{disabled:!I.value,class:"zcode-btn-secondary",onClick:G},[a.createVNode(a.unref(io),{size:16}),a.createElementVNode("span",null,a.toDisplayString(j.$t("common.add")),1)],8,iz)])])):a.createCommentVNode("",!0)])])):a.createCommentVNode("",!0)]),a.createElementVNode("div",sz,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:ne},[a.createVNode(a.unref(Qo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(j.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:me},[a.createVNode(a.unref(Ye),{size:16}),a.createElementVNode("span",null,a.toDisplayString(j.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[r.value&&a.unref(T)?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:W[20]||(W[20]=re=>r.value=!1)},[a.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:W[19]||(W[19]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",az,[a.createElementVNode("div",lz,a.toDisplayString(j.$t("partsManager.preview"))+" "+a.toDisplayString(a.unref(T).part.title),1),a.createElementVNode("button",{class:"zcode-close-btn",onClick:W[18]||(W[18]=re=>r.value=!1)},[a.createVNode(a.unref(Ye),{size:18})])]),a.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:a.unref(de)(a.unref(T).type,a.unref(T).part)},null,8,cz)])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[l.value&&(a.unref(O)==="common"||a.unref(O)==="individual"||a.unref(O)==="special")?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:a.withModifiers(_,["self"])},[a.createElementVNode("div",{class:"zcode-help-modal zcode-css-warning-modal",onClick:W[22]||(W[22]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",dz,[a.createElementVNode("div",uz,[a.createVNode(a.unref(xc),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString(j.$t("partsManager.cssEditWarning")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":j.$t("common.close"),onClick:_},[a.createVNode(a.unref(Ye),{size:20})],8,fz)]),a.createElementVNode("div",pz,[a.createElementVNode("div",hz,[a.createElementVNode("div",mz,[a.createElementVNode("ul",gz,[a.createElementVNode("li",null,[a.unref(O)==="common"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createTextVNode(a.toDisplayString(j.$t("partsManager.cssEditWarningMessageCommon")),1)],64)):a.unref(O)==="individual"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createTextVNode(a.toDisplayString(j.$t("partsManager.cssEditWarningMessageIndividual")),1)],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:2},[a.createTextVNode(a.toDisplayString(j.$t("partsManager.cssEditWarningMessageSpecial")),1)],64))])])])])]),a.createElementVNode("div",yz,[a.createElementVNode("label",bz,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":W[21]||(W[21]=re=>d.value=re),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[a.vModelCheckbox,d.value]]),a.createElementVNode("span",null,a.toDisplayString(j.$t("partsManager.dontShowAgain")),1)]),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:_},a.toDisplayString(j.$t("partsManager.understood")),1)])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[c.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:W[25]||(W[25]=a.withModifiers(re=>c.value=!1,["self"]))},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:W[24]||(W[24]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",xz,[a.createElementVNode("div",kz,[a.createVNode(a.unref(js),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString(j.$t("dataViewer.categoryInfo.title")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":j.$t("common.close"),onClick:W[23]||(W[23]=re=>c.value=!1)},[a.createVNode(a.unref(Ye),{size:18})],8,Ez)]),a.createElementVNode("div",wz,[a.createElementVNode("div",Sz,[a.createElementVNode("div",Cz,a.toDisplayString(j.$t("dataViewer.categoryInfo.common.title")),1),a.createElementVNode("div",Nz,a.toDisplayString(j.$t("dataViewer.categoryInfo.common.description")),1)]),a.createElementVNode("div",Tz,[a.createElementVNode("div",vz,a.toDisplayString(j.$t("dataViewer.categoryInfo.individual.title")),1),a.createElementVNode("div",zz,a.toDisplayString(j.$t("dataViewer.categoryInfo.individual.description")),1)]),a.createElementVNode("div",Mz,[a.createElementVNode("div",Az,a.toDisplayString(j.$t("dataViewer.categoryInfo.special.title")),1),a.createElementVNode("div",Iz,a.toDisplayString(j.$t("dataViewer.categoryInfo.special.description")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[s.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:E},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:W[26]||(W[26]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",_z,[a.createElementVNode("div",Oz,a.toDisplayString(j.$t("partsManager.templateHelpTitle")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":j.$t("common.close"),onClick:E},[a.createVNode(a.unref(Ye),{size:20})],8,Dz)]),a.createElementVNode("div",Rz,[a.createElementVNode("table",Pz,[a.createElementVNode("thead",null,[a.createElementVNode("tr",null,[a.createElementVNode("th",null,a.toDisplayString(j.$t("partsManager.syntax")),1),a.createElementVNode("th",null,a.toDisplayString(j.$t("partsManager.description")),1),a.createElementVNode("th",null,a.toDisplayString(j.$t("partsManager.example")),1)])]),a.createElementVNode("tbody",null,[a.createElementVNode("tr",null,[W[29]||(W[29]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default}")],-1)),a.createElementVNode("td",null,a.toDisplayString(j.$t("partsManager.templateHelp.textField")),1),W[30]||(W[30]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$title:タイトル}")],-1))]),a.createElementVNode("tr",null,[W[31]||(W[31]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:rich}")],-1)),a.createElementVNode("td",null,a.toDisplayString(j.$t("partsManager.templateHelp.richText")),1),W[32]||(W[32]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$content:本文:rich}")],-1))]),a.createElementVNode("tr",null,[W[33]||(W[33]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:textarea}")],-1)),a.createElementVNode("td",null,a.toDisplayString(j.$t("partsManager.templateHelp.textarea")),1),W[34]||(W[34]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$description:説明:textarea}")],-1))]),a.createElementVNode("tr",null,[W[35]||(W[35]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:image}")],-1)),a.createElementVNode("td",null,a.toDisplayString(j.$t("partsManager.templateHelp.image")),1),W[36]||(W[36]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$hero:default.jpg:image}")],-1))]),a.createElementVNode("tr",null,[W[37]||(W[37]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field:option1|option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString(j.$t("partsManager.templateHelp.radio")),1),W[38]||(W[38]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($color:red|blue|green)")],-1))]),a.createElementVNode("tr",null,[W[39]||(W[39]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field:option1,option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString(j.$t("partsManager.templateHelp.checkbox")),1),W[40]||(W[40]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($features:fast,secure)")],-1))]),a.createElementVNode("tr",null,[W[41]||(W[41]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field@:option1|option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString(j.$t("partsManager.templateHelp.selectSingle")),1),W[42]||(W[42]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($size@:S|M|L)")],-1))]),a.createElementVNode("tr",null,[W[43]||(W[43]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field@:option1,option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString(j.$t("partsManager.templateHelp.selectMultiple")),1),W[44]||(W[44]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($tags@:tag1,tag2,tag3)")],-1))]),a.createElementVNode("tr",null,[W[45]||(W[45]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'z-if="show_field"')],-1)),a.createElementVNode("td",null,a.toDisplayString(j.$t("partsManager.templateHelp.conditional")),1),W[46]||(W[46]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'<div z-if="show_content">...</div>')],-1))]),a.createElementVNode("tr",null,[W[47]||(W[47]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'z-slot="name"')],-1)),a.createElementVNode("td",null,a.toDisplayString(j.$t("partsManager.templateHelp.slot")),1),W[48]||(W[48]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'<div z-slot="content"></div>')],-1))])])]),a.createElementVNode("div",Lz,[a.createElementVNode("div",$z,a.toDisplayString(j.$t("partsManager.templateHelp.note")),1),a.createElementVNode("div",Vz,[a.createElementVNode("div",{role:"listitem",class:"zcode-help-section-item",innerHTML:j.$t("partsManager.templateHelp.suggestionNote")},null,8,Bz),a.createElementVNode("div",Fz,a.toDisplayString(j.$t("partsManager.templateHelp.fieldNameNote")),1),a.createElementVNode("div",jz,a.toDisplayString(j.$t("partsManager.templateHelp.defaultValueNote")),1)])])])])])):a.createCommentVNode("",!0)]))])]))}});function Uz(n){const e=a.ref("common"),t=a.ref(null),o=a.ref(null),r=a.ref(!1),i=a.ref(null),s=a.computed(()=>e.value==="common"?n.images.common:e.value==="individual"?n.images.individual:n.images.special);function l(x){t.value=x,o.value=null,r.value=!1}function c(x){return new Promise((M,E)=>{const v=new FileReader;v.onload=_=>{const A=_.target?.result,b={id:`img-${Date.now()}`,name:x.name,url:A,mimeType:x.type,needsUpload:!0};e.value==="common"?n.images.common.push(b):e.value==="individual"?n.images.individual.push(b):n.images.special.push(b),M(b)},v.onerror=E,v.readAsDataURL(x)})}function d(x){oc(x,n.page).forEach(A=>{Object.keys(A.component).forEach(b=>{b.includes("image")&&A.component[b]===x&&(A.component[b]="")})});const E=n.images.common.findIndex(A=>A.id===x);E!==-1&&n.images.common.splice(E,1);const v=n.images.individual.findIndex(A=>A.id===x);v!==-1&&n.images.individual.splice(v,1);const _=n.images.special.findIndex(A=>A.id===x);_!==-1&&n.images.special.splice(_,1),t.value?.id===x&&(t.value=null)}function u(x){o.value={...x},r.value=!1,t.value=x}function f(){if(!o.value)return;let x;e.value==="common"?x=n.images.common:e.value==="individual"?x=n.images.individual:x=n.images.special;const M=x.findIndex(E=>E.id===o.value.id);M!==-1&&(x[M]=o.value),o.value=null,r.value=!1}function p(){o.value=null,r.value=!1}function h(x){return oc(x,n.page)}function m(x){if(!i.value){i.value=x;return}if(i.value===x){g();return}y(i.value,x),g()}function y(x,M){let E;e.value==="common"?E=n.images.common:e.value==="individual"?E=n.images.individual:E=n.images.special;const v=E.findIndex(b=>b.id===x),_=E.findIndex(b=>b.id===M);if(v===-1||_===-1)return;const[A]=E.splice(v,1);E.splice(_,0,A)}function g(){i.value=null}return{reorderSourceImage:i,handleReorderClick:m,cancelReorder:g,activeCategory:e,selectedImage:t,editingImage:o,isCreatingNew:r,currentImages:s,selectImage:l,addImage:c,deleteImage:d,startEditing:u,saveImage:f,cancelEditing:p,checkImageUsage:h}}const Wz={class:"zcode-images-manager"},qz={class:"zcode-images-category-tabs"},Gz={class:"zcode-images-category-tab-group"},Kz=["onClick"],Jz=["title"],Xz={class:"zcode-images-add-wrapper"},Yz={class:"zcode-images-manager-content"},Qz={class:"zcode-images-grid"},Zz=["onClick"],eM={key:0,class:"zcode-reorder-source-indicator"},tM=["src","alt"],nM={class:"zcode-image-item-overlay"},oM={class:"zcode-image-item-actions"},rM=["title","onClick"],iM=["title","onClick"],sM={class:"zcode-image-item-name"},aM={class:"zcode-image-editor-header"},lM={class:"zcode-image-editor-header-title",role:"heading","aria-level":"4"},cM=["aria-label"],dM={class:"zcode-image-editor-form"},uM={class:"zcode-image-preview-large"},fM=["src","alt"],pM={class:"zcode-form-field"},hM={class:"zcode-form-field"},mM={class:"zcode-image-editor-actions"},gM={class:"zcode-help-modal-header"},yM={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},bM=["aria-label"],xM={class:"zcode-help-modal-body"},kM={class:"zcode-help-section"},EM={class:"zcode-help-section-title",role:"heading","aria-level":"4"},wM={class:"zcode-help-section-item"},SM={class:"zcode-help-section"},CM={class:"zcode-help-section-title",role:"heading","aria-level":"4"},NM={class:"zcode-help-section-item"},TM={class:"zcode-help-section"},vM={class:"zcode-help-section-title",role:"heading","aria-level":"4"},zM={class:"zcode-help-section-item"},MM=a.defineComponent({__name:"ImagesManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(n,{expose:e}){const{t}=Qt(),o=n,r=a.ref(null),i=a.ref(!1),s=a.computed(()=>o.config?.categoryOrder||"common"),l=a.computed(()=>{const A=[],b=o.cmsData.images.special.length>0;return s.value==="individual"?(A.push("individual","common"),b&&A.push("special")):s.value==="special"?(b&&A.push("special"),A.push("common","individual")):(A.push("common","individual"),b&&A.push("special")),A}),{reorderSourceImage:c,handleReorderClick:d,activeCategory:u,editingImage:f,currentImages:p,addImage:h,deleteImage:m,startEditing:y,saveImage:g,cancelEditing:x,checkImageUsage:M}=Uz(o.cmsData);o.config?.categoryOrder==="individual"?u.value="individual":o.config?.categoryOrder==="special"&&(u.value="special"),e({activeCategory:u});async function E(A){const b=A.target,k=b.files?.[0];if(k)try{await h(k),b&&(b.value="")}catch(w){console.error("画像追加エラー:",w),alert(t("imagesManager.addImageFailed"))}}function v(A){const b=["zcode-image-item"];return c.value===A.id&&b.push("zcode-reorder-source"),b.join(" ")}function _(A){const b=M(A.id);if(b.length>0){if(!confirm(t("imagesManager.deleteImageWithUsagesConfirm",{count:b.length})))return}else if(!confirm(t("imagesManager.deleteImageConfirm")))return;m(A.id)}return(A,b)=>(a.openBlock(),a.createElementBlock("div",Wz,[a.createElementVNode("div",qz,[a.createElementVNode("div",Gz,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(l.value,k=>(a.openBlock(),a.createElementBlock("button",{key:k,class:a.normalizeClass([{active:a.unref(u)===k},"zcode-category-tab"]),onClick:w=>u.value=k},a.toDisplayString(k==="common"?A.$t("dataViewer.common"):k==="individual"?A.$t("dataViewer.individual"):A.$t("dataViewer.special")),11,Kz))),128)),a.createElementVNode("button",{class:"zcode-help-btn",title:A.$t("dataViewer.categoryInfo.title"),onClick:b[0]||(b[0]=k=>i.value=!0)},[a.createVNode(a.unref(_n),{size:14})],8,Jz)]),a.createElementVNode("div",Xz,[a.createElementVNode("input",{ref_key:"fileInput",ref:r,type:"file",accept:"image/*",style:{display:"none"},onChange:E},null,544),a.createElementVNode("button",{class:"zcode-btn-primary zcode-images-add-btn",onClick:b[1]||(b[1]=k=>r.value?.click())},[a.createVNode(a.unref(io),{size:14}),a.createElementVNode("span",null,a.toDisplayString(A.$t("imagesManager.addImage")),1)])])]),a.createElementVNode("div",Yz,[a.createElementVNode("div",Qz,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(p),k=>(a.openBlock(),a.createElementBlock("div",{key:k.id,class:a.normalizeClass(v(k)),onClick:w=>a.unref(y)(k)},[a.unref(c)===k.id?(a.openBlock(),a.createElementBlock("div",eM,a.toDisplayString(A.$t("partsManager.source")),1)):a.createCommentVNode("",!0),a.createElementVNode("img",{src:k.url,alt:k.name},null,8,tM),a.createElementVNode("div",nM,[a.createElementVNode("div",oM,[a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(c)===k.id}]),title:A.$t("partsManager.reorderPart"),onClick:a.withModifiers(w=>a.unref(d)(k.id),["stop"])},[a.createVNode(a.unref(Yo),{size:16})],10,rM),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:A.$t("partsManager.deletePartButton"),onClick:a.withModifiers(w=>_(k),["stop"])},[a.createVNode(a.unref(On),{size:16})],8,iM)])]),a.createElementVNode("div",sM,a.toDisplayString(k.name),1)],10,Zz))),128))])]),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(f)?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:b[8]||(b[8]=a.withModifiers((...k)=>a.unref(x)&&a.unref(x)(...k),["self"]))},[a.createElementVNode("div",{class:"zcode-image-modal-content","data-edit-mode":"",onClick:b[7]||(b[7]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",aM,[a.createElementVNode("div",lM,a.toDisplayString(A.$t("imagesManager.editImage")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":A.$t("common.close"),onClick:b[2]||(b[2]=(...k)=>a.unref(x)&&a.unref(x)(...k))},[a.createVNode(a.unref(Ye),{size:18})],8,cM)]),a.createElementVNode("div",dM,[a.createElementVNode("div",uM,[a.createElementVNode("img",{src:a.unref(f).url,alt:a.unref(f).name,class:"zcode-image-preview-large-img"},null,8,fM)]),a.createElementVNode("div",pM,[a.createElementVNode("label",null,a.toDisplayString(A.$t("imagesManager.imageId")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":b[3]||(b[3]=k=>a.unref(f).id=k),type:"text",class:"zcode-text-input",disabled:""},null,512),[[a.vModelText,a.unref(f).id]])]),a.createElementVNode("div",hM,[a.createElementVNode("label",null,a.toDisplayString(A.$t("imagesManager.imageName")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":b[4]||(b[4]=k=>a.unref(f).name=k),type:"text",class:"zcode-text-input"},null,512),[[a.vModelText,a.unref(f).name]])]),a.createElementVNode("div",mM,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-image-editor-actions-btn",onClick:b[5]||(b[5]=(...k)=>a.unref(g)&&a.unref(g)(...k))},[a.createVNode(a.unref(Qo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(A.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-image-editor-actions-btn",onClick:b[6]||(b[6]=(...k)=>a.unref(x)&&a.unref(x)(...k))},[a.createVNode(a.unref(Ye),{size:16}),a.createElementVNode("span",null,a.toDisplayString(A.$t("common.cancel")),1)])])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[i.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:b[11]||(b[11]=a.withModifiers(k=>i.value=!1,["self"]))},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:b[10]||(b[10]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",gM,[a.createElementVNode("div",yM,[a.createVNode(a.unref(js),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString(A.$t("dataViewer.categoryInfo.title")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":A.$t("common.close"),onClick:b[9]||(b[9]=k=>i.value=!1)},[a.createVNode(a.unref(Ye),{size:18})],8,bM)]),a.createElementVNode("div",xM,[a.createElementVNode("div",kM,[a.createElementVNode("div",EM,a.toDisplayString(A.$t("dataViewer.categoryInfo.common.title")),1),a.createElementVNode("div",wM,a.toDisplayString(A.$t("dataViewer.categoryInfo.common.description")),1)]),a.createElementVNode("div",SM,[a.createElementVNode("div",CM,a.toDisplayString(A.$t("dataViewer.categoryInfo.individual.title")),1),a.createElementVNode("div",NM,a.toDisplayString(A.$t("dataViewer.categoryInfo.individual.description")),1)]),a.createElementVNode("div",TM,[a.createElementVNode("div",vM,a.toDisplayString(A.$t("dataViewer.categoryInfo.special.title")),1),a.createElementVNode("div",zM,a.toDisplayString(A.$t("dataViewer.categoryInfo.special.description")),1)])])])])):a.createCommentVNode("",!0)]))]))}}),AM={class:"zcode-data-viewer"},IM={class:"zcode-data-viewer-header"},_M={class:"zcode-data-viewer-content-tabs"},OM={class:"zcode-data-viewer-tabs"},DM=["onClick"],RM={class:"zcode-data-viewer-content"},PM={class:"zcode-data-viewer-display-wrapper"},LM={class:"zcode-data-viewer-display"},$M=["title"],VM=a.defineComponent({__name:"DataViewer",props:{cmsData:{type:Object},config:{type:Object}},setup(n,{expose:e}){const t=n,o=a.ref("page"),r=a.ref("json"),i=a.ref(!1),s=a.computed(()=>t.config?.categoryOrder||"common"),l=a.computed(()=>{const M=[],E=o.value==="parts"?t.cmsData.parts.special.length>0:t.cmsData.images.special.length>0;return s.value==="individual"?(M.push("individual","common"),E&&M.push("special")):s.value==="special"?(E&&M.push("special"),M.push("common","individual")):(M.push("common","individual"),E&&M.push("special")),M}),c=a.ref(t.config?.categoryOrder==="individual"?"individual":t.config?.categoryOrder==="special"?"special":"common"),{fullPageHtml:d}=ti(t.cmsData,!1),u=a.computed(()=>{switch(o.value){case"page":return t.cmsData.page;case"parts":return c.value==="common"?t.cmsData.parts.common:c.value==="individual"?t.cmsData.parts.individual:t.cmsData.parts.special;case"images":return c.value==="common"?t.cmsData.images.common:c.value==="individual"?t.cmsData.images.individual:t.cmsData.images.special;default:return null}}),f=a.ref("");let p="";function h(){try{const M=u.value,E=JSON.stringify(M,null,2);if(E===p)return;f.value=E,p=E}catch{f.value=String(u.value),p=f.value}}function m(M){let E=M.replace(/\\\\/g,"\0").replace(/\\u([0-9a-fA-F]{4})/g,(v,_)=>String.fromCharCode(parseInt(_,16))).replace(/\\n/g,`
482
+ `).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\\//g,"/").replace(/\u0000/g,"\\");return E=E.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"),E}function y(M){if(!M)return"";const v=M.replace(/>\s+</g,"><").replace(/></g,`>
487
483
  <`).split(`
488
- `),M=[];let A=0;for(const y of T){const E=y.trim();if(!E)continue;const k=/^<\/[^>]+>/.test(E),O=/\/>$/.test(E)||/^<!/.test(E),G=/^<[^/!][^>]*>$/.test(E)&&!O;k&&(A=Math.max(A-1,0)),M.push(" ".repeat(A)+E),G&&A++}return M.join(`
489
- `)}const g=a.computed(()=>o.value==="page"&&r.value==="html"?b(d.value):m(f.value));a.watch(u,()=>{h()},{deep:!0,immediate:!1}),a.watch(()=>n.cmsData,()=>{h()},{deep:!0}),a.watch(()=>{switch(o.value){case"page":return n.cmsData.page;case"parts":return c.value==="common"?n.cmsData.parts.common:n.cmsData.parts.individual;case"images":return c.value==="common"?n.cmsData.images.common:n.cmsData.images.individual;default:return null}},()=>{h()},{deep:!0}),a.watch(c,()=>{h()}),a.watch(o,()=>{c.value=n.config?.categoryOrder==="individual"?"individual":"common",h()});const x=async()=>{const v=g.value;try{await navigator.clipboard.writeText(v),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(w){console.error("コピーに失敗しました:",w);const T=document.createElement("textarea");T.value=v,T.style.position="fixed",T.style.opacity="0",document.body.appendChild(T),T.select();try{document.execCommand("copy"),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(M){console.error("コピーに失敗しました:",M)}document.body.removeChild(T)}};return h(),e({internalActiveTab:o,activeCategory:c}),(v,w)=>(a.openBlock(),a.createElementBlock("div",WA,[a.createElementVNode("div",GA,[a.createElementVNode("div",qA,[a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="page"},"zcode-data-viewer-content-tab"]),onClick:w[0]||(w[0]=T=>o.value="page")},a.toDisplayString(v.$t("dataViewer.page")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="parts"},"zcode-data-viewer-content-tab"]),onClick:w[1]||(w[1]=T=>o.value="parts")},a.toDisplayString(v.$t("dataViewer.parts")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="images"},"zcode-data-viewer-content-tab"]),onClick:w[2]||(w[2]=T=>o.value="images")},a.toDisplayString(v.$t("dataViewer.images")),3)]),a.createElementVNode("div",KA,[o.value==="page"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createElementVNode("button",{class:a.normalizeClass([{active:r.value==="json"},"zcode-data-viewer-tab"]),onClick:w[3]||(w[3]=T=>r.value="json")},a.toDisplayString(v.$t("dataViewer.json")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:r.value==="html"},"zcode-data-viewer-tab"]),onClick:w[4]||(w[4]=T=>r.value="html")},a.toDisplayString(v.$t("dataViewer.html")),3)],64)):(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:1},a.renderList(l.value,T=>(a.openBlock(),a.createElementBlock("button",{key:T,class:a.normalizeClass([{active:c.value===T},"zcode-data-viewer-tab"]),onClick:M=>c.value=T},a.toDisplayString(T==="common"?v.$t("dataViewer.common"):T==="individual"?v.$t("dataViewer.individual"):v.$t("dataViewer.special")),11,JA))),128))])]),a.createElementVNode("div",XA,[a.createElementVNode("div",YA,[a.createElementVNode("pre",QA,a.toDisplayString(g.value),1),a.createElementVNode("button",{class:"zcode-data-viewer-copy-btn",title:i.value?v.$t("common.copied"):v.$t("common.copy"),onClick:x},[i.value?(a.openBlock(),a.createBlock(a.unref(sr),{key:0,size:18})):(a.openBlock(),a.createBlock(a.unref(Xm),{key:1,size:18}))],8,ZA)])])]))}}),tM={class:"zcode-dev-container"},nM={class:"zcode-dev-header"},oM={class:"zcode-dev-tabs"},rM=["title"],iM={key:3,class:"zcode-loading-message"},sM={class:"zcode-loading-message-text"},aM={key:5,class:"zcode-loading-message"},lM={class:"zcode-loading-message-text"},cM={key:6,class:"zcode-save-controls-fixed"},dM={class:"zcode-save-confirm-dialog"},uM={class:"zcode-save-confirm-dialog-header"},fM={class:"zcode-save-confirm-dialog-title"},pM={class:"zcode-save-confirm-dialog-body"},hM={class:"zcode-save-confirm-targets"},mM={class:"zcode-save-confirm-dialog-footer"},vc=a.defineComponent({__name:"ZeroCodeEditor",props:{locale:{type:String},page:{type:String},cssCommon:{type:String},cssIndividual:{type:String},cssSpecial:{type:String},partsCommon:{type:String},partsIndividual:{type:String},partsSpecial:{type:String},imagesCommon:{type:String},imagesIndividual:{type:String},imagesSpecial:{type:String},config:{type:String},endpoints:{type:String},backendData:{type:String},enablePartsManager:{type:Boolean},enableImagesManager:{type:Boolean}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.computed(()=>o.enablePartsManager!==!1),i=a.computed(()=>o.enableImagesManager!==!1),s=a.ref("manage"),l=a.ref("edit"),c=a.ref(null),d=a.ref(null),u=a.ref(null),f=a.ref(null),p=a.ref(!1),h=a.ref(!1),m=a.ref([]),g=(C=>{if(!C)return{};try{return JSON.parse(C)}catch($){return console.warn("[ZeroCodeEditor] Failed to parse config:",$),{}}})(o.config);function x(C){return typeof C=="object"&&C!==null}function v(C){return C==="common"||C==="individual"||C==="special"}function w(C){return C==="page"||C==="parts"||C==="images"}function T(C){if(x(C)&&"value"in C)return C.value}function M(C){const $=T(C);if(typeof $=="boolean")return $;if(typeof C=="boolean")return C}function A(C){const $=T(C);if(typeof $=="string")return $;if(typeof C=="string")return C}function y(C,$){return x(C)&&"value"in C?(C.value=$,!0):!1}function E(C,$){if(x(C))return C[$]}function k(C){const $=E(C,"activeCategory");if(v($))return $;const te=T($);return v(te)?te:void 0}function O(C){const $=E(C,"internalActiveTab");if(w($))return $;const te=T($);return w(te)?te:void 0}function G(){const C=c.value;return!x(C)||!("cmsData"in C)||!("currentMode"in C)||!("switchMode"in C)||!("allowDynamicContentInteraction"in C)||!("settingsPanelOpen"in C)||!("setData"in C)?null:C}const z=(C,$,te)=>{const ge=Mu();return ge[C]!==void 0?ge[C]:te!==void 0?te:$},R=a.ref(z("showDataViewer",!1,g.dev?.showDataViewer)),W=a.ref(z("showSaveConfirm",!0,g.dev?.showSaveConfirm)),{cmsData:H,loadDataFromProps:L}=km(o),j=a.computed(()=>{const C=G();return C?C.cmsData:H}),Z=a.computed(()=>{const C=G();return(C?A(C.currentMode):void 0)??"edit"}),K=C=>{c.value?.switchMode&&c.value.switchMode(C)};function ae(C){l.value=C,(C==="parts"||C==="images"||C==="data")&&(s.value="manage")}function ee(){const C=G();C&&!y(C.settingsPanelOpen,!0)&&(C.settingsPanelOpen=!0)}const X=a.computed(()=>{if(s.value==="preview")return!0;const C=G();if(C){const $=M(C.allowDynamicContentInteraction);if($!==void 0)return $}return h1("allowDynamicContentInteraction",!1)});function Y(C){const $=j.value;if(!C)return $;const te=C.split(".");let ge=$;for(const Re of te)if(!x(ge)||(ge=ge[Re],ge===void 0))return;return ge}function J(C,$){const te=G();return te?te.setData(C,$):!1}a.onMounted(()=>{L()}),a.watch([()=>o.page,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial],()=>{L()}),a.watch(R,C=>{Ba({showDataViewer:C})}),a.watch(W,C=>{Ba({showSaveConfirm:C})}),a.watch(s,(C,$)=>{de("view-mode-changed",{mode:C,previousMode:$})});function Q(C){W.value=C}function de(C,$){const te=document.querySelector("zcode-editor");if(te){const Re=new CustomEvent(C,{detail:$,bubbles:!0,composed:!0});te.dispatchEvent(Re);return}const ge=new CustomEvent(C,{detail:$,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(ge)}function ke(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Te(){if(!j.value)return[];let C;if(l.value==="edit")C="page";else if(l.value==="parts")if(!d.value)console.warn('[ZeroCode] partsManagerRefが設定されていません。デフォルトで"common"を使用します。'),C="parts-common";else{const te=k(d.value);te==null?(console.warn('[ZeroCode] parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),C="parts-common"):te==="common"?C="parts-common":te==="individual"?C="parts-individual":C="parts-special"}else if(l.value==="images")if(!u.value)console.warn('[ZeroCode] imagesManagerRefが設定されていません。デフォルトで"common"を使用します。'),C="images-common";else{const te=k(u.value);te==null?(console.warn('[ZeroCode] images activeCategoryが取得できません。デフォルトで"common"を使用します。'),C="images-common"):te==="common"?C="images-common":te==="individual"?C="images-individual":C="images-special"}else if(l.value==="data")if(!f.value)console.warn('[ZeroCode] dataViewerRefが設定されていません。デフォルトで"page"を使用します。'),C="page";else{const te=O(f.value),ge=k(f.value);if(te==null)console.warn('[ZeroCode] dataViewer internalActiveTabが取得できません。デフォルトで"page"を使用します。'),C="page";else if(te==="page")C="page";else if(te==="parts")ge==null?(console.warn('[ZeroCode] dataViewer parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),C="parts-common"):ge==="common"?C="parts-common":ge==="individual"?C="parts-individual":C="parts-special";else if(te==="images")ge==null?(console.warn('[ZeroCode] dataViewer images activeCategoryが取得できません。デフォルトで"common"を使用します。'),C="images-common"):ge==="common"?C="images-common":ge==="individual"?C="images-individual":C="images-special";else return console.warn(`[ZeroCode] dataViewer 不明なinternalActiveTab: ${te}`),[]}else return[];let $;return C==="page"?$=["page","images-common","images-individual"]:C==="parts-common"?$=[C,"parts-common-css"]:C==="parts-individual"?$=[C,"parts-individual-css"]:C==="parts-special"?$=[C,"parts-special-css"]:$=[C],$}function $e(){if(!W.value){N();return}const C=Te();if(C.length===0){console.warn(`[ZeroCode] ${n("editor.noSaveTargets")}`);return}m.value=C,h.value=!0}function N(){const C=Te();if(C.length===0){console.warn(`[ZeroCode] ${n("editor.noSaveTargets")}`);return}de("save-request",{requestId:ke(),source:"editor",targets:C,timestamp:Date.now()})}function P(){h.value=!1,N()}function V(){h.value=!1,m.value=[]}function S(C){const{t:$}=rn();return{page:$("saveConfirm.targets.page"),"parts-common":$("saveConfirm.targets.parts-common"),"parts-individual":$("saveConfirm.targets.parts-individual"),"parts-special":$("saveConfirm.targets.parts-special"),"images-common":$("saveConfirm.targets.images-common"),"images-individual":$("saveConfirm.targets.images-individual"),"images-special":$("saveConfirm.targets.images-special"),"parts-common-css":$("saveConfirm.targets.parts-common-css"),"parts-individual-css":$("saveConfirm.targets.parts-individual-css"),"parts-special-css":$("saveConfirm.targets.parts-special-css")}[C]||C}return e({getData:Y,setData:J,allowDynamicContentInteraction:X}),(C,$)=>(a.openBlock(),a.createElementBlock("div",tM,[a.createElementVNode("div",nM,[a.createElementVNode("div",oM,[a.createElementVNode("button",{class:a.normalizeClass([{active:l.value==="edit"},"zcode-dev-tab"]),onClick:$[0]||($[0]=te=>ae("edit"))},[a.createVNode(a.unref(oa),{size:16}),a.createElementVNode("span",null,a.toDisplayString(C.$t("editor.pageManagement")),1)],2),r.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass([{active:l.value==="parts"},"zcode-dev-tab"]),onClick:$[1]||($[1]=te=>ae("parts"))},[a.createVNode(a.unref(og),{size:16}),a.createElementVNode("span",null,a.toDisplayString(C.$t("editor.partsManagement")),1)],2)):a.createCommentVNode("",!0),i.value?(a.openBlock(),a.createElementBlock("button",{key:1,class:a.normalizeClass([{active:l.value==="images"},"zcode-dev-tab"]),onClick:$[2]||($[2]=te=>ae("images"))},[a.createVNode(a.unref(Rc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(C.$t("editor.imagesManagement")),1)],2)):a.createCommentVNode("",!0),a.createElementVNode("button",{class:a.normalizeClass([{active:l.value==="data"},"zcode-dev-tab"]),onClick:$[3]||($[3]=te=>ae("data"))},[a.createVNode(a.unref(Ym),{size:16}),a.createElementVNode("span",null,a.toDisplayString(C.$t("editor.dataViewer")),1)],2),a.createElementVNode("button",{class:"zcode-dev-tab zcode-dev-settings-btn",title:C.$t("toolbar.settings"),onClick:$[4]||($[4]=te=>p.value=!0)},[a.createVNode(a.unref($c),{size:16})],8,rM)])]),l.value==="edit"?(a.openBlock(),a.createBlock(rd,{key:0,"current-mode":Z.value,"view-mode":s.value,"allow-dynamic-content-interaction":X.value,onSwitchMode:K,onSwitchViewMode:$[5]||($[5]=te=>s.value=te),onOpenSettings:ee},null,8,["current-mode","view-mode","allow-dynamic-content-interaction"])):a.createCommentVNode("",!0),s.value==="preview"&&j.value?(a.openBlock(),a.createBlock(ma,{key:1,"cms-data":j.value,"allow-dynamic-content-interaction":X.value},null,8,["cms-data","allow-dynamic-content-interaction"])):a.createCommentVNode("",!0),a.withDirectives(a.createVNode(Hs,{ref_key:"cmsRef",ref:c,locale:o.locale,page:o.page,"css-common":o.cssCommon,"css-individual":o.cssIndividual,"css-special":o.cssSpecial,"parts-common":o.partsCommon,"parts-individual":o.partsIndividual,"parts-special":o.partsSpecial,"images-common":o.imagesCommon,"images-individual":o.imagesIndividual,"images-special":o.imagesSpecial,config:o.config,endpoints:o.endpoints,"backend-data":o.backendData},null,8,["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data"]),[[a.vShow,s.value==="manage"&&l.value==="edit"]]),s.value==="manage"&&r.value&&l.value==="parts"&&j.value?(a.openBlock(),a.createBlock(rA,{key:2,ref_key:"partsManagerRef",ref:d,"cms-data":j.value,config:a.unref(g)},null,8,["cms-data","config"])):a.createCommentVNode("",!0),s.value==="manage"&&r.value&&l.value==="parts"&&!j.value?(a.openBlock(),a.createElementBlock("div",iM,[a.createElementVNode("div",sM,a.toDisplayString(C.$t("editor.loading")),1)])):a.createCommentVNode("",!0),s.value==="manage"&&i.value&&l.value==="images"&&j.value?(a.openBlock(),a.createBlock(HA,{key:4,ref_key:"imagesManagerRef",ref:u,"cms-data":j.value,config:a.unref(g)},null,8,["cms-data","config"])):a.createCommentVNode("",!0),s.value==="manage"&&i.value&&l.value==="images"&&!j.value?(a.openBlock(),a.createElementBlock("div",aM,[a.createElementVNode("div",lM,a.toDisplayString(C.$t("editor.loading")),1)])):a.createCommentVNode("",!0),a.withDirectives(a.createVNode(eM,{ref_key:"dataViewerRef",ref:f,"cms-data":j.value,config:a.unref(g)},null,8,["cms-data","config"]),[[a.vShow,s.value==="manage"&&l.value==="data"&&j.value]]),a.withDirectives(a.createVNode(Ou,{"is-open":p.value,"view-mode":s.value,mode:"dev-tabs","show-save-confirm":W.value,onClose:$[6]||($[6]=te=>p.value=!1),onToggleSaveConfirm:Q},null,8,["is-open","view-mode","show-save-confirm"]),[[a.vShow,p.value]]),s.value==="manage"?(a.openBlock(),a.createElementBlock("div",cM,[a.createElementVNode("button",{class:"zcode-save-btn",onClick:$e},[a.createVNode(a.unref(Lc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(C.$t("common.save")),1)])])):a.createCommentVNode("",!0),h.value?(a.openBlock(),a.createElementBlock("div",{key:7,class:"zcode-save-confirm-dialog-overlay",onClick:a.withModifiers(V,["self"])},[a.createElementVNode("div",dM,[a.createElementVNode("div",uM,[a.createElementVNode("div",fM,a.toDisplayString(C.$t("saveConfirm.title")),1)]),a.createElementVNode("div",pM,[a.createElementVNode("p",null,a.toDisplayString(C.$t("saveConfirm.message")),1),a.createElementVNode("ul",hM,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(m.value,te=>(a.openBlock(),a.createElementBlock("li",{key:te},a.toDisplayString(S(te)),1))),128))])]),a.createElementVNode("div",mM,[a.createElementVNode("button",{class:"zcode-btn-secondary",onClick:V},a.toDisplayString(C.$t("common.cancel")),1),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:P},a.toDisplayString(C.$t("saveConfirm.saveButton")),1)])])])):a.createCommentVNode("",!0)]))}});Cm();class gM extends HTMLElement{app=null;componentInstance=null;_shadowRoot=null;constructor(){super()}connectedCallback(){if(this.app)return;this.getAttribute("use-shadow-dom")!=="false"?(this.setupShadowDOM(),window.addEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this))):(this.setupLightDOM(),window.addEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this)))}setupLightDOM(){const e=this.getAttribute("page")||"[]",n=this.getAttribute("css-common"),o=this.getAttribute("css-individual"),r=this.getAttribute("css-special"),i=this.getAttribute("parts-common")||"[]",s=this.getAttribute("parts-individual")||"[]",l=this.getAttribute("parts-special")||"[]",c=this.getAttribute("images-common")||"[]",d=this.getAttribute("images-individual")||"[]",u=this.getAttribute("images-special")||"[]",f=Ws(this);this.app=a.createApp(vc,{locale:f,page:e,cssCommon:n,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:s,partsSpecial:l,imagesCommon:c,imagesIndividual:d,imagesSpecial:u,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||"",enablePartsManager:this.getAttribute("enable-parts-manager")!=="false",enableImagesManager:this.getAttribute("enable-images-manager")!=="false"}),Gs(this.app,f),this.componentInstance=this.app.mount(this),this.injectLightDOMCSS()}setupShadowDOM(){const e=this.shadowRoot,n=!!e;e?(this._shadowRoot=e,this.clearScripts()):(this._shadowRoot=this.attachShadow({mode:"open"}),this.injectCSS());const o=this.getAttribute("page")||"[]",r=this.getAttribute("css-common"),i=this.getAttribute("css-individual"),s=this.getAttribute("css-special"),l=this.getAttribute("parts-common")||"[]",c=this.getAttribute("parts-individual")||"[]",d=this.getAttribute("parts-special")||"[]",u=this.getAttribute("images-common")||"[]",f=this.getAttribute("images-individual")||"[]",p=this.getAttribute("images-special")||"[]",h=Ws(this);this.app=a.createApp(vc,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:s,partsCommon:l,partsIndividual:c,partsSpecial:d,imagesCommon:u,imagesIndividual:f,imagesSpecial:p,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||"",enablePartsManager:this.getAttribute("enable-parts-manager")!=="false",enableImagesManager:this.getAttribute("enable-images-manager")!=="false"}),Gs(this.app,h),this.componentInstance=this.app.mount(this._shadowRoot),requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{this.injectScript(n)},100)})})}injectCSS(){if(!this._shadowRoot)return;const e=document.createElement("style");e.textContent=Sm,this._shadowRoot.appendChild(e),this.querySelectorAll('[slot="css"]').forEach(o=>{const r=o.cloneNode(!0);r.removeAttribute("slot"),this._shadowRoot.appendChild(r),o.remove()})}injectLightDOMCSS(){this.querySelectorAll('[slot="css"]').forEach(n=>{const o=n.cloneNode(!0);o.removeAttribute("slot"),document.head.appendChild(o)})}clearScripts(){if(!this._shadowRoot)return;this._shadowRoot.querySelectorAll("script").forEach(n=>{n.remove()})}injectScript(e=!1){if(!this._shadowRoot)return;const n=this.querySelectorAll('[slot="script"]'),o=Array.from(n),r=[],i=[];o.forEach(c=>{const d=c;if(!d.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}d.src.includes("jquery")||d.src.includes("code.jquery.com")?r.push(d):i.push(d)});const s=c=>{let d=c.src;if(e)try{const f=new URL(c.src,window.location.href);f.searchParams.set("_t",Date.now().toString()),d=f.toString()}catch{d=c.src+(c.src.includes("?")?"&":"?")+"_t="+Date.now()}const u=document.createElement("script");return u.src=d,c.type&&(u.type=c.type),c.async&&(u.async=!0),c.defer&&(u.defer=!0),c.integrity&&(u.integrity=c.integrity),c.crossOrigin&&(u.crossOrigin=c.crossOrigin),u.onerror=f=>{console.error(`Failed to load script: ${c.src}`,f)},u},l=()=>{o.forEach(c=>{c.remove()})};if(r.length>0){let c=0;const d=r.length;r.forEach(u=>{const f=s(u);f.onload=()=>{c++,c===d&&(Mo(this._shadowRoot,e),requestAnimationFrame(()=>{i.forEach(p=>{this._shadowRoot.appendChild(s(p))}),l()}))},this._shadowRoot.appendChild(f)})}else Mo(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(s(c))}),l()}injectLightDOMScripts(){const e=this.querySelectorAll('[slot="script"]'),n=[],o=[];e.forEach(i=>{const s=i;if(!s.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}s.src.includes("jquery")||s.src.includes("code.jquery.com")?n.push(s):o.push(s)});const r=i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},s};if(n.length>0){let i=0;const s=n.length;n.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===s&&requestAnimationFrame(()=>{o.forEach(d=>{document.body.appendChild(r(d))})})},document.body.appendChild(c)})}else o.forEach(i=>{document.body.appendChild(r(i))})}getData(e){return this.componentInstance&&this.componentInstance.getData?this.componentInstance.getData(e):null}setData(e,n){return this.componentInstance&&this.componentInstance.setData?this.componentInstance.setData(e,n):!1}get allowDynamicContentInteraction(){if(this.componentInstance){const e=this.componentInstance.allowDynamicContentInteraction;if(e!==void 0)return e&&typeof e=="object"&&"value"in e?e.value:e}return!0}set allowDynamicContentInteraction(e){if(this.componentInstance){const n=this.componentInstance.allowDynamicContentInteraction;n!==void 0&&(n&&typeof n=="object"&&"value"in n?n.value=e:this.componentInstance.allowDynamicContentInteraction=e)}}disconnectedCallback(){if(this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot){if(this._shadowRoot.__zecEventListeners){const e=this._shadowRoot.__zecEventListeners,n=this._shadowRoot;e.forEach(o=>{o.forEach(r=>{n.removeEventListener(r.eventName,r.handler,!0)})}),e.clear()}if(window.__zecShadowRoots){const e=window.__zecShadowRoots,n=this._shadowRoot;for(const[o,r]of e.entries())r===n&&e.delete(o)}}this._shadowRoot=null,window.removeEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this)),window.removeEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this))}handleDOMUpdated(){if(!this._shadowRoot||this.getAttribute("use-shadow-dom")!=="true")return;this._shadowRoot.__zecJQueryExtended&&delete this._shadowRoot.__zecJQueryExtended;const e=this._shadowRoot.querySelector("script[data-zec-shadow-extension]");e&&e.remove(),Mo(this._shadowRoot,!0)}handleLightDOMUpdated(){this.getAttribute("use-shadow-dom")!=="true"&&(this.__lightDOMScriptsLoaded||(this.injectLightDOMScripts(),this.__lightDOMScriptsLoaded=!0))}static get observedAttributes(){return["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data","enable-parts-manager","enable-images-manager","use-shadow-dom"]}attributeChangedCallback(e,n,o){if(n!==o){if(e==="use-shadow-dom"){this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot&&(this._shadowRoot.innerHTML="",this._shadowRoot=null),this.connectedCallback();return}this.app&&(this.app.unmount(),this.app=null,this.componentInstance=null,this.connectedCallback())}}}customElements.get("zcode-editor")||customElements.define("zcode-editor",gM);class ni extends Error{constructor(e,n,o){super(o),this.code=e,this.path=n,this.name="RenderError"}}function bM(t,e={}){const{enableEditorAttributes:n=!1}=e,o=t.backendData;if(!t)throw new ni("PARSE_ERROR","","データが提供されていません");const r=t.parts||{common:[],individual:[],special:[]},i=t.images||{common:[],individual:[],special:[]},s=t.page||[];function l(d){return ha(d,r)}function c(d,u="",f=new Set){if(f.has(u))throw new ni("CIRCULAR_REFERENCE",u,`循環参照が検出されました: ${u}`);f.add(u);const p=d.part_id,h=l(p);if(!h)throw new ni("PART_NOT_FOUND",u,`パーツが見つかりません: ${p}`);const m=ui(h.body,d,u,l,(b,g)=>c(b,g,f),n,i.common,i.individual,i.special,o);return n?td(m,{"data-zcode-id":d.id,"data-zcode-path":u,"data-zcode-part":p}):m}return s.map((d,u)=>{try{return c(d,`page.${u}`)}catch(f){if(f instanceof ni)return`<div class="zcode-error-message" data-error-code="${f.code}">${f.message}</div>`;throw f}}).join("")}en.RenderError=ni,en.ZeroCodeCMS=Hs,en.ZeroCodeEditor=vc,en.ZeroCodePreview=ma,en.renderToHtml=bM,Object.defineProperty(en,Symbol.toStringTag,{value:"Module"})}));
484
+ `),_=[];let A=0;for(const b of v){const k=b.trim();if(!k)continue;const w=/^<\/[^>]+>/.test(k),O=/\/>$/.test(k)||/^<!/.test(k),q=/^<[^/!][^>]*>$/.test(k)&&!O;w&&(A=Math.max(A-1,0)),_.push(" ".repeat(A)+k),q&&A++}return _.join(`
485
+ `)}const g=a.computed(()=>o.value==="page"&&r.value==="html"?y(d.value):m(f.value));a.watch(u,()=>{h()},{deep:!0,immediate:!1}),a.watch(()=>t.cmsData,()=>{h()},{deep:!0}),a.watch(()=>{switch(o.value){case"page":return t.cmsData.page;case"parts":return c.value==="common"?t.cmsData.parts.common:t.cmsData.parts.individual;case"images":return c.value==="common"?t.cmsData.images.common:t.cmsData.images.individual;default:return null}},()=>{h()},{deep:!0}),a.watch(c,()=>{h()}),a.watch(o,()=>{c.value=t.config?.categoryOrder==="individual"?"individual":"common",h()});const x=async()=>{const M=g.value;try{await navigator.clipboard.writeText(M),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(E){console.error("コピーに失敗しました:",E);const v=document.createElement("textarea");v.value=M,v.style.position="fixed",v.style.opacity="0",document.body.appendChild(v),v.select();try{document.execCommand("copy"),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(_){console.error("コピーに失敗しました:",_)}document.body.removeChild(v)}};return h(),e({internalActiveTab:o,activeCategory:c}),(M,E)=>(a.openBlock(),a.createElementBlock("div",AM,[a.createElementVNode("div",IM,[a.createElementVNode("div",_M,[a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="page"},"zcode-data-viewer-content-tab"]),onClick:E[0]||(E[0]=v=>o.value="page")},a.toDisplayString(M.$t("dataViewer.page")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="parts"},"zcode-data-viewer-content-tab"]),onClick:E[1]||(E[1]=v=>o.value="parts")},a.toDisplayString(M.$t("dataViewer.parts")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="images"},"zcode-data-viewer-content-tab"]),onClick:E[2]||(E[2]=v=>o.value="images")},a.toDisplayString(M.$t("dataViewer.images")),3)]),a.createElementVNode("div",OM,[o.value==="page"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createElementVNode("button",{class:a.normalizeClass([{active:r.value==="json"},"zcode-data-viewer-tab"]),onClick:E[3]||(E[3]=v=>r.value="json")},a.toDisplayString(M.$t("dataViewer.json")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:r.value==="html"},"zcode-data-viewer-tab"]),onClick:E[4]||(E[4]=v=>r.value="html")},a.toDisplayString(M.$t("dataViewer.html")),3)],64)):(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:1},a.renderList(l.value,v=>(a.openBlock(),a.createElementBlock("button",{key:v,class:a.normalizeClass([{active:c.value===v},"zcode-data-viewer-tab"]),onClick:_=>c.value=v},a.toDisplayString(v==="common"?M.$t("dataViewer.common"):v==="individual"?M.$t("dataViewer.individual"):M.$t("dataViewer.special")),11,DM))),128))])]),a.createElementVNode("div",RM,[a.createElementVNode("div",PM,[a.createElementVNode("pre",LM,a.toDisplayString(g.value),1),a.createElementVNode("button",{class:"zcode-data-viewer-copy-btn",title:i.value?M.$t("common.copied"):M.$t("common.copy"),onClick:x},[i.value?(a.openBlock(),a.createBlock(a.unref(Qo),{key:0,size:18})):(a.openBlock(),a.createBlock(a.unref(hm),{key:1,size:18}))],8,$M)])])]))}}),BM={class:"zcode-dev-container"},FM={class:"zcode-dev-header"},jM={class:"zcode-dev-tabs"},HM=["title"],UM={key:3,class:"zcode-loading-message"},WM={class:"zcode-loading-message-text"},qM={key:5,class:"zcode-loading-message"},GM={class:"zcode-loading-message-text"},KM={key:6,class:"zcode-save-controls-fixed"},JM={class:"zcode-save-confirm-dialog"},XM={class:"zcode-save-confirm-dialog-header"},YM={class:"zcode-save-confirm-dialog-title"},QM={class:"zcode-save-confirm-dialog-body"},ZM={class:"zcode-save-confirm-targets"},eA={class:"zcode-save-confirm-dialog-footer"},sc=a.defineComponent({__name:"ZeroCodeEditor",props:{locale:{type:String},page:{type:String},cssCommon:{type:String},cssIndividual:{type:String},cssSpecial:{type:String},partsCommon:{type:String},partsIndividual:{type:String},partsSpecial:{type:String},imagesCommon:{type:String},imagesIndividual:{type:String},imagesSpecial:{type:String},config:{type:String},endpoints:{type:String},backendData:{type:String},enablePartsManager:{type:Boolean},enableImagesManager:{type:Boolean}},setup(n,{expose:e}){const{t}=Qt(),o=n,r=a.computed(()=>o.enablePartsManager!==!1),i=a.computed(()=>o.enableImagesManager!==!1),s=a.ref("manage"),l=a.ref("edit"),c=a.ref(null),d=a.ref(null),u=a.ref(null),f=a.ref(null),p=a.ref(!1),h=a.ref(!1),m=a.ref([]),g=(N=>{if(!N)return{};try{return JSON.parse(N)}catch($){return console.warn("[ZeroCodeEditor] Failed to parse config:",$),{}}})(o.config);function x(N){return typeof N=="object"&&N!==null}function M(N){return N==="common"||N==="individual"||N==="special"}function E(N){return N==="page"||N==="parts"||N==="images"}function v(N){if(x(N)&&"value"in N)return N.value}function _(N){const $=v(N);if(typeof $=="boolean")return $;if(typeof N=="boolean")return N}function A(N){const $=v(N);if(typeof $=="string")return $;if(typeof N=="string")return N}function b(N,$){return x(N)&&"value"in N?(N.value=$,!0):!1}function k(N,$){if(x(N))return N[$]}function w(N){const $=k(N,"activeCategory");if(M($))return $;const ne=v($);return M(ne)?ne:void 0}function O(N){const $=k(N,"internalActiveTab");if(E($))return $;const ne=v($);return E(ne)?ne:void 0}function q(){const N=c.value;return!x(N)||!("cmsData"in N)||!("currentMode"in N)||!("switchMode"in N)||!("allowDynamicContentInteraction"in N)||!("settingsPanelOpen"in N)||!("setData"in N)?null:N}const T=(N,$,ne)=>{const me=Jd();return me[N]!==void 0?me[N]:ne!==void 0?ne:$},R=a.ref(T("showDataViewer",!1,g.dev?.showDataViewer)),H=a.ref(T("showSaveConfirm",!0,g.dev?.showSaveConfirm)),{cmsData:F,loadDataFromProps:L}=Vh(o),B=a.computed(()=>{const N=q();return N?N.cmsData:F}),te=a.computed(()=>{const N=q();return(N?A(N.currentMode):void 0)??"edit"}),K=N=>{c.value?.switchMode&&c.value.switchMode(N)};function ae(N){l.value=N,(N==="parts"||N==="images"||N==="data")&&(s.value="manage")}function Q(){const N=q();N&&!b(N.settingsPanelOpen,!0)&&(N.settingsPanelOpen=!0)}const Z=a.computed(()=>{if(s.value==="preview")return!0;const N=q();if(N){const $=_(N.allowDynamicContentInteraction);if($!==void 0)return $}return Zy("allowDynamicContentInteraction",!1)});function Y(N){const $=B.value;if(!N)return $;const ne=N.split(".");let me=$;for(const De of ne)if(!x(me)||(me=me[De],me===void 0))return;return me}function J(N,$){const ne=q();return ne?ne.setData(N,$):!1}a.onMounted(()=>{L()}),a.watch([()=>o.page,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial],()=>{L()}),a.watch(R,N=>{ka({showDataViewer:N})}),a.watch(H,N=>{ka({showSaveConfirm:N})}),a.watch(s,(N,$)=>{de("view-mode-changed",{mode:N,previousMode:$})});function ee(N){H.value=N}function de(N,$){const ne=document.querySelector("zcode-editor");if(ne){const De=new CustomEvent(N,{detail:$,bubbles:!0,composed:!0});ne.dispatchEvent(De);return}const me=new CustomEvent(N,{detail:$,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(me)}function we(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Ne(){if(!B.value)return[];let N;if(l.value==="edit")N="page";else if(l.value==="parts")if(!d.value)console.warn('[ZeroCode] partsManagerRefが設定されていません。デフォルトで"common"を使用します。'),N="parts-common";else{const ne=w(d.value);ne==null?(console.warn('[ZeroCode] parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="parts-common"):ne==="common"?N="parts-common":ne==="individual"?N="parts-individual":N="parts-special"}else if(l.value==="images")if(!u.value)console.warn('[ZeroCode] imagesManagerRefが設定されていません。デフォルトで"common"を使用します。'),N="images-common";else{const ne=w(u.value);ne==null?(console.warn('[ZeroCode] images activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="images-common"):ne==="common"?N="images-common":ne==="individual"?N="images-individual":N="images-special"}else if(l.value==="data")if(!f.value)console.warn('[ZeroCode] dataViewerRefが設定されていません。デフォルトで"page"を使用します。'),N="page";else{const ne=O(f.value),me=w(f.value);if(ne==null)console.warn('[ZeroCode] dataViewer internalActiveTabが取得できません。デフォルトで"page"を使用します。'),N="page";else if(ne==="page")N="page";else if(ne==="parts")me==null?(console.warn('[ZeroCode] dataViewer parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="parts-common"):me==="common"?N="parts-common":me==="individual"?N="parts-individual":N="parts-special";else if(ne==="images")me==null?(console.warn('[ZeroCode] dataViewer images activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="images-common"):me==="common"?N="images-common":me==="individual"?N="images-individual":N="images-special";else return console.warn(`[ZeroCode] dataViewer 不明なinternalActiveTab: ${ne}`),[]}else return[];let $;return N==="page"?$=["page","images-common","images-individual"]:N==="parts-common"?$=[N,"parts-common-css"]:N==="parts-individual"?$=[N,"parts-individual-css"]:N==="parts-special"?$=[N,"parts-special-css"]:$=[N],$}function Pe(){if(!H.value){C();return}const N=Ne();if(N.length===0){console.warn(`[ZeroCode] ${t("editor.noSaveTargets")}`);return}m.value=N,h.value=!0}function C(){const N=Ne();if(N.length===0){console.warn(`[ZeroCode] ${t("editor.noSaveTargets")}`);return}de("save-request",{requestId:we(),source:"editor",targets:N,timestamp:Date.now()})}function P(){h.value=!1,C()}function V(){h.value=!1,m.value=[]}function S(N){const{t:$}=Qt();return{page:$("saveConfirm.targets.page"),"parts-common":$("saveConfirm.targets.parts-common"),"parts-individual":$("saveConfirm.targets.parts-individual"),"parts-special":$("saveConfirm.targets.parts-special"),"images-common":$("saveConfirm.targets.images-common"),"images-individual":$("saveConfirm.targets.images-individual"),"images-special":$("saveConfirm.targets.images-special"),"parts-common-css":$("saveConfirm.targets.parts-common-css"),"parts-individual-css":$("saveConfirm.targets.parts-individual-css"),"parts-special-css":$("saveConfirm.targets.parts-special-css")}[N]||N}return e({getData:Y,setData:J,allowDynamicContentInteraction:Z}),(N,$)=>(a.openBlock(),a.createElementBlock("div",BM,[a.createElementVNode("div",FM,[a.createElementVNode("div",jM,[a.createElementVNode("button",{class:a.normalizeClass([{active:l.value==="edit"},"zcode-dev-tab"]),onClick:$[0]||($[0]=ne=>ae("edit"))},[a.createVNode(a.unref(Hs),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("editor.pageManagement")),1)],2),r.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass([{active:l.value==="parts"},"zcode-dev-tab"]),onClick:$[1]||($[1]=ne=>ae("parts"))},[a.createVNode(a.unref(Em),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("editor.partsManagement")),1)],2)):a.createCommentVNode("",!0),i.value?(a.openBlock(),a.createElementBlock("button",{key:1,class:a.normalizeClass([{active:l.value==="images"},"zcode-dev-tab"]),onClick:$[2]||($[2]=ne=>ae("images"))},[a.createVNode(a.unref(mc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("editor.imagesManagement")),1)],2)):a.createCommentVNode("",!0),a.createElementVNode("button",{class:a.normalizeClass([{active:l.value==="data"},"zcode-dev-tab"]),onClick:$[3]||($[3]=ne=>ae("data"))},[a.createVNode(a.unref(mm),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("editor.dataViewer")),1)],2),a.createElementVNode("button",{class:"zcode-dev-tab zcode-dev-settings-btn",title:N.$t("toolbar.settings"),onClick:$[4]||($[4]=ne=>p.value=!0)},[a.createVNode(a.unref(bc),{size:16})],8,HM)])]),l.value==="edit"?(a.openBlock(),a.createBlock($c,{key:0,"current-mode":te.value,"view-mode":s.value,"allow-dynamic-content-interaction":Z.value,onSwitchMode:K,onSwitchViewMode:$[5]||($[5]=ne=>s.value=ne),onOpenSettings:Q},null,8,["current-mode","view-mode","allow-dynamic-content-interaction"])):a.createCommentVNode("",!0),s.value==="preview"&&B.value?(a.openBlock(),a.createBlock(ta,{key:1,"cms-data":B.value,"allow-dynamic-content-interaction":Z.value},null,8,["cms-data","allow-dynamic-content-interaction"])):a.createCommentVNode("",!0),a.withDirectives(a.createVNode(As,{ref_key:"cmsRef",ref:c,locale:o.locale,page:o.page,"css-common":o.cssCommon,"css-individual":o.cssIndividual,"css-special":o.cssSpecial,"parts-common":o.partsCommon,"parts-individual":o.partsIndividual,"parts-special":o.partsSpecial,"images-common":o.imagesCommon,"images-individual":o.imagesIndividual,"images-special":o.imagesSpecial,config:o.config,endpoints:o.endpoints,"backend-data":o.backendData},null,8,["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data"]),[[a.vShow,s.value==="manage"&&l.value==="edit"]]),s.value==="manage"&&r.value&&l.value==="parts"&&B.value?(a.openBlock(),a.createBlock(Hz,{key:2,ref_key:"partsManagerRef",ref:d,"cms-data":B.value,config:a.unref(g)},null,8,["cms-data","config"])):a.createCommentVNode("",!0),s.value==="manage"&&r.value&&l.value==="parts"&&!B.value?(a.openBlock(),a.createElementBlock("div",UM,[a.createElementVNode("div",WM,a.toDisplayString(N.$t("editor.loading")),1)])):a.createCommentVNode("",!0),s.value==="manage"&&i.value&&l.value==="images"&&B.value?(a.openBlock(),a.createBlock(MM,{key:4,ref_key:"imagesManagerRef",ref:u,"cms-data":B.value,config:a.unref(g)},null,8,["cms-data","config"])):a.createCommentVNode("",!0),s.value==="manage"&&i.value&&l.value==="images"&&!B.value?(a.openBlock(),a.createElementBlock("div",qM,[a.createElementVNode("div",GM,a.toDisplayString(N.$t("editor.loading")),1)])):a.createCommentVNode("",!0),a.withDirectives(a.createVNode(VM,{ref_key:"dataViewerRef",ref:f,"cms-data":B.value,config:a.unref(g)},null,8,["cms-data","config"]),[[a.vShow,s.value==="manage"&&l.value==="data"&&B.value]]),a.withDirectives(a.createVNode(Yd,{"is-open":p.value,"view-mode":s.value,mode:"dev-tabs","show-save-confirm":H.value,onClose:$[6]||($[6]=ne=>p.value=!1),onToggleSaveConfirm:ee},null,8,["is-open","view-mode","show-save-confirm"]),[[a.vShow,p.value]]),s.value==="manage"?(a.openBlock(),a.createElementBlock("div",KM,[a.createElementVNode("button",{class:"zcode-save-btn",onClick:Pe},[a.createVNode(a.unref(yc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("common.save")),1)])])):a.createCommentVNode("",!0),h.value?(a.openBlock(),a.createElementBlock("div",{key:7,class:"zcode-save-confirm-dialog-overlay",onClick:a.withModifiers(V,["self"])},[a.createElementVNode("div",JM,[a.createElementVNode("div",XM,[a.createElementVNode("div",YM,a.toDisplayString(N.$t("saveConfirm.title")),1)]),a.createElementVNode("div",QM,[a.createElementVNode("p",null,a.toDisplayString(N.$t("saveConfirm.message")),1),a.createElementVNode("ul",ZM,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(m.value,ne=>(a.openBlock(),a.createElementBlock("li",{key:ne},a.toDisplayString(S(ne)),1))),128))])]),a.createElementVNode("div",eA,[a.createElementVNode("button",{class:"zcode-btn-secondary",onClick:V},a.toDisplayString(N.$t("common.cancel")),1),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:P},a.toDisplayString(N.$t("saveConfirm.saveButton")),1)])])])):a.createCommentVNode("",!0)]))}});Hh();class tA extends HTMLElement{app=null;componentInstance=null;_shadowRoot=null;constructor(){super()}connectedCallback(){if(this.app)return;this.getAttribute("use-shadow-dom")!=="false"?(this.setupShadowDOM(),window.addEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this))):(this.setupLightDOM(),window.addEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this)))}setupLightDOM(){const e=this.getAttribute("page")||"[]",t=this.getAttribute("css-common"),o=this.getAttribute("css-individual"),r=this.getAttribute("css-special"),i=this.getAttribute("parts-common")||"[]",s=this.getAttribute("parts-individual")||"[]",l=this.getAttribute("parts-special")||"[]",c=this.getAttribute("images-common")||"[]",d=this.getAttribute("images-individual")||"[]",u=this.getAttribute("images-special")||"[]",f=Is(this);this.app=a.createApp(sc,{locale:f,page:e,cssCommon:t,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:s,partsSpecial:l,imagesCommon:c,imagesIndividual:d,imagesSpecial:u,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||"",enablePartsManager:this.getAttribute("enable-parts-manager")!=="false",enableImagesManager:this.getAttribute("enable-images-manager")!=="false"}),_s(this.app,f),this.componentInstance=this.app.mount(this),this.injectLightDOMCSS()}setupShadowDOM(){const e=this.shadowRoot,t=!!e;e?(this._shadowRoot=e,this.clearScripts()):(this._shadowRoot=this.attachShadow({mode:"open"}),this.injectCSS());const o=this.getAttribute("page")||"[]",r=this.getAttribute("css-common"),i=this.getAttribute("css-individual"),s=this.getAttribute("css-special"),l=this.getAttribute("parts-common")||"[]",c=this.getAttribute("parts-individual")||"[]",d=this.getAttribute("parts-special")||"[]",u=this.getAttribute("images-common")||"[]",f=this.getAttribute("images-individual")||"[]",p=this.getAttribute("images-special")||"[]",h=Is(this);this.app=a.createApp(sc,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:s,partsCommon:l,partsIndividual:c,partsSpecial:d,imagesCommon:u,imagesIndividual:f,imagesSpecial:p,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||"",enablePartsManager:this.getAttribute("enable-parts-manager")!=="false",enableImagesManager:this.getAttribute("enable-images-manager")!=="false"}),_s(this.app,h),this.componentInstance=this.app.mount(this._shadowRoot),requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{this.injectScript(t)},100)})})}injectCSS(){if(!this._shadowRoot)return;const e=document.createElement("style");e.textContent=Fh,this._shadowRoot.appendChild(e),this.querySelectorAll('[slot="css"]').forEach(o=>{const r=o.cloneNode(!0);r.removeAttribute("slot"),this._shadowRoot.appendChild(r),o.remove()})}injectLightDOMCSS(){this.querySelectorAll('[slot="css"]').forEach(t=>{const o=t.cloneNode(!0);o.removeAttribute("slot"),document.head.appendChild(o)})}clearScripts(){if(!this._shadowRoot)return;this._shadowRoot.querySelectorAll("script").forEach(t=>{t.remove()})}injectScript(e=!1){if(!this._shadowRoot)return;const t=this.querySelectorAll('[slot="script"]'),o=Array.from(t),r=[],i=[];o.forEach(c=>{const d=c;if(!d.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}d.src.includes("jquery")||d.src.includes("code.jquery.com")?r.push(d):i.push(d)});const s=c=>{let d=c.src;if(e)try{const f=new URL(c.src,window.location.href);f.searchParams.set("_t",Date.now().toString()),d=f.toString()}catch{d=c.src+(c.src.includes("?")?"&":"?")+"_t="+Date.now()}const u=document.createElement("script");return u.src=d,c.type&&(u.type=c.type),c.async&&(u.async=!0),c.defer&&(u.defer=!0),c.integrity&&(u.integrity=c.integrity),c.crossOrigin&&(u.crossOrigin=c.crossOrigin),u.onerror=f=>{console.error(`Failed to load script: ${c.src}`,f)},u},l=()=>{o.forEach(c=>{c.remove()})};if(r.length>0){let c=0;const d=r.length;r.forEach(u=>{const f=s(u);f.onload=()=>{c++,c===d&&(Co(this._shadowRoot,e),requestAnimationFrame(()=>{i.forEach(p=>{this._shadowRoot.appendChild(s(p))}),l()}))},this._shadowRoot.appendChild(f)})}else Co(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(s(c))}),l()}injectLightDOMScripts(){const e=this.querySelectorAll('[slot="script"]'),t=[],o=[];e.forEach(i=>{const s=i;if(!s.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}s.src.includes("jquery")||s.src.includes("code.jquery.com")?t.push(s):o.push(s)});const r=i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},s};if(t.length>0){let i=0;const s=t.length;t.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===s&&requestAnimationFrame(()=>{o.forEach(d=>{document.body.appendChild(r(d))})})},document.body.appendChild(c)})}else o.forEach(i=>{document.body.appendChild(r(i))})}getData(e){return this.componentInstance&&this.componentInstance.getData?this.componentInstance.getData(e):null}setData(e,t){return this.componentInstance&&this.componentInstance.setData?this.componentInstance.setData(e,t):!1}get allowDynamicContentInteraction(){if(this.componentInstance){const e=this.componentInstance.allowDynamicContentInteraction;if(e!==void 0)return e&&typeof e=="object"&&"value"in e?e.value:e}return!0}set allowDynamicContentInteraction(e){if(this.componentInstance){const t=this.componentInstance.allowDynamicContentInteraction;t!==void 0&&(t&&typeof t=="object"&&"value"in t?t.value=e:this.componentInstance.allowDynamicContentInteraction=e)}}disconnectedCallback(){if(this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot){if(this._shadowRoot.__zecEventListeners){const e=this._shadowRoot.__zecEventListeners,t=this._shadowRoot;e.forEach(o=>{o.forEach(r=>{t.removeEventListener(r.eventName,r.handler,!0)})}),e.clear()}if(window.__zecShadowRoots){const e=window.__zecShadowRoots,t=this._shadowRoot;for(const[o,r]of e.entries())r===t&&e.delete(o)}}this._shadowRoot=null,window.removeEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this)),window.removeEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this))}handleDOMUpdated(){if(!this._shadowRoot||this.getAttribute("use-shadow-dom")!=="true")return;this._shadowRoot.__zecJQueryExtended&&delete this._shadowRoot.__zecJQueryExtended;const e=this._shadowRoot.querySelector("script[data-zec-shadow-extension]");e&&e.remove(),Co(this._shadowRoot,!0)}handleLightDOMUpdated(){this.getAttribute("use-shadow-dom")!=="true"&&(this.__lightDOMScriptsLoaded||(this.injectLightDOMScripts(),this.__lightDOMScriptsLoaded=!0))}static get observedAttributes(){return["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data","enable-parts-manager","enable-images-manager","use-shadow-dom"]}attributeChangedCallback(e,t,o){if(t!==o){if(e==="use-shadow-dom"){this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot&&(this._shadowRoot.innerHTML="",this._shadowRoot=null),this.connectedCallback();return}this.app&&(this.app.unmount(),this.app=null,this.componentInstance=null,this.connectedCallback())}}}customElements.get("zcode-editor")||customElements.define("zcode-editor",tA);class Wr extends Error{constructor(e,t,o){super(o),this.code=e,this.path=t,this.name="RenderError"}}function nA(n,e={}){const{enableEditorAttributes:t=!1}=e,o=n.backendData;if(!n)throw new Wr("PARSE_ERROR","","データが提供されていません");const r=n.parts||{common:[],individual:[],special:[]},i=n.images||{common:[],individual:[],special:[]},s=n.page||[];function l(d){return ea(d,r)}function c(d,u="",f=new Set){if(f.has(u))throw new Wr("CIRCULAR_REFERENCE",u,`循環参照が検出されました: ${u}`);f.add(u);const p=d.part_id,h=l(p);if(!h)throw new Wr("PART_NOT_FOUND",u,`パーツが見つかりません: ${p}`);const m=ei(h.body,d,u,l,(y,g)=>c(y,g,f),t,i.common,i.individual,i.special,o);return t?Rc(m,{"data-zcode-id":d.id,"data-zcode-path":u,"data-zcode-part":p}):m}return s.map((d,u)=>{try{return c(d,`page.${u}`)}catch(f){if(f instanceof Wr)return`<div class="zcode-error-message" data-error-code="${f.code}">${f.message}</div>`;throw f}}).join("")}Gt.RenderError=Wr,Gt.ZeroCodeCMS=As,Gt.ZeroCodeEditor=sc,Gt.ZeroCodePreview=ta,Gt.renderToHtml=nA,Object.defineProperty(Gt,Symbol.toStringTag,{value:"Module"})}));