zerocodejs 1.0.1-beta.12 → 1.0.1-beta.13

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
1
  (function(Qt,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],s):(Qt=typeof globalThis<"u"?globalThis:Qt||self,s(Qt.ZeroCode={},Qt.Vue))})(this,(function(Qt,s){"use strict";const mc=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),fm=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,o)=>o?o.toUpperCase():t.toLowerCase()),pm=n=>{const e=fm(n);return e.charAt(0).toUpperCase()+e.slice(1)},hm=(...n)=>n.filter((e,t,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===t).join(" ").trim(),gc=n=>n==="";var Qo={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 mm=({name:n,iconNode:e,absoluteStrokeWidth:t,"absolute-stroke-width":o,strokeWidth:r,"stroke-width":i,size:a=Qo.width,color:l=Qo.stroke,...c},{slots:d})=>s.h("svg",{...Qo,...c,width:a,height:a,stroke:l,"stroke-width":gc(t)||gc(o)||t===!0||o===!0?Number(r||i||Qo["stroke-width"])*24/Number(a):r||i||Qo["stroke-width"],class:hm("lucide",c.class,...n?[`lucide-${mc(pm(n))}-icon`,`lucide-${mc(n)}`]:["lucide-icon"])},[...e.map(u=>s.h(...u)),...d.default?[d.default()]:[]]);const He=(n,e)=>(t,{slots:o,attrs:r})=>s.h(mm,{...r,...t,iconNode:e,name:n},o);const Zo=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 gm=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 er=He("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const ei=He("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Dn=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 ym=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 bm=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 xm=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 yc=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 Hs=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 km=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 Em=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 wm=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 Sm=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 Cm=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 bc=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 ao=He("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const xc=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 kc=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 Us=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 Nm=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 Pn=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 Ec=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 Ye=He("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const wc=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 vm{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 Tm=["innerHTML"],zm={key:0,class:"zcode-empty-state"},Sc=s.defineComponent({__name:"PreviewArea",props:{cmsData:{type:Object},fullPageHtml:{type:String},onAddClick:{type:Function},allowDynamicContentInteraction:{type:Boolean}},setup(n,{expose:e}){const t=n,o=s.ref(null),r=s.ref(null),i=new vm;let a=null,l=!1;const c=u=>{if(t.allowDynamicContentInteraction===!1){const f=u.target;(f.tagName==="A"||f.closest("a"))&&(u.preventDefault(),u.stopPropagation())}};s.watch(()=>t.fullPageHtml,()=>{s.nextTick(()=>{r.value&&(l=!0,a&&a.disconnect(),a=new MutationObserver(()=>{l&&(l=!1,s.nextTick(()=>{window.dispatchEvent(new CustomEvent("zcode-dom-updated",{})),a&&(a.disconnect(),a=null)}))}),a.observe(r.value,{childList:!0,subtree:!0,characterData:!0}))})},{immediate:!1}),s.watch(()=>[t.cmsData.css?.common,t.cmsData.css?.individual,t.cmsData.css?.special],()=>{s.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 s.onMounted(()=>{s.nextTick(()=>{r.value&&(window.dispatchEvent(new CustomEvent("zcode-dom-updated",{})),r.value.addEventListener("click",c,!0)),d()})}),s.onUnmounted(()=>{a&&(a.disconnect(),a=null),r.value&&r.value.removeEventListener("click",c,!0),i.cleanup()}),e({previewArea:o}),(u,f)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"previewArea",ref:o},[s.createElementVNode("div",{ref_key:"htmlContainer",ref:r,innerHTML:n.fullPageHtml},null,8,Tm),n.cmsData.page.length===0&&n.onAddClick?(s.openBlock(),s.createElementBlock("div",zm,[s.createElementVNode("p",null,s.toDisplayString(u.$t("emptyState.message")),1),s.createElementVNode("button",{class:"zcode-add-btn",onClick:f[0]||(f[0]=p=>n.onAddClick("page.0"))},s.toDisplayString(u.$t("emptyState.addPart")),1)])):s.createCommentVNode("",!0)],512))}});function Mm(n,e){typeof console<"u"&&(console.warn("[intlify] "+n),e&&console.warn(e.stack))}const Cc=typeof window<"u",Rn=(n,e=!1)=>e?Symbol.for(n):Symbol(n),Am=(n,e,t)=>Im({l:n,k:e,s:t}),Im=n=>JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),it=n=>typeof n=="number"&&isFinite(n),_m=n=>Mc(n)==="[object Date]",ti=n=>Mc(n)==="[object RegExp]",ni=n=>Ve(n)&&Object.keys(n).length===0,kt=Object.assign,Om=Object.create,Be=(n=null)=>Om(n);let Nc;const oi=()=>Nc||(Nc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:Be());function vc(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 Tc(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 Dm(n){return n=n.replace(/(\w+)\s*=\s*"([^"]*)"/g,(o,r,i)=>`${r}="${Tc(i)}"`),n=n.replace(/(\w+)\s*=\s*'([^']*)'/g,(o,r,i)=>`${r}='${Tc(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 Pm=Object.prototype.hasOwnProperty;function Zt(n,e){return Pm.call(n,e)}const ot=Array.isArray,Je=n=>typeof n=="function",xe=n=>typeof n=="string",Ge=n=>typeof n=="boolean",$e=n=>n!==null&&typeof n=="object",Rm=n=>$e(n)&&Je(n.then)&&Je(n.catch),zc=Object.prototype.toString,Mc=n=>zc.call(n),Ve=n=>{if(!$e(n))return!1;const e=Object.getPrototypeOf(n);return e===null||e.constructor===Object},Lm=n=>n==null?"":ot(n)||Ve(n)&&n.toString===zc?JSON.stringify(n,null,2):String(n);function $m(n,e=""){return n.reduce((t,o,r)=>r===0?t+o:t+e+o,"")}function ri(n){let e=n;return()=>++e}const ii=n=>!$e(n)||ot(n);function si(n,e){if(ii(n)||ii(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__"&&($e(o[i])&&!$e(r[i])&&(r[i]=Array.isArray(o[i])?[]:Be()),ii(r[i])||ii(o[i])?r[i]=o[i]:t.push({src:o[i],des:r[i]}))})}}function Vm(n,e,t){return{line:n,column:e,offset:t}}function ai(n,e,t){return{start:n,end:e}}const Bm=/\{([0-9a-zA-Z]+)\}/g;function Ac(n,...e){return e.length===1&&Fm(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),n.replace(Bm,(t,o)=>e.hasOwnProperty(o)?e[o]:"")}const Ic=Object.assign,_c=n=>typeof n=="string",Fm=n=>n!==null&&typeof n=="object";function Oc(n,e=""){return n.reduce((t,o,r)=>r===0?t+o:t+e+o,"")}const Ws={USE_MODULO_SYNTAX:1,__EXTEND_POINT__:2},jm={[Ws.USE_MODULO_SYNTAX]:"Use modulo before '{{0}}'."};function Hm(n,e,...t){const o=Ac(jm[n],...t||[]),r={message:String(o),code:n};return e&&(r.location=e),r}const Ce={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},Um={[Ce.EXPECTED_TOKEN]:"Expected token: '{0}'",[Ce.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[Ce.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[Ce.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[Ce.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[Ce.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[Ce.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[Ce.EMPTY_PLACEHOLDER]:"Empty placeholder",[Ce.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[Ce.INVALID_LINKED_FORMAT]:"Invalid linked format",[Ce.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[Ce.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[Ce.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[Ce.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[Ce.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[Ce.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function To(n,e,t={}){const{domain:o,messages:r,args:i}=t,a=Ac((r||Um)[n]||"",...i||[]),l=new SyntaxError(String(a));return l.code=n,e&&(l.location=e),l.domain=o,l}function Wm(n){throw n}const bn=" ",qm="\r",Et=`
2
- `,Gm="\u2028",Km="\u2029";function Jm(n){const e=n;let t=0,o=1,r=1,i=0;const a=k=>e[k]===qm&&e[k+1]===Et,l=k=>e[k]===Et,c=k=>e[k]===Km,d=k=>e[k]===Gm,u=k=>a(k)||l(k)||c(k)||d(k),f=()=>t,p=()=>o,h=()=>r,m=()=>i,g=k=>a(k)||c(k)||d(k)?Et:e[k],y=()=>g(t),x=()=>g(t+i);function C(){return i=0,u(t)&&(o++,r=0),a(t)&&t++,t++,r++,e[t]}function E(){return a(t+i)&&i++,i++,e[t+i]}function v(){t=0,o=1,r=1,i=0}function A(k=0){i=k}function M(){const k=t+i;for(;k!==t;)C();i=0}return{index:f,line:p,column:h,peekOffset:m,charAt:g,currentChar:y,currentPeek:x,next:C,peek:E,reset:v,resetPeek:A,skipToPeek:M}}const Ln=void 0,Xm=".",Dc="'",Ym="tokenizer";function Qm(n,e={}){const t=e.location!==!1,o=Jm(n),r=()=>o.index(),i=()=>Vm(o.line(),o.column(),o.index()),a=i(),l=r(),c={currentType:14,offset:l,startLoc:a,endLoc:a,lastType:14,lastOffset:l,lastStartLoc:a,lastEndLoc:a,braceNest:0,inLinked:!1,text:""},d=()=>c,{onError:u}=e;function f(T,I,Q,...ge){const Te=d();if(I.column+=Q,I.offset+=Q,u){const ye=t?ai(Te.startLoc,I):null,H=To(T,ye,{domain:Ym,args:ge});u(H)}}function p(T,I,Q){T.endLoc=i(),T.currentType=I;const ge={type:I};return t&&(ge.loc=ai(T.startLoc,T.endLoc)),Q!=null&&(ge.value=Q),ge}const h=T=>p(T,14);function m(T,I){return T.currentChar()===I?(T.next(),I):(f(Ce.EXPECTED_TOKEN,i(),0,I),"")}function g(T){let I="";for(;T.currentPeek()===bn||T.currentPeek()===Et;)I+=T.currentPeek(),T.peek();return I}function y(T){const I=g(T);return T.skipToPeek(),I}function x(T){if(T===Ln)return!1;const I=T.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I===95}function C(T){if(T===Ln)return!1;const I=T.charCodeAt(0);return I>=48&&I<=57}function E(T,I){const{currentType:Q}=I;if(Q!==2)return!1;g(T);const ge=x(T.currentPeek());return T.resetPeek(),ge}function v(T,I){const{currentType:Q}=I;if(Q!==2)return!1;g(T);const ge=T.currentPeek()==="-"?T.peek():T.currentPeek(),Te=C(ge);return T.resetPeek(),Te}function A(T,I){const{currentType:Q}=I;if(Q!==2)return!1;g(T);const ge=T.currentPeek()===Dc;return T.resetPeek(),ge}function M(T,I){const{currentType:Q}=I;if(Q!==8)return!1;g(T);const ge=T.currentPeek()===".";return T.resetPeek(),ge}function k(T,I){const{currentType:Q}=I;if(Q!==9)return!1;g(T);const ge=x(T.currentPeek());return T.resetPeek(),ge}function w(T,I){const{currentType:Q}=I;if(!(Q===8||Q===12))return!1;g(T);const ge=T.currentPeek()===":";return T.resetPeek(),ge}function b(T,I){const{currentType:Q}=I;if(Q!==10)return!1;const ge=()=>{const ye=T.currentPeek();return ye==="{"?x(T.peek()):ye==="@"||ye==="%"||ye==="|"||ye===":"||ye==="."||ye===bn||!ye?!1:ye===Et?(T.peek(),ge()):O(T,!1)},Te=ge();return T.resetPeek(),Te}function R(T){g(T);const I=T.currentPeek()==="|";return T.resetPeek(),I}function B(T){const I=g(T),Q=T.currentPeek()==="%"&&T.peek()==="{";return T.resetPeek(),{isModulo:Q,hasSpace:I.length>0}}function O(T,I=!0){const Q=(Te=!1,ye="",H=!1)=>{const ee=T.currentPeek();return ee==="{"?ye==="%"?!1:Te:ee==="@"||!ee?ye==="%"?!0:Te:ee==="%"?(T.peek(),Q(Te,"%",!0)):ee==="|"?ye==="%"||H?!0:!(ye===bn||ye===Et):ee===bn?(T.peek(),Q(!0,bn,H)):ee===Et?(T.peek(),Q(!0,Et,H)):!0},ge=Q();return I&&T.resetPeek(),ge}function D(T,I){const Q=T.currentChar();return Q===Ln?Ln:I(Q)?(T.next(),Q):null}function P(T){const I=T.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36}function q(T){return D(T,P)}function W(T){const I=T.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36||I===45}function V(T){return D(T,W)}function G(T){const I=T.charCodeAt(0);return I>=48&&I<=57}function J(T){return D(T,G)}function oe(T){const I=T.charCodeAt(0);return I>=48&&I<=57||I>=65&&I<=70||I>=97&&I<=102}function ne(T){return D(T,oe)}function X(T){let I="",Q="";for(;I=J(T);)Q+=I;return Q}function Z(T){y(T);const I=T.currentChar();return I!=="%"&&f(Ce.EXPECTED_TOKEN,i(),0,I),T.next(),"%"}function Y(T){let I="";for(;;){const Q=T.currentChar();if(Q==="{"||Q==="}"||Q==="@"||Q==="|"||!Q)break;if(Q==="%")if(O(T))I+=Q,T.next();else break;else if(Q===bn||Q===Et)if(O(T))I+=Q,T.next();else{if(R(T))break;I+=Q,T.next()}else I+=Q,T.next()}return I}function te(T){y(T);let I="",Q="";for(;I=V(T);)Q+=I;return T.currentChar()===Ln&&f(Ce.UNTERMINATED_CLOSING_BRACE,i(),0),Q}function de(T){y(T);let I="";return T.currentChar()==="-"?(T.next(),I+=`-${X(T)}`):I+=X(T),T.currentChar()===Ln&&f(Ce.UNTERMINATED_CLOSING_BRACE,i(),0),I}function me(T){return T!==Dc&&T!==Et}function Me(T){y(T),m(T,"'");let I="",Q="";for(;I=D(T,me);)I==="\\"?Q+=Le(T):Q+=I;const ge=T.currentChar();return ge===Et||ge===Ln?(f(Ce.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,i(),0),ge===Et&&(T.next(),m(T,"'")),Q):(m(T,"'"),Q)}function Le(T){const I=T.currentChar();switch(I){case"\\":case"'":return T.next(),`\\${I}`;case"u":return N(T,I,4);case"U":return N(T,I,6);default:return f(Ce.UNKNOWN_ESCAPE_SEQUENCE,i(),0,I),""}}function N(T,I,Q){m(T,I);let ge="";for(let Te=0;Te<Q;Te++){const ye=ne(T);if(!ye){f(Ce.INVALID_UNICODE_ESCAPE_SEQUENCE,i(),0,`\\${I}${ge}${T.currentChar()}`);break}ge+=ye}return`\\${I}${ge}`}function L(T){return T!=="{"&&T!=="}"&&T!==bn&&T!==Et}function $(T){y(T);let I="",Q="";for(;I=D(T,L);)Q+=I;return Q}function S(T){let I="",Q="";for(;I=q(T);)Q+=I;return Q}function K(T){const I=Q=>{const ge=T.currentChar();return ge==="{"||ge==="%"||ge==="@"||ge==="|"||ge==="("||ge===")"||!ge||ge===bn?Q:(Q+=ge,T.next(),I(Q))};return I("")}function z(T){y(T);const I=m(T,"|");return y(T),I}function U(T,I){let Q=null;switch(T.currentChar()){case"{":return I.braceNest>=1&&f(Ce.NOT_ALLOW_NEST_PLACEHOLDER,i(),0),T.next(),Q=p(I,2,"{"),y(T),I.braceNest++,Q;case"}":return I.braceNest>0&&I.currentType===2&&f(Ce.EMPTY_PLACEHOLDER,i(),0),T.next(),Q=p(I,3,"}"),I.braceNest--,I.braceNest>0&&y(T),I.inLinked&&I.braceNest===0&&(I.inLinked=!1),Q;case"@":return I.braceNest>0&&f(Ce.UNTERMINATED_CLOSING_BRACE,i(),0),Q=ie(T,I)||h(I),I.braceNest=0,Q;default:{let Te=!0,ye=!0,H=!0;if(R(T))return I.braceNest>0&&f(Ce.UNTERMINATED_CLOSING_BRACE,i(),0),Q=p(I,1,z(T)),I.braceNest=0,I.inLinked=!1,Q;if(I.braceNest>0&&(I.currentType===5||I.currentType===6||I.currentType===7))return f(Ce.UNTERMINATED_CLOSING_BRACE,i(),0),I.braceNest=0,Se(T,I);if(Te=E(T,I))return Q=p(I,5,te(T)),y(T),Q;if(ye=v(T,I))return Q=p(I,6,de(T)),y(T),Q;if(H=A(T,I))return Q=p(I,7,Me(T)),y(T),Q;if(!Te&&!ye&&!H)return Q=p(I,13,$(T)),f(Ce.INVALID_TOKEN_IN_PLACEHOLDER,i(),0,Q.value),y(T),Q;break}}return Q}function ie(T,I){const{currentType:Q}=I;let ge=null;const Te=T.currentChar();switch((Q===8||Q===9||Q===12||Q===10)&&(Te===Et||Te===bn)&&f(Ce.INVALID_LINKED_FORMAT,i(),0),Te){case"@":return T.next(),ge=p(I,8,"@"),I.inLinked=!0,ge;case".":return y(T),T.next(),p(I,9,".");case":":return y(T),T.next(),p(I,10,":");default:return R(T)?(ge=p(I,1,z(T)),I.braceNest=0,I.inLinked=!1,ge):M(T,I)||w(T,I)?(y(T),ie(T,I)):k(T,I)?(y(T),p(I,12,S(T))):b(T,I)?(y(T),Te==="{"?U(T,I)||ge:p(I,11,K(T))):(Q===8&&f(Ce.INVALID_LINKED_FORMAT,i(),0),I.braceNest=0,I.inLinked=!1,Se(T,I))}}function Se(T,I){let Q={type:14};if(I.braceNest>0)return U(T,I)||h(I);if(I.inLinked)return ie(T,I)||h(I);switch(T.currentChar()){case"{":return U(T,I)||h(I);case"}":return f(Ce.UNBALANCED_CLOSING_BRACE,i(),0),T.next(),p(I,3,"}");case"@":return ie(T,I)||h(I);default:{if(R(T))return Q=p(I,1,z(T)),I.braceNest=0,I.inLinked=!1,Q;const{isModulo:Te,hasSpace:ye}=B(T);if(Te)return ye?p(I,0,Y(T)):p(I,4,Z(T));if(O(T))return p(I,0,Y(T));break}}return Q}function ve(){const{currentType:T,offset:I,startLoc:Q,endLoc:ge}=c;return c.lastType=T,c.lastOffset=I,c.lastStartLoc=Q,c.lastEndLoc=ge,c.offset=r(),c.startLoc=i(),o.currentChar()===Ln?p(c,14):Se(o,c)}return{nextToken:ve,currentOffset:r,currentPosition:i,context:d}}const Zm="parser",eg=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function tg(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 ng(n={}){const e=n.location!==!1,{onError:t,onWarn:o}=n;function r(E,v,A,M,...k){const w=E.currentPosition();if(w.offset+=M,w.column+=M,t){const b=e?ai(A,w):null,R=To(v,b,{domain:Zm,args:k});t(R)}}function i(E,v,A,M,...k){const w=E.currentPosition();if(w.offset+=M,w.column+=M,o){const b=e?ai(A,w):null;o(Hm(v,b,k))}}function a(E,v,A){const M={type:E};return e&&(M.start=v,M.end=v,M.loc={start:A,end:A}),M}function l(E,v,A,M){e&&(E.end=v,E.loc&&(E.loc.end=A))}function c(E,v){const A=E.context(),M=a(3,A.offset,A.startLoc);return M.value=v,l(M,E.currentOffset(),E.currentPosition()),M}function d(E,v){const A=E.context(),{lastOffset:M,lastStartLoc:k}=A,w=a(5,M,k);return w.index=parseInt(v,10),E.nextToken(),l(w,E.currentOffset(),E.currentPosition()),w}function u(E,v,A){const M=E.context(),{lastOffset:k,lastStartLoc:w}=M,b=a(4,k,w);return b.key=v,A===!0&&(b.modulo=!0),E.nextToken(),l(b,E.currentOffset(),E.currentPosition()),b}function f(E,v){const A=E.context(),{lastOffset:M,lastStartLoc:k}=A,w=a(9,M,k);return w.value=v.replace(eg,tg),E.nextToken(),l(w,E.currentOffset(),E.currentPosition()),w}function p(E){const v=E.nextToken(),A=E.context(),{lastOffset:M,lastStartLoc:k}=A,w=a(8,M,k);return v.type!==12?(r(E,Ce.UNEXPECTED_EMPTY_LINKED_MODIFIER,A.lastStartLoc,0),w.value="",l(w,M,k),{nextConsumeToken:v,node:w}):(v.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,A.lastStartLoc,0,en(v)),w.value=v.value||"",l(w,E.currentOffset(),E.currentPosition()),{node:w})}function h(E,v){const A=E.context(),M=a(7,A.offset,A.startLoc);return M.value=v,l(M,E.currentOffset(),E.currentPosition()),M}function m(E){const v=E.context(),A=a(6,v.offset,v.startLoc);let M=E.nextToken();if(M.type===9){const k=p(E);A.modifier=k.node,M=k.nextConsumeToken||E.nextToken()}switch(M.type!==10&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(M)),M=E.nextToken(),M.type===2&&(M=E.nextToken()),M.type){case 11:M.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(M)),A.key=h(E,M.value||"");break;case 5:M.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(M)),A.key=u(E,M.value||"");break;case 6:M.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(M)),A.key=d(E,M.value||"");break;case 7:M.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(M)),A.key=f(E,M.value||"");break;default:{r(E,Ce.UNEXPECTED_EMPTY_LINKED_KEY,v.lastStartLoc,0);const k=E.context(),w=a(7,k.offset,k.startLoc);return w.value="",l(w,k.offset,k.startLoc),A.key=w,l(A,k.offset,k.startLoc),{nextConsumeToken:M,node:A}}}return l(A,E.currentOffset(),E.currentPosition()),{node:A}}function g(E){const v=E.context(),A=v.currentType===1?E.currentOffset():v.offset,M=v.currentType===1?v.endLoc:v.startLoc,k=a(2,A,M);k.items=[];let w=null,b=null;do{const O=w||E.nextToken();switch(w=null,O.type){case 0:O.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(O)),k.items.push(c(E,O.value||""));break;case 6:O.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(O)),k.items.push(d(E,O.value||""));break;case 4:b=!0;break;case 5:O.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(O)),k.items.push(u(E,O.value||"",!!b)),b&&(i(E,Ws.USE_MODULO_SYNTAX,v.lastStartLoc,0,en(O)),b=null);break;case 7:O.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(O)),k.items.push(f(E,O.value||""));break;case 8:{const D=m(E);k.items.push(D.node),w=D.nextConsumeToken||null;break}}}while(v.currentType!==14&&v.currentType!==1);const R=v.currentType===1?v.lastOffset:E.currentOffset(),B=v.currentType===1?v.lastEndLoc:E.currentPosition();return l(k,R,B),k}function y(E,v,A,M){const k=E.context();let w=M.items.length===0;const b=a(1,v,A);b.cases=[],b.cases.push(M);do{const R=g(E);w||(w=R.items.length===0),b.cases.push(R)}while(k.currentType!==14);return w&&r(E,Ce.MUST_HAVE_MESSAGES_IN_PLURAL,A,0),l(b,E.currentOffset(),E.currentPosition()),b}function x(E){const v=E.context(),{offset:A,startLoc:M}=v,k=g(E);return v.currentType===14?k:y(E,A,M,k)}function C(E){const v=Qm(E,Ic({},n)),A=v.context(),M=a(0,A.offset,A.startLoc);return e&&M.loc&&(M.loc.source=E),M.body=x(v),n.onCacheKey&&(M.cacheKey=n.onCacheKey(E)),A.currentType!==14&&r(v,Ce.UNEXPECTED_LEXICAL_ANALYSIS,A.lastStartLoc,0,E[A.offset]||""),l(M,v.currentOffset(),v.currentPosition()),M}return{parse:C}}function en(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 og(n,e={}){const t={ast:n,helpers:new Set};return{context:()=>t,helper:i=>(t.helpers.add(i),i)}}function Pc(n,e){for(let t=0;t<n.length;t++)qs(n[t],e)}function qs(n,e){switch(n.type){case 1:Pc(n.cases,e),e.helper("plural");break;case 2:Pc(n.items,e);break;case 6:{qs(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 rg(n,e={}){const t=og(n);t.helper("normalize"),n.body&&qs(n.body,t);const o=t.context();n.helpers=Array.from(o.helpers)}function ig(n){const e=n.body;return e.type===2?Rc(e):e.cases.forEach(t=>Rc(t)),n}function Rc(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=Oc(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 sg="minifier";function zo(n){switch(n.t=n.type,n.type){case 0:{const e=n;zo(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++)zo(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++)zo(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;zo(e.key),e.k=e.key,delete e.key,e.modifier&&(zo(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 To(Ce.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:sg,args:[n.type]})}delete n.type}const ag="parser";function lg(n,e){const{filename:t,breakLineCode:o,needIndent:r}=e,i=e.location!==!1,a={filename:t,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:r,indentLevel:0};i&&n.loc&&(a.source=n.loc.source);const l=()=>a;function c(g,y){a.code+=g}function d(g,y=!0){const x=y?o:"";c(r?x+" ".repeat(g):x)}function u(g=!0){const y=++a.indentLevel;g&&d(y)}function f(g=!0){const y=--a.indentLevel;g&&d(y)}function p(){d(a.indentLevel)}return{context:l,push:c,indent:u,deindent:f,newline:p,helper:g=>`_${g}`,needIndent:()=>a.needIndent}}function cg(n,e){const{helper:t}=n;n.push(`${t("linked")}(`),Mo(n,e.key),e.modifier?(n.push(", "),Mo(n,e.modifier),n.push(", _type")):n.push(", undefined, _type"),n.push(")")}function dg(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&&(Mo(n,e.items[i]),i!==r-1);i++)n.push(", ");n.deindent(o()),n.push("])")}function ug(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&&(Mo(n,e.cases[i]),i!==r-1);i++)n.push(", ");n.deindent(o()),n.push("])")}}function fg(n,e){e.body?Mo(n,e.body):n.push("null")}function Mo(n,e){const{helper:t}=n;switch(e.type){case 0:fg(n,e);break;case 1:ug(n,e);break;case 2:dg(n,e);break;case 6:cg(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 To(Ce.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:ag,args:[e.type]})}}const pg=(n,e={})=>{const t=_c(e.mode)?e.mode:"normal",o=_c(e.filename)?e.filename:"message.intl";e.sourceMap;const r=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":`
3
- `,i=e.needIndent?e.needIndent:t!=="arrow",a=n.helpers||[],l=lg(n,{filename:o,breakLineCode:r,needIndent:i});l.push(t==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),l.indent(i),a.length>0&&(l.push(`const { ${Oc(a.map(u=>`${u}: _${u}`),", ")} } = ctx`),l.newline()),l.push("return "),Mo(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 hg(n,e={}){const t=Ic({},e),o=!!t.jit,r=!!t.minify,i=t.optimize==null?!0:t.optimize,l=ng(t).parse(n);return o?(i&&ig(l),r&&zo(l),{ast:l,code:""}):(rg(l,t),pg(l,t))}function mg(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(oi().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(oi().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function an(n){return $e(n)&&Gs(n)===0&&(Zt(n,"b")||Zt(n,"body"))}const Lc=["b","body"];function gg(n){return $n(n,Lc)}const $c=["c","cases"];function yg(n){return $n(n,$c,[])}const Vc=["s","static"];function bg(n){return $n(n,Vc)}const Bc=["i","items"];function xg(n){return $n(n,Bc,[])}const Fc=["t","type"];function Gs(n){return $n(n,Fc)}const jc=["v","value"];function li(n,e){const t=$n(n,jc);if(t!=null)return t;throw tr(e)}const Hc=["m","modifier"];function kg(n){return $n(n,Hc)}const Uc=["k","key"];function Eg(n){const e=$n(n,Uc);if(e)return e;throw tr(6)}function $n(n,e,t){for(let o=0;o<e.length;o++){const r=e[o];if(Zt(n,r)&&n[r]!=null)return n[r]}return t}const Wc=[...Lc,...$c,...Vc,...Bc,...Uc,...Hc,...jc,...Fc];function tr(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 wg=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function Sg(n){return wg.test(n)}function Cg(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 Ng(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 vg(n){const e=n.trim();return n.charAt(0)==="0"&&isNaN(parseInt(n))?!1:Sg(e)?Cg(e):"*"+e}function Tg(n){const e=[];let t=-1,o=0,r=0,i,a,l,c,d,u,f;const p=[];p[0]=()=>{a===void 0?a=l:a+=l},p[1]=()=>{a!==void 0&&(e.push(a),a=void 0)},p[2]=()=>{p[0](),r++},p[3]=()=>{if(r>0)r--,o=4,p[0]();else{if(r=0,a===void 0||(a=vg(a),a===!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=Ng(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 qc=new Map;function zg(n,e){return $e(n)?n[e]:null}function Mg(n,e){if(!$e(n))return null;let t=qc.get(e);if(t||(t=Tg(e),t&&qc.set(e,t)),!t)return null;const o=t.length;let r=n,i=0;for(;i<o;){const a=t[i];if(Wc.includes(a)&&an(r))return null;const l=r[a];if(l===void 0||Je(r))return null;r=l,i++}return r}const Ag=n=>n,Ig=n=>"",_g="text",Og=n=>n.length===0?"":$m(n),Dg=Lm;function Gc(n,e){return n=Math.abs(n),e===2?n?n>1?1:0:1:n?Math.min(n,2):0}function Pg(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 Rg(n,e){e.count||(e.count=n),e.n||(e.n=n)}function Lg(n={}){const e=n.locale,t=Pg(n),o=$e(n.pluralRules)&&xe(e)&&Je(n.pluralRules[e])?n.pluralRules[e]:Gc,r=$e(n.pluralRules)&&xe(e)&&Je(n.pluralRules[e])?Gc:void 0,i=x=>x[o(t,x.length,r)],a=n.list||[],l=x=>a[x],c=n.named||Be();it(n.pluralIndex)&&Rg(t,c);const d=x=>c[x];function u(x){const C=Je(n.messages)?n.messages(x):$e(n.messages)?n.messages[x]:!1;return C||(n.parent?n.parent.message(x):Ig)}const f=x=>n.modifiers?n.modifiers[x]:Ag,p=Ve(n.processor)&&Je(n.processor.normalize)?n.processor.normalize:Og,h=Ve(n.processor)&&Je(n.processor.interpolate)?n.processor.interpolate:Dg,m=Ve(n.processor)&&xe(n.processor.type)?n.processor.type:_g,y={list:l,named:d,plural:i,linked:(x,...C)=>{const[E,v]=C;let A="text",M="";C.length===1?$e(E)?(M=E.modifier||M,A=E.type||A):xe(E)&&(M=E||M):C.length===2&&(xe(E)&&(M=E||M),xe(v)&&(A=v||A));const k=u(x)(y),w=A==="vnode"&&ot(k)&&M?k[0]:k;return M?f(M)(w,A):w},message:u,type:m,interpolate:h,normalize:p,values:kt(Be(),a,c)};return y}const $g=Ws.__EXTEND_POINT__,lo=ri($g),Vg={FALLBACK_TO_TRANSLATE:lo(),CANNOT_FORMAT_NUMBER:lo(),FALLBACK_TO_NUMBER_FORMAT:lo(),CANNOT_FORMAT_DATE:lo(),FALLBACK_TO_DATE_FORMAT:lo(),EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:lo(),__EXTEND_POINT__:lo()},Kc=Ce.__EXTEND_POINT__,co=ri(Kc),tn={INVALID_ARGUMENT:Kc,INVALID_DATE_ARGUMENT:co(),INVALID_ISO_DATE_ARGUMENT:co(),NOT_SUPPORT_NON_STRING_MESSAGE:co(),NOT_SUPPORT_LOCALE_PROMISE_VALUE:co(),NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:co(),NOT_SUPPORT_LOCALE_TYPE:co(),__EXTEND_POINT__:co()};function ln(n){return To(n,null,void 0)}function Ks(n,e){return e.locale!=null?Jc(e.locale):Jc(n.locale)}let Js;function Jc(n){if(xe(n))return n;if(Je(n)){if(n.resolvedOnce&&Js!=null)return Js;if(n.constructor.name==="Function"){const e=n();if(Rm(e))throw ln(tn.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Js=e}else throw ln(tn.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw ln(tn.NOT_SUPPORT_LOCALE_TYPE)}function Bg(n,e,t){return[...new Set([t,...ot(e)?e:$e(e)?Object.keys(e):xe(e)?[e]:[t]])]}function Xc(n,e,t){const o=xe(t)?t:di,r=n;r.__localeChainCache||(r.__localeChainCache=new Map);let i=r.__localeChainCache.get(o);if(!i){i=[];let a=[t];for(;ot(a);)a=Yc(i,a,e);const l=ot(e)||!Ve(e)?e:e.default?e.default:null;a=xe(l)?[l]:l,ot(a)&&Yc(i,a,!1),r.__localeChainCache.set(o,i)}return i}function Yc(n,e,t){let o=!0;for(let r=0;r<e.length&&Ge(o);r++){const i=e[r];xe(i)&&(o=Fg(n,e[r],t))}return o}function Fg(n,e,t){let o;const r=e.split("-");do{const i=r.join("-");o=jg(n,i,t),r.splice(-1,1)}while(r.length&&o===!0);return o}function jg(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),(ot(t)||Ve(t))&&t[r]&&(o=t[r])}return o}const Hg="9.14.5",ci=-1,di="en-US",Qc="",Zc=n=>`${n.charAt(0).toLocaleUpperCase()}${n.substr(1)}`;function Ug(){return{upper:(n,e)=>e==="text"&&xe(n)?n.toUpperCase():e==="vnode"&&$e(n)&&"__v_isVNode"in n?n.children.toUpperCase():n,lower:(n,e)=>e==="text"&&xe(n)?n.toLowerCase():e==="vnode"&&$e(n)&&"__v_isVNode"in n?n.children.toLowerCase():n,capitalize:(n,e)=>e==="text"&&xe(n)?Zc(n):e==="vnode"&&$e(n)&&"__v_isVNode"in n?Zc(n.children):n}}let ed;function td(n){ed=n}let nd;function Wg(n){nd=n}let od;function qg(n){od=n}const fA=n=>{};let rd=null;const id=n=>{rd=n},Gg=()=>rd;let sd=0;function Kg(n={}){const e=Je(n.onWarn)?n.onWarn:Mm,t=xe(n.version)?n.version:Hg,o=xe(n.locale)||Je(n.locale)?n.locale:di,r=Je(o)?di:o,i=ot(n.fallbackLocale)||Ve(n.fallbackLocale)||xe(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:r,a=Ve(n.messages)?n.messages:Xs(r),l=Ve(n.datetimeFormats)?n.datetimeFormats:Xs(r),c=Ve(n.numberFormats)?n.numberFormats:Xs(r),d=kt(Be(),n.modifiers,Ug()),u=n.pluralRules||Be(),f=Je(n.missing)?n.missing:null,p=Ge(n.missingWarn)||ti(n.missingWarn)?n.missingWarn:!0,h=Ge(n.fallbackWarn)||ti(n.fallbackWarn)?n.fallbackWarn:!0,m=!!n.fallbackFormat,g=!!n.unresolving,y=Je(n.postTranslation)?n.postTranslation:null,x=Ve(n.processor)?n.processor:null,C=Ge(n.warnHtmlMessage)?n.warnHtmlMessage:!0,E=!!n.escapeParameter,v=Je(n.messageCompiler)?n.messageCompiler:ed,A=Je(n.messageResolver)?n.messageResolver:nd||zg,M=Je(n.localeFallbacker)?n.localeFallbacker:od||Bg,k=$e(n.fallbackContext)?n.fallbackContext:void 0,w=n,b=$e(w.__datetimeFormatters)?w.__datetimeFormatters:new Map,R=$e(w.__numberFormatters)?w.__numberFormatters:new Map,B=$e(w.__meta)?w.__meta:{};sd++;const O={version:t,cid:sd,locale:o,fallbackLocale:i,messages:a,modifiers:d,pluralRules:u,missing:f,missingWarn:p,fallbackWarn:h,fallbackFormat:m,unresolving:g,postTranslation:y,processor:x,warnHtmlMessage:C,escapeParameter:E,messageCompiler:v,messageResolver:A,localeFallbacker:M,fallbackContext:k,onWarn:e,__meta:B};return O.datetimeFormats=l,O.numberFormats=c,O.__datetimeFormatters=b,O.__numberFormatters=R,O}const Xs=n=>({[n]:Be()});function Ys(n,e,t,o,r){const{missing:i,onWarn:a}=n;if(i!==null){const l=i(n,t,e,r);return xe(l)?l:e}else return e}function nr(n,e,t){const o=n;o.__localeChainCache=new Map,n.localeFallbacker(n,t,e)}function Jg(n,e){return n===e?!1:n.split("-")[0]===e.split("-")[0]}function Xg(n,e){const t=e.indexOf(n);if(t===-1)return!1;for(let o=t+1;o<e.length;o++)if(Jg(n,e[o]))return!0;return!1}function Qs(n){return t=>Yg(t,n)}function Yg(n,e){const t=gg(e);if(t==null)throw tr(0);if(Gs(t)===1){const i=yg(t);return n.plural(i.reduce((a,l)=>[...a,ad(n,l)],[]))}else return ad(n,t)}function ad(n,e){const t=bg(e);if(t!=null)return n.type==="text"?t:n.normalize([t]);{const o=xg(e).reduce((r,i)=>[...r,Zs(n,i)],[]);return n.normalize(o)}}function Zs(n,e){const t=Gs(e);switch(t){case 3:return li(e,t);case 9:return li(e,t);case 4:{const o=e;if(Zt(o,"k")&&o.k)return n.interpolate(n.named(o.k));if(Zt(o,"key")&&o.key)return n.interpolate(n.named(o.key));throw tr(t)}case 5:{const o=e;if(Zt(o,"i")&&it(o.i))return n.interpolate(n.list(o.i));if(Zt(o,"index")&&it(o.index))return n.interpolate(n.list(o.index));throw tr(t)}case 6:{const o=e,r=kg(o),i=Eg(o);return n.linked(Zs(n,i),r?Zs(n,r):void 0,n.type)}case 7:return li(e,t);case 8:return li(e,t);default:throw new Error(`unhandled node on format message part: ${t}`)}}const ld=n=>n;let Ao=Be();function cd(n,e={}){let t=!1;const o=e.onError||Wm;return e.onError=r=>{t=!0,o(r)},{...hg(n,e),detectError:t}}const Qg=(n,e)=>{if(!xe(n))throw ln(tn.NOT_SUPPORT_NON_STRING_MESSAGE);{Ge(e.warnHtmlMessage)&&e.warnHtmlMessage;const o=(e.onCacheKey||ld)(n),r=Ao[o];if(r)return r;const{code:i,detectError:a}=cd(n,e),l=new Function(`return ${i}`)();return a?l:Ao[o]=l}};function Zg(n,e){if(__INTLIFY_JIT_COMPILATION__&&!__INTLIFY_DROP_MESSAGE_COMPILER__&&xe(n)){Ge(e.warnHtmlMessage)&&e.warnHtmlMessage;const o=(e.onCacheKey||ld)(n),r=Ao[o];if(r)return r;const{ast:i,detectError:a}=cd(n,{...e,location:!1,jit:!0}),l=Qs(i);return a?l:Ao[o]=l}else{const t=n.cacheKey;if(t){const o=Ao[t];return o||(Ao[t]=Qs(n))}else return Qs(n)}}const dd=()=>"",xn=n=>Je(n);function ud(n,...e){const{fallbackFormat:t,postTranslation:o,unresolving:r,messageCompiler:i,fallbackLocale:a,messages:l}=n,[c,d]=ea(...e),u=Ge(d.missingWarn)?d.missingWarn:n.missingWarn,f=Ge(d.fallbackWarn)?d.fallbackWarn:n.fallbackWarn,p=Ge(d.escapeParameter)?d.escapeParameter:n.escapeParameter,h=!!d.resolvedMessage,m=xe(d.default)||Ge(d.default)?Ge(d.default)?i?c:()=>c:d.default:t?i?c:()=>c:"",g=t||m!=="",y=Ks(n,d);p&&ey(d);let[x,C,E]=h?[c,y,l[y]||Be()]:fd(n,c,y,a,f,u),v=x,A=c;if(!h&&!(xe(v)||an(v)||xn(v))&&g&&(v=m,A=v),!h&&(!(xe(v)||an(v)||xn(v))||!xe(C)))return r?ci:c;let M=!1;const k=()=>{M=!0},w=xn(v)?v:pd(n,c,C,v,A,k);if(M)return v;const b=oy(n,C,E,d),R=Lg(b),B=ty(n,w,R);let O=o?o(B,c):B;return p&&xe(O)&&(O=Dm(O)),O}function ey(n){ot(n.list)?n.list=n.list.map(e=>xe(e)?vc(e):e):$e(n.named)&&Object.keys(n.named).forEach(e=>{xe(n.named[e])&&(n.named[e]=vc(n.named[e]))})}function fd(n,e,t,o,r,i){const{messages:a,onWarn:l,messageResolver:c,localeFallbacker:d}=n,u=d(n,o,t);let f=Be(),p,h=null;const m="translate";for(let g=0;g<u.length&&(p=u[g],f=a[p]||Be(),(h=c(f,e))===null&&(h=f[e]),!(xe(h)||an(h)||xn(h)));g++)if(!Xg(p,u)){const y=Ys(n,e,p,i,m);y!==e&&(h=y)}return[h,p,f]}function pd(n,e,t,o,r,i){const{messageCompiler:a,warnHtmlMessage:l}=n;if(xn(o)){const d=o;return d.locale=d.locale||t,d.key=d.key||e,d}if(a==null){const d=(()=>o);return d.locale=t,d.key=e,d}const c=a(o,ny(n,t,r,o,l,i));return c.locale=t,c.key=e,c.source=o,c}function ty(n,e,t){return e(t)}function ea(...n){const[e,t,o]=n,r=Be();if(!xe(e)&&!it(e)&&!xn(e)&&!an(e))throw ln(tn.INVALID_ARGUMENT);const i=it(e)?String(e):(xn(e),e);return it(t)?r.plural=t:xe(t)?r.default=t:Ve(t)&&!ni(t)?r.named=t:ot(t)&&(r.list=t),it(o)?r.plural=o:xe(o)?r.default=o:Ve(o)&&kt(r,o),[i,r]}function ny(n,e,t,o,r,i){return{locale:e,key:t,warnHtmlMessage:r,onError:a=>{throw i&&i(a),a},onCacheKey:a=>Am(e,t,a)}}function oy(n,e,t,o){const{modifiers:r,pluralRules:i,messageResolver:a,fallbackLocale:l,fallbackWarn:c,missingWarn:d,fallbackContext:u}=n,p={locale:e,modifiers:r,pluralRules:i,messages:h=>{let m=a(t,h);if(m==null&&u){const[,,g]=fd(u,h,e,l,c,d);m=a(g,h)}if(xe(m)||an(m)){let g=!1;const x=pd(n,h,e,m,h,()=>{g=!0});return g?dd:x}else return xn(m)?m:dd}};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 hd(n,...e){const{datetimeFormats:t,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:a}=n,{__datetimeFormatters:l}=n,[c,d,u,f]=ta(...e),p=Ge(u.missingWarn)?u.missingWarn:n.missingWarn;Ge(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn;const h=!!u.part,m=Ks(n,u),g=a(n,r,m);if(!xe(c)||c==="")return new Intl.DateTimeFormat(m,f).format(d);let y={},x,C=null;const E="datetime format";for(let M=0;M<g.length&&(x=g[M],y=t[x]||{},C=y[c],!Ve(C));M++)Ys(n,c,x,p,E);if(!Ve(C)||!xe(x))return o?ci:c;let v=`${x}__${c}`;ni(f)||(v=`${v}__${JSON.stringify(f)}`);let A=l.get(v);return A||(A=new Intl.DateTimeFormat(x,kt({},C,f)),l.set(v,A)),h?A.formatToParts(d):A.format(d)}const md=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function ta(...n){const[e,t,o,r]=n,i=Be();let a=Be(),l;if(xe(e)){const c=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!c)throw ln(tn.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 ln(tn.INVALID_ISO_DATE_ARGUMENT)}}else if(_m(e)){if(isNaN(e.getTime()))throw ln(tn.INVALID_DATE_ARGUMENT);l=e}else if(it(e))l=e;else throw ln(tn.INVALID_ARGUMENT);return xe(t)?i.key=t:Ve(t)&&Object.keys(t).forEach(c=>{md.includes(c)?a[c]=t[c]:i[c]=t[c]}),xe(o)?i.locale=o:Ve(o)&&(a=o),Ve(r)&&(a=r),[i.key||"",l,i,a]}function gd(n,e,t){const o=n;for(const r in t){const i=`${e}__${r}`;o.__datetimeFormatters.has(i)&&o.__datetimeFormatters.delete(i)}}function yd(n,...e){const{numberFormats:t,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:a}=n,{__numberFormatters:l}=n,[c,d,u,f]=na(...e),p=Ge(u.missingWarn)?u.missingWarn:n.missingWarn;Ge(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn;const h=!!u.part,m=Ks(n,u),g=a(n,r,m);if(!xe(c)||c==="")return new Intl.NumberFormat(m,f).format(d);let y={},x,C=null;const E="number format";for(let M=0;M<g.length&&(x=g[M],y=t[x]||{},C=y[c],!Ve(C));M++)Ys(n,c,x,p,E);if(!Ve(C)||!xe(x))return o?ci:c;let v=`${x}__${c}`;ni(f)||(v=`${v}__${JSON.stringify(f)}`);let A=l.get(v);return A||(A=new Intl.NumberFormat(x,kt({},C,f)),l.set(v,A)),h?A.formatToParts(d):A.format(d)}const bd=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function na(...n){const[e,t,o,r]=n,i=Be();let a=Be();if(!it(e))throw ln(tn.INVALID_ARGUMENT);const l=e;return xe(t)?i.key=t:Ve(t)&&Object.keys(t).forEach(c=>{bd.includes(c)?a[c]=t[c]:i[c]=t[c]}),xe(o)?i.locale=o:Ve(o)&&(a=o),Ve(r)&&(a=r),[i.key||"",l,i,a]}function xd(n,e,t){const o=n;for(const r in t){const i=`${e}__${r}`;o.__numberFormatters.has(i)&&o.__numberFormatters.delete(i)}}mg();const ry="9.14.5";function iy(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(oi().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(oi().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}const sy=Vg.__EXTEND_POINT__,kn=ri(sy);kn(),kn(),kn(),kn(),kn(),kn(),kn(),kn(),kn();const kd=tn.__EXTEND_POINT__,zt=ri(kd),En={UNEXPECTED_RETURN_TYPE:kd,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 To(n,null,void 0)}const oa=Rn("__translateVNode"),ra=Rn("__datetimeParts"),ia=Rn("__numberParts"),ay=Rn("__setPluralRules"),ly=Rn("__injectWithOption"),sa=Rn("__dispose");function or(n){if(!$e(n)||an(n))return n;for(const e in n)if(Zt(n,e))if(!e.includes("."))$e(n[e])&&or(n[e]);else{const t=e.split("."),o=t.length-1;let r=n,i=!1;for(let a=0;a<o;a++){if(t[a]==="__proto__")throw new Error(`unsafe key: ${t[a]}`);if(t[a]in r||(r[t[a]]=Be()),!$e(r[t[a]])){i=!0;break}r=r[t[a]]}if(i||(an(r)?Wc.includes(t[o])||delete n[e]:(r[t[o]]=n[e],delete n[e])),!an(r)){const a=r[t[o]];$e(a)&&or(a)}}return n}function Ed(n,e){const{messages:t,__i18n:o,messageResolver:r,flatJson:i}=e,a=Ve(t)?t:ot(o)?Be():{[n]:Be()};if(ot(o)&&o.forEach(l=>{if("locale"in l&&"resource"in l){const{locale:c,resource:d}=l;c?(a[c]=a[c]||Be(),si(d,a[c])):si(d,a)}else xe(l)&&si(JSON.parse(l),a)}),r==null&&i)for(const l in a)Zt(a,l)&&or(a[l]);return a}function wd(n){return n.type}function cy(n,e,t){let o=$e(e.messages)?e.messages:Be();"__i18nGlobal"in t&&(o=Ed(n.locale.value,{messages:o,__i18n:t.__i18nGlobal}));const r=Object.keys(o);r.length&&r.forEach(i=>{n.mergeLocaleMessage(i,o[i])});{if($e(e.datetimeFormats)){const i=Object.keys(e.datetimeFormats);i.length&&i.forEach(a=>{n.mergeDateTimeFormat(a,e.datetimeFormats[a])})}if($e(e.numberFormats)){const i=Object.keys(e.numberFormats);i.length&&i.forEach(a=>{n.mergeNumberFormat(a,e.numberFormats[a])})}}}function Sd(n){return s.createVNode(s.Text,null,n,0)}const Cd="__INTLIFY_META__",Nd=()=>[],dy=()=>!1;let vd=0;function Td(n){return((e,t,o,r)=>n(t,o,s.getCurrentInstance()||void 0,r))}const pA=()=>{const n=s.getCurrentInstance();let e=null;return n&&(e=wd(n)[Cd])?{[Cd]:e}:null};function zd(n={},e){const{__root:t,__injectWithOption:o}=n,r=t===void 0,i=n.flatJson,a=Cc?s.ref:s.shallowRef,l=!!n.translateExistCompatible;let c=Ge(n.inheritLocale)?n.inheritLocale:!0;const d=a(t&&c?t.locale.value:xe(n.locale)?n.locale:di),u=a(t&&c?t.fallbackLocale.value:xe(n.fallbackLocale)||ot(n.fallbackLocale)||Ve(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:d.value),f=a(Ed(d.value,n)),p=a(Ve(n.datetimeFormats)?n.datetimeFormats:{[d.value]:{}}),h=a(Ve(n.numberFormats)?n.numberFormats:{[d.value]:{}});let m=t?t.missingWarn:Ge(n.missingWarn)||ti(n.missingWarn)?n.missingWarn:!0,g=t?t.fallbackWarn:Ge(n.fallbackWarn)||ti(n.fallbackWarn)?n.fallbackWarn:!0,y=t?t.fallbackRoot:Ge(n.fallbackRoot)?n.fallbackRoot:!0,x=!!n.fallbackFormat,C=Je(n.missing)?n.missing:null,E=Je(n.missing)?Td(n.missing):null,v=Je(n.postTranslation)?n.postTranslation:null,A=t?t.warnHtmlMessage:Ge(n.warnHtmlMessage)?n.warnHtmlMessage:!0,M=!!n.escapeParameter;const k=t?t.modifiers:Ve(n.modifiers)?n.modifiers:{};let w=n.pluralRules||t&&t.pluralRules,b;b=(()=>{r&&id(null);const H={version:ry,locale:d.value,fallbackLocale:u.value,messages:f.value,modifiers:k,pluralRules:w,missing:E===null?void 0:E,missingWarn:m,fallbackWarn:g,fallbackFormat:x,unresolving:!0,postTranslation:v===null?void 0:v,warnHtmlMessage:A,escapeParameter:M,messageResolver:n.messageResolver,messageCompiler:n.messageCompiler,__meta:{framework:"vue"}};H.datetimeFormats=p.value,H.numberFormats=h.value,H.__datetimeFormatters=Ve(b)?b.__datetimeFormatters:void 0,H.__numberFormatters=Ve(b)?b.__numberFormatters:void 0;const ee=Kg(H);return r&&id(ee),ee})(),nr(b,d.value,u.value);function B(){return[d.value,u.value,f.value,p.value,h.value]}const O=s.computed({get:()=>d.value,set:H=>{d.value=H,b.locale=d.value}}),D=s.computed({get:()=>u.value,set:H=>{u.value=H,b.fallbackLocale=u.value,nr(b,d.value,H)}}),P=s.computed(()=>f.value),q=s.computed(()=>p.value),W=s.computed(()=>h.value);function V(){return Je(v)?v:null}function G(H){v=H,b.postTranslation=H}function J(){return C}function oe(H){H!==null&&(E=Td(H)),C=H,b.missing=E}const ne=(H,ee,ze,Pe,dt,Xt)=>{B();let Ot;try{r||(b.fallbackContext=t?Gg():void 0),Ot=H(b)}finally{r||(b.fallbackContext=void 0)}if(ze!=="translate exists"&&it(Ot)&&Ot===ci||ze==="translate exists"&&!Ot){const[$t,_n]=ee();return t&&y?Pe(t):dt($t)}else{if(Xt(Ot))return Ot;throw Bn(En.UNEXPECTED_RETURN_TYPE)}};function X(...H){return ne(ee=>Reflect.apply(ud,null,[ee,...H]),()=>ea(...H),"translate",ee=>Reflect.apply(ee.t,ee,[...H]),ee=>ee,ee=>xe(ee))}function Z(...H){const[ee,ze,Pe]=H;if(Pe&&!$e(Pe))throw Bn(En.INVALID_ARGUMENT);return X(ee,ze,kt({resolvedMessage:!0},Pe||{}))}function Y(...H){return ne(ee=>Reflect.apply(hd,null,[ee,...H]),()=>ta(...H),"datetime format",ee=>Reflect.apply(ee.d,ee,[...H]),()=>Qc,ee=>xe(ee))}function te(...H){return ne(ee=>Reflect.apply(yd,null,[ee,...H]),()=>na(...H),"number format",ee=>Reflect.apply(ee.n,ee,[...H]),()=>Qc,ee=>xe(ee))}function de(H){return H.map(ee=>xe(ee)||it(ee)||Ge(ee)?Sd(String(ee)):ee)}const Me={normalize:de,interpolate:H=>H,type:"vnode"};function Le(...H){return ne(ee=>{let ze;const Pe=ee;try{Pe.processor=Me,ze=Reflect.apply(ud,null,[Pe,...H])}finally{Pe.processor=null}return ze},()=>ea(...H),"translate",ee=>ee[oa](...H),ee=>[Sd(ee)],ee=>ot(ee))}function N(...H){return ne(ee=>Reflect.apply(yd,null,[ee,...H]),()=>na(...H),"number format",ee=>ee[ia](...H),Nd,ee=>xe(ee)||ot(ee))}function L(...H){return ne(ee=>Reflect.apply(hd,null,[ee,...H]),()=>ta(...H),"datetime format",ee=>ee[ra](...H),Nd,ee=>xe(ee)||ot(ee))}function $(H){w=H,b.pluralRules=w}function S(H,ee){return ne(()=>{if(!H)return!1;const ze=xe(ee)?ee:d.value,Pe=U(ze),dt=b.messageResolver(Pe,H);return l?dt!=null:an(dt)||xn(dt)||xe(dt)},()=>[H],"translate exists",ze=>Reflect.apply(ze.te,ze,[H,ee]),dy,ze=>Ge(ze))}function K(H){let ee=null;const ze=Xc(b,u.value,d.value);for(let Pe=0;Pe<ze.length;Pe++){const dt=f.value[ze[Pe]]||{},Xt=b.messageResolver(dt,H);if(Xt!=null){ee=Xt;break}}return ee}function z(H){const ee=K(H);return ee??(t?t.tm(H)||{}:{})}function U(H){return f.value[H]||{}}function ie(H,ee){if(i){const ze={[H]:ee};for(const Pe in ze)Zt(ze,Pe)&&or(ze[Pe]);ee=ze[H]}f.value[H]=ee,b.messages=f.value}function Se(H,ee){f.value[H]=f.value[H]||{};const ze={[H]:ee};if(i)for(const Pe in ze)Zt(ze,Pe)&&or(ze[Pe]);ee=ze[H],si(ee,f.value[H]),b.messages=f.value}function ve(H){return p.value[H]||{}}function T(H,ee){p.value[H]=ee,b.datetimeFormats=p.value,gd(b,H,ee)}function I(H,ee){p.value[H]=kt(p.value[H]||{},ee),b.datetimeFormats=p.value,gd(b,H,ee)}function Q(H){return h.value[H]||{}}function ge(H,ee){h.value[H]=ee,b.numberFormats=h.value,xd(b,H,ee)}function Te(H,ee){h.value[H]=kt(h.value[H]||{},ee),b.numberFormats=h.value,xd(b,H,ee)}vd++,t&&Cc&&(s.watch(t.locale,H=>{c&&(d.value=H,b.locale=H,nr(b,d.value,u.value))}),s.watch(t.fallbackLocale,H=>{c&&(u.value=H,b.fallbackLocale=H,nr(b,d.value,u.value))}));const ye={id:vd,locale:O,fallbackLocale:D,get inheritLocale(){return c},set inheritLocale(H){c=H,H&&t&&(d.value=t.locale.value,u.value=t.fallbackLocale.value,nr(b,d.value,u.value))},get availableLocales(){return Object.keys(f.value).sort()},messages:P,get modifiers(){return k},get pluralRules(){return w||{}},get isGlobal(){return r},get missingWarn(){return m},set missingWarn(H){m=H,b.missingWarn=m},get fallbackWarn(){return g},set fallbackWarn(H){g=H,b.fallbackWarn=g},get fallbackRoot(){return y},set fallbackRoot(H){y=H},get fallbackFormat(){return x},set fallbackFormat(H){x=H,b.fallbackFormat=x},get warnHtmlMessage(){return A},set warnHtmlMessage(H){A=H,b.warnHtmlMessage=H},get escapeParameter(){return M},set escapeParameter(H){M=H,b.escapeParameter=H},t:X,getLocaleMessage:U,setLocaleMessage:ie,mergeLocaleMessage:Se,getPostTranslationHandler:V,setPostTranslationHandler:G,getMissingHandler:J,setMissingHandler:oe,[ay]:$};return ye.datetimeFormats=q,ye.numberFormats=W,ye.rt=Z,ye.te=S,ye.tm=z,ye.d=Y,ye.n=te,ye.getDateTimeFormat=ve,ye.setDateTimeFormat=T,ye.mergeDateTimeFormat=I,ye.getNumberFormat=Q,ye.setNumberFormat=ge,ye.mergeNumberFormat=Te,ye[ly]=o,ye[oa]=Le,ye[ra]=L,ye[ia]=N,ye}const aa={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:n=>n==="parent"||n==="global",default:"parent"},i18n:{type:Object}};function uy({slots:n},e){return e.length===1&&e[0]==="default"?(n.default?n.default():[]).reduce((o,r)=>[...o,...r.type===s.Fragment?r.children:[r]],[]):e.reduce((t,o)=>{const r=n[o];return r&&(t[o]=r()),t},Be())}function Md(n){return s.Fragment}kt({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:n=>it(n)||!isNaN(n)}},aa);function fy(n){return ot(n)&&!xe(n[0])}function Ad(n,e,t,o){const{slots:r,attrs:i}=e;return()=>{const a={part:!0};let l=Be();n.locale&&(a.locale=n.locale),xe(n.format)?a.key=n.format:$e(n.format)&&(xe(n.format.key)&&(a.key=n.format.key),l=Object.keys(n.format).reduce((p,h)=>t.includes(h)?kt(Be(),p,{[h]:n.format[h]}):p,Be()));const c=o(n.value,a,l);let d=[a.key];ot(c)?d=c.map((p,h)=>{const m=r[p.type],g=m?m({[p.type]:p.value,index:h,parts:c}):[p.value];return fy(g)&&(g[0].key=`${p.type}-${h}`),g}):xe(c)&&(d=[c]);const u=kt(Be(),i),f=xe(n.tag)||$e(n.tag)?n.tag:Md();return s.h(f,u,d)}}kt({value:{type:Number,required:!0},format:{type:[String,Object]}},aa),kt({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},aa);const py=Rn("global-vue-i18n");function hy(n={},e){const t=Ge(n.globalInjection)?n.globalInjection:!0,o=!0,r=new Map,[i,a]=my(n),l=Rn("");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),Ve(h[0])){const y=h[0];f.__composerExtend=y.__composerExtend,f.__vueI18nExtend=y.__vueI18nExtend}let m=null;t&&(m=Sy(p,f.global));const g=p.unmount;p.unmount=()=>{m&&m(),f.dispose(),g()}},get global(){return a},dispose(){i.stop()},__instances:r,__getInstance:c,__setInstance:d,__deleteInstance:u};return f}}function Vt(n={}){const e=s.getCurrentInstance();if(e==null)throw Bn(En.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw Bn(En.NOT_INSTALLED);const t=gy(e),o=by(t),r=wd(e),i=yy(n,r);if(i==="global")return cy(o,n,r),o;if(i==="parent"){let c=xy(t,e,n.__useComponent);return c==null&&(c=o),c}const a=t;let l=a.__getInstance(e);if(l==null){const c=kt({},n);"__i18n"in r&&(c.__i18n=r.__i18n),o&&(c.__root=o),l=zd(c),a.__composerExtend&&(l[sa]=a.__composerExtend(l)),Ey(a,e,l),a.__setInstance(e,l)}return l}function my(n,e,t){const o=s.effectScope();{const r=o.run(()=>zd(n));if(r==null)throw Bn(En.UNEXPECTED_ERROR);return[o,r]}}function gy(n){{const e=s.inject(n.isCE?py:n.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw Bn(n.isCE?En.NOT_INSTALLED_WITH_PROVIDE:En.UNEXPECTED_ERROR);return e}}function yy(n,e){return ni(n)?"__i18n"in e?"local":"global":n.useScope?n.useScope:"local"}function by(n){return n.mode==="composition"?n.global:n.global.__composer}function xy(n,e,t=!1){let o=null;const r=e.root;let i=ky(e,t);for(;i!=null;){const a=n;if(n.mode==="composition"&&(o=a.__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 Ey(n,e,t){s.onMounted(()=>{},e),s.onUnmounted(()=>{const o=t;n.__deleteInstance(e);const r=o[sa];r&&(r(),delete o[sa])},e)}const wy=["locale","fallbackLocale","availableLocales"],Id=["t","rt","d","n","tm","te"];function Sy(n,e){const t=Object.create(null);return wy.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i)throw Bn(En.UNEXPECTED_ERROR);const a=s.isRef(i.value)?{get(){return i.value.value},set(l){i.value.value=l}}:{get(){return i.get&&i.get()}};Object.defineProperty(t,r,a)}),n.config.globalProperties.$i18n=t,Id.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i||!i.value)throw Bn(En.UNEXPECTED_ERROR);Object.defineProperty(n.config.globalProperties,`$${r}`,i)}),()=>{delete n.config.globalProperties.$i18n,Id.forEach(r=>{delete n.config.globalProperties[`$${r}`]})}}iy(),__INTLIFY_JIT_COMPILATION__?td(Zg):td(Qg),Wg(Mg),qg(Xc);function la(){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 Cy(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
+ `,Gm="\u2028",Km="\u2029";function Jm(n){const e=n;let t=0,o=1,r=1,i=0;const a=k=>e[k]===qm&&e[k+1]===Et,l=k=>e[k]===Et,c=k=>e[k]===Km,d=k=>e[k]===Gm,u=k=>a(k)||l(k)||c(k)||d(k),f=()=>t,p=()=>o,h=()=>r,m=()=>i,g=k=>a(k)||c(k)||d(k)?Et:e[k],y=()=>g(t),x=()=>g(t+i);function N(){return i=0,u(t)&&(o++,r=0),a(t)&&t++,t++,r++,e[t]}function E(){return a(t+i)&&i++,i++,e[t+i]}function v(){t=0,o=1,r=1,i=0}function A(k=0){i=k}function M(){const k=t+i;for(;k!==t;)N();i=0}return{index:f,line:p,column:h,peekOffset:m,charAt:g,currentChar:y,currentPeek:x,next:N,peek:E,reset:v,resetPeek:A,skipToPeek:M}}const Ln=void 0,Xm=".",Dc="'",Ym="tokenizer";function Qm(n,e={}){const t=e.location!==!1,o=Jm(n),r=()=>o.index(),i=()=>Vm(o.line(),o.column(),o.index()),a=i(),l=r(),c={currentType:14,offset:l,startLoc:a,endLoc:a,lastType:14,lastOffset:l,lastStartLoc:a,lastEndLoc:a,braceNest:0,inLinked:!1,text:""},d=()=>c,{onError:u}=e;function f(T,I,Q,...ge){const Te=d();if(I.column+=Q,I.offset+=Q,u){const ye=t?ai(Te.startLoc,I):null,H=To(T,ye,{domain:Ym,args:ge});u(H)}}function p(T,I,Q){T.endLoc=i(),T.currentType=I;const ge={type:I};return t&&(ge.loc=ai(T.startLoc,T.endLoc)),Q!=null&&(ge.value=Q),ge}const h=T=>p(T,14);function m(T,I){return T.currentChar()===I?(T.next(),I):(f(Ce.EXPECTED_TOKEN,i(),0,I),"")}function g(T){let I="";for(;T.currentPeek()===bn||T.currentPeek()===Et;)I+=T.currentPeek(),T.peek();return I}function y(T){const I=g(T);return T.skipToPeek(),I}function x(T){if(T===Ln)return!1;const I=T.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I===95}function N(T){if(T===Ln)return!1;const I=T.charCodeAt(0);return I>=48&&I<=57}function E(T,I){const{currentType:Q}=I;if(Q!==2)return!1;g(T);const ge=x(T.currentPeek());return T.resetPeek(),ge}function v(T,I){const{currentType:Q}=I;if(Q!==2)return!1;g(T);const ge=T.currentPeek()==="-"?T.peek():T.currentPeek(),Te=N(ge);return T.resetPeek(),Te}function A(T,I){const{currentType:Q}=I;if(Q!==2)return!1;g(T);const ge=T.currentPeek()===Dc;return T.resetPeek(),ge}function M(T,I){const{currentType:Q}=I;if(Q!==8)return!1;g(T);const ge=T.currentPeek()===".";return T.resetPeek(),ge}function k(T,I){const{currentType:Q}=I;if(Q!==9)return!1;g(T);const ge=x(T.currentPeek());return T.resetPeek(),ge}function w(T,I){const{currentType:Q}=I;if(!(Q===8||Q===12))return!1;g(T);const ge=T.currentPeek()===":";return T.resetPeek(),ge}function b(T,I){const{currentType:Q}=I;if(Q!==10)return!1;const ge=()=>{const ye=T.currentPeek();return ye==="{"?x(T.peek()):ye==="@"||ye==="%"||ye==="|"||ye===":"||ye==="."||ye===bn||!ye?!1:ye===Et?(T.peek(),ge()):O(T,!1)},Te=ge();return T.resetPeek(),Te}function R(T){g(T);const I=T.currentPeek()==="|";return T.resetPeek(),I}function B(T){const I=g(T),Q=T.currentPeek()==="%"&&T.peek()==="{";return T.resetPeek(),{isModulo:Q,hasSpace:I.length>0}}function O(T,I=!0){const Q=(Te=!1,ye="",H=!1)=>{const ee=T.currentPeek();return ee==="{"?ye==="%"?!1:Te:ee==="@"||!ee?ye==="%"?!0:Te:ee==="%"?(T.peek(),Q(Te,"%",!0)):ee==="|"?ye==="%"||H?!0:!(ye===bn||ye===Et):ee===bn?(T.peek(),Q(!0,bn,H)):ee===Et?(T.peek(),Q(!0,Et,H)):!0},ge=Q();return I&&T.resetPeek(),ge}function D(T,I){const Q=T.currentChar();return Q===Ln?Ln:I(Q)?(T.next(),Q):null}function P(T){const I=T.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36}function q(T){return D(T,P)}function W(T){const I=T.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36||I===45}function V(T){return D(T,W)}function G(T){const I=T.charCodeAt(0);return I>=48&&I<=57}function J(T){return D(T,G)}function oe(T){const I=T.charCodeAt(0);return I>=48&&I<=57||I>=65&&I<=70||I>=97&&I<=102}function ne(T){return D(T,oe)}function X(T){let I="",Q="";for(;I=J(T);)Q+=I;return Q}function Z(T){y(T);const I=T.currentChar();return I!=="%"&&f(Ce.EXPECTED_TOKEN,i(),0,I),T.next(),"%"}function Y(T){let I="";for(;;){const Q=T.currentChar();if(Q==="{"||Q==="}"||Q==="@"||Q==="|"||!Q)break;if(Q==="%")if(O(T))I+=Q,T.next();else break;else if(Q===bn||Q===Et)if(O(T))I+=Q,T.next();else{if(R(T))break;I+=Q,T.next()}else I+=Q,T.next()}return I}function te(T){y(T);let I="",Q="";for(;I=V(T);)Q+=I;return T.currentChar()===Ln&&f(Ce.UNTERMINATED_CLOSING_BRACE,i(),0),Q}function de(T){y(T);let I="";return T.currentChar()==="-"?(T.next(),I+=`-${X(T)}`):I+=X(T),T.currentChar()===Ln&&f(Ce.UNTERMINATED_CLOSING_BRACE,i(),0),I}function me(T){return T!==Dc&&T!==Et}function Me(T){y(T),m(T,"'");let I="",Q="";for(;I=D(T,me);)I==="\\"?Q+=Le(T):Q+=I;const ge=T.currentChar();return ge===Et||ge===Ln?(f(Ce.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,i(),0),ge===Et&&(T.next(),m(T,"'")),Q):(m(T,"'"),Q)}function Le(T){const I=T.currentChar();switch(I){case"\\":case"'":return T.next(),`\\${I}`;case"u":return C(T,I,4);case"U":return C(T,I,6);default:return f(Ce.UNKNOWN_ESCAPE_SEQUENCE,i(),0,I),""}}function C(T,I,Q){m(T,I);let ge="";for(let Te=0;Te<Q;Te++){const ye=ne(T);if(!ye){f(Ce.INVALID_UNICODE_ESCAPE_SEQUENCE,i(),0,`\\${I}${ge}${T.currentChar()}`);break}ge+=ye}return`\\${I}${ge}`}function L(T){return T!=="{"&&T!=="}"&&T!==bn&&T!==Et}function $(T){y(T);let I="",Q="";for(;I=D(T,L);)Q+=I;return Q}function S(T){let I="",Q="";for(;I=q(T);)Q+=I;return Q}function K(T){const I=Q=>{const ge=T.currentChar();return ge==="{"||ge==="%"||ge==="@"||ge==="|"||ge==="("||ge===")"||!ge||ge===bn?Q:(Q+=ge,T.next(),I(Q))};return I("")}function z(T){y(T);const I=m(T,"|");return y(T),I}function U(T,I){let Q=null;switch(T.currentChar()){case"{":return I.braceNest>=1&&f(Ce.NOT_ALLOW_NEST_PLACEHOLDER,i(),0),T.next(),Q=p(I,2,"{"),y(T),I.braceNest++,Q;case"}":return I.braceNest>0&&I.currentType===2&&f(Ce.EMPTY_PLACEHOLDER,i(),0),T.next(),Q=p(I,3,"}"),I.braceNest--,I.braceNest>0&&y(T),I.inLinked&&I.braceNest===0&&(I.inLinked=!1),Q;case"@":return I.braceNest>0&&f(Ce.UNTERMINATED_CLOSING_BRACE,i(),0),Q=ie(T,I)||h(I),I.braceNest=0,Q;default:{let Te=!0,ye=!0,H=!0;if(R(T))return I.braceNest>0&&f(Ce.UNTERMINATED_CLOSING_BRACE,i(),0),Q=p(I,1,z(T)),I.braceNest=0,I.inLinked=!1,Q;if(I.braceNest>0&&(I.currentType===5||I.currentType===6||I.currentType===7))return f(Ce.UNTERMINATED_CLOSING_BRACE,i(),0),I.braceNest=0,Se(T,I);if(Te=E(T,I))return Q=p(I,5,te(T)),y(T),Q;if(ye=v(T,I))return Q=p(I,6,de(T)),y(T),Q;if(H=A(T,I))return Q=p(I,7,Me(T)),y(T),Q;if(!Te&&!ye&&!H)return Q=p(I,13,$(T)),f(Ce.INVALID_TOKEN_IN_PLACEHOLDER,i(),0,Q.value),y(T),Q;break}}return Q}function ie(T,I){const{currentType:Q}=I;let ge=null;const Te=T.currentChar();switch((Q===8||Q===9||Q===12||Q===10)&&(Te===Et||Te===bn)&&f(Ce.INVALID_LINKED_FORMAT,i(),0),Te){case"@":return T.next(),ge=p(I,8,"@"),I.inLinked=!0,ge;case".":return y(T),T.next(),p(I,9,".");case":":return y(T),T.next(),p(I,10,":");default:return R(T)?(ge=p(I,1,z(T)),I.braceNest=0,I.inLinked=!1,ge):M(T,I)||w(T,I)?(y(T),ie(T,I)):k(T,I)?(y(T),p(I,12,S(T))):b(T,I)?(y(T),Te==="{"?U(T,I)||ge:p(I,11,K(T))):(Q===8&&f(Ce.INVALID_LINKED_FORMAT,i(),0),I.braceNest=0,I.inLinked=!1,Se(T,I))}}function Se(T,I){let Q={type:14};if(I.braceNest>0)return U(T,I)||h(I);if(I.inLinked)return ie(T,I)||h(I);switch(T.currentChar()){case"{":return U(T,I)||h(I);case"}":return f(Ce.UNBALANCED_CLOSING_BRACE,i(),0),T.next(),p(I,3,"}");case"@":return ie(T,I)||h(I);default:{if(R(T))return Q=p(I,1,z(T)),I.braceNest=0,I.inLinked=!1,Q;const{isModulo:Te,hasSpace:ye}=B(T);if(Te)return ye?p(I,0,Y(T)):p(I,4,Z(T));if(O(T))return p(I,0,Y(T));break}}return Q}function ve(){const{currentType:T,offset:I,startLoc:Q,endLoc:ge}=c;return c.lastType=T,c.lastOffset=I,c.lastStartLoc=Q,c.lastEndLoc=ge,c.offset=r(),c.startLoc=i(),o.currentChar()===Ln?p(c,14):Se(o,c)}return{nextToken:ve,currentOffset:r,currentPosition:i,context:d}}const Zm="parser",eg=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function tg(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 ng(n={}){const e=n.location!==!1,{onError:t,onWarn:o}=n;function r(E,v,A,M,...k){const w=E.currentPosition();if(w.offset+=M,w.column+=M,t){const b=e?ai(A,w):null,R=To(v,b,{domain:Zm,args:k});t(R)}}function i(E,v,A,M,...k){const w=E.currentPosition();if(w.offset+=M,w.column+=M,o){const b=e?ai(A,w):null;o(Hm(v,b,k))}}function a(E,v,A){const M={type:E};return e&&(M.start=v,M.end=v,M.loc={start:A,end:A}),M}function l(E,v,A,M){e&&(E.end=v,E.loc&&(E.loc.end=A))}function c(E,v){const A=E.context(),M=a(3,A.offset,A.startLoc);return M.value=v,l(M,E.currentOffset(),E.currentPosition()),M}function d(E,v){const A=E.context(),{lastOffset:M,lastStartLoc:k}=A,w=a(5,M,k);return w.index=parseInt(v,10),E.nextToken(),l(w,E.currentOffset(),E.currentPosition()),w}function u(E,v,A){const M=E.context(),{lastOffset:k,lastStartLoc:w}=M,b=a(4,k,w);return b.key=v,A===!0&&(b.modulo=!0),E.nextToken(),l(b,E.currentOffset(),E.currentPosition()),b}function f(E,v){const A=E.context(),{lastOffset:M,lastStartLoc:k}=A,w=a(9,M,k);return w.value=v.replace(eg,tg),E.nextToken(),l(w,E.currentOffset(),E.currentPosition()),w}function p(E){const v=E.nextToken(),A=E.context(),{lastOffset:M,lastStartLoc:k}=A,w=a(8,M,k);return v.type!==12?(r(E,Ce.UNEXPECTED_EMPTY_LINKED_MODIFIER,A.lastStartLoc,0),w.value="",l(w,M,k),{nextConsumeToken:v,node:w}):(v.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,A.lastStartLoc,0,en(v)),w.value=v.value||"",l(w,E.currentOffset(),E.currentPosition()),{node:w})}function h(E,v){const A=E.context(),M=a(7,A.offset,A.startLoc);return M.value=v,l(M,E.currentOffset(),E.currentPosition()),M}function m(E){const v=E.context(),A=a(6,v.offset,v.startLoc);let M=E.nextToken();if(M.type===9){const k=p(E);A.modifier=k.node,M=k.nextConsumeToken||E.nextToken()}switch(M.type!==10&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(M)),M=E.nextToken(),M.type===2&&(M=E.nextToken()),M.type){case 11:M.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(M)),A.key=h(E,M.value||"");break;case 5:M.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(M)),A.key=u(E,M.value||"");break;case 6:M.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(M)),A.key=d(E,M.value||"");break;case 7:M.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(M)),A.key=f(E,M.value||"");break;default:{r(E,Ce.UNEXPECTED_EMPTY_LINKED_KEY,v.lastStartLoc,0);const k=E.context(),w=a(7,k.offset,k.startLoc);return w.value="",l(w,k.offset,k.startLoc),A.key=w,l(A,k.offset,k.startLoc),{nextConsumeToken:M,node:A}}}return l(A,E.currentOffset(),E.currentPosition()),{node:A}}function g(E){const v=E.context(),A=v.currentType===1?E.currentOffset():v.offset,M=v.currentType===1?v.endLoc:v.startLoc,k=a(2,A,M);k.items=[];let w=null,b=null;do{const O=w||E.nextToken();switch(w=null,O.type){case 0:O.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(O)),k.items.push(c(E,O.value||""));break;case 6:O.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(O)),k.items.push(d(E,O.value||""));break;case 4:b=!0;break;case 5:O.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(O)),k.items.push(u(E,O.value||"",!!b)),b&&(i(E,Ws.USE_MODULO_SYNTAX,v.lastStartLoc,0,en(O)),b=null);break;case 7:O.value==null&&r(E,Ce.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,en(O)),k.items.push(f(E,O.value||""));break;case 8:{const D=m(E);k.items.push(D.node),w=D.nextConsumeToken||null;break}}}while(v.currentType!==14&&v.currentType!==1);const R=v.currentType===1?v.lastOffset:E.currentOffset(),B=v.currentType===1?v.lastEndLoc:E.currentPosition();return l(k,R,B),k}function y(E,v,A,M){const k=E.context();let w=M.items.length===0;const b=a(1,v,A);b.cases=[],b.cases.push(M);do{const R=g(E);w||(w=R.items.length===0),b.cases.push(R)}while(k.currentType!==14);return w&&r(E,Ce.MUST_HAVE_MESSAGES_IN_PLURAL,A,0),l(b,E.currentOffset(),E.currentPosition()),b}function x(E){const v=E.context(),{offset:A,startLoc:M}=v,k=g(E);return v.currentType===14?k:y(E,A,M,k)}function N(E){const v=Qm(E,Ic({},n)),A=v.context(),M=a(0,A.offset,A.startLoc);return e&&M.loc&&(M.loc.source=E),M.body=x(v),n.onCacheKey&&(M.cacheKey=n.onCacheKey(E)),A.currentType!==14&&r(v,Ce.UNEXPECTED_LEXICAL_ANALYSIS,A.lastStartLoc,0,E[A.offset]||""),l(M,v.currentOffset(),v.currentPosition()),M}return{parse:N}}function en(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 og(n,e={}){const t={ast:n,helpers:new Set};return{context:()=>t,helper:i=>(t.helpers.add(i),i)}}function Pc(n,e){for(let t=0;t<n.length;t++)qs(n[t],e)}function qs(n,e){switch(n.type){case 1:Pc(n.cases,e),e.helper("plural");break;case 2:Pc(n.items,e);break;case 6:{qs(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 rg(n,e={}){const t=og(n);t.helper("normalize"),n.body&&qs(n.body,t);const o=t.context();n.helpers=Array.from(o.helpers)}function ig(n){const e=n.body;return e.type===2?Rc(e):e.cases.forEach(t=>Rc(t)),n}function Rc(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=Oc(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 sg="minifier";function zo(n){switch(n.t=n.type,n.type){case 0:{const e=n;zo(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++)zo(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++)zo(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;zo(e.key),e.k=e.key,delete e.key,e.modifier&&(zo(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 To(Ce.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:sg,args:[n.type]})}delete n.type}const ag="parser";function lg(n,e){const{filename:t,breakLineCode:o,needIndent:r}=e,i=e.location!==!1,a={filename:t,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:r,indentLevel:0};i&&n.loc&&(a.source=n.loc.source);const l=()=>a;function c(g,y){a.code+=g}function d(g,y=!0){const x=y?o:"";c(r?x+" ".repeat(g):x)}function u(g=!0){const y=++a.indentLevel;g&&d(y)}function f(g=!0){const y=--a.indentLevel;g&&d(y)}function p(){d(a.indentLevel)}return{context:l,push:c,indent:u,deindent:f,newline:p,helper:g=>`_${g}`,needIndent:()=>a.needIndent}}function cg(n,e){const{helper:t}=n;n.push(`${t("linked")}(`),Mo(n,e.key),e.modifier?(n.push(", "),Mo(n,e.modifier),n.push(", _type")):n.push(", undefined, _type"),n.push(")")}function dg(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&&(Mo(n,e.items[i]),i!==r-1);i++)n.push(", ");n.deindent(o()),n.push("])")}function ug(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&&(Mo(n,e.cases[i]),i!==r-1);i++)n.push(", ");n.deindent(o()),n.push("])")}}function fg(n,e){e.body?Mo(n,e.body):n.push("null")}function Mo(n,e){const{helper:t}=n;switch(e.type){case 0:fg(n,e);break;case 1:ug(n,e);break;case 2:dg(n,e);break;case 6:cg(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 To(Ce.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:ag,args:[e.type]})}}const pg=(n,e={})=>{const t=_c(e.mode)?e.mode:"normal",o=_c(e.filename)?e.filename:"message.intl";e.sourceMap;const r=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":`
3
+ `,i=e.needIndent?e.needIndent:t!=="arrow",a=n.helpers||[],l=lg(n,{filename:o,breakLineCode:r,needIndent:i});l.push(t==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),l.indent(i),a.length>0&&(l.push(`const { ${Oc(a.map(u=>`${u}: _${u}`),", ")} } = ctx`),l.newline()),l.push("return "),Mo(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 hg(n,e={}){const t=Ic({},e),o=!!t.jit,r=!!t.minify,i=t.optimize==null?!0:t.optimize,l=ng(t).parse(n);return o?(i&&ig(l),r&&zo(l),{ast:l,code:""}):(rg(l,t),pg(l,t))}function mg(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(oi().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(oi().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function an(n){return $e(n)&&Gs(n)===0&&(Zt(n,"b")||Zt(n,"body"))}const Lc=["b","body"];function gg(n){return $n(n,Lc)}const $c=["c","cases"];function yg(n){return $n(n,$c,[])}const Vc=["s","static"];function bg(n){return $n(n,Vc)}const Bc=["i","items"];function xg(n){return $n(n,Bc,[])}const Fc=["t","type"];function Gs(n){return $n(n,Fc)}const jc=["v","value"];function li(n,e){const t=$n(n,jc);if(t!=null)return t;throw tr(e)}const Hc=["m","modifier"];function kg(n){return $n(n,Hc)}const Uc=["k","key"];function Eg(n){const e=$n(n,Uc);if(e)return e;throw tr(6)}function $n(n,e,t){for(let o=0;o<e.length;o++){const r=e[o];if(Zt(n,r)&&n[r]!=null)return n[r]}return t}const Wc=[...Lc,...$c,...Vc,...Bc,...Uc,...Hc,...jc,...Fc];function tr(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 wg=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function Sg(n){return wg.test(n)}function Cg(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 Ng(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 vg(n){const e=n.trim();return n.charAt(0)==="0"&&isNaN(parseInt(n))?!1:Sg(e)?Cg(e):"*"+e}function Tg(n){const e=[];let t=-1,o=0,r=0,i,a,l,c,d,u,f;const p=[];p[0]=()=>{a===void 0?a=l:a+=l},p[1]=()=>{a!==void 0&&(e.push(a),a=void 0)},p[2]=()=>{p[0](),r++},p[3]=()=>{if(r>0)r--,o=4,p[0]();else{if(r=0,a===void 0||(a=vg(a),a===!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=Ng(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 qc=new Map;function zg(n,e){return $e(n)?n[e]:null}function Mg(n,e){if(!$e(n))return null;let t=qc.get(e);if(t||(t=Tg(e),t&&qc.set(e,t)),!t)return null;const o=t.length;let r=n,i=0;for(;i<o;){const a=t[i];if(Wc.includes(a)&&an(r))return null;const l=r[a];if(l===void 0||Je(r))return null;r=l,i++}return r}const Ag=n=>n,Ig=n=>"",_g="text",Og=n=>n.length===0?"":$m(n),Dg=Lm;function Gc(n,e){return n=Math.abs(n),e===2?n?n>1?1:0:1:n?Math.min(n,2):0}function Pg(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 Rg(n,e){e.count||(e.count=n),e.n||(e.n=n)}function Lg(n={}){const e=n.locale,t=Pg(n),o=$e(n.pluralRules)&&xe(e)&&Je(n.pluralRules[e])?n.pluralRules[e]:Gc,r=$e(n.pluralRules)&&xe(e)&&Je(n.pluralRules[e])?Gc:void 0,i=x=>x[o(t,x.length,r)],a=n.list||[],l=x=>a[x],c=n.named||Be();it(n.pluralIndex)&&Rg(t,c);const d=x=>c[x];function u(x){const N=Je(n.messages)?n.messages(x):$e(n.messages)?n.messages[x]:!1;return N||(n.parent?n.parent.message(x):Ig)}const f=x=>n.modifiers?n.modifiers[x]:Ag,p=Ve(n.processor)&&Je(n.processor.normalize)?n.processor.normalize:Og,h=Ve(n.processor)&&Je(n.processor.interpolate)?n.processor.interpolate:Dg,m=Ve(n.processor)&&xe(n.processor.type)?n.processor.type:_g,y={list:l,named:d,plural:i,linked:(x,...N)=>{const[E,v]=N;let A="text",M="";N.length===1?$e(E)?(M=E.modifier||M,A=E.type||A):xe(E)&&(M=E||M):N.length===2&&(xe(E)&&(M=E||M),xe(v)&&(A=v||A));const k=u(x)(y),w=A==="vnode"&&ot(k)&&M?k[0]:k;return M?f(M)(w,A):w},message:u,type:m,interpolate:h,normalize:p,values:kt(Be(),a,c)};return y}const $g=Ws.__EXTEND_POINT__,lo=ri($g),Vg={FALLBACK_TO_TRANSLATE:lo(),CANNOT_FORMAT_NUMBER:lo(),FALLBACK_TO_NUMBER_FORMAT:lo(),CANNOT_FORMAT_DATE:lo(),FALLBACK_TO_DATE_FORMAT:lo(),EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:lo(),__EXTEND_POINT__:lo()},Kc=Ce.__EXTEND_POINT__,co=ri(Kc),tn={INVALID_ARGUMENT:Kc,INVALID_DATE_ARGUMENT:co(),INVALID_ISO_DATE_ARGUMENT:co(),NOT_SUPPORT_NON_STRING_MESSAGE:co(),NOT_SUPPORT_LOCALE_PROMISE_VALUE:co(),NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:co(),NOT_SUPPORT_LOCALE_TYPE:co(),__EXTEND_POINT__:co()};function ln(n){return To(n,null,void 0)}function Ks(n,e){return e.locale!=null?Jc(e.locale):Jc(n.locale)}let Js;function Jc(n){if(xe(n))return n;if(Je(n)){if(n.resolvedOnce&&Js!=null)return Js;if(n.constructor.name==="Function"){const e=n();if(Rm(e))throw ln(tn.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Js=e}else throw ln(tn.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw ln(tn.NOT_SUPPORT_LOCALE_TYPE)}function Bg(n,e,t){return[...new Set([t,...ot(e)?e:$e(e)?Object.keys(e):xe(e)?[e]:[t]])]}function Xc(n,e,t){const o=xe(t)?t:di,r=n;r.__localeChainCache||(r.__localeChainCache=new Map);let i=r.__localeChainCache.get(o);if(!i){i=[];let a=[t];for(;ot(a);)a=Yc(i,a,e);const l=ot(e)||!Ve(e)?e:e.default?e.default:null;a=xe(l)?[l]:l,ot(a)&&Yc(i,a,!1),r.__localeChainCache.set(o,i)}return i}function Yc(n,e,t){let o=!0;for(let r=0;r<e.length&&Ge(o);r++){const i=e[r];xe(i)&&(o=Fg(n,e[r],t))}return o}function Fg(n,e,t){let o;const r=e.split("-");do{const i=r.join("-");o=jg(n,i,t),r.splice(-1,1)}while(r.length&&o===!0);return o}function jg(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),(ot(t)||Ve(t))&&t[r]&&(o=t[r])}return o}const Hg="9.14.5",ci=-1,di="en-US",Qc="",Zc=n=>`${n.charAt(0).toLocaleUpperCase()}${n.substr(1)}`;function Ug(){return{upper:(n,e)=>e==="text"&&xe(n)?n.toUpperCase():e==="vnode"&&$e(n)&&"__v_isVNode"in n?n.children.toUpperCase():n,lower:(n,e)=>e==="text"&&xe(n)?n.toLowerCase():e==="vnode"&&$e(n)&&"__v_isVNode"in n?n.children.toLowerCase():n,capitalize:(n,e)=>e==="text"&&xe(n)?Zc(n):e==="vnode"&&$e(n)&&"__v_isVNode"in n?Zc(n.children):n}}let ed;function td(n){ed=n}let nd;function Wg(n){nd=n}let od;function qg(n){od=n}const fA=n=>{};let rd=null;const id=n=>{rd=n},Gg=()=>rd;let sd=0;function Kg(n={}){const e=Je(n.onWarn)?n.onWarn:Mm,t=xe(n.version)?n.version:Hg,o=xe(n.locale)||Je(n.locale)?n.locale:di,r=Je(o)?di:o,i=ot(n.fallbackLocale)||Ve(n.fallbackLocale)||xe(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:r,a=Ve(n.messages)?n.messages:Xs(r),l=Ve(n.datetimeFormats)?n.datetimeFormats:Xs(r),c=Ve(n.numberFormats)?n.numberFormats:Xs(r),d=kt(Be(),n.modifiers,Ug()),u=n.pluralRules||Be(),f=Je(n.missing)?n.missing:null,p=Ge(n.missingWarn)||ti(n.missingWarn)?n.missingWarn:!0,h=Ge(n.fallbackWarn)||ti(n.fallbackWarn)?n.fallbackWarn:!0,m=!!n.fallbackFormat,g=!!n.unresolving,y=Je(n.postTranslation)?n.postTranslation:null,x=Ve(n.processor)?n.processor:null,N=Ge(n.warnHtmlMessage)?n.warnHtmlMessage:!0,E=!!n.escapeParameter,v=Je(n.messageCompiler)?n.messageCompiler:ed,A=Je(n.messageResolver)?n.messageResolver:nd||zg,M=Je(n.localeFallbacker)?n.localeFallbacker:od||Bg,k=$e(n.fallbackContext)?n.fallbackContext:void 0,w=n,b=$e(w.__datetimeFormatters)?w.__datetimeFormatters:new Map,R=$e(w.__numberFormatters)?w.__numberFormatters:new Map,B=$e(w.__meta)?w.__meta:{};sd++;const O={version:t,cid:sd,locale:o,fallbackLocale:i,messages:a,modifiers:d,pluralRules:u,missing:f,missingWarn:p,fallbackWarn:h,fallbackFormat:m,unresolving:g,postTranslation:y,processor:x,warnHtmlMessage:N,escapeParameter:E,messageCompiler:v,messageResolver:A,localeFallbacker:M,fallbackContext:k,onWarn:e,__meta:B};return O.datetimeFormats=l,O.numberFormats=c,O.__datetimeFormatters=b,O.__numberFormatters=R,O}const Xs=n=>({[n]:Be()});function Ys(n,e,t,o,r){const{missing:i,onWarn:a}=n;if(i!==null){const l=i(n,t,e,r);return xe(l)?l:e}else return e}function nr(n,e,t){const o=n;o.__localeChainCache=new Map,n.localeFallbacker(n,t,e)}function Jg(n,e){return n===e?!1:n.split("-")[0]===e.split("-")[0]}function Xg(n,e){const t=e.indexOf(n);if(t===-1)return!1;for(let o=t+1;o<e.length;o++)if(Jg(n,e[o]))return!0;return!1}function Qs(n){return t=>Yg(t,n)}function Yg(n,e){const t=gg(e);if(t==null)throw tr(0);if(Gs(t)===1){const i=yg(t);return n.plural(i.reduce((a,l)=>[...a,ad(n,l)],[]))}else return ad(n,t)}function ad(n,e){const t=bg(e);if(t!=null)return n.type==="text"?t:n.normalize([t]);{const o=xg(e).reduce((r,i)=>[...r,Zs(n,i)],[]);return n.normalize(o)}}function Zs(n,e){const t=Gs(e);switch(t){case 3:return li(e,t);case 9:return li(e,t);case 4:{const o=e;if(Zt(o,"k")&&o.k)return n.interpolate(n.named(o.k));if(Zt(o,"key")&&o.key)return n.interpolate(n.named(o.key));throw tr(t)}case 5:{const o=e;if(Zt(o,"i")&&it(o.i))return n.interpolate(n.list(o.i));if(Zt(o,"index")&&it(o.index))return n.interpolate(n.list(o.index));throw tr(t)}case 6:{const o=e,r=kg(o),i=Eg(o);return n.linked(Zs(n,i),r?Zs(n,r):void 0,n.type)}case 7:return li(e,t);case 8:return li(e,t);default:throw new Error(`unhandled node on format message part: ${t}`)}}const ld=n=>n;let Ao=Be();function cd(n,e={}){let t=!1;const o=e.onError||Wm;return e.onError=r=>{t=!0,o(r)},{...hg(n,e),detectError:t}}const Qg=(n,e)=>{if(!xe(n))throw ln(tn.NOT_SUPPORT_NON_STRING_MESSAGE);{Ge(e.warnHtmlMessage)&&e.warnHtmlMessage;const o=(e.onCacheKey||ld)(n),r=Ao[o];if(r)return r;const{code:i,detectError:a}=cd(n,e),l=new Function(`return ${i}`)();return a?l:Ao[o]=l}};function Zg(n,e){if(__INTLIFY_JIT_COMPILATION__&&!__INTLIFY_DROP_MESSAGE_COMPILER__&&xe(n)){Ge(e.warnHtmlMessage)&&e.warnHtmlMessage;const o=(e.onCacheKey||ld)(n),r=Ao[o];if(r)return r;const{ast:i,detectError:a}=cd(n,{...e,location:!1,jit:!0}),l=Qs(i);return a?l:Ao[o]=l}else{const t=n.cacheKey;if(t){const o=Ao[t];return o||(Ao[t]=Qs(n))}else return Qs(n)}}const dd=()=>"",xn=n=>Je(n);function ud(n,...e){const{fallbackFormat:t,postTranslation:o,unresolving:r,messageCompiler:i,fallbackLocale:a,messages:l}=n,[c,d]=ea(...e),u=Ge(d.missingWarn)?d.missingWarn:n.missingWarn,f=Ge(d.fallbackWarn)?d.fallbackWarn:n.fallbackWarn,p=Ge(d.escapeParameter)?d.escapeParameter:n.escapeParameter,h=!!d.resolvedMessage,m=xe(d.default)||Ge(d.default)?Ge(d.default)?i?c:()=>c:d.default:t?i?c:()=>c:"",g=t||m!=="",y=Ks(n,d);p&&ey(d);let[x,N,E]=h?[c,y,l[y]||Be()]:fd(n,c,y,a,f,u),v=x,A=c;if(!h&&!(xe(v)||an(v)||xn(v))&&g&&(v=m,A=v),!h&&(!(xe(v)||an(v)||xn(v))||!xe(N)))return r?ci:c;let M=!1;const k=()=>{M=!0},w=xn(v)?v:pd(n,c,N,v,A,k);if(M)return v;const b=oy(n,N,E,d),R=Lg(b),B=ty(n,w,R);let O=o?o(B,c):B;return p&&xe(O)&&(O=Dm(O)),O}function ey(n){ot(n.list)?n.list=n.list.map(e=>xe(e)?vc(e):e):$e(n.named)&&Object.keys(n.named).forEach(e=>{xe(n.named[e])&&(n.named[e]=vc(n.named[e]))})}function fd(n,e,t,o,r,i){const{messages:a,onWarn:l,messageResolver:c,localeFallbacker:d}=n,u=d(n,o,t);let f=Be(),p,h=null;const m="translate";for(let g=0;g<u.length&&(p=u[g],f=a[p]||Be(),(h=c(f,e))===null&&(h=f[e]),!(xe(h)||an(h)||xn(h)));g++)if(!Xg(p,u)){const y=Ys(n,e,p,i,m);y!==e&&(h=y)}return[h,p,f]}function pd(n,e,t,o,r,i){const{messageCompiler:a,warnHtmlMessage:l}=n;if(xn(o)){const d=o;return d.locale=d.locale||t,d.key=d.key||e,d}if(a==null){const d=(()=>o);return d.locale=t,d.key=e,d}const c=a(o,ny(n,t,r,o,l,i));return c.locale=t,c.key=e,c.source=o,c}function ty(n,e,t){return e(t)}function ea(...n){const[e,t,o]=n,r=Be();if(!xe(e)&&!it(e)&&!xn(e)&&!an(e))throw ln(tn.INVALID_ARGUMENT);const i=it(e)?String(e):(xn(e),e);return it(t)?r.plural=t:xe(t)?r.default=t:Ve(t)&&!ni(t)?r.named=t:ot(t)&&(r.list=t),it(o)?r.plural=o:xe(o)?r.default=o:Ve(o)&&kt(r,o),[i,r]}function ny(n,e,t,o,r,i){return{locale:e,key:t,warnHtmlMessage:r,onError:a=>{throw i&&i(a),a},onCacheKey:a=>Am(e,t,a)}}function oy(n,e,t,o){const{modifiers:r,pluralRules:i,messageResolver:a,fallbackLocale:l,fallbackWarn:c,missingWarn:d,fallbackContext:u}=n,p={locale:e,modifiers:r,pluralRules:i,messages:h=>{let m=a(t,h);if(m==null&&u){const[,,g]=fd(u,h,e,l,c,d);m=a(g,h)}if(xe(m)||an(m)){let g=!1;const x=pd(n,h,e,m,h,()=>{g=!0});return g?dd:x}else return xn(m)?m:dd}};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 hd(n,...e){const{datetimeFormats:t,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:a}=n,{__datetimeFormatters:l}=n,[c,d,u,f]=ta(...e),p=Ge(u.missingWarn)?u.missingWarn:n.missingWarn;Ge(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn;const h=!!u.part,m=Ks(n,u),g=a(n,r,m);if(!xe(c)||c==="")return new Intl.DateTimeFormat(m,f).format(d);let y={},x,N=null;const E="datetime format";for(let M=0;M<g.length&&(x=g[M],y=t[x]||{},N=y[c],!Ve(N));M++)Ys(n,c,x,p,E);if(!Ve(N)||!xe(x))return o?ci:c;let v=`${x}__${c}`;ni(f)||(v=`${v}__${JSON.stringify(f)}`);let A=l.get(v);return A||(A=new Intl.DateTimeFormat(x,kt({},N,f)),l.set(v,A)),h?A.formatToParts(d):A.format(d)}const md=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function ta(...n){const[e,t,o,r]=n,i=Be();let a=Be(),l;if(xe(e)){const c=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!c)throw ln(tn.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 ln(tn.INVALID_ISO_DATE_ARGUMENT)}}else if(_m(e)){if(isNaN(e.getTime()))throw ln(tn.INVALID_DATE_ARGUMENT);l=e}else if(it(e))l=e;else throw ln(tn.INVALID_ARGUMENT);return xe(t)?i.key=t:Ve(t)&&Object.keys(t).forEach(c=>{md.includes(c)?a[c]=t[c]:i[c]=t[c]}),xe(o)?i.locale=o:Ve(o)&&(a=o),Ve(r)&&(a=r),[i.key||"",l,i,a]}function gd(n,e,t){const o=n;for(const r in t){const i=`${e}__${r}`;o.__datetimeFormatters.has(i)&&o.__datetimeFormatters.delete(i)}}function yd(n,...e){const{numberFormats:t,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:a}=n,{__numberFormatters:l}=n,[c,d,u,f]=na(...e),p=Ge(u.missingWarn)?u.missingWarn:n.missingWarn;Ge(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn;const h=!!u.part,m=Ks(n,u),g=a(n,r,m);if(!xe(c)||c==="")return new Intl.NumberFormat(m,f).format(d);let y={},x,N=null;const E="number format";for(let M=0;M<g.length&&(x=g[M],y=t[x]||{},N=y[c],!Ve(N));M++)Ys(n,c,x,p,E);if(!Ve(N)||!xe(x))return o?ci:c;let v=`${x}__${c}`;ni(f)||(v=`${v}__${JSON.stringify(f)}`);let A=l.get(v);return A||(A=new Intl.NumberFormat(x,kt({},N,f)),l.set(v,A)),h?A.formatToParts(d):A.format(d)}const bd=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function na(...n){const[e,t,o,r]=n,i=Be();let a=Be();if(!it(e))throw ln(tn.INVALID_ARGUMENT);const l=e;return xe(t)?i.key=t:Ve(t)&&Object.keys(t).forEach(c=>{bd.includes(c)?a[c]=t[c]:i[c]=t[c]}),xe(o)?i.locale=o:Ve(o)&&(a=o),Ve(r)&&(a=r),[i.key||"",l,i,a]}function xd(n,e,t){const o=n;for(const r in t){const i=`${e}__${r}`;o.__numberFormatters.has(i)&&o.__numberFormatters.delete(i)}}mg();const ry="9.14.5";function iy(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(oi().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(oi().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}const sy=Vg.__EXTEND_POINT__,kn=ri(sy);kn(),kn(),kn(),kn(),kn(),kn(),kn(),kn(),kn();const kd=tn.__EXTEND_POINT__,zt=ri(kd),En={UNEXPECTED_RETURN_TYPE:kd,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 To(n,null,void 0)}const oa=Rn("__translateVNode"),ra=Rn("__datetimeParts"),ia=Rn("__numberParts"),ay=Rn("__setPluralRules"),ly=Rn("__injectWithOption"),sa=Rn("__dispose");function or(n){if(!$e(n)||an(n))return n;for(const e in n)if(Zt(n,e))if(!e.includes("."))$e(n[e])&&or(n[e]);else{const t=e.split("."),o=t.length-1;let r=n,i=!1;for(let a=0;a<o;a++){if(t[a]==="__proto__")throw new Error(`unsafe key: ${t[a]}`);if(t[a]in r||(r[t[a]]=Be()),!$e(r[t[a]])){i=!0;break}r=r[t[a]]}if(i||(an(r)?Wc.includes(t[o])||delete n[e]:(r[t[o]]=n[e],delete n[e])),!an(r)){const a=r[t[o]];$e(a)&&or(a)}}return n}function Ed(n,e){const{messages:t,__i18n:o,messageResolver:r,flatJson:i}=e,a=Ve(t)?t:ot(o)?Be():{[n]:Be()};if(ot(o)&&o.forEach(l=>{if("locale"in l&&"resource"in l){const{locale:c,resource:d}=l;c?(a[c]=a[c]||Be(),si(d,a[c])):si(d,a)}else xe(l)&&si(JSON.parse(l),a)}),r==null&&i)for(const l in a)Zt(a,l)&&or(a[l]);return a}function wd(n){return n.type}function cy(n,e,t){let o=$e(e.messages)?e.messages:Be();"__i18nGlobal"in t&&(o=Ed(n.locale.value,{messages:o,__i18n:t.__i18nGlobal}));const r=Object.keys(o);r.length&&r.forEach(i=>{n.mergeLocaleMessage(i,o[i])});{if($e(e.datetimeFormats)){const i=Object.keys(e.datetimeFormats);i.length&&i.forEach(a=>{n.mergeDateTimeFormat(a,e.datetimeFormats[a])})}if($e(e.numberFormats)){const i=Object.keys(e.numberFormats);i.length&&i.forEach(a=>{n.mergeNumberFormat(a,e.numberFormats[a])})}}}function Sd(n){return s.createVNode(s.Text,null,n,0)}const Cd="__INTLIFY_META__",Nd=()=>[],dy=()=>!1;let vd=0;function Td(n){return((e,t,o,r)=>n(t,o,s.getCurrentInstance()||void 0,r))}const pA=()=>{const n=s.getCurrentInstance();let e=null;return n&&(e=wd(n)[Cd])?{[Cd]:e}:null};function zd(n={},e){const{__root:t,__injectWithOption:o}=n,r=t===void 0,i=n.flatJson,a=Cc?s.ref:s.shallowRef,l=!!n.translateExistCompatible;let c=Ge(n.inheritLocale)?n.inheritLocale:!0;const d=a(t&&c?t.locale.value:xe(n.locale)?n.locale:di),u=a(t&&c?t.fallbackLocale.value:xe(n.fallbackLocale)||ot(n.fallbackLocale)||Ve(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:d.value),f=a(Ed(d.value,n)),p=a(Ve(n.datetimeFormats)?n.datetimeFormats:{[d.value]:{}}),h=a(Ve(n.numberFormats)?n.numberFormats:{[d.value]:{}});let m=t?t.missingWarn:Ge(n.missingWarn)||ti(n.missingWarn)?n.missingWarn:!0,g=t?t.fallbackWarn:Ge(n.fallbackWarn)||ti(n.fallbackWarn)?n.fallbackWarn:!0,y=t?t.fallbackRoot:Ge(n.fallbackRoot)?n.fallbackRoot:!0,x=!!n.fallbackFormat,N=Je(n.missing)?n.missing:null,E=Je(n.missing)?Td(n.missing):null,v=Je(n.postTranslation)?n.postTranslation:null,A=t?t.warnHtmlMessage:Ge(n.warnHtmlMessage)?n.warnHtmlMessage:!0,M=!!n.escapeParameter;const k=t?t.modifiers:Ve(n.modifiers)?n.modifiers:{};let w=n.pluralRules||t&&t.pluralRules,b;b=(()=>{r&&id(null);const H={version:ry,locale:d.value,fallbackLocale:u.value,messages:f.value,modifiers:k,pluralRules:w,missing:E===null?void 0:E,missingWarn:m,fallbackWarn:g,fallbackFormat:x,unresolving:!0,postTranslation:v===null?void 0:v,warnHtmlMessage:A,escapeParameter:M,messageResolver:n.messageResolver,messageCompiler:n.messageCompiler,__meta:{framework:"vue"}};H.datetimeFormats=p.value,H.numberFormats=h.value,H.__datetimeFormatters=Ve(b)?b.__datetimeFormatters:void 0,H.__numberFormatters=Ve(b)?b.__numberFormatters:void 0;const ee=Kg(H);return r&&id(ee),ee})(),nr(b,d.value,u.value);function B(){return[d.value,u.value,f.value,p.value,h.value]}const O=s.computed({get:()=>d.value,set:H=>{d.value=H,b.locale=d.value}}),D=s.computed({get:()=>u.value,set:H=>{u.value=H,b.fallbackLocale=u.value,nr(b,d.value,H)}}),P=s.computed(()=>f.value),q=s.computed(()=>p.value),W=s.computed(()=>h.value);function V(){return Je(v)?v:null}function G(H){v=H,b.postTranslation=H}function J(){return N}function oe(H){H!==null&&(E=Td(H)),N=H,b.missing=E}const ne=(H,ee,ze,Pe,dt,Xt)=>{B();let Ot;try{r||(b.fallbackContext=t?Gg():void 0),Ot=H(b)}finally{r||(b.fallbackContext=void 0)}if(ze!=="translate exists"&&it(Ot)&&Ot===ci||ze==="translate exists"&&!Ot){const[$t,_n]=ee();return t&&y?Pe(t):dt($t)}else{if(Xt(Ot))return Ot;throw Bn(En.UNEXPECTED_RETURN_TYPE)}};function X(...H){return ne(ee=>Reflect.apply(ud,null,[ee,...H]),()=>ea(...H),"translate",ee=>Reflect.apply(ee.t,ee,[...H]),ee=>ee,ee=>xe(ee))}function Z(...H){const[ee,ze,Pe]=H;if(Pe&&!$e(Pe))throw Bn(En.INVALID_ARGUMENT);return X(ee,ze,kt({resolvedMessage:!0},Pe||{}))}function Y(...H){return ne(ee=>Reflect.apply(hd,null,[ee,...H]),()=>ta(...H),"datetime format",ee=>Reflect.apply(ee.d,ee,[...H]),()=>Qc,ee=>xe(ee))}function te(...H){return ne(ee=>Reflect.apply(yd,null,[ee,...H]),()=>na(...H),"number format",ee=>Reflect.apply(ee.n,ee,[...H]),()=>Qc,ee=>xe(ee))}function de(H){return H.map(ee=>xe(ee)||it(ee)||Ge(ee)?Sd(String(ee)):ee)}const Me={normalize:de,interpolate:H=>H,type:"vnode"};function Le(...H){return ne(ee=>{let ze;const Pe=ee;try{Pe.processor=Me,ze=Reflect.apply(ud,null,[Pe,...H])}finally{Pe.processor=null}return ze},()=>ea(...H),"translate",ee=>ee[oa](...H),ee=>[Sd(ee)],ee=>ot(ee))}function C(...H){return ne(ee=>Reflect.apply(yd,null,[ee,...H]),()=>na(...H),"number format",ee=>ee[ia](...H),Nd,ee=>xe(ee)||ot(ee))}function L(...H){return ne(ee=>Reflect.apply(hd,null,[ee,...H]),()=>ta(...H),"datetime format",ee=>ee[ra](...H),Nd,ee=>xe(ee)||ot(ee))}function $(H){w=H,b.pluralRules=w}function S(H,ee){return ne(()=>{if(!H)return!1;const ze=xe(ee)?ee:d.value,Pe=U(ze),dt=b.messageResolver(Pe,H);return l?dt!=null:an(dt)||xn(dt)||xe(dt)},()=>[H],"translate exists",ze=>Reflect.apply(ze.te,ze,[H,ee]),dy,ze=>Ge(ze))}function K(H){let ee=null;const ze=Xc(b,u.value,d.value);for(let Pe=0;Pe<ze.length;Pe++){const dt=f.value[ze[Pe]]||{},Xt=b.messageResolver(dt,H);if(Xt!=null){ee=Xt;break}}return ee}function z(H){const ee=K(H);return ee??(t?t.tm(H)||{}:{})}function U(H){return f.value[H]||{}}function ie(H,ee){if(i){const ze={[H]:ee};for(const Pe in ze)Zt(ze,Pe)&&or(ze[Pe]);ee=ze[H]}f.value[H]=ee,b.messages=f.value}function Se(H,ee){f.value[H]=f.value[H]||{};const ze={[H]:ee};if(i)for(const Pe in ze)Zt(ze,Pe)&&or(ze[Pe]);ee=ze[H],si(ee,f.value[H]),b.messages=f.value}function ve(H){return p.value[H]||{}}function T(H,ee){p.value[H]=ee,b.datetimeFormats=p.value,gd(b,H,ee)}function I(H,ee){p.value[H]=kt(p.value[H]||{},ee),b.datetimeFormats=p.value,gd(b,H,ee)}function Q(H){return h.value[H]||{}}function ge(H,ee){h.value[H]=ee,b.numberFormats=h.value,xd(b,H,ee)}function Te(H,ee){h.value[H]=kt(h.value[H]||{},ee),b.numberFormats=h.value,xd(b,H,ee)}vd++,t&&Cc&&(s.watch(t.locale,H=>{c&&(d.value=H,b.locale=H,nr(b,d.value,u.value))}),s.watch(t.fallbackLocale,H=>{c&&(u.value=H,b.fallbackLocale=H,nr(b,d.value,u.value))}));const ye={id:vd,locale:O,fallbackLocale:D,get inheritLocale(){return c},set inheritLocale(H){c=H,H&&t&&(d.value=t.locale.value,u.value=t.fallbackLocale.value,nr(b,d.value,u.value))},get availableLocales(){return Object.keys(f.value).sort()},messages:P,get modifiers(){return k},get pluralRules(){return w||{}},get isGlobal(){return r},get missingWarn(){return m},set missingWarn(H){m=H,b.missingWarn=m},get fallbackWarn(){return g},set fallbackWarn(H){g=H,b.fallbackWarn=g},get fallbackRoot(){return y},set fallbackRoot(H){y=H},get fallbackFormat(){return x},set fallbackFormat(H){x=H,b.fallbackFormat=x},get warnHtmlMessage(){return A},set warnHtmlMessage(H){A=H,b.warnHtmlMessage=H},get escapeParameter(){return M},set escapeParameter(H){M=H,b.escapeParameter=H},t:X,getLocaleMessage:U,setLocaleMessage:ie,mergeLocaleMessage:Se,getPostTranslationHandler:V,setPostTranslationHandler:G,getMissingHandler:J,setMissingHandler:oe,[ay]:$};return ye.datetimeFormats=q,ye.numberFormats=W,ye.rt=Z,ye.te=S,ye.tm=z,ye.d=Y,ye.n=te,ye.getDateTimeFormat=ve,ye.setDateTimeFormat=T,ye.mergeDateTimeFormat=I,ye.getNumberFormat=Q,ye.setNumberFormat=ge,ye.mergeNumberFormat=Te,ye[ly]=o,ye[oa]=Le,ye[ra]=L,ye[ia]=C,ye}const aa={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:n=>n==="parent"||n==="global",default:"parent"},i18n:{type:Object}};function uy({slots:n},e){return e.length===1&&e[0]==="default"?(n.default?n.default():[]).reduce((o,r)=>[...o,...r.type===s.Fragment?r.children:[r]],[]):e.reduce((t,o)=>{const r=n[o];return r&&(t[o]=r()),t},Be())}function Md(n){return s.Fragment}kt({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:n=>it(n)||!isNaN(n)}},aa);function fy(n){return ot(n)&&!xe(n[0])}function Ad(n,e,t,o){const{slots:r,attrs:i}=e;return()=>{const a={part:!0};let l=Be();n.locale&&(a.locale=n.locale),xe(n.format)?a.key=n.format:$e(n.format)&&(xe(n.format.key)&&(a.key=n.format.key),l=Object.keys(n.format).reduce((p,h)=>t.includes(h)?kt(Be(),p,{[h]:n.format[h]}):p,Be()));const c=o(n.value,a,l);let d=[a.key];ot(c)?d=c.map((p,h)=>{const m=r[p.type],g=m?m({[p.type]:p.value,index:h,parts:c}):[p.value];return fy(g)&&(g[0].key=`${p.type}-${h}`),g}):xe(c)&&(d=[c]);const u=kt(Be(),i),f=xe(n.tag)||$e(n.tag)?n.tag:Md();return s.h(f,u,d)}}kt({value:{type:Number,required:!0},format:{type:[String,Object]}},aa),kt({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},aa);const py=Rn("global-vue-i18n");function hy(n={},e){const t=Ge(n.globalInjection)?n.globalInjection:!0,o=!0,r=new Map,[i,a]=my(n),l=Rn("");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),Ve(h[0])){const y=h[0];f.__composerExtend=y.__composerExtend,f.__vueI18nExtend=y.__vueI18nExtend}let m=null;t&&(m=Sy(p,f.global));const g=p.unmount;p.unmount=()=>{m&&m(),f.dispose(),g()}},get global(){return a},dispose(){i.stop()},__instances:r,__getInstance:c,__setInstance:d,__deleteInstance:u};return f}}function Vt(n={}){const e=s.getCurrentInstance();if(e==null)throw Bn(En.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw Bn(En.NOT_INSTALLED);const t=gy(e),o=by(t),r=wd(e),i=yy(n,r);if(i==="global")return cy(o,n,r),o;if(i==="parent"){let c=xy(t,e,n.__useComponent);return c==null&&(c=o),c}const a=t;let l=a.__getInstance(e);if(l==null){const c=kt({},n);"__i18n"in r&&(c.__i18n=r.__i18n),o&&(c.__root=o),l=zd(c),a.__composerExtend&&(l[sa]=a.__composerExtend(l)),Ey(a,e,l),a.__setInstance(e,l)}return l}function my(n,e,t){const o=s.effectScope();{const r=o.run(()=>zd(n));if(r==null)throw Bn(En.UNEXPECTED_ERROR);return[o,r]}}function gy(n){{const e=s.inject(n.isCE?py:n.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw Bn(n.isCE?En.NOT_INSTALLED_WITH_PROVIDE:En.UNEXPECTED_ERROR);return e}}function yy(n,e){return ni(n)?"__i18n"in e?"local":"global":n.useScope?n.useScope:"local"}function by(n){return n.mode==="composition"?n.global:n.global.__composer}function xy(n,e,t=!1){let o=null;const r=e.root;let i=ky(e,t);for(;i!=null;){const a=n;if(n.mode==="composition"&&(o=a.__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 Ey(n,e,t){s.onMounted(()=>{},e),s.onUnmounted(()=>{const o=t;n.__deleteInstance(e);const r=o[sa];r&&(r(),delete o[sa])},e)}const wy=["locale","fallbackLocale","availableLocales"],Id=["t","rt","d","n","tm","te"];function Sy(n,e){const t=Object.create(null);return wy.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i)throw Bn(En.UNEXPECTED_ERROR);const a=s.isRef(i.value)?{get(){return i.value.value},set(l){i.value.value=l}}:{get(){return i.get&&i.get()}};Object.defineProperty(t,r,a)}),n.config.globalProperties.$i18n=t,Id.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i||!i.value)throw Bn(En.UNEXPECTED_ERROR);Object.defineProperty(n.config.globalProperties,`$${r}`,i)}),()=>{delete n.config.globalProperties.$i18n,Id.forEach(r=>{delete n.config.globalProperties[`$${r}`]})}}iy(),__INTLIFY_JIT_COMPILATION__?td(Zg):td(Qg),Wg(Mg),qg(Xc);function la(){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 Cy(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),`
4
4
  (function() {
5
5
  const scriptId = '${t}'
6
6
  const shadowRoot = window.__zcmsShadowRoots?.get(scriptId)
@@ -336,24 +336,24 @@
336
336
  }
337
337
  })
338
338
  })()
339
- `}function Io(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(a){a.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=Cy(n),n.insertBefore(r,n.firstChild)}function Ny(){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 rr(n,e=0){if(!(typeof window>"u"||!n))try{const t=n.getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,r=Ny(),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:_d,setPrototypeOf:Od,isFrozen:vy,getPrototypeOf:Ty,getOwnPropertyDescriptor:zy}=Object;let{freeze:wt,seal:Bt,create:ca}=Object,{apply:da,construct:ua}=typeof Reflect<"u"&&Reflect;wt||(wt=function(e){return e}),Bt||(Bt=function(e){return e}),da||(da=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)}),ua||(ua=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 ui=Ct(Array.prototype.forEach),My=Ct(Array.prototype.lastIndexOf),Dd=Ct(Array.prototype.pop),ir=Ct(Array.prototype.push),Ay=Ct(Array.prototype.splice),fi=Ct(String.prototype.toLowerCase),fa=Ct(String.prototype.toString),pa=Ct(String.prototype.match),sr=Ct(String.prototype.replace),Iy=Ct(String.prototype.indexOf),_y=Ct(String.prototype.trim),nn=Ct(Object.prototype.hasOwnProperty),St=Ct(RegExp.prototype.test),ar=Oy(TypeError);function Ct(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 da(n,e,o)}}function Oy(n){return function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return ua(n,t)}}function De(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:fi;Od&&Od(n,null);let o=e.length;for(;o--;){let r=e[o];if(typeof r=="string"){const i=t(r);i!==r&&(vy(e)||(e[o]=i),r=i)}n[r]=!0}return n}function Dy(n){for(let e=0;e<n.length;e++)nn(n,e)||(n[e]=null);return n}function cn(n){const e=ca(null);for(const[t,o]of _d(n))nn(n,t)&&(Array.isArray(o)?e[t]=Dy(o):o&&typeof o=="object"&&o.constructor===Object?e[t]=cn(o):e[t]=o);return e}function lr(n,e){for(;n!==null;){const o=zy(n,e);if(o){if(o.get)return Ct(o.get);if(typeof o.value=="function")return Ct(o.value)}n=Ty(n)}function t(){return null}return t}const Pd=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"]),ha=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"]),ma=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"]),Py=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"]),ga=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"]),Ry=wt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Rd=wt(["#text"]),Ld=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"]),ya=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"]),$d=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"]),pi=wt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ly=Bt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),$y=Bt(/<%[\w\W]*|[\w\W]*%>/gm),Vy=Bt(/\$\{[\w\W]*/gm),By=Bt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Fy=Bt(/^aria-[\-\w]+$/),Vd=Bt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),jy=Bt(/^(?:\w+script|data):/i),Hy=Bt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Bd=Bt(/^html$/i),Uy=Bt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Fd=Object.freeze({__proto__:null,ARIA_ATTR:Fy,ATTR_WHITESPACE:Hy,CUSTOM_ELEMENT:Uy,DATA_ATTR:By,DOCTYPE_NAME:Bd,ERB_EXPR:$y,IS_ALLOWED_URI:Vd,IS_SCRIPT_OR_DATA:jy,MUSTACHE_EXPR:Ly,TMPLIT_EXPR:Vy});const cr={element:1,text:3,progressingInstruction:7,comment:8,document:9},Wy=function(){return typeof window>"u"?null:window},qy=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(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},jd=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Hd(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Wy();const e=ke=>Hd(ke);if(e.version="3.3.1",e.removed=[],!n||!n.document||n.document.nodeType!==cr.document||!n.Element)return e.isSupported=!1,e;let{document:t}=n;const o=t,r=o.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:h}=n,m=c.prototype,g=lr(m,"cloneNode"),y=lr(m,"remove"),x=lr(m,"nextSibling"),C=lr(m,"childNodes"),E=lr(m,"parentNode");if(typeof a=="function"){const ke=t.createElement("template");ke.content&&ke.content.ownerDocument&&(t=ke.content.ownerDocument)}let v,A="";const{implementation:M,createNodeIterator:k,createDocumentFragment:w,getElementsByTagName:b}=t,{importNode:R}=o;let B=jd();e.isSupported=typeof _d=="function"&&typeof E=="function"&&M&&M.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:O,ERB_EXPR:D,TMPLIT_EXPR:P,DATA_ATTR:q,ARIA_ATTR:W,IS_SCRIPT_OR_DATA:V,ATTR_WHITESPACE:G,CUSTOM_ELEMENT:J}=Fd;let{IS_ALLOWED_URI:oe}=Fd,ne=null;const X=De({},[...Pd,...ha,...ma,...ga,...Rd]);let Z=null;const Y=De({},[...Ld,...ya,...$d,...pi]);let te=Object.seal(ca(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,me=null;const Me=Object.seal(ca(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Le=!0,N=!0,L=!1,$=!0,S=!1,K=!0,z=!1,U=!1,ie=!1,Se=!1,ve=!1,T=!1,I=!0,Q=!1;const ge="user-content-";let Te=!0,ye=!1,H={},ee=null;const ze=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 Pe=null;const dt=De({},["audio","video","img","source","image","track"]);let Xt=null;const Ot=De({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),$t="http://www.w3.org/1998/Math/MathML",_n="http://www.w3.org/2000/svg",F="http://www.w3.org/1999/xhtml";let j=F,le=!1,fe=null;const _e=De({},[$t,_n,F],fa);let Qe=De({},["mi","mo","mn","ms","mtext"]),gn=De({},["annotation-xml"]);const Kr=De({},["title","style","font","a","script"]);let vo=null;const lc=["application/xhtml+xml","text/html"],Jr="text/html";let Ke=null,Dt=null;const cc=t.createElement("form"),Ko=function(_){return _ instanceof RegExp||_ instanceof Function},Jo=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Dt&&Dt===_)){if((!_||typeof _!="object")&&(_={}),_=cn(_),vo=lc.indexOf(_.PARSER_MEDIA_TYPE)===-1?Jr:_.PARSER_MEDIA_TYPE,Ke=vo==="application/xhtml+xml"?fa:fi,ne=nn(_,"ALLOWED_TAGS")?De({},_.ALLOWED_TAGS,Ke):X,Z=nn(_,"ALLOWED_ATTR")?De({},_.ALLOWED_ATTR,Ke):Y,fe=nn(_,"ALLOWED_NAMESPACES")?De({},_.ALLOWED_NAMESPACES,fa):_e,Xt=nn(_,"ADD_URI_SAFE_ATTR")?De(cn(Ot),_.ADD_URI_SAFE_ATTR,Ke):Ot,Pe=nn(_,"ADD_DATA_URI_TAGS")?De(cn(dt),_.ADD_DATA_URI_TAGS,Ke):dt,ee=nn(_,"FORBID_CONTENTS")?De({},_.FORBID_CONTENTS,Ke):ze,de=nn(_,"FORBID_TAGS")?De({},_.FORBID_TAGS,Ke):cn({}),me=nn(_,"FORBID_ATTR")?De({},_.FORBID_ATTR,Ke):cn({}),H=nn(_,"USE_PROFILES")?_.USE_PROFILES:!1,Le=_.ALLOW_ARIA_ATTR!==!1,N=_.ALLOW_DATA_ATTR!==!1,L=_.ALLOW_UNKNOWN_PROTOCOLS||!1,$=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,S=_.SAFE_FOR_TEMPLATES||!1,K=_.SAFE_FOR_XML!==!1,z=_.WHOLE_DOCUMENT||!1,Se=_.RETURN_DOM||!1,ve=_.RETURN_DOM_FRAGMENT||!1,T=_.RETURN_TRUSTED_TYPE||!1,ie=_.FORCE_BODY||!1,I=_.SANITIZE_DOM!==!1,Q=_.SANITIZE_NAMED_PROPS||!1,Te=_.KEEP_CONTENT!==!1,ye=_.IN_PLACE||!1,oe=_.ALLOWED_URI_REGEXP||Vd,j=_.NAMESPACE||F,Qe=_.MATHML_TEXT_INTEGRATION_POINTS||Qe,gn=_.HTML_INTEGRATION_POINTS||gn,te=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&Ko(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(te.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&Ko(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(te.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(te.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),S&&(N=!1),ve&&(Se=!0),H&&(ne=De({},Rd),Z=[],H.html===!0&&(De(ne,Pd),De(Z,Ld)),H.svg===!0&&(De(ne,ha),De(Z,ya),De(Z,pi)),H.svgFilters===!0&&(De(ne,ma),De(Z,ya),De(Z,pi)),H.mathMl===!0&&(De(ne,ga),De(Z,$d),De(Z,pi))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?Me.tagCheck=_.ADD_TAGS:(ne===X&&(ne=cn(ne)),De(ne,_.ADD_TAGS,Ke))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?Me.attributeCheck=_.ADD_ATTR:(Z===Y&&(Z=cn(Z)),De(Z,_.ADD_ATTR,Ke))),_.ADD_URI_SAFE_ATTR&&De(Xt,_.ADD_URI_SAFE_ATTR,Ke),_.FORBID_CONTENTS&&(ee===ze&&(ee=cn(ee)),De(ee,_.FORBID_CONTENTS,Ke)),_.ADD_FORBID_CONTENTS&&(ee===ze&&(ee=cn(ee)),De(ee,_.ADD_FORBID_CONTENTS,Ke)),Te&&(ne["#text"]=!0),z&&De(ne,["html","head","body"]),ne.table&&(De(ne,["tbody"]),delete de.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw ar('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ar('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=_.TRUSTED_TYPES_POLICY,A=v.createHTML("")}else v===void 0&&(v=qy(h,r)),v!==null&&typeof A=="string"&&(A=v.createHTML(""));wt&&wt(_),Dt=_}},Fs=De({},[...ha,...ma,...Py]),Xr=De({},[...ga,...Ry]),dc=function(_){let ce=E(_);(!ce||!ce.tagName)&&(ce={namespaceURI:j,tagName:"template"});const be=fi(_.tagName),qe=fi(ce.tagName);return fe[_.namespaceURI]?_.namespaceURI===_n?ce.namespaceURI===F?be==="svg":ce.namespaceURI===$t?be==="svg"&&(qe==="annotation-xml"||Qe[qe]):!!Fs[be]:_.namespaceURI===$t?ce.namespaceURI===F?be==="math":ce.namespaceURI===_n?be==="math"&&gn[qe]:!!Xr[be]:_.namespaceURI===F?ce.namespaceURI===_n&&!gn[qe]||ce.namespaceURI===$t&&!Qe[qe]?!1:!Xr[be]&&(Kr[be]||!Fs[be]):!!(vo==="application/xhtml+xml"&&fe[_.namespaceURI]):!1},Yt=function(_){ir(e.removed,{element:_});try{E(_).removeChild(_)}catch{y(_)}},yn=function(_,ce){try{ir(e.removed,{attribute:ce.getAttributeNode(_),from:ce})}catch{ir(e.removed,{attribute:null,from:ce})}if(ce.removeAttribute(_),_==="is")if(Se||ve)try{Yt(ce)}catch{}else try{ce.setAttribute(_,"")}catch{}},js=function(_){let ce=null,be=null;if(ie)_="<remove></remove>"+_;else{const nt=pa(_,/^[\r\n\t ]+/);be=nt&&nt[0]}vo==="application/xhtml+xml"&&j===F&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const qe=v?v.createHTML(_):_;if(j===F)try{ce=new p().parseFromString(qe,vo)}catch{}if(!ce||!ce.documentElement){ce=M.createDocument(j,"template",null);try{ce.documentElement.innerHTML=le?A:qe}catch{}}const xt=ce.body||ce.documentElement;return _&&be&&xt.insertBefore(t.createTextNode(be),xt.childNodes[0]||null),j===F?b.call(ce,z?"html":"body")[0]:z?ce.documentElement:xt},Yr=function(_){return k.call(_.ownerDocument||_,_,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Qr=function(_){return _ instanceof f&&(typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||!(_.attributes instanceof u)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function")},Zr=function(_){return typeof l=="function"&&_ instanceof l};function se(ke,_,ce){ui(ke,be=>{be.call(e,_,ce,Dt)})}const ue=function(_){let ce=null;if(se(B.beforeSanitizeElements,_,null),Qr(_))return Yt(_),!0;const be=Ke(_.nodeName);if(se(B.uponSanitizeElement,_,{tagName:be,allowedTags:ne}),K&&_.hasChildNodes()&&!Zr(_.firstElementChild)&&St(/<[/\w!]/g,_.innerHTML)&&St(/<[/\w!]/g,_.textContent)||_.nodeType===cr.progressingInstruction||K&&_.nodeType===cr.comment&&St(/<[/\w]/g,_.data))return Yt(_),!0;if(!(Me.tagCheck instanceof Function&&Me.tagCheck(be))&&(!ne[be]||de[be])){if(!de[be]&&We(be)&&(te.tagNameCheck instanceof RegExp&&St(te.tagNameCheck,be)||te.tagNameCheck instanceof Function&&te.tagNameCheck(be)))return!1;if(Te&&!ee[be]){const qe=E(_)||_.parentNode,xt=C(_)||_.childNodes;if(xt&&qe){const nt=xt.length;for(let Pt=nt-1;Pt>=0;--Pt){const On=g(xt[Pt],!0);On.__removalCount=(_.__removalCount||0)+1,qe.insertBefore(On,x(_))}}}return Yt(_),!0}return _ instanceof c&&!dc(_)||(be==="noscript"||be==="noembed"||be==="noframes")&&St(/<\/no(script|embed|frames)/i,_.innerHTML)?(Yt(_),!0):(S&&_.nodeType===cr.text&&(ce=_.textContent,ui([O,D,P],qe=>{ce=sr(ce,qe," ")}),_.textContent!==ce&&(ir(e.removed,{element:_.cloneNode()}),_.textContent=ce)),se(B.afterSanitizeElements,_,null),!1)},we=function(_,ce,be){if(I&&(ce==="id"||ce==="name")&&(be in t||be in cc))return!1;if(!(N&&!me[ce]&&St(q,ce))){if(!(Le&&St(W,ce))){if(!(Me.attributeCheck instanceof Function&&Me.attributeCheck(ce,_))){if(!Z[ce]||me[ce]){if(!(We(_)&&(te.tagNameCheck instanceof RegExp&&St(te.tagNameCheck,_)||te.tagNameCheck instanceof Function&&te.tagNameCheck(_))&&(te.attributeNameCheck instanceof RegExp&&St(te.attributeNameCheck,ce)||te.attributeNameCheck instanceof Function&&te.attributeNameCheck(ce,_))||ce==="is"&&te.allowCustomizedBuiltInElements&&(te.tagNameCheck instanceof RegExp&&St(te.tagNameCheck,be)||te.tagNameCheck instanceof Function&&te.tagNameCheck(be))))return!1}else if(!Xt[ce]){if(!St(oe,sr(be,G,""))){if(!((ce==="src"||ce==="xlink:href"||ce==="href")&&_!=="script"&&Iy(be,"data:")===0&&Pe[_])){if(!(L&&!St(V,sr(be,G,"")))){if(be)return!1}}}}}}}return!0},We=function(_){return _!=="annotation-xml"&&pa(_,J)},bt=function(_){se(B.beforeSanitizeAttributes,_,null);const{attributes:ce}=_;if(!ce||Qr(_))return;const be={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Z,forceKeepAttr:void 0};let qe=ce.length;for(;qe--;){const xt=ce[qe],{name:nt,namespaceURI:Pt,value:On}=xt,Xo=Ke(nt),uc=On;let mt=nt==="value"?uc:_y(uc);if(be.attrName=Xo,be.attrValue=mt,be.keepAttr=!0,be.forceKeepAttr=void 0,se(B.uponSanitizeAttribute,_,be),mt=be.attrValue,Q&&(Xo==="id"||Xo==="name")&&(yn(nt,_),mt=ge+mt),K&&St(/((--!?|])>)|<\/(style|title|textarea)/i,mt)){yn(nt,_);continue}if(Xo==="attributename"&&pa(mt,"href")){yn(nt,_);continue}if(be.forceKeepAttr)continue;if(!be.keepAttr){yn(nt,_);continue}if(!$&&St(/\/>/i,mt)){yn(nt,_);continue}S&&ui([O,D,P],sm=>{mt=sr(mt,sm," ")});const im=Ke(_.nodeName);if(!we(im,Xo,mt)){yn(nt,_);continue}if(v&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Pt)switch(h.getAttributeType(im,Xo)){case"TrustedHTML":{mt=v.createHTML(mt);break}case"TrustedScriptURL":{mt=v.createScriptURL(mt);break}}if(mt!==uc)try{Pt?_.setAttributeNS(Pt,nt,mt):_.setAttribute(nt,mt),Qr(_)?Yt(_):Dd(e.removed)}catch{yn(nt,_)}}se(B.afterSanitizeAttributes,_,null)},tt=function ke(_){let ce=null;const be=Yr(_);for(se(B.beforeSanitizeShadowDOM,_,null);ce=be.nextNode();)se(B.uponSanitizeShadowNode,ce,null),ue(ce),bt(ce),ce.content instanceof i&&ke(ce.content);se(B.afterSanitizeShadowDOM,_,null)};return e.sanitize=function(ke){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ce=null,be=null,qe=null,xt=null;if(le=!ke,le&&(ke="<!-->"),typeof ke!="string"&&!Zr(ke))if(typeof ke.toString=="function"){if(ke=ke.toString(),typeof ke!="string")throw ar("dirty is not a string, aborting")}else throw ar("toString is not a function");if(!e.isSupported)return ke;if(U||Jo(_),e.removed=[],typeof ke=="string"&&(ye=!1),ye){if(ke.nodeName){const On=Ke(ke.nodeName);if(!ne[On]||de[On])throw ar("root node is forbidden and cannot be sanitized in-place")}}else if(ke instanceof l)ce=js("<!---->"),be=ce.ownerDocument.importNode(ke,!0),be.nodeType===cr.element&&be.nodeName==="BODY"||be.nodeName==="HTML"?ce=be:ce.appendChild(be);else{if(!Se&&!S&&!z&&ke.indexOf("<")===-1)return v&&T?v.createHTML(ke):ke;if(ce=js(ke),!ce)return Se?null:T?A:""}ce&&ie&&Yt(ce.firstChild);const nt=Yr(ye?ke:ce);for(;qe=nt.nextNode();)ue(qe),bt(qe),qe.content instanceof i&&tt(qe.content);if(ye)return ke;if(Se){if(ve)for(xt=w.call(ce.ownerDocument);ce.firstChild;)xt.appendChild(ce.firstChild);else xt=ce;return(Z.shadowroot||Z.shadowrootmode)&&(xt=R.call(o,xt,!0)),xt}let Pt=z?ce.outerHTML:ce.innerHTML;return z&&ne["!doctype"]&&ce.ownerDocument&&ce.ownerDocument.doctype&&ce.ownerDocument.doctype.name&&St(Bd,ce.ownerDocument.doctype.name)&&(Pt="<!DOCTYPE "+ce.ownerDocument.doctype.name+`>
340
- `+Pt),S&&ui([O,D,P],On=>{Pt=sr(Pt,On," ")}),v&&T?v.createHTML(Pt):Pt},e.setConfig=function(){let ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Jo(ke),U=!0},e.clearConfig=function(){Dt=null,U=!1},e.isValidAttribute=function(ke,_,ce){Dt||Jo({});const be=Ke(ke),qe=Ke(_);return we(be,qe,ce)},e.addHook=function(ke,_){typeof _=="function"&&ir(B[ke],_)},e.removeHook=function(ke,_){if(_!==void 0){const ce=My(B[ke],_);return ce===-1?void 0:Ay(B[ke],ce,1)[0]}return Dd(B[ke])},e.removeHooks=function(ke){B[ke]=[]},e.removeAllHooks=function(){B=jd()},e}var Gy=Hd();function Ud(n){return Gy.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 rt(n){return typeof n!="string"?"":n.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Nt(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 Ky(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 Ae(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:Ky(t)}}function Fn(n){const e=[],t=new Set,o=la(),a=new o().parseFromString(`<template>${n}</template>`,"text/html").querySelector("template");if(!a)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 K=S[1],z=S[2];if(!t.has(K)){const{defaultValue:U,validation:ie}=Ae(S[3]);e.push({fieldName:K,groupName:z,type:"rich",defaultValue:U,optional:!0,...ie}),t.add(K)}}});const h=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(h)).forEach(S=>{if(S&&S[1]&&S[2]){const K=S[1];if(!t.has(K)){const{defaultValue:z,validation:U}=Ae(S[2]);e.push({fieldName:K,type:"rich",defaultValue:z,optional:!0,...U}),t.add(K)}}});const g=new RegExp(he.RICH_TEXT_FIELD_WITH_GROUP.source,he.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(g)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]){const K=S[1],z=S[2];if(!t.has(K)){const{defaultValue:U,validation:ie}=Ae(S[3]);e.push({fieldName:K,groupName:z,type:"rich",defaultValue:U,...ie}),t.add(K)}}});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 K=S[1];if(!t.has(K)){const{defaultValue:z,validation:U}=Ae(S[2]);e.push({fieldName:K,type:"rich",defaultValue:z,...U}),t.add(K)}}});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:K,validation:z}=Ae(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"textarea",defaultValue:K,optional:!0,...z}),t.add(S[1])}});const A=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(A)).forEach(S=>{if(S&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[2]);e.push({fieldName:S[1],type:"textarea",defaultValue:K,optional:!0,...z}),t.add(S[1])}});const k=new RegExp(he.TEXTAREA_FIELD_WITH_GROUP.source,he.TEXTAREA_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(k)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"textarea",defaultValue:K,...z}),t.add(S[1])}});const b=new RegExp(he.TEXTAREA_FIELD.source,he.TEXTAREA_FIELD.flags);Array.from(u.matchAll(b)).forEach(S=>{if(S&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[2]);e.push({fieldName:S[1],type:"textarea",defaultValue:K,...z}),t.add(S[1])}});const B=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(B)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"image",defaultValue:K,optional:!0,...z}),t.add(S[1])}});const D=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(D)).forEach(S=>{if(S&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[2]);e.push({fieldName:S[1],type:"image",defaultValue:K,optional:!0,...z}),t.add(S[1])}});const q=new RegExp(he.IMAGE_FIELD_WITH_GROUP.source,he.IMAGE_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(q)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"image",defaultValue:K,...z}),t.add(S[1])}});const V=new RegExp(he.IMAGE_FIELD.source,he.IMAGE_FIELD.flags);Array.from(u.matchAll(V)).forEach(S=>{if(S&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[2]);e.push({fieldName:S[1],type:"image",defaultValue:K,...z}),t.add(S[1])}});const J=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(J)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"text",defaultValue:K,optional:!0,...z}),t.add(S[1])}});const ne=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(ne)).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:K,validation:z}=Ae(S[2]);e.push({fieldName:S[1],type:"text",defaultValue:K,optional:!0,...z}),t.add(S[1])}});const Z=new RegExp(he.TEXT_FIELD_WITH_GROUP.source,he.TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(Z)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"text",defaultValue:K,...z}),t.add(S[1])}});const te=new RegExp(he.TEXT_FIELD.source,he.TEXT_FIELD.flags);Array.from(u.matchAll(te)).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:K,validation:z}=Ae(S[2]);e.push({fieldName:S[1],type:"text",defaultValue:K,...z}),t.add(S[1])}});const me=new RegExp(he.SELECT_FIELD_WITH_GROUP.source,he.SELECT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(me)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const K=S[1],z=S[2],U=S[3];U.includes("|")?e.push({fieldName:K,groupName:z,type:"select",options:U.split("|")}):U.includes(",")&&e.push({fieldName:K,groupName:z,type:"select-multiple",options:U.split(",")}),t.add(K)}}),(u.match(he.SELECT_FIELD)||[]).forEach(S=>{const K=S.match(/\(\$(\w+)@:([^)]+)\)/);if(K&&!t.has(K[1])){const z=K[1],U=K[2];U.includes("|")?e.push({fieldName:z,type:"select",options:U.split("|")}):U.includes(",")&&e.push({fieldName:z,type:"select-multiple",options:U.split(",")}),t.add(z)}});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]&&!t.has(S[1])){const K=S[1],z=S[2],U=S[3];U.includes("|")?e.push({fieldName:K,groupName:z,type:"radio",options:U.split("|")}):U.includes(",")&&e.push({fieldName:K,groupName:z,type:"checkbox",options:U.split(",")}),t.add(K)}}),(u.match(he.RADIO_FIELD)||[]).forEach(S=>{const K=S.match(/\(\$(\w+):([^)]+)\)/);if(K&&!t.has(K[1])){const z=K[1],U=K[2];U.includes("|")?e.push({fieldName:z,type:"radio",options:U.split("|")}):U.includes(",")&&e.push({fieldName:z,type:"checkbox",options:U.split(",")}),t.add(z)}});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 g=m[1],y=m[2];if(!t.has(g)){const x=y?y.split("|").map(v=>v.trim()):void 0,C=u.tagName.toLowerCase();let E=C;x&&!x.includes(C)&&(E=x[0]),e.push({fieldName:g,type:"tag",defaultValue:E,options:x,optional:!1}),t.add(g)}}}Array.from(u.attributes).forEach(m=>{const g=m.value,y=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(g.matchAll(y)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!t.has(N[1])){const{defaultValue:L,validation:$}=Ae(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"rich",defaultValue:L,optional:!0,...$}),t.add(N[1])}});const C=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(g.matchAll(C)).forEach(N=>{if(N&&N[1]&&N[2]&&!t.has(N[1])){const{defaultValue:L,validation:$}=Ae(N[2]);e.push({fieldName:N[1],type:"rich",defaultValue:L,optional:!0,...$}),t.add(N[1])}});const v=new RegExp(he.RICH_TEXT_FIELD_WITH_GROUP.source,he.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(v)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!t.has(N[1])){const{defaultValue:L,validation:$}=Ae(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"rich",defaultValue:L,...$}),t.add(N[1])}});const M=new RegExp(he.RICH_TEXT_FIELD.source,he.RICH_TEXT_FIELD.flags);Array.from(g.matchAll(M)).forEach(N=>{if(N&&N[1]&&N[2]&&!t.has(N[1])){const{defaultValue:L,validation:$}=Ae(N[2]);e.push({fieldName:N[1],type:"rich",defaultValue:L,...$}),t.add(N[1])}});const w=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(g.matchAll(w)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!t.has(N[1])){const{defaultValue:L,validation:$}=Ae(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"image",defaultValue:L,optional:!0,...$}),t.add(N[1])}});const R=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(g.matchAll(R)).forEach(N=>{if(N&&N[1]&&N[2]&&!t.has(N[1])){const{defaultValue:L,validation:$}=Ae(N[2]);e.push({fieldName:N[1],type:"image",defaultValue:L,optional:!0,...$}),t.add(N[1])}});const O=new RegExp(he.IMAGE_FIELD_WITH_GROUP.source,he.IMAGE_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(O)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!t.has(N[1])){const{defaultValue:L,validation:$}=Ae(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"image",defaultValue:L,...$}),t.add(N[1])}});const P=new RegExp(he.IMAGE_FIELD.source,he.IMAGE_FIELD.flags);Array.from(g.matchAll(P)).forEach(N=>{if(N&&N[1]&&N[2]&&!t.has(N[1])){const{defaultValue:L,validation:$}=Ae(N[2]);e.push({fieldName:N[1],type:"image",defaultValue:L,...$}),t.add(N[1])}});const W=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(g.matchAll(W)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!t.has(N[1])){const{defaultValue:L,validation:$}=Ae(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"text",defaultValue:L,optional:!0,...$}),t.add(N[1])}});const G=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(g.matchAll(G)).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]&&!t.has(N[1])){const{defaultValue:L,validation:$}=Ae(N[2]);e.push({fieldName:N[1],type:"text",defaultValue:L,optional:!0,...$}),t.add(N[1])}});const oe=new RegExp(he.TEXT_FIELD_WITH_GROUP.source,he.TEXT_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(oe)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!t.has(N[1])){const{defaultValue:L,validation:$}=Ae(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"text",defaultValue:L,...$}),t.add(N[1])}});const X=new RegExp(he.TEXT_FIELD.source,he.TEXT_FIELD.flags);Array.from(g.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]&&!t.has(N[1])){const{defaultValue:L,validation:$}=Ae(N[2]);e.push({fieldName:N[1],type:"text",defaultValue:L,...$}),t.add(N[1])}});const Y=new RegExp(he.SELECT_FIELD_WITH_GROUP.source,he.SELECT_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(Y)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!t.has(N[1])){const L=N[1],$=N[2],S=N[3];S.includes("|")?e.push({fieldName:L,groupName:$,type:"select",options:S.split("|")}):S.includes(",")&&e.push({fieldName:L,groupName:$,type:"select-multiple",options:S.split(",")}),t.add(L)}}),(g.match(he.SELECT_FIELD)||[]).forEach(N=>{const L=N.match(/\(\$(\w+)@:([^)]+)\)/);if(L&&!t.has(L[1])){const $=L[1],S=L[2];S.includes("|")?e.push({fieldName:$,type:"select",options:S.split("|")}):S.includes(",")&&e.push({fieldName:$,type:"select-multiple",options:S.split(",")}),t.add($)}});const me=new RegExp(he.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,he.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(me)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!t.has(N[1])){const L=N[1],$=N[2],S=N[3];S.includes("|")?e.push({fieldName:L,groupName:$,type:"radio",options:S.split("|")}):S.includes(",")&&e.push({fieldName:L,groupName:$,type:"checkbox",options:S.split(",")}),t.add(L)}}),(g.match(he.RADIO_FIELD)||[]).forEach(N=>{const L=N.match(/\(\$(\w+):([^)]+)\)/);if(L&&!t.has(L[1])){const $=L[1],S=L[2];S.includes("|")?e.push({fieldName:$,type:"radio",options:S.split("|")}):S.includes(",")&&e.push({fieldName:$,type:"checkbox",options:S.split(",")}),t.add($)}})}),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(a.content.childNodes).forEach(d=>l(d)),e}function Wd(n,e){const t=la(),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 a=i.content.firstElementChild;return Object.entries(e).forEach(([l,c])=>{a.setAttribute(l,c)}),a.outerHTML}function hi(n,e,t,o,r=[]){const i=[...t,...o,...r];if(n){const a=i.find(l=>l.id===n);if(a)return a.url}if(e){const a=i.find(l=>l.id===e);if(a)return console.warn(`Image not found: ${n}, using default: ${e}`),a.url}return console.warn(`Image not found: ${n}, default: ${e}`),""}function Jy(n){return typeof n=="object"&&n!==null}function qd(n,e){if(!n||!e)return"";try{const t=[];let o="";for(let i=0;i<e.length;i++){const a=e[i];a==="["||a==="]"||a==="."?o&&(t.push(o),o=""):o+=a}o&&t.push(o);let r=n;for(let i=0;i<t.length;i++){const a=t[i];if(a.match(/^\d+$/)){const l=parseInt(a,10);if(Array.isArray(r)&&l>=0&&l<r.length)r=r[l];else return""}else if(Jy(r)&&a in r)r=r[a];else return""}return r==null?"":String(r)}catch(t){return console.warn(`[ZeroCode] Failed to resolve backend data path: ${e}`,t),""}}function Xy(n,e){return!n||!e?n:n.replace(/\{(\w+)\}/g,(t,o)=>{const r=e[o];return r==null?t:String(r)})}function mi(n,e,t,o,r,i=!0,a=[],l=[],c=[],d,u){const f=la(),p=new f,h=p.parseFromString(`<template>${n}</template>`,"text/html"),m=h.querySelector("template");if(!m||!m.content)return console.error("Failed to parse template HTML"),n;const g=w=>{if(w.nodeType===Node.TEXT_NODE){let b=w.textContent||"";d&&(b=b.replace(he.BACKEND_DATA,(X,Z)=>qd(d,Z)));let B=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(b),O=!1;if(B&&w.parentNode?O=!0:B=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(b),B&&w.parentNode){const X=B[1],Z=O?B[3]:B[2],{defaultValue:Y}=Ae(Z),te=e[X];if(typeof te=="boolean"){const $=w.parentNode,S=B.index||0,K=b.substring(0,S),z=b.substring(S+B[0].length);K&&$.insertBefore(h.createTextNode(K),w),z&&$.insertBefore(h.createTextNode(z),w),w.parentNode&&w.parentNode.removeChild(w);return}let de=te===void 0?"":typeof te=="string"?te:String(te||Y);i||(de=Ud(de));const me=w.parentNode,Me=B.index||0,Le=b.substring(0,Me),N=b.substring(Me+B[0].length);de?de.trim().startsWith("<p")||(de=`<p>${de}</p>`):de="";const L=h.createElement("div");L.innerHTML=de,Le&&me.insertBefore(h.createTextNode(Le),w),Array.from(L.childNodes).forEach($=>{me.insertBefore($.cloneNode(!0),w)}),N&&me.insertBefore(h.createTextNode(N),w),w.parentNode&&w.parentNode.removeChild(w);return}let P=new RegExp(he.RICH_TEXT_FIELD_WITH_GROUP.source,he.RICH_TEXT_FIELD_WITH_GROUP.flags).exec(b),q=!1;if(P&&w.parentNode?q=!0:P=new RegExp(he.RICH_TEXT_FIELD.source,he.RICH_TEXT_FIELD.flags).exec(b),P&&w.parentNode){const X=P[1],Z=q?P[3]:P[2],Y=e[X];let te=Y===void 0?"":typeof Y=="string"?Y:String(Y||Z);i||(te=Ud(te));const de=w.parentNode,me=P.index||0,Me=b.substring(0,me),Le=b.substring(me+P[0].length);te?te.trim().startsWith("<p")||(te=`<p>${te}</p>`):te="<p></p>";const N=h.createElement("div");N.innerHTML=te,Me&&de.insertBefore(h.createTextNode(Me),w),Array.from(N.childNodes).forEach(L=>{de.insertBefore(L.cloneNode(!0),w)}),Le&&de.insertBefore(h.createTextNode(Le),w),w.parentNode&&w.parentNode.removeChild(w);return}let V=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(b),G=!1;if(V&&w.parentNode?G=!0:V=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(b),V&&w.parentNode){const X=V[1],Z=G?V[3]:V[2],{defaultValue:Y}=Ae(Z),te=e[X],de=te===void 0?"":String(te||Y),me=w.parentNode,Me=V.index||0,Le=b.substring(0,Me),N=b.substring(Me+V[0].length);Le&&me.insertBefore(h.createTextNode(Le),w);const L=de.split(`
341
- `);if(L.forEach(($,S)=>{$&&me.insertBefore(h.createTextNode($),w),S<L.length-1&&me.insertBefore(h.createElement("br"),w)}),N){const $=h.createTextNode(N);me.insertBefore($,w),g($)}w.parentNode&&w.parentNode.removeChild(w);return}let oe=new RegExp(he.TEXTAREA_FIELD_WITH_GROUP.source,he.TEXTAREA_FIELD_WITH_GROUP.flags).exec(b),ne=!1;if(oe&&w.parentNode?ne=!0:oe=new RegExp(he.TEXTAREA_FIELD.source,he.TEXTAREA_FIELD.flags).exec(b),oe&&w.parentNode){const X=oe[1],Z=ne?oe[3]:oe[2],Y=e[X]??Z??"",te=String(Y),de=w.parentNode,me=oe.index||0,Me=b.substring(0,me),Le=b.substring(me+oe[0].length);Me&&de.insertBefore(h.createTextNode(Me),w);const N=te.split(`
342
- `);if(N.forEach((L,$)=>{L&&de.insertBefore(h.createTextNode(L),w),$<N.length-1&&de.insertBefore(h.createElement("br"),w)}),Le){const L=h.createTextNode(Le);de.insertBefore(L,w),g(L)}w.parentNode&&w.parentNode.removeChild(w);return}b=b.replace(/\{\$(\w+)\?:([^}]+)\}/g,(X,Z,Y)=>{if(/:textarea(?::[^}]*)?$/.test(X))return X;const te=e[Z];if(te===void 0||typeof te=="boolean")return"";const{defaultValue:de}=Ae(Y);return String(te||de)}),b=b.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(X,Z,Y,te)=>{if(/:textarea(?::[^}]*)?$/.test(X))return X;const de=e[Z];if(de===void 0||typeof de=="boolean")return"";const{defaultValue:me}=Ae(te);return String(de||me)}),b=b.replace(he.TEXT_FIELD_WITH_GROUP,(X,Z,Y,te)=>{const de=e[Z];if(de===void 0)return"";const{defaultValue:me}=Ae(te);return String(de||me)}),b=b.replace(he.TEXT_FIELD,(X,Z,Y)=>{const te=e[Z];if(te===void 0)return"";const{defaultValue:de}=Ae(Y);return String(te||de)}),w.textContent=b}else if(w.nodeType===Node.ELEMENT_NODE){const b=w,R=[];Array.from(b.attributes).forEach(B=>{const O=B.value;let D=B.value;const P=B.name.toLowerCase();if(P==="z-if"||P==="z-for"||P==="z-slot"||P==="z-empty"||P==="z-tag"||P.startsWith("data-zcode-"))return;const q=/^\{\$[\w.]+?\?:[^}]+\}(?::(rich|image|textarea))?$/.test(O.trim());d&&((P==="href"||P==="src"||P==="action")&&(D=Xy(D,d)),D=D.replace(he.BACKEND_DATA,(W,V)=>{const G=qd(d,V);return P==="href"||P==="src"||P==="action"?Nt(G):rt(G)})),D=D.replace(/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(W,V,G)=>{const J=e[V];if(J===void 0||typeof J=="boolean")return"";const{defaultValue:oe}=Ae(G);return rt(String(J||oe))}),D=D.replace(/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(W,V,G,J)=>{const oe=e[V];if(oe===void 0||typeof oe=="boolean")return"";const{defaultValue:ne}=Ae(J);return rt(String(oe||ne))}),D=D.replace(/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(W,V,G)=>{const J=e[V];if(J===void 0)return"";const{defaultValue:oe}=Ae(G),ne=typeof J=="string"?J:String(J||oe),X=hi(ne,oe,a,l,c),Z=typeof X=="string"?X:String(X||oe);return P==="href"||P==="src"?Nt(Z):rt(Z)}),D=D.replace(/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(W,V,G,J)=>{const oe=e[V];if(oe===void 0)return"";const{defaultValue:ne}=Ae(J),X=typeof oe=="string"?oe:String(oe||ne),Z=hi(X,ne,a,l,c),Y=typeof Z=="string"?Z:String(Z||ne);return P==="href"||P==="src"?Nt(Y):rt(Y)}),D=D.replace(he.RICH_TEXT_FIELD_WITH_GROUP,(W,V,G,J)=>{const oe=e[V];return oe===void 0?"":rt(String(oe||J))}),D=D.replace(he.RICH_TEXT_FIELD,(W,V,G)=>{const J=e[V];return J===void 0?"":rt(String(J||G))}),D=D.replace(he.IMAGE_FIELD_WITH_GROUP,(W,V,G,J)=>{const oe=e[V];if(oe===void 0)return"";const ne=hi(oe||J,J,a,l,c);return P==="href"||P==="src"?Nt(ne||J):rt(ne||J)}),D=D.replace(he.IMAGE_FIELD,(W,V,G)=>{const J=e[V];if(J===void 0)return"";const oe=hi(J||G,G,a,l,c);return P==="href"||P==="src"?Nt(oe||G):rt(oe||G)}),D=D.replace(/\{\$(\w+)\?:([^}]+)\}/g,(W,V,G)=>{const J=e[V];if(J===void 0||typeof J=="boolean")return"";const{defaultValue:oe}=Ae(G),ne=String(J||oe);return P==="href"||P==="src"||P==="action"?Nt(ne):rt(ne)}),D=D.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(W,V,G,J)=>{const oe=e[V];if(oe===void 0||typeof oe=="boolean")return"";const{defaultValue:ne}=Ae(J),X=String(oe||ne);return P==="href"||P==="src"||P==="action"?Nt(X):rt(X)}),D=D.replace(he.TEXT_FIELD_WITH_GROUP,(W,V,G,J)=>{const oe=e[V];if(oe===void 0)return"";const{defaultValue:ne}=Ae(J),X=String(oe||ne);return P==="href"||P==="src"||P==="action"?Nt(X):rt(X)}),D=D.replace(he.TEXT_FIELD,(W,V,G)=>{const J=e[V];if(J===void 0)return"";const{defaultValue:oe}=Ae(G),ne=String(J||oe);return P==="href"||P==="src"||P==="action"?Nt(ne):rt(ne)}),q&&D.trim()===""?R.push(B.name):B.value=D}),R.forEach(B=>{b.removeAttribute(B)})}Array.from(w.childNodes).forEach(b=>g(b))};g(m.content);const y=w=>{if(w.nodeType===Node.TEXT_NODE){let b=w.textContent||"";b=b.replace(he.SELECT_FIELD_WITH_GROUP,(R,B,O,D)=>{if(D.includes("|"))return e[B]||D.split("|")[0];if(D.includes(",")){const P=e[B],q=Array.isArray(P)?P:[],W=D.split(",");return q.filter(V=>typeof V=="string"&&W.includes(V)).join(" ")}return e[B]||D}),b=b.replace(he.SELECT_FIELD,(R,B,O)=>{if(O.includes("|")){const P=e[B];return typeof P=="string"?P:O.split("|")[0]}else if(O.includes(",")){const P=e[B],q=Array.isArray(P)?P:[],W=O.split(",");return q.filter(V=>typeof V=="string"&&W.includes(V)).join(" ")}const D=e[B];return typeof D=="string"?D:O}),b=b.replace(he.RADIO_CHECKBOX_FIELD_WITH_GROUP,(R,B,O,D)=>{if(D.includes("|")){const q=e[B];return typeof q=="string"?q:D.split("|")[0]}else if(D.includes(",")){const q=e[B],W=Array.isArray(q)?q:[],V=D.split(",");return W.filter(G=>typeof G=="string"&&V.includes(G)).join(" ")}const P=e[B];return typeof P=="string"?P:D}),b=b.replace(he.RADIO_FIELD,(R,B,O)=>{if(O.includes("|")){const P=e[B];return typeof P=="string"?P:O.split("|")[0]}else if(O.includes(",")){const P=e[B],q=Array.isArray(P)?P:[],W=O.split(",");return q.filter(V=>typeof V=="string"&&W.includes(V)).join(" ")}const D=e[B];return typeof D=="string"?D:O}),w.textContent=b}else w.nodeType===Node.ELEMENT_NODE&&Array.from(w.attributes).forEach(R=>{let B=R.value;const O=R.name.toLowerCase();B=B.replace(he.SELECT_FIELD_WITH_GROUP,(D,P,q,W)=>{let V;if(W.includes("|"))V=e[P]||W.split("|")[0];else if(W.includes(",")){const G=e[P],J=Array.isArray(G)?G:[],oe=W.split(",");V=J.filter(ne=>typeof ne=="string"&&oe.includes(ne)).join(" ")}else{const G=e[P];V=typeof G=="string"?G:W}return O==="href"||O==="src"||O==="action"?Nt(String(V)):rt(String(V))}),B=B.replace(he.SELECT_FIELD,(D,P,q)=>{let W;if(q.includes("|"))W=e[P]||q.split("|")[0];else if(q.includes(",")){const V=e[P],G=Array.isArray(V)?V:[],J=q.split(",");W=G.filter(oe=>typeof oe=="string"&&J.includes(oe)).join(" ")}else{const V=e[P];W=typeof V=="string"?V:q}return O==="href"||O==="src"||O==="action"?Nt(String(W)):rt(String(W))}),B=B.replace(he.RADIO_CHECKBOX_FIELD_WITH_GROUP,(D,P,q,W)=>{let V;if(W.includes("|"))V=e[P]||W.split("|")[0];else if(W.includes(",")){const G=e[P],J=Array.isArray(G)?G:[],oe=W.split(",");V=J.filter(ne=>typeof ne=="string"&&oe.includes(ne)).join(" ")}else{const G=e[P];V=typeof G=="string"?G:W}return O==="href"||O==="src"||O==="action"?Nt(String(V)):rt(String(V))}),B=B.replace(he.RADIO_FIELD,(D,P,q)=>{let W;if(q.includes("|"))W=e[P]||q.split("|")[0];else if(q.includes(",")){const V=e[P],G=Array.isArray(V)?V:[],J=q.split(",");W=G.filter(oe=>typeof oe=="string"&&J.includes(oe)).join(" ")}else{const V=e[P];W=typeof V=="string"?V:q}return O==="href"||O==="src"||O==="action"?Nt(String(W)):rt(String(W))}),R.value=B});w.childNodes.forEach(b=>y(b))};y(m.content),m.content.querySelectorAll("[z-if]").forEach(w=>{const b=w.getAttribute("z-if");b?(e[b]!==void 0?e[b]:!0)?w.removeAttribute("z-if"):w.remove():w.removeAttribute("z-if")}),m.content.querySelectorAll("[z-tag]").forEach(w=>{const b=w.getAttribute("z-tag");if(b){const R=b.match(/^\$(\w+)(?::(.+))?$/);if(R){const B=R[1],O=e[B],D=typeof O=="string"?O:w.tagName.toLowerCase(),P=["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"],q=typeof D=="string"?D.toLowerCase():D;if(typeof q=="string"&&P.includes(q)){const W=h.createElement(q);Array.from(w.attributes).forEach(V=>{V.name!=="z-tag"&&W.setAttribute(V.name,V.value)}),Array.from(w.childNodes).forEach(V=>{W.appendChild(V.cloneNode(!0))}),w.parentNode?.replaceChild(W,w)}}}}),m.content.querySelectorAll("[z-empty]").forEach(w=>{const b=w.getAttribute("z-empty");if(b){const R=b.match(/^\$(\w+)$/);if(R){const B=R[1],O=e[B];(P=>{if(P==null||P==="")return!0;if(typeof P=="string"){const q=P.trim();if(q===""||q==="<p></p>"||q==="<p> </p>"||/^<p>\s*<\/p>$/i.test(q)||/^<p>\s*<br\s*\/?>\s*<\/p>$/i.test(q))return!0}return!1})(O)?w.remove():w.removeAttribute("z-empty")}else w.removeAttribute("z-empty")}else w.removeAttribute("z-empty")});const v=()=>{Array.from(m.content.querySelectorAll("[z-for]")).forEach(b=>{const R=b.getAttribute("z-for");if(!R){b.removeAttribute("z-for");return}const B=R.match(/^(\w+)\s+in\s+(.+)$/);if(!B){console.warn(`[ZeroCode] Invalid z-for syntax: ${R}`),b.removeAttribute("z-for");return}const[,O,D]=B;if(!D.startsWith("{@")||!D.endsWith("}")){console.warn(`[ZeroCode] z-for only supports backend data: ${D}`),b.removeAttribute("z-for");return}const P=D.slice(2,-1);if(!d){b.remove();return}let q;try{const V=P.split(".");let G=d;for(const J of V)if(G&&typeof G=="object"&&J in G)G=G[J];else{G=null;break}q=G}catch(V){console.warn(`[ZeroCode] Failed to resolve data source: ${P}`,V),b.remove();return}if(!Array.isArray(q)||q.length===0){b.remove();return}const W=document.createDocumentFragment();q.forEach(V=>{const G=b.cloneNode(!0);G.removeAttribute("z-for"),A(G,O,V,e,d),W.appendChild(G)}),b.parentNode&&b.parentNode.replaceChild(W,b)})},A=(w,b,R,B,O,D)=>{const P=W=>{if(W.nodeType===Node.TEXT_NODE){let V=W.textContent||"";const G=new RegExp(`\\{${b}\\.([\\w\\.\\[\\]]+)\\}`,"g");V=V.replace(G,(J,oe)=>{try{const ne=oe.split(/[.[\]]/).filter(Z=>Z);let X=R;for(const Z of ne)if(Z.match(/^\d+$/)){const Y=parseInt(Z,10);if(Array.isArray(X)&&Y>=0&&Y<X.length)X=X[Y];else return""}else if(X&&typeof X=="object"&&Z in X)X=X[Z];else return"";return X==null?"":String(X)}catch{return""}}),V=V.replace(new RegExp(`\\{${b}\\}`,"g"),()=>typeof R=="object"&&R!==null?JSON.stringify(R):String(R)),W.textContent=V}else if(W.nodeType===Node.ELEMENT_NODE){const V=W;Array.from(V.attributes).forEach(G=>{let J=G.value;const oe=new RegExp(`\\{${b}\\.([\\w\\.\\[\\]]+)\\}`,"g");J=J.replace(oe,(ne,X)=>{try{const Z=X.split(/[.[\]]/).filter(de=>de);let Y=R;for(const de of Z)if(de.match(/^\d+$/)){const me=parseInt(de,10);if(Array.isArray(Y)&&me>=0&&me<Y.length)Y=Y[me];else return""}else if(Y&&typeof Y=="object"&&de in Y)Y=Y[de];else return"";const te=Y==null?"":String(Y);return G.name==="href"||G.name==="src"||G.name==="action"?Nt(te):rt(te)}catch{return""}}),J=J.replace(new RegExp(`\\{${b}\\}`,"g"),()=>{const ne=typeof R=="object"&&R!==null?JSON.stringify(R):String(R);return G.name==="href"||G.name==="src"||G.name==="action"?Nt(ne):rt(ne)}),G.value=J}),Array.from(V.childNodes).forEach(G=>P(G))}};Array.from(w.childNodes).forEach(W=>P(W));const q=w.innerHTML;if(q){const W=mi(q,B,t,o,r,i,a,l,c,O);w.innerHTML=W}};v();const M=w=>{w.forEach(b=>{const R=b.getAttribute("z-slot")||"default",B=e.slots?.[R];let O=[];if(Array.isArray(B)?O=B:B&&typeof B=="object"&&B.children&&(O=B.children||[]),O.length===0){if(b.removeAttribute("z-slot"),i){b.setAttribute("data-zcode-empty-slot",R),b.setAttribute("data-zcode-slot-path",t?`${t}.slots.${R}`:`slots.${R}`);const W=u?.translations?.addSlotButton??"+ Add Part";b.innerHTML=`<div class="zcode-empty-slot" data-zcode-empty-slot-content>
339
+ `}function Io(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(a){a.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=Cy(n),n.insertBefore(r,n.firstChild)}function Ny(){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 rr(n,e=0){if(!(typeof window>"u"||!n))try{const t=n.getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,r=Ny(),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:_d,setPrototypeOf:Od,isFrozen:vy,getPrototypeOf:Ty,getOwnPropertyDescriptor:zy}=Object;let{freeze:wt,seal:Bt,create:ca}=Object,{apply:da,construct:ua}=typeof Reflect<"u"&&Reflect;wt||(wt=function(e){return e}),Bt||(Bt=function(e){return e}),da||(da=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)}),ua||(ua=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 ui=Ct(Array.prototype.forEach),My=Ct(Array.prototype.lastIndexOf),Dd=Ct(Array.prototype.pop),ir=Ct(Array.prototype.push),Ay=Ct(Array.prototype.splice),fi=Ct(String.prototype.toLowerCase),fa=Ct(String.prototype.toString),pa=Ct(String.prototype.match),sr=Ct(String.prototype.replace),Iy=Ct(String.prototype.indexOf),_y=Ct(String.prototype.trim),nn=Ct(Object.prototype.hasOwnProperty),St=Ct(RegExp.prototype.test),ar=Oy(TypeError);function Ct(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 da(n,e,o)}}function Oy(n){return function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return ua(n,t)}}function De(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:fi;Od&&Od(n,null);let o=e.length;for(;o--;){let r=e[o];if(typeof r=="string"){const i=t(r);i!==r&&(vy(e)||(e[o]=i),r=i)}n[r]=!0}return n}function Dy(n){for(let e=0;e<n.length;e++)nn(n,e)||(n[e]=null);return n}function cn(n){const e=ca(null);for(const[t,o]of _d(n))nn(n,t)&&(Array.isArray(o)?e[t]=Dy(o):o&&typeof o=="object"&&o.constructor===Object?e[t]=cn(o):e[t]=o);return e}function lr(n,e){for(;n!==null;){const o=zy(n,e);if(o){if(o.get)return Ct(o.get);if(typeof o.value=="function")return Ct(o.value)}n=Ty(n)}function t(){return null}return t}const Pd=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"]),ha=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"]),ma=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"]),Py=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"]),ga=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"]),Ry=wt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Rd=wt(["#text"]),Ld=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"]),ya=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"]),$d=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"]),pi=wt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ly=Bt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),$y=Bt(/<%[\w\W]*|[\w\W]*%>/gm),Vy=Bt(/\$\{[\w\W]*/gm),By=Bt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Fy=Bt(/^aria-[\-\w]+$/),Vd=Bt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),jy=Bt(/^(?:\w+script|data):/i),Hy=Bt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Bd=Bt(/^html$/i),Uy=Bt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Fd=Object.freeze({__proto__:null,ARIA_ATTR:Fy,ATTR_WHITESPACE:Hy,CUSTOM_ELEMENT:Uy,DATA_ATTR:By,DOCTYPE_NAME:Bd,ERB_EXPR:$y,IS_ALLOWED_URI:Vd,IS_SCRIPT_OR_DATA:jy,MUSTACHE_EXPR:Ly,TMPLIT_EXPR:Vy});const cr={element:1,text:3,progressingInstruction:7,comment:8,document:9},Wy=function(){return typeof window>"u"?null:window},qy=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(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},jd=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Hd(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Wy();const e=ke=>Hd(ke);if(e.version="3.3.1",e.removed=[],!n||!n.document||n.document.nodeType!==cr.document||!n.Element)return e.isSupported=!1,e;let{document:t}=n;const o=t,r=o.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:h}=n,m=c.prototype,g=lr(m,"cloneNode"),y=lr(m,"remove"),x=lr(m,"nextSibling"),N=lr(m,"childNodes"),E=lr(m,"parentNode");if(typeof a=="function"){const ke=t.createElement("template");ke.content&&ke.content.ownerDocument&&(t=ke.content.ownerDocument)}let v,A="";const{implementation:M,createNodeIterator:k,createDocumentFragment:w,getElementsByTagName:b}=t,{importNode:R}=o;let B=jd();e.isSupported=typeof _d=="function"&&typeof E=="function"&&M&&M.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:O,ERB_EXPR:D,TMPLIT_EXPR:P,DATA_ATTR:q,ARIA_ATTR:W,IS_SCRIPT_OR_DATA:V,ATTR_WHITESPACE:G,CUSTOM_ELEMENT:J}=Fd;let{IS_ALLOWED_URI:oe}=Fd,ne=null;const X=De({},[...Pd,...ha,...ma,...ga,...Rd]);let Z=null;const Y=De({},[...Ld,...ya,...$d,...pi]);let te=Object.seal(ca(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,me=null;const Me=Object.seal(ca(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Le=!0,C=!0,L=!1,$=!0,S=!1,K=!0,z=!1,U=!1,ie=!1,Se=!1,ve=!1,T=!1,I=!0,Q=!1;const ge="user-content-";let Te=!0,ye=!1,H={},ee=null;const ze=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 Pe=null;const dt=De({},["audio","video","img","source","image","track"]);let Xt=null;const Ot=De({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),$t="http://www.w3.org/1998/Math/MathML",_n="http://www.w3.org/2000/svg",F="http://www.w3.org/1999/xhtml";let j=F,le=!1,fe=null;const _e=De({},[$t,_n,F],fa);let Qe=De({},["mi","mo","mn","ms","mtext"]),gn=De({},["annotation-xml"]);const Kr=De({},["title","style","font","a","script"]);let vo=null;const lc=["application/xhtml+xml","text/html"],Jr="text/html";let Ke=null,Dt=null;const cc=t.createElement("form"),Ko=function(_){return _ instanceof RegExp||_ instanceof Function},Jo=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Dt&&Dt===_)){if((!_||typeof _!="object")&&(_={}),_=cn(_),vo=lc.indexOf(_.PARSER_MEDIA_TYPE)===-1?Jr:_.PARSER_MEDIA_TYPE,Ke=vo==="application/xhtml+xml"?fa:fi,ne=nn(_,"ALLOWED_TAGS")?De({},_.ALLOWED_TAGS,Ke):X,Z=nn(_,"ALLOWED_ATTR")?De({},_.ALLOWED_ATTR,Ke):Y,fe=nn(_,"ALLOWED_NAMESPACES")?De({},_.ALLOWED_NAMESPACES,fa):_e,Xt=nn(_,"ADD_URI_SAFE_ATTR")?De(cn(Ot),_.ADD_URI_SAFE_ATTR,Ke):Ot,Pe=nn(_,"ADD_DATA_URI_TAGS")?De(cn(dt),_.ADD_DATA_URI_TAGS,Ke):dt,ee=nn(_,"FORBID_CONTENTS")?De({},_.FORBID_CONTENTS,Ke):ze,de=nn(_,"FORBID_TAGS")?De({},_.FORBID_TAGS,Ke):cn({}),me=nn(_,"FORBID_ATTR")?De({},_.FORBID_ATTR,Ke):cn({}),H=nn(_,"USE_PROFILES")?_.USE_PROFILES:!1,Le=_.ALLOW_ARIA_ATTR!==!1,C=_.ALLOW_DATA_ATTR!==!1,L=_.ALLOW_UNKNOWN_PROTOCOLS||!1,$=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,S=_.SAFE_FOR_TEMPLATES||!1,K=_.SAFE_FOR_XML!==!1,z=_.WHOLE_DOCUMENT||!1,Se=_.RETURN_DOM||!1,ve=_.RETURN_DOM_FRAGMENT||!1,T=_.RETURN_TRUSTED_TYPE||!1,ie=_.FORCE_BODY||!1,I=_.SANITIZE_DOM!==!1,Q=_.SANITIZE_NAMED_PROPS||!1,Te=_.KEEP_CONTENT!==!1,ye=_.IN_PLACE||!1,oe=_.ALLOWED_URI_REGEXP||Vd,j=_.NAMESPACE||F,Qe=_.MATHML_TEXT_INTEGRATION_POINTS||Qe,gn=_.HTML_INTEGRATION_POINTS||gn,te=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&Ko(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(te.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&Ko(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(te.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(te.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),S&&(C=!1),ve&&(Se=!0),H&&(ne=De({},Rd),Z=[],H.html===!0&&(De(ne,Pd),De(Z,Ld)),H.svg===!0&&(De(ne,ha),De(Z,ya),De(Z,pi)),H.svgFilters===!0&&(De(ne,ma),De(Z,ya),De(Z,pi)),H.mathMl===!0&&(De(ne,ga),De(Z,$d),De(Z,pi))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?Me.tagCheck=_.ADD_TAGS:(ne===X&&(ne=cn(ne)),De(ne,_.ADD_TAGS,Ke))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?Me.attributeCheck=_.ADD_ATTR:(Z===Y&&(Z=cn(Z)),De(Z,_.ADD_ATTR,Ke))),_.ADD_URI_SAFE_ATTR&&De(Xt,_.ADD_URI_SAFE_ATTR,Ke),_.FORBID_CONTENTS&&(ee===ze&&(ee=cn(ee)),De(ee,_.FORBID_CONTENTS,Ke)),_.ADD_FORBID_CONTENTS&&(ee===ze&&(ee=cn(ee)),De(ee,_.ADD_FORBID_CONTENTS,Ke)),Te&&(ne["#text"]=!0),z&&De(ne,["html","head","body"]),ne.table&&(De(ne,["tbody"]),delete de.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw ar('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ar('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=_.TRUSTED_TYPES_POLICY,A=v.createHTML("")}else v===void 0&&(v=qy(h,r)),v!==null&&typeof A=="string"&&(A=v.createHTML(""));wt&&wt(_),Dt=_}},Fs=De({},[...ha,...ma,...Py]),Xr=De({},[...ga,...Ry]),dc=function(_){let ce=E(_);(!ce||!ce.tagName)&&(ce={namespaceURI:j,tagName:"template"});const be=fi(_.tagName),qe=fi(ce.tagName);return fe[_.namespaceURI]?_.namespaceURI===_n?ce.namespaceURI===F?be==="svg":ce.namespaceURI===$t?be==="svg"&&(qe==="annotation-xml"||Qe[qe]):!!Fs[be]:_.namespaceURI===$t?ce.namespaceURI===F?be==="math":ce.namespaceURI===_n?be==="math"&&gn[qe]:!!Xr[be]:_.namespaceURI===F?ce.namespaceURI===_n&&!gn[qe]||ce.namespaceURI===$t&&!Qe[qe]?!1:!Xr[be]&&(Kr[be]||!Fs[be]):!!(vo==="application/xhtml+xml"&&fe[_.namespaceURI]):!1},Yt=function(_){ir(e.removed,{element:_});try{E(_).removeChild(_)}catch{y(_)}},yn=function(_,ce){try{ir(e.removed,{attribute:ce.getAttributeNode(_),from:ce})}catch{ir(e.removed,{attribute:null,from:ce})}if(ce.removeAttribute(_),_==="is")if(Se||ve)try{Yt(ce)}catch{}else try{ce.setAttribute(_,"")}catch{}},js=function(_){let ce=null,be=null;if(ie)_="<remove></remove>"+_;else{const nt=pa(_,/^[\r\n\t ]+/);be=nt&&nt[0]}vo==="application/xhtml+xml"&&j===F&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const qe=v?v.createHTML(_):_;if(j===F)try{ce=new p().parseFromString(qe,vo)}catch{}if(!ce||!ce.documentElement){ce=M.createDocument(j,"template",null);try{ce.documentElement.innerHTML=le?A:qe}catch{}}const xt=ce.body||ce.documentElement;return _&&be&&xt.insertBefore(t.createTextNode(be),xt.childNodes[0]||null),j===F?b.call(ce,z?"html":"body")[0]:z?ce.documentElement:xt},Yr=function(_){return k.call(_.ownerDocument||_,_,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Qr=function(_){return _ instanceof f&&(typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||!(_.attributes instanceof u)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function")},Zr=function(_){return typeof l=="function"&&_ instanceof l};function se(ke,_,ce){ui(ke,be=>{be.call(e,_,ce,Dt)})}const ue=function(_){let ce=null;if(se(B.beforeSanitizeElements,_,null),Qr(_))return Yt(_),!0;const be=Ke(_.nodeName);if(se(B.uponSanitizeElement,_,{tagName:be,allowedTags:ne}),K&&_.hasChildNodes()&&!Zr(_.firstElementChild)&&St(/<[/\w!]/g,_.innerHTML)&&St(/<[/\w!]/g,_.textContent)||_.nodeType===cr.progressingInstruction||K&&_.nodeType===cr.comment&&St(/<[/\w]/g,_.data))return Yt(_),!0;if(!(Me.tagCheck instanceof Function&&Me.tagCheck(be))&&(!ne[be]||de[be])){if(!de[be]&&We(be)&&(te.tagNameCheck instanceof RegExp&&St(te.tagNameCheck,be)||te.tagNameCheck instanceof Function&&te.tagNameCheck(be)))return!1;if(Te&&!ee[be]){const qe=E(_)||_.parentNode,xt=N(_)||_.childNodes;if(xt&&qe){const nt=xt.length;for(let Pt=nt-1;Pt>=0;--Pt){const On=g(xt[Pt],!0);On.__removalCount=(_.__removalCount||0)+1,qe.insertBefore(On,x(_))}}}return Yt(_),!0}return _ instanceof c&&!dc(_)||(be==="noscript"||be==="noembed"||be==="noframes")&&St(/<\/no(script|embed|frames)/i,_.innerHTML)?(Yt(_),!0):(S&&_.nodeType===cr.text&&(ce=_.textContent,ui([O,D,P],qe=>{ce=sr(ce,qe," ")}),_.textContent!==ce&&(ir(e.removed,{element:_.cloneNode()}),_.textContent=ce)),se(B.afterSanitizeElements,_,null),!1)},we=function(_,ce,be){if(I&&(ce==="id"||ce==="name")&&(be in t||be in cc))return!1;if(!(C&&!me[ce]&&St(q,ce))){if(!(Le&&St(W,ce))){if(!(Me.attributeCheck instanceof Function&&Me.attributeCheck(ce,_))){if(!Z[ce]||me[ce]){if(!(We(_)&&(te.tagNameCheck instanceof RegExp&&St(te.tagNameCheck,_)||te.tagNameCheck instanceof Function&&te.tagNameCheck(_))&&(te.attributeNameCheck instanceof RegExp&&St(te.attributeNameCheck,ce)||te.attributeNameCheck instanceof Function&&te.attributeNameCheck(ce,_))||ce==="is"&&te.allowCustomizedBuiltInElements&&(te.tagNameCheck instanceof RegExp&&St(te.tagNameCheck,be)||te.tagNameCheck instanceof Function&&te.tagNameCheck(be))))return!1}else if(!Xt[ce]){if(!St(oe,sr(be,G,""))){if(!((ce==="src"||ce==="xlink:href"||ce==="href")&&_!=="script"&&Iy(be,"data:")===0&&Pe[_])){if(!(L&&!St(V,sr(be,G,"")))){if(be)return!1}}}}}}}return!0},We=function(_){return _!=="annotation-xml"&&pa(_,J)},bt=function(_){se(B.beforeSanitizeAttributes,_,null);const{attributes:ce}=_;if(!ce||Qr(_))return;const be={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Z,forceKeepAttr:void 0};let qe=ce.length;for(;qe--;){const xt=ce[qe],{name:nt,namespaceURI:Pt,value:On}=xt,Xo=Ke(nt),uc=On;let mt=nt==="value"?uc:_y(uc);if(be.attrName=Xo,be.attrValue=mt,be.keepAttr=!0,be.forceKeepAttr=void 0,se(B.uponSanitizeAttribute,_,be),mt=be.attrValue,Q&&(Xo==="id"||Xo==="name")&&(yn(nt,_),mt=ge+mt),K&&St(/((--!?|])>)|<\/(style|title|textarea)/i,mt)){yn(nt,_);continue}if(Xo==="attributename"&&pa(mt,"href")){yn(nt,_);continue}if(be.forceKeepAttr)continue;if(!be.keepAttr){yn(nt,_);continue}if(!$&&St(/\/>/i,mt)){yn(nt,_);continue}S&&ui([O,D,P],sm=>{mt=sr(mt,sm," ")});const im=Ke(_.nodeName);if(!we(im,Xo,mt)){yn(nt,_);continue}if(v&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Pt)switch(h.getAttributeType(im,Xo)){case"TrustedHTML":{mt=v.createHTML(mt);break}case"TrustedScriptURL":{mt=v.createScriptURL(mt);break}}if(mt!==uc)try{Pt?_.setAttributeNS(Pt,nt,mt):_.setAttribute(nt,mt),Qr(_)?Yt(_):Dd(e.removed)}catch{yn(nt,_)}}se(B.afterSanitizeAttributes,_,null)},tt=function ke(_){let ce=null;const be=Yr(_);for(se(B.beforeSanitizeShadowDOM,_,null);ce=be.nextNode();)se(B.uponSanitizeShadowNode,ce,null),ue(ce),bt(ce),ce.content instanceof i&&ke(ce.content);se(B.afterSanitizeShadowDOM,_,null)};return e.sanitize=function(ke){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ce=null,be=null,qe=null,xt=null;if(le=!ke,le&&(ke="<!-->"),typeof ke!="string"&&!Zr(ke))if(typeof ke.toString=="function"){if(ke=ke.toString(),typeof ke!="string")throw ar("dirty is not a string, aborting")}else throw ar("toString is not a function");if(!e.isSupported)return ke;if(U||Jo(_),e.removed=[],typeof ke=="string"&&(ye=!1),ye){if(ke.nodeName){const On=Ke(ke.nodeName);if(!ne[On]||de[On])throw ar("root node is forbidden and cannot be sanitized in-place")}}else if(ke instanceof l)ce=js("<!---->"),be=ce.ownerDocument.importNode(ke,!0),be.nodeType===cr.element&&be.nodeName==="BODY"||be.nodeName==="HTML"?ce=be:ce.appendChild(be);else{if(!Se&&!S&&!z&&ke.indexOf("<")===-1)return v&&T?v.createHTML(ke):ke;if(ce=js(ke),!ce)return Se?null:T?A:""}ce&&ie&&Yt(ce.firstChild);const nt=Yr(ye?ke:ce);for(;qe=nt.nextNode();)ue(qe),bt(qe),qe.content instanceof i&&tt(qe.content);if(ye)return ke;if(Se){if(ve)for(xt=w.call(ce.ownerDocument);ce.firstChild;)xt.appendChild(ce.firstChild);else xt=ce;return(Z.shadowroot||Z.shadowrootmode)&&(xt=R.call(o,xt,!0)),xt}let Pt=z?ce.outerHTML:ce.innerHTML;return z&&ne["!doctype"]&&ce.ownerDocument&&ce.ownerDocument.doctype&&ce.ownerDocument.doctype.name&&St(Bd,ce.ownerDocument.doctype.name)&&(Pt="<!DOCTYPE "+ce.ownerDocument.doctype.name+`>
340
+ `+Pt),S&&ui([O,D,P],On=>{Pt=sr(Pt,On," ")}),v&&T?v.createHTML(Pt):Pt},e.setConfig=function(){let ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Jo(ke),U=!0},e.clearConfig=function(){Dt=null,U=!1},e.isValidAttribute=function(ke,_,ce){Dt||Jo({});const be=Ke(ke),qe=Ke(_);return we(be,qe,ce)},e.addHook=function(ke,_){typeof _=="function"&&ir(B[ke],_)},e.removeHook=function(ke,_){if(_!==void 0){const ce=My(B[ke],_);return ce===-1?void 0:Ay(B[ke],ce,1)[0]}return Dd(B[ke])},e.removeHooks=function(ke){B[ke]=[]},e.removeAllHooks=function(){B=jd()},e}var Gy=Hd();function Ud(n){return Gy.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 rt(n){return typeof n!="string"?"":n.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Nt(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 Ky(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 Ae(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:Ky(t)}}function Fn(n){const e=[],t=new Set,o=la(),a=new o().parseFromString(`<template>${n}</template>`,"text/html").querySelector("template");if(!a)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 K=S[1],z=S[2];if(!t.has(K)){const{defaultValue:U,validation:ie}=Ae(S[3]);e.push({fieldName:K,groupName:z,type:"rich",defaultValue:U,optional:!0,...ie}),t.add(K)}}});const h=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(h)).forEach(S=>{if(S&&S[1]&&S[2]){const K=S[1];if(!t.has(K)){const{defaultValue:z,validation:U}=Ae(S[2]);e.push({fieldName:K,type:"rich",defaultValue:z,optional:!0,...U}),t.add(K)}}});const g=new RegExp(he.RICH_TEXT_FIELD_WITH_GROUP.source,he.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(g)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]){const K=S[1],z=S[2];if(!t.has(K)){const{defaultValue:U,validation:ie}=Ae(S[3]);e.push({fieldName:K,groupName:z,type:"rich",defaultValue:U,...ie}),t.add(K)}}});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 K=S[1];if(!t.has(K)){const{defaultValue:z,validation:U}=Ae(S[2]);e.push({fieldName:K,type:"rich",defaultValue:z,...U}),t.add(K)}}});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:K,validation:z}=Ae(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"textarea",defaultValue:K,optional:!0,...z}),t.add(S[1])}});const A=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(A)).forEach(S=>{if(S&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[2]);e.push({fieldName:S[1],type:"textarea",defaultValue:K,optional:!0,...z}),t.add(S[1])}});const k=new RegExp(he.TEXTAREA_FIELD_WITH_GROUP.source,he.TEXTAREA_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(k)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"textarea",defaultValue:K,...z}),t.add(S[1])}});const b=new RegExp(he.TEXTAREA_FIELD.source,he.TEXTAREA_FIELD.flags);Array.from(u.matchAll(b)).forEach(S=>{if(S&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[2]);e.push({fieldName:S[1],type:"textarea",defaultValue:K,...z}),t.add(S[1])}});const B=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(B)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"image",defaultValue:K,optional:!0,...z}),t.add(S[1])}});const D=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(D)).forEach(S=>{if(S&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[2]);e.push({fieldName:S[1],type:"image",defaultValue:K,optional:!0,...z}),t.add(S[1])}});const q=new RegExp(he.IMAGE_FIELD_WITH_GROUP.source,he.IMAGE_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(q)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"image",defaultValue:K,...z}),t.add(S[1])}});const V=new RegExp(he.IMAGE_FIELD.source,he.IMAGE_FIELD.flags);Array.from(u.matchAll(V)).forEach(S=>{if(S&&S[1]&&S[2]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[2]);e.push({fieldName:S[1],type:"image",defaultValue:K,...z}),t.add(S[1])}});const J=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(J)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"text",defaultValue:K,optional:!0,...z}),t.add(S[1])}});const ne=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(ne)).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:K,validation:z}=Ae(S[2]);e.push({fieldName:S[1],type:"text",defaultValue:K,optional:!0,...z}),t.add(S[1])}});const Z=new RegExp(he.TEXT_FIELD_WITH_GROUP.source,he.TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(Z)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const{defaultValue:K,validation:z}=Ae(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"text",defaultValue:K,...z}),t.add(S[1])}});const te=new RegExp(he.TEXT_FIELD.source,he.TEXT_FIELD.flags);Array.from(u.matchAll(te)).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:K,validation:z}=Ae(S[2]);e.push({fieldName:S[1],type:"text",defaultValue:K,...z}),t.add(S[1])}});const me=new RegExp(he.SELECT_FIELD_WITH_GROUP.source,he.SELECT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(me)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!t.has(S[1])){const K=S[1],z=S[2],U=S[3];U.includes("|")?e.push({fieldName:K,groupName:z,type:"select",options:U.split("|")}):U.includes(",")&&e.push({fieldName:K,groupName:z,type:"select-multiple",options:U.split(",")}),t.add(K)}}),(u.match(he.SELECT_FIELD)||[]).forEach(S=>{const K=S.match(/\(\$(\w+)@:([^)]+)\)/);if(K&&!t.has(K[1])){const z=K[1],U=K[2];U.includes("|")?e.push({fieldName:z,type:"select",options:U.split("|")}):U.includes(",")&&e.push({fieldName:z,type:"select-multiple",options:U.split(",")}),t.add(z)}});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 K=S[1],z=S[2],U=S[3];U.includes("|")?e.push({fieldName:K,groupName:z,type:"radio",options:U.split("|")}):U.includes(",")&&e.push({fieldName:K,groupName:z,type:"checkbox",options:U.split(",")}),t.add(K)}}),(u.match(he.RADIO_FIELD)||[]).forEach(S=>{const K=S.match(/\(\$(\w+):([^)]+)\)/);if(K&&!t.has(K[1])){const z=K[1],U=K[2];U.includes("|")?e.push({fieldName:z,type:"radio",options:U.split("|")}):U.includes(",")&&e.push({fieldName:z,type:"checkbox",options:U.split(",")}),t.add(z)}});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 g=m[1],y=m[2];if(!t.has(g)){const x=y?y.split("|").map(v=>v.trim()):void 0,N=u.tagName.toLowerCase();let E=N;x&&!x.includes(N)&&(E=x[0]),e.push({fieldName:g,type:"tag",defaultValue:E,options:x,optional:!1}),t.add(g)}}}Array.from(u.attributes).forEach(m=>{const g=m.value,y=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(g.matchAll(y)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:L,validation:$}=Ae(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"rich",defaultValue:L,optional:!0,...$}),t.add(C[1])}});const N=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(g.matchAll(N)).forEach(C=>{if(C&&C[1]&&C[2]&&!t.has(C[1])){const{defaultValue:L,validation:$}=Ae(C[2]);e.push({fieldName:C[1],type:"rich",defaultValue:L,optional:!0,...$}),t.add(C[1])}});const v=new RegExp(he.RICH_TEXT_FIELD_WITH_GROUP.source,he.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(v)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:L,validation:$}=Ae(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"rich",defaultValue:L,...$}),t.add(C[1])}});const M=new RegExp(he.RICH_TEXT_FIELD.source,he.RICH_TEXT_FIELD.flags);Array.from(g.matchAll(M)).forEach(C=>{if(C&&C[1]&&C[2]&&!t.has(C[1])){const{defaultValue:L,validation:$}=Ae(C[2]);e.push({fieldName:C[1],type:"rich",defaultValue:L,...$}),t.add(C[1])}});const w=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(g.matchAll(w)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:L,validation:$}=Ae(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"image",defaultValue:L,optional:!0,...$}),t.add(C[1])}});const R=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(g.matchAll(R)).forEach(C=>{if(C&&C[1]&&C[2]&&!t.has(C[1])){const{defaultValue:L,validation:$}=Ae(C[2]);e.push({fieldName:C[1],type:"image",defaultValue:L,optional:!0,...$}),t.add(C[1])}});const O=new RegExp(he.IMAGE_FIELD_WITH_GROUP.source,he.IMAGE_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(O)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:L,validation:$}=Ae(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"image",defaultValue:L,...$}),t.add(C[1])}});const P=new RegExp(he.IMAGE_FIELD.source,he.IMAGE_FIELD.flags);Array.from(g.matchAll(P)).forEach(C=>{if(C&&C[1]&&C[2]&&!t.has(C[1])){const{defaultValue:L,validation:$}=Ae(C[2]);e.push({fieldName:C[1],type:"image",defaultValue:L,...$}),t.add(C[1])}});const W=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(g.matchAll(W)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:L,validation:$}=Ae(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"text",defaultValue:L,optional:!0,...$}),t.add(C[1])}});const G=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(g.matchAll(G)).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:L,validation:$}=Ae(C[2]);e.push({fieldName:C[1],type:"text",defaultValue:L,optional:!0,...$}),t.add(C[1])}});const oe=new RegExp(he.TEXT_FIELD_WITH_GROUP.source,he.TEXT_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(oe)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const{defaultValue:L,validation:$}=Ae(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"text",defaultValue:L,...$}),t.add(C[1])}});const X=new RegExp(he.TEXT_FIELD.source,he.TEXT_FIELD.flags);Array.from(g.matchAll(X)).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:L,validation:$}=Ae(C[2]);e.push({fieldName:C[1],type:"text",defaultValue:L,...$}),t.add(C[1])}});const Y=new RegExp(he.SELECT_FIELD_WITH_GROUP.source,he.SELECT_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(Y)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const L=C[1],$=C[2],S=C[3];S.includes("|")?e.push({fieldName:L,groupName:$,type:"select",options:S.split("|")}):S.includes(",")&&e.push({fieldName:L,groupName:$,type:"select-multiple",options:S.split(",")}),t.add(L)}}),(g.match(he.SELECT_FIELD)||[]).forEach(C=>{const L=C.match(/\(\$(\w+)@:([^)]+)\)/);if(L&&!t.has(L[1])){const $=L[1],S=L[2];S.includes("|")?e.push({fieldName:$,type:"select",options:S.split("|")}):S.includes(",")&&e.push({fieldName:$,type:"select-multiple",options:S.split(",")}),t.add($)}});const me=new RegExp(he.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,he.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(me)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!t.has(C[1])){const L=C[1],$=C[2],S=C[3];S.includes("|")?e.push({fieldName:L,groupName:$,type:"radio",options:S.split("|")}):S.includes(",")&&e.push({fieldName:L,groupName:$,type:"checkbox",options:S.split(",")}),t.add(L)}}),(g.match(he.RADIO_FIELD)||[]).forEach(C=>{const L=C.match(/\(\$(\w+):([^)]+)\)/);if(L&&!t.has(L[1])){const $=L[1],S=L[2];S.includes("|")?e.push({fieldName:$,type:"radio",options:S.split("|")}):S.includes(",")&&e.push({fieldName:$,type:"checkbox",options:S.split(",")}),t.add($)}})}),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(a.content.childNodes).forEach(d=>l(d)),e}function Wd(n,e){const t=la(),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 a=i.content.firstElementChild;return Object.entries(e).forEach(([l,c])=>{a.setAttribute(l,c)}),a.outerHTML}function hi(n,e,t,o,r=[]){const i=[...t,...o,...r];if(n){const a=i.find(l=>l.id===n);if(a)return a.url}if(e){const a=i.find(l=>l.id===e);if(a)return console.warn(`Image not found: ${n}, using default: ${e}`),a.url}return console.warn(`Image not found: ${n}, default: ${e}`),""}function Jy(n){return typeof n=="object"&&n!==null}function qd(n,e){if(!n||!e)return"";try{const t=[];let o="";for(let i=0;i<e.length;i++){const a=e[i];a==="["||a==="]"||a==="."?o&&(t.push(o),o=""):o+=a}o&&t.push(o);let r=n;for(let i=0;i<t.length;i++){const a=t[i];if(a.match(/^\d+$/)){const l=parseInt(a,10);if(Array.isArray(r)&&l>=0&&l<r.length)r=r[l];else return""}else if(Jy(r)&&a in r)r=r[a];else return""}return r==null?"":String(r)}catch(t){return console.warn(`[ZeroCode] Failed to resolve backend data path: ${e}`,t),""}}function Xy(n,e){return!n||!e?n:n.replace(/\{(\w+)\}/g,(t,o)=>{const r=e[o];return r==null?t:String(r)})}function mi(n,e,t,o,r,i=!0,a=[],l=[],c=[],d,u){const f=la(),p=new f,h=p.parseFromString(`<template>${n}</template>`,"text/html"),m=h.querySelector("template");if(!m||!m.content)return console.error("Failed to parse template HTML"),n;const g=w=>{if(w.nodeType===Node.TEXT_NODE){let b=w.textContent||"";d&&(b=b.replace(he.BACKEND_DATA,(X,Z)=>qd(d,Z)));let B=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(b),O=!1;if(B&&w.parentNode?O=!0:B=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(b),B&&w.parentNode){const X=B[1],Z=O?B[3]:B[2],{defaultValue:Y}=Ae(Z),te=e[X];if(typeof te=="boolean"){const $=w.parentNode,S=B.index||0,K=b.substring(0,S),z=b.substring(S+B[0].length);K&&$.insertBefore(h.createTextNode(K),w),z&&$.insertBefore(h.createTextNode(z),w),w.parentNode&&w.parentNode.removeChild(w);return}let de=te===void 0?"":typeof te=="string"?te:String(te||Y);i||(de=Ud(de));const me=w.parentNode,Me=B.index||0,Le=b.substring(0,Me),C=b.substring(Me+B[0].length);de?de.trim().startsWith("<p")||(de=`<p>${de}</p>`):de="";const L=h.createElement("div");L.innerHTML=de,Le&&me.insertBefore(h.createTextNode(Le),w),Array.from(L.childNodes).forEach($=>{me.insertBefore($.cloneNode(!0),w)}),C&&me.insertBefore(h.createTextNode(C),w),w.parentNode&&w.parentNode.removeChild(w);return}let P=new RegExp(he.RICH_TEXT_FIELD_WITH_GROUP.source,he.RICH_TEXT_FIELD_WITH_GROUP.flags).exec(b),q=!1;if(P&&w.parentNode?q=!0:P=new RegExp(he.RICH_TEXT_FIELD.source,he.RICH_TEXT_FIELD.flags).exec(b),P&&w.parentNode){const X=P[1],Z=q?P[3]:P[2],Y=e[X];let te=Y===void 0?"":typeof Y=="string"?Y:String(Y||Z);i||(te=Ud(te));const de=w.parentNode,me=P.index||0,Me=b.substring(0,me),Le=b.substring(me+P[0].length);te?te.trim().startsWith("<p")||(te=`<p>${te}</p>`):te="<p></p>";const C=h.createElement("div");C.innerHTML=te,Me&&de.insertBefore(h.createTextNode(Me),w),Array.from(C.childNodes).forEach(L=>{de.insertBefore(L.cloneNode(!0),w)}),Le&&de.insertBefore(h.createTextNode(Le),w),w.parentNode&&w.parentNode.removeChild(w);return}let V=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(b),G=!1;if(V&&w.parentNode?G=!0:V=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(b),V&&w.parentNode){const X=V[1],Z=G?V[3]:V[2],{defaultValue:Y}=Ae(Z),te=e[X],de=te===void 0?"":String(te||Y),me=w.parentNode,Me=V.index||0,Le=b.substring(0,Me),C=b.substring(Me+V[0].length);Le&&me.insertBefore(h.createTextNode(Le),w);const L=de.split(`
341
+ `);if(L.forEach(($,S)=>{$&&me.insertBefore(h.createTextNode($),w),S<L.length-1&&me.insertBefore(h.createElement("br"),w)}),C){const $=h.createTextNode(C);me.insertBefore($,w),g($)}w.parentNode&&w.parentNode.removeChild(w);return}let oe=new RegExp(he.TEXTAREA_FIELD_WITH_GROUP.source,he.TEXTAREA_FIELD_WITH_GROUP.flags).exec(b),ne=!1;if(oe&&w.parentNode?ne=!0:oe=new RegExp(he.TEXTAREA_FIELD.source,he.TEXTAREA_FIELD.flags).exec(b),oe&&w.parentNode){const X=oe[1],Z=ne?oe[3]:oe[2],Y=e[X]??Z??"",te=String(Y),de=w.parentNode,me=oe.index||0,Me=b.substring(0,me),Le=b.substring(me+oe[0].length);Me&&de.insertBefore(h.createTextNode(Me),w);const C=te.split(`
342
+ `);if(C.forEach((L,$)=>{L&&de.insertBefore(h.createTextNode(L),w),$<C.length-1&&de.insertBefore(h.createElement("br"),w)}),Le){const L=h.createTextNode(Le);de.insertBefore(L,w),g(L)}w.parentNode&&w.parentNode.removeChild(w);return}b=b.replace(/\{\$(\w+)\?:([^}]+)\}/g,(X,Z,Y)=>{if(/:textarea(?::[^}]*)?$/.test(X))return X;const te=e[Z];if(te===void 0||typeof te=="boolean")return"";const{defaultValue:de}=Ae(Y);return String(te||de)}),b=b.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(X,Z,Y,te)=>{if(/:textarea(?::[^}]*)?$/.test(X))return X;const de=e[Z];if(de===void 0||typeof de=="boolean")return"";const{defaultValue:me}=Ae(te);return String(de||me)}),b=b.replace(he.TEXT_FIELD_WITH_GROUP,(X,Z,Y,te)=>{const de=e[Z];if(de===void 0)return"";const{defaultValue:me}=Ae(te);return String(de||me)}),b=b.replace(he.TEXT_FIELD,(X,Z,Y)=>{const te=e[Z];if(te===void 0)return"";const{defaultValue:de}=Ae(Y);return String(te||de)}),w.textContent=b}else if(w.nodeType===Node.ELEMENT_NODE){const b=w,R=[];Array.from(b.attributes).forEach(B=>{const O=B.value;let D=B.value;const P=B.name.toLowerCase();if(P==="z-if"||P==="z-for"||P==="z-slot"||P==="z-empty"||P==="z-tag"||P.startsWith("data-zcode-"))return;const q=/^\{\$[\w.]+?\?:[^}]+\}(?::(rich|image|textarea))?$/.test(O.trim());d&&((P==="href"||P==="src"||P==="action")&&(D=Xy(D,d)),D=D.replace(he.BACKEND_DATA,(W,V)=>{const G=qd(d,V);return P==="href"||P==="src"||P==="action"?Nt(G):rt(G)})),D=D.replace(/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(W,V,G)=>{const J=e[V];if(J===void 0||typeof J=="boolean")return"";const{defaultValue:oe}=Ae(G);return rt(String(J||oe))}),D=D.replace(/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(W,V,G,J)=>{const oe=e[V];if(oe===void 0||typeof oe=="boolean")return"";const{defaultValue:ne}=Ae(J);return rt(String(oe||ne))}),D=D.replace(/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(W,V,G)=>{const J=e[V];if(J===void 0)return"";const{defaultValue:oe}=Ae(G),ne=typeof J=="string"?J:String(J||oe),X=hi(ne,oe,a,l,c),Z=typeof X=="string"?X:String(X||oe);return P==="href"||P==="src"?Nt(Z):rt(Z)}),D=D.replace(/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(W,V,G,J)=>{const oe=e[V];if(oe===void 0)return"";const{defaultValue:ne}=Ae(J),X=typeof oe=="string"?oe:String(oe||ne),Z=hi(X,ne,a,l,c),Y=typeof Z=="string"?Z:String(Z||ne);return P==="href"||P==="src"?Nt(Y):rt(Y)}),D=D.replace(he.RICH_TEXT_FIELD_WITH_GROUP,(W,V,G,J)=>{const oe=e[V];return oe===void 0?"":rt(String(oe||J))}),D=D.replace(he.RICH_TEXT_FIELD,(W,V,G)=>{const J=e[V];return J===void 0?"":rt(String(J||G))}),D=D.replace(he.IMAGE_FIELD_WITH_GROUP,(W,V,G,J)=>{const oe=e[V];if(oe===void 0)return"";const ne=hi(oe||J,J,a,l,c);return P==="href"||P==="src"?Nt(ne||J):rt(ne||J)}),D=D.replace(he.IMAGE_FIELD,(W,V,G)=>{const J=e[V];if(J===void 0)return"";const oe=hi(J||G,G,a,l,c);return P==="href"||P==="src"?Nt(oe||G):rt(oe||G)}),D=D.replace(/\{\$(\w+)\?:([^}]+)\}/g,(W,V,G)=>{const J=e[V];if(J===void 0||typeof J=="boolean")return"";const{defaultValue:oe}=Ae(G),ne=String(J||oe);return P==="href"||P==="src"||P==="action"?Nt(ne):rt(ne)}),D=D.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(W,V,G,J)=>{const oe=e[V];if(oe===void 0||typeof oe=="boolean")return"";const{defaultValue:ne}=Ae(J),X=String(oe||ne);return P==="href"||P==="src"||P==="action"?Nt(X):rt(X)}),D=D.replace(he.TEXT_FIELD_WITH_GROUP,(W,V,G,J)=>{const oe=e[V];if(oe===void 0)return"";const{defaultValue:ne}=Ae(J),X=String(oe||ne);return P==="href"||P==="src"||P==="action"?Nt(X):rt(X)}),D=D.replace(he.TEXT_FIELD,(W,V,G)=>{const J=e[V];if(J===void 0)return"";const{defaultValue:oe}=Ae(G),ne=String(J||oe);return P==="href"||P==="src"||P==="action"?Nt(ne):rt(ne)}),q&&D.trim()===""?R.push(B.name):B.value=D}),R.forEach(B=>{b.removeAttribute(B)})}Array.from(w.childNodes).forEach(b=>g(b))};g(m.content);const y=w=>{if(w.nodeType===Node.TEXT_NODE){let b=w.textContent||"";b=b.replace(he.SELECT_FIELD_WITH_GROUP,(R,B,O,D)=>{if(D.includes("|"))return e[B]||D.split("|")[0];if(D.includes(",")){const P=e[B],q=Array.isArray(P)?P:[],W=D.split(",");return q.filter(V=>typeof V=="string"&&W.includes(V)).join(" ")}return e[B]||D}),b=b.replace(he.SELECT_FIELD,(R,B,O)=>{if(O.includes("|")){const P=e[B];return typeof P=="string"?P:O.split("|")[0]}else if(O.includes(",")){const P=e[B],q=Array.isArray(P)?P:[],W=O.split(",");return q.filter(V=>typeof V=="string"&&W.includes(V)).join(" ")}const D=e[B];return typeof D=="string"?D:O}),b=b.replace(he.RADIO_CHECKBOX_FIELD_WITH_GROUP,(R,B,O,D)=>{if(D.includes("|")){const q=e[B];return typeof q=="string"?q:D.split("|")[0]}else if(D.includes(",")){const q=e[B],W=Array.isArray(q)?q:[],V=D.split(",");return W.filter(G=>typeof G=="string"&&V.includes(G)).join(" ")}const P=e[B];return typeof P=="string"?P:D}),b=b.replace(he.RADIO_FIELD,(R,B,O)=>{if(O.includes("|")){const P=e[B];return typeof P=="string"?P:O.split("|")[0]}else if(O.includes(",")){const P=e[B],q=Array.isArray(P)?P:[],W=O.split(",");return q.filter(V=>typeof V=="string"&&W.includes(V)).join(" ")}const D=e[B];return typeof D=="string"?D:O}),w.textContent=b}else w.nodeType===Node.ELEMENT_NODE&&Array.from(w.attributes).forEach(R=>{let B=R.value;const O=R.name.toLowerCase();B=B.replace(he.SELECT_FIELD_WITH_GROUP,(D,P,q,W)=>{let V;if(W.includes("|"))V=e[P]||W.split("|")[0];else if(W.includes(",")){const G=e[P],J=Array.isArray(G)?G:[],oe=W.split(",");V=J.filter(ne=>typeof ne=="string"&&oe.includes(ne)).join(" ")}else{const G=e[P];V=typeof G=="string"?G:W}return O==="href"||O==="src"||O==="action"?Nt(String(V)):rt(String(V))}),B=B.replace(he.SELECT_FIELD,(D,P,q)=>{let W;if(q.includes("|"))W=e[P]||q.split("|")[0];else if(q.includes(",")){const V=e[P],G=Array.isArray(V)?V:[],J=q.split(",");W=G.filter(oe=>typeof oe=="string"&&J.includes(oe)).join(" ")}else{const V=e[P];W=typeof V=="string"?V:q}return O==="href"||O==="src"||O==="action"?Nt(String(W)):rt(String(W))}),B=B.replace(he.RADIO_CHECKBOX_FIELD_WITH_GROUP,(D,P,q,W)=>{let V;if(W.includes("|"))V=e[P]||W.split("|")[0];else if(W.includes(",")){const G=e[P],J=Array.isArray(G)?G:[],oe=W.split(",");V=J.filter(ne=>typeof ne=="string"&&oe.includes(ne)).join(" ")}else{const G=e[P];V=typeof G=="string"?G:W}return O==="href"||O==="src"||O==="action"?Nt(String(V)):rt(String(V))}),B=B.replace(he.RADIO_FIELD,(D,P,q)=>{let W;if(q.includes("|"))W=e[P]||q.split("|")[0];else if(q.includes(",")){const V=e[P],G=Array.isArray(V)?V:[],J=q.split(",");W=G.filter(oe=>typeof oe=="string"&&J.includes(oe)).join(" ")}else{const V=e[P];W=typeof V=="string"?V:q}return O==="href"||O==="src"||O==="action"?Nt(String(W)):rt(String(W))}),R.value=B});w.childNodes.forEach(b=>y(b))};y(m.content),m.content.querySelectorAll("[z-if]").forEach(w=>{const b=w.getAttribute("z-if");b?(e[b]!==void 0?e[b]:!0)?w.removeAttribute("z-if"):w.remove():w.removeAttribute("z-if")}),m.content.querySelectorAll("[z-tag]").forEach(w=>{const b=w.getAttribute("z-tag");if(b){const R=b.match(/^\$(\w+)(?::(.+))?$/);if(R){const B=R[1],O=e[B],D=typeof O=="string"?O:w.tagName.toLowerCase(),P=["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"],q=typeof D=="string"?D.toLowerCase():D;if(typeof q=="string"&&P.includes(q)){const W=h.createElement(q);Array.from(w.attributes).forEach(V=>{V.name!=="z-tag"&&W.setAttribute(V.name,V.value)}),Array.from(w.childNodes).forEach(V=>{W.appendChild(V.cloneNode(!0))}),w.parentNode?.replaceChild(W,w)}}}}),m.content.querySelectorAll("[z-empty]").forEach(w=>{const b=w.getAttribute("z-empty");if(b){const R=b.match(/^\$(\w+)$/);if(R){const B=R[1],O=e[B];(P=>{if(P==null||P==="")return!0;if(typeof P=="string"){const q=P.trim();if(q===""||q==="<p></p>"||q==="<p> </p>"||/^<p>\s*<\/p>$/i.test(q)||/^<p>\s*<br\s*\/?>\s*<\/p>$/i.test(q))return!0}return!1})(O)?w.remove():w.removeAttribute("z-empty")}else w.removeAttribute("z-empty")}else w.removeAttribute("z-empty")});const v=()=>{Array.from(m.content.querySelectorAll("[z-for]")).forEach(b=>{const R=b.getAttribute("z-for");if(!R){b.removeAttribute("z-for");return}const B=R.match(/^(\w+)\s+in\s+(.+)$/);if(!B){console.warn(`[ZeroCode] Invalid z-for syntax: ${R}`),b.removeAttribute("z-for");return}const[,O,D]=B;if(!D.startsWith("{@")||!D.endsWith("}")){console.warn(`[ZeroCode] z-for only supports backend data: ${D}`),b.removeAttribute("z-for");return}const P=D.slice(2,-1);if(!d){b.remove();return}let q;try{const V=P.split(".");let G=d;for(const J of V)if(G&&typeof G=="object"&&J in G)G=G[J];else{G=null;break}q=G}catch(V){console.warn(`[ZeroCode] Failed to resolve data source: ${P}`,V),b.remove();return}if(!Array.isArray(q)||q.length===0){b.remove();return}const W=document.createDocumentFragment();q.forEach(V=>{const G=b.cloneNode(!0);G.removeAttribute("z-for"),A(G,O,V,e,d),W.appendChild(G)}),b.parentNode&&b.parentNode.replaceChild(W,b)})},A=(w,b,R,B,O,D)=>{const P=W=>{if(W.nodeType===Node.TEXT_NODE){let V=W.textContent||"";const G=new RegExp(`\\{${b}\\.([\\w\\.\\[\\]]+)\\}`,"g");V=V.replace(G,(J,oe)=>{try{const ne=oe.split(/[.[\]]/).filter(Z=>Z);let X=R;for(const Z of ne)if(Z.match(/^\d+$/)){const Y=parseInt(Z,10);if(Array.isArray(X)&&Y>=0&&Y<X.length)X=X[Y];else return""}else if(X&&typeof X=="object"&&Z in X)X=X[Z];else return"";return X==null?"":String(X)}catch{return""}}),V=V.replace(new RegExp(`\\{${b}\\}`,"g"),()=>typeof R=="object"&&R!==null?JSON.stringify(R):String(R)),W.textContent=V}else if(W.nodeType===Node.ELEMENT_NODE){const V=W;Array.from(V.attributes).forEach(G=>{let J=G.value;const oe=new RegExp(`\\{${b}\\.([\\w\\.\\[\\]]+)\\}`,"g");J=J.replace(oe,(ne,X)=>{try{const Z=X.split(/[.[\]]/).filter(de=>de);let Y=R;for(const de of Z)if(de.match(/^\d+$/)){const me=parseInt(de,10);if(Array.isArray(Y)&&me>=0&&me<Y.length)Y=Y[me];else return""}else if(Y&&typeof Y=="object"&&de in Y)Y=Y[de];else return"";const te=Y==null?"":String(Y);return G.name==="href"||G.name==="src"||G.name==="action"?Nt(te):rt(te)}catch{return""}}),J=J.replace(new RegExp(`\\{${b}\\}`,"g"),()=>{const ne=typeof R=="object"&&R!==null?JSON.stringify(R):String(R);return G.name==="href"||G.name==="src"||G.name==="action"?Nt(ne):rt(ne)}),G.value=J}),Array.from(V.childNodes).forEach(G=>P(G))}};Array.from(w.childNodes).forEach(W=>P(W));const q=w.innerHTML;if(q){const W=mi(q,B,t,o,r,i,a,l,c,O);w.innerHTML=W}};v();const M=w=>{w.forEach(b=>{const R=b.getAttribute("z-slot")||"default",B=e.slots?.[R];let O=[];if(Array.isArray(B)?O=B:B&&typeof B=="object"&&B.children&&(O=B.children||[]),O.length===0){if(b.removeAttribute("z-slot"),i){b.setAttribute("data-zcode-empty-slot",R),b.setAttribute("data-zcode-slot-path",t?`${t}.slots.${R}`:`slots.${R}`);const W=u?.translations?.addSlotButton??"+ Add Part";b.innerHTML=`<div class="zcode-empty-slot" data-zcode-empty-slot-content>
343
343
  <button class="zcode-add-slot-btn" data-zcode-add-slot>${W}</button>
344
344
  </div>`}else b.innerHTML="";return}const D=O.map((W,V)=>{const G=t?`${t}.slots.${R}.${V}`:`slots.${R}.${V}`;return r(W,G)}).join("");b.removeAttribute("z-slot");const q=p.parseFromString(`<template>${D}</template>`,"text/html").querySelector("template");if(q&&q.content)for(b.innerHTML="";q.content.firstChild;)b.appendChild(q.content.firstChild);else b.innerHTML=D})},k=Array.from(m.content.querySelectorAll("[z-slot]"));return M(k),m.innerHTML}function dn(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 jn(){return`zcode-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function Yy(n){return n.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^\s*([a-zA-Z])/,e=>e.toUpperCase())}function Qy(n){return Yy(n)}function Gd(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 ba(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 gi(n,e=!0){const{t}=Vt();function o(a){return ba(a,n.parts)}function r(a,l="",c=new Set){if(c.has(l))return console.warn(`循環参照を検出しました: ${l}`),`<div class="zcode-error-message">循環参照が検出されました: ${l}</div>`;c.add(l);const d=a.part_id,u=o(d);if(!u)return`<div class="zcode-error-message">パーツが見つかりません: ${d}</div>`;const f=e?{translations:{addSlotButton:t("emptyState.addPart")}}:void 0,p=mi(u.body,a,l,o,(h,m)=>r(h,m,c),e,n.images.common,n.images.individual,n.images.special,n.backendData,f);return e?Wd(p,{"data-zcode-id":a.id,"data-zcode-path":l,"data-zcode-part":d}):p}return{fullPageHtml:s.computed(()=>n.page.map((a,l)=>r(a,`page.${l}`)).join("")),renderComponentToHtml:r,findPart:o}}const xa=s.defineComponent({__name:"ZeroCodePreview",props:{cmsData:{type:Object},allowDynamicContentInteraction:{type:Boolean}},setup(n,{expose:e}){const t=n,{fullPageHtml:o}=gi(t.cmsData,!1),r=s.ref(null),i=s.computed(()=>r.value?.previewArea||null);return e({previewArea:i}),(a,l)=>(s.openBlock(),s.createBlock(Sc,{ref_key:"previewAreaRef",ref:r,"cms-data":n.cmsData,"full-page-html":s.unref(o),"allow-dynamic-content-interaction":n.allowDynamicContentInteraction},null,8,["cms-data","full-page-html","allow-dynamic-content-interaction"]))}}),Zy={class:"zcode-toolbar"},eb=["title"],Kd=s.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"),s.nextTick(()=>{o("switch-mode",i)})):o("switch-mode",i)};return(i,a)=>(s.openBlock(),s.createElementBlock("div",Zy,[s.createElementVNode("button",{class:s.normalizeClass([{active:n.viewMode==="preview"},"zcode-view-mode-btn zcode-view-mode-preview"]),onClick:a[0]||(a[0]=l=>i.$emit("switch-view-mode",n.viewMode==="preview"?"manage":"preview"))},[s.createVNode(s.unref(xm),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("toolbar.viewMode")),1)],2),!n.availableModes||n.availableModes.includes("edit")?(s.openBlock(),s.createElementBlock("button",{key:0,class:s.normalizeClass([{active:n.currentMode==="edit"&&n.viewMode==="manage"},"zcode-mode-btn zcode-mode-edit"]),onClick:a[1]||(a[1]=l=>r("edit"))},[s.createVNode(s.unref(bc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("toolbar.editMode")),1)],2)):s.createCommentVNode("",!0),!n.availableModes||n.availableModes.includes("add")?(s.openBlock(),s.createElementBlock("button",{key:1,class:s.normalizeClass([{active:n.currentMode==="add"&&n.viewMode==="manage"},"zcode-mode-btn zcode-mode-add"]),onClick:a[2]||(a[2]=l=>r("add"))},[s.createVNode(s.unref(ao),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("toolbar.addMode")),1)],2)):s.createCommentVNode("",!0),!n.availableModes||n.availableModes.includes("reorder")?(s.openBlock(),s.createElementBlock("button",{key:2,class:s.normalizeClass([{active:n.currentMode==="reorder"&&n.viewMode==="manage"},"zcode-mode-btn zcode-mode-reorder"]),onClick:a[3]||(a[3]=l=>r("reorder"))},[s.createVNode(s.unref(Zo),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("toolbar.reorderMode")),1)],2)):s.createCommentVNode("",!0),!n.availableModes||n.availableModes.includes("delete")?(s.openBlock(),s.createElementBlock("button",{key:3,class:s.normalizeClass([{active:n.currentMode==="delete"&&n.viewMode==="manage"},"zcode-mode-btn zcode-mode-delete"]),onClick:a[4]||(a[4]=l=>r("delete"))},[s.createVNode(s.unref(Pn),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("toolbar.deleteMode")),1)],2)):s.createCommentVNode("",!0),s.createElementVNode("button",{class:"zcode-settings-btn",title:i.$t("toolbar.settings"),onClick:a[5]||(a[5]=l=>i.$emit("open-settings"))},[s.createVNode(s.unref(kc),{size:16})],8,eb)]))}}),Jd="zcode-user-settings";function _o(){try{const n=localStorage.getItem(Jd);return n?JSON.parse(n):{}}catch(n){return console.warn("[ZeroCode] Failed to load user settings:",n),{}}}function ka(n){try{const e=_o(),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(Jd,JSON.stringify(t))}catch(e){console.warn("[ZeroCode] Failed to save user settings:",e)}}function tb(n=null){const e=_o();return e.locale!==void 0?e.locale:n}function Xd(){return _o().cms||{}}function yi(n){const e=_o();ka({cms:{...e.cms,...n}})}function nb(n,e){return Xd()[n]??e}function Yd(){return _o().dev||{}}function Ea(n){const e=_o();ka({dev:{...e.dev,...n}})}function ob(n,e){return Yd()[n]??e}const Qd="zcode-dont-show-css-warning-parts";function rb(){try{return sessionStorage.getItem(Qd)==="true"}catch{return!1}}function ib(n){try{sessionStorage.setItem(Qd,String(n))}catch(e){console.warn("[ZeroCode] Failed to save CSS warning setting:",e)}}const sb={class:"zcode-settings-panel-header"},ab={class:"zcode-settings-panel-header-title",role:"heading","aria-level":"3"},lb={class:"zcode-settings-panel-header-actions"},cb=["value","aria-label"],db={value:"ja"},ub={value:"en"},fb={class:"zcode-settings-panel-content"},pb={key:0},hb={key:0,class:"zcode-setting-item"},mb={class:"zcode-setting-label"},gb=["checked"],yb=["title"],bb={key:0,class:"zcode-setting-description"},xb={key:1,class:"zcode-setting-item"},kb={class:"zcode-setting-label"},Eb=["checked"],wb=["title"],Sb={key:0,class:"zcode-setting-description"},Cb={key:2,class:"zcode-setting-item"},Nb={class:"zcode-setting-label"},vb=["checked"],Tb=["title"],zb={key:0,class:"zcode-setting-description"},Mb={key:3,class:"zcode-setting-item"},Ab={class:"zcode-setting-label"},Ib=["checked"],_b=["title"],Ob={key:0,class:"zcode-setting-description"},Db={key:1,class:"zcode-setting-item"},Pb={class:"zcode-setting-info"},Zd=s.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}=Vt(),o=s.computed(()=>t.value||"ja");function r(u){const p=u.target.value;t.value=p,ka({locale:p})}const i=s.ref(!1),a=s.ref(!1),l=s.ref(!1),c=s.ref(!1),d=s.computed(()=>e.devRightPadding!==void 0?e.devRightPadding:!1);return(u,f)=>n.isOpen?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-settings-panel-overlay",onClick:f[10]||(f[10]=s.withModifiers(p=>u.$emit("close"),["self"]))},[s.createElementVNode("div",{class:"zcode-settings-panel",onClick:f[9]||(f[9]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",sb,[s.createElementVNode("div",ab,s.toDisplayString(u.$t("settings.title")),1),s.createElementVNode("div",lb,[s.createElementVNode("select",{value:o.value,class:"zcode-language-select","aria-label":u.$t("settings.language.label"),onChange:r},[s.createElementVNode("option",db,s.toDisplayString(u.$t("settings.language.ja")),1),s.createElementVNode("option",ub,s.toDisplayString(u.$t("settings.language.en")),1)],40,cb),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":"$t('common.close')",onClick:f[0]||(f[0]=p=>u.$emit("close"))},[s.createVNode(s.unref(Ye),{size:18})])])]),s.createElementVNode("div",fb,[n.viewMode==="manage"?(s.openBlock(),s.createElementBlock("div",pb,[e.mode==="toolbar"||e.mode===void 0?(s.openBlock(),s.createElementBlock("div",hb,[s.createElementVNode("label",mb,[s.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,gb),s.createElementVNode("span",null,s.toDisplayString(u.$t("settings.enableDynamicContent")),1),s.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[2]||(f[2]=s.withModifiers(p=>i.value=!i.value,["stop"]))},[s.createVNode(s.unref(Dn),{size:16})],8,yb)]),i.value?(s.openBlock(),s.createElementBlock("div",bb,s.toDisplayString(u.$t("settings.enableDynamicContentDescription")),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),e.mode==="toolbar"||e.mode===void 0?(s.openBlock(),s.createElementBlock("div",xb,[s.createElementVNode("label",kb,[s.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,Eb),s.createElementVNode("span",null,s.toDisplayString(u.$t("settings.devRightPadding")),1),s.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[4]||(f[4]=s.withModifiers(p=>a.value=!a.value,["stop"]))},[s.createVNode(s.unref(Dn),{size:16})],8,wb)]),a.value?(s.openBlock(),s.createElementBlock("div",Sb,s.toDisplayString(u.$t("settings.devRightPaddingDescription")),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),e.mode==="toolbar"||e.mode===void 0?(s.openBlock(),s.createElementBlock("div",Cb,[s.createElementVNode("label",Nb,[s.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,vb),s.createElementVNode("span",null,s.toDisplayString(u.$t("settings.enableContextMenu")),1),s.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[6]||(f[6]=s.withModifiers(p=>l.value=!l.value,["stop"]))},[s.createVNode(s.unref(Dn),{size:16})],8,Tb)]),l.value?(s.openBlock(),s.createElementBlock("div",zb,s.toDisplayString(u.$t("settings.enableContextMenuDescription")),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),e.mode==="dev-tabs"?(s.openBlock(),s.createElementBlock("div",Mb,[s.createElementVNode("label",Ab,[s.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,Ib),s.createElementVNode("span",null,s.toDisplayString(u.$t("settings.showSaveConfirm")),1),s.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[8]||(f[8]=s.withModifiers(p=>c.value=!c.value,["stop"]))},[s.createVNode(s.unref(Dn),{size:16})],8,_b)]),c.value?(s.openBlock(),s.createElementBlock("div",Ob,s.toDisplayString(u.$t("settings.showSaveConfirmDescription")),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)])):(s.openBlock(),s.createElementBlock("div",Db,[s.createElementVNode("div",Pb,s.toDisplayString(u.$t("settings.previewModeInfo")),1)]))])])])):s.createCommentVNode("",!0)}});function ut(n){this.content=n}ut.prototype={constructor:ut,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 ut(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 ut(t)},addToStart:function(n,e){return new ut([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ut(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 ut(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=ut.from(n),n.size?new ut(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=ut.from(n),n.size?new ut(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=ut.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}},ut.from=function(n){if(n instanceof ut)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ut(e)};function eu(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 a=0;r.text[a]==i.text[a];a++)t++;return t}if(r.content.size||i.content.size){let a=eu(r.content,i.content,t+1);if(a!=null)return a}t+=r.nodeSize}}function tu(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 a=n.child(--r),l=e.child(--i),c=a.nodeSize;if(a==l){t-=c,o-=c;continue}if(!a.sameMarkup(l))return{a:t,b:o};if(a.isText&&a.text!=l.text){let d=0,u=Math.min(a.text.length,l.text.length);for(;d<u&&a.text[a.text.length-d-1]==l.text[l.text.length-d-1];)d++,t--,o--;return{a:t,b:o}}if(a.content.size||l.content.size){let d=tu(a.content,l.content,t-1,o-1);if(d)return d}t-=c,o-=c}}class re{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 a=0,l=0;l<t;a++){let c=this.content[a],d=l+c.nodeSize;if(d>e&&o(c,r+l,i||null,a)!==!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="",a=!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&&(a?a=!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 re(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,a=0;a<t;i++){let l=this.content[i],c=a+l.nodeSize;c>e&&((a<e||c>t)&&(l.isText?l=l.cut(Math.max(0,e-a),Math.min(l.text.length,t-a)):l=l.cut(Math.max(0,e-a-1),Math.min(l.content.size,t-a-1))),o.push(l),r+=l.nodeSize),a=c}return new re(o,r)}cutByIndex(e,t){return e==t?re.empty:e==0&&t==this.content.length?this:new re(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 re(r,i)}addToStart(e){return new re([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new re(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 eu(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return tu(this,e,t,o)}findIndex(e){if(e==0)return bi(0,e);if(e==this.size)return bi(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?bi(t+1,i):bi(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 re.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new re(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return re.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 re(t||e,o)}static from(e){if(!e)return re.empty;if(e instanceof re)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new re([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}re.empty=new re([],0);const wa={index:0,offset:0};function bi(n,e){return wa.index=n,wa.offset=e,wa}function xi(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(!xi(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!xi(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}let Fe=class fc{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&&xi(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 fc.none;if(e instanceof fc)return[e];let t=e.slice();return t.sort((o,r)=>o.type.rank-r.type.rank),t}};Fe.none=[];class ki extends Error{}class pe{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=ou(this.content,e+this.openStart,t);return o&&new pe(o,this.openStart,this.openEnd)}removeBetween(e,t){return new pe(nu(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 pe.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 pe(re.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 pe(e,o,r)}}pe.empty=new pe(re.empty,0,0);function nu(n,e,t){let{index:o,offset:r}=n.findIndex(e),i=n.maybeChild(o),{index:a,offset:l}=n.findIndex(t);if(r==e||i.isText){if(l!=t&&!n.child(a).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(o!=a)throw new RangeError("Removing non-flat range");return n.replaceChild(o,i.copy(nu(i.content,e-r-1,t-r-1)))}function ou(n,e,t,o){let{index:r,offset:i}=n.findIndex(e),a=n.maybeChild(r);if(i==e||a.isText)return o&&!o.canReplace(r,r,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=ou(a.content,e-i-1,t,a);return l&&n.replaceChild(r,a.copy(l))}function Rb(n,e,t){if(t.openStart>n.depth)throw new ki("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ki("Inconsistent open depths");return ru(n,e,t,0)}function ru(n,e,t,o){let r=n.index(o),i=n.node(o);if(r==e.index(o)&&o<n.depth-t.openStart){let a=ru(n,e,t,o+1);return i.copy(i.content.replaceChild(r,a))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==o&&e.depth==o){let a=n.parent,l=a.content;return fo(a,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:a,end:l}=Lb(t,n);return fo(i,su(n,a,l,e,o))}else return fo(i,Ei(n,e,o))}function iu(n,e){if(!e.type.compatibleContent(n.type))throw new ki("Cannot join "+e.type.name+" onto "+n.type.name)}function Sa(n,e,t){let o=n.node(t);return iu(o,e.node(t)),o}function uo(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 dr(n,e,t,o){let r=(e||n).node(t),i=0,a=e?e.index(t):r.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(uo(n.nodeAfter,o),i++));for(let l=i;l<a;l++)uo(r.child(l),o);e&&e.depth==t&&e.textOffset&&uo(e.nodeBefore,o)}function fo(n,e){return n.type.checkContent(e),n.copy(e)}function su(n,e,t,o,r){let i=n.depth>r&&Sa(n,e,r+1),a=o.depth>r&&Sa(t,o,r+1),l=[];return dr(null,n,r,l),i&&a&&e.index(r)==t.index(r)?(iu(i,a),uo(fo(i,su(n,e,t,o,r+1)),l)):(i&&uo(fo(i,Ei(n,e,r+1)),l),dr(e,t,r,l),a&&uo(fo(a,Ei(t,o,r+1)),l)),dr(o,null,r,l),new re(l)}function Ei(n,e,t){let o=[];if(dr(null,n,t,o),n.depth>t){let r=Sa(n,e,t+1);uo(fo(r,Ei(n,e,t+1)),o)}return dr(e,null,t,o),new re(o)}function Lb(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(re.from(r));return{start:r.resolveNoCache(n.openStart+t),end:r.resolveNoCache(r.content.size-n.openEnd-t)}}class ur{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 a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].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 wi(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 a=e;;){let{index:l,offset:c}=a.content.findIndex(i),d=i-c;if(o.push(a,l,r+c),!d||(a=a.child(l),a.isText))break;i=d-1,r+=c+1}return new ur(t,o,i)}static resolveCached(e,t){let o=au.get(e);if(o)for(let i=0;i<o.elts.length;i++){let a=o.elts[i];if(a.pos==t)return a}else au.set(e,o=new $b);let r=o.elts[o.i]=ur.resolve(e,t);return o.i=(o.i+1)%Vb,r}}class $b{constructor(){this.elts=[],this.i=0}}const Vb=12,au=new WeakMap;class wi{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 Bb=Object.create(null);let Hn=class pc{constructor(e,t,o,r=Fe.none){this.type=e,this.attrs=t,this.marks=r,this.content=o||re.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&&xi(this.attrs,t||e.defaultAttrs||Bb)&&Fe.sameSet(this.marks,o||Fe.none)}copy(e=null){return e==this.content?this:new pc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new pc(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 pe.empty;let r=this.resolve(e),i=this.resolve(t),a=o?0:r.sharedDepth(t),l=r.start(a),d=r.node(a).content.cut(r.pos-l,i.pos-l);return new pe(d,r.depth-a,i.depth-a)}replace(e,t,o){return Rb(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 ur.resolveCached(this,e)}resolveNoCache(e){return ur.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()+")"),lu(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=re.empty,r=0,i=o.childCount){let a=this.contentMatchAt(e).matchFragment(o,r,i),l=a&&a.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),a=i&&i.matchFragment(this.content,t);return a?a.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=re.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};Hn.prototype.text=void 0;class Si extends Hn{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):lu(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 Si(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Si(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 lu(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class po{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let o=new Fb(e,t);if(o.next==null)return po.empty;let r=cu(o);o.next&&o.err("Unexpected trailing text");let i=Kb(Gb(r));return Jb(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(a,l){let c=a.matchFragment(e,o);if(c&&(!t||c.validEnd))return re.from(l.map(d=>d.createAndFill()));for(let d=0;d<a.next.length;d++){let{type:u,next:f}=a.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 a=[];for(let l=r;l.type;l=l.via)a.push(l.type);return a.reverse()}for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];!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 a=0;a<o.next.length;a++)i+=(a?", ":"")+o.next[a].type.name+"->"+e.indexOf(o.next[a].next);return i}).join(`
345
345
  `)}}po.empty=new po(!0);class Fb{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 cu(n){let e=[];do e.push(jb(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function jb(n){let e=[];do e.push(Hb(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Hb(n){let e=qb(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=Ub(n,e);else break;return e}function du(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Ub(n,e){let t=du(n),o=t;return n.eat(",")&&(n.next!="}"?o=du(n):o=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:o,expr:e}}function Wb(n,e){let t=n.nodeTypes,o=t[e];if(o)return[o];let r=[];for(let i in t){let a=t[i];a.isInGroup(e)&&r.push(a)}return r.length==0&&n.err("No node type or group '"+e+"' found"),r}function qb(n){if(n.eat("(")){let e=cu(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=Wb(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 Gb(n){let e=[[]];return r(i(n,0),t()),e;function t(){return e.push([])-1}function o(a,l,c){let d={term:c,to:l};return e[a].push(d),d}function r(a,l){a.forEach(c=>c.to=l)}function i(a,l){if(a.type=="choice")return a.exprs.reduce((c,d)=>c.concat(i(d,l)),[]);if(a.type=="seq")for(let c=0;;c++){let d=i(a.exprs[c],l);if(c==a.exprs.length-1)return d;r(d,l=t())}else if(a.type=="star"){let c=t();return o(l,c),r(i(a.expr,c),c),[o(c)]}else if(a.type=="plus"){let c=t();return r(i(a.expr,l),c),r(i(a.expr,c),c),[o(c)]}else{if(a.type=="opt")return[o(l)].concat(i(a.expr,l));if(a.type=="range"){let c=l;for(let d=0;d<a.min;d++){let u=t();r(i(a.expr,c),u),c=u}if(a.max==-1)r(i(a.expr,c),c);else for(let d=a.min;d<a.max;d++){let u=t();o(c,u),r(i(a.expr,c),u),c=u}return[o(c)]}else{if(a.type=="name")return[o(l,void 0,a.value)];throw new Error("Unknown expr type")}}}}function uu(n,e){return e-n}function fu(n,e){let t=[];return o(e),t.sort(uu);function o(r){let i=n[r];if(i.length==1&&!i[0].term)return o(i[0].to);t.push(r);for(let a=0;a<i.length;a++){let{term:l,to:c}=i[a];!l&&t.indexOf(c)==-1&&o(c)}}}function Kb(n){let e=Object.create(null);return t(fu(n,0));function t(o){let r=[];o.forEach(a=>{n[a].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]);fu(n,c).forEach(u=>{d||r.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let i=e[o.join(",")]=new po(o.indexOf(n.length-1)>-1);for(let a=0;a<r.length;a++){let l=r[a][1].sort(uu);i.next.push({type:r[a][0],next:e[l.join(",")]||t(l)})}return i}}function Jb(n,e){for(let t=0,o=[n];t<o.length;t++){let r=o[t],i=!r.validEnd,a=[];for(let l=0;l<r.next.length;l++){let{type:c,next:d}=r.next[l];a.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),o.indexOf(d)==-1&&o.push(d)}i&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function pu(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 hu(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 mu(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 gu(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new Yb(n,o,e[o]);return t}let yu=class am{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=gu(e,o.attrs),this.defaultAttrs=pu(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==po.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:hu(this.attrs,e)}create(e=null,t,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Hn(this,this.computeAttrs(e),re.from(t),Fe.setFrom(o))}createChecked(e=null,t,o){return t=re.from(t),this.checkContent(t),new Hn(this,this.computeAttrs(e),t,Fe.setFrom(o))}createAndFill(e=null,t,o){if(e=this.computeAttrs(e),t=re.from(t),t.size){let a=this.contentMatch.fillBefore(t);if(!a)return null;t=a.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(re.empty,!0);return i?new Hn(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){mu(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,a)=>o[i]=new am(i,t,a));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 Xb(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 Yb{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?Xb(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class Ci{constructor(e,t,o,r){this.name=e,this.rank=t,this.schema=o,this.spec=r,this.attrs=gu(e,r.attrs),this.excluded=null;let i=pu(this.attrs);this.instance=i?new Fe(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Fe(this,hu(this.attrs,e))}static compile(e,t){let o=Object.create(null),r=0;return e.forEach((i,a)=>o[i]=new Ci(i,r++,t,a)),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){mu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class bu{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=ut.from(e.nodes),t.marks=ut.from(e.marks||{}),this.nodes=yu.compile(this.spec.nodes,this),this.marks=Ci.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],a=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=o[a]||(o[a]=po.parse(a,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?xu(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],a=i.spec.excludes;i.excluded=a==null?[i]:a==""?[]:xu(this,a.split(" "))}this.nodeFromJSON=r=>Hn.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 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(t,o,r)}text(e,t){let o=this.nodes.text;return new Si(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 xu(n,e){let t=[];for(let o=0;o<e.length;o++){let r=e[o],i=n.marks[r],a=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(a=c)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return t}function Qb(n){return n.tag!=null}function Zb(n){return n.style!=null}let fr=class hc{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(r=>{if(Qb(r))this.tags.push(r);else if(Zb(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 Su(this,t,!1);return o.addAll(e,Fe.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new Su(this,t,!0);return o.addAll(e,Fe.none,t.from,t.to),pe.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(n1(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let a=i.getAttrs(e);if(a===!1)continue;i.attrs=a||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 a=this.styles[i],l=a.style;if(!(l.indexOf(e)!=0||a.context&&!o.matchesContext(a.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(a.getAttrs){let c=a.getAttrs(t);if(c===!1)continue;a.attrs=c||void 0}return a}}}static schemaRules(e){let t=[];function o(r){let i=r.priority==null?50:r.priority,a=0;for(;a<t.length;a++){let l=t[a];if((l.priority==null?50:l.priority)<i)break}t.splice(a,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(a=>{o(a=Cu(a)),a.mark||a.ignore||a.clearMark||(a.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(a=>{o(a=Cu(a)),a.node||a.ignore||a.mark||(a.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new hc(e,hc.schemaRules(e)))}};const ku={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},e1={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Eu={ol:!0,ul:!0},pr=1,Ca=2,hr=4;function wu(n,e,t){return e!=null?(e?pr:0)|(e==="full"?Ca:0):n&&n.whitespace=="pre"?pr|Ca:t&~hr}class Ni{constructor(e,t,o,r,i,a){this.type=e,this.attrs=t,this.marks=o,this.solid=r,this.options=a,this.content=[],this.activeMarks=Fe.none,this.match=i||(a&hr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(re.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&pr)){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=re.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(re.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&&!ku.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Su{constructor(e,t,o){this.parser=e,this.options=t,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=wu(null,t.preserveWhitespace,0)|(o?hr:0);r?i=new Ni(r.type,r.attrs,Fe.none,!0,t.topMatch||r.type.contentMatch,a):o?i=new Ni(null,null,Fe.none,!0,null,a):i=new Ni(e.schema.topNodeType,null,Fe.none,!0,null,a),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&Ca?"full":this.localPreserveWS||(r.options&pr)>0,{schema:a}=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
346
  `);else if(a.linebreakReplacement&&/[\r\n]/.test(o)&&this.top.findWrapping(a.linebreakReplacement.create())){let l=o.split(/\r?\n|\r/);for(let c=0;c<l.length;c++)c&&this.insertNode(a.linebreakReplacement.create(),t,!0),l[c]&&this.insertNode(a.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(a.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 a=e.nodeName.toLowerCase(),l;Eu.hasOwnProperty(a)&&this.parser.normalizeLists&&t1(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(c?c.ignore:e1.hasOwnProperty(a))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(ku.hasOwnProperty(a))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
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],a=o.getPropertyValue(i);if(a)for(let l=void 0;;){let c=this.parser.matchStyle(i,a,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,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let c=this.enter(a,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(a&&a.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 a=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];a!=l;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,o){let r,i;for(let a=this.open,l=0;a>=0;a--){let c=this.nodes[a],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 a=0;a<r.length;a++)t=this.enterInner(r[a],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 a=Fe.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Nu(l.type,e.type))&&(a=l.addToSet(a));return i.content.push(e.mark(a)),!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 a=this.top;a.match=a.match&&a.match.matchType(e);let l=wu(e,i,a.options);a.options&hr&&a.content.length==0&&(l|=hr);let c=Fe.none;return o=o.filter(d=>(a.type?a.type.allowsMarkType(d.type):Nu(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new Ni(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|=pr)}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),a=(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(a(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 a(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 t1(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&Eu.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function n1(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Cu(n){let e={};for(let t in n)e[t]=n[t];return e}function Nu(n,e){let t=e.schema.nodes;for(let o in t){let r=t[o];if(!r.allowsMarkType(n))continue;let i=[],a=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&&a(u))return!0}};if(a(r.contentMatch))return!0}}class ho{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},o){o||(o=Na(t).createDocumentFragment());let r=o,i=[];return e.forEach(a=>{if(i.length||a.marks.length){let l=0,c=0;for(;l<i.length&&c<a.marks.length;){let d=a.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<a.marks.length;){let d=a.marks[c++],u=this.serializeMark(d,a.isInline,t);u&&(i.push([d,r]),r.appendChild(u.dom),r=u.contentDOM||u.dom)}}r.appendChild(this.serializeNodeInner(a,t))}),o}serializeNodeInner(e,t){let{dom:o,contentDOM:r}=vi(Na(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&&vi(Na(o),r(e,t),null,e.attrs)}static renderSpec(e,t,o=null,r){return vi(e,t,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ho(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=vu(e.nodes);return t.text||(t.text=o=>o.text),t}static marksFromSchema(e){return vu(e.marks)}}function vu(n){let e={};for(let t in n){let o=n[t].spec.toDOM;o&&(e[t]=o)}return e}function Na(n){return n.document||window.document}const Tu=new WeakMap;function o1(n){let e=Tu.get(n);return e===void 0&&Tu.set(n,e=r1(n)),e}function r1(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 vi(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=o1(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 a=r.indexOf(" ");a>0&&(t=r.slice(0,a),r=r.slice(a+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}=vi(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 zu=65535,Mu=Math.pow(2,16);function i1(n,e){return n+e*Mu}function Au(n){return n&zu}function s1(n){return(n-(n&zu))/Mu}const Iu=1,_u=2,Ti=4,Ou=8;class va{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&Ou)>0}get deletedBefore(){return(this.delInfo&(Iu|Ti))>0}get deletedAfter(){return(this.delInfo&(_u|Ti))>0}get deletedAcross(){return(this.delInfo&Ti)>0}}class Rt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Rt.empty)return Rt.empty}recover(e){let t=0,o=Au(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+s1(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,a=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+a],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:i1(l/3,e-c),g=e==c?_u:e==f?Iu:Ti;return(t<0?e!=c:e!=f)&&(g|=Ou),new va(h,g,m)}r+=u-d}return o?e+r:new va(e+r,0,null)}touches(e,t){let o=0,r=Au(t),i=this.inverted?2:1,a=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+a]-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 a=this.ranges[r],l=a-(this.inverted?i:0),c=a+(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 Rt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Rt.empty:new Rt(e<0?[0,-e,0]:[0,0,e])}}Rt.empty=new Rt([]);class zi{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 zi(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 zi;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 a=this._maps[i],l=a.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 va(e,r,null)}}const Ta=Object.create(null);class gt{getMap(){return Rt.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 Ze{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Ze(e,null)}static fail(e){return new Ze(null,e)}static fromReplace(e,t,o,r){try{return Ze.ok(e.replace(t,o,r))}catch(i){if(i instanceof ki)return Ze.fail(i.message);throw i}}}function za(n,e,t){let o=[];for(let r=0;r<n.childCount;r++){let i=n.child(r);i.content.size&&(i=i.copy(za(i.content,e,i))),i.isInline&&(i=e(i,t,r)),o.push(i)}return re.fromArray(o)}class Un extends gt{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 pe(za(t.content,(a,l)=>!a.isAtom||!l.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),r),t.openStart,t.openEnd);return Ze.fromReplace(e,this.from,this.to,i)}invert(){return new on(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 Un(t.pos,o.pos,this.mark)}merge(e){return e instanceof Un&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Un(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 Un(t.from,t.to,e.markFromJSON(t.mark))}}gt.jsonID("addMark",Un);class on extends gt{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 pe(za(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return Ze.fromReplace(e,this.from,this.to,o)}invert(){return new Un(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 on(t.pos,o.pos,this.mark)}merge(e){return e instanceof on&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new on(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 on(t.from,t.to,e.markFromJSON(t.mark))}}gt.jsonID("removeMark",on);class Wn extends gt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Ze.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Ze.fromReplace(e,this.pos,this.pos+1,new pe(re.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 Wn(this.pos,t.marks[r]);return new Wn(this.pos,this.mark)}}return new mo(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Wn(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 Wn(t.pos,e.markFromJSON(t.mark))}}gt.jsonID("addNodeMark",Wn);class mo extends gt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Ze.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Ze.fromReplace(e,this.pos,this.pos+1,new pe(re.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Wn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new mo(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 mo(t.pos,e.markFromJSON(t.mark))}}gt.jsonID("removeNodeMark",mo);class st extends gt{constructor(e,t,o,r=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=r}apply(e){return this.structure&&Ma(e,this.from,this.to)?Ze.fail("Structure replace would overwrite content"):Ze.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Rt([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?pe.empty:new pe(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?pe.empty:new pe(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,pe.fromJSON(e,t.slice),!!t.structure)}}gt.jsonID("replace",st);class at extends gt{constructor(e,t,o,r,i,a,l=!1){super(),this.from=e,this.to=t,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=a,this.structure=l}apply(e){if(this.structure&&(Ma(e,this.from,this.gapFrom)||Ma(e,this.gapTo,this.to)))return Ze.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Ze.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,t.content);return o?Ze.fromReplace(e,this.from,this.to,o):Ze.fail("Content does not fit in gap")}getMap(){return new Rt([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,pe.fromJSON(e,t.slice),t.insert,!!t.structure)}}gt.jsonID("replaceAround",at);function Ma(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 a=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,r--}}return!1}function a1(n,e,t,o){let r=[],i=[],a,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 g=0;g<f.length;g++)f[g].isInSet(m)||(a&&a.to==p&&a.mark.eq(f[g])?a.to=h:r.push(a=new on(p,h,f[g])));l&&l.to==p?l.to=h:i.push(l=new Un(p,h,o))}}),r.forEach(c=>n.step(c)),i.forEach(c=>n.step(c))}function l1(n,e,t,o){let r=[],i=0;n.doc.nodesBetween(e,t,(a,l)=>{if(!a.isInline)return;i++;let c=null;if(o instanceof Ci){let d=a.marks,u;for(;u=o.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else o?o.isInSet(a.marks)&&(c=[o]):c=a.marks;if(c&&c.length){let d=Math.min(l+a.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(a=>n.step(new on(a.from,a.to,a.style)))}function Aa(n,e,t,o=t.contentMatch,r=!0){let i=n.doc.nodeAt(e),a=[],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)a.push(new st(l,u,pe.empty));else{o=f;for(let p=0;p<d.marks.length;p++)t.allowsMarkType(d.marks[p].type)||n.step(new on(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 pe(re.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),a.push(new st(l+p.index,l+p.index+p[0].length,m))}}l=u}if(!o.validEnd){let c=o.fillBefore(re.empty,!0);n.replace(l,l,new pe(c,0,0))}for(let c=a.length-1;c>=0;c--)n.step(a[c])}function c1(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Oo(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let o=n.depth,r=0,i=0;;--o){let a=n.$from.node(o),l=n.$from.index(o)+r,c=n.$to.indexAfter(o)-i;if(o<n.depth&&a.canReplace(l,c,t))return o;if(o==0||a.type.spec.isolating||!c1(a,l,c))break;l&&(r=1),c<a.childCount&&(i=1)}return null}function d1(n,e,t){let{$from:o,$to:r,depth:i}=e,a=o.before(i+1),l=r.after(i+1),c=a,d=l,u=re.empty,f=0;for(let m=i,g=!1;m>t;m--)g||o.index(m)>0?(g=!0,u=re.from(o.node(m).copy(u)),f++):c--;let p=re.empty,h=0;for(let m=i,g=!1;m>t;m--)g||r.after(m+1)<r.end(m)?(g=!0,p=re.from(r.node(m).copy(p)),h++):d++;n.step(new at(c,d,a,l,new pe(u.append(p),f,h),u.size-f,!0))}function Ia(n,e,t=null,o=n){let r=u1(n,e),i=r&&f1(o,e);return i?r.map(Du).concat({type:e,attrs:t}).concat(i.map(Du)):null}function Du(n){return{type:n,attrs:null}}function u1(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.contentMatchAt(o).findWrapping(e);if(!i)return null;let a=i.length?i[0]:e;return t.canReplaceWith(o,r,a)?i:null}function f1(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.child(o),a=e.contentMatch.findWrapping(i.type);if(!a)return null;let c=(a.length?a[a.length-1]:e).contentMatch;for(let d=o;c&&d<r;d++)c=c.matchType(t.child(d).type);return!c||!c.validEnd?null:a}function p1(n,e,t){let o=re.empty;for(let a=t.length-1;a>=0;a--){if(o.size){let l=t[a].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=re.from(t[a].type.create(t[a].attrs,o))}let r=e.start,i=e.end;n.step(new at(r,i,r,i,new pe(o,0,0),t.length,!0))}function h1(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,(a,l)=>{let c=typeof r=="function"?r(a):r;if(a.isTextblock&&!a.hasMarkup(o,c)&&m1(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&&Ru(n,a,l,i),Aa(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+a.nodeSize,1);return n.step(new at(f,p,f+1,p-1,new pe(re.from(o.create(c,null,a.marks)),0,0),1,!0)),d===!0&&Pu(n,a,l,i),!1}})}function Pu(n,e,t,o){e.forEach((r,i)=>{if(r.isText){let a,l=/\r?\n|\r/g;for(;a=l.exec(r.text);){let c=n.mapping.slice(o).map(t+1+i+a.index);n.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function Ru(n,e,t,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let a=n.mapping.slice(o).map(t+1+i);n.replaceWith(a,a+1,e.type.schema.text(`
348
- `))}})}function m1(n,e,t){let o=n.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,t)}function g1(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 a=t.create(o,null,r||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,a);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 pe(re.from(a),0,0),1,!0))}function wn(n,e,t=1,o){let r=n.resolve(e),i=r.depth-t,a=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!a.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 g=o&&o[u]||f;if(!f.canReplace(p+1,f.childCount)||!g.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 y1(n,e,t=1,o){let r=n.doc.resolve(e),i=re.empty,a=re.empty;for(let l=r.depth,c=r.depth-t,d=t-1;l>c;l--,d--){i=re.from(r.node(l).copy(i));let u=o&&o[d];a=re.from(u?u.type.create(u.attrs,a):r.node(l).copy(a))}n.step(new st(e,e,new pe(i.append(a),t,t),!0))}function qn(n,e){let t=n.resolve(e),o=t.index();return Lu(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(o,o+1)}function b1(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),a=i.type==o?n.type.schema.nodes.text:i.type;if(t=t.matchType(a),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function Lu(n,e){return!!(n&&e&&!n.isLeaf&&b1(n,e))}function Mi(n,e,t=-1){let o=n.resolve(e);for(let r=o.depth;;r--){let i,a,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,a=o.nodeAfter):t>0?(i=o.node(r+1),l++,a=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),a=o.node(r+1)),i&&!i.isTextblock&&Lu(i,a)&&o.node(r).canReplace(l,l+1))return e;if(r==0)break;e=t<0?o.before(r):o.after(r)}}function x1(n,e,t){let o=null,{linebreakReplacement:r}=n.doc.type.schema,i=n.doc.resolve(e-t),a=i.node().type;if(r&&a.inlineContent){let u=a.whitespace=="pre",f=!!a.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);Ru(n,u.node(),u.before(),l)}a.inlineContent&&Aa(n,e+t-1,a,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),pe.empty,!0)),o===!0){let u=n.doc.resolve(d);Pu(n,u.node(),u.before(),n.steps.length)}return n}function k1(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 E1(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 a=o.depth;a>=0;a--){let l=a==o.depth?0:o.pos<=(o.start(a+1)+o.end(a+1))/2?-1:1,c=o.index(a)+(l>0?1:0),d=o.node(a),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(a+1):o.after(a+1)}return null}function Ai(n,e,t=e,o=pe.empty){if(e==t&&!o.size)return null;let r=n.resolve(e),i=n.resolve(t);return $u(r,i,o)?new st(e,t,o):new w1(r,i,o).fit()}function $u(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class w1{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=re.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=re.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,a=o.depth,l=r.depth;for(;a&&l&&i.childCount==1;)i=i.firstChild.content,a--,l--;let c=new pe(i,a,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=_a(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let a=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:d}=this.frontier[l],u,f=null;if(t==1&&(a?d.matchType(a.type)||(f=d.fillBefore(re.from(a),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(t==2&&a&&(u=d.findWrapping(a.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=_a(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new pe(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=_a(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new pe(mr(e,t-1,1),t-1,i?t-1:o)}else this.unplaced=new pe(mr(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 g=0;g<i.length;g++)this.openFrontierNode(i[g]);let a=this.unplaced,l=o?o.content:a.content,c=a.openStart-e,d=0,u=[],{match:f,type:p}=this.frontier[t];if(r){for(let g=0;g<r.childCount;g++)u.push(r.child(g));f=f.matchFragment(r)}let h=l.size+e-(a.content.size-a.openEnd);for(;d<l.childCount;){let g=l.child(d),y=f.matchType(g.type);if(!y)break;d++,(d>1||c==0||g.content.size)&&(f=y,u.push(Vu(g.mark(p.allowedMarks(g.marks)),d==1?c:0,d==l.childCount?h:-1)))}let m=d==l.childCount;m||(h=-1),this.placed=gr(this.placed,t,re.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 g=0,y=l;g<h;g++){let x=y.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),y=x.content}this.unplaced=m?e==0?pe.empty:new pe(mr(a.content,e-1,1),e-1,h<0?a.openEnd:e-1):new pe(mr(a.content,e,d),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Oa(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)),a=Oa(e,t,r,o,i);if(a){for(let l=t-1;l>=0;l--){let{match:c,type:d}=this.frontier[l],u=Oa(e,l,d,c,!0);if(!u||u.childCount)continue e}return{depth:t,fit:a,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=gr(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=gr(this.placed,this.depth,re.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(re.empty,!0);t.childCount&&(this.placed=gr(this.placed,this.frontier.length,t))}}function mr(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(mr(n.firstChild.content,e-1,t)))}function gr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(gr(n.lastChild.content,e-1,t)))}function _a(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Vu(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,Vu(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(re.empty,!0)))),n.copy(o)}function Oa(n,e,t,o,r){let i=n.node(e),a=r?n.indexAfter(e):n.index(e);if(a==i.childCount&&!t.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,a);return l&&!S1(t,i.content,a)?l:null}function S1(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function C1(n){return n.spec.defining||n.spec.definingForContent}function N1(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),i=n.doc.resolve(t);if($u(r,i,o))return n.step(new st(e,t,o));let a=Fu(r,i);a[a.length-1]==0&&a.pop();let l=-(r.depth+1);a.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;a.indexOf(p)>-1?l=p:r.before(p)==h&&a.splice(1,0,-p)}let c=a.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=C1(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 g=0;g<a.length;g++){let y=a[(g+c)%a.length],x=!0;y<0&&(x=!1,y=-y);let C=r.node(y-1),E=r.index(y-1);if(C.canReplaceWith(E,E,m.type,m.marks))return n.replace(r.before(y),x?i.after(y):t,new pe(Bu(o.content,0,o.openStart,h),h,o.openEnd))}}let f=n.steps.length;for(let p=a.length-1;p>=0&&(n.replace(e,t,o),!(n.steps.length>f));p--){let h=a[p];h<0||(e=r.before(h),t=i.after(h))}}function Bu(n,e,t,o,r){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(Bu(i.content,e+1,t,o,i)))}if(e>o){let i=r.contentMatchAt(0),a=i.fillBefore(n).append(n);n=a.append(i.matchFragment(a).fillBefore(re.empty,!0))}return n}function v1(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=k1(n.doc,e,o.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new pe(re.from(o),0,0))}function T1(n,e,t){let o=n.doc.resolve(e),r=n.doc.resolve(t),i=Fu(o,r);for(let a=0;a<i.length;a++){let l=i[a],c=a==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 a=1;a<=o.depth&&a<=r.depth;a++)if(e-o.start(a)==o.depth-a&&t>o.end(a)&&r.end(a)-t!=r.depth-a&&o.start(a-1)==r.start(a-1)&&o.node(a-1).canReplace(o.index(a-1),r.index(a-1)))return n.delete(o.before(a),t);n.delete(e,t)}function Fu(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 Do extends gt{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 Ze.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 Ze.fromReplace(e,this.pos,this.pos+1,new pe(re.from(r),0,t.isLeaf?0:1))}getMap(){return Rt.empty}invert(e){return new Do(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 Do(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 Do(t.pos,t.attr,t.value)}}gt.jsonID("attr",Do);class yr extends gt{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 Ze.ok(o)}getMap(){return Rt.empty}invert(e){return new yr(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 yr(t.attr,t.value)}}gt.jsonID("docAttr",yr);let Po=class extends Error{};Po=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},Po.prototype=Object.create(Error.prototype),Po.prototype.constructor=Po,Po.prototype.name="TransformError";class ju{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new zi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Po(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=pe.empty){let r=Ai(this.doc,e,t,o);return r&&this.step(r),this}replaceWith(e,t,o){return this.replace(e,t,new pe(re.from(o),0,0))}delete(e,t){return this.replace(e,t,pe.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return N1(this,e,t,o),this}replaceRangeWith(e,t,o){return v1(this,e,t,o),this}deleteRange(e,t){return T1(this,e,t),this}lift(e,t){return d1(this,e,t),this}join(e,t=1){return x1(this,e,t),this}wrap(e,t){return p1(this,e,t),this}setBlockType(e,t=e,o,r=null){return h1(this,e,t,o,r),this}setNodeMarkup(e,t,o=null,r){return g1(this,e,t,o,r),this}setNodeAttribute(e,t,o){return this.step(new Do(e,t,o)),this}setDocAttribute(e,t){return this.step(new yr(e,t)),this}addNodeMark(e,t){return this.step(new Wn(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 mo(e,t));else{let r=o.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new mo(e,i)),r=i.removeFromSet(r);for(let l=a.length-1;l>=0;l--)this.step(a[l])}return this}split(e,t=1,o){return y1(this,e,t,o),this}addMark(e,t,o){return a1(this,e,t,o),this}removeMark(e,t,o){return l1(this,e,t,o),this}clearIncompatible(e,t,o){return Aa(this,e,t,o),this}}const Da=Object.create(null);class Re{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new z1(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=pe.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,a=this.ranges;for(let l=0;l<a.length;l++){let{$from:c,$to:d}=a[l],u=e.mapping.slice(i);e.replaceRange(u.map(c.pos),u.map(d.pos),l?pe.empty:t),l==0&&Wu(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:a,$to:l}=r[i],c=e.mapping.slice(o),d=c.map(a.pos),u=c.map(l.pos);i?e.deleteRange(d,u):(e.replaceRangeWith(d,u,t),Wu(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let r=e.parent.inlineContent?new Oe(e):Ro(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 a=t<0?Ro(e.node(0),e.node(i),e.before(i+1),e.index(i),t,o):Ro(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,o);if(a)return a}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Lt(e.node(0))}static atStart(e){return Ro(e,e,0,0,1)||new Lt(e)}static atEnd(e){return Ro(e,e,e.content.size,e.childCount,-1)||new Lt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Da[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 Da)throw new RangeError("Duplicate use of selection JSON ID "+e);return Da[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Oe.between(this.$anchor,this.$head).getBookmark()}}Re.prototype.visible=!0;class z1{constructor(e,t){this.$from=e,this.$to=t}}let Hu=!1;function Uu(n){!Hu&&!n.parent.inlineContent&&(Hu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Oe extends Re{constructor(e,t=e){Uu(e),Uu(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 Oe(r.parent.inlineContent?r:o,o)}replace(e,t=pe.empty){if(super.replace(e,t),t==pe.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 Ii(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 Oe(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 Oe(e,t)}}Re.jsonID("text",Oe);class Ii{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Ii(e.map(this.anchor),e.map(this.head))}resolve(e){return Oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ne 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 Ne(i)}content(){return new pe(re.from(this.node),0,0)}eq(e){return e instanceof Ne&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Pa(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ne(e.resolve(t.anchor))}static create(e,t){return new Ne(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ne.prototype.visible=!1,Re.jsonID("node",Ne);class Pa{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new Ii(o,o):new Pa(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&Ne.isSelectable(o)?new Ne(t):Re.near(t)}}class Lt extends Re{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=pe.empty){if(t==pe.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 Lt(e)}map(e){return new Lt(e)}eq(e){return e instanceof Lt}getBookmark(){return M1}}Re.jsonID("all",Lt);const M1={map(){return this},resolve(n){return new Lt(n)}};function Ro(n,e,t,o,r,i=!1){if(e.inlineContent)return Oe.create(n,t);for(let a=o-(r>0?0:1);r>0?a<e.childCount:a>=0;a+=r){let l=e.child(a);if(l.isAtom){if(!i&&Ne.isSelectable(l))return Ne.create(n,t-(r<0?l.nodeSize:0))}else{let c=Ro(n,l,t+r,r<0?l.childCount:0,r,i);if(c)return c}t+=l.nodeSize*r}return null}function Wu(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],a;i.forEach((l,c,d,u)=>{a==null&&(a=u)}),n.setSelection(Re.near(n.doc.resolve(a),t))}const qu=1,_i=2,Gu=4;class A1 extends ju{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|qu)&~_i,this.storedMarks=null,this}get selectionSet(){return(this.updated&qu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=_i,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&_i)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~_i,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 a=this.doc.resolve(t);i=o==t?a.marks():a.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|=Gu,this}get scrolledIntoView(){return(this.updated&Gu)>0}}function Ku(n,e){return!e||!n?n:n.bind(e)}class br{constructor(e,t,o){this.name=e,this.init=Ku(t.init,o),this.apply=Ku(t.apply,o)}}const I1=[new br("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new br("selection",{init(n,e){return n.selection||Re.atStart(e.doc)},apply(n){return n.selection}}),new br("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new br("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=I1.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 br(o.key,o.spec.state,o))})}}class Lo{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 a=0;a<this.config.plugins.length;a++){let l=this.config.plugins[a];if(l.spec.appendTransaction){let c=r?r[a].n:0,d=r?r[a].state:this,u=c<t.length&&l.spec.appendTransaction.call(l,c?t.slice(c):t,d,o);if(u&&o.filterTransaction(u,a)){if(u.setMeta("appendedTransaction",e),!r){r=[];for(let f=0;f<this.config.plugins.length;f++)r.push(f<a?{state:o,n:t.length}:{state:this,n:0})}t.push(u),o=o.applyInner(u),i=!0}r&&(r[a]={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 Lo(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 A1(this)}static create(e){let t=new Ra(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new Lo(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 Lo(t);for(let i=0;i<o.length;i++){let a=o[i].name;r[a]=this.hasOwnProperty(a)?this[a]: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 Lo(r);return r.fields.forEach(a=>{if(a.name=="doc")i.doc=Hn.fromJSON(e.schema,t.doc);else if(a.name=="selection")i.selection=Re.fromJSON(i.doc,t.selection);else if(a.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==a.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[a.name]=d.fromJSON.call(c,e,t[l],i);return}}i[a.name]=a.init(e,i)}}),i}}function Ju(n,e,t){for(let o in n){let r=n[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=Ju(r,e,{})),t[o]=r}return t}class Mt{constructor(e){this.spec=e,this.props={},e.props&&Ju(e.props,this,this.props),this.key=e.key?e.key.key:Xu("plugin")}getState(e){return e[this.key]}}const La=Object.create(null);function Xu(n){return n in La?n+"$"+ ++La[n]:(La[n]=0,n+"$")}class rn{constructor(e="key"){this.key=Xu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const $a=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Yu(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Qu=(n,e,t)=>{let o=Yu(n,t);if(!o)return!1;let r=Va(o);if(!r){let a=o.blockRange(),l=a&&Oo(a);return l==null?!1:(e&&e(n.tr.lift(a,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(lf(n,r,e,-1))return!0;if(o.parent.content.size==0&&($o(i,"end")||Ne.isSelectable(i)))for(let a=o.depth;;a--){let l=Ai(n.doc,o.before(a),o.after(a),pe.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=n.tr.step(l);c.setSelection($o(i,"end")?Re.findFrom(c.doc.resolve(c.mapping.map(r.pos,-1)),-1):Ne.create(c.doc,r.pos-i.nodeSize)),e(c.scrollIntoView())}return!0}if(a==1||o.node(a-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},_1=(n,e,t)=>{let o=Yu(n,t);if(!o)return!1;let r=Va(o);return r?Zu(n,r,e):!1},O1=(n,e,t)=>{let o=tf(n,t);if(!o)return!1;let r=Ba(o);return r?Zu(n,r,e):!1};function Zu(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 a=e.nodeAfter,l=a,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=Ai(n.doc,i,c,pe.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(Oe.create(u.doc,i)),t(u.scrollIntoView())}return!0}function $o(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 ef=(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=Va(o)}let a=i&&i.nodeBefore;return!a||!Ne.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Ne.create(n.doc,i.pos-a.nodeSize)).scrollIntoView()),!0)};function Va(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 tf(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const nf=(n,e,t)=>{let o=tf(n,t);if(!o)return!1;let r=Ba(o);if(!r)return!1;let i=r.nodeAfter;if(lf(n,r,e,1))return!0;if(o.parent.content.size==0&&($o(i,"start")||Ne.isSelectable(i))){let a=Ai(n.doc,o.before(),o.after(),pe.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=n.tr.step(a);l.setSelection($o(i,"start")?Re.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):Ne.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},of=(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=Ba(o)}let a=i&&i.nodeAfter;return!a||!Ne.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Ne.create(n.doc,i.pos)).scrollIntoView()),!0)};function Ba(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 D1=(n,e)=>{let t=n.selection,o=t instanceof Ne,r;if(o){if(t.node.isTextblock||!qn(n.doc,t.from))return!1;r=t.from}else if(r=Mi(n.doc,t.from,-1),r==null)return!1;if(e){let i=n.tr.join(r);o&&i.setSelection(Ne.create(i.doc,r-n.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},P1=(n,e)=>{let t=n.selection,o;if(t instanceof Ne){if(t.node.isTextblock||!qn(n.doc,t.to))return!1;o=t.to}else if(o=Mi(n.doc,t.to,1),o==null)return!1;return e&&e(n.tr.join(o).scrollIntoView()),!0},R1=(n,e)=>{let{$from:t,$to:o}=n.selection,r=t.blockRange(o),i=r&&Oo(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},rf=(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 Fa(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 L1=(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),a=Fa(r.contentMatchAt(i));if(!a||!r.canReplaceWith(i,i,a))return!1;if(e){let l=t.after(),c=n.tr.replaceWith(l,l,a.createAndFill());c.setSelection(Re.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},sf=(n,e)=>{let t=n.selection,{$from:o,$to:r}=t;if(t instanceof Lt||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=Fa(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let a=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=n.tr.insert(a,i.createAndFill());l.setSelection(Oe.create(l.doc,a+1)),e(l.scrollIntoView())}return!0},af=(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(wn(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let o=t.blockRange(),r=o&&Oo(o);return r==null?!1:(e&&e(n.tr.lift(o,r).scrollIntoView()),!0)};function $1(n){return(e,t)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof Ne&&e.selection.node.isBlock)return!o.parentOffset||!wn(e.doc,o.pos)?!1:(t&&t(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],a,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=Fa(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(c&&l?{type:l}:null),a=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof Oe||e.selection instanceof Lt)&&u.deleteSelection();let f=u.mapping.map(o.pos),p=wn(u.doc,f,i.length,i);if(p||(i[0]=l?{type:l}:null,p=wn(u.doc,f,i.length,i)),!p)return!1;if(u.split(f,i.length,i),!c&&d&&o.node(a).type!=l){let h=u.mapping.map(o.before(a)),m=u.doc.resolve(h);l&&o.node(a-1).canReplaceWith(m.index(),m.index()+1,l)&&u.setNodeMarkup(u.mapping.map(o.before(a)),l)}return t&&t(u.scrollIntoView()),!0}}const V1=$1(),B1=(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(Ne.create(n.doc,r))),!0)};function F1(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||qn(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function lf(n,e,t,o){let r=e.nodeBefore,i=e.nodeAfter,a,l,c=r.type.spec.isolating||i.type.spec.isolating;if(!c&&F1(n,e,t))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(a=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(a[0]||i.type).validEnd){if(t){let h=e.pos+i.nodeSize,m=re.empty;for(let x=a.length-1;x>=0;x--)m=re.from(a[x].create(null,m));m=re.from(r.copy(m));let g=n.tr.step(new at(e.pos-1,h,e.pos,h,new pe(m,1,0),a.length,!0)),y=g.doc.resolve(h+2*a.length);y.nodeAfter&&y.nodeAfter.type==r.type&&qn(g.doc,y.pos)&&g.join(y.pos),t(g.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&&Oo(f);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(f,p).scrollIntoView()),!0;if(d&&$o(i,"start",!0)&&$o(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=i,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(t){let x=re.empty;for(let E=m.length-1;E>=0;E--)x=re.from(m[E].copy(x));let C=n.tr.step(new at(e.pos-m.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new pe(x,m.length,0),0,!0));t(C.scrollIntoView())}return!0}}return!1}function cf(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(Oe.create(e.doc,n<0?r.start(i):r.end(i)))),!0):!1}}const j1=cf(-1),H1=cf(1);function U1(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,a=r.blockRange(i),l=a&&Ia(a,n,e);return l?(o&&o(t.tr.wrap(a,l).scrollIntoView()),!0):!1}}function df(n,e=null){return function(t,o){let r=!1;for(let i=0;i<t.selection.ranges.length&&!r;i++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[i];t.doc.nodesBetween(a,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 a=0;a<t.selection.ranges.length;a++){let{$from:{pos:l},$to:{pos:c}}=t.selection.ranges[a];i.setBlockType(l,c,n,e)}o(i.scrollIntoView())}return!0}}function ja(...n){return function(e,t,o){for(let r=0;r<n.length;r++)if(n[r](e,t,o))return!0;return!1}}ja($a,Qu,ef),ja($a,nf,of),ja(rf,sf,af,V1),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function W1(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,a=r.blockRange(i);if(!a)return!1;let l=o?t.tr:null;return q1(l,a,n,e)?(o&&o(l.scrollIntoView()),!0):!1}}function q1(n,e,t,o=null){let r=!1,i=e,a=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=a.resolve(e.start-2);i=new wi(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new wi(e.$from,a.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=Ia(i,t,o,e);return l?(n&&G1(n,e,l,r,t),!0):!1}function G1(n,e,t,o,r){let i=re.empty;for(let u=t.length-1;u>=0;u--)i=re.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 pe(i,0,0),t.length,!0));let a=0;for(let u=0;u<t.length;u++)t[u].type==r&&(a=u+1);let l=t.length-a,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&&wn(n.doc,c,l)&&(n.split(c,l),c+=2*l),c+=d.child(u).nodeSize;return n}function K1(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,a=>a.childCount>0&&a.firstChild.type==n);return i?t?o.node(i.depth-1).type==n?J1(e,t,n,i):X1(e,t,i):!0:!1}}function J1(n,e,t,o){let r=n.tr,i=o.end,a=o.$to.end(o.depth);i<a&&(r.step(new at(i-1,a,i,a,new pe(re.from(t.create(null,o.parent.copy())),1,0),1,!0)),o=new wi(r.doc.resolve(o.$from.pos),r.doc.resolve(a),o.depth));const l=Oo(o);if(l==null)return!1;r.lift(o,l);let c=r.doc.resolve(r.mapping.map(i,-1)-1);return qn(r.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&r.join(c.pos),e(r.scrollIntoView()),!0}function X1(n,e,t){let o=n.tr,r=t.parent;for(let h=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(t.start),a=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,a.content.append(c?re.empty:re.from(r))))return!1;let f=i.pos,p=f+a.nodeSize;return o.step(new at(f-(l?1:0),p+(c?1:0),f+1,p-1,new pe((l?re.empty:re.from(r.copy(re.empty))).append(c?re.empty:re.from(r.copy(re.empty))),l?0:1,c?0:1),l?0:1)),e(o.scrollIntoView()),!0}function Y1(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 a=i.startIndex;if(a==0)return!1;let l=i.parent,c=l.child(a-1);if(c.type!=n)return!1;if(t){let d=c.lastChild&&c.lastChild.type==l.type,u=re.from(d?n.create():null),f=new pe(re.from(n.create(null,re.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 ft=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Vo=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Ha=null;const Sn=function(n,e,t){let o=Ha||(Ha=document.createRange());return o.setEnd(n,t??n.nodeValue.length),o.setStart(n,e||0),o},Q1=function(){Ha=null},go=function(n,e,t,o){return t&&(uf(n,e,t,o,-1)||uf(n,e,t,o,1))},Z1=/^(img|br|input|textarea|hr)$/i;function uf(n,e,t,o,r){for(var i;;){if(n==t&&e==o)return!0;if(e==(r<0?0:Ft(n))){let a=n.parentNode;if(!a||a.nodeType!=1||xr(n)||Z1.test(n.nodeName)||n.contentEditable=="false")return!1;e=ft(n)+(r<0?0:1),n=a}else if(n.nodeType==1){let a=n.childNodes[e+(r<0?-1:0)];if(a.nodeType==1&&a.contentEditable=="false")if(!((i=a.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=r;else return!1;else n=a,e=r<0?Ft(n):0}else return!1}}function Ft(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function e0(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=Ft(n)}else if(n.parentNode&&!xr(n))e=ft(n),n=n.parentNode;else return null}}function t0(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&&!xr(n))e=ft(n)+1,n=n.parentNode;else return null}}function n0(n,e,t){for(let o=e==0,r=e==Ft(n);o||r;){if(n==t)return!0;let i=ft(n);if(n=n.parentNode,!n)return!1;o=o&&i==0,r=r&&i==Ft(n)}}function xr(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 Oi=function(n){return n.focusNode&&go(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function yo(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function o0(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function r0(n,e,t){if(n.caretPositionFromPoint)try{let o=n.caretPositionFromPoint(e,t);if(o)return{node:o.offsetNode,offset:Math.min(Ft(o.offsetNode),o.offset)}}catch{}if(n.caretRangeFromPoint){let o=n.caretRangeFromPoint(e,t);if(o)return{node:o.startContainer,offset:Math.min(Ft(o.startContainer),o.startOffset)}}}const un=typeof navigator<"u"?navigator:null,ff=typeof document<"u"?document:null,Gn=un&&un.userAgent||"",Ua=/Edge\/(\d+)/.exec(Gn),pf=/MSIE \d/.exec(Gn),Wa=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Gn),At=!!(pf||Wa||Ua),Kn=pf?document.documentMode:Wa?+Wa[1]:Ua?+Ua[1]:0,jt=!At&&/gecko\/(\d+)/i.test(Gn);jt&&+(/Firefox\/(\d+)/.exec(Gn)||[0,0])[1];const qa=!At&&/Chrome\/(\d+)/.exec(Gn),lt=!!qa,hf=qa?+qa[1]:0,pt=!At&&!!un&&/Apple Computer/.test(un.vendor),Bo=pt&&(/Mobile\/\w+/.test(Gn)||!!un&&un.maxTouchPoints>2),Ht=Bo||(un?/Mac/.test(un.platform):!1),mf=un?/Win/.test(un.platform):!1,Cn=/Android \d/.test(Gn),kr=!!ff&&"webkitFontSmoothing"in ff.documentElement.style,i0=kr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function s0(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 Nn(n,e){return typeof n=="number"?n:n[e]}function a0(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 gf(n,e,t){let o=n.someProp("scrollThreshold")||0,r=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let a=t||n.dom;a;){if(a.nodeType!=1){a=Vo(a);continue}let l=a,c=l==i.body,d=c?s0(i):a0(l),u=0,f=0;if(e.top<d.top+Nn(o,"top")?f=-(d.top-e.top+Nn(r,"top")):e.bottom>d.bottom-Nn(o,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+Nn(r,"top")-d.top:e.bottom-d.bottom+Nn(r,"bottom")),e.left<d.left+Nn(o,"left")?u=-(d.left-e.left+Nn(r,"left")):e.right>d.right-Nn(o,"right")&&(u=e.right-d.right+Nn(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 g=l.scrollLeft-h,y=l.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let p=c?"fixed":getComputedStyle(a).position;if(/^(fixed|sticky)$/.test(p))break;a=p=="absolute"?a.offsetParent:Vo(a)}}function l0(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),o,r;for(let i=(e.left+e.right)/2,a=t+1;a<Math.min(innerHeight,e.bottom);a+=5){let l=n.root.elementFromPoint(i,a);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:yf(n.dom)}}function yf(n){let e=[],t=n.ownerDocument;for(let o=n;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),n!=t);o=Vo(o));return e}function c0({refDOM:n,refTop:e,stack:t}){let o=n?n.getBoundingClientRect().top:0;bf(t,o==0?0:o-e)}function bf(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 Fo=null;function d0(n){if(n.setActive)return n.setActive();if(Fo)return n.focus(Fo);let e=yf(n);n.focus(Fo==null?{get preventScroll(){return Fo={preventScroll:!0},!0}}:void 0),Fo||(Fo=!1,bf(e,0))}function xf(n,e){let t,o=2e8,r,i=0,a=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=Sn(u).getClientRects();else continue;for(let h=0;h<p.length;h++){let m=p[h];if(m.top<=a&&m.bottom>=l){a=Math.max(m.bottom,a),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<o){t=u,o=g,r=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(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?u0(t,r):!t||o&&t.nodeType==1?{node:n,offset:i}:xf(t,r)}function u0(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 a=Jn(o,1);if(a.top!=a.bottom&&Ga(e,a)){r={node:n,offset:i+(e.left>=(a.left+a.right)/2?1:0)};break}}return o.detach(),r||{node:n,offset:0}}function Ga(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function f0(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function p0(n,e,t){let{node:o,offset:r}=xf(e,t),i=-1;if(o.nodeType==1&&!o.firstChild){let a=o.getBoundingClientRect();i=a.left!=a.right&&t.left>(a.left+a.right)/2?1:-1}return n.docView.posFromDOM(o,r,i)}function h0(n,e,t,o){let r=-1;for(let i=e,a=!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)&&(!a&&c.left>o.left||c.top>o.top?r=l.posBefore:(!a&&c.right<o.left||c.bottom<o.top)&&(r=l.posAfter),a=!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 kf(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 a=n.childNodes[i];if(a.nodeType==1){let l=a.getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(Ga(e,d))return kf(a,e,d)}}if((i=(i+1)%o)==r)break}return n}function m0(n,e){let t=n.dom.ownerDocument,o,r=0,i=r0(t,e.left,e.top);i&&({node:o,offset:r}=i);let a=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!a||!n.dom.contains(a.nodeType!=1?a.parentNode:a)){let d=n.dom.getBoundingClientRect();if(!Ga(e,d)||(a=kf(n.dom,e,d),!a))return null}if(pt)for(let d=a;o&&d;d=Vo(d))d.draggable&&(o=void 0);if(a=f0(a,e),o){if(jt&&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;kr&&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=h0(n,o,r,e))}l==null&&(l=p0(n,a,e));let c=n.docView.nearestDesc(a,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function Ef(n){return n.top<n.bottom||n.left<n.right}function Jn(n,e){let t=n.getClientRects();if(t.length){let o=t[e<0?0:t.length-1];if(Ef(o))return o}return Array.prototype.find.call(t,Ef)||n.getBoundingClientRect()}const g0=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function wf(n,e,t){let{node:o,offset:r,atom:i}=n.docView.domFromPos(e,t<0?-1:1),a=kr||jt;if(o.nodeType==3)if(a&&(g0.test(o.nodeValue)||(t<0?!r:r==o.nodeValue.length))){let c=Jn(Sn(o,r,r),t);if(jt&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let d=Jn(Sn(o,r-1,r-1),-1);if(d.top==c.top){let u=Jn(Sn(o,r,r+1),-1);if(u.top!=c.top)return Er(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++,Er(Jn(Sn(o,c,d),u),u<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(t<0||r==Ft(o))){let c=o.childNodes[r-1];if(c.nodeType==1)return Ka(c.getBoundingClientRect(),!1)}if(i==null&&r<Ft(o)){let c=o.childNodes[r];if(c.nodeType==1)return Ka(c.getBoundingClientRect(),!0)}return Ka(o.getBoundingClientRect(),t>=0)}if(i==null&&r&&(t<0||r==Ft(o))){let c=o.childNodes[r-1],d=c.nodeType==3?Sn(c,Ft(c)-(a?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return Er(Jn(d,1),!1)}if(i==null&&r<Ft(o)){let c=o.childNodes[r];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?Sn(c,0,a?0:1):c.nodeType==1?c:null:null;if(d)return Er(Jn(d,-1),!0)}return Er(Jn(o.nodeType==3?Sn(o):o,-t),t>=0)}function Er(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 Ka(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 Sf(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 y0(n,e,t){let o=e.selection,r=t=="up"?o.$from:o.$to;return Sf(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 a=wf(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=Sn(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"?a.top-u.top>(u.bottom-a.top)*2:u.bottom-a.bottom>(a.bottom-u.top)*2))return!1}}return!0})}const b0=/[\u0590-\u08ac]/;function x0(n,e,t){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,a=r==o.parent.content.size,l=n.domSelection();return l?!b0.test(o.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:a:Sf(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:g}=n.domSelectionRange(),y=m&&!h.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==g;try{l.collapse(u,f),c&&(c!=u||d!=f)&&l.extend&&l.extend(c,d)}catch{}return p!=null&&(l.caretBidiLevel=p),y}):o.pos==o.start()||o.pos==o.end()}let Cf=null,Nf=null,vf=!1;function k0(n,e,t){return Cf==e&&Nf==t?vf:(Cf=e,Nf=t,vf=t=="up"||t=="down"?y0(n,e,t):x0(n,e,t))}const Ut=0,Tf=1,bo=2,fn=3;class wr{constructor(e,t,o,r){this.parent=e,this.children=t,this.dom=o,this.contentDOM=r,this.dirty=Ut,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,a;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((a=i.pmViewDesc)&&a.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(a)+a.size:this.posAtStart}else{let i,a;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((a=i.pmViewDesc)&&a.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(a):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>ft(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),a;if(i&&(!t||i.node))if(o&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==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 a=0;a<r.children.length;a++){let l=r.children[a];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 a=this.children[o],l=i+a.size;if(l>e||a instanceof Af){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 zf&&i.side>=0;o--);if(t<=0){let i,a=!0;for(;i=o?this.children[o-1]:null,!(!i||i.dom.parentNode==this.contentDOM);o--,a=!1);return i&&t&&a&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?ft(i.dom)+1:0}}else{let i,a=!0;for(;i=o<this.children.length?this.children[o]:null,!(!i||i.dom.parentNode==this.contentDOM);o++,a=!1);return i&&a&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?ft(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 a=o,l=0;;l++){let c=this.children[l],d=a+c.size;if(r==-1&&e<=d){let u=a+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=a;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=ft(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=ft(f.dom);break}t+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=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),a=Math.max(e,t);for(let h=0,m=0;h<this.children.length;h++){let g=this.children[h],y=m+g.size;if(i>m&&a<y)return g.setSelection(e-m-g.border,t-m-g.border,o,r);m=y}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((jt||pt)&&e==t){let{node:h,offset:m}=l;if(h.nodeType==3){if(f=!!(m&&h.nodeValue[m-1]==`
348
+ `))}})}function m1(n,e,t){let o=n.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,t)}function g1(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 a=t.create(o,null,r||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,a);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 pe(re.from(a),0,0),1,!0))}function wn(n,e,t=1,o){let r=n.resolve(e),i=r.depth-t,a=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!a.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 g=o&&o[u]||f;if(!f.canReplace(p+1,f.childCount)||!g.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 y1(n,e,t=1,o){let r=n.doc.resolve(e),i=re.empty,a=re.empty;for(let l=r.depth,c=r.depth-t,d=t-1;l>c;l--,d--){i=re.from(r.node(l).copy(i));let u=o&&o[d];a=re.from(u?u.type.create(u.attrs,a):r.node(l).copy(a))}n.step(new st(e,e,new pe(i.append(a),t,t),!0))}function qn(n,e){let t=n.resolve(e),o=t.index();return Lu(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(o,o+1)}function b1(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),a=i.type==o?n.type.schema.nodes.text:i.type;if(t=t.matchType(a),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function Lu(n,e){return!!(n&&e&&!n.isLeaf&&b1(n,e))}function Mi(n,e,t=-1){let o=n.resolve(e);for(let r=o.depth;;r--){let i,a,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,a=o.nodeAfter):t>0?(i=o.node(r+1),l++,a=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),a=o.node(r+1)),i&&!i.isTextblock&&Lu(i,a)&&o.node(r).canReplace(l,l+1))return e;if(r==0)break;e=t<0?o.before(r):o.after(r)}}function x1(n,e,t){let o=null,{linebreakReplacement:r}=n.doc.type.schema,i=n.doc.resolve(e-t),a=i.node().type;if(r&&a.inlineContent){let u=a.whitespace=="pre",f=!!a.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);Ru(n,u.node(),u.before(),l)}a.inlineContent&&Aa(n,e+t-1,a,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),pe.empty,!0)),o===!0){let u=n.doc.resolve(d);Pu(n,u.node(),u.before(),n.steps.length)}return n}function k1(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 E1(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 a=o.depth;a>=0;a--){let l=a==o.depth?0:o.pos<=(o.start(a+1)+o.end(a+1))/2?-1:1,c=o.index(a)+(l>0?1:0),d=o.node(a),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(a+1):o.after(a+1)}return null}function Ai(n,e,t=e,o=pe.empty){if(e==t&&!o.size)return null;let r=n.resolve(e),i=n.resolve(t);return $u(r,i,o)?new st(e,t,o):new w1(r,i,o).fit()}function $u(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class w1{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=re.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=re.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,a=o.depth,l=r.depth;for(;a&&l&&i.childCount==1;)i=i.firstChild.content,a--,l--;let c=new pe(i,a,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=_a(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let a=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:d}=this.frontier[l],u,f=null;if(t==1&&(a?d.matchType(a.type)||(f=d.fillBefore(re.from(a),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(t==2&&a&&(u=d.findWrapping(a.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=_a(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new pe(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=_a(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new pe(mr(e,t-1,1),t-1,i?t-1:o)}else this.unplaced=new pe(mr(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 g=0;g<i.length;g++)this.openFrontierNode(i[g]);let a=this.unplaced,l=o?o.content:a.content,c=a.openStart-e,d=0,u=[],{match:f,type:p}=this.frontier[t];if(r){for(let g=0;g<r.childCount;g++)u.push(r.child(g));f=f.matchFragment(r)}let h=l.size+e-(a.content.size-a.openEnd);for(;d<l.childCount;){let g=l.child(d),y=f.matchType(g.type);if(!y)break;d++,(d>1||c==0||g.content.size)&&(f=y,u.push(Vu(g.mark(p.allowedMarks(g.marks)),d==1?c:0,d==l.childCount?h:-1)))}let m=d==l.childCount;m||(h=-1),this.placed=gr(this.placed,t,re.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 g=0,y=l;g<h;g++){let x=y.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),y=x.content}this.unplaced=m?e==0?pe.empty:new pe(mr(a.content,e-1,1),e-1,h<0?a.openEnd:e-1):new pe(mr(a.content,e,d),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Oa(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)),a=Oa(e,t,r,o,i);if(a){for(let l=t-1;l>=0;l--){let{match:c,type:d}=this.frontier[l],u=Oa(e,l,d,c,!0);if(!u||u.childCount)continue e}return{depth:t,fit:a,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=gr(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=gr(this.placed,this.depth,re.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(re.empty,!0);t.childCount&&(this.placed=gr(this.placed,this.frontier.length,t))}}function mr(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(mr(n.firstChild.content,e-1,t)))}function gr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(gr(n.lastChild.content,e-1,t)))}function _a(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Vu(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,Vu(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(re.empty,!0)))),n.copy(o)}function Oa(n,e,t,o,r){let i=n.node(e),a=r?n.indexAfter(e):n.index(e);if(a==i.childCount&&!t.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,a);return l&&!S1(t,i.content,a)?l:null}function S1(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function C1(n){return n.spec.defining||n.spec.definingForContent}function N1(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),i=n.doc.resolve(t);if($u(r,i,o))return n.step(new st(e,t,o));let a=Fu(r,i);a[a.length-1]==0&&a.pop();let l=-(r.depth+1);a.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;a.indexOf(p)>-1?l=p:r.before(p)==h&&a.splice(1,0,-p)}let c=a.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=C1(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 g=0;g<a.length;g++){let y=a[(g+c)%a.length],x=!0;y<0&&(x=!1,y=-y);let N=r.node(y-1),E=r.index(y-1);if(N.canReplaceWith(E,E,m.type,m.marks))return n.replace(r.before(y),x?i.after(y):t,new pe(Bu(o.content,0,o.openStart,h),h,o.openEnd))}}let f=n.steps.length;for(let p=a.length-1;p>=0&&(n.replace(e,t,o),!(n.steps.length>f));p--){let h=a[p];h<0||(e=r.before(h),t=i.after(h))}}function Bu(n,e,t,o,r){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(Bu(i.content,e+1,t,o,i)))}if(e>o){let i=r.contentMatchAt(0),a=i.fillBefore(n).append(n);n=a.append(i.matchFragment(a).fillBefore(re.empty,!0))}return n}function v1(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=k1(n.doc,e,o.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new pe(re.from(o),0,0))}function T1(n,e,t){let o=n.doc.resolve(e),r=n.doc.resolve(t),i=Fu(o,r);for(let a=0;a<i.length;a++){let l=i[a],c=a==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 a=1;a<=o.depth&&a<=r.depth;a++)if(e-o.start(a)==o.depth-a&&t>o.end(a)&&r.end(a)-t!=r.depth-a&&o.start(a-1)==r.start(a-1)&&o.node(a-1).canReplace(o.index(a-1),r.index(a-1)))return n.delete(o.before(a),t);n.delete(e,t)}function Fu(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 Do extends gt{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 Ze.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 Ze.fromReplace(e,this.pos,this.pos+1,new pe(re.from(r),0,t.isLeaf?0:1))}getMap(){return Rt.empty}invert(e){return new Do(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 Do(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 Do(t.pos,t.attr,t.value)}}gt.jsonID("attr",Do);class yr extends gt{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 Ze.ok(o)}getMap(){return Rt.empty}invert(e){return new yr(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 yr(t.attr,t.value)}}gt.jsonID("docAttr",yr);let Po=class extends Error{};Po=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},Po.prototype=Object.create(Error.prototype),Po.prototype.constructor=Po,Po.prototype.name="TransformError";class ju{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new zi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Po(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=pe.empty){let r=Ai(this.doc,e,t,o);return r&&this.step(r),this}replaceWith(e,t,o){return this.replace(e,t,new pe(re.from(o),0,0))}delete(e,t){return this.replace(e,t,pe.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return N1(this,e,t,o),this}replaceRangeWith(e,t,o){return v1(this,e,t,o),this}deleteRange(e,t){return T1(this,e,t),this}lift(e,t){return d1(this,e,t),this}join(e,t=1){return x1(this,e,t),this}wrap(e,t){return p1(this,e,t),this}setBlockType(e,t=e,o,r=null){return h1(this,e,t,o,r),this}setNodeMarkup(e,t,o=null,r){return g1(this,e,t,o,r),this}setNodeAttribute(e,t,o){return this.step(new Do(e,t,o)),this}setDocAttribute(e,t){return this.step(new yr(e,t)),this}addNodeMark(e,t){return this.step(new Wn(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 mo(e,t));else{let r=o.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new mo(e,i)),r=i.removeFromSet(r);for(let l=a.length-1;l>=0;l--)this.step(a[l])}return this}split(e,t=1,o){return y1(this,e,t,o),this}addMark(e,t,o){return a1(this,e,t,o),this}removeMark(e,t,o){return l1(this,e,t,o),this}clearIncompatible(e,t,o){return Aa(this,e,t,o),this}}const Da=Object.create(null);class Re{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new z1(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=pe.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,a=this.ranges;for(let l=0;l<a.length;l++){let{$from:c,$to:d}=a[l],u=e.mapping.slice(i);e.replaceRange(u.map(c.pos),u.map(d.pos),l?pe.empty:t),l==0&&Wu(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:a,$to:l}=r[i],c=e.mapping.slice(o),d=c.map(a.pos),u=c.map(l.pos);i?e.deleteRange(d,u):(e.replaceRangeWith(d,u,t),Wu(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let r=e.parent.inlineContent?new Oe(e):Ro(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 a=t<0?Ro(e.node(0),e.node(i),e.before(i+1),e.index(i),t,o):Ro(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,o);if(a)return a}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Lt(e.node(0))}static atStart(e){return Ro(e,e,0,0,1)||new Lt(e)}static atEnd(e){return Ro(e,e,e.content.size,e.childCount,-1)||new Lt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Da[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 Da)throw new RangeError("Duplicate use of selection JSON ID "+e);return Da[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Oe.between(this.$anchor,this.$head).getBookmark()}}Re.prototype.visible=!0;class z1{constructor(e,t){this.$from=e,this.$to=t}}let Hu=!1;function Uu(n){!Hu&&!n.parent.inlineContent&&(Hu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Oe extends Re{constructor(e,t=e){Uu(e),Uu(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 Oe(r.parent.inlineContent?r:o,o)}replace(e,t=pe.empty){if(super.replace(e,t),t==pe.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 Ii(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 Oe(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 Oe(e,t)}}Re.jsonID("text",Oe);class Ii{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Ii(e.map(this.anchor),e.map(this.head))}resolve(e){return Oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ne 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 Ne(i)}content(){return new pe(re.from(this.node),0,0)}eq(e){return e instanceof Ne&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Pa(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ne(e.resolve(t.anchor))}static create(e,t){return new Ne(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ne.prototype.visible=!1,Re.jsonID("node",Ne);class Pa{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new Ii(o,o):new Pa(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&Ne.isSelectable(o)?new Ne(t):Re.near(t)}}class Lt extends Re{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=pe.empty){if(t==pe.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 Lt(e)}map(e){return new Lt(e)}eq(e){return e instanceof Lt}getBookmark(){return M1}}Re.jsonID("all",Lt);const M1={map(){return this},resolve(n){return new Lt(n)}};function Ro(n,e,t,o,r,i=!1){if(e.inlineContent)return Oe.create(n,t);for(let a=o-(r>0?0:1);r>0?a<e.childCount:a>=0;a+=r){let l=e.child(a);if(l.isAtom){if(!i&&Ne.isSelectable(l))return Ne.create(n,t-(r<0?l.nodeSize:0))}else{let c=Ro(n,l,t+r,r<0?l.childCount:0,r,i);if(c)return c}t+=l.nodeSize*r}return null}function Wu(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],a;i.forEach((l,c,d,u)=>{a==null&&(a=u)}),n.setSelection(Re.near(n.doc.resolve(a),t))}const qu=1,_i=2,Gu=4;class A1 extends ju{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|qu)&~_i,this.storedMarks=null,this}get selectionSet(){return(this.updated&qu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=_i,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&_i)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~_i,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 a=this.doc.resolve(t);i=o==t?a.marks():a.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|=Gu,this}get scrolledIntoView(){return(this.updated&Gu)>0}}function Ku(n,e){return!e||!n?n:n.bind(e)}class br{constructor(e,t,o){this.name=e,this.init=Ku(t.init,o),this.apply=Ku(t.apply,o)}}const I1=[new br("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new br("selection",{init(n,e){return n.selection||Re.atStart(e.doc)},apply(n){return n.selection}}),new br("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new br("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=I1.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 br(o.key,o.spec.state,o))})}}class Lo{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 a=0;a<this.config.plugins.length;a++){let l=this.config.plugins[a];if(l.spec.appendTransaction){let c=r?r[a].n:0,d=r?r[a].state:this,u=c<t.length&&l.spec.appendTransaction.call(l,c?t.slice(c):t,d,o);if(u&&o.filterTransaction(u,a)){if(u.setMeta("appendedTransaction",e),!r){r=[];for(let f=0;f<this.config.plugins.length;f++)r.push(f<a?{state:o,n:t.length}:{state:this,n:0})}t.push(u),o=o.applyInner(u),i=!0}r&&(r[a]={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 Lo(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 A1(this)}static create(e){let t=new Ra(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new Lo(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 Lo(t);for(let i=0;i<o.length;i++){let a=o[i].name;r[a]=this.hasOwnProperty(a)?this[a]: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 Lo(r);return r.fields.forEach(a=>{if(a.name=="doc")i.doc=Hn.fromJSON(e.schema,t.doc);else if(a.name=="selection")i.selection=Re.fromJSON(i.doc,t.selection);else if(a.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==a.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[a.name]=d.fromJSON.call(c,e,t[l],i);return}}i[a.name]=a.init(e,i)}}),i}}function Ju(n,e,t){for(let o in n){let r=n[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=Ju(r,e,{})),t[o]=r}return t}class Mt{constructor(e){this.spec=e,this.props={},e.props&&Ju(e.props,this,this.props),this.key=e.key?e.key.key:Xu("plugin")}getState(e){return e[this.key]}}const La=Object.create(null);function Xu(n){return n in La?n+"$"+ ++La[n]:(La[n]=0,n+"$")}class rn{constructor(e="key"){this.key=Xu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const $a=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Yu(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Qu=(n,e,t)=>{let o=Yu(n,t);if(!o)return!1;let r=Va(o);if(!r){let a=o.blockRange(),l=a&&Oo(a);return l==null?!1:(e&&e(n.tr.lift(a,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(lf(n,r,e,-1))return!0;if(o.parent.content.size==0&&($o(i,"end")||Ne.isSelectable(i)))for(let a=o.depth;;a--){let l=Ai(n.doc,o.before(a),o.after(a),pe.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=n.tr.step(l);c.setSelection($o(i,"end")?Re.findFrom(c.doc.resolve(c.mapping.map(r.pos,-1)),-1):Ne.create(c.doc,r.pos-i.nodeSize)),e(c.scrollIntoView())}return!0}if(a==1||o.node(a-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},_1=(n,e,t)=>{let o=Yu(n,t);if(!o)return!1;let r=Va(o);return r?Zu(n,r,e):!1},O1=(n,e,t)=>{let o=tf(n,t);if(!o)return!1;let r=Ba(o);return r?Zu(n,r,e):!1};function Zu(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 a=e.nodeAfter,l=a,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=Ai(n.doc,i,c,pe.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(Oe.create(u.doc,i)),t(u.scrollIntoView())}return!0}function $o(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 ef=(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=Va(o)}let a=i&&i.nodeBefore;return!a||!Ne.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Ne.create(n.doc,i.pos-a.nodeSize)).scrollIntoView()),!0)};function Va(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 tf(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const nf=(n,e,t)=>{let o=tf(n,t);if(!o)return!1;let r=Ba(o);if(!r)return!1;let i=r.nodeAfter;if(lf(n,r,e,1))return!0;if(o.parent.content.size==0&&($o(i,"start")||Ne.isSelectable(i))){let a=Ai(n.doc,o.before(),o.after(),pe.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=n.tr.step(a);l.setSelection($o(i,"start")?Re.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):Ne.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},of=(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=Ba(o)}let a=i&&i.nodeAfter;return!a||!Ne.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Ne.create(n.doc,i.pos)).scrollIntoView()),!0)};function Ba(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 D1=(n,e)=>{let t=n.selection,o=t instanceof Ne,r;if(o){if(t.node.isTextblock||!qn(n.doc,t.from))return!1;r=t.from}else if(r=Mi(n.doc,t.from,-1),r==null)return!1;if(e){let i=n.tr.join(r);o&&i.setSelection(Ne.create(i.doc,r-n.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},P1=(n,e)=>{let t=n.selection,o;if(t instanceof Ne){if(t.node.isTextblock||!qn(n.doc,t.to))return!1;o=t.to}else if(o=Mi(n.doc,t.to,1),o==null)return!1;return e&&e(n.tr.join(o).scrollIntoView()),!0},R1=(n,e)=>{let{$from:t,$to:o}=n.selection,r=t.blockRange(o),i=r&&Oo(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},rf=(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 Fa(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 L1=(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),a=Fa(r.contentMatchAt(i));if(!a||!r.canReplaceWith(i,i,a))return!1;if(e){let l=t.after(),c=n.tr.replaceWith(l,l,a.createAndFill());c.setSelection(Re.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},sf=(n,e)=>{let t=n.selection,{$from:o,$to:r}=t;if(t instanceof Lt||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=Fa(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let a=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=n.tr.insert(a,i.createAndFill());l.setSelection(Oe.create(l.doc,a+1)),e(l.scrollIntoView())}return!0},af=(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(wn(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let o=t.blockRange(),r=o&&Oo(o);return r==null?!1:(e&&e(n.tr.lift(o,r).scrollIntoView()),!0)};function $1(n){return(e,t)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof Ne&&e.selection.node.isBlock)return!o.parentOffset||!wn(e.doc,o.pos)?!1:(t&&t(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],a,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=Fa(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(c&&l?{type:l}:null),a=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof Oe||e.selection instanceof Lt)&&u.deleteSelection();let f=u.mapping.map(o.pos),p=wn(u.doc,f,i.length,i);if(p||(i[0]=l?{type:l}:null,p=wn(u.doc,f,i.length,i)),!p)return!1;if(u.split(f,i.length,i),!c&&d&&o.node(a).type!=l){let h=u.mapping.map(o.before(a)),m=u.doc.resolve(h);l&&o.node(a-1).canReplaceWith(m.index(),m.index()+1,l)&&u.setNodeMarkup(u.mapping.map(o.before(a)),l)}return t&&t(u.scrollIntoView()),!0}}const V1=$1(),B1=(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(Ne.create(n.doc,r))),!0)};function F1(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||qn(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function lf(n,e,t,o){let r=e.nodeBefore,i=e.nodeAfter,a,l,c=r.type.spec.isolating||i.type.spec.isolating;if(!c&&F1(n,e,t))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(a=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(a[0]||i.type).validEnd){if(t){let h=e.pos+i.nodeSize,m=re.empty;for(let x=a.length-1;x>=0;x--)m=re.from(a[x].create(null,m));m=re.from(r.copy(m));let g=n.tr.step(new at(e.pos-1,h,e.pos,h,new pe(m,1,0),a.length,!0)),y=g.doc.resolve(h+2*a.length);y.nodeAfter&&y.nodeAfter.type==r.type&&qn(g.doc,y.pos)&&g.join(y.pos),t(g.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&&Oo(f);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(f,p).scrollIntoView()),!0;if(d&&$o(i,"start",!0)&&$o(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=i,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(t){let x=re.empty;for(let E=m.length-1;E>=0;E--)x=re.from(m[E].copy(x));let N=n.tr.step(new at(e.pos-m.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new pe(x,m.length,0),0,!0));t(N.scrollIntoView())}return!0}}return!1}function cf(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(Oe.create(e.doc,n<0?r.start(i):r.end(i)))),!0):!1}}const j1=cf(-1),H1=cf(1);function U1(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,a=r.blockRange(i),l=a&&Ia(a,n,e);return l?(o&&o(t.tr.wrap(a,l).scrollIntoView()),!0):!1}}function df(n,e=null){return function(t,o){let r=!1;for(let i=0;i<t.selection.ranges.length&&!r;i++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[i];t.doc.nodesBetween(a,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 a=0;a<t.selection.ranges.length;a++){let{$from:{pos:l},$to:{pos:c}}=t.selection.ranges[a];i.setBlockType(l,c,n,e)}o(i.scrollIntoView())}return!0}}function ja(...n){return function(e,t,o){for(let r=0;r<n.length;r++)if(n[r](e,t,o))return!0;return!1}}ja($a,Qu,ef),ja($a,nf,of),ja(rf,sf,af,V1),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function W1(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,a=r.blockRange(i);if(!a)return!1;let l=o?t.tr:null;return q1(l,a,n,e)?(o&&o(l.scrollIntoView()),!0):!1}}function q1(n,e,t,o=null){let r=!1,i=e,a=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=a.resolve(e.start-2);i=new wi(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new wi(e.$from,a.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=Ia(i,t,o,e);return l?(n&&G1(n,e,l,r,t),!0):!1}function G1(n,e,t,o,r){let i=re.empty;for(let u=t.length-1;u>=0;u--)i=re.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 pe(i,0,0),t.length,!0));let a=0;for(let u=0;u<t.length;u++)t[u].type==r&&(a=u+1);let l=t.length-a,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&&wn(n.doc,c,l)&&(n.split(c,l),c+=2*l),c+=d.child(u).nodeSize;return n}function K1(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,a=>a.childCount>0&&a.firstChild.type==n);return i?t?o.node(i.depth-1).type==n?J1(e,t,n,i):X1(e,t,i):!0:!1}}function J1(n,e,t,o){let r=n.tr,i=o.end,a=o.$to.end(o.depth);i<a&&(r.step(new at(i-1,a,i,a,new pe(re.from(t.create(null,o.parent.copy())),1,0),1,!0)),o=new wi(r.doc.resolve(o.$from.pos),r.doc.resolve(a),o.depth));const l=Oo(o);if(l==null)return!1;r.lift(o,l);let c=r.doc.resolve(r.mapping.map(i,-1)-1);return qn(r.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&r.join(c.pos),e(r.scrollIntoView()),!0}function X1(n,e,t){let o=n.tr,r=t.parent;for(let h=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(t.start),a=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,a.content.append(c?re.empty:re.from(r))))return!1;let f=i.pos,p=f+a.nodeSize;return o.step(new at(f-(l?1:0),p+(c?1:0),f+1,p-1,new pe((l?re.empty:re.from(r.copy(re.empty))).append(c?re.empty:re.from(r.copy(re.empty))),l?0:1,c?0:1),l?0:1)),e(o.scrollIntoView()),!0}function Y1(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 a=i.startIndex;if(a==0)return!1;let l=i.parent,c=l.child(a-1);if(c.type!=n)return!1;if(t){let d=c.lastChild&&c.lastChild.type==l.type,u=re.from(d?n.create():null),f=new pe(re.from(n.create(null,re.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 ft=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Vo=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Ha=null;const Sn=function(n,e,t){let o=Ha||(Ha=document.createRange());return o.setEnd(n,t??n.nodeValue.length),o.setStart(n,e||0),o},Q1=function(){Ha=null},go=function(n,e,t,o){return t&&(uf(n,e,t,o,-1)||uf(n,e,t,o,1))},Z1=/^(img|br|input|textarea|hr)$/i;function uf(n,e,t,o,r){for(var i;;){if(n==t&&e==o)return!0;if(e==(r<0?0:Ft(n))){let a=n.parentNode;if(!a||a.nodeType!=1||xr(n)||Z1.test(n.nodeName)||n.contentEditable=="false")return!1;e=ft(n)+(r<0?0:1),n=a}else if(n.nodeType==1){let a=n.childNodes[e+(r<0?-1:0)];if(a.nodeType==1&&a.contentEditable=="false")if(!((i=a.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=r;else return!1;else n=a,e=r<0?Ft(n):0}else return!1}}function Ft(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function e0(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=Ft(n)}else if(n.parentNode&&!xr(n))e=ft(n),n=n.parentNode;else return null}}function t0(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&&!xr(n))e=ft(n)+1,n=n.parentNode;else return null}}function n0(n,e,t){for(let o=e==0,r=e==Ft(n);o||r;){if(n==t)return!0;let i=ft(n);if(n=n.parentNode,!n)return!1;o=o&&i==0,r=r&&i==Ft(n)}}function xr(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 Oi=function(n){return n.focusNode&&go(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function yo(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function o0(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function r0(n,e,t){if(n.caretPositionFromPoint)try{let o=n.caretPositionFromPoint(e,t);if(o)return{node:o.offsetNode,offset:Math.min(Ft(o.offsetNode),o.offset)}}catch{}if(n.caretRangeFromPoint){let o=n.caretRangeFromPoint(e,t);if(o)return{node:o.startContainer,offset:Math.min(Ft(o.startContainer),o.startOffset)}}}const un=typeof navigator<"u"?navigator:null,ff=typeof document<"u"?document:null,Gn=un&&un.userAgent||"",Ua=/Edge\/(\d+)/.exec(Gn),pf=/MSIE \d/.exec(Gn),Wa=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Gn),At=!!(pf||Wa||Ua),Kn=pf?document.documentMode:Wa?+Wa[1]:Ua?+Ua[1]:0,jt=!At&&/gecko\/(\d+)/i.test(Gn);jt&&+(/Firefox\/(\d+)/.exec(Gn)||[0,0])[1];const qa=!At&&/Chrome\/(\d+)/.exec(Gn),lt=!!qa,hf=qa?+qa[1]:0,pt=!At&&!!un&&/Apple Computer/.test(un.vendor),Bo=pt&&(/Mobile\/\w+/.test(Gn)||!!un&&un.maxTouchPoints>2),Ht=Bo||(un?/Mac/.test(un.platform):!1),mf=un?/Win/.test(un.platform):!1,Cn=/Android \d/.test(Gn),kr=!!ff&&"webkitFontSmoothing"in ff.documentElement.style,i0=kr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function s0(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 Nn(n,e){return typeof n=="number"?n:n[e]}function a0(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 gf(n,e,t){let o=n.someProp("scrollThreshold")||0,r=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let a=t||n.dom;a;){if(a.nodeType!=1){a=Vo(a);continue}let l=a,c=l==i.body,d=c?s0(i):a0(l),u=0,f=0;if(e.top<d.top+Nn(o,"top")?f=-(d.top-e.top+Nn(r,"top")):e.bottom>d.bottom-Nn(o,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+Nn(r,"top")-d.top:e.bottom-d.bottom+Nn(r,"bottom")),e.left<d.left+Nn(o,"left")?u=-(d.left-e.left+Nn(r,"left")):e.right>d.right-Nn(o,"right")&&(u=e.right-d.right+Nn(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 g=l.scrollLeft-h,y=l.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let p=c?"fixed":getComputedStyle(a).position;if(/^(fixed|sticky)$/.test(p))break;a=p=="absolute"?a.offsetParent:Vo(a)}}function l0(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),o,r;for(let i=(e.left+e.right)/2,a=t+1;a<Math.min(innerHeight,e.bottom);a+=5){let l=n.root.elementFromPoint(i,a);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:yf(n.dom)}}function yf(n){let e=[],t=n.ownerDocument;for(let o=n;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),n!=t);o=Vo(o));return e}function c0({refDOM:n,refTop:e,stack:t}){let o=n?n.getBoundingClientRect().top:0;bf(t,o==0?0:o-e)}function bf(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 Fo=null;function d0(n){if(n.setActive)return n.setActive();if(Fo)return n.focus(Fo);let e=yf(n);n.focus(Fo==null?{get preventScroll(){return Fo={preventScroll:!0},!0}}:void 0),Fo||(Fo=!1,bf(e,0))}function xf(n,e){let t,o=2e8,r,i=0,a=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=Sn(u).getClientRects();else continue;for(let h=0;h<p.length;h++){let m=p[h];if(m.top<=a&&m.bottom>=l){a=Math.max(m.bottom,a),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<o){t=u,o=g,r=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(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?u0(t,r):!t||o&&t.nodeType==1?{node:n,offset:i}:xf(t,r)}function u0(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 a=Jn(o,1);if(a.top!=a.bottom&&Ga(e,a)){r={node:n,offset:i+(e.left>=(a.left+a.right)/2?1:0)};break}}return o.detach(),r||{node:n,offset:0}}function Ga(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function f0(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function p0(n,e,t){let{node:o,offset:r}=xf(e,t),i=-1;if(o.nodeType==1&&!o.firstChild){let a=o.getBoundingClientRect();i=a.left!=a.right&&t.left>(a.left+a.right)/2?1:-1}return n.docView.posFromDOM(o,r,i)}function h0(n,e,t,o){let r=-1;for(let i=e,a=!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)&&(!a&&c.left>o.left||c.top>o.top?r=l.posBefore:(!a&&c.right<o.left||c.bottom<o.top)&&(r=l.posAfter),a=!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 kf(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 a=n.childNodes[i];if(a.nodeType==1){let l=a.getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(Ga(e,d))return kf(a,e,d)}}if((i=(i+1)%o)==r)break}return n}function m0(n,e){let t=n.dom.ownerDocument,o,r=0,i=r0(t,e.left,e.top);i&&({node:o,offset:r}=i);let a=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!a||!n.dom.contains(a.nodeType!=1?a.parentNode:a)){let d=n.dom.getBoundingClientRect();if(!Ga(e,d)||(a=kf(n.dom,e,d),!a))return null}if(pt)for(let d=a;o&&d;d=Vo(d))d.draggable&&(o=void 0);if(a=f0(a,e),o){if(jt&&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;kr&&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=h0(n,o,r,e))}l==null&&(l=p0(n,a,e));let c=n.docView.nearestDesc(a,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function Ef(n){return n.top<n.bottom||n.left<n.right}function Jn(n,e){let t=n.getClientRects();if(t.length){let o=t[e<0?0:t.length-1];if(Ef(o))return o}return Array.prototype.find.call(t,Ef)||n.getBoundingClientRect()}const g0=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function wf(n,e,t){let{node:o,offset:r,atom:i}=n.docView.domFromPos(e,t<0?-1:1),a=kr||jt;if(o.nodeType==3)if(a&&(g0.test(o.nodeValue)||(t<0?!r:r==o.nodeValue.length))){let c=Jn(Sn(o,r,r),t);if(jt&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let d=Jn(Sn(o,r-1,r-1),-1);if(d.top==c.top){let u=Jn(Sn(o,r,r+1),-1);if(u.top!=c.top)return Er(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++,Er(Jn(Sn(o,c,d),u),u<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(t<0||r==Ft(o))){let c=o.childNodes[r-1];if(c.nodeType==1)return Ka(c.getBoundingClientRect(),!1)}if(i==null&&r<Ft(o)){let c=o.childNodes[r];if(c.nodeType==1)return Ka(c.getBoundingClientRect(),!0)}return Ka(o.getBoundingClientRect(),t>=0)}if(i==null&&r&&(t<0||r==Ft(o))){let c=o.childNodes[r-1],d=c.nodeType==3?Sn(c,Ft(c)-(a?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return Er(Jn(d,1),!1)}if(i==null&&r<Ft(o)){let c=o.childNodes[r];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?Sn(c,0,a?0:1):c.nodeType==1?c:null:null;if(d)return Er(Jn(d,-1),!0)}return Er(Jn(o.nodeType==3?Sn(o):o,-t),t>=0)}function Er(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 Ka(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 Sf(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 y0(n,e,t){let o=e.selection,r=t=="up"?o.$from:o.$to;return Sf(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 a=wf(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=Sn(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"?a.top-u.top>(u.bottom-a.top)*2:u.bottom-a.bottom>(a.bottom-u.top)*2))return!1}}return!0})}const b0=/[\u0590-\u08ac]/;function x0(n,e,t){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,a=r==o.parent.content.size,l=n.domSelection();return l?!b0.test(o.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:a:Sf(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:g}=n.domSelectionRange(),y=m&&!h.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==g;try{l.collapse(u,f),c&&(c!=u||d!=f)&&l.extend&&l.extend(c,d)}catch{}return p!=null&&(l.caretBidiLevel=p),y}):o.pos==o.start()||o.pos==o.end()}let Cf=null,Nf=null,vf=!1;function k0(n,e,t){return Cf==e&&Nf==t?vf:(Cf=e,Nf=t,vf=t=="up"||t=="down"?y0(n,e,t):x0(n,e,t))}const Ut=0,Tf=1,bo=2,fn=3;class wr{constructor(e,t,o,r){this.parent=e,this.children=t,this.dom=o,this.contentDOM=r,this.dirty=Ut,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,a;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((a=i.pmViewDesc)&&a.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(a)+a.size:this.posAtStart}else{let i,a;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((a=i.pmViewDesc)&&a.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(a):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>ft(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),a;if(i&&(!t||i.node))if(o&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==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 a=0;a<r.children.length;a++){let l=r.children[a];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 a=this.children[o],l=i+a.size;if(l>e||a instanceof Af){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 zf&&i.side>=0;o--);if(t<=0){let i,a=!0;for(;i=o?this.children[o-1]:null,!(!i||i.dom.parentNode==this.contentDOM);o--,a=!1);return i&&t&&a&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?ft(i.dom)+1:0}}else{let i,a=!0;for(;i=o<this.children.length?this.children[o]:null,!(!i||i.dom.parentNode==this.contentDOM);o++,a=!1);return i&&a&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?ft(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 a=o,l=0;;l++){let c=this.children[l],d=a+c.size;if(r==-1&&e<=d){let u=a+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=a;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=ft(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=ft(f.dom);break}t+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=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),a=Math.max(e,t);for(let h=0,m=0;h<this.children.length;h++){let g=this.children[h],y=m+g.size;if(i>m&&a<y)return g.setSelection(e-m-g.border,t-m-g.border,o,r);m=y}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((jt||pt)&&e==t){let{node:h,offset:m}=l;if(h.nodeType==3){if(f=!!(m&&h.nodeValue[m-1]==`
350
350
  `),f&&m==h.nodeValue.length)for(let g=h,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(l=c={node:y.parentNode,offset:ft(y)+1});break}let x=g.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let g=h.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(jt&&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&&pt)&&go(l.node,l.offset,u.anchorNode,u.anchorOffset)&&go(c.node,c.offset,u.focusNode,u.focusOffset))return;let p=!1;if((d.extend||e==t)&&!(f&&jt)){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],a=o+i.size;if(o==a?e<=a&&t>=o:e<a&&t>o){let l=o+i.border,c=a-i.border;if(e>=l&&t<=c){this.dirty=e==o||t==a?bo:Tf,e==l&&t==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=fn:i.markDirty(e-l,t-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?bo:fn}o=a}this.dirty=bo}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let o=e==1?bo:Tf;t.dirty<o&&(t.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class zf extends wr{constructor(e,t,o,r){let i,a=t.type.toDOM;if(typeof a=="function"&&(a=a(o,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let l=document.createElement("span");l.appendChild(a),a=l}a.contentEditable="false",a.classList.add("ProseMirror-widget")}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Ut&&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 E0 extends wr{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 xo extends wr{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],a=i&&i(t,r,o);return(!a||!a.dom)&&(a=ho.renderSpec(document,t.type.spec.toDOM(t,o),null,t.attrs)),new xo(e,t,a.dom,a.contentDOM||a.dom,a)}parseRule(){return this.dirty&fn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=fn&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Ut){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=Ut}}slice(e,t,o){let r=xo.create(this.parent,this.mark,!0,o),i=this.children,a=this.size;t<a&&(i=Xa(i,t,a,o)),e>0&&(i=Xa(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 Xn extends wr{constructor(e,t,o,r,i,a,l,c,d){super(e,[],i,a),this.node=t,this.outerDeco=o,this.innerDeco=r,this.nodeDOM=l}static create(e,t,o,r,i,a){let l=i.nodeViews[t.type.name],c,d=l&&l(t,i,()=>{if(!c)return a;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}=ho.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=Of(u,o,t),d?c=new w0(e,t,o,r,u,f||null,p,d,i,a+1):t.isText?new Di(e,t,o,r,u,p,i):new Xn(e,t,o,r,u,f||null,p,i,a+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=()=>re.empty)}return e}matchesNode(e,t,o){return this.dirty==Ut&&e.eq(this.node)&&Pi(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,a=i&&i.pos>-1?i:null,l=i&&i.pos<0,c=new C0(this,a&&a.node,e);T0(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==bo)&&(a&&this.protectLocalComposition(e,a),If(this.contentDOM,this.children,e),Bo&&z0(this.dom))}localCompositionInfo(e,t){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof Oe)||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 a=i.nodeValue,l=M0(this.node.content,a,o-t,r-t);return l<0?null:{node:i,pos:l,text:a}}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 a=new E0(this,i,t,r);e.input.compositionNodes.push(a),this.children=Xa(this.children,o,o+r.length,e,a)}update(e,t,o,r){return this.dirty==fn||!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=Ut}updateOuterDeco(e){if(Pi(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=_f(this.dom,this.nodeDOM,Ja(this.outerDeco,this.node,t),Ja(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 Mf(n,e,t,o,r){Of(o,e,n);let i=new Xn(void 0,n,e,t,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class Di extends Xn{constructor(e,t,o,r,i,a,l){super(e,t,o,r,i,null,a,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==fn||this.dirty!=Ut&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Ut||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=Ut,!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 Di(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=fn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Af extends wr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ut&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class w0 extends Xn{constructor(e,t,o,r,i,a,l,c,d,u){super(e,t,o,r,i,a,l,d,u),this.spec=c}update(e,t,o,r){if(this.dirty==fn)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 If(n,e,t){let o=n.firstChild,r=!1;for(let i=0;i<e.length;i++){let a=e[i],l=a.dom;if(l.parentNode==n){for(;l!=o;)o=Df(o),r=!0;o=o.nextSibling}else r=!0,n.insertBefore(l,o);if(a instanceof xo){let c=o?o.previousSibling:n.lastChild;If(a.contentDOM,a.children,t),o=c?c.nextSibling:n.firstChild}}for(;o;)o=Df(o),r=!0;r&&t.trackWrites==n&&(t.trackWrites=null)}const Sr=function(n){n&&(this.nodeName=n)};Sr.prototype=Object.create(null);const ko=[new Sr];function Ja(n,e,t){if(n.length==0)return ko;let o=t?ko[0]:new Sr,r=[o];for(let i=0;i<n.length;i++){let a=n[i].type.attrs;if(a){a.nodeName&&r.push(o=new Sr(a.nodeName));for(let l in a){let c=a[l];c!=null&&(t&&r.length==1&&r.push(o=new Sr(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 _f(n,e,t,o){if(t==ko&&o==ko)return e;let r=e;for(let i=0;i<o.length;i++){let a=o[i],l=t[i];if(i){let c;l&&l.nodeName==a.nodeName&&r!=n&&(c=r.parentNode)&&c.nodeName.toLowerCase()==a.nodeName||(c=document.createElement(a.nodeName),c.pmIsDeco=!0,c.appendChild(r),l=ko[0]),r=c}S0(r,l||ko[0],a)}return r}function S0(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 Of(n,e,t){return _f(n,n,ko,Ja(e,t,n.nodeType!=1))}function Pi(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 Df(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class C0{constructor(e,t,o){this.lock=t,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=N0(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,a=this.stack.length>>1,l=Math.min(a,e.length);for(;i<l&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=Ut,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<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[a])&&!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=xo.create(this.top,e[a],t,o);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,o,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,o))i=this.top.children.indexOf(a,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 a=this.top.children[r];return a.dirty==fn&&a.dom==a.contentDOM&&(a.dirty=bo),a.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,a){for(let l=this.index;l<this.top.children.length;l++){let c=this.top.children[l];if(c instanceof Xn){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!=fn&&Pi(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,a)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=bo,f.updateChildren(r,a+1),f.dirty=Ut),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,o,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Pi(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=Xn.create(this.top,t,o,r,i,a);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 a=Xn.create(this.top,e,t,o,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),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 zf(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 xo;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Di)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((pt||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 Af(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 N0(n,e){let t=e,o=t.children.length,r=n.childCount,i=new Map,a=[];e:for(;r>0;){let l;for(;;)if(o){let d=t.children[o-1];if(d instanceof xo)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),a.push(l)}}return{index:r,matched:i,matches:a.reverse()}}function v0(n,e){return n.type.side-e.type.side}function T0(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 a=0,l=[],c=null;for(let d=0;;){let u,f;for(;a<r.length&&r[a].to==i;){let y=r[a++];y.widget&&(u?(f||(f=[u])).push(y):u=y)}if(u)if(f){f.sort(v0);for(let y=0;y<f.length;y++)t(f[y],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 y=0;y<l.length;y++)l[y].to<=i&&l.splice(y--,1);for(;a<r.length&&r[a].from<=i&&r[a].to>i;)l.push(r[a++]);let m=i+p.nodeSize;if(p.isText){let y=m;a<r.length&&r[a].from<y&&(y=r[a].from);for(let x=0;x<l.length;x++)l[x].to<y&&(y=l[x].to);y<m&&(c=p.cut(y-i),p=p.cut(0,y-i),m=y,h=-1)}else for(;a<r.length&&r[a].to<m;)a++;let g=p.isInline&&!p.isLeaf?l.filter(y=>!y.inline):l.slice();o(p,g,e.forChild(i,p),h),i=m}}function z0(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 M0(n,e,t,o){for(let r=0,i=0;r<n.childCount&&i<=o;){let a=n.child(r++),l=i;if(i+=a.nodeSize,!a.isText)continue;let c=a.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 Xa(n,e,t,o,r){let i=[];for(let a=0,l=0;a<n.length;a++){let c=n[a],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 Ya(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,a=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(a<0)return null;let l=o.resolve(a),c,d;if(Oi(t)){for(c=a;r&&!r.node;)r=r.parent;let f=r.node;if(r&&f.isAtom&&Ne.isSelectable(f)&&r.parent&&!(f.isInline&&n0(t.focusNode,t.focusOffset,r.dom))){let p=r.posBefore;d=new Ne(a==p?l:o.resolve(p))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=a,p=a;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,a]=p==n.state.selection.anchor?[p,f]:[f,p],l=o.resolve(a)}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=Za(n,u,l,f)}return d}function Pf(n){return n.editable?n.hasFocus():jf(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function vn(n,e=!1){let t=n.state.selection;if(Vf(n,t),!!Pf(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&lt){let o=n.domSelectionRange(),r=n.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&go(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)I0(n);else{let{anchor:o,head:r}=t,i,a;Rf&&!(t instanceof Oe)&&(t.$from.parent.inlineContent||(i=Lf(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=Lf(n,t.to))),n.docView.setSelection(o,r,n,e),Rf&&(i&&$f(i),a&&$f(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&A0(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Rf=pt||lt&&hf<63;function Lf(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(pt&&r&&r.contentEditable=="false")return Qa(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return Qa(r);if(i)return Qa(i)}}function Qa(n){return n.contentEditable="true",pt&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function $f(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function A0(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(()=>{(!Pf(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function I0(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,o=t.nodeName=="IMG";o?e.collapse(t.parentNode,ft(t)+1):e.collapse(t,0),!o&&!n.state.selection.visible&&At&&Kn<=11&&(t.disabled=!0,t.disabled=!1)}function Vf(n,e){if(e instanceof Ne){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Bf(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Bf(n)}function Bf(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Za(n,e,t,o){return n.someProp("createSelectionBetween",r=>r(n,e,t))||Oe.between(e,t,o)}function Ff(n){return n.editable&&!n.hasFocus()?!1:jf(n)}function jf(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 _0(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return go(e.node,e.offset,t.anchorNode,t.anchorOffset)}function el(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 Yn(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Hf(n,e,t){let o=n.state.selection;if(o instanceof Oe)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 a=n.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return Yn(n,new Oe(o.$anchor,a))}else if(o.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let r=el(n.state,e);return r&&r instanceof Ne?Yn(n,r):!1}else if(!(Ht&&t.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,a;if(!i||i.isText)return!1;let l=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(a=n.docView.descAt(l))&&!a.contentDOM?Ne.isSelectable(i)?Yn(n,new Ne(e<0?n.state.doc.resolve(r.pos-i.nodeSize):r)):kr?Yn(n,new Oe(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof Ne&&o.node.isInline)return Yn(n,new Oe(e>0?o.$to:o.$from));{let r=el(n.state,e);return r?Yn(n,r):!1}}}function Ri(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Cr(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function jo(n,e){return e<0?O0(n):D0(n)}function O0(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r,i,a=!1;for(jt&&t.nodeType==1&&o<Ri(t)&&Cr(t.childNodes[o],-1)&&(a=!0);;)if(o>0){if(t.nodeType!=1)break;{let l=t.childNodes[o-1];if(Cr(l,-1))r=t,i=--o;else if(l.nodeType==3)t=l,o=t.nodeValue.length;else break}}else{if(Uf(t))break;{let l=t.previousSibling;for(;l&&Cr(l,-1);)r=t.parentNode,i=ft(l),l=l.previousSibling;if(l)t=l,o=Ri(t);else{if(t=t.parentNode,t==n.dom)break;o=0}}}a?tl(n,t,o):r&&tl(n,r,i)}function D0(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r=Ri(t),i,a;for(;;)if(o<r){if(t.nodeType!=1)break;let l=t.childNodes[o];if(Cr(l,1))i=t,a=++o;else break}else{if(Uf(t))break;{let l=t.nextSibling;for(;l&&Cr(l,1);)i=l.parentNode,a=ft(l)+1,l=l.nextSibling;if(l)t=l,o=0,r=Ri(t);else{if(t=t.parentNode,t==n.dom)break;o=r=0}}}i&&tl(n,i,a)}function Uf(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function P0(n,e){for(;n&&e==n.childNodes.length&&!xr(n);)e=ft(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 R0(n,e){for(;n&&!e&&!xr(n);)e=ft(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 tl(n,e,t){if(e.nodeType!=3){let i,a;(a=P0(e,t))?(e=a,t=0):(i=R0(e,t))&&(e=i,t=i.nodeValue.length)}let o=n.domSelection();if(!o)return;if(Oi(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&&vn(n)},50)}function Wf(n,e){let t=n.state.doc.resolve(e);if(!(lt||mf)&&t.parent.inlineContent){let r=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),a=(i.top+i.bottom)/2;if(a>r.top&&a<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),a=(i.top+i.bottom)/2;if(a>r.top&&a<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 qf(n,e,t){let o=n.state.selection;if(o instanceof Oe&&!o.empty||t.indexOf("s")>-1||Ht&&t.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let a=el(n.state,e);if(a&&a instanceof Ne)return Yn(n,a)}if(!r.parent.inlineContent){let a=e<0?r:i,l=o instanceof Lt?Re.near(a,e):Re.findFrom(a,e);return l?Yn(n,l):!1}return!1}function Gf(n,e){if(!(n.state.selection instanceof Oe))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 a=n.state.tr;return e<0?a.delete(t.pos-i.nodeSize,t.pos):a.delete(t.pos,t.pos+i.nodeSize),n.dispatch(a),!0}return!1}function Kf(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function L0(n){if(!pt||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;Kf(n,o,"true"),setTimeout(()=>Kf(n,o,"false"),20)}return!1}function $0(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function V0(n,e){let t=e.keyCode,o=$0(e);if(t==8||Ht&&t==72&&o=="c")return Gf(n,-1)||jo(n,-1);if(t==46&&!e.shiftKey||Ht&&t==68&&o=="c")return Gf(n,1)||jo(n,1);if(t==13||t==27)return!0;if(t==37||Ht&&t==66&&o=="c"){let r=t==37?Wf(n,n.state.selection.from)=="ltr"?-1:1:-1;return Hf(n,r,o)||jo(n,r)}else if(t==39||Ht&&t==70&&o=="c"){let r=t==39?Wf(n,n.state.selection.from)=="ltr"?1:-1:1;return Hf(n,r,o)||jo(n,r)}else{if(t==38||Ht&&t==80&&o=="c")return qf(n,-1,o)||jo(n,-1);if(t==40||Ht&&t==78&&o=="c")return L0(n)||qf(n,1,o)||jo(n,1);if(o==(Ht?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function nl(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 a=n.someProp("clipboardSerializer")||ho.fromSchema(n.state.schema),l=np(),c=l.createElement("div");c.appendChild(a.serializeFragment(o,{document:l}));let d=c.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=ep[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
351
 
352
352
  `);return{dom:c,text:p,slice:e}}function Jf(n,e,t,o,r){let i=r.parent.type.spec.code,a,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 pe(re.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=ho.fromSchema(h);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=a.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(h.text(g,p)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),a=H0(t),kr&&U0(a);let d=a&&a.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=a.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;a=p}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||fr.fromSchema(n.state.schema)).parseSlice(a,{preserveWhitespace:!!(c||u),context:r,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!B0.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)l=W0(Zf(l,+u[1],+u[2]),u[4]);else if(l=pe.maxOpen(F0(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=Zf(l,f,p)}return n.someProp("transformPasted",f=>{l=f(l,n,c)}),l}const B0=/^(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 F0(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,a=[];if(n.forEach(l=>{if(!a)return;let c=r.findWrapping(l.type),d;if(!c)return a=null;if(d=a.length&&i.length&&Yf(c,i,l,a[a.length-1],0))a[a.length-1]=d;else{a.length&&(a[a.length-1]=Qf(a[a.length-1],i.length));let u=Xf(l,c);a.push(u),r=r.matchType(u.type),i=c}}),a)return re.from(a)}return n}function Xf(n,e,t=0){for(let o=e.length-1;o>=t;o--)n=e[o].create(null,re.from(n));return n}function Yf(n,e,t,o,r){if(r<n.length&&r<e.length&&n[r]==e[r]){let i=Yf(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(re.from(Xf(t,n,r+1))))}}function Qf(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Qf(n.lastChild,e-1)),o=n.contentMatchAt(n.childCount).fillBefore(re.empty,!0);return n.copy(t.append(o))}function ol(n,e,t,o,r,i){let a=e<0?n.firstChild:n.lastChild,l=a.content;return n.childCount>1&&(i=0),r<o-1&&(l=ol(l,e,t,o,r+1,i)),r>=t&&(l=e<0?a.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(re.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,a.copy(l))}function Zf(n,e,t){return e<n.openStart&&(n=new pe(ol(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new pe(ol(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const ep={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 tp=null;function np(){return tp||(tp=document.implementation.createHTMLDocument("title"))}let rl=null;function j0(n){let e=window.trustedTypes;return e?(rl||(rl=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),rl.createHTML(n)):n}function H0(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=np().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(n),r;if((r=o&&ep[o[1].toLowerCase()])&&(n=r.map(i=>"<"+i+">").join("")+n+r.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=j0(n),r)for(let i=0;i<r.length;i++)t=t.querySelector(r[i])||t;return t}function U0(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 W0(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:a}=n;for(let l=o.length-2;l>=0;l-=2){let c=t.nodes[o[l]];if(!c||c.hasRequiredAttrs())break;r=re.from(c.create(o[l+1],r)),i++,a++}return new pe(r,i,a)}const vt={},Tt={},q0={touchstart:!0,touchmove:!0};class G0{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 K0(n){for(let e in vt){let t=vt[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=o=>{X0(n,o)&&!sl(n,o)&&(n.editable||!(o.type in Tt))&&t(n,o)},q0[e]?{passive:!0}:void 0)}pt&&n.dom.addEventListener("input",()=>null),il(n)}function Qn(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function J0(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 il(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=o=>sl(n,o))})}function sl(n,e){return n.someProp("handleDOMEvents",t=>{let o=t[e.type];return o?o(n,e)||e.defaultPrevented:!1})}function X0(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 Y0(n,e){!sl(n,e)&&vt[e.type]&&(n.editable||!(e.type in Tt))&&vt[e.type](n,e)}Tt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!rp(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Cn&&lt&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Bo&&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,yo(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",o=>o(n,t))||V0(n,t)?t.preventDefault():Qn(n,"key")},Tt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},Tt.keypress=(n,e)=>{let t=e;if(rp(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ht&&t.metaKey)return;if(n.someProp("handleKeyPress",r=>r(n,t))){t.preventDefault();return}let o=n.state.selection;if(!(o instanceof Oe)||!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",a=>a(n,o.$from.pos,o.$to.pos,r,i))&&n.dispatch(i()),t.preventDefault()}};function Li(n){return{left:n.clientX,top:n.clientY}}function Q0(n,e){let t=e.x-n.clientX,o=e.y-n.clientY;return t*t+o*o<100}function al(n,e,t,o,r){if(o==-1)return!1;let i=n.state.doc.resolve(o);for(let a=i.depth+1;a>0;a--)if(n.someProp(e,l=>a>i.depth?l(n,t,i.nodeAfter,i.before(a),r,!0):l(n,t,i.node(a),i.before(a),r,!1)))return!0;return!1}function Ho(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 Z0(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),o=t.nodeAfter;return o&&o.isAtom&&Ne.isSelectable(o)?(Ho(n,new Ne(t)),!0):!1}function ex(n,e){if(e==-1)return!1;let t=n.state.selection,o,r;t instanceof Ne&&(o=t.node);let i=n.state.doc.resolve(e);for(let a=i.depth+1;a>0;a--){let l=a>i.depth?i.nodeAfter:i.node(a);if(Ne.isSelectable(l)){o&&t.$from.depth>0&&a>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?r=i.before(t.$from.depth):r=i.before(a);break}}return r!=null?(Ho(n,Ne.create(n.state.doc,r)),!0):!1}function tx(n,e,t,o,r){return al(n,"handleClickOn",e,t,o)||n.someProp("handleClick",i=>i(n,e,o))||(r?ex(n,t):Z0(n,t))}function nx(n,e,t,o){return al(n,"handleDoubleClickOn",e,t,o)||n.someProp("handleDoubleClick",r=>r(n,e,o))}function ox(n,e,t,o){return al(n,"handleTripleClickOn",e,t,o)||n.someProp("handleTripleClick",r=>r(n,e,o))||rx(n,t,o)}function rx(n,e,t){if(t.button!=0)return!1;let o=n.state.doc;if(e==-1)return o.inlineContent?(Ho(n,Oe.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let a=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(a.inlineContent)Ho(n,Oe.create(o,l+1,l+1+a.content.size));else if(Ne.isSelectable(a))Ho(n,Ne.create(o,l));else continue;return!0}}function ll(n){return $i(n)}const op=Ht?"metaKey":"ctrlKey";vt.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let o=ll(n),r=Date.now(),i="singleClick";r-n.input.lastClick.time<500&&Q0(t,n.input.lastClick)&&!t[op]&&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 a=n.posAtCoords(Li(t));a&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new ix(n,a,t,!!o)):(i=="doubleClick"?nx:ox)(n,a.pos,a.inside,t)?t.preventDefault():Qn(n,"pointer"))};class ix{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[op],this.allowDefault=o.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let u=e.state.doc.resolve(t.pos);i=u.parent,a=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 Ne&&d.from<=a&&d.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&jt&&!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)),Qn(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(()=>vn(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(Li(e))),this.updateAllowDefault(e),this.allowDefault||!t?Qn(this.view,"pointer"):tx(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||pt&&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)?(Ho(this.view,Re.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Qn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Qn(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)}}vt.touchstart=n=>{n.input.lastTouch=Date.now(),ll(n),Qn(n,"pointer")},vt.touchmove=n=>{n.input.lastTouch=Date.now(),Qn(n,"pointer")},vt.contextmenu=n=>ll(n);function rp(n,e){return n.composing?!0:pt&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const sx=Cn?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 Oe&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||lt&&mf&&ax(n)))n.markCursor=n.state.storedMarks||t.marks(),$i(n,!0),n.markCursor=null;else if($i(n,!e.selection.empty),jt&&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 a=i<0?r.lastChild:r.childNodes[i-1];if(!a)break;if(a.nodeType==3){let l=n.domSelection();l&&l.collapse(a,a.nodeValue.length);break}else r=a,i=-1}}n.input.composing=!0}ip(n,sx)};function ax(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++,ip(n,20))};function ip(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>$i(n),e))}function sp(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=cx());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function lx(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=e0(e.focusNode,e.focusOffset),o=t0(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 a=t.pmViewDesc;if(!(!a||!a.isText(t.nodeValue)))return o}}return t||o}function cx(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function $i(n,e=!1){if(!(Cn&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),sp(n),e||n.docView&&n.docView.dirty){let t=Ya(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 dx(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 Nr=At&&Kn<15||Bo&&i0<604;vt.copy=Tt.cut=(n,e)=>{let t=e,o=n.state.selection,r=t.type=="cut";if(o.empty)return;let i=Nr?null:t.clipboardData,a=o.content(),{dom:l,text:c}=nl(n,a);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",c)):dx(n,l),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ux(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function fx(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?vr(n,o.value,null,r,e):vr(n,o.textContent,o.innerHTML,r,e)},50)}function vr(n,e,t,o,r){let i=Jf(n,e,t,o,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,r,i||pe.empty)))return!0;if(!i)return!1;let a=ux(i),l=a?n.state.tr.replaceSelectionWith(a,o):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ap(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&&!Cn)return;let o=Nr?null:t.clipboardData,r=n.input.shiftKey&&n.input.lastKeyCode!=45;o&&vr(n,ap(o),o.getData("text/html"),r,t)?t.preventDefault():fx(n,t)};class lp{constructor(e,t,o){this.slice=e,this.move=t,this.node=o}}const px=Ht?"altKey":"ctrlKey";function cp(n,e){let t=n.someProp("dragCopies",o=>!o(e));return t??!e[px]}vt.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(Li(t)),a;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof Ne?r.to-1:r.to))){if(o&&o.mightDrag)a=Ne.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&&(a=Ne.create(n.state.doc,f.posBefore))}}let l=(a||n.state.selection).content(),{dom:c,text:d,slice:u}=nl(n,l);(!t.dataTransfer.files.length||!lt||hf>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Nr?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",Nr||t.dataTransfer.setData("text/plain",d),n.dragging=new lp(u,cp(n,t),a)},vt.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{hx(n,e,n.dragging)}finally{n.dragging=null}};function hx(n,e,t){if(!e.dataTransfer)return;let o=n.posAtCoords(Li(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=Jf(n,ap(e.dataTransfer),Nr?null:e.dataTransfer.getData("text/html"),!1,r);let a=!!(t&&cp(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||pe.empty,a))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?E1(n.state.doc,r.pos,i):r.pos;l==null&&(l=r.pos);let c=n.state.tr;if(a){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&&Ne.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new Ne(p));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,x)=>h=x),c.setSelection(Za(n,p,c.doc.resolve(h)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))}vt.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())&&vn(n)},20))},vt.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)},vt.beforeinput=(n,e)=>{if(lt&&Cn&&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,yo(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)vt[n]=Tt[n];function Tr(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 Vi{constructor(e,t){this.toDOM=e,this.spec=t||Eo,this.side=this.spec.side||0}map(e,t,o,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new sn(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof Vi&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Tr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Zn{constructor(e,t){this.attrs=e,this.spec=t||Eo}map(e,t,o,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-o,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=a?null:new sn(i,a,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Zn&&Tr(this.attrs,e.attrs)&&Tr(this.spec,e.spec)}static is(e){return e.type instanceof Zn}destroy(){}}class cl{constructor(e,t){this.attrs=e,this.spec=t||Eo}map(e,t,o,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new sn(i.pos-o,a.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 cl&&Tr(this.attrs,e.attrs)&&Tr(this.spec,e.spec)}destroy(){}}class sn{constructor(e,t,o){this.from=e,this.to=t,this.type=o}copy(e,t){return new sn(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 sn(e,e,new Vi(t,o))}static inline(e,t,o,r){return new sn(e,t,new Zn(o,r))}static node(e,t,o,r){return new sn(e,t,new cl(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Zn}get widget(){return this.type instanceof Vi}}const Uo=[],Eo={};class ct{constructor(e,t){this.local=e.length?e:Uo,this.children=t.length?t:Uo}static create(e,t){return t.length?Bi(t,e,0,Eo):yt}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 a=0;a<this.local.length;a++){let l=this.local[a];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let l=this.children[a]+1;this.children[a+2].findInner(e-l,t-l,o,r+l,i)}}map(e,t,o){return this==yt||e.maps.length==0?this:this.mapInner(e,t,0,0,o||Eo)}mapInner(e,t,o,r,i){let a;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,o,r);c&&c.type.valid(t,c)?(a||(a=[])).push(c):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?mx(this.children,a||[],e,t,o,r,i):a?new ct(a.sort(wo),Uo):yt}add(e,t){return t.length?this==yt?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=up(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,Bi(u,l,d+1,Eo)),i+=3}});let a=dp(i?fp(t):t,-o);for(let l=0;l<a.length;l++)a[l].type.valid(e,a[l])||a.splice(l--,1);return new ct(a.length?this.local.concat(a).sort(wo):this.local,r||this.children)}remove(e){return e.length==0||this==yt?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 a,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,(a||(a=[])).push(f));if(!a)continue;o==this.children&&(o=this.children.slice());let d=o[i+2].removeInner(a,l+1);d!=yt?o[i+2]=d:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,a;i<e.length;i++)if(a=e[i])for(let l=0;l<r.length;l++)r[l].eq(a,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):yt}forChild(e,t){if(this==yt)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,a=i+t.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<a&&c.to>i&&c.type instanceof Zn){let d=Math.max(i,c.from)-i,u=Math.min(a,c.to)-i;d<u&&(r||(r=[])).push(c.copy(d,u))}}if(r){let l=new ct(r.sort(wo),Uo);return o?new eo([l,o]):l}return o||yt}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 dl(this.localsInner(e))}localsInner(e){if(this==yt)return Uo;if(e.inlineContent||!this.local.some(Zn.is))return this.local;let t=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof Zn||t.push(this.local[o]);return t}forEachSet(e){e(this)}}ct.empty=new ct([],[]),ct.removeOverlap=dl;const yt=ct.empty;class eo{constructor(e){this.members=e}map(e,t){const o=this.members.map(r=>r.map(e,t,Eo));return eo.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!=yt&&(i instanceof eo?o=o.concat(i.members):o.push(i))}return eo.from(o)}eq(e){if(!(e instanceof eo)||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 a=0;a<i.length;a++)t.push(i[a])}}return t?dl(o?t:t.sort(wo)):Uo}static from(e){switch(e.length){case 0:return yt;case 1:return e[0];default:return new eo(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 mx(n,e,t,o,r,i,a){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,g)=>{let y=g-m-(h-p);for(let x=0;x<l.length;x+=3){let C=l[x+1];if(C<0||p>C+u-f)continue;let E=l[x]+u-f;h>=E?l[x+1]=p<=E?-2:-1:p>=u&&y&&(l[x]+=y,l[x+1]+=y)}f+=y}),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:g}=o.content.findIndex(f),y=o.maybeChild(m);if(y&&g==f&&g+y.nodeSize==h){let x=l[d+2].mapInner(t,y,u+1,n[d]+i+1,a);x!=yt?(l[d]=f,l[d+1]=h,l[d+2]=x):(l[d+1]=-2,c=!0)}else c=!0}if(c){let d=gx(l,n,e,t,r,i,a),u=Bi(d,o,0,a);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(wo),l)}function dp(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 sn(r.from+e,r.to+e,r.type))}return t}function gx(n,e,t,o,r,i,a){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):a.onRemove&&a.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 up(n,e,t){if(e.isLeaf)return null;let o=t+e.nodeSize,r=null;for(let i=0,a;i<n.length;i++)(a=n[i])&&a.from>t&&a.to<o&&((r||(r=[])).push(a),n[i]=null);return r}function fp(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Bi(n,e,t,o){let r=[],i=!1;e.forEach((l,c)=>{let d=up(n,l,c+t);if(d){i=!0;let u=Bi(d,l,t+c+1,o);u!=yt&&r.push(c,c+l.nodeSize,u)}});let a=dp(i?fp(n):n,-t).sort(wo);for(let l=0;l<a.length;l++)a[l].type.valid(e,a[l])||(o.onRemove&&o.onRemove(a[l].spec),a.splice(l--,1));return a.length||r.length?new ct(a,r):yt}function wo(n,e){return n.from-e.from||n.to-e.to}function dl(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),pp(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),pp(e,r,o.copy(i.from,o.to)));break}}}return e}function pp(n,e,t){for(;e<n.length&&wo(t,n[e])>0;)e++;n.splice(e,0,t)}function ul(n){let e=[];return n.someProp("decorations",t=>{let o=t(n.state);o&&o!=yt&&e.push(o)}),n.cursorWrapper&&e.push(ct.create(n.state.doc,[n.cursorWrapper.deco])),eo.from(e)}const yx={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},bx=At&&Kn<=11;class xx{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 kx{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new xx,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&&Kn<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():pt&&e.composing&&o.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),bx&&(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,yx)),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(Ff(this.view)){if(this.suppressingSelectionUpdates)return vn(this.view);if(At&&Kn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&go(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=Vo(i))t.add(i);for(let i=e.anchorNode;i;i=Vo(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)&&Ff(e)&&!this.ignoreSelectionChange(o),i=-1,a=-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),a=a<0?f.to:Math.max(f.to,a),f.typeOver&&(l=!0))}if(jt&&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||Sx(e,f)!=h)&&p.remove()}}}else if((lt||pt)&&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&&Oi(o)&&(d=Ya(e))&&d.eq(Re.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,vn(e),this.currentSelection.set(o),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),Ex(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Cx(e,c)),this.handleDOMChange(i,a,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||vn(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&&Kn<=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 a=r&&r.parentNode==e.target?ft(r)+1:0,l=o.localPosFromDOM(e.target,a,-1),c=i&&i.parentNode==e.target?ft(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 hp=new WeakMap,mp=!1;function Ex(n){if(!hp.has(n)&&(hp.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=jt,mp)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."),mp=!0}}function gp(n,e){let t=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,a=n.domAtPos(n.state.selection.anchor);return go(a.node,a.offset,r,i)&&([t,o,r,i]=[r,i,t,o]),{anchorNode:t,anchorOffset:o,focusNode:r,focusOffset:i}}function wx(n,e){if(e.getComposedRanges){let r=e.getComposedRanges(n.root)[0];if(r)return gp(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?gp(n,t):null}function Sx(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 Cx(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 a=i.nextSibling;for(;a&&a.nodeName!="TD"&&a.nodeName!="TH";)a=a.nextSibling;if(a){let l=a;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 Nx(n,e,t){let{node:o,fromOffset:r,toOffset:i,from:a,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}],Oi(c)||d.push({node:c.focusNode,offset:c.focusOffset})),lt&&n.input.lastKeyCode===8)for(let y=i;y>r;y--){let x=o.childNodes[y-1],C=x.pmViewDesc;if(x.nodeName=="BR"&&!C){i=y;break}if(!C||C.size)break}let f=n.state.doc,p=n.someProp("domParser")||fr.fromSchema(n.state.schema),h=f.resolve(a),m=null,g=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:vx,context:h});if(d&&d[0].pos!=null){let y=d[0].pos,x=d[1]&&d[1].pos;x==null&&(x=y),m={anchor:y+a,head:x+a}}return{doc:g,sel:m,from:a,to:l}}function vx(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(pt&&/^(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||pt&&/^(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 Tx=/^(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 zx(n,e,t,o,r){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let k=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,w=Ya(n,k);if(w&&!n.state.selection.eq(w)){if(lt&&Cn&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",R=>R(n,yo(13,"Enter"))))return;let b=n.state.tr.setSelection(w);k=="pointer"?b.setMeta("pointer",!0):k=="key"&&b.scrollIntoView(),i&&b.setMeta("composition",i),n.dispatch(b)}return}let a=n.state.doc.resolve(e),l=a.sharedDepth(t);e=a.before(l+1),t=n.state.doc.resolve(t).after(l+1);let c=n.state.selection,d=Nx(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=Ix(f.content,d.doc.content,d.from,p,h);if(m&&n.input.domChangeCount++,(Bo&&n.input.lastIOSEnter>Date.now()-225||Cn)&&r.some(k=>k.nodeType==1&&!Tx.test(k.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",k=>k(n,yo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof Oe&&!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 k=yp(n,n.state.doc,d.sel);if(k&&!k.eq(n.state.selection)){let w=n.state.tr.setSelection(k);i&&w.setMeta("composition",i),n.dispatch(w)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof Oe&&(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&&Kn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=d.doc.resolveNoCache(m.start-d.from),y=d.doc.resolveNoCache(m.endB-d.from),x=u.resolve(m.start),C=g.sameParent(y)&&g.parent.inlineContent&&x.end()>=m.endA;if((Bo&&n.input.lastIOSEnter>Date.now()-225&&(!C||r.some(k=>k.nodeName=="DIV"||k.nodeName=="P"))||!C&&g.pos<d.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(d.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",k=>k(n,yo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&Ax(u,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",k=>k(n,yo(8,"Backspace")))){Cn&&lt&&n.domObserver.suppressSelectionUpdates();return}lt&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),Cn&&!C&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,y=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{n.someProp("handleKeyDown",function(k){return k(n,yo(13,"Enter"))})},20));let E=m.start,v=m.endA,A=k=>{let w=k||n.state.tr.replace(E,v,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let b=yp(n,w.doc,d.sel);b&&!(lt&&n.composing&&b.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(b.head==E||b.head==w.mapping.map(v)-1)||At&&b.empty&&b.head==E)&&w.setSelection(b)}return i&&w.setMeta("composition",i),w.scrollIntoView()},M;if(C)if(g.pos==y.pos){At&&Kn<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>vn(n),20));let k=A(n.state.tr.delete(E,v)),w=u.resolve(m.start).marksAcross(u.resolve(m.endA));w&&k.ensureMarks(w),n.dispatch(k)}else if(m.endA==m.endB&&(M=Mx(g.parent.content.cut(g.parentOffset,y.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start())))){let k=A(n.state.tr);M.type=="add"?k.addMark(E,v,M.mark):k.removeMark(E,v,M.mark),n.dispatch(k)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let k=g.parent.textBetween(g.parentOffset,y.parentOffset),w=()=>A(n.state.tr.insertText(k,E,v));n.someProp("handleTextInput",b=>b(n,E,v,k,w))||n.dispatch(w())}else n.dispatch(A());else n.dispatch(A())}function yp(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Za(n,e.resolve(t.anchor),e.resolve(t.head))}function Mx(n,e){let t=n.firstChild.marks,o=e.firstChild.marks,r=t,i=o,a,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],a="add",c=u=>u.mark(l.addToSet(u.marks));else if(r.length==0&&i.length==1)l=i[0],a="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(re.from(d).eq(n))return{mark:l,type:a}}function Ax(n,e,t,o,r){if(t-e<=r.pos-o.pos||fl(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 a=n.resolve(fl(i,!0,!0));return!a.parent.isTextblock||a.pos>t||fl(a,!0,!1)<t?!1:o.parent.content.cut(o.parentOffset).eq(a.parent.content)}function fl(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 Ix(n,e,t,o,r){let i=n.findDiffStart(e,t);if(i==null)return null;let{a,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(r=="end"){let c=Math.max(0,i-Math.min(a,l));o-=a+c-i}if(a<i&&n.size<e.size){let c=o<=i&&o>=a?i-o:0;i-=c,i&&i<e.size&&bp(e.textBetween(i-1,i+1))&&(i+=c?1:-1),l=i+(l-a),a=i}else if(l<i){let c=o<=i&&o>=l?i-o:0;i-=c,i&&i<n.size&&bp(n.textBetween(i-1,i+1))&&(i+=c?1:-1),a=i+(a-l),l=i}return{start:i,endA:a,endB:l}}function bp(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 xp{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 G0,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Cp),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=wp(this),Ep(this),this.nodeViews=Sp(this),this.docView=Mf(this.state.doc,kp(this),ul(this),this.dom,this),this.domObserver=new kx(this,(o,r,i,a)=>zx(this,o,r,i,a)),this.domObserver.start(),K0(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&&il(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Cp),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,a=!1;e.storedMarks&&this.composing&&(sp(this),a=!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=Sp(this);Ox(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&il(this),this.editable=wp(this),Ep(this);let c=ul(this),d=kp(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))&&(a=!0);let p=u=="preserve"&&a&&this.dom.style.overflowAnchor==null&&l0(this);if(a){this.domObserver.stop();let h=f&&(At||lt)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&_x(r.selection,e.selection);if(f){let m=lt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=lx(this)),(i||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=Mf(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())&&_0(this))?vn(this,h):(Vf(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&&c0(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 Ne){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&gf(this,t.getBoundingClientRect(),e)}else gf(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 lp(e.slice,e.move,r<0?void 0:Ne.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 a=0;a<this.directPlugins.length;a++){let l=this.directPlugins[a].props[e];if(l!=null&&(r=t?t(l):l))return r}let i=this.state.plugins;if(i)for(let a=0;a<i.length;a++){let l=i[a].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&&d0(this.dom),vn(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 m0(this,e)}coordsAtPos(e,t=1){return wf(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 k0(this,t||this.state,e)}pasteHTML(e,t){return vr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return vr(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return nl(this,e)}destroy(){this.docView&&(J0(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ul(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Q1())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Y0(this,e)}domSelectionRange(){let e=this.domSelection();return e?pt&&this.root.nodeType===11&&o0(this.dom.ownerDocument)==this.dom&&wx(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}xp.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function kp(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"),[sn.node(0,n.state.doc.content.size,e)]}function Ep(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:sn.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function wp(n){return!n.someProp("editable",e=>e(n.state)===!1)}function _x(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 Sp(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 Ox(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 Cp(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 to={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:"'"},Fi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Dx=typeof navigator<"u"&&/Mac/.test(navigator.platform),Px=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ht=0;ht<10;ht++)to[48+ht]=to[96+ht]=String(ht);for(var ht=1;ht<=24;ht++)to[ht+111]="F"+ht;for(var ht=65;ht<=90;ht++)to[ht]=String.fromCharCode(ht+32),Fi[ht]=String.fromCharCode(ht);for(var pl in to)Fi.hasOwnProperty(pl)||(Fi[pl]=to[pl]);function Rx(n){var e=Dx&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Px&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Fi:to)[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 Lx=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),$x=typeof navigator<"u"&&/Win/.test(navigator.platform);function Vx(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let o,r,i,a;for(let l=0;l<e.length-1;l++){let c=e[l];if(/^(cmd|meta|m)$/i.test(c))a=!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))Lx?a=!0:r=!0;else throw new Error("Unrecognized modifier name: "+c)}return o&&(t="Alt-"+t),r&&(t="Ctrl-"+t),a&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function Bx(n){let e=Object.create(null);for(let t in n)e[Vx(t)]=n[t];return e}function hl(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 Fx(n){return new Mt({props:{handleKeyDown:jx(n)}})}function jx(n){let e=Bx(n);return function(t,o){let r=Rx(o),i,a=e[hl(r,o)];if(a&&a(t.state,t.dispatch,t))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[hl(r,o,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!($x&&o.ctrlKey&&o.altKey)&&(i=to[o.keyCode])&&i!=r){let l=e[hl(i,o)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var Hx=Object.defineProperty,ml=(n,e)=>{for(var t in e)Hx(n,t,{get:e[t],enumerable:!0})};function ji(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 Hi=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(([a,l])=>[a,(...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,a=[],l=!!n,c=n||r.tr,d=()=>(!l&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(c),a.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(t).map(([f,p])=>[f,(...m)=>{const g=this.buildProps(c,e),y=p(...m)(g);return a.push(y),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,a={tr:n,editor:o,view:i,state:ji({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)(a)]))}};return a}},Np={};ml(Np,{blur:()=>Ux,clearContent:()=>Wx,clearNodes:()=>qx,command:()=>Gx,createParagraphNear:()=>Kx,cut:()=>Jx,deleteCurrentNode:()=>Xx,deleteNode:()=>Yx,deleteRange:()=>Qx,deleteSelection:()=>Zx,enter:()=>ek,exitCode:()=>tk,extendMarkRange:()=>nk,first:()=>ok,focus:()=>ik,forEach:()=>sk,insertContent:()=>ak,insertContentAt:()=>dk,joinBackward:()=>pk,joinDown:()=>fk,joinForward:()=>hk,joinItemBackward:()=>mk,joinItemForward:()=>gk,joinTextblockBackward:()=>yk,joinTextblockForward:()=>bk,joinUp:()=>uk,keyboardShortcut:()=>kk,lift:()=>Ek,liftEmptyBlock:()=>wk,liftListItem:()=>Sk,newlineInCode:()=>Ck,resetAttributes:()=>Nk,scrollIntoView:()=>vk,selectAll:()=>Tk,selectNodeBackward:()=>zk,selectNodeForward:()=>Mk,selectParentNode:()=>Ak,selectTextblockEnd:()=>Ik,selectTextblockStart:()=>_k,setContent:()=>Ok,setMark:()=>Zk,setMeta:()=>eE,setNode:()=>tE,setNodeSelection:()=>nE,setTextDirection:()=>oE,setTextSelection:()=>rE,sinkListItem:()=>iE,splitBlock:()=>sE,splitListItem:()=>aE,toggleList:()=>lE,toggleMark:()=>cE,toggleNode:()=>dE,toggleWrap:()=>uE,undoInputRule:()=>fE,unsetAllMarks:()=>pE,unsetMark:()=>hE,unsetTextDirection:()=>mE,updateAttributes:()=>gE,wrapIn:()=>yE,wrapInList:()=>bE});var Ux=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),Wx=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),qx=()=>({state:n,tr:e,dispatch:t})=>{const{selection:o}=e,{ranges:r}=o;return t&&r.forEach(({$from:i,$to:a})=>{n.doc.nodesBetween(i.pos,a.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=Oo(h);if(l.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},Gx=n=>e=>n(e),Kx=()=>({state:n,dispatch:e})=>sf(n,e),Jx=(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 a=o.mapping.map(e);return o.insert(a,i.content),o.setSelection(new Oe(o.doc.resolve(Math.max(a-1,0)))),!0},Xx=()=>({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 et(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 Yx=n=>({tr:e,state:t,dispatch:o})=>{const r=et(n,t.schema),i=e.selection.$anchor;for(let a=i.depth;a>0;a-=1)if(i.node(a).type===r){if(o){const c=i.before(a),d=i.after(a);e.delete(c,d).scrollIntoView()}return!0}return!1},Qx=n=>({tr:e,dispatch:t})=>{const{from:o,to:r}=n;return t&&e.delete(o,r),!0},Zx=()=>({state:n,dispatch:e})=>$a(n,e),ek=()=>({commands:n})=>n.keyboardShortcut("Enter"),tk=()=>({state:n,dispatch:e})=>L1(n,e);function gl(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Ui(n,e,t={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>t.strict?e[r]===n[r]:gl(e[r])?e[r].test(n[r]):e[r]===n[r]):!0}function vp(n,e,t={}){return n.find(o=>o.type===e&&Ui(Object.fromEntries(Object.keys(t).map(r=>[r,o.attrs[r]])),t))}function Tp(n,e,t={}){return!!vp(n,e,t)}function yl(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),!vp([...r.node.marks],e,t)))return;let a=r.index,l=n.start()+r.offset,c=a+1,d=l+r.node.nodeSize;for(;a>0&&Tp([...n.parent.child(a-1).marks],e,t);)a-=1,l-=n.parent.child(a).nodeSize;for(;c<n.parent.childCount&&Tp([...n.parent.child(c).marks],e,t);)d+=n.parent.child(c).nodeSize,c+=1;return{from:l,to:d}}function Tn(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 nk=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const i=Tn(n,o.schema),{doc:a,selection:l}=t,{$from:c,from:d,to:u}=l;if(r){const f=yl(c,i,e);if(f&&f.from<=d&&f.to>=u){const p=Oe.create(a,f.from,f.to);t.setSelection(p)}}return!0},ok=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 zp(n){return n instanceof Oe}function So(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Mp(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"?Oe.create(n,So(0,r,i),So(n.content.size,r,i)):Oe.create(n,So(e,r,i),So(e,r,i))}function Ap(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Wi(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function rk(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var ik=(n=null,e={})=>({editor:t,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const a=()=>{(Wi()||Ap())&&o.dom.focus(),rk()&&!Wi()&&!Ap()&&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&&!zp(t.state.selection))return a(),!0;const l=Mp(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),a()),!0},sk=(n,e)=>t=>n.every((o,r)=>e(o,{...t,index:r})),ak=(n,e)=>({tr:t,commands:o})=>o.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Ip=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&&Ip(o)}return n};function qi(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 Ip(t)}function zr(n,e,t){if(n instanceof Hn||n instanceof re)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 re.fromArray(n.map(l=>e.nodeFromJSON(l)));const a=e.nodeFromJSON(n);return t.errorOnInvalidContent&&a.check(),a}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),zr("",e,t)}if(r){if(t.errorOnInvalidContent){let a=!1,l="";const c=new bu({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=>(a=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(t.slice?fr.fromSchema(c).parseSlice(qi(n),t.parseOptions):fr.fromSchema(c).parse(qi(n),t.parseOptions),t.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=fr.fromSchema(e);return t.slice?i.parseSlice(qi(n),t.parseOptions).content:i.parse(qi(n),t.parseOptions)}return zr("",e,t)}function lk(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 a=0;i.forEach((l,c,d,u)=>{a===0&&(a=u)}),n.setSelection(Re.near(n.doc.resolve(a),t))}var ck=n=>!("type"in n),dk=(n,e,t)=>({tr:o,dispatch:r,editor:i})=>{var a;if(r){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const c=y=>{i.emit("contentError",{editor:i,error:y,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{zr(e,i.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(y){c(y)}try{l=zr(e,i.schema,{parseOptions:d,errorOnInvalidContent:(a=t.errorOnInvalidContent)!=null?a:i.options.enableContentCheck})}catch(y){return c(y),!1}let{from:u,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,h=!0;if((ck(l)?l:[l]).forEach(y=>{y.check(),p=p?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),u===f&&h){const{parent:y}=o.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,f+=1)}let g;if(p){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof re){let y="";e.forEach(x=>{x.text&&(y+=x.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;o.insertText(g,u,f)}else{g=l;const y=o.doc.resolve(u),x=y.node(),C=y.parentOffset===0,E=x.isText||x.isTextblock,v=x.content.size>0;C&&E&&v&&(u=Math.max(0,u-1)),o.replaceWith(u,f,g)}t.updateSelection&&lk(o,o.steps.length-1,-1),t.applyInputRules&&o.setMeta("applyInputRules",{from:u,text:g}),t.applyPasteRules&&o.setMeta("applyPasteRules",{from:u,text:g})}return!0},uk=()=>({state:n,dispatch:e})=>D1(n,e),fk=()=>({state:n,dispatch:e})=>P1(n,e),pk=()=>({state:n,dispatch:e})=>Qu(n,e),hk=()=>({state:n,dispatch:e})=>nf(n,e),mk=()=>({state:n,dispatch:e,tr:t})=>{try{const o=Mi(n.doc,n.selection.$from.pos,-1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},gk=()=>({state:n,dispatch:e,tr:t})=>{try{const o=Mi(n.doc,n.selection.$from.pos,1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},yk=()=>({state:n,dispatch:e})=>_1(n,e),bk=()=>({state:n,dispatch:e})=>O1(n,e);function _p(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function xk(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let o,r,i,a;for(let l=0;l<e.length-1;l+=1){const c=e[l];if(/^(cmd|meta|m)$/i.test(c))a=!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))Wi()||_p()?a=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return o&&(t=`Alt-${t}`),r&&(t=`Ctrl-${t}`),a&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}var kk=n=>({editor:e,view:t,tr:o,dispatch:r})=>{const i=xk(n).split(/-(?!$)/),a=i.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,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 no(n,e,t={}){const{from:o,to:r,empty:i}=n.selection,a=e?et(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=>a?a.name===f.node.type.name:!0).filter(f=>Ui(f.node.attrs,t,{strict:!1}));return i?!!d.length:d.reduce((f,p)=>f+p.to-p.from,0)>=c}var Ek=(n,e={})=>({state:t,dispatch:o})=>{const r=et(n,t.schema);return no(t,r,e)?R1(t,o):!1},wk=()=>({state:n,dispatch:e})=>af(n,e),Sk=n=>({state:e,dispatch:t})=>{const o=et(n,e.schema);return K1(o)(e,t)},Ck=()=>({state:n,dispatch:e})=>rf(n,e);function Gi(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Op(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 Nk=(n,e)=>({tr:t,state:o,dispatch:r})=>{let i=null,a=null;const l=Gi(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=et(n,o.schema)),l==="mark"&&(a=Tn(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,Op(u.attrs,e))),a&&u.marks.length&&u.marks.forEach(p=>{a===p.type&&(c=!0,r&&t.addMark(f,f+u.nodeSize,a.create(Op(p.attrs,e))))})})}),c},vk=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Tk=()=>({tr:n,dispatch:e})=>{if(e){const t=new Lt(n.doc);n.setSelection(t)}return!0},zk=()=>({state:n,dispatch:e})=>ef(n,e),Mk=()=>({state:n,dispatch:e})=>of(n,e),Ak=()=>({state:n,dispatch:e})=>B1(n,e),Ik=()=>({state:n,dispatch:e})=>H1(n,e),_k=()=>({state:n,dispatch:e})=>j1(n,e);function bl(n,e,t={},o={}){return zr(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:o.errorOnInvalidContent})}var Ok=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:o={}}={})=>({editor:r,tr:i,dispatch:a,commands:l})=>{const{doc:c}=i;if(o.preserveWhitespace!=="full"){const d=bl(n,r.schema,o,{errorOnInvalidContent:e??r.options.enableContentCheck});return a&&i.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!t),!0}return a&&i.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:c.content.size},n,{parseOptions:o,errorOnInvalidContent:e??r.options.enableContentCheck})};function Dp(n,e){const t=Tn(e,n.schema),{from:o,to:r,empty:i}=n.selection,a=[];i?(n.storedMarks&&a.push(...n.storedMarks),a.push(...n.selection.$head.marks())):n.doc.nodesBetween(o,r,c=>{a.push(...c.marks)});const l=a.find(c=>c.type.name===t.name);return l?{...l.attrs}:{}}function Pp(n,e){const t=new ju(n);return e.forEach(o=>{o.steps.forEach(r=>{t.step(r)})}),t}function Dk(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 Pk(n,e,t){const o=[];return n.nodesBetween(e.from,e.to,(r,i)=>{t(r)&&o.push({node:r,pos:i})}),o}function Rk(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 Ki(n){return e=>Rk(e.$from,n)}function Ee(n,e,t){return n.config[e]===void 0&&n.parent?Ee(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?Ee(n.parent,e,t):null}):n.config[e]}function xl(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},o=Ee(e,"addExtensions",t);return o?[e,...xl(o())]:e}).flat(10)}function kl(n,e){const t=ho.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function Rp(n){return typeof n=="function"}function je(n,e=void 0,...t){return Rp(n)?e?n.bind(e)(...t):n(...t):n}function Lk(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Wo(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 Lp(n){const e=[],{nodeExtensions:t,markExtensions:o}=Wo(n),r=[...t,...o],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(a=>{const l={name:a.name,options:a.options,storage:a.storage,extensions:r},c=Ee(a,"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(a=>{const l={name:a.name,options:a.options,storage:a.storage},c=Ee(a,"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:a.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 Mr(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 $k(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function $p(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,a)=>{const l=a.attribute.parseHTML?a.attribute.parseHTML(t):$k(t.getAttribute(a.name));return l==null?i:{...i,[a.name]:l}},{});return{...o,...r}}}}function Vp(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Lk(t)?!1:t!=null))}function Bp(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 Vk(n,e){var t;const o=Lp(n),{nodeExtensions:r,markExtensions:i}=Wo(n),a=(t=r.find(d=>Ee(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,C)=>{const E=Ee(C,"extendNodeSchema",f);return{...x,...E?E(d):{}}},{}),h=Vp({...p,content:je(Ee(d,"content",f)),marks:je(Ee(d,"marks",f)),group:je(Ee(d,"group",f)),inline:je(Ee(d,"inline",f)),atom:je(Ee(d,"atom",f)),selectable:je(Ee(d,"selectable",f)),draggable:je(Ee(d,"draggable",f)),code:je(Ee(d,"code",f)),whitespace:je(Ee(d,"whitespace",f)),linebreakReplacement:je(Ee(d,"linebreakReplacement",f)),defining:je(Ee(d,"defining",f)),isolating:je(Ee(d,"isolating",f)),attrs:Object.fromEntries(u.map(Bp))}),m=je(Ee(d,"parseHTML",f));m&&(h.parseDOM=m.map(x=>$p(x,u)));const g=Ee(d,"renderHTML",f);g&&(h.toDOM=x=>g({node:x,HTMLAttributes:Mr(x,u)}));const y=Ee(d,"renderText",f);return y&&(h.toText=y),[d.name,h]})),c=Object.fromEntries(i.map(d=>{const u=o.filter(y=>y.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=n.reduce((y,x)=>{const C=Ee(x,"extendMarkSchema",f);return{...y,...C?C(d):{}}},{}),h=Vp({...p,inclusive:je(Ee(d,"inclusive",f)),excludes:je(Ee(d,"excludes",f)),group:je(Ee(d,"group",f)),spanning:je(Ee(d,"spanning",f)),code:je(Ee(d,"code",f)),attrs:Object.fromEntries(u.map(Bp))}),m=je(Ee(d,"parseHTML",f));m&&(h.parseDOM=m.map(y=>$p(y,u)));const g=Ee(d,"renderHTML",f);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:Mr(y,u)})),[d.name,h]}));return new bu({topNode:a,nodes:l,marks:c})}function Bk(n){const e=n.filter((t,o)=>n.indexOf(t)!==o);return Array.from(new Set(e))}function Ji(n){return n.sort((t,o)=>{const r=Ee(t,"priority")||100,i=Ee(o,"priority")||100;return r>i?-1:r<i?1:0})}function Fp(n){const e=Ji(xl(n)),t=Bk(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 jp(n,e,t){const{from:o,to:r}=e,{blockSeparator:i=`
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=ho.fromSchema(h);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=a.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(h.text(g,p)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),a=H0(t),kr&&U0(a);let d=a&&a.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=a.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;a=p}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||fr.fromSchema(n.state.schema)).parseSlice(a,{preserveWhitespace:!!(c||u),context:r,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!B0.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)l=W0(Zf(l,+u[1],+u[2]),u[4]);else if(l=pe.maxOpen(F0(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=Zf(l,f,p)}return n.someProp("transformPasted",f=>{l=f(l,n,c)}),l}const B0=/^(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 F0(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,a=[];if(n.forEach(l=>{if(!a)return;let c=r.findWrapping(l.type),d;if(!c)return a=null;if(d=a.length&&i.length&&Yf(c,i,l,a[a.length-1],0))a[a.length-1]=d;else{a.length&&(a[a.length-1]=Qf(a[a.length-1],i.length));let u=Xf(l,c);a.push(u),r=r.matchType(u.type),i=c}}),a)return re.from(a)}return n}function Xf(n,e,t=0){for(let o=e.length-1;o>=t;o--)n=e[o].create(null,re.from(n));return n}function Yf(n,e,t,o,r){if(r<n.length&&r<e.length&&n[r]==e[r]){let i=Yf(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(re.from(Xf(t,n,r+1))))}}function Qf(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Qf(n.lastChild,e-1)),o=n.contentMatchAt(n.childCount).fillBefore(re.empty,!0);return n.copy(t.append(o))}function ol(n,e,t,o,r,i){let a=e<0?n.firstChild:n.lastChild,l=a.content;return n.childCount>1&&(i=0),r<o-1&&(l=ol(l,e,t,o,r+1,i)),r>=t&&(l=e<0?a.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(re.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,a.copy(l))}function Zf(n,e,t){return e<n.openStart&&(n=new pe(ol(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new pe(ol(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const ep={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 tp=null;function np(){return tp||(tp=document.implementation.createHTMLDocument("title"))}let rl=null;function j0(n){let e=window.trustedTypes;return e?(rl||(rl=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),rl.createHTML(n)):n}function H0(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=np().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(n),r;if((r=o&&ep[o[1].toLowerCase()])&&(n=r.map(i=>"<"+i+">").join("")+n+r.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=j0(n),r)for(let i=0;i<r.length;i++)t=t.querySelector(r[i])||t;return t}function U0(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 W0(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:a}=n;for(let l=o.length-2;l>=0;l-=2){let c=t.nodes[o[l]];if(!c||c.hasRequiredAttrs())break;r=re.from(c.create(o[l+1],r)),i++,a++}return new pe(r,i,a)}const vt={},Tt={},q0={touchstart:!0,touchmove:!0};class G0{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 K0(n){for(let e in vt){let t=vt[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=o=>{X0(n,o)&&!sl(n,o)&&(n.editable||!(o.type in Tt))&&t(n,o)},q0[e]?{passive:!0}:void 0)}pt&&n.dom.addEventListener("input",()=>null),il(n)}function Qn(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function J0(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 il(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=o=>sl(n,o))})}function sl(n,e){return n.someProp("handleDOMEvents",t=>{let o=t[e.type];return o?o(n,e)||e.defaultPrevented:!1})}function X0(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 Y0(n,e){!sl(n,e)&&vt[e.type]&&(n.editable||!(e.type in Tt))&&vt[e.type](n,e)}Tt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!rp(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Cn&&lt&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Bo&&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,yo(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",o=>o(n,t))||V0(n,t)?t.preventDefault():Qn(n,"key")},Tt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},Tt.keypress=(n,e)=>{let t=e;if(rp(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ht&&t.metaKey)return;if(n.someProp("handleKeyPress",r=>r(n,t))){t.preventDefault();return}let o=n.state.selection;if(!(o instanceof Oe)||!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",a=>a(n,o.$from.pos,o.$to.pos,r,i))&&n.dispatch(i()),t.preventDefault()}};function Li(n){return{left:n.clientX,top:n.clientY}}function Q0(n,e){let t=e.x-n.clientX,o=e.y-n.clientY;return t*t+o*o<100}function al(n,e,t,o,r){if(o==-1)return!1;let i=n.state.doc.resolve(o);for(let a=i.depth+1;a>0;a--)if(n.someProp(e,l=>a>i.depth?l(n,t,i.nodeAfter,i.before(a),r,!0):l(n,t,i.node(a),i.before(a),r,!1)))return!0;return!1}function Ho(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 Z0(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),o=t.nodeAfter;return o&&o.isAtom&&Ne.isSelectable(o)?(Ho(n,new Ne(t)),!0):!1}function ex(n,e){if(e==-1)return!1;let t=n.state.selection,o,r;t instanceof Ne&&(o=t.node);let i=n.state.doc.resolve(e);for(let a=i.depth+1;a>0;a--){let l=a>i.depth?i.nodeAfter:i.node(a);if(Ne.isSelectable(l)){o&&t.$from.depth>0&&a>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?r=i.before(t.$from.depth):r=i.before(a);break}}return r!=null?(Ho(n,Ne.create(n.state.doc,r)),!0):!1}function tx(n,e,t,o,r){return al(n,"handleClickOn",e,t,o)||n.someProp("handleClick",i=>i(n,e,o))||(r?ex(n,t):Z0(n,t))}function nx(n,e,t,o){return al(n,"handleDoubleClickOn",e,t,o)||n.someProp("handleDoubleClick",r=>r(n,e,o))}function ox(n,e,t,o){return al(n,"handleTripleClickOn",e,t,o)||n.someProp("handleTripleClick",r=>r(n,e,o))||rx(n,t,o)}function rx(n,e,t){if(t.button!=0)return!1;let o=n.state.doc;if(e==-1)return o.inlineContent?(Ho(n,Oe.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let a=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(a.inlineContent)Ho(n,Oe.create(o,l+1,l+1+a.content.size));else if(Ne.isSelectable(a))Ho(n,Ne.create(o,l));else continue;return!0}}function ll(n){return $i(n)}const op=Ht?"metaKey":"ctrlKey";vt.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let o=ll(n),r=Date.now(),i="singleClick";r-n.input.lastClick.time<500&&Q0(t,n.input.lastClick)&&!t[op]&&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 a=n.posAtCoords(Li(t));a&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new ix(n,a,t,!!o)):(i=="doubleClick"?nx:ox)(n,a.pos,a.inside,t)?t.preventDefault():Qn(n,"pointer"))};class ix{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[op],this.allowDefault=o.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let u=e.state.doc.resolve(t.pos);i=u.parent,a=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 Ne&&d.from<=a&&d.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&jt&&!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)),Qn(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(()=>vn(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(Li(e))),this.updateAllowDefault(e),this.allowDefault||!t?Qn(this.view,"pointer"):tx(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||pt&&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)?(Ho(this.view,Re.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Qn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Qn(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)}}vt.touchstart=n=>{n.input.lastTouch=Date.now(),ll(n),Qn(n,"pointer")},vt.touchmove=n=>{n.input.lastTouch=Date.now(),Qn(n,"pointer")},vt.contextmenu=n=>ll(n);function rp(n,e){return n.composing?!0:pt&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const sx=Cn?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 Oe&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||lt&&mf&&ax(n)))n.markCursor=n.state.storedMarks||t.marks(),$i(n,!0),n.markCursor=null;else if($i(n,!e.selection.empty),jt&&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 a=i<0?r.lastChild:r.childNodes[i-1];if(!a)break;if(a.nodeType==3){let l=n.domSelection();l&&l.collapse(a,a.nodeValue.length);break}else r=a,i=-1}}n.input.composing=!0}ip(n,sx)};function ax(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++,ip(n,20))};function ip(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>$i(n),e))}function sp(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=cx());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function lx(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=e0(e.focusNode,e.focusOffset),o=t0(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 a=t.pmViewDesc;if(!(!a||!a.isText(t.nodeValue)))return o}}return t||o}function cx(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function $i(n,e=!1){if(!(Cn&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),sp(n),e||n.docView&&n.docView.dirty){let t=Ya(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 dx(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 Nr=At&&Kn<15||Bo&&i0<604;vt.copy=Tt.cut=(n,e)=>{let t=e,o=n.state.selection,r=t.type=="cut";if(o.empty)return;let i=Nr?null:t.clipboardData,a=o.content(),{dom:l,text:c}=nl(n,a);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",c)):dx(n,l),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ux(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function fx(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?vr(n,o.value,null,r,e):vr(n,o.textContent,o.innerHTML,r,e)},50)}function vr(n,e,t,o,r){let i=Jf(n,e,t,o,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,r,i||pe.empty)))return!0;if(!i)return!1;let a=ux(i),l=a?n.state.tr.replaceSelectionWith(a,o):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ap(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&&!Cn)return;let o=Nr?null:t.clipboardData,r=n.input.shiftKey&&n.input.lastKeyCode!=45;o&&vr(n,ap(o),o.getData("text/html"),r,t)?t.preventDefault():fx(n,t)};class lp{constructor(e,t,o){this.slice=e,this.move=t,this.node=o}}const px=Ht?"altKey":"ctrlKey";function cp(n,e){let t=n.someProp("dragCopies",o=>!o(e));return t??!e[px]}vt.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(Li(t)),a;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof Ne?r.to-1:r.to))){if(o&&o.mightDrag)a=Ne.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&&(a=Ne.create(n.state.doc,f.posBefore))}}let l=(a||n.state.selection).content(),{dom:c,text:d,slice:u}=nl(n,l);(!t.dataTransfer.files.length||!lt||hf>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Nr?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",Nr||t.dataTransfer.setData("text/plain",d),n.dragging=new lp(u,cp(n,t),a)},vt.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{hx(n,e,n.dragging)}finally{n.dragging=null}};function hx(n,e,t){if(!e.dataTransfer)return;let o=n.posAtCoords(Li(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=Jf(n,ap(e.dataTransfer),Nr?null:e.dataTransfer.getData("text/html"),!1,r);let a=!!(t&&cp(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||pe.empty,a))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?E1(n.state.doc,r.pos,i):r.pos;l==null&&(l=r.pos);let c=n.state.tr;if(a){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&&Ne.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new Ne(p));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,x)=>h=x),c.setSelection(Za(n,p,c.doc.resolve(h)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))}vt.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())&&vn(n)},20))},vt.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)},vt.beforeinput=(n,e)=>{if(lt&&Cn&&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,yo(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)vt[n]=Tt[n];function Tr(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 Vi{constructor(e,t){this.toDOM=e,this.spec=t||Eo,this.side=this.spec.side||0}map(e,t,o,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new sn(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof Vi&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Tr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Zn{constructor(e,t){this.attrs=e,this.spec=t||Eo}map(e,t,o,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-o,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=a?null:new sn(i,a,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Zn&&Tr(this.attrs,e.attrs)&&Tr(this.spec,e.spec)}static is(e){return e.type instanceof Zn}destroy(){}}class cl{constructor(e,t){this.attrs=e,this.spec=t||Eo}map(e,t,o,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new sn(i.pos-o,a.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 cl&&Tr(this.attrs,e.attrs)&&Tr(this.spec,e.spec)}destroy(){}}class sn{constructor(e,t,o){this.from=e,this.to=t,this.type=o}copy(e,t){return new sn(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 sn(e,e,new Vi(t,o))}static inline(e,t,o,r){return new sn(e,t,new Zn(o,r))}static node(e,t,o,r){return new sn(e,t,new cl(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Zn}get widget(){return this.type instanceof Vi}}const Uo=[],Eo={};class ct{constructor(e,t){this.local=e.length?e:Uo,this.children=t.length?t:Uo}static create(e,t){return t.length?Bi(t,e,0,Eo):yt}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 a=0;a<this.local.length;a++){let l=this.local[a];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let l=this.children[a]+1;this.children[a+2].findInner(e-l,t-l,o,r+l,i)}}map(e,t,o){return this==yt||e.maps.length==0?this:this.mapInner(e,t,0,0,o||Eo)}mapInner(e,t,o,r,i){let a;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,o,r);c&&c.type.valid(t,c)?(a||(a=[])).push(c):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?mx(this.children,a||[],e,t,o,r,i):a?new ct(a.sort(wo),Uo):yt}add(e,t){return t.length?this==yt?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=up(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,Bi(u,l,d+1,Eo)),i+=3}});let a=dp(i?fp(t):t,-o);for(let l=0;l<a.length;l++)a[l].type.valid(e,a[l])||a.splice(l--,1);return new ct(a.length?this.local.concat(a).sort(wo):this.local,r||this.children)}remove(e){return e.length==0||this==yt?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 a,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,(a||(a=[])).push(f));if(!a)continue;o==this.children&&(o=this.children.slice());let d=o[i+2].removeInner(a,l+1);d!=yt?o[i+2]=d:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,a;i<e.length;i++)if(a=e[i])for(let l=0;l<r.length;l++)r[l].eq(a,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):yt}forChild(e,t){if(this==yt)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,a=i+t.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<a&&c.to>i&&c.type instanceof Zn){let d=Math.max(i,c.from)-i,u=Math.min(a,c.to)-i;d<u&&(r||(r=[])).push(c.copy(d,u))}}if(r){let l=new ct(r.sort(wo),Uo);return o?new eo([l,o]):l}return o||yt}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 dl(this.localsInner(e))}localsInner(e){if(this==yt)return Uo;if(e.inlineContent||!this.local.some(Zn.is))return this.local;let t=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof Zn||t.push(this.local[o]);return t}forEachSet(e){e(this)}}ct.empty=new ct([],[]),ct.removeOverlap=dl;const yt=ct.empty;class eo{constructor(e){this.members=e}map(e,t){const o=this.members.map(r=>r.map(e,t,Eo));return eo.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!=yt&&(i instanceof eo?o=o.concat(i.members):o.push(i))}return eo.from(o)}eq(e){if(!(e instanceof eo)||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 a=0;a<i.length;a++)t.push(i[a])}}return t?dl(o?t:t.sort(wo)):Uo}static from(e){switch(e.length){case 0:return yt;case 1:return e[0];default:return new eo(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 mx(n,e,t,o,r,i,a){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,g)=>{let y=g-m-(h-p);for(let x=0;x<l.length;x+=3){let N=l[x+1];if(N<0||p>N+u-f)continue;let E=l[x]+u-f;h>=E?l[x+1]=p<=E?-2:-1:p>=u&&y&&(l[x]+=y,l[x+1]+=y)}f+=y}),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:g}=o.content.findIndex(f),y=o.maybeChild(m);if(y&&g==f&&g+y.nodeSize==h){let x=l[d+2].mapInner(t,y,u+1,n[d]+i+1,a);x!=yt?(l[d]=f,l[d+1]=h,l[d+2]=x):(l[d+1]=-2,c=!0)}else c=!0}if(c){let d=gx(l,n,e,t,r,i,a),u=Bi(d,o,0,a);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(wo),l)}function dp(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 sn(r.from+e,r.to+e,r.type))}return t}function gx(n,e,t,o,r,i,a){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):a.onRemove&&a.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 up(n,e,t){if(e.isLeaf)return null;let o=t+e.nodeSize,r=null;for(let i=0,a;i<n.length;i++)(a=n[i])&&a.from>t&&a.to<o&&((r||(r=[])).push(a),n[i]=null);return r}function fp(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Bi(n,e,t,o){let r=[],i=!1;e.forEach((l,c)=>{let d=up(n,l,c+t);if(d){i=!0;let u=Bi(d,l,t+c+1,o);u!=yt&&r.push(c,c+l.nodeSize,u)}});let a=dp(i?fp(n):n,-t).sort(wo);for(let l=0;l<a.length;l++)a[l].type.valid(e,a[l])||(o.onRemove&&o.onRemove(a[l].spec),a.splice(l--,1));return a.length||r.length?new ct(a,r):yt}function wo(n,e){return n.from-e.from||n.to-e.to}function dl(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),pp(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),pp(e,r,o.copy(i.from,o.to)));break}}}return e}function pp(n,e,t){for(;e<n.length&&wo(t,n[e])>0;)e++;n.splice(e,0,t)}function ul(n){let e=[];return n.someProp("decorations",t=>{let o=t(n.state);o&&o!=yt&&e.push(o)}),n.cursorWrapper&&e.push(ct.create(n.state.doc,[n.cursorWrapper.deco])),eo.from(e)}const yx={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},bx=At&&Kn<=11;class xx{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 kx{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new xx,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&&Kn<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():pt&&e.composing&&o.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),bx&&(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,yx)),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(Ff(this.view)){if(this.suppressingSelectionUpdates)return vn(this.view);if(At&&Kn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&go(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=Vo(i))t.add(i);for(let i=e.anchorNode;i;i=Vo(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)&&Ff(e)&&!this.ignoreSelectionChange(o),i=-1,a=-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),a=a<0?f.to:Math.max(f.to,a),f.typeOver&&(l=!0))}if(jt&&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||Sx(e,f)!=h)&&p.remove()}}}else if((lt||pt)&&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&&Oi(o)&&(d=Ya(e))&&d.eq(Re.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,vn(e),this.currentSelection.set(o),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),Ex(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Cx(e,c)),this.handleDOMChange(i,a,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||vn(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&&Kn<=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 a=r&&r.parentNode==e.target?ft(r)+1:0,l=o.localPosFromDOM(e.target,a,-1),c=i&&i.parentNode==e.target?ft(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 hp=new WeakMap,mp=!1;function Ex(n){if(!hp.has(n)&&(hp.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=jt,mp)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."),mp=!0}}function gp(n,e){let t=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,a=n.domAtPos(n.state.selection.anchor);return go(a.node,a.offset,r,i)&&([t,o,r,i]=[r,i,t,o]),{anchorNode:t,anchorOffset:o,focusNode:r,focusOffset:i}}function wx(n,e){if(e.getComposedRanges){let r=e.getComposedRanges(n.root)[0];if(r)return gp(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?gp(n,t):null}function Sx(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 Cx(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 a=i.nextSibling;for(;a&&a.nodeName!="TD"&&a.nodeName!="TH";)a=a.nextSibling;if(a){let l=a;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 Nx(n,e,t){let{node:o,fromOffset:r,toOffset:i,from:a,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}],Oi(c)||d.push({node:c.focusNode,offset:c.focusOffset})),lt&&n.input.lastKeyCode===8)for(let y=i;y>r;y--){let x=o.childNodes[y-1],N=x.pmViewDesc;if(x.nodeName=="BR"&&!N){i=y;break}if(!N||N.size)break}let f=n.state.doc,p=n.someProp("domParser")||fr.fromSchema(n.state.schema),h=f.resolve(a),m=null,g=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:vx,context:h});if(d&&d[0].pos!=null){let y=d[0].pos,x=d[1]&&d[1].pos;x==null&&(x=y),m={anchor:y+a,head:x+a}}return{doc:g,sel:m,from:a,to:l}}function vx(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(pt&&/^(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||pt&&/^(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 Tx=/^(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 zx(n,e,t,o,r){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let k=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,w=Ya(n,k);if(w&&!n.state.selection.eq(w)){if(lt&&Cn&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",R=>R(n,yo(13,"Enter"))))return;let b=n.state.tr.setSelection(w);k=="pointer"?b.setMeta("pointer",!0):k=="key"&&b.scrollIntoView(),i&&b.setMeta("composition",i),n.dispatch(b)}return}let a=n.state.doc.resolve(e),l=a.sharedDepth(t);e=a.before(l+1),t=n.state.doc.resolve(t).after(l+1);let c=n.state.selection,d=Nx(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=Ix(f.content,d.doc.content,d.from,p,h);if(m&&n.input.domChangeCount++,(Bo&&n.input.lastIOSEnter>Date.now()-225||Cn)&&r.some(k=>k.nodeType==1&&!Tx.test(k.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",k=>k(n,yo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof Oe&&!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 k=yp(n,n.state.doc,d.sel);if(k&&!k.eq(n.state.selection)){let w=n.state.tr.setSelection(k);i&&w.setMeta("composition",i),n.dispatch(w)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof Oe&&(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&&Kn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=d.doc.resolveNoCache(m.start-d.from),y=d.doc.resolveNoCache(m.endB-d.from),x=u.resolve(m.start),N=g.sameParent(y)&&g.parent.inlineContent&&x.end()>=m.endA;if((Bo&&n.input.lastIOSEnter>Date.now()-225&&(!N||r.some(k=>k.nodeName=="DIV"||k.nodeName=="P"))||!N&&g.pos<d.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(d.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",k=>k(n,yo(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&Ax(u,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",k=>k(n,yo(8,"Backspace")))){Cn&&lt&&n.domObserver.suppressSelectionUpdates();return}lt&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),Cn&&!N&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,y=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{n.someProp("handleKeyDown",function(k){return k(n,yo(13,"Enter"))})},20));let E=m.start,v=m.endA,A=k=>{let w=k||n.state.tr.replace(E,v,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let b=yp(n,w.doc,d.sel);b&&!(lt&&n.composing&&b.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(b.head==E||b.head==w.mapping.map(v)-1)||At&&b.empty&&b.head==E)&&w.setSelection(b)}return i&&w.setMeta("composition",i),w.scrollIntoView()},M;if(N)if(g.pos==y.pos){At&&Kn<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>vn(n),20));let k=A(n.state.tr.delete(E,v)),w=u.resolve(m.start).marksAcross(u.resolve(m.endA));w&&k.ensureMarks(w),n.dispatch(k)}else if(m.endA==m.endB&&(M=Mx(g.parent.content.cut(g.parentOffset,y.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start())))){let k=A(n.state.tr);M.type=="add"?k.addMark(E,v,M.mark):k.removeMark(E,v,M.mark),n.dispatch(k)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let k=g.parent.textBetween(g.parentOffset,y.parentOffset),w=()=>A(n.state.tr.insertText(k,E,v));n.someProp("handleTextInput",b=>b(n,E,v,k,w))||n.dispatch(w())}else n.dispatch(A());else n.dispatch(A())}function yp(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Za(n,e.resolve(t.anchor),e.resolve(t.head))}function Mx(n,e){let t=n.firstChild.marks,o=e.firstChild.marks,r=t,i=o,a,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],a="add",c=u=>u.mark(l.addToSet(u.marks));else if(r.length==0&&i.length==1)l=i[0],a="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(re.from(d).eq(n))return{mark:l,type:a}}function Ax(n,e,t,o,r){if(t-e<=r.pos-o.pos||fl(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 a=n.resolve(fl(i,!0,!0));return!a.parent.isTextblock||a.pos>t||fl(a,!0,!1)<t?!1:o.parent.content.cut(o.parentOffset).eq(a.parent.content)}function fl(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 Ix(n,e,t,o,r){let i=n.findDiffStart(e,t);if(i==null)return null;let{a,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(r=="end"){let c=Math.max(0,i-Math.min(a,l));o-=a+c-i}if(a<i&&n.size<e.size){let c=o<=i&&o>=a?i-o:0;i-=c,i&&i<e.size&&bp(e.textBetween(i-1,i+1))&&(i+=c?1:-1),l=i+(l-a),a=i}else if(l<i){let c=o<=i&&o>=l?i-o:0;i-=c,i&&i<n.size&&bp(n.textBetween(i-1,i+1))&&(i+=c?1:-1),a=i+(a-l),l=i}return{start:i,endA:a,endB:l}}function bp(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 xp{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 G0,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Cp),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=wp(this),Ep(this),this.nodeViews=Sp(this),this.docView=Mf(this.state.doc,kp(this),ul(this),this.dom,this),this.domObserver=new kx(this,(o,r,i,a)=>zx(this,o,r,i,a)),this.domObserver.start(),K0(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&&il(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Cp),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,a=!1;e.storedMarks&&this.composing&&(sp(this),a=!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=Sp(this);Ox(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&il(this),this.editable=wp(this),Ep(this);let c=ul(this),d=kp(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))&&(a=!0);let p=u=="preserve"&&a&&this.dom.style.overflowAnchor==null&&l0(this);if(a){this.domObserver.stop();let h=f&&(At||lt)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&_x(r.selection,e.selection);if(f){let m=lt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=lx(this)),(i||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=Mf(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())&&_0(this))?vn(this,h):(Vf(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&&c0(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 Ne){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&gf(this,t.getBoundingClientRect(),e)}else gf(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 lp(e.slice,e.move,r<0?void 0:Ne.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 a=0;a<this.directPlugins.length;a++){let l=this.directPlugins[a].props[e];if(l!=null&&(r=t?t(l):l))return r}let i=this.state.plugins;if(i)for(let a=0;a<i.length;a++){let l=i[a].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&&d0(this.dom),vn(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 m0(this,e)}coordsAtPos(e,t=1){return wf(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 k0(this,t||this.state,e)}pasteHTML(e,t){return vr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return vr(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return nl(this,e)}destroy(){this.docView&&(J0(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ul(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Q1())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Y0(this,e)}domSelectionRange(){let e=this.domSelection();return e?pt&&this.root.nodeType===11&&o0(this.dom.ownerDocument)==this.dom&&wx(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}xp.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function kp(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"),[sn.node(0,n.state.doc.content.size,e)]}function Ep(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:sn.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function wp(n){return!n.someProp("editable",e=>e(n.state)===!1)}function _x(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 Sp(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 Ox(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 Cp(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 to={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:"'"},Fi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Dx=typeof navigator<"u"&&/Mac/.test(navigator.platform),Px=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ht=0;ht<10;ht++)to[48+ht]=to[96+ht]=String(ht);for(var ht=1;ht<=24;ht++)to[ht+111]="F"+ht;for(var ht=65;ht<=90;ht++)to[ht]=String.fromCharCode(ht+32),Fi[ht]=String.fromCharCode(ht);for(var pl in to)Fi.hasOwnProperty(pl)||(Fi[pl]=to[pl]);function Rx(n){var e=Dx&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Px&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Fi:to)[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 Lx=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),$x=typeof navigator<"u"&&/Win/.test(navigator.platform);function Vx(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let o,r,i,a;for(let l=0;l<e.length-1;l++){let c=e[l];if(/^(cmd|meta|m)$/i.test(c))a=!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))Lx?a=!0:r=!0;else throw new Error("Unrecognized modifier name: "+c)}return o&&(t="Alt-"+t),r&&(t="Ctrl-"+t),a&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function Bx(n){let e=Object.create(null);for(let t in n)e[Vx(t)]=n[t];return e}function hl(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 Fx(n){return new Mt({props:{handleKeyDown:jx(n)}})}function jx(n){let e=Bx(n);return function(t,o){let r=Rx(o),i,a=e[hl(r,o)];if(a&&a(t.state,t.dispatch,t))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[hl(r,o,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!($x&&o.ctrlKey&&o.altKey)&&(i=to[o.keyCode])&&i!=r){let l=e[hl(i,o)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var Hx=Object.defineProperty,ml=(n,e)=>{for(var t in e)Hx(n,t,{get:e[t],enumerable:!0})};function ji(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 Hi=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(([a,l])=>[a,(...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,a=[],l=!!n,c=n||r.tr,d=()=>(!l&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(c),a.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(t).map(([f,p])=>[f,(...m)=>{const g=this.buildProps(c,e),y=p(...m)(g);return a.push(y),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,a={tr:n,editor:o,view:i,state:ji({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)(a)]))}};return a}},Np={};ml(Np,{blur:()=>Ux,clearContent:()=>Wx,clearNodes:()=>qx,command:()=>Gx,createParagraphNear:()=>Kx,cut:()=>Jx,deleteCurrentNode:()=>Xx,deleteNode:()=>Yx,deleteRange:()=>Qx,deleteSelection:()=>Zx,enter:()=>ek,exitCode:()=>tk,extendMarkRange:()=>nk,first:()=>ok,focus:()=>ik,forEach:()=>sk,insertContent:()=>ak,insertContentAt:()=>dk,joinBackward:()=>pk,joinDown:()=>fk,joinForward:()=>hk,joinItemBackward:()=>mk,joinItemForward:()=>gk,joinTextblockBackward:()=>yk,joinTextblockForward:()=>bk,joinUp:()=>uk,keyboardShortcut:()=>kk,lift:()=>Ek,liftEmptyBlock:()=>wk,liftListItem:()=>Sk,newlineInCode:()=>Ck,resetAttributes:()=>Nk,scrollIntoView:()=>vk,selectAll:()=>Tk,selectNodeBackward:()=>zk,selectNodeForward:()=>Mk,selectParentNode:()=>Ak,selectTextblockEnd:()=>Ik,selectTextblockStart:()=>_k,setContent:()=>Ok,setMark:()=>Zk,setMeta:()=>eE,setNode:()=>tE,setNodeSelection:()=>nE,setTextDirection:()=>oE,setTextSelection:()=>rE,sinkListItem:()=>iE,splitBlock:()=>sE,splitListItem:()=>aE,toggleList:()=>lE,toggleMark:()=>cE,toggleNode:()=>dE,toggleWrap:()=>uE,undoInputRule:()=>fE,unsetAllMarks:()=>pE,unsetMark:()=>hE,unsetTextDirection:()=>mE,updateAttributes:()=>gE,wrapIn:()=>yE,wrapInList:()=>bE});var Ux=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),Wx=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),qx=()=>({state:n,tr:e,dispatch:t})=>{const{selection:o}=e,{ranges:r}=o;return t&&r.forEach(({$from:i,$to:a})=>{n.doc.nodesBetween(i.pos,a.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=Oo(h);if(l.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},Gx=n=>e=>n(e),Kx=()=>({state:n,dispatch:e})=>sf(n,e),Jx=(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 a=o.mapping.map(e);return o.insert(a,i.content),o.setSelection(new Oe(o.doc.resolve(Math.max(a-1,0)))),!0},Xx=()=>({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 et(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 Yx=n=>({tr:e,state:t,dispatch:o})=>{const r=et(n,t.schema),i=e.selection.$anchor;for(let a=i.depth;a>0;a-=1)if(i.node(a).type===r){if(o){const c=i.before(a),d=i.after(a);e.delete(c,d).scrollIntoView()}return!0}return!1},Qx=n=>({tr:e,dispatch:t})=>{const{from:o,to:r}=n;return t&&e.delete(o,r),!0},Zx=()=>({state:n,dispatch:e})=>$a(n,e),ek=()=>({commands:n})=>n.keyboardShortcut("Enter"),tk=()=>({state:n,dispatch:e})=>L1(n,e);function gl(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Ui(n,e,t={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>t.strict?e[r]===n[r]:gl(e[r])?e[r].test(n[r]):e[r]===n[r]):!0}function vp(n,e,t={}){return n.find(o=>o.type===e&&Ui(Object.fromEntries(Object.keys(t).map(r=>[r,o.attrs[r]])),t))}function Tp(n,e,t={}){return!!vp(n,e,t)}function yl(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),!vp([...r.node.marks],e,t)))return;let a=r.index,l=n.start()+r.offset,c=a+1,d=l+r.node.nodeSize;for(;a>0&&Tp([...n.parent.child(a-1).marks],e,t);)a-=1,l-=n.parent.child(a).nodeSize;for(;c<n.parent.childCount&&Tp([...n.parent.child(c).marks],e,t);)d+=n.parent.child(c).nodeSize,c+=1;return{from:l,to:d}}function Tn(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 nk=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const i=Tn(n,o.schema),{doc:a,selection:l}=t,{$from:c,from:d,to:u}=l;if(r){const f=yl(c,i,e);if(f&&f.from<=d&&f.to>=u){const p=Oe.create(a,f.from,f.to);t.setSelection(p)}}return!0},ok=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 zp(n){return n instanceof Oe}function So(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Mp(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"?Oe.create(n,So(0,r,i),So(n.content.size,r,i)):Oe.create(n,So(e,r,i),So(e,r,i))}function Ap(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Wi(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function rk(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var ik=(n=null,e={})=>({editor:t,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const a=()=>{(Wi()||Ap())&&o.dom.focus(),rk()&&!Wi()&&!Ap()&&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&&!zp(t.state.selection))return a(),!0;const l=Mp(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),a()),!0},sk=(n,e)=>t=>n.every((o,r)=>e(o,{...t,index:r})),ak=(n,e)=>({tr:t,commands:o})=>o.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Ip=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&&Ip(o)}return n};function qi(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 Ip(t)}function zr(n,e,t){if(n instanceof Hn||n instanceof re)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 re.fromArray(n.map(l=>e.nodeFromJSON(l)));const a=e.nodeFromJSON(n);return t.errorOnInvalidContent&&a.check(),a}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),zr("",e,t)}if(r){if(t.errorOnInvalidContent){let a=!1,l="";const c=new bu({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=>(a=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(t.slice?fr.fromSchema(c).parseSlice(qi(n),t.parseOptions):fr.fromSchema(c).parse(qi(n),t.parseOptions),t.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=fr.fromSchema(e);return t.slice?i.parseSlice(qi(n),t.parseOptions).content:i.parse(qi(n),t.parseOptions)}return zr("",e,t)}function lk(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 a=0;i.forEach((l,c,d,u)=>{a===0&&(a=u)}),n.setSelection(Re.near(n.doc.resolve(a),t))}var ck=n=>!("type"in n),dk=(n,e,t)=>({tr:o,dispatch:r,editor:i})=>{var a;if(r){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const c=y=>{i.emit("contentError",{editor:i,error:y,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{zr(e,i.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(y){c(y)}try{l=zr(e,i.schema,{parseOptions:d,errorOnInvalidContent:(a=t.errorOnInvalidContent)!=null?a:i.options.enableContentCheck})}catch(y){return c(y),!1}let{from:u,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,h=!0;if((ck(l)?l:[l]).forEach(y=>{y.check(),p=p?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),u===f&&h){const{parent:y}=o.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,f+=1)}let g;if(p){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof re){let y="";e.forEach(x=>{x.text&&(y+=x.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;o.insertText(g,u,f)}else{g=l;const y=o.doc.resolve(u),x=y.node(),N=y.parentOffset===0,E=x.isText||x.isTextblock,v=x.content.size>0;N&&E&&v&&(u=Math.max(0,u-1)),o.replaceWith(u,f,g)}t.updateSelection&&lk(o,o.steps.length-1,-1),t.applyInputRules&&o.setMeta("applyInputRules",{from:u,text:g}),t.applyPasteRules&&o.setMeta("applyPasteRules",{from:u,text:g})}return!0},uk=()=>({state:n,dispatch:e})=>D1(n,e),fk=()=>({state:n,dispatch:e})=>P1(n,e),pk=()=>({state:n,dispatch:e})=>Qu(n,e),hk=()=>({state:n,dispatch:e})=>nf(n,e),mk=()=>({state:n,dispatch:e,tr:t})=>{try{const o=Mi(n.doc,n.selection.$from.pos,-1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},gk=()=>({state:n,dispatch:e,tr:t})=>{try{const o=Mi(n.doc,n.selection.$from.pos,1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},yk=()=>({state:n,dispatch:e})=>_1(n,e),bk=()=>({state:n,dispatch:e})=>O1(n,e);function _p(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function xk(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let o,r,i,a;for(let l=0;l<e.length-1;l+=1){const c=e[l];if(/^(cmd|meta|m)$/i.test(c))a=!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))Wi()||_p()?a=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return o&&(t=`Alt-${t}`),r&&(t=`Ctrl-${t}`),a&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}var kk=n=>({editor:e,view:t,tr:o,dispatch:r})=>{const i=xk(n).split(/-(?!$)/),a=i.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,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 no(n,e,t={}){const{from:o,to:r,empty:i}=n.selection,a=e?et(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=>a?a.name===f.node.type.name:!0).filter(f=>Ui(f.node.attrs,t,{strict:!1}));return i?!!d.length:d.reduce((f,p)=>f+p.to-p.from,0)>=c}var Ek=(n,e={})=>({state:t,dispatch:o})=>{const r=et(n,t.schema);return no(t,r,e)?R1(t,o):!1},wk=()=>({state:n,dispatch:e})=>af(n,e),Sk=n=>({state:e,dispatch:t})=>{const o=et(n,e.schema);return K1(o)(e,t)},Ck=()=>({state:n,dispatch:e})=>rf(n,e);function Gi(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Op(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 Nk=(n,e)=>({tr:t,state:o,dispatch:r})=>{let i=null,a=null;const l=Gi(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=et(n,o.schema)),l==="mark"&&(a=Tn(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,Op(u.attrs,e))),a&&u.marks.length&&u.marks.forEach(p=>{a===p.type&&(c=!0,r&&t.addMark(f,f+u.nodeSize,a.create(Op(p.attrs,e))))})})}),c},vk=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Tk=()=>({tr:n,dispatch:e})=>{if(e){const t=new Lt(n.doc);n.setSelection(t)}return!0},zk=()=>({state:n,dispatch:e})=>ef(n,e),Mk=()=>({state:n,dispatch:e})=>of(n,e),Ak=()=>({state:n,dispatch:e})=>B1(n,e),Ik=()=>({state:n,dispatch:e})=>H1(n,e),_k=()=>({state:n,dispatch:e})=>j1(n,e);function bl(n,e,t={},o={}){return zr(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:o.errorOnInvalidContent})}var Ok=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:o={}}={})=>({editor:r,tr:i,dispatch:a,commands:l})=>{const{doc:c}=i;if(o.preserveWhitespace!=="full"){const d=bl(n,r.schema,o,{errorOnInvalidContent:e??r.options.enableContentCheck});return a&&i.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!t),!0}return a&&i.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:c.content.size},n,{parseOptions:o,errorOnInvalidContent:e??r.options.enableContentCheck})};function Dp(n,e){const t=Tn(e,n.schema),{from:o,to:r,empty:i}=n.selection,a=[];i?(n.storedMarks&&a.push(...n.storedMarks),a.push(...n.selection.$head.marks())):n.doc.nodesBetween(o,r,c=>{a.push(...c.marks)});const l=a.find(c=>c.type.name===t.name);return l?{...l.attrs}:{}}function Pp(n,e){const t=new ju(n);return e.forEach(o=>{o.steps.forEach(r=>{t.step(r)})}),t}function Dk(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 Pk(n,e,t){const o=[];return n.nodesBetween(e.from,e.to,(r,i)=>{t(r)&&o.push({node:r,pos:i})}),o}function Rk(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 Ki(n){return e=>Rk(e.$from,n)}function Ee(n,e,t){return n.config[e]===void 0&&n.parent?Ee(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?Ee(n.parent,e,t):null}):n.config[e]}function xl(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},o=Ee(e,"addExtensions",t);return o?[e,...xl(o())]:e}).flat(10)}function kl(n,e){const t=ho.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function Rp(n){return typeof n=="function"}function je(n,e=void 0,...t){return Rp(n)?e?n.bind(e)(...t):n(...t):n}function Lk(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Wo(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 Lp(n){const e=[],{nodeExtensions:t,markExtensions:o}=Wo(n),r=[...t,...o],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(a=>{const l={name:a.name,options:a.options,storage:a.storage,extensions:r},c=Ee(a,"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(a=>{const l={name:a.name,options:a.options,storage:a.storage},c=Ee(a,"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:a.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 Mr(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 $k(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function $p(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,a)=>{const l=a.attribute.parseHTML?a.attribute.parseHTML(t):$k(t.getAttribute(a.name));return l==null?i:{...i,[a.name]:l}},{});return{...o,...r}}}}function Vp(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Lk(t)?!1:t!=null))}function Bp(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 Vk(n,e){var t;const o=Lp(n),{nodeExtensions:r,markExtensions:i}=Wo(n),a=(t=r.find(d=>Ee(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,N)=>{const E=Ee(N,"extendNodeSchema",f);return{...x,...E?E(d):{}}},{}),h=Vp({...p,content:je(Ee(d,"content",f)),marks:je(Ee(d,"marks",f)),group:je(Ee(d,"group",f)),inline:je(Ee(d,"inline",f)),atom:je(Ee(d,"atom",f)),selectable:je(Ee(d,"selectable",f)),draggable:je(Ee(d,"draggable",f)),code:je(Ee(d,"code",f)),whitespace:je(Ee(d,"whitespace",f)),linebreakReplacement:je(Ee(d,"linebreakReplacement",f)),defining:je(Ee(d,"defining",f)),isolating:je(Ee(d,"isolating",f)),attrs:Object.fromEntries(u.map(Bp))}),m=je(Ee(d,"parseHTML",f));m&&(h.parseDOM=m.map(x=>$p(x,u)));const g=Ee(d,"renderHTML",f);g&&(h.toDOM=x=>g({node:x,HTMLAttributes:Mr(x,u)}));const y=Ee(d,"renderText",f);return y&&(h.toText=y),[d.name,h]})),c=Object.fromEntries(i.map(d=>{const u=o.filter(y=>y.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=n.reduce((y,x)=>{const N=Ee(x,"extendMarkSchema",f);return{...y,...N?N(d):{}}},{}),h=Vp({...p,inclusive:je(Ee(d,"inclusive",f)),excludes:je(Ee(d,"excludes",f)),group:je(Ee(d,"group",f)),spanning:je(Ee(d,"spanning",f)),code:je(Ee(d,"code",f)),attrs:Object.fromEntries(u.map(Bp))}),m=je(Ee(d,"parseHTML",f));m&&(h.parseDOM=m.map(y=>$p(y,u)));const g=Ee(d,"renderHTML",f);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:Mr(y,u)})),[d.name,h]}));return new bu({topNode:a,nodes:l,marks:c})}function Bk(n){const e=n.filter((t,o)=>n.indexOf(t)!==o);return Array.from(new Set(e))}function Ji(n){return n.sort((t,o)=>{const r=Ee(t,"priority")||100,i=Ee(o,"priority")||100;return r>i?-1:r<i?1:0})}function Fp(n){const e=Ji(xl(n)),t=Bk(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 jp(n,e,t){const{from:o,to:r}=e,{blockSeparator:i=`
354
354
 
355
- `,textSerializers:a={}}=t||{};let l="";return n.nodesBetween(o,r,(c,d,u,f)=>{var p;c.isBlock&&d>o&&(l+=i);const h=a?.[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 Fk(n,e){const t={from:0,to:n.content.size};return jp(n,t,e)}function Hp(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function jk(n,e){const t=et(e,n.schema),{from:o,to:r}=n.selection,i=[];n.doc.nodesBetween(o,r,l=>{i.push(l)});const a=i.reverse().find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function Up(n,e){const t=Gi(typeof e=="string"?e:e.name,n.schema);return t==="node"?jk(n,e):t==="mark"?Dp(n,e):{}}function Hk(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 Uk(n){const e=Hk(n);return e.length===1?e:e.filter((t,o)=>!e.filter((i,a)=>a!==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 Wp(n){const{mapping:e,steps:t}=n,o=[];return e.maps.forEach((r,i)=>{const a=[];if(r.ranges.length)r.forEach((l,c)=>{a.push({from:l,to:c})});else{const{from:l,to:c}=t[i];if(l===void 0||c===void 0)return;a.push({from:l,to:c})}a.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}})})}),Uk(o)}function El(n,e,t){const o=[];return n===e?t.resolve(n).marks().forEach(r=>{const i=t.resolve(n),a=yl(i,r.type);a&&o.push({mark:r,...a})}):t.nodesBetween(n,e,(r,i)=>{!r||r?.nodeSize===void 0||o.push(...r.marks.map(a=>({from:i,to:i+r.nodeSize,mark:a})))}),o}var Wk=(n,e,t,o=20)=>{const r=n.doc.resolve(t);let i=o,a=null;for(;i>0&&a===null;){const l=r.node(i);l?.type.name===e?a=l:i-=1}return[a,i]};function Xi(n,e){return e.nodes[n]||e.marks[n]||null}function Yi(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 qk=(n,e=500)=>{let t="";const o=n.parentOffset;return n.parent.nodesBetween(Math.max(0,o-e),o,(r,i,a,l)=>{var c,d;const u=((d=(c=r.type.spec).toText)==null?void 0:d.call(c,{node:r,pos:i,parent:a,index:l}))||r.textContent||"%leaf%";t+=r.isAtom&&!r.isText?u:u.slice(0,Math.max(0,o-i))}),t};function wl(n,e,t={}){const{empty:o,ranges:r}=n.selection,i=e?Tn(e,n.schema):null;if(o)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>i?i.name===f.type.name:!0).find(f=>Ui(f.attrs,t,{strict:!1}));let a=0;const l=[];if(r.forEach(({$from:f,$to:p})=>{const h=f.pos,m=p.pos;n.doc.nodesBetween(h,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const x=Math.max(h,y),C=Math.min(m,y+g.nodeSize),E=C-x;a+=E,l.push(...g.marks.map(v=>({mark:v,from:x,to:C})))})}),a===0)return!1;const c=l.filter(f=>i?i.name===f.mark.type.name:!0).filter(f=>Ui(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)>=a}function Gk(n,e,t={}){if(!e)return no(n,null,t)||wl(n,null,t);const o=Gi(e,n.schema);return o==="node"?no(n,e,t):o==="mark"?wl(n,e,t):!1}var Kk=(n,e)=>{const{$from:t,$to:o,$anchor:r}=n.selection;if(e){const i=Ki(l=>l.type.name===e)(n.selection);if(!i)return!1;const a=n.doc.resolve(i.pos+1);return r.pos+1===a.end()}return!(o.parentOffset<o.parent.nodeSize-2||t.pos!==o.pos)},Jk=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function qp(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function Gp(n,e){const{nodeExtensions:t}=Wo(e),o=t.find(a=>a.name===n);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=je(Ee(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function Sl(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&&(Sl(i,{ignoreWhitespace:t,checkChildren:e})||(r=!1))}),r}return!1}var Kp=class lm{constructor(e){this.position=e}static fromJSON(e){return new lm(e.position)}toJSON(){return{position:this.position}}};function Xk(n,e){const t=e.mapping.mapResult(n.position);return{position:new Kp(t.pos),mapResult:t}}function Yk(n){return new Kp(n)}function Qk(n,e,t){var o;const{selection:r}=e;let i=null;if(zp(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:a}=r;return a.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(g=>g.type.excludes(t));d=h&&m}return!d}),d})}var Zk=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=t,{empty:a,ranges:l}=i,c=Tn(n,o.schema);if(r)if(a){const d=Dp(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),g=Math.min(h+p.nodeSize,f);p.marks.find(x=>x.type===c)?p.marks.forEach(x=>{c===x.type&&t.addMark(m,g,c.create({...x.attrs,...e}))}):t.addMark(m,g,c.create(e))})});return Qk(o,t,c)},eE=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),tE=(n,e={})=>({state:t,dispatch:o,chain:r})=>{const i=et(n,t.schema);let a;return t.selection.$anchor.sameParent(t.selection.$head)&&(a=t.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>df(i,{...a,...e})(t)?!0:l.clearNodes()).command(({state:l})=>df(i,{...a,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},nE=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,r=So(n,0,o.content.size),i=Ne.create(o,r);e.setSelection(i)}return!0},oE=(n,e)=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=o;let a,l;return typeof e=="number"?(a=e,l=e):e&&"from"in e&&"to"in e?(a=e.from,l=e.to):(a=i.from,l=i.to),r&&t.doc.nodesBetween(a,l,(c,d)=>{c.isText||t.setNodeMarkup(d,void 0,{...c.attrs,dir:n})}),!0},rE=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,{from:r,to:i}=typeof n=="number"?{from:n,to:n}:n,a=Oe.atStart(o).from,l=Oe.atEnd(o).to,c=So(r,a,l),d=So(i,a,l),u=Oe.create(o,c,d);e.setSelection(u)}return!0},iE=n=>({state:e,dispatch:t})=>{const o=et(n,e.schema);return Y1(o)(e,t)};function Jp(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 sE=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:o,editor:r})=>{const{selection:i,doc:a}=e,{$from:l,$to:c}=i,d=r.extensionManager.attributes,u=Yi(d,l.node().type.name,l.node().attrs);if(i instanceof Ne&&i.node.isBlock)return!l.parentOffset||!wn(a,l.pos)?!1:(o&&(n&&Jp(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:Dk(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:u}]:void 0,m=wn(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&wn(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 g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,p)&&e.setNodeMarkup(e.mapping.map(l.before()),p)}n&&Jp(t,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},aE=(n,e={})=>({tr:t,state:o,dispatch:r,editor:i})=>{var a;const l=et(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=re.empty;const C=c.index(-1)?1:c.index(-2)?2:3;for(let w=c.depth-C;w>=c.depth-3;w-=1)x=re.from(c.node(w).copy(x));const E=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,v={...Yi(p,c.node().type.name,c.node().attrs),...e},A=((a=l.contentMatch.defaultType)==null?void 0:a.createAndFill(v))||void 0;x=x.append(re.from(l.createAndFill(null,A)||void 0));const M=c.before(c.depth-(C-1));t.replace(M,c.after(-E),new pe(x,4-C,0));let k=-1;t.doc.nodesBetween(M,t.doc.content.size,(w,b)=>{if(k>-1)return!1;w.isTextblock&&w.content.size===0&&(k=b+1)}),k>-1&&t.setSelection(Oe.near(t.doc.resolve(k))),t.scrollIntoView()}return!0}const h=d.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...Yi(p,f.type.name,f.attrs),...e},g={...Yi(p,c.node().type.name,c.node().attrs),...e};t.delete(c.pos,d.pos);const y=h?[{type:l,attrs:m},{type:h,attrs:g}]:[{type:l,attrs:m}];if(!wn(t.doc,c.pos,2))return!1;if(r){const{selection:x,storedMarks:C}=o,{splittableMarks:E}=i.extensionManager,v=C||x.$to.parentOffset&&x.$from.marks();if(t.split(c.pos,2,y).scrollIntoView(),!v||!r)return!0;const A=v.filter(M=>E.includes(M.type.name));t.ensureMarks(A)}return!0},Cl=(n,e)=>{const t=Ki(a=>a.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&&qn(n.doc,t.pos)&&n.join(t.pos),!0},Nl=(n,e)=>{const t=Ki(a=>a.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&&qn(n.doc,o)&&n.join(o),!0},lE=(n,e,t,o={})=>({editor:r,tr:i,state:a,dispatch:l,chain:c,commands:d,can:u})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,h=et(n,a.schema),m=et(e,a.schema),{selection:g,storedMarks:y}=a,{$from:x,$to:C}=g,E=x.blockRange(C),v=y||g.$to.parentOffset&&g.$from.marks();if(!E)return!1;const A=Ki(M=>Gp(M.type.name,f))(g);if(E.depth>=1&&A&&E.depth-A.depth<=1){if(A.node.type===h)return d.liftListItem(m);if(Gp(A.node.type.name,f)&&h.validContent(A.node.content)&&l)return c().command(()=>(i.setNodeMarkup(A.pos,h),!0)).command(()=>Cl(i,h)).command(()=>Nl(i,h)).run()}return!t||!v||!l?c().command(()=>u().wrapInList(h,o)?!0:d.clearNodes()).wrapInList(h,o).command(()=>Cl(i,h)).command(()=>Nl(i,h)).run():c().command(()=>{const M=u().wrapInList(h,o),k=v.filter(w=>p.includes(w.type.name));return i.ensureMarks(k),M?!0:d.clearNodes()}).wrapInList(h,o).command(()=>Cl(i,h)).command(()=>Nl(i,h)).run()},cE=(n,e={},t={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=t,a=Tn(n,o.schema);return wl(o,a,e)?r.unsetMark(a,{extendEmptyMarkRange:i}):r.setMark(a,e)},dE=(n,e,t={})=>({state:o,commands:r})=>{const i=et(n,o.schema),a=et(e,o.schema),l=no(o,i,t);let c;return o.selection.$anchor.sameParent(o.selection.$head)&&(c=o.selection.$anchor.parent.attrs),l?r.setNode(a,c):r.setNode(i,{...c,...t})},uE=(n,e={})=>({state:t,commands:o})=>{const r=et(n,t.schema);return no(t,r,e)?o.lift(r):o.wrapIn(r,e)},fE=()=>({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 a=n.tr,l=i.transform;for(let c=l.steps.length-1;c>=0;c-=1)a.step(l.steps[c].invert(l.docs[c]));if(i.text){const c=a.doc.resolve(i.from).marks();a.replaceWith(i.from,i.to,n.schema.text(i.text,c))}else a.delete(i.from,i.to)}return!0}}return!1},pE=()=>({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},hE=(n,e={})=>({tr:t,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:a=!1}=e,{selection:l}=t,c=Tn(n,o.schema),{$from:d,empty:u,ranges:f}=l;if(!r)return!0;if(u&&a){let{from:p,to:h}=l;const m=(i=d.marks().find(y=>y.type===c))==null?void 0:i.attrs,g=yl(d,c,m);g&&(p=g.from,h=g.to),t.removeMark(p,h,c)}else f.forEach(p=>{t.removeMark(p.$from.pos,p.$to.pos,c)});return t.removeStoredMark(c),!0},mE=n=>({tr:e,state:t,dispatch:o})=>{const{selection:r}=t;let i,a;return typeof n=="number"?(i=n,a=n):n&&"from"in n&&"to"in n?(i=n.from,a=n.to):(i=r.from,a=r.to),o&&e.doc.nodesBetween(i,a,(l,c)=>{if(l.isText)return;const d={...l.attrs};delete d.dir,e.setNodeMarkup(c,void 0,d)}),!0},gE=(n,e={})=>({tr:t,state:o,dispatch:r})=>{let i=null,a=null;const l=Gi(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=et(n,o.schema)),l==="mark"&&(a=Tn(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,g;t.selection.empty?o.doc.nodesBetween(u,f,(y,x)=>{i&&i===y.type&&(c=!0,m=Math.max(x,u),g=Math.min(x+y.nodeSize,f),p=x,h=y)}):o.doc.nodesBetween(u,f,(y,x)=>{x<u&&i&&i===y.type&&(c=!0,m=Math.max(x,u),g=Math.min(x+y.nodeSize,f),p=x,h=y),x>=u&&x<=f&&(i&&i===y.type&&(c=!0,r&&t.setNodeMarkup(x,void 0,{...y.attrs,...e})),a&&y.marks.length&&y.marks.forEach(C=>{if(a===C.type&&(c=!0,r)){const E=Math.max(x,u),v=Math.min(x+y.nodeSize,f);t.addMark(E,v,a.create({...C.attrs,...e}))}}))}),h&&(p!==void 0&&r&&t.setNodeMarkup(p,void 0,{...h.attrs,...e}),a&&h.marks.length&&h.marks.forEach(y=>{a===y.type&&r&&t.addMark(m,g,a.create({...y.attrs,...e}))}))}),c},yE=(n,e={})=>({state:t,dispatch:o})=>{const r=et(n,t.schema);return U1(r,e)(t,o)},bE=(n,e={})=>({state:t,dispatch:o})=>{const r=et(n,t.schema);return W1(r,e)(t,o)},xE=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={}}},Xp=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},kE=(n,e)=>{if(gl(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 Qi(n){var e;const{editor:t,from:o,to:r,text:i,rules:a,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=qk(d)+i;return a.forEach(p=>{if(u)return;const h=kE(f,p.find);if(!h)return;const m=c.state.tr,g=ji({state:c.state,transaction:m}),y={from:o-(h[0].length-i.length),to:r},{commands:x,chain:C,can:E}=new Hi({editor:t,state:g});p.handler({state:g,range:y,match:h,commands:x,chain:C,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 EE(n){const{editor:e,rules:t}=n,o=new Mt({state:{init(){return null},apply(r,i,a){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=kl(re.from(u),a.schema);const{from:f}=c,p=f+u.length;Qi({editor:e,from:f,to:p,text:u,rules:t,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,a,l){return Qi({editor:e,from:i,to:a,text:l,rules:t,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&Qi({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:a}=r.state.selection;return a?Qi({editor:e,from:a.pos,to:a.pos,text:`
356
- `,rules:t,plugin:o}):!1}},isInputRules:!0});return o}function wE(n){return Object.prototype.toString.call(n).slice(8,-1)}function Zi(n){return wE(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Yp(n,e){const t={...n};return Zi(n)&&Zi(e)&&Object.keys(e).forEach(o=>{Zi(e[o])&&Zi(n[o])?t[o]=Yp(n[o],e[o]):t[o]=e[o]}),t}var vl=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(Ee(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...je(Ee(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>Yp(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}},Ar=class cm extends vl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new cm(t)}static handleExit({editor:e,mark:t}){const{tr:o}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const a=r.marks();if(!!!a.find(d=>d?.type.name===t.name))return!1;const c=a.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 SE(n){return typeof n=="number"}var CE=class{constructor(n){this.find=n.find,this.handler=n.handler}},NE=(n,e,t)=>{if(gl(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 vE(n){const{editor:e,state:t,from:o,to:r,rule:i,pasteEvent:a,dropEvent:l}=n,{commands:c,chain:d,can:u}=new Hi({editor:e,state:t}),f=[];return t.doc.nodesBetween(o,r,(h,m)=>{var g,y,x,C,E;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const v=(E=(C=(x=h.content)==null?void 0:x.size)!=null?C:h.nodeSize)!=null?E:0,A=Math.max(o,m),M=Math.min(r,m+v);if(A>=M)return;const k=h.isText?h.text||"":h.textBetween(A-m,M-m,void 0,"");NE(k,i.find,a).forEach(b=>{if(b.index===void 0)return;const R=A+b.index+1,B=R+b[0].length,O={from:t.tr.mapping.map(R),to:t.tr.mapping.map(B)},D=i.handler({state:t,range:O,match:b,commands:c,chain:d,can:u,pasteEvent:a,dropEvent:l});f.push(D)})}),f.every(h=>h!==null)}var es=null,TE=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function zE(n){const{editor:e,rules:t}=n;let o=null,r=!1,i=!1,a=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 g=u.tr,y=ji({state:u,transaction:g});if(!(!vE({editor:e,state:y,from:Math.max(f-1,0),to:p.b-1,rule:h,pasteEvent:m,dropEvent:l})||!g.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(u=>new Mt({view(f){const p=m=>{var g;o=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,o&&(es=e)},h=()=>{es&&(es=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=es;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 a=p,r=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,p,h)=>{const m=f[0],g=m.getMeta("uiEvent")==="paste"&&!r,y=m.getMeta("uiEvent")==="drop"&&!i,x=m.getMeta("applyPasteRules"),C=!!x;if(!g&&!y&&!C)return;if(C){let{text:A}=x;typeof A=="string"?A=A:A=kl(re.from(A),h.schema);const{from:M}=x,k=M+A.length,w=TE(A);return c({rule:u,state:h,from:M,to:{b:k},pasteEvt:w})}const E=p.doc.content.findDiffStart(h.doc.content),v=p.doc.content.findDiffEnd(h.doc.content);if(!(!SE(E)||!v||E===v.b))return c({rule:u,state:h,from:E,to:v,pasteEvt:a})}}))}var ts=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=Fp(n),this.schema=Vk(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:Xi(e.name,this.schema)},o=Ee(e,"addCommands",t);return o?{...n,...o()}:n},{})}get plugins(){const{editor:n}=this;return Ji([...this.extensions].reverse()).flatMap(o=>{const r={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:n,type:Xi(o.name,this.schema)},i=[],a=Ee(o,"addKeyboardShortcuts",r);let l={};if(o.type==="mark"&&Ee(o,"exitable",r)&&(l.ArrowRight=()=>Ar.handleExit({editor:n,mark:o})),a){const p=Object.fromEntries(Object.entries(a()).map(([h,m])=>[h,()=>m({editor:n})]));l={...l,...p}}const c=Fx(l);i.push(c);const d=Ee(o,"addInputRules",r);if(qp(o,n.options.enableInputRules)&&d){const p=d();if(p&&p.length){const h=EE({editor:n,rules:p}),m=Array.isArray(h)?h:[h];i.push(...m)}}const u=Ee(o,"addPasteRules",r);if(qp(o,n.options.enablePasteRules)&&u){const p=u();if(p&&p.length){const h=zE({editor:n,rules:p});i.push(...h)}}const f=Ee(o,"addProseMirrorPlugins",r);if(f){const p=f();i.push(...p)}return i})}get attributes(){return Lp(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Wo(this.extensions);return Object.fromEntries(e.filter(t=>!!Ee(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:et(t.name,this.schema)},i=Ee(t,"addNodeView",r);if(!i)return[];const a=i();if(!a)return[];const l=(c,d,u,f,p)=>{const h=Mr(c,o);return a({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 Ji([...this.extensions].reverse()).reduceRight((o,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Xi(r.name,this.schema)},a=Ee(r,"dispatchTransaction",i);return a?l=>{a.call(i,{transaction:l,next:o})}:o},n)}get markViews(){const{editor:n}=this,{markExtensions:e}=Wo(this.extensions);return Object.fromEntries(e.filter(t=>!!Ee(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:Tn(t.name,this.schema)},i=Ee(t,"addMarkView",r);if(!i)return[];const a=(l,c,d)=>{const u=Mr(l,o);return i()({mark:l,view:c,inline:d,editor:n,extension:t,HTMLAttributes:u,updateAttributes:f=>{BE(l,n,f)}})};return[t.name,a]}))}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:Xi(e.name,this.schema)};e.type==="mark"&&((t=je(Ee(e,"keepOnSplit",o)))==null||t)&&this.splittableMarks.push(e.name);const r=Ee(e,"onBeforeCreate",o),i=Ee(e,"onCreate",o),a=Ee(e,"onUpdate",o),l=Ee(e,"onSelectionUpdate",o),c=Ee(e,"onTransaction",o),d=Ee(e,"onFocus",o),u=Ee(e,"onBlur",o),f=Ee(e,"onDestroy",o);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),a&&this.editor.on("update",a),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)})}};ts.resolve=Fp,ts.sort=Ji,ts.flatten=xl;var ME={};ml(ME,{ClipboardTextSerializer:()=>Qp,Commands:()=>Zp,Delete:()=>eh,Drop:()=>th,Editable:()=>nh,FocusEvents:()=>rh,Keymap:()=>ih,Paste:()=>sh,Tabindex:()=>ah,TextDirection:()=>lh,focusEventsPluginKey:()=>oh});var Wt=class dm extends vl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new dm(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Qp=Wt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Mt({key:new rn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:o,selection:r}=e,{ranges:i}=r,a=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),c=Hp(t);return jp(o,{from:a,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),Zp=Wt.create({name:"commands",addCommands(){return{...Np}}}),eh=Wt.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,o,r;const i=()=>{var a,l,c,d;if((d=(c=(l=(a=this.editor.options.coreExtensionOptions)==null?void 0:a.delete)==null?void 0:l.filterTransaction)==null?void 0:c.call(l,n))!=null?d:n.getMeta("y-sync$"))return;const u=Pp(n.before,[n,...e]);Wp(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,g)=>{const y=g+m.nodeSize-2,x=h.oldRange.from<=g&&y<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:y,newFrom:u.mapping.map(g),newTo:u.mapping.map(y),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 g,y;if(h instanceof on){const x=p.slice(m).map(h.from,-1),C=p.slice(m).map(h.to),E=p.invert().map(x,-1),v=p.invert().map(C),A=(g=u.doc.nodeAt(x-1))==null?void 0:g.marks.some(k=>k.eq(h.mark)),M=(y=u.doc.nodeAt(C))==null?void 0:y.marks.some(k=>k.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:C},partial:!!(M||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()}}),th=Wt.create({name:"drop",addProseMirrorPlugins(){return[new Mt({key:new rn("tiptapDrop"),props:{handleDrop:(n,e,t,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:o})}}})]}}),nh=Wt.create({name:"editable",addProseMirrorPlugins(){return[new Mt({key:new rn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),oh=new rn("focusEvents"),rh=Wt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Mt({key:oh,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}}}})]}}),ih=Wt.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.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,g=m.parent.type.spec.isolating,y=f.pos-f.parentOffset,x=g&&m.parent.childCount===1?y===f.pos:Re.atStart(d).from===p;return!u||!h.type.isTextblock||h.textContent.length||!x||x&&f.parent.type.name==="paragraph"?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),o={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.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 Wi()||_p()?i:r},addProseMirrorPlugins(){return[new Mt({key:new rn("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const o=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),r=n.some(g=>g.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:a,to:l}=e.selection,c=Re.atStart(e.doc).from,d=Re.atEnd(e.doc).to;if(i||!(a===c&&l===d)||!Sl(t.doc))return;const p=t.tr,h=ji({state:t,transaction:p}),{commands:m}=new Hi({editor:this.editor,state:h});if(m.clearNodes(),!!p.steps.length)return p}})]}}),sh=Wt.create({name:"paste",addProseMirrorPlugins(){return[new Mt({key:new rn("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),ah=Wt.create({name:"tabindex",addProseMirrorPlugins(){return[new Mt({key:new rn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),lh=Wt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=Wo(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 rn("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),AE=class Yo{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 Yo(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 Yo(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 Yo(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,a=this.pos+o+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!r&&l.depth<=this.depth)return;const c=new Yo(l,this.editor,r,r?t:null);r&&(c.actualDepth=this.depth+1),e.push(new Yo(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,a=Object.keys(t);for(let l=0;l<a.length;l+=1){const c=a[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(a=>{o&&r.length>0||(a.node.type.name===e&&i.every(c=>t[c]===a.node.attrs[c])&&r.push(a),!(o&&r.length>0)&&(r=r.concat(a.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)}},IE=`.ProseMirror {
355
+ `,textSerializers:a={}}=t||{};let l="";return n.nodesBetween(o,r,(c,d,u,f)=>{var p;c.isBlock&&d>o&&(l+=i);const h=a?.[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 Fk(n,e){const t={from:0,to:n.content.size};return jp(n,t,e)}function Hp(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function jk(n,e){const t=et(e,n.schema),{from:o,to:r}=n.selection,i=[];n.doc.nodesBetween(o,r,l=>{i.push(l)});const a=i.reverse().find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function Up(n,e){const t=Gi(typeof e=="string"?e:e.name,n.schema);return t==="node"?jk(n,e):t==="mark"?Dp(n,e):{}}function Hk(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 Uk(n){const e=Hk(n);return e.length===1?e:e.filter((t,o)=>!e.filter((i,a)=>a!==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 Wp(n){const{mapping:e,steps:t}=n,o=[];return e.maps.forEach((r,i)=>{const a=[];if(r.ranges.length)r.forEach((l,c)=>{a.push({from:l,to:c})});else{const{from:l,to:c}=t[i];if(l===void 0||c===void 0)return;a.push({from:l,to:c})}a.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}})})}),Uk(o)}function El(n,e,t){const o=[];return n===e?t.resolve(n).marks().forEach(r=>{const i=t.resolve(n),a=yl(i,r.type);a&&o.push({mark:r,...a})}):t.nodesBetween(n,e,(r,i)=>{!r||r?.nodeSize===void 0||o.push(...r.marks.map(a=>({from:i,to:i+r.nodeSize,mark:a})))}),o}var Wk=(n,e,t,o=20)=>{const r=n.doc.resolve(t);let i=o,a=null;for(;i>0&&a===null;){const l=r.node(i);l?.type.name===e?a=l:i-=1}return[a,i]};function Xi(n,e){return e.nodes[n]||e.marks[n]||null}function Yi(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 qk=(n,e=500)=>{let t="";const o=n.parentOffset;return n.parent.nodesBetween(Math.max(0,o-e),o,(r,i,a,l)=>{var c,d;const u=((d=(c=r.type.spec).toText)==null?void 0:d.call(c,{node:r,pos:i,parent:a,index:l}))||r.textContent||"%leaf%";t+=r.isAtom&&!r.isText?u:u.slice(0,Math.max(0,o-i))}),t};function wl(n,e,t={}){const{empty:o,ranges:r}=n.selection,i=e?Tn(e,n.schema):null;if(o)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>i?i.name===f.type.name:!0).find(f=>Ui(f.attrs,t,{strict:!1}));let a=0;const l=[];if(r.forEach(({$from:f,$to:p})=>{const h=f.pos,m=p.pos;n.doc.nodesBetween(h,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const x=Math.max(h,y),N=Math.min(m,y+g.nodeSize),E=N-x;a+=E,l.push(...g.marks.map(v=>({mark:v,from:x,to:N})))})}),a===0)return!1;const c=l.filter(f=>i?i.name===f.mark.type.name:!0).filter(f=>Ui(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)>=a}function Gk(n,e,t={}){if(!e)return no(n,null,t)||wl(n,null,t);const o=Gi(e,n.schema);return o==="node"?no(n,e,t):o==="mark"?wl(n,e,t):!1}var Kk=(n,e)=>{const{$from:t,$to:o,$anchor:r}=n.selection;if(e){const i=Ki(l=>l.type.name===e)(n.selection);if(!i)return!1;const a=n.doc.resolve(i.pos+1);return r.pos+1===a.end()}return!(o.parentOffset<o.parent.nodeSize-2||t.pos!==o.pos)},Jk=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function qp(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function Gp(n,e){const{nodeExtensions:t}=Wo(e),o=t.find(a=>a.name===n);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=je(Ee(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function Sl(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&&(Sl(i,{ignoreWhitespace:t,checkChildren:e})||(r=!1))}),r}return!1}var Kp=class lm{constructor(e){this.position=e}static fromJSON(e){return new lm(e.position)}toJSON(){return{position:this.position}}};function Xk(n,e){const t=e.mapping.mapResult(n.position);return{position:new Kp(t.pos),mapResult:t}}function Yk(n){return new Kp(n)}function Qk(n,e,t){var o;const{selection:r}=e;let i=null;if(zp(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:a}=r;return a.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(g=>g.type.excludes(t));d=h&&m}return!d}),d})}var Zk=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=t,{empty:a,ranges:l}=i,c=Tn(n,o.schema);if(r)if(a){const d=Dp(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),g=Math.min(h+p.nodeSize,f);p.marks.find(x=>x.type===c)?p.marks.forEach(x=>{c===x.type&&t.addMark(m,g,c.create({...x.attrs,...e}))}):t.addMark(m,g,c.create(e))})});return Qk(o,t,c)},eE=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),tE=(n,e={})=>({state:t,dispatch:o,chain:r})=>{const i=et(n,t.schema);let a;return t.selection.$anchor.sameParent(t.selection.$head)&&(a=t.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>df(i,{...a,...e})(t)?!0:l.clearNodes()).command(({state:l})=>df(i,{...a,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},nE=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,r=So(n,0,o.content.size),i=Ne.create(o,r);e.setSelection(i)}return!0},oE=(n,e)=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=o;let a,l;return typeof e=="number"?(a=e,l=e):e&&"from"in e&&"to"in e?(a=e.from,l=e.to):(a=i.from,l=i.to),r&&t.doc.nodesBetween(a,l,(c,d)=>{c.isText||t.setNodeMarkup(d,void 0,{...c.attrs,dir:n})}),!0},rE=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,{from:r,to:i}=typeof n=="number"?{from:n,to:n}:n,a=Oe.atStart(o).from,l=Oe.atEnd(o).to,c=So(r,a,l),d=So(i,a,l),u=Oe.create(o,c,d);e.setSelection(u)}return!0},iE=n=>({state:e,dispatch:t})=>{const o=et(n,e.schema);return Y1(o)(e,t)};function Jp(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 sE=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:o,editor:r})=>{const{selection:i,doc:a}=e,{$from:l,$to:c}=i,d=r.extensionManager.attributes,u=Yi(d,l.node().type.name,l.node().attrs);if(i instanceof Ne&&i.node.isBlock)return!l.parentOffset||!wn(a,l.pos)?!1:(o&&(n&&Jp(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:Dk(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:u}]:void 0,m=wn(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&wn(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 g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,p)&&e.setNodeMarkup(e.mapping.map(l.before()),p)}n&&Jp(t,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},aE=(n,e={})=>({tr:t,state:o,dispatch:r,editor:i})=>{var a;const l=et(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=re.empty;const N=c.index(-1)?1:c.index(-2)?2:3;for(let w=c.depth-N;w>=c.depth-3;w-=1)x=re.from(c.node(w).copy(x));const E=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,v={...Yi(p,c.node().type.name,c.node().attrs),...e},A=((a=l.contentMatch.defaultType)==null?void 0:a.createAndFill(v))||void 0;x=x.append(re.from(l.createAndFill(null,A)||void 0));const M=c.before(c.depth-(N-1));t.replace(M,c.after(-E),new pe(x,4-N,0));let k=-1;t.doc.nodesBetween(M,t.doc.content.size,(w,b)=>{if(k>-1)return!1;w.isTextblock&&w.content.size===0&&(k=b+1)}),k>-1&&t.setSelection(Oe.near(t.doc.resolve(k))),t.scrollIntoView()}return!0}const h=d.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...Yi(p,f.type.name,f.attrs),...e},g={...Yi(p,c.node().type.name,c.node().attrs),...e};t.delete(c.pos,d.pos);const y=h?[{type:l,attrs:m},{type:h,attrs:g}]:[{type:l,attrs:m}];if(!wn(t.doc,c.pos,2))return!1;if(r){const{selection:x,storedMarks:N}=o,{splittableMarks:E}=i.extensionManager,v=N||x.$to.parentOffset&&x.$from.marks();if(t.split(c.pos,2,y).scrollIntoView(),!v||!r)return!0;const A=v.filter(M=>E.includes(M.type.name));t.ensureMarks(A)}return!0},Cl=(n,e)=>{const t=Ki(a=>a.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&&qn(n.doc,t.pos)&&n.join(t.pos),!0},Nl=(n,e)=>{const t=Ki(a=>a.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&&qn(n.doc,o)&&n.join(o),!0},lE=(n,e,t,o={})=>({editor:r,tr:i,state:a,dispatch:l,chain:c,commands:d,can:u})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,h=et(n,a.schema),m=et(e,a.schema),{selection:g,storedMarks:y}=a,{$from:x,$to:N}=g,E=x.blockRange(N),v=y||g.$to.parentOffset&&g.$from.marks();if(!E)return!1;const A=Ki(M=>Gp(M.type.name,f))(g);if(E.depth>=1&&A&&E.depth-A.depth<=1){if(A.node.type===h)return d.liftListItem(m);if(Gp(A.node.type.name,f)&&h.validContent(A.node.content)&&l)return c().command(()=>(i.setNodeMarkup(A.pos,h),!0)).command(()=>Cl(i,h)).command(()=>Nl(i,h)).run()}return!t||!v||!l?c().command(()=>u().wrapInList(h,o)?!0:d.clearNodes()).wrapInList(h,o).command(()=>Cl(i,h)).command(()=>Nl(i,h)).run():c().command(()=>{const M=u().wrapInList(h,o),k=v.filter(w=>p.includes(w.type.name));return i.ensureMarks(k),M?!0:d.clearNodes()}).wrapInList(h,o).command(()=>Cl(i,h)).command(()=>Nl(i,h)).run()},cE=(n,e={},t={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=t,a=Tn(n,o.schema);return wl(o,a,e)?r.unsetMark(a,{extendEmptyMarkRange:i}):r.setMark(a,e)},dE=(n,e,t={})=>({state:o,commands:r})=>{const i=et(n,o.schema),a=et(e,o.schema),l=no(o,i,t);let c;return o.selection.$anchor.sameParent(o.selection.$head)&&(c=o.selection.$anchor.parent.attrs),l?r.setNode(a,c):r.setNode(i,{...c,...t})},uE=(n,e={})=>({state:t,commands:o})=>{const r=et(n,t.schema);return no(t,r,e)?o.lift(r):o.wrapIn(r,e)},fE=()=>({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 a=n.tr,l=i.transform;for(let c=l.steps.length-1;c>=0;c-=1)a.step(l.steps[c].invert(l.docs[c]));if(i.text){const c=a.doc.resolve(i.from).marks();a.replaceWith(i.from,i.to,n.schema.text(i.text,c))}else a.delete(i.from,i.to)}return!0}}return!1},pE=()=>({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},hE=(n,e={})=>({tr:t,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:a=!1}=e,{selection:l}=t,c=Tn(n,o.schema),{$from:d,empty:u,ranges:f}=l;if(!r)return!0;if(u&&a){let{from:p,to:h}=l;const m=(i=d.marks().find(y=>y.type===c))==null?void 0:i.attrs,g=yl(d,c,m);g&&(p=g.from,h=g.to),t.removeMark(p,h,c)}else f.forEach(p=>{t.removeMark(p.$from.pos,p.$to.pos,c)});return t.removeStoredMark(c),!0},mE=n=>({tr:e,state:t,dispatch:o})=>{const{selection:r}=t;let i,a;return typeof n=="number"?(i=n,a=n):n&&"from"in n&&"to"in n?(i=n.from,a=n.to):(i=r.from,a=r.to),o&&e.doc.nodesBetween(i,a,(l,c)=>{if(l.isText)return;const d={...l.attrs};delete d.dir,e.setNodeMarkup(c,void 0,d)}),!0},gE=(n,e={})=>({tr:t,state:o,dispatch:r})=>{let i=null,a=null;const l=Gi(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=et(n,o.schema)),l==="mark"&&(a=Tn(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,g;t.selection.empty?o.doc.nodesBetween(u,f,(y,x)=>{i&&i===y.type&&(c=!0,m=Math.max(x,u),g=Math.min(x+y.nodeSize,f),p=x,h=y)}):o.doc.nodesBetween(u,f,(y,x)=>{x<u&&i&&i===y.type&&(c=!0,m=Math.max(x,u),g=Math.min(x+y.nodeSize,f),p=x,h=y),x>=u&&x<=f&&(i&&i===y.type&&(c=!0,r&&t.setNodeMarkup(x,void 0,{...y.attrs,...e})),a&&y.marks.length&&y.marks.forEach(N=>{if(a===N.type&&(c=!0,r)){const E=Math.max(x,u),v=Math.min(x+y.nodeSize,f);t.addMark(E,v,a.create({...N.attrs,...e}))}}))}),h&&(p!==void 0&&r&&t.setNodeMarkup(p,void 0,{...h.attrs,...e}),a&&h.marks.length&&h.marks.forEach(y=>{a===y.type&&r&&t.addMark(m,g,a.create({...y.attrs,...e}))}))}),c},yE=(n,e={})=>({state:t,dispatch:o})=>{const r=et(n,t.schema);return U1(r,e)(t,o)},bE=(n,e={})=>({state:t,dispatch:o})=>{const r=et(n,t.schema);return W1(r,e)(t,o)},xE=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={}}},Xp=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},kE=(n,e)=>{if(gl(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 Qi(n){var e;const{editor:t,from:o,to:r,text:i,rules:a,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=qk(d)+i;return a.forEach(p=>{if(u)return;const h=kE(f,p.find);if(!h)return;const m=c.state.tr,g=ji({state:c.state,transaction:m}),y={from:o-(h[0].length-i.length),to:r},{commands:x,chain:N,can:E}=new Hi({editor:t,state:g});p.handler({state:g,range:y,match:h,commands:x,chain:N,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 EE(n){const{editor:e,rules:t}=n,o=new Mt({state:{init(){return null},apply(r,i,a){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=kl(re.from(u),a.schema);const{from:f}=c,p=f+u.length;Qi({editor:e,from:f,to:p,text:u,rules:t,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,a,l){return Qi({editor:e,from:i,to:a,text:l,rules:t,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&Qi({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:a}=r.state.selection;return a?Qi({editor:e,from:a.pos,to:a.pos,text:`
356
+ `,rules:t,plugin:o}):!1}},isInputRules:!0});return o}function wE(n){return Object.prototype.toString.call(n).slice(8,-1)}function Zi(n){return wE(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Yp(n,e){const t={...n};return Zi(n)&&Zi(e)&&Object.keys(e).forEach(o=>{Zi(e[o])&&Zi(n[o])?t[o]=Yp(n[o],e[o]):t[o]=e[o]}),t}var vl=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(Ee(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...je(Ee(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>Yp(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}},Ar=class cm extends vl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new cm(t)}static handleExit({editor:e,mark:t}){const{tr:o}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const a=r.marks();if(!!!a.find(d=>d?.type.name===t.name))return!1;const c=a.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 SE(n){return typeof n=="number"}var CE=class{constructor(n){this.find=n.find,this.handler=n.handler}},NE=(n,e,t)=>{if(gl(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 vE(n){const{editor:e,state:t,from:o,to:r,rule:i,pasteEvent:a,dropEvent:l}=n,{commands:c,chain:d,can:u}=new Hi({editor:e,state:t}),f=[];return t.doc.nodesBetween(o,r,(h,m)=>{var g,y,x,N,E;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const v=(E=(N=(x=h.content)==null?void 0:x.size)!=null?N:h.nodeSize)!=null?E:0,A=Math.max(o,m),M=Math.min(r,m+v);if(A>=M)return;const k=h.isText?h.text||"":h.textBetween(A-m,M-m,void 0,"");NE(k,i.find,a).forEach(b=>{if(b.index===void 0)return;const R=A+b.index+1,B=R+b[0].length,O={from:t.tr.mapping.map(R),to:t.tr.mapping.map(B)},D=i.handler({state:t,range:O,match:b,commands:c,chain:d,can:u,pasteEvent:a,dropEvent:l});f.push(D)})}),f.every(h=>h!==null)}var es=null,TE=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function zE(n){const{editor:e,rules:t}=n;let o=null,r=!1,i=!1,a=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 g=u.tr,y=ji({state:u,transaction:g});if(!(!vE({editor:e,state:y,from:Math.max(f-1,0),to:p.b-1,rule:h,pasteEvent:m,dropEvent:l})||!g.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(u=>new Mt({view(f){const p=m=>{var g;o=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,o&&(es=e)},h=()=>{es&&(es=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=es;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 a=p,r=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,p,h)=>{const m=f[0],g=m.getMeta("uiEvent")==="paste"&&!r,y=m.getMeta("uiEvent")==="drop"&&!i,x=m.getMeta("applyPasteRules"),N=!!x;if(!g&&!y&&!N)return;if(N){let{text:A}=x;typeof A=="string"?A=A:A=kl(re.from(A),h.schema);const{from:M}=x,k=M+A.length,w=TE(A);return c({rule:u,state:h,from:M,to:{b:k},pasteEvt:w})}const E=p.doc.content.findDiffStart(h.doc.content),v=p.doc.content.findDiffEnd(h.doc.content);if(!(!SE(E)||!v||E===v.b))return c({rule:u,state:h,from:E,to:v,pasteEvt:a})}}))}var ts=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=Fp(n),this.schema=Vk(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:Xi(e.name,this.schema)},o=Ee(e,"addCommands",t);return o?{...n,...o()}:n},{})}get plugins(){const{editor:n}=this;return Ji([...this.extensions].reverse()).flatMap(o=>{const r={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:n,type:Xi(o.name,this.schema)},i=[],a=Ee(o,"addKeyboardShortcuts",r);let l={};if(o.type==="mark"&&Ee(o,"exitable",r)&&(l.ArrowRight=()=>Ar.handleExit({editor:n,mark:o})),a){const p=Object.fromEntries(Object.entries(a()).map(([h,m])=>[h,()=>m({editor:n})]));l={...l,...p}}const c=Fx(l);i.push(c);const d=Ee(o,"addInputRules",r);if(qp(o,n.options.enableInputRules)&&d){const p=d();if(p&&p.length){const h=EE({editor:n,rules:p}),m=Array.isArray(h)?h:[h];i.push(...m)}}const u=Ee(o,"addPasteRules",r);if(qp(o,n.options.enablePasteRules)&&u){const p=u();if(p&&p.length){const h=zE({editor:n,rules:p});i.push(...h)}}const f=Ee(o,"addProseMirrorPlugins",r);if(f){const p=f();i.push(...p)}return i})}get attributes(){return Lp(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Wo(this.extensions);return Object.fromEntries(e.filter(t=>!!Ee(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:et(t.name,this.schema)},i=Ee(t,"addNodeView",r);if(!i)return[];const a=i();if(!a)return[];const l=(c,d,u,f,p)=>{const h=Mr(c,o);return a({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 Ji([...this.extensions].reverse()).reduceRight((o,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Xi(r.name,this.schema)},a=Ee(r,"dispatchTransaction",i);return a?l=>{a.call(i,{transaction:l,next:o})}:o},n)}get markViews(){const{editor:n}=this,{markExtensions:e}=Wo(this.extensions);return Object.fromEntries(e.filter(t=>!!Ee(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:Tn(t.name,this.schema)},i=Ee(t,"addMarkView",r);if(!i)return[];const a=(l,c,d)=>{const u=Mr(l,o);return i()({mark:l,view:c,inline:d,editor:n,extension:t,HTMLAttributes:u,updateAttributes:f=>{BE(l,n,f)}})};return[t.name,a]}))}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:Xi(e.name,this.schema)};e.type==="mark"&&((t=je(Ee(e,"keepOnSplit",o)))==null||t)&&this.splittableMarks.push(e.name);const r=Ee(e,"onBeforeCreate",o),i=Ee(e,"onCreate",o),a=Ee(e,"onUpdate",o),l=Ee(e,"onSelectionUpdate",o),c=Ee(e,"onTransaction",o),d=Ee(e,"onFocus",o),u=Ee(e,"onBlur",o),f=Ee(e,"onDestroy",o);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),a&&this.editor.on("update",a),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)})}};ts.resolve=Fp,ts.sort=Ji,ts.flatten=xl;var ME={};ml(ME,{ClipboardTextSerializer:()=>Qp,Commands:()=>Zp,Delete:()=>eh,Drop:()=>th,Editable:()=>nh,FocusEvents:()=>rh,Keymap:()=>ih,Paste:()=>sh,Tabindex:()=>ah,TextDirection:()=>lh,focusEventsPluginKey:()=>oh});var Wt=class dm extends vl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new dm(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Qp=Wt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Mt({key:new rn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:o,selection:r}=e,{ranges:i}=r,a=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),c=Hp(t);return jp(o,{from:a,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),Zp=Wt.create({name:"commands",addCommands(){return{...Np}}}),eh=Wt.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,o,r;const i=()=>{var a,l,c,d;if((d=(c=(l=(a=this.editor.options.coreExtensionOptions)==null?void 0:a.delete)==null?void 0:l.filterTransaction)==null?void 0:c.call(l,n))!=null?d:n.getMeta("y-sync$"))return;const u=Pp(n.before,[n,...e]);Wp(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,g)=>{const y=g+m.nodeSize-2,x=h.oldRange.from<=g&&y<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:y,newFrom:u.mapping.map(g),newTo:u.mapping.map(y),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 g,y;if(h instanceof on){const x=p.slice(m).map(h.from,-1),N=p.slice(m).map(h.to),E=p.invert().map(x,-1),v=p.invert().map(N),A=(g=u.doc.nodeAt(x-1))==null?void 0:g.marks.some(k=>k.eq(h.mark)),M=(y=u.doc.nodeAt(N))==null?void 0:y.marks.some(k=>k.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:N},partial:!!(M||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()}}),th=Wt.create({name:"drop",addProseMirrorPlugins(){return[new Mt({key:new rn("tiptapDrop"),props:{handleDrop:(n,e,t,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:o})}}})]}}),nh=Wt.create({name:"editable",addProseMirrorPlugins(){return[new Mt({key:new rn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),oh=new rn("focusEvents"),rh=Wt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Mt({key:oh,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}}}})]}}),ih=Wt.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.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,g=m.parent.type.spec.isolating,y=f.pos-f.parentOffset,x=g&&m.parent.childCount===1?y===f.pos:Re.atStart(d).from===p;return!u||!h.type.isTextblock||h.textContent.length||!x||x&&f.parent.type.name==="paragraph"?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),o={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.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 Wi()||_p()?i:r},addProseMirrorPlugins(){return[new Mt({key:new rn("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const o=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),r=n.some(g=>g.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:a,to:l}=e.selection,c=Re.atStart(e.doc).from,d=Re.atEnd(e.doc).to;if(i||!(a===c&&l===d)||!Sl(t.doc))return;const p=t.tr,h=ji({state:t,transaction:p}),{commands:m}=new Hi({editor:this.editor,state:h});if(m.clearNodes(),!!p.steps.length)return p}})]}}),sh=Wt.create({name:"paste",addProseMirrorPlugins(){return[new Mt({key:new rn("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),ah=Wt.create({name:"tabindex",addProseMirrorPlugins(){return[new Mt({key:new rn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),lh=Wt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=Wo(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 rn("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),AE=class Yo{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 Yo(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 Yo(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 Yo(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,a=this.pos+o+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!r&&l.depth<=this.depth)return;const c=new Yo(l,this.editor,r,r?t:null);r&&(c.actualDepth=this.depth+1),e.push(new Yo(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,a=Object.keys(t);for(let l=0;l<a.length;l+=1){const c=a[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(a=>{o&&r.length>0||(a.node.type.name===e&&i.every(c=>t[c]===a.node.attrs[c])&&r.push(a),!(o&&r.length>0)&&(r=r.concat(a.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)}},IE=`.ProseMirror {
357
357
  position: relative;
358
358
  }
359
359
 
@@ -425,19 +425,19 @@ img.ProseMirror-separator {
425
425
  display: block;
426
426
  }`;function _E(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 OE=class extends xE{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:Xk,createMappablePosition:Yk},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:a})=>this.options.onDrop(r,i,a)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const t=this.createDoc(),o=Mp(t,this.options.autofocus);this.editorState=Lo.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=_E(IE,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=Rp(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 a=typeof i=="string"?`${i}$`:i.key;o=o.filter(l=>!l.key.startsWith(a))}),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?[nh,Qp.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),Zp,rh,ih,ah,th,sh,eh,lh.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 ts(r,this)}createCommandManager(){this.commandManager=new Hi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=bl(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=bl(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 xp(e,{...t,attributes:{role:"textbox",...t?.attributes},dispatchTransaction:i,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),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),a=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)||a.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:o.slice(1)})}getAttributes(e){return Up(this.state,e)}isActive(e,t){const o=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return Gk(this.state,o,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return kl(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
427
427
 
428
- `,textSerializers:o={}}=e||{};return Fk(this.state.doc,{blockSeparator:t,textSerializers:{...Hp(this.schema),...o}})}get isEmpty(){return Sl(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 AE(t,this)}get $doc(){return this.$pos(0)}};function Ir(n){return new Xp({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,a=o[o.length-1],l=o[0];if(a){const c=l.search(/\S/),d=t.from+l.indexOf(a),u=d+a.length;if(El(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==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+a.length;i.addMark(t.from+c,p,n.type.create(r||{})),i.removeStoredMark(n.type)}},undoable:n.undoable})}function _r(n){return new Xp({find:n.find,handler:({state:e,range:t,match:o,chain:r})=>{const i=je(n.getAttributes,void 0,o)||{},a=e.tr.delete(t.from,t.to),c=a.doc.resolve(t.from).blockRange(),d=c&&Ia(c,n.type,i);if(!d)return null;if(a.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 g=m.filter(y=>h.includes(y.type.name));a.ensureMarks(g)}}if(n.keepAttributes){const f=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(f,i).run()}const u=a.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&qn(a.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(o,u))&&a.join(t.from-1)},undoable:n.undoable})}var DE={};ml(DE,{createAtomBlockMarkdownSpec:()=>PE,createBlockMarkdownSpec:()=>RE,createInlineMarkdownSpec:()=>VE,parseAttributes:()=>Tl,parseIndentedBlocks:()=>Ml,renderNestedMarkdownContent:()=>Al,serializeAttributes:()=>zl});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 a=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(o.matchAll(a)).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 zl(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 PE(n){const{nodeName:e,name:t,parseAttributes:o=Tl,serializeAttributes:r=zl,defaultAttributes:i={},requiredAttributes:a=[],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 g=m[1]||"",y=o(g);if(!a.find(C=>!(C in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:u=>{const f=d(u.attrs||{}),p=r(f),h=p?` {${p}}`:"";return`:::${c}${h} :::`}}}function RE(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=Tl,serializeAttributes:i=zl,defaultAttributes:a={},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 g=o(f);h=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?h=p.parseChildren(f.tokens||[]):h=p.parseInline(f.tokens||[]);const m={...a,...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 g=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[x,C=""]=y,E=r(C);let v=1;const A=x.length;let M="";const k=/^:::([\w-]*)(\s.*)?/gm,w=f.slice(A);for(k.lastIndex=0;;){const b=k.exec(w);if(b===null)break;const R=b.index,B=b[1];if(!((m=b[2])!=null&&m.endsWith(":::"))){if(B)v+=1;else if(v-=1,v===0){const O=w.slice(0,R);M=O.trim();const D=f.slice(0,A+R+b[0].length);let P=[];if(M)if(l==="block")for(P=h.blockTokens(O),P.forEach(q=>{q.text&&(!q.tokens||q.tokens.length===0)&&(q.tokens=h.inlineTokens(q.text))});P.length>0;){const q=P[P.length-1];if(q.type==="paragraph"&&(!q.text||q.text.trim()===""))P.pop();else break}else P=h.inlineTokens(M);return{type:e,raw:D,attributes:E,content:M,tokens:P}}}}}},renderMarkdown:(f,p)=>{const h=u(f.attrs||{}),m=i(h),g=m?` {${m}}`:"",y=p.renderChildren(f.content||[],`
428
+ `,textSerializers:o={}}=e||{};return Fk(this.state.doc,{blockSeparator:t,textSerializers:{...Hp(this.schema),...o}})}get isEmpty(){return Sl(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 AE(t,this)}get $doc(){return this.$pos(0)}};function Ir(n){return new Xp({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,a=o[o.length-1],l=o[0];if(a){const c=l.search(/\S/),d=t.from+l.indexOf(a),u=d+a.length;if(El(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==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+a.length;i.addMark(t.from+c,p,n.type.create(r||{})),i.removeStoredMark(n.type)}},undoable:n.undoable})}function _r(n){return new Xp({find:n.find,handler:({state:e,range:t,match:o,chain:r})=>{const i=je(n.getAttributes,void 0,o)||{},a=e.tr.delete(t.from,t.to),c=a.doc.resolve(t.from).blockRange(),d=c&&Ia(c,n.type,i);if(!d)return null;if(a.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 g=m.filter(y=>h.includes(y.type.name));a.ensureMarks(g)}}if(n.keepAttributes){const f=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(f,i).run()}const u=a.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&qn(a.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(o,u))&&a.join(t.from-1)},undoable:n.undoable})}var DE={};ml(DE,{createAtomBlockMarkdownSpec:()=>PE,createBlockMarkdownSpec:()=>RE,createInlineMarkdownSpec:()=>VE,parseAttributes:()=>Tl,parseIndentedBlocks:()=>Ml,renderNestedMarkdownContent:()=>Al,serializeAttributes:()=>zl});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 a=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(o.matchAll(a)).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 zl(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 PE(n){const{nodeName:e,name:t,parseAttributes:o=Tl,serializeAttributes:r=zl,defaultAttributes:i={},requiredAttributes:a=[],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 g=m[1]||"",y=o(g);if(!a.find(N=>!(N in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:u=>{const f=d(u.attrs||{}),p=r(f),h=p?` {${p}}`:"";return`:::${c}${h} :::`}}}function RE(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=Tl,serializeAttributes:i=zl,defaultAttributes:a={},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 g=o(f);h=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?h=p.parseChildren(f.tokens||[]):h=p.parseInline(f.tokens||[]);const m={...a,...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 g=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[x,N=""]=y,E=r(N);let v=1;const A=x.length;let M="";const k=/^:::([\w-]*)(\s.*)?/gm,w=f.slice(A);for(k.lastIndex=0;;){const b=k.exec(w);if(b===null)break;const R=b.index,B=b[1];if(!((m=b[2])!=null&&m.endsWith(":::"))){if(B)v+=1;else if(v-=1,v===0){const O=w.slice(0,R);M=O.trim();const D=f.slice(0,A+R+b[0].length);let P=[];if(M)if(l==="block")for(P=h.blockTokens(O),P.forEach(q=>{q.text&&(!q.tokens||q.tokens.length===0)&&(q.tokens=h.inlineTokens(q.text))});P.length>0;){const q=P[P.length-1];if(q.type==="paragraph"&&(!q.text||q.text.trim()===""))P.pop();else break}else P=h.inlineTokens(M);return{type:e,raw:D,attributes:E,content:M,tokens:P}}}}}},renderMarkdown:(f,p)=>{const h=u(f.attrs||{}),m=i(h),g=m?` {${m}}`:"",y=p.renderChildren(f.content||[],`
429
429
 
430
430
  `);return`:::${d}${g}
431
431
 
432
432
  ${y}
433
433
 
434
- :::`}}}function LE(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let o=t.exec(n);for(;o!==null;){const[,r,i,a]=o;e[r]=i||a,o=t.exec(n)}return e}function $E(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function VE(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=LE,serializeAttributes:i=$E,defaultAttributes:a={},selfClosing:l=!1,allowedAttributes:c}=n,d=t||e,u=p=>{if(!c)return p;const h={};return c.forEach(m=>{const g=typeof m=="string"?m:m.name,y=typeof m=="string"?void 0:m.skipIfDefault;if(g in p){const x=p[g];if(y!==void 0&&x===y)return;h[g]=x}}),h},f=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,h)=>{const m={...a,...p.attributes};if(l)return h.createNode(e,m);const g=o?o(p):p.content||"";return g?h.createNode(e,m,[h.createTextNode(g)]):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),g=m?.index;return g!==void 0?g:-1},tokenize(p,h,m){const g=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),y=p.match(g);if(!y)return;let x="",C="";if(l){const[,v]=y;C=v}else{const[,v,A]=y;C=v,x=A||""}const E=r(C.trim());return{type:e,raw:y[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||{}),g=i(m),y=g?` ${g}`:"";return l?`[${d}${y}]`:`[${d}${y}]${h}[/${d}]`}}}function Ml(n,e,t){var o,r,i,a;const l=n.split(`
434
+ :::`}}}function LE(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let o=t.exec(n);for(;o!==null;){const[,r,i,a]=o;e[r]=i||a,o=t.exec(n)}return e}function $E(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function VE(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=LE,serializeAttributes:i=$E,defaultAttributes:a={},selfClosing:l=!1,allowedAttributes:c}=n,d=t||e,u=p=>{if(!c)return p;const h={};return c.forEach(m=>{const g=typeof m=="string"?m:m.name,y=typeof m=="string"?void 0:m.skipIfDefault;if(g in p){const x=p[g];if(y!==void 0&&x===y)return;h[g]=x}}),h},f=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,h)=>{const m={...a,...p.attributes};if(l)return h.createNode(e,m);const g=o?o(p):p.content||"";return g?h.createNode(e,m,[h.createTextNode(g)]):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),g=m?.index;return g!==void 0?g:-1},tokenize(p,h,m){const g=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),y=p.match(g);if(!y)return;let x="",N="";if(l){const[,v]=y;N=v}else{const[,v,A]=y;N=v,x=A||""}const E=r(N.trim());return{type:e,raw:y[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||{}),g=i(m),y=g?` ${g}`:"";return l?`[${d}${y}]`:`[${d}${y}]${h}[/${d}]`}}}function Ml(n,e,t){var o,r,i,a;const l=n.split(`
435
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}
436
436
  `;continue}else return}const m=e.extractItemData(h),{indentLevel:g,mainContent:y}=m;d=`${d}${p}
437
437
  `;const x=[y];for(u+=1;u<l.length;){const A=l[u];if(A.trim()===""){const k=l.slice(u+1).findIndex(R=>R.trim()!=="");if(k===-1)break;if((((r=(o=l[u+1+k].match(/^(\s*)/))==null?void 0:o[1])==null?void 0:r.length)||0)>g){x.push(A),d=`${d}${A}
438
438
  `,u+=1;continue}else break}if((((a=(i=A.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:a.length)||0)>g)x.push(A),d=`${d}${A}
439
- `,u+=1;else break}let C;const E=x.slice(1);if(E.length>0){const A=E.map(M=>M.slice(g+f)).join(`
440
- `);A.trim()&&(e.customNestedParser?C=e.customNestedParser(A):C=t.blockTokens(A))}const v=e.createToken(m,C);c.push(v)}if(c.length!==0)return{items:c,raw:d}}function Al(n,e,t,o){if(!n||!Array.isArray(n.content))return"";const r=typeof t=="function"?t(o):t,[i,...a]=n.content,l=e.renderChildren([i]),c=[`${r}${l}`];return a&&a.length>0&&a.forEach(d=>{const u=e.renderChildren([d]);if(u){const f=u.split(`
439
+ `,u+=1;else break}let N;const E=x.slice(1);if(E.length>0){const A=E.map(M=>M.slice(g+f)).join(`
440
+ `);A.trim()&&(e.customNestedParser?N=e.customNestedParser(A):N=t.blockTokens(A))}const v=e.createToken(m,N);c.push(v)}if(c.length!==0)return{items:c,raw:d}}function Al(n,e,t,o){if(!n||!Array.isArray(n.content))return"";const r=typeof t=="function"?t(o):t,[i,...a]=n.content,l=e.renderChildren([i]),c=[`${r}${l}`];return a&&a.length>0&&a.forEach(d=>{const u=e.renderChildren([d]);if(u){const f=u.split(`
441
441
  `).map(p=>p?e.indent(p):"").join(`
442
442
  `);c.push(f)}}),c.join(`
443
443
  `)}function BE(n,e,t={}){const{state:o}=e,{doc:r,tr:i}=o,a=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!==a)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 zn=class um extends vl{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new um(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function qo(n){return new CE({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:a}=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(El(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===n.type&&y!==m.mark.type)).filter(m=>m.to>f).length)return null;p<t.to&&a.delete(p,t.to),f>t.from&&a.delete(t.from+u,f),d=t.from+u+l.length,a.addMark(t.from+u,d,n.type.create(i||{})),a.removeStoredMark(n.type)}}})}function ch(n){return s.customRef((e,t)=>({get(){return e(),n},set(o){n=o,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var FE=class extends OE{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=ch(this.view.state),this.reactiveExtensionStorage=ch(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),s.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}},jE=s.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=s.ref(),t=s.getCurrentInstance();return s.watchEffect(()=>{const o=n.editor;o&&o.options.element&&e.value&&s.nextTick(()=>{var r;if(!e.value||!((r=o.view.dom)!=null&&r.parentNode))return;const i=s.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()})}),s.onBeforeUnmount(()=>{const o=n.editor;o&&(o.contentComponent=null,o.appContext=null)}),{rootEl:e}},render(){return s.h("div",{ref:n=>{this.rootEl=n}})}});s.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return s.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),s.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return s.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 HE=(n={})=>{const e=s.shallowRef();return s.onMounted(()=>{e.value=new FE(n)}),s.onBeforeUnmount(()=>{var t,o,r,i;const a=(o=(t=e.value)==null?void 0:t.view.dom)==null?void 0:o.parentNode,l=a?.cloneNode(!0);(r=a?.parentNode)==null||r.replaceChild(l,a),(i=e.value)==null||i.destroy()}),e};s.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return s.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var UE=zn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
@@ -456,19 +456,19 @@ ${h.slice(d+2)}`,f+=1;else break}e.push({indent:d,number:parseInt(l,10),content:
456
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 a=Ml(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 a?[{type:"taskList",raw:a.raw,items:a.items}]:t.blockTokens(i)},r=Ml(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,a)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:t.inlineTokens(i.mainContent),nestedTokens:a}),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()}}});Wt.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(ph.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(hh.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(yw.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Ch.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Sw.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Cw.configure(this.options.taskList)),n}});var Nw=ph,vw=Ch,Tw=hh,zw=zn.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`
457
457
  `},renderMarkdown:()=>`
458
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:a}=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&&a){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()}}}),Mw=zw;const Aw="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Iw="ελ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",Dl="numeric",Pl="ascii",Rl="alpha",Dr="asciinumeric",Pr="alphanumeric",Ll="domain",Nh="emoji",_w="scheme",Ow="slashscheme",$l="whitespace";function Dw(n,e){return n in e||(e[n]=[]),e[n]}function Co(n,e,t){e[Dl]&&(e[Dr]=!0,e[Pr]=!0),e[Pl]&&(e[Dr]=!0,e[Rl]=!0),e[Dr]&&(e[Pr]=!0),e[Rl]&&(e[Pr]=!0),e[Pr]&&(e[Ll]=!0),e[Nh]&&(e[Ll]=!0);for(const o in e){const r=Dw(o,t);r.indexOf(n)<0&&r.push(n)}}function Pw(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&&Co(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 a=0;a<i-1;a++)r=r.tt(n[a]);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 a,l=r.go(n);if(l?(a=new _t,Object.assign(a.j,l.j),a.jr.push.apply(a.jr,l.jr),a.jd=l.jd,a.t=l.t):a=new _t,i){if(o)if(a.t&&typeof a.t=="string"){const c=Object.assign(Pw(a.t,o),t);Co(i,c,o)}else t&&Co(i,t,o);a.t=i}return r.j[n]=a,a}};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),vh=(n,e,t,o,r)=>n.ts(e,t,o,r),ae=(n,e,t,o,r)=>n.tt(e,t,o,r),Mn="WORD",Vl="UWORD",Th="ASCIINUMERICAL",zh="ALPHANUMERICAL",Rr="LOCALHOST",Bl="TLD",Fl="UTLD",ns="SCHEME",Go="SLASH_SCHEME",jl="NUM",Hl="WS",Ul="NL",Lr="OPENBRACE",$r="CLOSEBRACE",rs="OPENBRACKET",is="CLOSEBRACKET",ss="OPENPAREN",as="CLOSEPAREN",ls="OPENANGLEBRACKET",cs="CLOSEANGLEBRACKET",ds="FULLWIDTHLEFTPAREN",us="FULLWIDTHRIGHTPAREN",fs="LEFTCORNERBRACKET",ps="RIGHTCORNERBRACKET",hs="LEFTWHITECORNERBRACKET",ms="RIGHTWHITECORNERBRACKET",gs="FULLWIDTHLESSTHAN",ys="FULLWIDTHGREATERTHAN",bs="AMPERSAND",xs="APOSTROPHE",ks="ASTERISK",oo="AT",Es="BACKSLASH",ws="BACKTICK",Ss="CARET",ro="COLON",Wl="COMMA",Cs="DOLLAR",pn="DOT",Ns="EQUALS",ql="EXCLAMATION",qt="HYPHEN",Vr="PERCENT",vs="PIPE",Ts="PLUS",zs="POUND",Br="QUERY",Gl="QUOTE",Mh="FULLWIDTHMIDDLEDOT",Kl="SEMI",hn="SLASH",Fr="TILDE",Ms="UNDERSCORE",Ah="EMOJI",As="SYM";var Ih=Object.freeze({__proto__:null,ALPHANUMERICAL:zh,AMPERSAND:bs,APOSTROPHE:xs,ASCIINUMERICAL:Th,ASTERISK:ks,AT:oo,BACKSLASH:Es,BACKTICK:ws,CARET:Ss,CLOSEANGLEBRACKET:cs,CLOSEBRACE:$r,CLOSEBRACKET:is,CLOSEPAREN:as,COLON:ro,COMMA:Wl,DOLLAR:Cs,DOT:pn,EMOJI:Ah,EQUALS:Ns,EXCLAMATION:ql,FULLWIDTHGREATERTHAN:ys,FULLWIDTHLEFTPAREN:ds,FULLWIDTHLESSTHAN:gs,FULLWIDTHMIDDLEDOT:Mh,FULLWIDTHRIGHTPAREN:us,HYPHEN:qt,LEFTCORNERBRACKET:fs,LEFTWHITECORNERBRACKET:hs,LOCALHOST:Rr,NL:Ul,NUM:jl,OPENANGLEBRACKET:ls,OPENBRACE:Lr,OPENBRACKET:rs,OPENPAREN:ss,PERCENT:Vr,PIPE:vs,PLUS:Ts,POUND:zs,QUERY:Br,QUOTE:Gl,RIGHTCORNERBRACKET:ps,RIGHTWHITECORNERBRACKET:ms,SCHEME:ns,SEMI:Kl,SLASH:hn,SLASH_SCHEME:Go,SYM:As,TILDE:Fr,TLD:Bl,UNDERSCORE:Ms,UTLD:Fl,UWORD:Vl,WORD:Mn,WS:Hl});const An=/[a-z]/,jr=new RegExp("\\p{L}","u"),Jl=new RegExp("\\p{Emoji}","u"),In=/\d/,Xl=/\s/,_h="\r",Yl=`
459
- `,Rw="️",Lw="‍",Ql="";let Is=null,_s=null;function $w(n=[]){const e={};_t.groups=e;const t=new _t;Is==null&&(Is=Dh(Aw)),_s==null&&(_s=Dh(Iw)),ae(t,"'",xs),ae(t,"{",Lr),ae(t,"}",$r),ae(t,"[",rs),ae(t,"]",is),ae(t,"(",ss),ae(t,")",as),ae(t,"<",ls),ae(t,">",cs),ae(t,"(",ds),ae(t,")",us),ae(t,"「",fs),ae(t,"」",ps),ae(t,"『",hs),ae(t,"』",ms),ae(t,"<",gs),ae(t,">",ys),ae(t,"&",bs),ae(t,"*",ks),ae(t,"@",oo),ae(t,"`",ws),ae(t,"^",Ss),ae(t,":",ro),ae(t,",",Wl),ae(t,"$",Cs),ae(t,".",pn),ae(t,"=",Ns),ae(t,"!",ql),ae(t,"-",qt),ae(t,"%",Vr),ae(t,"|",vs),ae(t,"+",Ts),ae(t,"#",zs),ae(t,"?",Br),ae(t,'"',Gl),ae(t,"/",hn),ae(t,";",Kl),ae(t,"~",Fr),ae(t,"_",Ms),ae(t,"\\",Es),ae(t,"・",Mh);const o=Xe(t,In,jl,{[Dl]:!0});Xe(o,In,o);const r=Xe(o,An,Th,{[Dr]:!0}),i=Xe(o,jr,zh,{[Pr]:!0}),a=Xe(t,An,Mn,{[Pl]:!0});Xe(a,In,r),Xe(a,An,a),Xe(r,In,r),Xe(r,An,r);const l=Xe(t,jr,Vl,{[Rl]:!0});Xe(l,An),Xe(l,In,i),Xe(l,jr,l),Xe(i,In,i),Xe(i,An),Xe(i,jr,i);const c=ae(t,Yl,Ul,{[$l]:!0}),d=ae(t,_h,Hl,{[$l]:!0}),u=Xe(t,Xl,Hl,{[$l]:!0});ae(t,Ql,u),ae(d,Yl,c),ae(d,Ql,u),Xe(d,Xl,u),ae(u,_h),ae(u,Yl),Xe(u,Xl,u),ae(u,Ql,u);const f=Xe(t,Jl,Ah,{[Nh]:!0});ae(f,"#"),Xe(f,Jl,f),ae(f,Rw,f);const p=ae(f,Lw);ae(p,"#"),Xe(p,Jl,f);const h=[[An,a],[In,r]],m=[[An,null],[jr,l],[In,i]];for(let g=0;g<Is.length;g++)io(t,Is[g],Bl,Mn,h);for(let g=0;g<_s.length;g++)io(t,_s[g],Fl,Vl,m);Co(Bl,{tld:!0,ascii:!0},e),Co(Fl,{utld:!0,alpha:!0},e),io(t,"file",ns,Mn,h),io(t,"mailto",ns,Mn,h),io(t,"http",Go,Mn,h),io(t,"https",Go,Mn,h),io(t,"ftp",Go,Mn,h),io(t,"ftps",Go,Mn,h),Co(ns,{scheme:!0,ascii:!0},e),Co(Go,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],C=n[g][1]?{[_w]:!0}:{[Ow]:!0};y.indexOf("-")>=0?C[Ll]=!0:An.test(y)?In.test(y)?C[Dr]=!0:C[Pl]=!0:C[Dl]=!0,vh(t,y,y,C)}return vh(t,"localhost",Rr,{ascii:!0}),t.jd=new _t(As),{start:t,tokens:Object.assign({groups:e},Ih)}}function Oh(n,e){const t=Vw(e.replace(/[A-Z]/g,l=>l.toLowerCase())),o=t.length,r=[];let i=0,a=0;for(;a<o;){let l=n,c=null,d=0,u=null,f=-1,p=-1;for(;a<o&&(c=l.go(t[a]));)l=c,l.accepts()?(f=0,p=0,u=l):f>=0&&(f+=t[a].length,p++),d+=t[a].length,i+=t[a].length,a++;i-=f,a-=p,d-=f,r.push({t:u.t,v:e.slice(i-d,i),s:i-d,e:i})}return r}function Vw(n){const e=[],t=n.length;let o=0;for(;o<t;){let r=n.charCodeAt(o),i,a=r<55296||r>56319||o+1===t||(i=n.charCodeAt(o+1))<56320||i>57343?n[o]:n.slice(o,o+2);e.push(a),o+=a.length}return e}function io(n,e,t,o,r){let i;const a=e.length;for(let l=0;l<a-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[a-1]]=i,i}function Dh(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 a=parseInt(n.substring(o,o+i),10);a>0;a--)t.pop();o+=i}else t.push(n[o]),o++}return e}const Hr={defaultProtocol:"http",events:null,format:Ph,formatHref:Ph,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Zl(n,e=null){let t=Object.assign({},Hr);n&&(t=Object.assign(t,n instanceof Zl?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}Zl.prototype={o:Hr,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]:Hr[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 Ph(n){return n}function Rh(n,e){this.t="token",this.v=n,this.tk=e}Rh.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=Hr.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),a={},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 a.href=o,l&&(a.class=l),c&&(a.target=c),d&&(a.rel=d),u&&Object.assign(a,u),{tagName:r,attributes:a,content:i,eventListeners:f}}};function Os(n,e){class t extends Rh{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 Lh=Os("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),$h=Os("text"),Bw=Os("nl"),Ds=Os("url",{isLink:!0,toHref(n=Hr.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Rr&&n[1].t===ro}}),Gt=n=>new _t(n);function Fw({groups:n}){const e=n.domain.concat([bs,ks,oo,Es,ws,Ss,Cs,Ns,qt,jl,Vr,vs,Ts,zs,hn,As,Fr,Ms]),t=[xs,ro,Wl,pn,ql,Vr,Br,Gl,Kl,ls,cs,Lr,$r,is,rs,ss,as,ds,us,fs,ps,hs,ms,gs,ys],o=[bs,xs,ks,Es,ws,Ss,Cs,Ns,qt,Lr,$r,Vr,vs,Ts,zs,Br,hn,As,Fr,Ms],r=Gt(),i=ae(r,Fr);Ie(i,o,i),Ie(i,n.domain,i);const a=Gt(),l=Gt(),c=Gt();Ie(r,n.domain,a),Ie(r,n.scheme,l),Ie(r,n.slashscheme,c),Ie(a,o,i),Ie(a,n.domain,a);const d=ae(a,oo);ae(i,oo,d),ae(l,oo,d),ae(c,oo,d);const u=ae(i,pn);Ie(u,o,i),Ie(u,n.domain,i);const f=Gt();Ie(d,n.domain,f),Ie(f,n.domain,f);const p=ae(f,pn);Ie(p,n.domain,f);const h=Gt(Lh);Ie(p,n.tld,h),Ie(p,n.utld,h),ae(d,Rr,h);const m=ae(f,qt);ae(m,qt,m),Ie(m,n.domain,f),Ie(h,n.domain,f),ae(h,pn,p),ae(h,qt,m);const g=ae(h,ro);Ie(g,n.numeric,Lh);const y=ae(a,qt),x=ae(a,pn);ae(y,qt,y),Ie(y,n.domain,a),Ie(x,o,i),Ie(x,n.domain,a);const C=Gt(Ds);Ie(x,n.tld,C),Ie(x,n.utld,C),Ie(C,n.domain,a),Ie(C,o,i),ae(C,pn,x),ae(C,qt,y),ae(C,oo,d);const E=ae(C,ro),v=Gt(Ds);Ie(E,n.numeric,v);const A=Gt(Ds),M=Gt();Ie(A,e,A),Ie(A,t,M),Ie(M,e,A),Ie(M,t,M),ae(C,hn,A),ae(v,hn,A);const k=ae(l,ro),w=ae(c,ro),b=ae(w,hn),R=ae(b,hn);Ie(l,n.domain,a),ae(l,pn,x),ae(l,qt,y),Ie(c,n.domain,a),ae(c,pn,x),ae(c,qt,y),Ie(k,n.domain,A),ae(k,hn,A),ae(k,Br,A),Ie(R,n.domain,A),Ie(R,e,A),ae(R,hn,A);const B=[[Lr,$r],[rs,is],[ss,as],[ls,cs],[ds,us],[fs,ps],[hs,ms],[gs,ys]];for(let O=0;O<B.length;O++){const[D,P]=B[O],q=ae(A,D);ae(M,D,q),ae(q,P,A);const W=Gt(Ds);Ie(q,e,W);const V=Gt();Ie(q,t),Ie(W,e,W),Ie(W,t,V),Ie(V,e,W),Ie(V,t,V),ae(W,P,A),ae(V,P,A)}return ae(r,Rr,C),ae(r,Ul,Bw),{start:r,tokens:Ih}}function jw(n,e,t){let o=t.length,r=0,i=[],a=[];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));)a.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&&(a.push(t[r]),r++);else{a.length>0&&(i.push(ec($h,e,a)),a=[]),r-=p,u-=p;const h=f.t,m=t.slice(r-u,r);i.push(ec(h,e,m))}}return a.length>0&&i.push(ec($h,e,a)),i}function ec(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 Hw=typeof console<"u"&&console&&console.warn||(()=>{}),Uw="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ue={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Ww(){return _t.groups={},Ue.scanner=null,Ue.parser=null,Ue.tokenQueue=[],Ue.pluginQueue=[],Ue.customSchemes=[],Ue.initialized=!1,Ue}function Vh(n,e=!1){if(Ue.initialized&&Hw(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Uw}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
459
+ `,Rw="️",Lw="‍",Ql="";let Is=null,_s=null;function $w(n=[]){const e={};_t.groups=e;const t=new _t;Is==null&&(Is=Dh(Aw)),_s==null&&(_s=Dh(Iw)),ae(t,"'",xs),ae(t,"{",Lr),ae(t,"}",$r),ae(t,"[",rs),ae(t,"]",is),ae(t,"(",ss),ae(t,")",as),ae(t,"<",ls),ae(t,">",cs),ae(t,"(",ds),ae(t,")",us),ae(t,"「",fs),ae(t,"」",ps),ae(t,"『",hs),ae(t,"』",ms),ae(t,"<",gs),ae(t,">",ys),ae(t,"&",bs),ae(t,"*",ks),ae(t,"@",oo),ae(t,"`",ws),ae(t,"^",Ss),ae(t,":",ro),ae(t,",",Wl),ae(t,"$",Cs),ae(t,".",pn),ae(t,"=",Ns),ae(t,"!",ql),ae(t,"-",qt),ae(t,"%",Vr),ae(t,"|",vs),ae(t,"+",Ts),ae(t,"#",zs),ae(t,"?",Br),ae(t,'"',Gl),ae(t,"/",hn),ae(t,";",Kl),ae(t,"~",Fr),ae(t,"_",Ms),ae(t,"\\",Es),ae(t,"・",Mh);const o=Xe(t,In,jl,{[Dl]:!0});Xe(o,In,o);const r=Xe(o,An,Th,{[Dr]:!0}),i=Xe(o,jr,zh,{[Pr]:!0}),a=Xe(t,An,Mn,{[Pl]:!0});Xe(a,In,r),Xe(a,An,a),Xe(r,In,r),Xe(r,An,r);const l=Xe(t,jr,Vl,{[Rl]:!0});Xe(l,An),Xe(l,In,i),Xe(l,jr,l),Xe(i,In,i),Xe(i,An),Xe(i,jr,i);const c=ae(t,Yl,Ul,{[$l]:!0}),d=ae(t,_h,Hl,{[$l]:!0}),u=Xe(t,Xl,Hl,{[$l]:!0});ae(t,Ql,u),ae(d,Yl,c),ae(d,Ql,u),Xe(d,Xl,u),ae(u,_h),ae(u,Yl),Xe(u,Xl,u),ae(u,Ql,u);const f=Xe(t,Jl,Ah,{[Nh]:!0});ae(f,"#"),Xe(f,Jl,f),ae(f,Rw,f);const p=ae(f,Lw);ae(p,"#"),Xe(p,Jl,f);const h=[[An,a],[In,r]],m=[[An,null],[jr,l],[In,i]];for(let g=0;g<Is.length;g++)io(t,Is[g],Bl,Mn,h);for(let g=0;g<_s.length;g++)io(t,_s[g],Fl,Vl,m);Co(Bl,{tld:!0,ascii:!0},e),Co(Fl,{utld:!0,alpha:!0},e),io(t,"file",ns,Mn,h),io(t,"mailto",ns,Mn,h),io(t,"http",Go,Mn,h),io(t,"https",Go,Mn,h),io(t,"ftp",Go,Mn,h),io(t,"ftps",Go,Mn,h),Co(ns,{scheme:!0,ascii:!0},e),Co(Go,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],N=n[g][1]?{[_w]:!0}:{[Ow]:!0};y.indexOf("-")>=0?N[Ll]=!0:An.test(y)?In.test(y)?N[Dr]=!0:N[Pl]=!0:N[Dl]=!0,vh(t,y,y,N)}return vh(t,"localhost",Rr,{ascii:!0}),t.jd=new _t(As),{start:t,tokens:Object.assign({groups:e},Ih)}}function Oh(n,e){const t=Vw(e.replace(/[A-Z]/g,l=>l.toLowerCase())),o=t.length,r=[];let i=0,a=0;for(;a<o;){let l=n,c=null,d=0,u=null,f=-1,p=-1;for(;a<o&&(c=l.go(t[a]));)l=c,l.accepts()?(f=0,p=0,u=l):f>=0&&(f+=t[a].length,p++),d+=t[a].length,i+=t[a].length,a++;i-=f,a-=p,d-=f,r.push({t:u.t,v:e.slice(i-d,i),s:i-d,e:i})}return r}function Vw(n){const e=[],t=n.length;let o=0;for(;o<t;){let r=n.charCodeAt(o),i,a=r<55296||r>56319||o+1===t||(i=n.charCodeAt(o+1))<56320||i>57343?n[o]:n.slice(o,o+2);e.push(a),o+=a.length}return e}function io(n,e,t,o,r){let i;const a=e.length;for(let l=0;l<a-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[a-1]]=i,i}function Dh(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 a=parseInt(n.substring(o,o+i),10);a>0;a--)t.pop();o+=i}else t.push(n[o]),o++}return e}const Hr={defaultProtocol:"http",events:null,format:Ph,formatHref:Ph,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Zl(n,e=null){let t=Object.assign({},Hr);n&&(t=Object.assign(t,n instanceof Zl?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}Zl.prototype={o:Hr,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]:Hr[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 Ph(n){return n}function Rh(n,e){this.t="token",this.v=n,this.tk=e}Rh.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=Hr.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),a={},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 a.href=o,l&&(a.class=l),c&&(a.target=c),d&&(a.rel=d),u&&Object.assign(a,u),{tagName:r,attributes:a,content:i,eventListeners:f}}};function Os(n,e){class t extends Rh{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 Lh=Os("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),$h=Os("text"),Bw=Os("nl"),Ds=Os("url",{isLink:!0,toHref(n=Hr.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Rr&&n[1].t===ro}}),Gt=n=>new _t(n);function Fw({groups:n}){const e=n.domain.concat([bs,ks,oo,Es,ws,Ss,Cs,Ns,qt,jl,Vr,vs,Ts,zs,hn,As,Fr,Ms]),t=[xs,ro,Wl,pn,ql,Vr,Br,Gl,Kl,ls,cs,Lr,$r,is,rs,ss,as,ds,us,fs,ps,hs,ms,gs,ys],o=[bs,xs,ks,Es,ws,Ss,Cs,Ns,qt,Lr,$r,Vr,vs,Ts,zs,Br,hn,As,Fr,Ms],r=Gt(),i=ae(r,Fr);Ie(i,o,i),Ie(i,n.domain,i);const a=Gt(),l=Gt(),c=Gt();Ie(r,n.domain,a),Ie(r,n.scheme,l),Ie(r,n.slashscheme,c),Ie(a,o,i),Ie(a,n.domain,a);const d=ae(a,oo);ae(i,oo,d),ae(l,oo,d),ae(c,oo,d);const u=ae(i,pn);Ie(u,o,i),Ie(u,n.domain,i);const f=Gt();Ie(d,n.domain,f),Ie(f,n.domain,f);const p=ae(f,pn);Ie(p,n.domain,f);const h=Gt(Lh);Ie(p,n.tld,h),Ie(p,n.utld,h),ae(d,Rr,h);const m=ae(f,qt);ae(m,qt,m),Ie(m,n.domain,f),Ie(h,n.domain,f),ae(h,pn,p),ae(h,qt,m);const g=ae(h,ro);Ie(g,n.numeric,Lh);const y=ae(a,qt),x=ae(a,pn);ae(y,qt,y),Ie(y,n.domain,a),Ie(x,o,i),Ie(x,n.domain,a);const N=Gt(Ds);Ie(x,n.tld,N),Ie(x,n.utld,N),Ie(N,n.domain,a),Ie(N,o,i),ae(N,pn,x),ae(N,qt,y),ae(N,oo,d);const E=ae(N,ro),v=Gt(Ds);Ie(E,n.numeric,v);const A=Gt(Ds),M=Gt();Ie(A,e,A),Ie(A,t,M),Ie(M,e,A),Ie(M,t,M),ae(N,hn,A),ae(v,hn,A);const k=ae(l,ro),w=ae(c,ro),b=ae(w,hn),R=ae(b,hn);Ie(l,n.domain,a),ae(l,pn,x),ae(l,qt,y),Ie(c,n.domain,a),ae(c,pn,x),ae(c,qt,y),Ie(k,n.domain,A),ae(k,hn,A),ae(k,Br,A),Ie(R,n.domain,A),Ie(R,e,A),ae(R,hn,A);const B=[[Lr,$r],[rs,is],[ss,as],[ls,cs],[ds,us],[fs,ps],[hs,ms],[gs,ys]];for(let O=0;O<B.length;O++){const[D,P]=B[O],q=ae(A,D);ae(M,D,q),ae(q,P,A);const W=Gt(Ds);Ie(q,e,W);const V=Gt();Ie(q,t),Ie(W,e,W),Ie(W,t,V),Ie(V,e,W),Ie(V,t,V),ae(W,P,A),ae(V,P,A)}return ae(r,Rr,N),ae(r,Ul,Bw),{start:r,tokens:Ih}}function jw(n,e,t){let o=t.length,r=0,i=[],a=[];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));)a.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&&(a.push(t[r]),r++);else{a.length>0&&(i.push(ec($h,e,a)),a=[]),r-=p,u-=p;const h=f.t,m=t.slice(r-u,r);i.push(ec(h,e,m))}}return a.length>0&&i.push(ec($h,e,a)),i}function ec(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 Hw=typeof console<"u"&&console&&console.warn||(()=>{}),Uw="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ue={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Ww(){return _t.groups={},Ue.scanner=null,Ue.parser=null,Ue.tokenQueue=[],Ue.pluginQueue=[],Ue.customSchemes=[],Ue.initialized=!1,Ue}function Vh(n,e=!1){if(Ue.initialized&&Hw(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Uw}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
460
460
  1. Must only contain digits, lowercase ASCII letters or "-"
461
461
  2. Cannot start or end with "-"
462
- 3. "-" cannot repeat`);Ue.customSchemes.push([n,e])}function qw(){Ue.scanner=$w(Ue.customSchemes);for(let n=0;n<Ue.tokenQueue.length;n++)Ue.tokenQueue[n][1]({scanner:Ue.scanner});Ue.parser=Fw(Ue.scanner.tokens);for(let n=0;n<Ue.pluginQueue.length;n++)Ue.pluginQueue[n][1]({scanner:Ue.scanner,parser:Ue.parser});return Ue.initialized=!0,Ue}function tc(n){return Ue.initialized||qw(),jw(Ue.parser.start,n,Oh(Ue.scanner.start,n))}tc.scan=Oh;function Bh(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 Zl(t),r=tc(n),i=[];for(let a=0;a<r.length;a++){const l=r[a];l.isLink&&(!e||l.t===e)&&o.check(l)&&i.push(l.toFormattedObject(o))}return i}var nc="[\0-   ᠎ -\u2029  ]",Gw=new RegExp(nc),Kw=new RegExp(`${nc}$`),Jw=new RegExp(nc,"g");function Xw(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function Yw(n){return new Mt({key:new rn("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:a}=o,l=Pp(t.doc,[...e]);if(Wp(l).forEach(({newRange:d})=>{const u=Pk(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(!Kw.test(h))return;f=u[0],p=o.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&p){const h=p.split(Gw).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],g=f.pos+p.lastIndexOf(m);if(!m)return!1;const y=tc(m).map(x=>x.toObject(n.defaultProtocol));if(!Xw(y))return!1;y.filter(x=>x.isLink).map(x=>({...x,from:g+x.start+1,to:g+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=>{El(x.from,x.to,o.doc).some(C=>C.mark.type===n.type)||a.addMark(x.from,x.to,n.type.create({href:x.href}))})}}),!!a.steps.length)return a}})}function Qw(n){return new Mt({key:new rn("handleClickLink"),props:{handleClick:(e,t,o)=>{var r,i;if(o.button!==0||!e.editable)return!1;let a=!1;if(n.enableClickSelection&&(a=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 a;const c=Up(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),a=!0)}return a}}})}function Zw(n){return new Mt({key:new rn("handlePasteLink"),props:{handlePaste:(e,t,o)=>{const{shouldAutoLink:r}=n,{state:i}=e,{selection:a}=i,{empty:l}=a;if(l)return!1;let c="";o.content.forEach(u=>{c+=u.textContent});const d=Bh(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 No(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(Jw,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var eS=Ar.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"){Vh(n);return}Vh(n.scheme,n.optionalSlashes)})},onDestroy(){Ww()},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)=>!!No(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=>!!No(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=>!!No(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=>!!No(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=>!!No(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[qo({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:o}=this.options,r=Bh(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:a=>!!No(a,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(Yw({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!No(r,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(Qw({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(Zw({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),tS=eS;const nS={class:"zcode-rich-text-editor"},oS={key:0,class:"zcode-rich-text-toolbar"},rS=s.defineComponent({__name:"RichTextEditor",props:{modelValue:{type:String},placeholder:{type:String}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,r=HE({extensions:[WE,GE,JE,tw,aw,uw,Nw,vw,Tw,Mw,tS.configure({openOnClick:!1,HTMLAttributes:{class:"zcode-link"}})],content:t.modelValue||"",editorProps:{attributes:{class:"zcode-tiptap-editor","data-placeholder":t.placeholder||"テキストを入力..."}},onUpdate:({editor:a})=>{const l=a.getHTML();o("update:modelValue",l)}});s.watch(()=>t.modelValue,a=>{r.value&&r.value.getHTML()!==a&&r.value.commands.setContent(a||"")});const i=()=>{if(!r.value)return;const a=r.value.getAttributes("link").href,l=window.prompt("URLを入力してください",a);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 s.onUnmounted(()=>{r.value&&r.value.destroy()}),(a,l)=>(s.openBlock(),s.createElementBlock("div",nS,[s.unref(r)?(s.openBlock(),s.createElementBlock("div",oS,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("bold")},"zcode-toolbar-btn"]),title:"太字",onClick:l[0]||(l[0]=c=>s.unref(r).chain().focus().toggleBold().run())},[s.createVNode(s.unref(gm),{size:16})],2),s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("italic")},"zcode-toolbar-btn"]),title:"斜体",onClick:l[1]||(l[1]=c=>s.unref(r).chain().focus().toggleItalic().run())},[s.createVNode(s.unref(km),{size:16})],2),s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("strike")},"zcode-toolbar-btn"]),title:"取り消し線",onClick:l[2]||(l[2]=c=>s.unref(r).chain().focus().toggleStrike().run())},[s.createVNode(s.unref(Nm),{size:16})],2),l[5]||(l[5]=s.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("bulletList")},"zcode-toolbar-btn"]),title:"箇条書き",onClick:l[3]||(l[3]=c=>s.unref(r).chain().focus().toggleBulletList().run())},[s.createVNode(s.unref(Sm),{size:16})],2),s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("orderedList")},"zcode-toolbar-btn"]),title:"番号付きリスト",onClick:l[4]||(l[4]=c=>s.unref(r).chain().focus().toggleOrderedList().run())},[s.createVNode(s.unref(wm),{size:16})],2),l[6]||(l[6]=s.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("link")},"zcode-toolbar-btn"]),title:"リンク",onClick:i},[s.createVNode(s.unref(Em),{size:16})],2)])):s.createCommentVNode("",!0),s.createVNode(s.unref(jE),{editor:s.unref(r),class:"zcode-rich-text-editor-content"},null,8,["editor"])]))}}),iS={class:"zcode-image-modal-header"},sS={class:"zcode-image-modal-header-title",role:"heading","aria-level":"3"},aS=["aria-label"],lS={key:0,class:"zcode-image-current"},cS={class:"zcode-image-current-title",role:"heading","aria-level":"4"},dS={class:"zcode-image-current-item"},uS=["src","alt"],fS={class:"zcode-image-current-name"},pS={class:"zcode-image-tabs"},hS={class:"zcode-image-grid"},mS=["onClick"],gS=["src","alt"],yS={class:"zcode-image-name"},bS={key:1,class:"zcode-image-add"},xS={class:"zcode-image-modal-actions"},kS=s.defineComponent({__name:"ImageSelectModal",props:{isOpen:{type:Boolean},imagesCommon:{type:Array},imagesIndividual:{type:Array},imagesSpecial:{type:Array},currentValue:{type:String},imageModalActions:{type:Object}},emits:["update:model-value","add-image","delete-image","close"],setup(n,{emit:e}){const{t}=Vt(),o=n,r=e,i=s.ref("common"),a=s.ref(null),l=s.ref(o.currentValue||null),c=s.computed(()=>i.value==="common"?o.imagesCommon:i.value==="individual"?o.imagesIndividual:o.imagesSpecial),d=s.computed(()=>{const C={add:!1,delete:!1},E=o.imageModalActions;return E?i.value==="common"?{...C,...E.common}:i.value==="individual"?{...C,...E.individual}:{...C,...E.special}:C}),u=s.computed(()=>d.value.add),f=s.computed(()=>d.value.delete),p=()=>o.currentValue&&[...o.imagesCommon,...o.imagesIndividual,...o.imagesSpecial].find(E=>E.id===o.currentValue)||null,h=C=>{l.value=C.id},m=()=>{l.value&&(r("update:model-value",l.value),x())},g=()=>{l.value&&confirm(t("imagesManager.deleteImageFromModalConfirm"))&&(r("delete-image",l.value),l.value=null)},y=C=>{const v=C.target.files?.[0];if(!v)return;const A=new FileReader;A.onload=M=>{const k=M.target?.result,w={id:`img-${Date.now()}`,name:v.name,url:k,mimeType:v.type,needsUpload:!0},b=i.value==="common"?"common":i.value==="individual"?"individual":"special";r("add-image",w,b),l.value=w.id},A.readAsDataURL(v)},x=()=>{r("close")};return(C,E)=>n.isOpen?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:s.withModifiers(x,["self"])},[s.createElementVNode("div",{class:"zcode-image-modal-content",onClick:E[4]||(E[4]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",iS,[s.createElementVNode("div",sS,s.toDisplayString(C.$t("imagesManager.selectImage")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":C.$t("common.close"),onClick:x},[s.createVNode(s.unref(Ye),{size:18})],8,aS)]),n.currentValue&&p()?(s.openBlock(),s.createElementBlock("div",lS,[s.createElementVNode("div",cS,s.toDisplayString(C.$t("imagesManager.currentlySelected")),1),s.createElementVNode("div",dS,[s.createElementVNode("img",{src:p()?.url,alt:p()?.name||"",class:"zcode-image-current-item-img"},null,8,uS),s.createElementVNode("div",fS,s.toDisplayString(p()?.name),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",pS,[s.createElementVNode("button",{class:s.normalizeClass([{active:i.value==="common"},"zcode-image-tab"]),onClick:E[0]||(E[0]=v=>i.value="common")},s.toDisplayString(C.$t("dataViewer.common")),3),s.createElementVNode("button",{class:s.normalizeClass([{active:i.value==="individual"},"zcode-image-tab"]),onClick:E[1]||(E[1]=v=>i.value="individual")},s.toDisplayString(C.$t("dataViewer.individual")),3),n.imagesSpecial.length>0?(s.openBlock(),s.createElementBlock("button",{key:0,class:s.normalizeClass([{active:i.value==="special"},"zcode-image-tab"]),onClick:E[2]||(E[2]=v=>i.value="special")},s.toDisplayString(C.$t("dataViewer.special")),3)):s.createCommentVNode("",!0)]),s.createElementVNode("div",hS,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(c.value,v=>(s.openBlock(),s.createElementBlock("div",{key:v.id,class:s.normalizeClass([{selected:l.value===v.id},"zcode-image-item"]),onClick:A=>h(v)},[s.createElementVNode("img",{src:v.url,alt:v.name,class:"zcode-image-item-img"},null,8,gS),s.createElementVNode("div",yS,s.toDisplayString(v.name),1)],10,mS))),128))]),u.value?(s.openBlock(),s.createElementBlock("div",bS,[s.createElementVNode("input",{ref_key:"fileInput",ref:a,type:"file",accept:"image/*",style:{display:"none"},onChange:y},null,544),s.createElementVNode("button",{class:"zcode-image-add-btn",onClick:E[3]||(E[3]=v=>a.value?.click())},[s.createVNode(s.unref(ao),{size:16}),s.createElementVNode("span",null,s.toDisplayString(C.$t("imagesManager.addImage")),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",xS,[l.value?(s.openBlock(),s.createElementBlock("button",{key:0,class:"zcode-btn-primary zcode-image-modal-actions-btn",onClick:m},[s.createVNode(s.unref(er),{size:16}),s.createElementVNode("span",null,s.toDisplayString(C.$t("imagesManager.select")),1)])):s.createCommentVNode("",!0),l.value&&f.value?(s.openBlock(),s.createElementBlock("button",{key:1,class:"zcode-btn-danger zcode-image-modal-actions-btn",onClick:g},[s.createVNode(s.unref(Pn),{size:16}),s.createElementVNode("span",null,s.toDisplayString(C.$t("common.delete")),1)])):s.createCommentVNode("",!0)])])])):s.createCommentVNode("",!0)}}),ES={key:0,class:"zcode-edit-panel-header"},wS={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},SS=["aria-label"],CS={key:1,class:"zcode-parent-selector"},NS={key:2,class:"zcode-group-tabs"},vS=["onClick"],TS={key:3,class:"zcode-field-editor"},zS={class:"zcode-field-item-title",role:"heading","aria-level":"4"},MS={key:0,class:"zcode-text-editor"},AS=["value","placeholder","maxlength","readonly","disabled","onInput"],IS={key:0,class:"zcode-field-error-message"},_S={key:1,class:"zcode-field-counter"},OS={key:1,class:"zcode-text-editor"},DS=["value","placeholder","maxlength","readonly","disabled","onInput"],PS={key:0,class:"zcode-field-error-message"},RS={key:1,class:"zcode-field-counter"},LS={key:2,class:"zcode-rich-text-editor-wrapper"},$S={key:0,class:"zcode-field-error-message"},VS={key:3,class:"zcode-radio-editor"},BS={class:"zcode-radio-group"},FS=["onUpdate:modelValue","name","value","onChange"],jS={class:"zcode-radio-item-label"},HS={key:4,class:"zcode-checkbox-editor"},US={class:"zcode-checkbox-group"},WS=["onUpdate:modelValue","value","onChange"],qS={class:"zcode-checkbox-item-label"},GS={key:5,class:"zcode-select-editor"},KS=["onUpdate:modelValue","onChange"],JS=["value"],XS={key:6,class:"zcode-select-editor"},YS=["onUpdate:modelValue","size","onChange"],QS=["value"],ZS={key:7,class:"zcode-tag-editor"},eC=["onUpdate:modelValue","onChange"],tC=["value"],nC={class:"zcode-tag-preview"},oC={key:8,class:"zcode-boolean-editor"},rC={class:"zcode-checkbox-item"},iC=["onUpdate:modelValue","onChange"],sC={class:"zcode-checkbox-item-label"},aC={key:9,class:"zcode-image-editor"},lC={class:"zcode-image-editor-buttons"},cC=["onClick"],dC=["title","onClick"],uC={key:0,class:"zcode-image-preview"},fC=["src","alt"],pC={key:4,class:"zcode-edit-fields"},hC={class:"zcode-edit-fields-text"},mC={class:"zcode-edit-fields-text"},Fh=s.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},previewMode:{type:Boolean},imageModalActions:{type:Object}},emits:["close","select-parent","save-field","add-image","delete-image"],setup(n,{emit:e}){const t=n,o=s.ref("all"),r=s.computed(()=>{const k=new Map;return t.editingAvailableFields.forEach(w=>{const b=w.groupName||"other";k.set(b,(k.get(b)||0)+1)}),Array.from(k.entries()).map(([w,b])=>({name:w,count:b}))}),i=s.computed(()=>r.value.length>1),a=s.computed(()=>!i.value||o.value==="all"?t.editingAvailableFields:t.editingAvailableFields.filter(k=>(k.groupName||"other")===o.value));s.watch(()=>i.value,k=>{k?o.value="all":o.value=void 0},{immediate:!0}),s.watch(()=>t.editingAvailableFields,()=>{if(i.value){if(o.value==="all")return;r.value.some(w=>w.name===o.value)||(o.value="all")}},{deep:!0});const l=e,c=s.ref({});function d(k){const w=k.label||k.fieldName,b=k.currentValue,R=k.type==="rich"&&typeof b=="string"&&b.trim()==="<p></p>"?"":b??"";return k.required&&(R===""||R===void 0||R===null)?`${w}は必須です`:typeof k.maxLength=="number"&&k.maxLength>0&&String(R).length>k.maxLength?`${w}は${k.maxLength}文字以内で入力してください`:null}function u(k,w){w?c.value[k]=w:delete c.value[k]}function f(k){return c.value[k]||t.fieldErrors?.[k]||null}const p=s.ref(!1),h=s.ref(null),m=k=>{h.value=k,p.value=!0},g=()=>{p.value=!1,h.value=null},y=k=>{k.currentValue="",l("save-field",k)},x=k=>{h.value&&(h.value.currentValue=k||"",l("save-field",h.value))},C=(k,w)=>{l("add-image",k,w)},E=k=>{l("delete-image",k),h.value?.currentValue===k&&(h.value.currentValue="",l("save-field",h.value))},v=k=>k&&[...t.imagesCommon,...t.imagesIndividual,...t.imagesSpecial].find(R=>R.id===k)?.url||null,A=(k,w)=>{const b=w.target;k.currentValue=b.value,u(k.fieldName,d(k)),l("save-field",k)},M=(k,w)=>{k.optional&&w===""?k.currentValue=void 0:k.currentValue=w,u(k.fieldName,d(k)),l("save-field",k)};return(k,w)=>n.editingComponent&&n.currentMode==="edit"?(s.openBlock(),s.createElementBlock("div",{key:0,class:s.normalizeClass(n.previewMode?"zcode-edit-panel-preview":"zcode-edit-panel"),onClick:w[3]||(w[3]=s.withModifiers(()=>{},["stop"]))},[n.previewMode?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("div",ES,[s.createElementVNode("div",wS,s.toDisplayString(k.$t("editPanel.editing",{type:n.editingComponent.type})),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":k.$t("common.close"),onClick:w[0]||(w[0]=b=>k.$emit("close"))},[s.createVNode(s.unref(Ye),{size:18})],8,SS)])),!n.previewMode&&n.canSelectParent?(s.openBlock(),s.createElementBlock("div",CS,[s.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:w[1]||(w[1]=b=>k.$emit("select-parent"))},[s.createVNode(s.unref(ei),{size:16}),s.createElementVNode("span",null,s.toDisplayString(k.$t("addPanel.selectParent")),1)])])):s.createCommentVNode("",!0),i.value?(s.openBlock(),s.createElementBlock("div",NS,[s.createElementVNode("button",{class:s.normalizeClass([{active:o.value==="all"},"zcode-group-tab"]),onClick:w[2]||(w[2]=b=>o.value="all")}," all ",2),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r.value,b=>(s.openBlock(),s.createElementBlock("button",{key:b.name,class:s.normalizeClass([{active:o.value===b.name},"zcode-group-tab"]),onClick:R=>o.value=b.name},s.toDisplayString(b.name),11,vS))),128))])):s.createCommentVNode("",!0),a.value.length>0?(s.openBlock(),s.createElementBlock("div",TS,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(a.value,b=>(s.openBlock(),s.createElementBlock("div",{key:b.fieldName,class:"zcode-field-item"},[s.createElementVNode("div",zS,s.toDisplayString(b.label),1),b.type==="text"?(s.openBlock(),s.createElementBlock("div",MS,[s.createElementVNode("input",{type:"text",value:b.currentValue??"",placeholder:b.defaultValue,maxlength:b.maxLength,readonly:b.readonly,disabled:b.disabled,class:s.normalizeClass([{"zcode-field-error":f(b.fieldName)},"zcode-text-input"]),onInput:R=>A(b,R)},null,42,AS),f(b.fieldName)?(s.openBlock(),s.createElementBlock("div",IS,s.toDisplayString(f(b.fieldName)),1)):s.createCommentVNode("",!0),b.maxLength?(s.openBlock(),s.createElementBlock("div",_S,s.toDisplayString(String(b.currentValue??"").length)+" / "+s.toDisplayString(b.maxLength),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),b.type==="textarea"?(s.openBlock(),s.createElementBlock("div",OS,[s.createElementVNode("textarea",{value:b.currentValue??"",placeholder:b.defaultValue,maxlength:b.maxLength,readonly:b.readonly,disabled:b.disabled,class:s.normalizeClass([{"zcode-field-error":f(b.fieldName)},"zcode-textarea"]),rows:"4",onInput:R=>A(b,R)},null,42,DS),f(b.fieldName)?(s.openBlock(),s.createElementBlock("div",PS,s.toDisplayString(f(b.fieldName)),1)):s.createCommentVNode("",!0),b.maxLength?(s.openBlock(),s.createElementBlock("div",RS,s.toDisplayString(String(b.currentValue??"").length)+" / "+s.toDisplayString(b.maxLength),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),b.type==="rich"?(s.openBlock(),s.createElementBlock("div",LS,[s.createVNode(rS,{"model-value":b.currentValue??"",placeholder:b.defaultValue,"onUpdate:modelValue":R=>M(b,R)},null,8,["model-value","placeholder","onUpdate:modelValue"]),f(b.fieldName)?(s.openBlock(),s.createElementBlock("div",$S,s.toDisplayString(f(b.fieldName)),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),b.type==="radio"?(s.openBlock(),s.createElementBlock("div",VS,[s.createElementVNode("div",BS,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(b.options,R=>(s.openBlock(),s.createElementBlock("label",{key:R,class:"zcode-radio-item"},[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":B=>b.currentValue=B,type:"radio",name:b.fieldName,value:R,onChange:B=>k.$emit("save-field",b)},null,40,FS),[[s.vModelRadio,b.currentValue]]),s.createElementVNode("span",jS,s.toDisplayString(R),1)]))),128))])])):s.createCommentVNode("",!0),b.type==="checkbox"?(s.openBlock(),s.createElementBlock("div",HS,[s.createElementVNode("div",US,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(b.options,R=>(s.openBlock(),s.createElementBlock("label",{key:R,class:"zcode-checkbox-item"},[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":B=>b.currentValue=B,type:"checkbox",value:R,onChange:B=>k.$emit("save-field",b)},null,40,WS),[[s.vModelCheckbox,b.currentValue]]),s.createElementVNode("span",qS,s.toDisplayString(R),1)]))),128))])])):s.createCommentVNode("",!0),b.type==="select"?(s.openBlock(),s.createElementBlock("div",GS,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":R=>b.currentValue=R,class:"zcode-select",onChange:R=>k.$emit("save-field",b)},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(b.options,R=>(s.openBlock(),s.createElementBlock("option",{key:R,value:R},s.toDisplayString(R),9,JS))),128))],40,KS),[[s.vModelSelect,b.currentValue]])])):s.createCommentVNode("",!0),b.type==="select-multiple"?(s.openBlock(),s.createElementBlock("div",XS,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":R=>b.currentValue=R,class:"zcode-select",multiple:"",size:Math.min(b.options?.length||3,5),onChange:R=>k.$emit("save-field",b)},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(b.options,R=>(s.openBlock(),s.createElementBlock("option",{key:R,value:R},s.toDisplayString(R),9,QS))),128))],40,YS),[[s.vModelSelect,b.currentValue]])])):s.createCommentVNode("",!0),b.type==="tag"?(s.openBlock(),s.createElementBlock("div",ZS,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":R=>b.currentValue=R,class:"zcode-select",onChange:R=>k.$emit("save-field",b)},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(b.options,R=>(s.openBlock(),s.createElementBlock("option",{key:R,value:R},s.toDisplayString(R),9,tC))),128))],40,eC),[[s.vModelSelect,b.currentValue]]),s.createElementVNode("div",nC,[w[4]||(w[4]=s.createTextVNode(" 現在のタグ: ",-1)),s.createElementVNode("code",null,"<"+s.toDisplayString(b.currentValue)+">",1)])])):s.createCommentVNode("",!0),b.type==="boolean"?(s.openBlock(),s.createElementBlock("div",oC,[s.createElementVNode("label",rC,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":R=>b.currentValue=R,type:"checkbox",onChange:R=>k.$emit("save-field",b)},null,40,iC),[[s.vModelCheckbox,b.currentValue]]),s.createElementVNode("span",sC,s.toDisplayString(b.label)+"を表示",1)])])):s.createCommentVNode("",!0),b.type==="image"?(s.openBlock(),s.createElementBlock("div",aC,[s.createElementVNode("div",lC,[s.createElementVNode("button",{class:"zcode-image-select-btn",onClick:R=>m(b)},[s.createVNode(s.unref(yc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(b.currentValue?k.$t("editPanel.replaceImage"):k.$t("editPanel.selectImage")),1)],8,cC),b.currentValue?(s.openBlock(),s.createElementBlock("button",{key:0,class:"zcode-image-clear-btn",title:k.$t("editPanel.clearImageTitle"),onClick:R=>y(b)},[s.createVNode(s.unref(Ye),{size:16}),s.createElementVNode("span",null,s.toDisplayString(k.$t("editPanel.clearImage")),1)],8,dC)):s.createCommentVNode("",!0)]),v(b.currentValue)?(s.openBlock(),s.createElementBlock("div",uC,[s.createElementVNode("img",{src:v(b.currentValue)||"",alt:b.label,class:"zcode-image-preview-img"},null,8,fC)])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)]))),128))])):!i.value||a.value.length===0?(s.openBlock(),s.createElementBlock("div",pC,[s.createElementVNode("div",hC,s.toDisplayString(k.$t("editPanel.id",{id:n.editingComponent.id})),1),s.createElementVNode("div",mC,"Type: "+s.toDisplayString(n.editingComponent.type),1)])):s.createCommentVNode("",!0),s.createVNode(kS,{"is-open":p.value,"images-common":n.imagesCommon,"images-individual":n.imagesIndividual,"images-special":n.imagesSpecial,"current-value":h.value?.currentValue||void 0,"image-modal-actions":n.imageModalActions,"onUpdate:modelValue":x,onAddImage:C,onDeleteImage:E,onClose:g},null,8,["is-open","images-common","images-individual","images-special","current-value","image-modal-actions"])],2)):s.createCommentVNode("",!0)}}),gC={class:"zcode-delete-panel-header"},yC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},bC=["aria-label"],xC={key:0,class:"zcode-parent-selector"},kC={class:"zcode-delete-panel-content"},EC={class:"zcode-delete-warning"},wC={class:"zcode-delete-warning-text"},SC={class:"zcode-delete-actions"},CC=s.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"?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-delete-panel",onClick:t[4]||(t[4]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",gC,[s.createElementVNode("div",yC,s.toDisplayString(e.$t("deletePanel.title")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:t[0]||(t[0]=o=>e.$emit("cancel"))},[s.createVNode(s.unref(Ye),{size:18})],8,bC)]),n.canSelectParent?(s.openBlock(),s.createElementBlock("div",xC,[s.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:t[1]||(t[1]=o=>e.$emit("select-parent"))},[s.createVNode(s.unref(ei),{size:16}),s.createElementVNode("span",null,s.toDisplayString(e.$t("deletePanel.selectParent")),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",kC,[s.createElementVNode("div",EC,[s.createVNode(s.unref(Ec),{size:20,class:"zcode-delete-warning-icon"}),s.createElementVNode("div",wC,s.toDisplayString(e.$t("deletePanel.confirmMessage")),1)]),s.createElementVNode("div",SC,[s.createElementVNode("button",{class:"zcode-btn-danger",onClick:t[2]||(t[2]=o=>e.$emit("confirm"))},[s.createVNode(s.unref(Pn),{size:16}),s.createElementVNode("span",null,s.toDisplayString(e.$t("common.delete")),1)]),s.createElementVNode("button",{class:"zcode-btn-cancel",onClick:t[3]||(t[3]=o=>e.$emit("cancel"))},[s.createVNode(s.unref(Ye),{size:16}),s.createElementVNode("span",null,s.toDisplayString(e.$t("common.cancel")),1)])])])])):s.createCommentVNode("",!0)}}),NC={class:"zcode-reorder-panel-header"},vC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},TC=["aria-label"],zC={key:0,class:"zcode-parent-selector"},MC={class:"zcode-reorder-panel-content"},AC={class:"zcode-reorder-panel-content-text"},IC={class:"zcode-reorder-source"},_C=s.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"?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-reorder-panel",onClick:t[2]||(t[2]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",NC,[s.createElementVNode("div",vC,s.toDisplayString(e.$t("reorderPanel.title")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:t[0]||(t[0]=o=>e.$emit("cancel"))},[s.createVNode(s.unref(Ye),{size:18})],8,TC)]),n.canSelectParent?(s.openBlock(),s.createElementBlock("div",zC,[s.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:t[1]||(t[1]=o=>e.$emit("select-parent"))},[s.createVNode(s.unref(ei),{size:16}),s.createElementVNode("span",null,s.toDisplayString(e.$t("reorderPanel.selectParent")),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",MC,[s.createElementVNode("div",AC,s.toDisplayString(e.$t("reorderPanel.instruction")),1),s.createElementVNode("div",IC,s.toDisplayString(e.$t("reorderPanel.source",{path:n.reorderSourcePath})),1)])])):s.createCommentVNode("",!0)}}),OC={class:"zcode-add-panel-header"},DC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},PC=["aria-label"],RC={key:0,class:"zcode-parent-selector"},LC={class:"zcode-part-category-tabs"},$C=["onClick"],VC={key:1,class:"zcode-type-tabs"},BC=["onClick"],FC={class:"zcode-add-panel-content"},jC={class:"zcode-part-list"},HC={class:"zcode-part-type-section"},UC={class:"zcode-type-section-title",role:"heading","aria-level":"3"},WC={class:"zcode-type-section-description"},qC={key:0,class:"zcode-module-buttons"},GC={class:"zcode-module-preview-header"},KC={class:"zcode-module-preview-label zcode-module-preview-label-header"},JC=["aria-label"],XC=["innerHTML"],YC={key:1,class:"zcode-empty-parts"},QC={class:"zcode-empty-parts-text"},ZC={class:"zcode-type-section-title",role:"heading","aria-level":"3"},eN={key:0,class:"zcode-type-section-description"},tN={class:"zcode-module-buttons"},nN=["onClick"],oN={class:"zcode-module-preview-header"},rN={class:"zcode-module-preview-label zcode-module-preview-label-header"},iN=["aria-label","onClick"],sN=["innerHTML"],aN={key:0,class:"zcode-empty-parts"},lN={class:"zcode-empty-parts-text"},cN={key:2,class:"zcode-insert-position"},dN={class:"zcode-insert-header"},uN={class:"zcode-keep-adding-label zcode-keep-adding-label-position"},fN=["checked"],pN={class:"zcode-insert-buttons"},hN={class:"zcode-preview-modal-header"},mN={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},gN=["innerHTML"],yN=s.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=s.computed(()=>e.config?.categoryOrder||"common"),o=s.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=s.ref(!1),i=s.ref(null);function a(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?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-add-panel",onClick:u[9]||(u[9]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",OC,[s.createElementVNode("div",DC,s.toDisplayString(d.$t("addPanel.title")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":d.$t("common.close"),onClick:u[0]||(u[0]=f=>d.$emit("cancel"))},[s.createVNode(s.unref(Ye),{size:18})],8,PC)]),n.canSelectParent?(s.openBlock(),s.createElementBlock("div",RC,[s.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:u[1]||(u[1]=f=>d.$emit("select-parent"))},[s.createVNode(s.unref(ei),{size:16}),s.createElementVNode("span",null,s.toDisplayString(d.$t("addPanel.selectParent")),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",LC,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(o.value,f=>(s.openBlock(),s.createElementBlock("button",{key:f,class:s.normalizeClass([{active:n.addPartCategory===f&&n.addTypeTab!=="selected"},"zcode-category-tab"]),onClick:p=>d.$emit("category-tab-click",f)},s.toDisplayString(f==="common"?d.$t("addPanel.category.common"):f==="individual"?d.$t("addPanel.category.individual"):d.$t("dataViewer.special")),11,$C))),128)),s.createElementVNode("button",{class:s.normalizeClass([{active:n.addTypeTab==="selected"},"zcode-category-tab"]),onClick:u[2]||(u[2]=f=>d.$emit("type-tab-click","selected"))},s.toDisplayString(d.$t("addPanel.category.selected")),3)]),n.availablePartTypes.length>0&&n.addTypeTab!=="selected"?(s.openBlock(),s.createElementBlock("div",VC,[s.createElementVNode("button",{class:s.normalizeClass([{active:n.addTypeTab==="all"},"zcode-type-tab"]),onClick:u[3]||(u[3]=f=>d.$emit("type-tab-click","all"))}," all ",2),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(n.availablePartTypes,f=>(s.openBlock(),s.createElementBlock("button",{key:f,class:s.normalizeClass([{active:n.addTypeTab===f},"zcode-type-tab"]),onClick:p=>d.$emit("type-tab-click",f)},s.toDisplayString(f),11,BC))),128))])):s.createCommentVNode("",!0),s.createElementVNode("div",FC,[s.createElementVNode("div",jC,[s.withDirectives(s.createElementVNode("div",HC,[s.createElementVNode("div",UC,s.toDisplayString(d.$t("addPanel.activeParts")),1),s.createElementVNode("div",WC,s.toDisplayString(d.$t("addPanel.activePartsDescription")),1),n.clickedComponent&&n.addSelectedPart&&n.addSelectedType?(s.openBlock(),s.createElementBlock("div",qC,[s.createElementVNode("div",{class:s.normalizeClass([{active:!0},"zcode-module-preview"])},[s.createElementVNode("div",GC,[s.createElementVNode("div",KC,s.toDisplayString(d.$t("addPanel.activeParts")),1),s.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:u[4]||(u[4]=s.withModifiers(f=>l(),["stop"]))},[s.createVNode(s.unref(wc),{size:14})],8,JC)]),s.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:n.getClickedComponentPreviewHtml()},null,8,XC)])])):(s.openBlock(),s.createElementBlock("div",YC,[s.createElementVNode("div",QC,s.toDisplayString(d.$t("addPanel.clickPartInPreview")),1)]))],512),[[s.vShow,n.addTypeTab==="selected"]]),s.withDirectives(s.createElementVNode("div",null,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(n.groupedPartsByType,f=>(s.openBlock(),s.createElementBlock("div",{key:f.type,class:"zcode-part-type-section"},[s.createElementVNode("div",ZC,s.toDisplayString(f.type),1),f.description?(s.openBlock(),s.createElementBlock("div",eN,s.toDisplayString(f.description),1)):s.createCommentVNode("",!0),s.createElementVNode("div",tN,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(f.parts,p=>(s.openBlock(),s.createElementBlock("div",{key:p.title,class:s.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)},[s.createElementVNode("div",oN,[s.createElementVNode("div",rN,s.toDisplayString(p.title),1),s.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:s.withModifiers(h=>a(f.typeData,p),["stop"])},[s.createVNode(s.unref(wc),{size:14})],8,iN)]),s.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:n.getPartPreviewHtml(f.typeData,p)},null,8,sN)],10,nN))),128))])]))),128)),n.groupedPartsByType.length===0&&!n.addSelectedPart?(s.openBlock(),s.createElementBlock("div",aN,[s.createElementVNode("div",lN,s.toDisplayString(d.$t("addPanel.noPartsAvailable")),1)])):s.createCommentVNode("",!0)],512),[[s.vShow,n.addTypeTab!=="selected"]])])]),n.addSelectedPart?(s.openBlock(),s.createElementBlock("div",cN,[s.createElementVNode("div",dN,[u[10]||(u[10]=s.createElementVNode("div",{class:"zcode-insert-position-title",role:"heading","aria-level":"4"}," 追加位置を選択 ",-1)),s.createElementVNode("label",uN,[s.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,fN),s.createElementVNode("span",null,s.toDisplayString(d.$t("addPanel.continueAdding")),1)])]),s.createElementVNode("div",pN,[s.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-before",onClick:u[6]||(u[6]=f=>d.$emit("confirm-add","before"))},s.toDisplayString(d.$t("addPanel.addBefore")),1),s.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-after",onClick:u[7]||(u[7]=f=>d.$emit("confirm-add","after"))},s.toDisplayString(d.$t("addPanel.addAfter")),1)])])):s.createCommentVNode("",!0),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[r.value&&i.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:c},[s.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:u[8]||(u[8]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",hN,[s.createElementVNode("div",mN,s.toDisplayString(d.$t("common.preview"))+": "+s.toDisplayString(i.value.isActiveParts?d.$t("addPanel.activeParts"):i.value.part.title),1),s.createElementVNode("button",{class:"zcode-close-btn",onClick:c},[s.createVNode(s.unref(Ye),{size:18})])]),s.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:i.value.isActiveParts?n.getClickedComponentPreviewHtml():n.getPartPreviewHtml(i.value.type,i.value.part)},null,8,gN)])])):s.createCommentVNode("",!0)]))])):s.createCommentVNode("",!0)}}),bN=s.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,a)=>n.isVisible?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-context-menu",style:s.normalizeStyle({left:`${n.position.x}px`,top:`${n.position.y}px`}),onClick:a[4]||(a[4]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("button",{class:s.normalizeClass(["zcode-context-menu-item",{active:n.currentMode==="edit"}]),onClick:a[0]||(a[0]=l=>o("edit"))},[s.createVNode(s.unref(bc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("contextMenu.edit")),1)],2),s.createElementVNode("button",{class:s.normalizeClass(["zcode-context-menu-item",{active:n.currentMode==="add"}]),onClick:a[1]||(a[1]=l=>o("add"))},[s.createVNode(s.unref(ao),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("contextMenu.add")),1)],2),s.createElementVNode("button",{class:s.normalizeClass(["zcode-context-menu-item",{active:n.currentMode==="reorder"}]),onClick:a[2]||(a[2]=l=>o("reorder"))},[s.createVNode(s.unref(Zo),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("contextMenu.reorder")),1)],2),s.createElementVNode("button",{class:s.normalizeClass(["zcode-context-menu-item",{active:n.currentMode==="delete"}]),onClick:a[3]||(a[3]=l=>o("delete"))},[s.createVNode(s.unref(Pn),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("contextMenu.delete")),1)],2),a[5]||(a[5]=s.createElementVNode("div",{class:"zcode-context-menu-divider"},null,-1)),s.createElementVNode("button",{class:"zcode-context-menu-item",onClick:r},[s.createVNode(s.unref(Ye),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("contextMenu.close")),1)])],4)):s.createCommentVNode("",!0)}});function xN(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 kN(n,e){const t=ba(n.part_id,e);if(!t)return;Fn(t.body).forEach(r=>{r.optional||n[r.fieldName]===void 0&&(n[r.fieldName]=xN(r))})}function EN(n){function e(t){kN(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 jh(n){const e=s.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):[],a=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,g=n.backendData?JSON.parse(n.backendData):void 0;Object.assign(e,{page:i,css:{common:p,individual:h,special:m},parts:{common:a,individual:l,special:c},images:{common:d,individual:u,special:f},backendData:g}),EN(e)}catch(i){console.error("Failed to parse props:",i)}}function o(i){if(!i)return e;const a=i.split(".");let l=e;for(const c of a)if(l==null||typeof l!="object"||(l=l[c],l===void 0))return;return l}function r(i,a){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]]=a}else Object.assign(e,i)}return{cmsData:e,loadDataFromProps:t,getData:o,setData:r}}function wN(){const n=s.ref("edit"),e=s.ref(!1);function t(o){n.value=o}return{currentMode:n,switchMode:t,allowDynamicContentInteraction:e}}function Hh(n,e){return Fn(n.body).map(o=>{const r={fieldName:o.fieldName,groupName:o.groupName,label:Qy(o.fieldName),required:o.required,maxLength:o.maxLength,readonly:o.readonly,disabled:o.disabled},i=e[o.fieldName];if(o.type==="text")return{...r,type:"text",defaultValue:o.defaultValue,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.defaultValue};if(o.type==="textarea")return{...r,type:"textarea",defaultValue:o.defaultValue,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.defaultValue||""};if(o.type==="rich")return{...r,type:"rich",defaultValue:o.defaultValue,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.defaultValue||""};if(o.type==="radio")return{...r,type:"radio",options:o.options,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.options?.[0]};if(o.type==="boolean")return{...r,type:"boolean",defaultValue:o.defaultValue,optional:o.optional,currentValue:i!==void 0?i:!0};if(o.type==="image")return{...r,type:"image",defaultValue:o.defaultValue,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.defaultValue||""};if(o.type==="select")return{...r,type:"select",options:o.options,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.options?.[0]};if(o.type==="select-multiple")return{...r,type:"select-multiple",options:o.options,optional:o.optional,currentValue:Array.isArray(i)?i:[]};if(o.type==="tag"){const a=["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"],l=o.options||a;return{...r,type:"tag",options:l,defaultValue:o.defaultValue||"div",currentValue:i!==void 0?i:o.defaultValue||"div"}}return{...r,type:"checkbox",options:o.options,optional:o.optional,currentValue:Array.isArray(i)?i:[]}})}function Uh(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 Kt(n,e){const t=Uh(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 Jt(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 oc(n,e){const t=Uh(e);n.style.outline=`2px dashed ${t}`,n.style.outlineOffset="2px"}function mn(n){n.style.outline="",n.style.outlineOffset=""}function SN(n,e){const t=s.ref(null),o=s.ref(-1),r=s.ref(""),i=s.ref([]);function a(u){const f=u.part_id,p=n.parts,h=[...p.common,...p.individual];let m=null;for(const g of h){const y=g.parts.find(x=>x.id===f);if(y){m=y;break}}return m?Hh(m,u):[]}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&&Jt(m)}t.value=f,o.value=h,r.value=u,i.value=a(f),s.nextTick(()=>{if(e.value&&r.value===u){const m=e.value.querySelector(`[data-zcode-path="${u}"]`);m&&(Kt(m,"edit"),rr(m))}})}function c(u){if(t.value&&r.value){const f=dn(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&&Jt(u)}t.value=null,r.value="",i.value=[]}return{editingComponent:t,editingComponentIndex:o,editingComponentPath:r,editingAvailableFields:i,handleEditClick:l,saveFieldEdit:c,closeEditPanel:d}}function CN(n,e,t,o){const r=s.ref(null),i=s.ref(null),a=s.ref(null),l=s.ref(o?.categoryOrder==="individual"?"individual":o?.categoryOrder==="special"?"special":"common"),c=s.ref("all"),d=s.ref(null),u=s.ref(!1);function f(O){if(O.includes(".slots.")){const D=O.split(".");let P=-1;for(let q=D.length-1;q>=0;q--)if(D[q]==="slots"){P=q;break}if(P!==-1&&P+1<D.length)return D.slice(0,P+2).join(".")}return O}const p=s.computed(()=>{const O=n.parts,D=l.value==="common"?O.common:l.value==="individual"?O.individual:O.special;if(r.value&&r.value.includes(".slots.")){const q=[...O.common,...O.individual,...O.special],W=f(r.value);return g(W,q,D)}return[...new Set(D.map(q=>q.type))]});function h(O,D){const P=O.split(".");let q=-1;for(let Z=P.length-1;Z>=0;Z--)if(P[Z]==="slots"){q=Z;break}if(q===-1)return null;const W=P.slice(0,q).join("."),V=P[q+1],G=dn(W,n);if(!G)return null;const J=G.part_id;let oe=null;for(const Z of D)if(Z.parts.some(Y=>Y.id===J)){oe=Z;break}if(!oe)return null;const X=(oe.parts.find(Z=>Z.id===J)||oe.parts[0])?.slots?.[V];if(X){const Z=X.allowedParts;if(Z&&Array.isArray(Z))return Z}return null}const m=s.computed(()=>{const O=n.parts,D=l.value==="common"?O.common:l.value==="individual"?O.individual:O.special,P=p.value;let q=D.filter(J=>P.includes(J.type));c.value&&c.value!=="all"&&c.value!=="selected"&&(q=q.filter(J=>J.type===c.value));const W=[...O.common,...O.individual],V=r.value&&r.value.includes(".slots.")?h(f(r.value),W):null,G=new Map;return q.forEach(J=>{G.has(J.type)||G.set(J.type,{type:J,parts:[]});const oe=G.get(J.type);V!==null?V.length>0&&J.parts.forEach(ne=>{V.includes(ne.id)&&oe.parts.push(ne)}):J.parts.forEach(ne=>{ne.slotOnly||oe.parts.push(ne)})}),Array.from(G.values()).map(J=>({type:J.type.type,description:J.type.description,typeData:J.type,parts:J.parts}))});function g(O,D,P){const q=O.split(".");let W=-1;for(let Y=q.length-1;Y>=0;Y--)if(q[Y]==="slots"){W=Y;break}if(W===-1)return[...new Set(P.map(Y=>Y.type))];const V=q.slice(0,W).join("."),G=q[W+1],J=dn(V,n);if(!J)return[...new Set(P.map(Y=>Y.type))];const oe=J.part_id;let ne=null,X=null;for(const Y of D){const te=Y.parts.find(de=>de.id===oe);if(te){ne=Y,X=te;break}}if(!ne||!X)return[...new Set(P.map(Y=>Y.type))];const Z=X?.slots?.[G];if(Z){const Y=Z.allowedParts;if(Y&&Array.isArray(Y)){const te=new Set;D.forEach(me=>{me.parts.forEach(Me=>{Y.includes(Me.id)&&te.add(me.type)})});let de=Array.from(te);return de=de.filter(me=>P.some(Me=>Me.type===me)),de}}return[...new Set(P.map(Y=>Y.type))]}function y(O,D=!1){if(r.value===O){R();return}if(r.value&&e.value){const de=e.value.querySelector(`[data-zcode-path="${r.value}"]`);de&&Jt(de);const me=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);me&&Jt(me)}r.value=O,c.value="all",l.value="common",i.value=null,a.value=null;const P=dn(O,n);P&&P.part_id?d.value=P:d.value=null;const q=n.parts,W=q.common,V=q.individual,G=q.special;let J=[],oe=[];if(O.includes(".slots.")){const de=[...W,...V,...G],me=f(O);J=g(me,de,W),oe=g(me,de,V)}else J=[...new Set(W.map(de=>de.type))],oe=[...new Set(V.map(de=>de.type))];const ne=J.length>0,X=oe.length>0,Z=G.length>0,Y=o?.categoryOrder;let te;Y==="special"&&Z?te="special":Y==="individual"&&X?te="individual":Y==="common"&&ne||ne?te="common":X?te="individual":Z?te="special":te="common",l.value=te,s.nextTick(()=>{if(e.value&&r.value===O){const de=e.value.querySelector(`[data-zcode-path="${O}"]`);if(de)Kt(de,"add"),rr(de);else{const me=f(O);if(me!==O){const Me=e.value.querySelector(`[data-zcode-slot-path="${me}"]`);Me&&(Kt(Me,"add"),rr(Me))}}}})}function x(O){l.value=O,c.value="all",i.value=null,a.value=null,u.value=!1}function C(O){if(c.value=O,O==="selected"&&d.value&&d.value.part_id){const D=n.parts,P=[...D.common,...D.individual,...D.special];for(const q of P){const W=q.parts.find(V=>V.id===d.value.part_id);if(W){i.value=q,a.value=W;break}}}else O!=="selected"&&(i.value=null,a.value=null);u.value=!1}function E(O,D){const P=A(O,D);return t(P,"")}function v(){return d.value?t(d.value,""):""}function A(O,D){const P=k(O,!1,new Set,D.id);return P.id="preview",P}function M(O,D){if(a.value?.id===D.id){i.value=null,a.value=null;return}i.value=O,a.value=D,c.value==="selected"&&(c.value="all"),u.value=!1}function k(O,D=!1,P=new Set,q){const W=q?O.parts.find(X=>X.id===q)||O.parts[0]:D&&a.value?a.value:O.parts[0];if(!W)throw new Error(`Part not found for type: ${O.type}`);const V=`${O.id}:${W.id}`;if(P.has(V)){const X=Fn(W.body),Z={};return X.forEach(Y=>{Y.optional?Z[Y.fieldName]=void 0:Y.type==="text"?Z[Y.fieldName]=Y.defaultValue:Y.type==="radio"?Z[Y.fieldName]=Y.options?.[0]:Y.type==="checkbox"?Z[Y.fieldName]=[]:Y.type==="boolean"?Z[Y.fieldName]=!0:Y.type==="rich"?Z[Y.fieldName]=Y.defaultValue?`<p>${Y.defaultValue}</p>`:"<p></p>":Y.type==="image"&&(Z[Y.fieldName]=Y.defaultValue||"")}),{id:jn(),part_id:W.id,...Z}}P.add(V);const G=Fn(W.body),J={};G.forEach(X=>{X.optional?J[X.fieldName]=void 0:X.type==="text"?J[X.fieldName]=X.defaultValue:X.type==="radio"?J[X.fieldName]=X.options?.[0]:X.type==="checkbox"?J[X.fieldName]=[]:X.type==="boolean"?J[X.fieldName]=!0:X.type==="rich"?J[X.fieldName]=X.defaultValue?`<p>${X.defaultValue}</p>`:"<p></p>":X.type==="image"&&(J[X.fieldName]=X.defaultValue||"")});const oe={id:jn(),part_id:W.id,...J},ne=W.slots;if(ne){const X={};Object.entries(ne).forEach(([Z,Y])=>{const te=Y.allowedParts;if(te&&te.length===1){const de=te[0],me=n.parts,Me=[...me.common,...me.individual,...me.special];let Le=null,N=null;for(const L of Me){const $=L.parts.find(S=>S.id===de);if($){Le=L,N=$;break}}if(Le&&N){const L=k(Le,!1,P,N.id);X[Z]=[L]}else X[Z]=[]}else X[Z]=[]}),Object.keys(X).length>0&&(oe.slots=X)}return oe}function w(O){return k(O,!0)}function b(O){if(!i.value||!a.value||!r.value){console.error("Missing required values:",{addSelectedType:i.value,addSelectedPart:a.value,addTargetPath:r.value});return}let D;if(c.value==="selected"&&d.value){if(D=JSON.parse(JSON.stringify(d.value)),D.id=jn(),D.slots){const W=V=>{V.forEach(G=>{G.id=jn(),G.slots&&Object.values(G.slots).forEach(J=>{Array.isArray(J)?W(J):J&&typeof J=="object"&&J.children&&W(J.children||[])})})};Object.values(D.slots).forEach(V=>{Array.isArray(V)?W(V):V&&typeof V=="object"&&V.children&&W(V.children||[])})}}else D=w(i.value);const P=r.value,q=P.split(".");if(q[0]==="page"&&q.length===2){const W=parseInt(q[1]);O==="before"?(n.page.splice(W,0,D),u.value&&(r.value=`page.${W+1}`)):n.page.splice(W+1,0,D)}else if(q.includes("slots")){const W=f(P),V=W.split(".");let G=-1;for(let te=V.length-1;te>=0;te--)if(V[te]==="slots"){G=te;break}if(G===-1||G>=V.length-1){console.error("Invalid slot path:",W);return}const J=V.slice(0,G).join("."),oe=V[G+1],ne=P!==W?parseInt(q[q.length-1]):-1,X=dn(J,n);if(!X){console.error("Parent component not found:",J);return}X.slots||(X.slots={});const Z=X.slots[oe];let Y=[];if(Array.isArray(Z)?Y=Z:Z&&typeof Z=="object"&&Z.children?(Y=Z.children||[],Z.children||(Z.children=[])):(X.slots[oe]=[],Y=X.slots[oe]),ne===-1)Y.push(D);else if(O==="before"){if(Y.splice(ne,0,D),u.value){const te=f(P);if(P!==te){const de=[...q];de[de.length-1]=String(ne+1),r.value=de.join(".")}else{const me=[...te.split(".")];me.push("0"),r.value=me.join(".")}}}else Y.splice(ne+1,0,D);Array.isArray(X.slots[oe])||(X.slots[oe].children=Y)}if(d.value||c.value==="selected"&&(c.value="all"),!u.value)R();else if(O==="before"&&e.value&&r.value){const W=e.value.querySelector(`[data-zcode-path="${P}"]`);W&&Jt(W),s.nextTick(()=>{if(e.value&&r.value){const V=e.value.querySelector(`[data-zcode-path="${r.value}"]`);V&&Kt(V,"add")}})}}function R(){if(r.value&&e.value){const O=e.value.querySelector(`[data-zcode-path="${r.value}"]`);O&&Jt(O);const D=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);D&&Jt(D)}r.value=null,i.value=null,a.value=null,d.value=null,l.value="common",c.value="all",u.value=!1}const B=s.computed(()=>n.parts.special.length>0);return{addTargetPath:r,addSelectedType:i,addSelectedPart:a,clickedComponent:d,addPartCategory:l,addTypeTab:c,keepAdding:u,availablePartTypes:p,groupedPartsByType:m,hasSpecialParts:B,handleAddClick:y,handleCategoryTabClick:x,handleTypeTabClick:C,selectPart:M,getPartPreviewHtml:E,getClickedComponentPreviewHtml:v,confirmAddPart:b,cancelAdd:R}}function NN(n,e,t,o){const r=s.ref(null),i=s.ref("");function a(f,p){if(i.value===f){u();return}if(i.value&&e.value){const h=e.value.querySelector(`[data-zcode-path="${i.value}"]`);h&&Jt(h)}r.value=p,i.value=f,o(()=>{if(e.value&&i.value===f){const h=e.value.querySelector(`[data-zcode-path="${f}"]`);h&&(Kt(h,"delete"),rr(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 g=parseInt(p[1]);!isNaN(g)&&g>=0&&g<n.page.length&&(n.page.splice(g,1),n.page.length===0&&o(()=>{t("add")}))}else if(p.length>2&&p[0]==="page"){const g=parseInt(p[1]);if(isNaN(g)||g<0||g>=n.page.length){console.error("Invalid top-level index:",g),u();return}let y=n.page[g];const x=p.slice(2);x.length>=3&&x[0]==="slots"&&(m=x[1],h=`page.${g}`);for(let E=0;E<x.length-1;E++){if(!y||typeof y!="object"){console.error("Invalid path:",f),u();return}y=y[x[E]]}const C=x[x.length-1];if(y&&typeof y=="object")if(Array.isArray(y)){const E=parseInt(C);!isNaN(E)&&E>=0&&E<y.length?y.splice(E,1):console.error("Invalid array index:",C)}else C in y?delete y[C]: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,n);if(!h)return;const m=h.slots;if(!m||!Array.isArray(m[p]))return;const g=m[p];if(g.length===0){const y=h.part_id,x=n.parts,C=[...x.common,...x.individual];let E=null,v=null;for(const M of C){const k=M.parts.find(w=>w.id===y);if(k){E=M,v=k;break}}if(!E||!v)return;const A=v?.slots?.[p];if(A){const M=A.allowedParts;if(M&&M.length===1){const k=M[0];let w=null,b=null;for(const R of C){const B=R.parts.find(O=>O.id===k);if(B){w=R,b=B;break}}if(w&&b){const R=d(w,b.id);g.push(R)}}}}}function d(f,p){const h=p&&f.parts.find(C=>C.id===p)||f.parts[0];if(!h)throw new Error(`Part not found for type: ${f.type}`);const m=Fn(h.body),g={};m.forEach(C=>{C.optional?g[C.fieldName]=void 0:C.type==="text"?g[C.fieldName]=C.defaultValue:C.type==="radio"?g[C.fieldName]=C.options?.[0]:C.type==="checkbox"?g[C.fieldName]=[]:C.type==="boolean"?g[C.fieldName]=!0:C.type==="rich"?g[C.fieldName]=C.defaultValue?`<p>${C.defaultValue}</p>`:"<p></p>":C.type==="image"&&(g[C.fieldName]=C.defaultValue||"")});const y={id:jn(),part_id:h.id,...g},x=h.slots;if(x){const C={};Object.entries(x).forEach(([E,v])=>{const A=v.allowedParts;if(A&&A.length===1){const M=A[0],k=n.parts,w=[...k.common,...k.individual];let b=null,R=null;for(const B of w){const O=B.parts.find(D=>D.id===M);if(O){b=B,R=O;break}}if(b&&R){const B=d(b,R.id);C[E]=[B]}else C[E]=[]}else C[E]=[]}),Object.keys(C).length>0&&(y.slots=C)}return y}function u(){if(i.value&&e.value){const f=e.value.querySelector(`[data-zcode-path="${i.value}"]`);f&&Jt(f)}r.value=null,i.value=""}return{deleteConfirmComponent:r,deleteConfirmPath:i,handleDeleteClick:a,confirmDelete:l,cancelDelete:u}}function vN(n,e){const t=s.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 g=d[f+1],y=u[p+1];return g===y}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=Gd(l);if(d&&e.value){const u=e.value.querySelector(`[data-zcode-path="${d}"]`);u&&mn(u)}if(t.value=l,e.value){const u=e.value.querySelector(`[data-zcode-path="${l}"]`);u&&(Kt(u,"reorder"),rr(u))}return}if(t.value===l){i();return}if(!o(t.value,l)){alert("この要素とは並べ替えできません。同じ階層の要素を選択してください。"),i();return}a(t.value,l)||alert("並べ替えに失敗しました。同じ階層の要素を選択してください。"),i()}function i(){if(t.value&&e.value){const l=e.value.querySelector(`[data-zcode-path="${t.value}"]`);l&&Jt(l)}t.value=""}function a(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 k=d.length-1;k>=0;k--)if(d[k]==="slots"){f=k;break}for(let k=u.length-1;k>=0;k--)if(u[k]==="slots"){p=k;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 g=d[f+1],y=u[p+1];if(g!==y)return!1;const x=parseInt(d[d.length-1]),C=parseInt(u[u.length-1]);if(isNaN(x)||isNaN(C)||x===C)return!1;const E=dn(h,n);if(!E||!E.slots||!E.slots[g])return!1;const v=E.slots[g];let A=[];if(Array.isArray(v))A=v;else if(v&&typeof v=="object"&&v.children)A=v.children||[];else return!1;const[M]=A.splice(x,1);return A.splice(C,0,M),!Array.isArray(v)&&typeof v=="object"&&v.children&&(v.children=A),!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 g=parseInt(d[1]);let y=n.page[g];for(let x=2;x<d.length-1;x++)y=y[d[x]];if(Array.isArray(y)){const[x]=y.splice(h,1);return y.splice(m,0,x),!0}}}}return!1}return{reorderSourcePath:t,handleReorderClick:r,canReorderWith:o,cancelReorder:i}}function TN(n,e,t,o,r,i,a,l,c){const d=s.computed(()=>o.value?Gd(o.value):null),u=s.computed(()=>{if(!d.value)return!1;const p=dn(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=dn(p,n);if(m){if(o.value&&e.value){const g=e.value.querySelector(`[data-zcode-path="${o.value}"]`);g&&mn(g)}switch(t.value){case"edit":r(p,m);break;case"add":i(p,!0);break;case"reorder":if(c.value){const g=e.value.querySelector(`[data-zcode-path="${c.value}"]`);g&&Jt(g),c.value=""}a(p);break;case"delete":l(p,m);break}}}return{parentPath:d,canSelectParent:u,selectParentElement:f}}function zN(n,e,t,o,r,i,a,l,c,d,u,f,p,h){const m=new Map;function g(){if(!e.value)return;y();const x=e.value.querySelectorAll("[data-zcode-id]"),C=k=>{const w=k.target;if(!w)return;const b=w.closest("[data-zcode-add-slot]");if(!b)return;const R=b.closest("[data-zcode-slot-path]"),B=R?.getAttribute("data-zcode-slot-path");if(!B)return;k.preventDefault(),k.stopPropagation(),k.stopImmediatePropagation();const O=()=>{const D=e.value?.querySelector(`[data-zcode-slot-path="${B}"]`);D&&(mn(D),Kt(D,"add"))};if(R&&mn(R),t.value!=="add"){p("add"),s.nextTick(()=>{c(B),s.nextTick(()=>{O()})});return}O(),s.nextTick(()=>{c(B),s.nextTick(()=>{O()})})};let E=null;const v=k=>o.value===k||r.value===k||i.value===k||a.value===k,A=k=>{const b=k.target;if(!b)return;const R=b.closest("[data-zcode-slot-path]");if(!R){if(E){const O=E.getAttribute("data-zcode-slot-path")||"";(!O||!v(O))&&mn(E),E=null}return}if(E===R)return;if(E){const O=E.getAttribute("data-zcode-slot-path")||"";(!O||!v(O))&&mn(E)}E=R;const B=R.getAttribute("data-zcode-slot-path")||"";B&&!v(B)&&oc(R,t.value)},M=k=>{const w=k,b=w.target;if(!b)return;const R=w.relatedTarget,B=b.closest("[data-zcode-slot-path]");if(!B||R&&B.contains(R))return;const O=B.getAttribute("data-zcode-slot-path")||"";(!O||!v(O))&&mn(B),E===B&&(E=null)};e.value.addEventListener("click",C,!0),e.value.addEventListener("mouseover",A,!0),e.value.addEventListener("mouseout",M,!0),m.set(e.value,[{type:"click",listener:C,options:!0},{type:"mouseover",listener:A,options:!0},{type:"mouseout",listener:M,options:!0}]),x.forEach(k=>{const w=k,b=w.getAttribute("data-zcode-path");if(!b)return;const R=P=>{const q=P.target,V=q?.closest("[data-zcode-path]")?.getAttribute("data-zcode-path");if(V&&V!==b)return;q?.closest("a[href]")&&(h.value||P.preventDefault()),h.value||(P.stopPropagation(),P.stopImmediatePropagation());const J=dn(b,n);if(J)switch(mn(w),t.value){case"edit":l(b,J);break;case"add":c(b);break;case"reorder":if(i.value){const oe=i.value.split("."),ne=b.split(".");if(oe.length!==ne.length&&oe.indexOf("rows")!==-1){const Z=ne.indexOf("cells");if(Z!==-1){let Y=-1;for(let te=Z-1;te>=0;te--)if(ne[te]==="slots"){Y=te;break}if(Y!==-1){const te=ne.slice(0,Y).join(".");if(te&&f(i.value,te)){d(te);return}}}}}d(b);break;case"delete":u(b,J);break}},B=P=>{if(o.value===P||r.value===P||i.value===P||a.value===P)return!0;if(P.includes(".slots.")){const W=P.split(".");let V=-1;for(let G=W.length-1;G>=0;G--)if(W[G]==="slots"){V=G;break}if(V!==-1&&V+1<W.length){const G=W.slice(0,V+2).join(".");return r.value===G||o.value===G||i.value===G||a.value===G}}return!1},O=()=>{B(b)||(t.value==="reorder"&&i.value?f(i.value,b)&&oc(w,t.value):oc(w,t.value)),t.value==="reorder"?w.style.cursor=i.value&&f(i.value,b)?"move":i.value?"not-allowed":"move":w.style.cursor="pointer"},D=()=>{B(b)||mn(w),w.style.cursor=""};w.addEventListener("click",R,!0),w.addEventListener("mouseenter",O),w.addEventListener("mouseleave",D),m.set(w,[{type:"click",listener:R,options:!0},{type:"mouseenter",listener:O},{type:"mouseleave",listener:D}])}),s.nextTick(()=>{s.nextTick(()=>{if(t.value==="edit"&&o.value&&e.value){const k=e.value.querySelector(`[data-zcode-path="${o.value}"]`);k&&Kt(k,"edit")}if(t.value==="add"&&r.value&&e.value){const k=e.value.querySelector(`[data-zcode-path="${r.value}"]`);if(k)Kt(k,"add");else{const w=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);w&&Kt(w,"add")}}if(t.value==="reorder"&&i.value&&e.value){const k=e.value.querySelector(`[data-zcode-path="${i.value}"]`);k&&Kt(k,"reorder")}if(t.value==="delete"&&a.value&&e.value){const k=e.value.querySelector(`[data-zcode-path="${a.value}"]`);k&&Kt(k,"delete")}})})}function y(){m.forEach((x,C)=>{x.forEach(({type:E,listener:v,options:A})=>{C.removeEventListener(E,v,A)})}),m.clear()}return{setupClickHandlers:g,cleanupEventListeners:y}}function MN(n,e,t,o,r,i,a,l,c,d,u,f,p){function h(m){n.value&&n.value.querySelectorAll("[data-zcode-path], [data-zcode-slot-path]").forEach(y=>{Jt(y),mn(y)}),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"&&a.value&&p(),t(m)}return{switchMode:h}}function AN(n,e,t){const o=s.ref(!1),r=s.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 a(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:a,closeMenu:l,setupContextMenu:u,cleanupContextMenu:f}}function IN(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 rc(n,e){const t=[],o=(r,i)=>{Object.keys(r).forEach(a=>{a.includes("image")&&r[a]===n&&t.push({path:i,component:r,fieldName:a})}),r.slots&&Object.entries(r.slots).forEach(([a,l])=>{Array.isArray(l)&&l.forEach((c,d)=>{o(c,`${i}.slots.${a}.${d}`)})})};return e.forEach((r,i)=>{o(r,`page.${i}`)}),t}const _N={key:0,class:"zcode-save-banner zcode-save-banner--error",role:"alert"},ON={class:"zcode-save-banner-text"},DN=["aria-label"],PN={key:1,class:"zcode-save-controls-fixed"},RN={class:"zcode-save-confirm-dialog"},LN={class:"zcode-save-confirm-dialog-header"},$N={class:"zcode-save-confirm-dialog-title"},VN={class:"zcode-save-confirm-dialog-body"},BN={class:"zcode-save-confirm-dialog-footer"},Ps=s.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}=Vt(),o=n,r=s.ref("manage"),i=s.ref(!1),l=(se=>{if(!se)return{};try{return JSON.parse(se)}catch(ue){return console.warn("[ZeroCodeCMS] Failed to parse config:",ue),{}}})(o.config),c=s.computed(()=>{const se={common:{add:!1,delete:!1},individual:{add:!1,delete:!1},special:{add:!1,delete:!1}},ue=l.cms?.imageModalActions;return ue?{common:{...se.common,...ue.common},individual:{...se.individual,...ue.individual},special:{...se.special,...ue.special}}:se}),d=s.computed(()=>{const se=["page"],ue=c.value;return(ue.common?.add||ue.common?.delete)&&se.push("images-common"),(ue.individual?.add||ue.individual?.delete)&&se.push("images-individual"),(ue.special?.add||ue.special?.delete)&&se.push("images-special"),se}),u=(se,ue,we)=>{const We=Xd();return We[se]!==void 0?We[se]:we!==void 0?we:ue},f=s.ref(u("devRightPadding",!1,l.cms?.devRightPadding)),p=s.ref(u("enableContextMenu",!1,l.cms?.enableContextMenu)),h=s.ref(u("showSaveConfirm",!0,l.cms?.showSaveConfirm)),m=s.computed(()=>f.value),g=s.ref(!1),{cmsData:y,loadDataFromProps:x,getData:C,setData:E}=jh(o),{fullPageHtml:v,renderComponentToHtml:A}=gi(y,!0);function M(se){if(se!=="css")return se?C(se):C()}const k=s.ref(null),w=s.ref(null),b=s.computed(()=>w.value?.previewArea||null),{currentMode:R,switchMode:B,allowDynamicContentInteraction:O}=wN(),D=u("allowDynamicContentInteraction",!1,l.cms?.allowDynamicContentInteraction),P=s.ref(D);O.value=D;let q=!1;s.watch(r,(se,ue)=>{se==="preview"?(q=P.value,P.value=!0,O.value=!0,s.nextTick(()=>{fe()})):ue==="preview"&&(P.value=q,O.value=q,s.nextTick(()=>{fe()})),Dt("view-mode-changed",{mode:se,previousMode:ue})});const{editingComponent:W,editingComponentPath:V,editingAvailableFields:G,handleEditClick:J,saveFieldEdit:oe,closeEditPanel:ne}=SN(y,b),X=s.ref({}),Z=s.ref([]),Y=s.ref({visible:!1,message:""});function te(se){if(se?.fieldName&&X.value[se.fieldName]){const ue={...X.value};delete ue[se.fieldName],X.value=ue}oe(se)}const{addTargetPath:de,addSelectedType:me,addSelectedPart:Me,clickedComponent:Le,addPartCategory:N,addTypeTab:L,keepAdding:$,availablePartTypes:S,groupedPartsByType:K,hasSpecialParts:z,handleAddClick:U,handleCategoryTabClick:ie,handleTypeTabClick:Se,selectPart:ve,getPartPreviewHtml:T,getClickedComponentPreviewHtml:I,confirmAddPart:Q,cancelAdd:ge}=CN(y,b,A,l),{reorderSourcePath:Te,handleReorderClick:ye,canReorderWith:H,cancelReorder:ee}=vN(y,b),{deleteConfirmComponent:ze,deleteConfirmPath:Pe,handleDeleteClick:dt,confirmDelete:Xt,cancelDelete:Ot}=NN(y,b,B,s.nextTick),{switchMode:$t}=MN(b,R,B,V,de,Te,Pe,W,me,Me,N,L,Ot),_n=s.computed(()=>R.value==="edit"&&V.value?V.value:R.value==="add"&&de.value?de.value:R.value==="reorder"&&Te.value?Te.value:R.value==="delete"&&Pe.value?Pe.value:null),{canSelectParent:F,selectParentElement:j}=TN(y,b,R,_n,J,U,ye,dt,Te),le=s.computed(()=>!!(W.value||de.value||Te.value||ze.value)),fe=()=>{if(b.value){const se=b.value.getRootNode();if(se instanceof ShadowRoot){let We=0;const bt=()=>{We++;const tt=se;if(typeof tt.__zcmsSetAllowDynamicContentInteraction=="function"){tt.__zcmsSetAllowDynamicContentInteraction(P.value);return}We<30&&setTimeout(bt,50)};bt()}}},{setupClickHandlers:_e,cleanupEventListeners:Qe}=zN(y,b,R,V,de,Te,Pe,J,U,ye,dt,H,$t,P),{isVisible:gn,position:Kr,handleModeSelect:vo,closeMenu:lc,setupContextMenu:Jr,cleanupContextMenu:Ke}=AN(b,p,$t);function Dt(se,ue){const we=Ko();if(we){const bt=new CustomEvent(se,{detail:ue,bubbles:!0,composed:!0});we.dispatchEvent(bt);return}const We=new CustomEvent(se,{detail:ue,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(We)}function cc(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Ko(){if(k.value){const ue=k.value.getRootNode();if(ue instanceof ShadowRoot&&ue.host)return ue.host;const we=k.value.closest?.("zcode-cms")||k.value.closest?.("zcode-editor");if(we)return we}const se=s.getCurrentInstance();if(se){const ue=se.vnode.el;if(ue instanceof HTMLElement){const we=ue.getRootNode();if(we instanceof ShadowRoot&&we.host)return we.host;const We=ue.closest?.("zcode-cms")||ue.closest?.("zcode-editor");return We||null}if(ue instanceof Node){const we=ue.getRootNode();if(we instanceof ShadowRoot&&we.host)return we.host}}return null}function Jo(se){return typeof se=="object"&&se!==null}function Fs(se){return Array.isArray(se)?se.filter(ue=>Jo(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 Xr(se){if(!se){X.value={};return}const ue={};for(const we of Z.value){const We=typeof we?.path=="string"?we.path:null,bt=typeof we?.field=="string"?we.field:null,tt=typeof we?.message=="string"?we.message:null;!bt||!tt||We&&We!==se||(ue[bt]=tt)}X.value=ue}const dc=(se,ue)=>{ue==="common"?y.images.common.push(se):ue==="individual"?y.images.individual.push(se):y.images.special.push(se)},Yt=se=>{rc(se,y.page).forEach(tt=>{Object.keys(tt.component).forEach(ke=>{ke.includes("image")&&tt.component[ke]===se&&(tt.component[ke]="")})});const we=y.images.common.findIndex(tt=>tt.id===se);we!==-1&&y.images.common.splice(we,1);const We=y.images.individual.findIndex(tt=>tt.id===se);We!==-1&&y.images.individual.splice(We,1);const bt=y.images.special.findIndex(tt=>tt.id===se);bt!==-1&&y.images.special.splice(bt,1)};function yn(se){const ue=se.detail;if(!Jo(ue))return;const we=ue;if(we.ok===!0){Y.value.visible=!1,Y.value.message="",Z.value=[],X.value={};return}if(we.ok!==!1)return;const We=Fs(we.errors);Z.value=We;const bt=We.length,tt=typeof We[0]?.message=="string"&&We[0].message?We[0].message:null;Y.value.visible=!0,Y.value.requestId=typeof we.requestId=="string"?we.requestId:void 0,Y.value.target=typeof we.target=="string"?we.target:void 0,Y.value.message=tt?t("editor.saveFailedWithMessage",{count:bt,message:tt}):t("editor.saveFailedWithCount",{count:bt}),Xr(V.value||null)}s.onMounted(()=>{x(),s.nextTick(()=>{_e(),p.value&&Jr(),fe(),Dt("zcode-dom-updated",{})});const se=Ko();se&&se.addEventListener("save-result",yn)}),s.onUnmounted(()=>{Qe(),Ke();const se=Ko();se&&se.removeEventListener("save-result",yn)}),s.watch(()=>V.value,se=>{Xr(se||null)}),s.watch([()=>o.page,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial],()=>{x()}),s.watch(y,()=>{s.nextTick(()=>{_e(),Dt("zcode-dom-updated",{})})},{deep:!0}),s.watch([r,b],([se,ue])=>{se==="manage"&&ue?s.nextTick(()=>{_e(),p.value&&Jr(),fe(),Dt("zcode-dom-updated",{})}):Ke()}),s.watch(R,()=>{s.nextTick(()=>{Dt("zcode-dom-updated",{})})}),s.watch(f,se=>{yi({devRightPadding:se})}),s.watch(P,se=>{r.value==="manage"&&yi({allowDynamicContentInteraction:se}),O.value=se,s.nextTick(()=>{_e(),fe(),Dt("zcode-dom-updated",{})})}),s.watch(p,se=>{yi({enableContextMenu:se}),se?s.nextTick(()=>{Jr()}):Ke()}),s.watch(h,se=>{yi({showSaveConfirm:se})});function js(){if(!h.value){Yr();return}g.value=!0}function Yr(){const se=cc();Dt("save-request",{requestId:se,source:"cms",targets:d.value,timestamp:Date.now()})}function Qr(){g.value=!1,Yr()}function Zr(){g.value=!1}return e({getData:M,setData:E,validateData:IN,cmsData:y,currentMode:R,switchMode:$t,allowDynamicContentInteraction:P,devRightPadding:f,devRightPaddingValue:m,settingsPanelOpen:i}),(se,ue)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"containerRef",ref:k,class:s.normalizeClass(["zcode-cms-container",{"zcode-dev-padding":f.value&&le.value}])},[s.createVNode(Kd,{"current-mode":s.unref(R),"view-mode":r.value,"allow-dynamic-content-interaction":P.value,onSwitchMode:s.unref($t),onSwitchViewMode:ue[0]||(ue[0]=we=>r.value=we),onOpenSettings:ue[1]||(ue[1]=we=>i.value=!0)},null,8,["current-mode","view-mode","allow-dynamic-content-interaction","onSwitchMode"]),Y.value.visible?(s.openBlock(),s.createElementBlock("div",_N,[s.createElementVNode("div",ON,s.toDisplayString(Y.value.message),1),s.createElementVNode("button",{class:"zcode-save-banner-close","aria-label":se.$t("common.close"),onClick:ue[2]||(ue[2]=we=>Y.value.visible=!1)}," × ",8,DN)])):s.createCommentVNode("",!0),r.value==="manage"?(s.openBlock(),s.createElementBlock("div",PN,[s.createElementVNode("button",{class:"zcode-save-btn",onClick:js},[s.createVNode(s.unref(xc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(se.$t("common.save")),1)])])):s.createCommentVNode("",!0),r.value==="preview"?(s.openBlock(),s.createBlock(xa,{key:2,"cms-data":s.unref(y),"allow-dynamic-content-interaction":!0},null,8,["cms-data"])):s.createCommentVNode("",!0),r.value==="manage"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:3},[s.createVNode(Sc,{ref_key:"previewAreaRef",ref:w,"cms-data":s.unref(y),"full-page-html":s.unref(v),"on-add-click":s.unref(U),"allow-dynamic-content-interaction":P.value},null,8,["cms-data","full-page-html","on-add-click","allow-dynamic-content-interaction"]),s.createVNode(Fh,{"editing-component":s.unref(W),"editing-available-fields":s.unref(G),"field-errors":X.value,"current-mode":s.unref(R),"can-select-parent":s.unref(F),"images-common":s.unref(y).images.common,"images-individual":s.unref(y).images.individual,"images-special":s.unref(y).images.special,"image-modal-actions":c.value,onClose:s.unref(ne),onSelectParent:s.unref(j),onSaveField:te,onAddImage:dc,onDeleteImage:Yt},null,8,["editing-component","editing-available-fields","field-errors","current-mode","can-select-parent","images-common","images-individual","images-special","image-modal-actions","onClose","onSelectParent"]),s.createVNode(CC,{"delete-confirm-component":s.unref(ze),"current-mode":s.unref(R),"can-select-parent":s.unref(F),onConfirm:s.unref(Xt),onCancel:s.unref(Ot),onSelectParent:s.unref(j)},null,8,["delete-confirm-component","current-mode","can-select-parent","onConfirm","onCancel","onSelectParent"]),s.createVNode(_C,{"reorder-source-path":s.unref(Te),"current-mode":s.unref(R),"can-select-parent":s.unref(F),onCancel:s.unref(ee),onSelectParent:s.unref(j)},null,8,["reorder-source-path","current-mode","can-select-parent","onCancel","onSelectParent"]),s.createVNode(yN,{"add-target-path":s.unref(de),"add-part-category":s.unref(N),"add-type-tab":s.unref(L),"add-selected-part":s.unref(Me),"add-selected-type":s.unref(me),"has-special-parts":s.unref(z),"clicked-component":s.unref(Le),"available-part-types":s.unref(S),config:s.unref(l),"grouped-parts-by-type":s.unref(K),"can-select-parent":s.unref(F),"get-part-preview-html":s.unref(T),"get-clicked-component-preview-html":s.unref(I),"keep-adding":s.unref($),onCancel:s.unref(ge),onSelectParent:s.unref(j),onCategoryTabClick:s.unref(ie),onTypeTabClick:s.unref(Se),onSelectPart:s.unref(ve),onConfirmAdd:s.unref(Q),onUpdateKeepAdding:ue[3]||(ue[3]=we=>$.value=we)},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)):s.createCommentVNode("",!0),s.createVNode(Zd,{"is-open":i.value,"view-mode":r.value,mode:"toolbar","allow-dynamic-content-interaction":P.value,"dev-right-padding":m.value,"enable-context-menu":p.value,"show-save-confirm":h.value,onClose:ue[4]||(ue[4]=we=>i.value=!1),onToggleDynamicContent:ue[5]||(ue[5]=we=>P.value=we),onToggleDevPadding:ue[6]||(ue[6]=we=>f.value=we),onToggleContextMenu:ue[7]||(ue[7]=we=>p.value=we),onToggleSaveConfirm:ue[8]||(ue[8]=we=>h.value=we)},null,8,["is-open","view-mode","allow-dynamic-content-interaction","dev-right-padding","enable-context-menu","show-save-confirm"]),s.createVNode(bN,{"is-visible":s.unref(gn),position:s.unref(Kr),"current-mode":s.unref(R),onSelectMode:s.unref(vo),onClose:s.unref(lc)},null,8,["is-visible","position","current-mode","onSelectMode","onClose"]),g.value?(s.openBlock(),s.createElementBlock("div",{key:4,class:"zcode-save-confirm-dialog-overlay",onClick:s.withModifiers(Zr,["self"])},[s.createElementVNode("div",RN,[s.createElementVNode("div",LN,[s.createElementVNode("div",$N,s.toDisplayString(se.$t("saveConfirm.title")),1)]),s.createElementVNode("div",VN,[s.createElementVNode("p",null,s.toDisplayString(se.$t("saveConfirm.simpleMessage")),1)]),s.createElementVNode("div",BN,[s.createElementVNode("button",{class:"zcode-btn-secondary",onClick:Zr},s.toDisplayString(se.$t("common.cancel")),1),s.createElementVNode("button",{class:"zcode-btn-primary",onClick:Qr},s.toDisplayString(se.$t("saveConfirm.saveButton")),1)])])])):s.createCommentVNode("",!0)],2))}}),Wh=":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-side-tabs{display:flex;gap:0;padding:8px 12px 0;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-part-editor-side-tab{padding:8px 12px;font-size:13px;color:#6b7280;background:transparent;border:none;border-bottom:2px solid transparent;cursor:pointer;margin-bottom:-1px}.zcode-part-editor-side-tab:hover{color:#374151}.zcode-part-editor-side-tab.active{color:#1f2937;font-weight:600;border-bottom-color:#3b82f6}.zcode-edit-panel-preview-heading{font-size:14px;font-weight:600;color:#1f2937;margin-bottom:4px}.zcode-part-editor-pane-body .zcode-edit-panel-preview-desc{margin-bottom:12px;font-size:12px;color:#6b7280;line-height:1.5}.zcode-edit-panel-preview-empty{padding:24px 12px;text-align:center;font-size:13px;color:#6b7280;background:#f9fafb;border-radius:6px;border:1px dashed #e5e7eb}.zcode-edit-panel-preview-wrap{display:flex;flex-direction:column;min-height:0;overflow:hidden}.zcode-edit-panel-preview{position:static;top:auto;right:auto;width:auto;height:auto;max-height:none;box-shadow:none;z-index:auto;display:flex;flex-direction:column;background:transparent;overflow:visible}.zcode-edit-panel-preview .zcode-field-editor{padding:0 4px}.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-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}.zcode-edit-panel-preview{position:static;inset:auto;width:auto;height:auto;max-height:none;box-shadow:none;z-index:auto;border-radius:0;animation:none}@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}.zcode-part-editor-main{display:grid;grid-template-columns:1fr 1fr;gap:24px;align-items:stretch;min-height:0}.zcode-part-editor-main .zcode-part-editor-pane--side{position:sticky;top:0;align-self:start;max-height:calc(100vh - 120px)}.zcode-part-editor-pane--side .zcode-part-editor-pane-body{overflow-y:auto}.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-slots-config-in-pane{padding:12px 0;overflow-y:auto;min-height:0}.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}}",FN={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:"設定項目はありません。"},emptyState:{message:"パーツを追加してください",addPart:"+ パーツを追加"},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} を削除しますか?
462
+ 3. "-" cannot repeat`);Ue.customSchemes.push([n,e])}function qw(){Ue.scanner=$w(Ue.customSchemes);for(let n=0;n<Ue.tokenQueue.length;n++)Ue.tokenQueue[n][1]({scanner:Ue.scanner});Ue.parser=Fw(Ue.scanner.tokens);for(let n=0;n<Ue.pluginQueue.length;n++)Ue.pluginQueue[n][1]({scanner:Ue.scanner,parser:Ue.parser});return Ue.initialized=!0,Ue}function tc(n){return Ue.initialized||qw(),jw(Ue.parser.start,n,Oh(Ue.scanner.start,n))}tc.scan=Oh;function Bh(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 Zl(t),r=tc(n),i=[];for(let a=0;a<r.length;a++){const l=r[a];l.isLink&&(!e||l.t===e)&&o.check(l)&&i.push(l.toFormattedObject(o))}return i}var nc="[\0-   ᠎ -\u2029  ]",Gw=new RegExp(nc),Kw=new RegExp(`${nc}$`),Jw=new RegExp(nc,"g");function Xw(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function Yw(n){return new Mt({key:new rn("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:a}=o,l=Pp(t.doc,[...e]);if(Wp(l).forEach(({newRange:d})=>{const u=Pk(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(!Kw.test(h))return;f=u[0],p=o.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&p){const h=p.split(Gw).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],g=f.pos+p.lastIndexOf(m);if(!m)return!1;const y=tc(m).map(x=>x.toObject(n.defaultProtocol));if(!Xw(y))return!1;y.filter(x=>x.isLink).map(x=>({...x,from:g+x.start+1,to:g+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=>{El(x.from,x.to,o.doc).some(N=>N.mark.type===n.type)||a.addMark(x.from,x.to,n.type.create({href:x.href}))})}}),!!a.steps.length)return a}})}function Qw(n){return new Mt({key:new rn("handleClickLink"),props:{handleClick:(e,t,o)=>{var r,i;if(o.button!==0||!e.editable)return!1;let a=!1;if(n.enableClickSelection&&(a=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 a;const c=Up(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),a=!0)}return a}}})}function Zw(n){return new Mt({key:new rn("handlePasteLink"),props:{handlePaste:(e,t,o)=>{const{shouldAutoLink:r}=n,{state:i}=e,{selection:a}=i,{empty:l}=a;if(l)return!1;let c="";o.content.forEach(u=>{c+=u.textContent});const d=Bh(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 No(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(Jw,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var eS=Ar.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"){Vh(n);return}Vh(n.scheme,n.optionalSlashes)})},onDestroy(){Ww()},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)=>!!No(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=>!!No(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=>!!No(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=>!!No(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=>!!No(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[qo({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:o}=this.options,r=Bh(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:a=>!!No(a,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(Yw({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!No(r,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(Qw({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(Zw({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),tS=eS;const nS={class:"zcode-rich-text-editor"},oS={key:0,class:"zcode-rich-text-toolbar"},rS=s.defineComponent({__name:"RichTextEditor",props:{modelValue:{type:String},placeholder:{type:String}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,r=HE({extensions:[WE,GE,JE,tw,aw,uw,Nw,vw,Tw,Mw,tS.configure({openOnClick:!1,HTMLAttributes:{class:"zcode-link"}})],content:t.modelValue||"",editorProps:{attributes:{class:"zcode-tiptap-editor","data-placeholder":t.placeholder||"テキストを入力..."}},onUpdate:({editor:a})=>{const l=a.getHTML();o("update:modelValue",l)}});s.watch(()=>t.modelValue,a=>{r.value&&r.value.getHTML()!==a&&r.value.commands.setContent(a||"")});const i=()=>{if(!r.value)return;const a=r.value.getAttributes("link").href,l=window.prompt("URLを入力してください",a);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 s.onUnmounted(()=>{r.value&&r.value.destroy()}),(a,l)=>(s.openBlock(),s.createElementBlock("div",nS,[s.unref(r)?(s.openBlock(),s.createElementBlock("div",oS,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("bold")},"zcode-toolbar-btn"]),title:"太字",onClick:l[0]||(l[0]=c=>s.unref(r).chain().focus().toggleBold().run())},[s.createVNode(s.unref(gm),{size:16})],2),s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("italic")},"zcode-toolbar-btn"]),title:"斜体",onClick:l[1]||(l[1]=c=>s.unref(r).chain().focus().toggleItalic().run())},[s.createVNode(s.unref(km),{size:16})],2),s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("strike")},"zcode-toolbar-btn"]),title:"取り消し線",onClick:l[2]||(l[2]=c=>s.unref(r).chain().focus().toggleStrike().run())},[s.createVNode(s.unref(Nm),{size:16})],2),l[5]||(l[5]=s.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("bulletList")},"zcode-toolbar-btn"]),title:"箇条書き",onClick:l[3]||(l[3]=c=>s.unref(r).chain().focus().toggleBulletList().run())},[s.createVNode(s.unref(Sm),{size:16})],2),s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("orderedList")},"zcode-toolbar-btn"]),title:"番号付きリスト",onClick:l[4]||(l[4]=c=>s.unref(r).chain().focus().toggleOrderedList().run())},[s.createVNode(s.unref(wm),{size:16})],2),l[6]||(l[6]=s.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),s.createElementVNode("button",{type:"button",class:s.normalizeClass([{"is-active":s.unref(r).isActive("link")},"zcode-toolbar-btn"]),title:"リンク",onClick:i},[s.createVNode(s.unref(Em),{size:16})],2)])):s.createCommentVNode("",!0),s.createVNode(s.unref(jE),{editor:s.unref(r),class:"zcode-rich-text-editor-content"},null,8,["editor"])]))}}),iS={class:"zcode-image-modal-header"},sS={class:"zcode-image-modal-header-title",role:"heading","aria-level":"3"},aS=["aria-label"],lS={key:0,class:"zcode-image-current"},cS={class:"zcode-image-current-title",role:"heading","aria-level":"4"},dS={class:"zcode-image-current-item"},uS=["src","alt"],fS={class:"zcode-image-current-name"},pS={class:"zcode-image-tabs"},hS={class:"zcode-image-grid"},mS=["onClick"],gS=["src","alt"],yS={class:"zcode-image-name"},bS={key:1,class:"zcode-image-add"},xS={class:"zcode-image-modal-actions"},kS=s.defineComponent({__name:"ImageSelectModal",props:{isOpen:{type:Boolean},imagesCommon:{type:Array},imagesIndividual:{type:Array},imagesSpecial:{type:Array},currentValue:{type:String},imageModalActions:{type:Object}},emits:["update:model-value","add-image","delete-image","close"],setup(n,{emit:e}){const{t}=Vt(),o=n,r=e,i=s.ref("common"),a=s.ref(null),l=s.ref(o.currentValue||null),c=s.computed(()=>i.value==="common"?o.imagesCommon:i.value==="individual"?o.imagesIndividual:o.imagesSpecial),d=s.computed(()=>{const N={add:!1,delete:!1},E=o.imageModalActions;return E?i.value==="common"?{...N,...E.common}:i.value==="individual"?{...N,...E.individual}:{...N,...E.special}:N}),u=s.computed(()=>d.value.add),f=s.computed(()=>d.value.delete),p=()=>o.currentValue&&[...o.imagesCommon,...o.imagesIndividual,...o.imagesSpecial].find(E=>E.id===o.currentValue)||null,h=N=>{l.value=N.id},m=()=>{l.value&&(r("update:model-value",l.value),x())},g=()=>{l.value&&confirm(t("imagesManager.deleteImageFromModalConfirm"))&&(r("delete-image",l.value),l.value=null)},y=N=>{const v=N.target.files?.[0];if(!v)return;const A=new FileReader;A.onload=M=>{const k=M.target?.result,w={id:`img-${Date.now()}`,name:v.name,url:k,mimeType:v.type,needsUpload:!0},b=i.value==="common"?"common":i.value==="individual"?"individual":"special";r("add-image",w,b),l.value=w.id},A.readAsDataURL(v)},x=()=>{r("close")};return(N,E)=>n.isOpen?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:s.withModifiers(x,["self"])},[s.createElementVNode("div",{class:"zcode-image-modal-content",onClick:E[4]||(E[4]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",iS,[s.createElementVNode("div",sS,s.toDisplayString(N.$t("imagesManager.selectImage")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":N.$t("common.close"),onClick:x},[s.createVNode(s.unref(Ye),{size:18})],8,aS)]),n.currentValue&&p()?(s.openBlock(),s.createElementBlock("div",lS,[s.createElementVNode("div",cS,s.toDisplayString(N.$t("imagesManager.currentlySelected")),1),s.createElementVNode("div",dS,[s.createElementVNode("img",{src:p()?.url,alt:p()?.name||"",class:"zcode-image-current-item-img"},null,8,uS),s.createElementVNode("div",fS,s.toDisplayString(p()?.name),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",pS,[s.createElementVNode("button",{class:s.normalizeClass([{active:i.value==="common"},"zcode-image-tab"]),onClick:E[0]||(E[0]=v=>i.value="common")},s.toDisplayString(N.$t("dataViewer.common")),3),s.createElementVNode("button",{class:s.normalizeClass([{active:i.value==="individual"},"zcode-image-tab"]),onClick:E[1]||(E[1]=v=>i.value="individual")},s.toDisplayString(N.$t("dataViewer.individual")),3),n.imagesSpecial.length>0?(s.openBlock(),s.createElementBlock("button",{key:0,class:s.normalizeClass([{active:i.value==="special"},"zcode-image-tab"]),onClick:E[2]||(E[2]=v=>i.value="special")},s.toDisplayString(N.$t("dataViewer.special")),3)):s.createCommentVNode("",!0)]),s.createElementVNode("div",hS,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(c.value,v=>(s.openBlock(),s.createElementBlock("div",{key:v.id,class:s.normalizeClass([{selected:l.value===v.id},"zcode-image-item"]),onClick:A=>h(v)},[s.createElementVNode("img",{src:v.url,alt:v.name,class:"zcode-image-item-img"},null,8,gS),s.createElementVNode("div",yS,s.toDisplayString(v.name),1)],10,mS))),128))]),u.value?(s.openBlock(),s.createElementBlock("div",bS,[s.createElementVNode("input",{ref_key:"fileInput",ref:a,type:"file",accept:"image/*",style:{display:"none"},onChange:y},null,544),s.createElementVNode("button",{class:"zcode-image-add-btn",onClick:E[3]||(E[3]=v=>a.value?.click())},[s.createVNode(s.unref(ao),{size:16}),s.createElementVNode("span",null,s.toDisplayString(N.$t("imagesManager.addImage")),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",xS,[l.value?(s.openBlock(),s.createElementBlock("button",{key:0,class:"zcode-btn-primary zcode-image-modal-actions-btn",onClick:m},[s.createVNode(s.unref(er),{size:16}),s.createElementVNode("span",null,s.toDisplayString(N.$t("imagesManager.select")),1)])):s.createCommentVNode("",!0),l.value&&f.value?(s.openBlock(),s.createElementBlock("button",{key:1,class:"zcode-btn-danger zcode-image-modal-actions-btn",onClick:g},[s.createVNode(s.unref(Pn),{size:16}),s.createElementVNode("span",null,s.toDisplayString(N.$t("common.delete")),1)])):s.createCommentVNode("",!0)])])])):s.createCommentVNode("",!0)}}),ES={key:0,class:"zcode-edit-panel-header"},wS={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},SS=["aria-label"],CS={key:1,class:"zcode-parent-selector"},NS={key:2,class:"zcode-group-tabs"},vS=["onClick"],TS={key:3,class:"zcode-field-editor"},zS={class:"zcode-field-item-title",role:"heading","aria-level":"4"},MS={key:0,class:"zcode-text-editor"},AS=["value","placeholder","maxlength","readonly","disabled","onInput"],IS={key:0,class:"zcode-field-error-message"},_S={key:1,class:"zcode-field-counter"},OS={key:1,class:"zcode-text-editor"},DS=["value","placeholder","maxlength","readonly","disabled","onInput"],PS={key:0,class:"zcode-field-error-message"},RS={key:1,class:"zcode-field-counter"},LS={key:2,class:"zcode-rich-text-editor-wrapper"},$S={key:0,class:"zcode-field-error-message"},VS={key:3,class:"zcode-radio-editor"},BS={class:"zcode-radio-group"},FS=["onUpdate:modelValue","name","value","onChange"],jS={class:"zcode-radio-item-label"},HS={key:4,class:"zcode-checkbox-editor"},US={class:"zcode-checkbox-group"},WS=["onUpdate:modelValue","value","onChange"],qS={class:"zcode-checkbox-item-label"},GS={key:5,class:"zcode-select-editor"},KS=["onUpdate:modelValue","onChange"],JS=["value"],XS={key:6,class:"zcode-select-editor"},YS=["onUpdate:modelValue","size","onChange"],QS=["value"],ZS={key:7,class:"zcode-tag-editor"},eC=["onUpdate:modelValue","onChange"],tC=["value"],nC={class:"zcode-tag-preview"},oC={key:8,class:"zcode-boolean-editor"},rC={class:"zcode-checkbox-item"},iC=["onUpdate:modelValue","onChange"],sC={class:"zcode-checkbox-item-label"},aC={key:9,class:"zcode-image-editor"},lC={class:"zcode-image-editor-buttons"},cC=["onClick"],dC=["title","onClick"],uC={key:0,class:"zcode-image-preview"},fC=["src","alt"],pC={key:4,class:"zcode-edit-fields"},hC={class:"zcode-edit-fields-text"},mC={class:"zcode-edit-fields-text"},Fh=s.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},previewMode:{type:Boolean},imageModalActions:{type:Object}},emits:["close","select-parent","save-field","add-image","delete-image"],setup(n,{emit:e}){const t=n,o=s.ref("all"),r=s.computed(()=>{const k=new Map;return t.editingAvailableFields.forEach(w=>{const b=w.groupName||"other";k.set(b,(k.get(b)||0)+1)}),Array.from(k.entries()).map(([w,b])=>({name:w,count:b}))}),i=s.computed(()=>r.value.length>1),a=s.computed(()=>!i.value||o.value==="all"?t.editingAvailableFields:t.editingAvailableFields.filter(k=>(k.groupName||"other")===o.value));s.watch(()=>i.value,k=>{k?o.value="all":o.value=void 0},{immediate:!0}),s.watch(()=>t.editingAvailableFields,()=>{if(i.value){if(o.value==="all")return;r.value.some(w=>w.name===o.value)||(o.value="all")}},{deep:!0});const l=e,c=s.ref({});function d(k){const w=k.label||k.fieldName,b=k.currentValue,R=k.type==="rich"&&typeof b=="string"&&b.trim()==="<p></p>"?"":b??"";return k.required&&(R===""||R===void 0||R===null)?`${w}は必須です`:typeof k.maxLength=="number"&&k.maxLength>0&&String(R).length>k.maxLength?`${w}は${k.maxLength}文字以内で入力してください`:null}function u(k,w){w?c.value[k]=w:delete c.value[k]}function f(k){return c.value[k]||t.fieldErrors?.[k]||null}const p=s.ref(!1),h=s.ref(null),m=k=>{h.value=k,p.value=!0},g=()=>{p.value=!1,h.value=null},y=k=>{k.currentValue="",l("save-field",k)},x=k=>{h.value&&(h.value.currentValue=k||"",l("save-field",h.value))},N=(k,w)=>{l("add-image",k,w)},E=k=>{l("delete-image",k),h.value?.currentValue===k&&(h.value.currentValue="",l("save-field",h.value))},v=k=>k&&[...t.imagesCommon,...t.imagesIndividual,...t.imagesSpecial].find(R=>R.id===k)?.url||null,A=(k,w)=>{const b=w.target;k.currentValue=b.value,u(k.fieldName,d(k)),l("save-field",k)},M=(k,w)=>{k.optional&&w===""?k.currentValue=void 0:k.currentValue=w,u(k.fieldName,d(k)),l("save-field",k)};return(k,w)=>n.editingComponent&&n.currentMode==="edit"?(s.openBlock(),s.createElementBlock("div",{key:0,class:s.normalizeClass(n.previewMode?"zcode-edit-panel-preview":"zcode-edit-panel"),onClick:w[3]||(w[3]=s.withModifiers(()=>{},["stop"]))},[n.previewMode?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("div",ES,[s.createElementVNode("div",wS,s.toDisplayString(k.$t("editPanel.editing",{type:n.editingComponent.type})),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":k.$t("common.close"),onClick:w[0]||(w[0]=b=>k.$emit("close"))},[s.createVNode(s.unref(Ye),{size:18})],8,SS)])),!n.previewMode&&n.canSelectParent?(s.openBlock(),s.createElementBlock("div",CS,[s.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:w[1]||(w[1]=b=>k.$emit("select-parent"))},[s.createVNode(s.unref(ei),{size:16}),s.createElementVNode("span",null,s.toDisplayString(k.$t("addPanel.selectParent")),1)])])):s.createCommentVNode("",!0),i.value?(s.openBlock(),s.createElementBlock("div",NS,[s.createElementVNode("button",{class:s.normalizeClass([{active:o.value==="all"},"zcode-group-tab"]),onClick:w[2]||(w[2]=b=>o.value="all")}," all ",2),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r.value,b=>(s.openBlock(),s.createElementBlock("button",{key:b.name,class:s.normalizeClass([{active:o.value===b.name},"zcode-group-tab"]),onClick:R=>o.value=b.name},s.toDisplayString(b.name),11,vS))),128))])):s.createCommentVNode("",!0),a.value.length>0?(s.openBlock(),s.createElementBlock("div",TS,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(a.value,b=>(s.openBlock(),s.createElementBlock("div",{key:b.fieldName,class:"zcode-field-item"},[s.createElementVNode("div",zS,s.toDisplayString(b.label),1),b.type==="text"?(s.openBlock(),s.createElementBlock("div",MS,[s.createElementVNode("input",{type:"text",value:b.currentValue??"",placeholder:b.defaultValue,maxlength:b.maxLength,readonly:b.readonly,disabled:b.disabled,class:s.normalizeClass([{"zcode-field-error":f(b.fieldName)},"zcode-text-input"]),onInput:R=>A(b,R)},null,42,AS),f(b.fieldName)?(s.openBlock(),s.createElementBlock("div",IS,s.toDisplayString(f(b.fieldName)),1)):s.createCommentVNode("",!0),b.maxLength?(s.openBlock(),s.createElementBlock("div",_S,s.toDisplayString(String(b.currentValue??"").length)+" / "+s.toDisplayString(b.maxLength),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),b.type==="textarea"?(s.openBlock(),s.createElementBlock("div",OS,[s.createElementVNode("textarea",{value:b.currentValue??"",placeholder:b.defaultValue,maxlength:b.maxLength,readonly:b.readonly,disabled:b.disabled,class:s.normalizeClass([{"zcode-field-error":f(b.fieldName)},"zcode-textarea"]),rows:"4",onInput:R=>A(b,R)},null,42,DS),f(b.fieldName)?(s.openBlock(),s.createElementBlock("div",PS,s.toDisplayString(f(b.fieldName)),1)):s.createCommentVNode("",!0),b.maxLength?(s.openBlock(),s.createElementBlock("div",RS,s.toDisplayString(String(b.currentValue??"").length)+" / "+s.toDisplayString(b.maxLength),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),b.type==="rich"?(s.openBlock(),s.createElementBlock("div",LS,[s.createVNode(rS,{"model-value":b.currentValue??"",placeholder:b.defaultValue,"onUpdate:modelValue":R=>M(b,R)},null,8,["model-value","placeholder","onUpdate:modelValue"]),f(b.fieldName)?(s.openBlock(),s.createElementBlock("div",$S,s.toDisplayString(f(b.fieldName)),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),b.type==="radio"?(s.openBlock(),s.createElementBlock("div",VS,[s.createElementVNode("div",BS,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(b.options,R=>(s.openBlock(),s.createElementBlock("label",{key:R,class:"zcode-radio-item"},[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":B=>b.currentValue=B,type:"radio",name:b.fieldName,value:R,onChange:B=>k.$emit("save-field",b)},null,40,FS),[[s.vModelRadio,b.currentValue]]),s.createElementVNode("span",jS,s.toDisplayString(R),1)]))),128))])])):s.createCommentVNode("",!0),b.type==="checkbox"?(s.openBlock(),s.createElementBlock("div",HS,[s.createElementVNode("div",US,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(b.options,R=>(s.openBlock(),s.createElementBlock("label",{key:R,class:"zcode-checkbox-item"},[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":B=>b.currentValue=B,type:"checkbox",value:R,onChange:B=>k.$emit("save-field",b)},null,40,WS),[[s.vModelCheckbox,b.currentValue]]),s.createElementVNode("span",qS,s.toDisplayString(R),1)]))),128))])])):s.createCommentVNode("",!0),b.type==="select"?(s.openBlock(),s.createElementBlock("div",GS,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":R=>b.currentValue=R,class:"zcode-select",onChange:R=>k.$emit("save-field",b)},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(b.options,R=>(s.openBlock(),s.createElementBlock("option",{key:R,value:R},s.toDisplayString(R),9,JS))),128))],40,KS),[[s.vModelSelect,b.currentValue]])])):s.createCommentVNode("",!0),b.type==="select-multiple"?(s.openBlock(),s.createElementBlock("div",XS,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":R=>b.currentValue=R,class:"zcode-select",multiple:"",size:Math.min(b.options?.length||3,5),onChange:R=>k.$emit("save-field",b)},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(b.options,R=>(s.openBlock(),s.createElementBlock("option",{key:R,value:R},s.toDisplayString(R),9,QS))),128))],40,YS),[[s.vModelSelect,b.currentValue]])])):s.createCommentVNode("",!0),b.type==="tag"?(s.openBlock(),s.createElementBlock("div",ZS,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":R=>b.currentValue=R,class:"zcode-select",onChange:R=>k.$emit("save-field",b)},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(b.options,R=>(s.openBlock(),s.createElementBlock("option",{key:R,value:R},s.toDisplayString(R),9,tC))),128))],40,eC),[[s.vModelSelect,b.currentValue]]),s.createElementVNode("div",nC,[w[4]||(w[4]=s.createTextVNode(" 現在のタグ: ",-1)),s.createElementVNode("code",null,"<"+s.toDisplayString(b.currentValue)+">",1)])])):s.createCommentVNode("",!0),b.type==="boolean"?(s.openBlock(),s.createElementBlock("div",oC,[s.createElementVNode("label",rC,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":R=>b.currentValue=R,type:"checkbox",onChange:R=>k.$emit("save-field",b)},null,40,iC),[[s.vModelCheckbox,b.currentValue]]),s.createElementVNode("span",sC,s.toDisplayString(b.label)+"を表示",1)])])):s.createCommentVNode("",!0),b.type==="image"?(s.openBlock(),s.createElementBlock("div",aC,[s.createElementVNode("div",lC,[s.createElementVNode("button",{class:"zcode-image-select-btn",onClick:R=>m(b)},[s.createVNode(s.unref(yc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(b.currentValue?k.$t("editPanel.replaceImage"):k.$t("editPanel.selectImage")),1)],8,cC),b.currentValue?(s.openBlock(),s.createElementBlock("button",{key:0,class:"zcode-image-clear-btn",title:k.$t("editPanel.clearImageTitle"),onClick:R=>y(b)},[s.createVNode(s.unref(Ye),{size:16}),s.createElementVNode("span",null,s.toDisplayString(k.$t("editPanel.clearImage")),1)],8,dC)):s.createCommentVNode("",!0)]),v(b.currentValue)?(s.openBlock(),s.createElementBlock("div",uC,[s.createElementVNode("img",{src:v(b.currentValue)||"",alt:b.label,class:"zcode-image-preview-img"},null,8,fC)])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)]))),128))])):!i.value||a.value.length===0?(s.openBlock(),s.createElementBlock("div",pC,[s.createElementVNode("div",hC,s.toDisplayString(k.$t("editPanel.id",{id:n.editingComponent.id})),1),s.createElementVNode("div",mC,"Type: "+s.toDisplayString(n.editingComponent.type),1)])):s.createCommentVNode("",!0),s.createVNode(kS,{"is-open":p.value,"images-common":n.imagesCommon,"images-individual":n.imagesIndividual,"images-special":n.imagesSpecial,"current-value":h.value?.currentValue||void 0,"image-modal-actions":n.imageModalActions,"onUpdate:modelValue":x,onAddImage:N,onDeleteImage:E,onClose:g},null,8,["is-open","images-common","images-individual","images-special","current-value","image-modal-actions"])],2)):s.createCommentVNode("",!0)}}),gC={class:"zcode-delete-panel-header"},yC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},bC=["aria-label"],xC={key:0,class:"zcode-parent-selector"},kC={class:"zcode-delete-panel-content"},EC={class:"zcode-delete-warning"},wC={class:"zcode-delete-warning-text"},SC={class:"zcode-delete-actions"},CC=s.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"?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-delete-panel",onClick:t[4]||(t[4]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",gC,[s.createElementVNode("div",yC,s.toDisplayString(e.$t("deletePanel.title")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:t[0]||(t[0]=o=>e.$emit("cancel"))},[s.createVNode(s.unref(Ye),{size:18})],8,bC)]),n.canSelectParent?(s.openBlock(),s.createElementBlock("div",xC,[s.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:t[1]||(t[1]=o=>e.$emit("select-parent"))},[s.createVNode(s.unref(ei),{size:16}),s.createElementVNode("span",null,s.toDisplayString(e.$t("deletePanel.selectParent")),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",kC,[s.createElementVNode("div",EC,[s.createVNode(s.unref(Ec),{size:20,class:"zcode-delete-warning-icon"}),s.createElementVNode("div",wC,s.toDisplayString(e.$t("deletePanel.confirmMessage")),1)]),s.createElementVNode("div",SC,[s.createElementVNode("button",{class:"zcode-btn-danger",onClick:t[2]||(t[2]=o=>e.$emit("confirm"))},[s.createVNode(s.unref(Pn),{size:16}),s.createElementVNode("span",null,s.toDisplayString(e.$t("common.delete")),1)]),s.createElementVNode("button",{class:"zcode-btn-cancel",onClick:t[3]||(t[3]=o=>e.$emit("cancel"))},[s.createVNode(s.unref(Ye),{size:16}),s.createElementVNode("span",null,s.toDisplayString(e.$t("common.cancel")),1)])])])])):s.createCommentVNode("",!0)}}),NC={class:"zcode-reorder-panel-header"},vC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},TC=["aria-label"],zC={key:0,class:"zcode-parent-selector"},MC={class:"zcode-reorder-panel-content"},AC={class:"zcode-reorder-panel-content-text"},IC={class:"zcode-reorder-source"},_C=s.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"?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-reorder-panel",onClick:t[2]||(t[2]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",NC,[s.createElementVNode("div",vC,s.toDisplayString(e.$t("reorderPanel.title")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:t[0]||(t[0]=o=>e.$emit("cancel"))},[s.createVNode(s.unref(Ye),{size:18})],8,TC)]),n.canSelectParent?(s.openBlock(),s.createElementBlock("div",zC,[s.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:t[1]||(t[1]=o=>e.$emit("select-parent"))},[s.createVNode(s.unref(ei),{size:16}),s.createElementVNode("span",null,s.toDisplayString(e.$t("reorderPanel.selectParent")),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",MC,[s.createElementVNode("div",AC,s.toDisplayString(e.$t("reorderPanel.instruction")),1),s.createElementVNode("div",IC,s.toDisplayString(e.$t("reorderPanel.source",{path:n.reorderSourcePath})),1)])])):s.createCommentVNode("",!0)}}),OC={class:"zcode-add-panel-header"},DC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},PC=["aria-label"],RC={key:0,class:"zcode-parent-selector"},LC={class:"zcode-part-category-tabs"},$C=["onClick"],VC={key:1,class:"zcode-type-tabs"},BC=["onClick"],FC={class:"zcode-add-panel-content"},jC={class:"zcode-part-list"},HC={class:"zcode-part-type-section"},UC={class:"zcode-type-section-title",role:"heading","aria-level":"3"},WC={class:"zcode-type-section-description"},qC={key:0,class:"zcode-module-buttons"},GC={class:"zcode-module-preview-header"},KC={class:"zcode-module-preview-label zcode-module-preview-label-header"},JC=["aria-label"],XC=["innerHTML"],YC={key:1,class:"zcode-empty-parts"},QC={class:"zcode-empty-parts-text"},ZC={class:"zcode-type-section-title",role:"heading","aria-level":"3"},eN={key:0,class:"zcode-type-section-description"},tN={class:"zcode-module-buttons"},nN=["onClick"],oN={class:"zcode-module-preview-header"},rN={class:"zcode-module-preview-label zcode-module-preview-label-header"},iN=["aria-label","onClick"],sN=["innerHTML"],aN={key:0,class:"zcode-empty-parts"},lN={class:"zcode-empty-parts-text"},cN={key:2,class:"zcode-insert-position"},dN={class:"zcode-insert-header"},uN={class:"zcode-keep-adding-label zcode-keep-adding-label-position"},fN=["checked"],pN={class:"zcode-insert-buttons"},hN={class:"zcode-preview-modal-header"},mN={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},gN=["innerHTML"],yN=s.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=s.computed(()=>e.config?.categoryOrder||"common"),o=s.computed(()=>{const d=[];return t.value==="individual"?d.push("individual","common","special"):t.value==="special"?d.push("special","common","individual"):d.push("common","individual","special"),d}),r=s.ref(!1),i=s.ref(null);function a(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?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-add-panel",onClick:u[9]||(u[9]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",OC,[s.createElementVNode("div",DC,s.toDisplayString(d.$t("addPanel.title")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":d.$t("common.close"),onClick:u[0]||(u[0]=f=>d.$emit("cancel"))},[s.createVNode(s.unref(Ye),{size:18})],8,PC)]),n.canSelectParent?(s.openBlock(),s.createElementBlock("div",RC,[s.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:u[1]||(u[1]=f=>d.$emit("select-parent"))},[s.createVNode(s.unref(ei),{size:16}),s.createElementVNode("span",null,s.toDisplayString(d.$t("addPanel.selectParent")),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",LC,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(o.value,f=>(s.openBlock(),s.createElementBlock("button",{key:f,class:s.normalizeClass([{active:n.addPartCategory===f&&n.addTypeTab!=="selected"},"zcode-category-tab"]),onClick:p=>d.$emit("category-tab-click",f)},s.toDisplayString(f==="common"?d.$t("addPanel.category.common"):f==="individual"?d.$t("addPanel.category.individual"):d.$t("dataViewer.special")),11,$C))),128)),s.createElementVNode("button",{class:s.normalizeClass([{active:n.addTypeTab==="selected"},"zcode-category-tab"]),onClick:u[2]||(u[2]=f=>d.$emit("type-tab-click","selected"))},s.toDisplayString(d.$t("addPanel.category.selected")),3)]),n.availablePartTypes.length>0&&n.addTypeTab!=="selected"?(s.openBlock(),s.createElementBlock("div",VC,[s.createElementVNode("button",{class:s.normalizeClass([{active:n.addTypeTab==="all"},"zcode-type-tab"]),onClick:u[3]||(u[3]=f=>d.$emit("type-tab-click","all"))}," all ",2),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(n.availablePartTypes,f=>(s.openBlock(),s.createElementBlock("button",{key:f,class:s.normalizeClass([{active:n.addTypeTab===f},"zcode-type-tab"]),onClick:p=>d.$emit("type-tab-click",f)},s.toDisplayString(f),11,BC))),128))])):s.createCommentVNode("",!0),s.createElementVNode("div",FC,[s.createElementVNode("div",jC,[s.withDirectives(s.createElementVNode("div",HC,[s.createElementVNode("div",UC,s.toDisplayString(d.$t("addPanel.activeParts")),1),s.createElementVNode("div",WC,s.toDisplayString(d.$t("addPanel.activePartsDescription")),1),n.clickedComponent&&n.addSelectedPart&&n.addSelectedType?(s.openBlock(),s.createElementBlock("div",qC,[s.createElementVNode("div",{class:s.normalizeClass([{active:!0},"zcode-module-preview"])},[s.createElementVNode("div",GC,[s.createElementVNode("div",KC,s.toDisplayString(d.$t("addPanel.activeParts")),1),s.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:u[4]||(u[4]=s.withModifiers(f=>l(),["stop"]))},[s.createVNode(s.unref(wc),{size:14})],8,JC)]),s.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:n.getClickedComponentPreviewHtml()},null,8,XC)])])):(s.openBlock(),s.createElementBlock("div",YC,[s.createElementVNode("div",QC,s.toDisplayString(d.$t("addPanel.clickPartInPreview")),1)]))],512),[[s.vShow,n.addTypeTab==="selected"]]),s.withDirectives(s.createElementVNode("div",null,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(n.groupedPartsByType,f=>(s.openBlock(),s.createElementBlock("div",{key:f.type,class:"zcode-part-type-section"},[s.createElementVNode("div",ZC,s.toDisplayString(f.type),1),f.description?(s.openBlock(),s.createElementBlock("div",eN,s.toDisplayString(f.description),1)):s.createCommentVNode("",!0),s.createElementVNode("div",tN,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(f.parts,p=>(s.openBlock(),s.createElementBlock("div",{key:p.title,class:s.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)},[s.createElementVNode("div",oN,[s.createElementVNode("div",rN,s.toDisplayString(p.title),1),s.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:s.withModifiers(h=>a(f.typeData,p),["stop"])},[s.createVNode(s.unref(wc),{size:14})],8,iN)]),s.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:n.getPartPreviewHtml(f.typeData,p)},null,8,sN)],10,nN))),128))])]))),128)),n.groupedPartsByType.length===0&&!n.addSelectedPart?(s.openBlock(),s.createElementBlock("div",aN,[s.createElementVNode("div",lN,s.toDisplayString(d.$t("addPanel.noPartsAvailable")),1)])):s.createCommentVNode("",!0)],512),[[s.vShow,n.addTypeTab!=="selected"]])])]),n.addSelectedPart?(s.openBlock(),s.createElementBlock("div",cN,[s.createElementVNode("div",dN,[u[10]||(u[10]=s.createElementVNode("div",{class:"zcode-insert-position-title",role:"heading","aria-level":"4"}," 追加位置を選択 ",-1)),s.createElementVNode("label",uN,[s.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,fN),s.createElementVNode("span",null,s.toDisplayString(d.$t("addPanel.continueAdding")),1)])]),s.createElementVNode("div",pN,[s.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-before",onClick:u[6]||(u[6]=f=>d.$emit("confirm-add","before"))},s.toDisplayString(d.$t("addPanel.addBefore")),1),s.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-after",onClick:u[7]||(u[7]=f=>d.$emit("confirm-add","after"))},s.toDisplayString(d.$t("addPanel.addAfter")),1)])])):s.createCommentVNode("",!0),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[r.value&&i.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:c},[s.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:u[8]||(u[8]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",hN,[s.createElementVNode("div",mN,s.toDisplayString(d.$t("common.preview"))+": "+s.toDisplayString(i.value.isActiveParts?d.$t("addPanel.activeParts"):i.value.part.title),1),s.createElementVNode("button",{class:"zcode-close-btn",onClick:c},[s.createVNode(s.unref(Ye),{size:18})])]),s.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:i.value.isActiveParts?n.getClickedComponentPreviewHtml():n.getPartPreviewHtml(i.value.type,i.value.part)},null,8,gN)])])):s.createCommentVNode("",!0)]))])):s.createCommentVNode("",!0)}}),bN=s.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,a)=>n.isVisible?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-context-menu",style:s.normalizeStyle({left:`${n.position.x}px`,top:`${n.position.y}px`}),onClick:a[4]||(a[4]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("button",{class:s.normalizeClass(["zcode-context-menu-item",{active:n.currentMode==="edit"}]),onClick:a[0]||(a[0]=l=>o("edit"))},[s.createVNode(s.unref(bc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("contextMenu.edit")),1)],2),s.createElementVNode("button",{class:s.normalizeClass(["zcode-context-menu-item",{active:n.currentMode==="add"}]),onClick:a[1]||(a[1]=l=>o("add"))},[s.createVNode(s.unref(ao),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("contextMenu.add")),1)],2),s.createElementVNode("button",{class:s.normalizeClass(["zcode-context-menu-item",{active:n.currentMode==="reorder"}]),onClick:a[2]||(a[2]=l=>o("reorder"))},[s.createVNode(s.unref(Zo),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("contextMenu.reorder")),1)],2),s.createElementVNode("button",{class:s.normalizeClass(["zcode-context-menu-item",{active:n.currentMode==="delete"}]),onClick:a[3]||(a[3]=l=>o("delete"))},[s.createVNode(s.unref(Pn),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("contextMenu.delete")),1)],2),a[5]||(a[5]=s.createElementVNode("div",{class:"zcode-context-menu-divider"},null,-1)),s.createElementVNode("button",{class:"zcode-context-menu-item",onClick:r},[s.createVNode(s.unref(Ye),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("contextMenu.close")),1)])],4)):s.createCommentVNode("",!0)}});function xN(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 kN(n,e){const t=ba(n.part_id,e);if(!t)return;Fn(t.body).forEach(r=>{r.optional||n[r.fieldName]===void 0&&(n[r.fieldName]=xN(r))})}function EN(n){function e(t){kN(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 jh(n){const e=s.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):[],a=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,g=n.backendData?JSON.parse(n.backendData):void 0;Object.assign(e,{page:i,css:{common:p,individual:h,special:m},parts:{common:a,individual:l,special:c},images:{common:d,individual:u,special:f},backendData:g}),EN(e)}catch(i){console.error("Failed to parse props:",i)}}function o(i){if(!i)return e;const a=i.split(".");let l=e;for(const c of a)if(l==null||typeof l!="object"||(l=l[c],l===void 0))return;return l}function r(i,a){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]]=a}else Object.assign(e,i)}return{cmsData:e,loadDataFromProps:t,getData:o,setData:r}}function wN(){const n=s.ref("edit"),e=s.ref(!1);function t(o){n.value=o}return{currentMode:n,switchMode:t,allowDynamicContentInteraction:e}}function Hh(n,e){return Fn(n.body).map(o=>{const r={fieldName:o.fieldName,groupName:o.groupName,label:Qy(o.fieldName),required:o.required,maxLength:o.maxLength,readonly:o.readonly,disabled:o.disabled},i=e[o.fieldName];if(o.type==="text")return{...r,type:"text",defaultValue:o.defaultValue,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.defaultValue};if(o.type==="textarea")return{...r,type:"textarea",defaultValue:o.defaultValue,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.defaultValue||""};if(o.type==="rich")return{...r,type:"rich",defaultValue:o.defaultValue,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.defaultValue||""};if(o.type==="radio")return{...r,type:"radio",options:o.options,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.options?.[0]};if(o.type==="boolean")return{...r,type:"boolean",defaultValue:o.defaultValue,optional:o.optional,currentValue:i!==void 0?i:!0};if(o.type==="image")return{...r,type:"image",defaultValue:o.defaultValue,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.defaultValue||""};if(o.type==="select")return{...r,type:"select",options:o.options,optional:o.optional,currentValue:i!==void 0?i:o.optional?void 0:o.options?.[0]};if(o.type==="select-multiple")return{...r,type:"select-multiple",options:o.options,optional:o.optional,currentValue:Array.isArray(i)?i:[]};if(o.type==="tag"){const a=["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"],l=o.options||a;return{...r,type:"tag",options:l,defaultValue:o.defaultValue||"div",currentValue:i!==void 0?i:o.defaultValue||"div"}}return{...r,type:"checkbox",options:o.options,optional:o.optional,currentValue:Array.isArray(i)?i:[]}})}function Uh(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 Kt(n,e){const t=Uh(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 Jt(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 oc(n,e){const t=Uh(e);n.style.outline=`2px dashed ${t}`,n.style.outlineOffset="2px"}function mn(n){n.style.outline="",n.style.outlineOffset=""}function SN(n,e){const t=s.ref(null),o=s.ref(-1),r=s.ref(""),i=s.ref([]);function a(u){const f=u.part_id,p=n.parts,h=[...p.common,...p.individual];let m=null;for(const g of h){const y=g.parts.find(x=>x.id===f);if(y){m=y;break}}return m?Hh(m,u):[]}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&&Jt(m)}t.value=f,o.value=h,r.value=u,i.value=a(f),s.nextTick(()=>{if(e.value&&r.value===u){const m=e.value.querySelector(`[data-zcode-path="${u}"]`);m&&(Kt(m,"edit"),rr(m))}})}function c(u){if(t.value&&r.value){const f=dn(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&&Jt(u)}t.value=null,r.value="",i.value=[]}return{editingComponent:t,editingComponentIndex:o,editingComponentPath:r,editingAvailableFields:i,handleEditClick:l,saveFieldEdit:c,closeEditPanel:d}}function CN(n,e,t,o){const r=s.ref(null),i=s.ref(null),a=s.ref(null),l=s.ref(o?.categoryOrder==="individual"?"individual":o?.categoryOrder==="special"?"special":"common"),c=s.ref("all"),d=s.ref(null),u=s.ref(!1);function f(O){if(O.includes(".slots.")){const D=O.split(".");let P=-1;for(let q=D.length-1;q>=0;q--)if(D[q]==="slots"){P=q;break}if(P!==-1&&P+1<D.length)return D.slice(0,P+2).join(".")}return O}const p=s.computed(()=>{const O=n.parts,D=l.value==="common"?O.common:l.value==="individual"?O.individual:O.special;if(r.value&&r.value.includes(".slots.")){const q=[...O.common,...O.individual,...O.special],W=f(r.value);return g(W,q,D)}return[...new Set(D.map(q=>q.type))]});function h(O,D){const P=O.split(".");let q=-1;for(let Z=P.length-1;Z>=0;Z--)if(P[Z]==="slots"){q=Z;break}if(q===-1)return null;const W=P.slice(0,q).join("."),V=P[q+1],G=dn(W,n);if(!G)return null;const J=G.part_id;let oe=null;for(const Z of D)if(Z.parts.some(Y=>Y.id===J)){oe=Z;break}if(!oe)return null;const X=(oe.parts.find(Z=>Z.id===J)||oe.parts[0])?.slots?.[V];if(X){const Z=X.allowedParts;if(Z&&Array.isArray(Z))return Z}return null}const m=s.computed(()=>{const O=n.parts,D=l.value==="common"?O.common:l.value==="individual"?O.individual:O.special,P=p.value;let q=D.filter(J=>P.includes(J.type));c.value&&c.value!=="all"&&c.value!=="selected"&&(q=q.filter(J=>J.type===c.value));const W=[...O.common,...O.individual],V=r.value&&r.value.includes(".slots.")?h(f(r.value),W):null,G=new Map;return q.forEach(J=>{G.has(J.type)||G.set(J.type,{type:J,parts:[]});const oe=G.get(J.type);V!==null?V.length>0&&J.parts.forEach(ne=>{V.includes(ne.id)&&oe.parts.push(ne)}):J.parts.forEach(ne=>{ne.slotOnly||oe.parts.push(ne)})}),Array.from(G.values()).map(J=>({type:J.type.type,description:J.type.description,typeData:J.type,parts:J.parts}))});function g(O,D,P){const q=O.split(".");let W=-1;for(let Y=q.length-1;Y>=0;Y--)if(q[Y]==="slots"){W=Y;break}if(W===-1)return[...new Set(P.map(Y=>Y.type))];const V=q.slice(0,W).join("."),G=q[W+1],J=dn(V,n);if(!J)return[...new Set(P.map(Y=>Y.type))];const oe=J.part_id;let ne=null,X=null;for(const Y of D){const te=Y.parts.find(de=>de.id===oe);if(te){ne=Y,X=te;break}}if(!ne||!X)return[...new Set(P.map(Y=>Y.type))];const Z=X?.slots?.[G];if(Z){const Y=Z.allowedParts;if(Y&&Array.isArray(Y)){const te=new Set;D.forEach(me=>{me.parts.forEach(Me=>{Y.includes(Me.id)&&te.add(me.type)})});let de=Array.from(te);return de=de.filter(me=>P.some(Me=>Me.type===me)),de}}return[...new Set(P.map(Y=>Y.type))]}function y(O,D=!1){if(r.value===O){R();return}if(r.value&&e.value){const de=e.value.querySelector(`[data-zcode-path="${r.value}"]`);de&&Jt(de);const me=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);me&&Jt(me)}r.value=O,c.value="all",l.value="common",i.value=null,a.value=null;const P=dn(O,n);P&&P.part_id?d.value=P:d.value=null;const q=n.parts,W=q.common,V=q.individual,G=q.special;let J=[],oe=[];if(O.includes(".slots.")){const de=[...W,...V,...G],me=f(O);J=g(me,de,W),oe=g(me,de,V)}else J=[...new Set(W.map(de=>de.type))],oe=[...new Set(V.map(de=>de.type))];const ne=J.length>0,X=oe.length>0,Z=G.length>0,Y=o?.categoryOrder;let te;Y==="special"&&Z?te="special":Y==="individual"&&X?te="individual":Y==="common"&&ne||ne?te="common":X?te="individual":Z?te="special":te="common",l.value=te,s.nextTick(()=>{if(e.value&&r.value===O){const de=e.value.querySelector(`[data-zcode-path="${O}"]`);if(de)Kt(de,"add"),rr(de);else{const me=f(O);if(me!==O){const Me=e.value.querySelector(`[data-zcode-slot-path="${me}"]`);Me&&(Kt(Me,"add"),rr(Me))}}}})}function x(O){l.value=O,c.value="all",i.value=null,a.value=null,u.value=!1}function N(O){if(c.value=O,O==="selected"&&d.value&&d.value.part_id){const D=n.parts,P=[...D.common,...D.individual,...D.special];for(const q of P){const W=q.parts.find(V=>V.id===d.value.part_id);if(W){i.value=q,a.value=W;break}}}else O!=="selected"&&(i.value=null,a.value=null);u.value=!1}function E(O,D){const P=A(O,D);return t(P,"")}function v(){return d.value?t(d.value,""):""}function A(O,D){const P=k(O,!1,new Set,D.id);return P.id="preview",P}function M(O,D){if(a.value?.id===D.id){i.value=null,a.value=null;return}i.value=O,a.value=D,c.value==="selected"&&(c.value="all"),u.value=!1}function k(O,D=!1,P=new Set,q){const W=q?O.parts.find(X=>X.id===q)||O.parts[0]:D&&a.value?a.value:O.parts[0];if(!W)throw new Error(`Part not found for type: ${O.type}`);const V=`${O.id}:${W.id}`;if(P.has(V)){const X=Fn(W.body),Z={};return X.forEach(Y=>{Y.optional?Z[Y.fieldName]=void 0:Y.type==="text"?Z[Y.fieldName]=Y.defaultValue:Y.type==="radio"?Z[Y.fieldName]=Y.options?.[0]:Y.type==="checkbox"?Z[Y.fieldName]=[]:Y.type==="boolean"?Z[Y.fieldName]=!0:Y.type==="rich"?Z[Y.fieldName]=Y.defaultValue?`<p>${Y.defaultValue}</p>`:"<p></p>":Y.type==="image"&&(Z[Y.fieldName]=Y.defaultValue||"")}),{id:jn(),part_id:W.id,...Z}}P.add(V);const G=Fn(W.body),J={};G.forEach(X=>{X.optional?J[X.fieldName]=void 0:X.type==="text"?J[X.fieldName]=X.defaultValue:X.type==="radio"?J[X.fieldName]=X.options?.[0]:X.type==="checkbox"?J[X.fieldName]=[]:X.type==="boolean"?J[X.fieldName]=!0:X.type==="rich"?J[X.fieldName]=X.defaultValue?`<p>${X.defaultValue}</p>`:"<p></p>":X.type==="image"&&(J[X.fieldName]=X.defaultValue||"")});const oe={id:jn(),part_id:W.id,...J},ne=W.slots;if(ne){const X={};Object.entries(ne).forEach(([Z,Y])=>{const te=Y.allowedParts;if(te&&te.length===1){const de=te[0],me=n.parts,Me=[...me.common,...me.individual,...me.special];let Le=null,C=null;for(const L of Me){const $=L.parts.find(S=>S.id===de);if($){Le=L,C=$;break}}if(Le&&C){const L=k(Le,!1,P,C.id);X[Z]=[L]}else X[Z]=[]}else X[Z]=[]}),Object.keys(X).length>0&&(oe.slots=X)}return oe}function w(O){return k(O,!0)}function b(O){if(!i.value||!a.value||!r.value){console.error("Missing required values:",{addSelectedType:i.value,addSelectedPart:a.value,addTargetPath:r.value});return}let D;if(c.value==="selected"&&d.value){if(D=JSON.parse(JSON.stringify(d.value)),D.id=jn(),D.slots){const W=V=>{V.forEach(G=>{G.id=jn(),G.slots&&Object.values(G.slots).forEach(J=>{Array.isArray(J)?W(J):J&&typeof J=="object"&&J.children&&W(J.children||[])})})};Object.values(D.slots).forEach(V=>{Array.isArray(V)?W(V):V&&typeof V=="object"&&V.children&&W(V.children||[])})}}else D=w(i.value);const P=r.value,q=P.split(".");if(q[0]==="page"&&q.length===2){const W=parseInt(q[1]);O==="before"?(n.page.splice(W,0,D),u.value&&(r.value=`page.${W+1}`)):n.page.splice(W+1,0,D)}else if(q.includes("slots")){const W=f(P),V=W.split(".");let G=-1;for(let te=V.length-1;te>=0;te--)if(V[te]==="slots"){G=te;break}if(G===-1||G>=V.length-1){console.error("Invalid slot path:",W);return}const J=V.slice(0,G).join("."),oe=V[G+1],ne=P!==W?parseInt(q[q.length-1]):-1,X=dn(J,n);if(!X){console.error("Parent component not found:",J);return}X.slots||(X.slots={});const Z=X.slots[oe];let Y=[];if(Array.isArray(Z)?Y=Z:Z&&typeof Z=="object"&&Z.children?(Y=Z.children||[],Z.children||(Z.children=[])):(X.slots[oe]=[],Y=X.slots[oe]),ne===-1)Y.push(D);else if(O==="before"){if(Y.splice(ne,0,D),u.value){const te=f(P);if(P!==te){const de=[...q];de[de.length-1]=String(ne+1),r.value=de.join(".")}else{const me=[...te.split(".")];me.push("0"),r.value=me.join(".")}}}else Y.splice(ne+1,0,D);Array.isArray(X.slots[oe])||(X.slots[oe].children=Y)}if(d.value||c.value==="selected"&&(c.value="all"),!u.value)R();else if(O==="before"&&e.value&&r.value){const W=e.value.querySelector(`[data-zcode-path="${P}"]`);W&&Jt(W),s.nextTick(()=>{if(e.value&&r.value){const V=e.value.querySelector(`[data-zcode-path="${r.value}"]`);V&&Kt(V,"add")}})}}function R(){if(r.value&&e.value){const O=e.value.querySelector(`[data-zcode-path="${r.value}"]`);O&&Jt(O);const D=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);D&&Jt(D)}r.value=null,i.value=null,a.value=null,d.value=null,l.value="common",c.value="all",u.value=!1}const B=s.computed(()=>n.parts.special.length>0);return{addTargetPath:r,addSelectedType:i,addSelectedPart:a,clickedComponent:d,addPartCategory:l,addTypeTab:c,keepAdding:u,availablePartTypes:p,groupedPartsByType:m,hasSpecialParts:B,handleAddClick:y,handleCategoryTabClick:x,handleTypeTabClick:N,selectPart:M,getPartPreviewHtml:E,getClickedComponentPreviewHtml:v,confirmAddPart:b,cancelAdd:R}}function NN(n,e,t,o){const r=s.ref(null),i=s.ref("");function a(f,p){if(i.value===f){u();return}if(i.value&&e.value){const h=e.value.querySelector(`[data-zcode-path="${i.value}"]`);h&&Jt(h)}r.value=p,i.value=f,o(()=>{if(e.value&&i.value===f){const h=e.value.querySelector(`[data-zcode-path="${f}"]`);h&&(Kt(h,"delete"),rr(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 g=parseInt(p[1]);!isNaN(g)&&g>=0&&g<n.page.length&&(n.page.splice(g,1),n.page.length===0&&o(()=>{t("add")}))}else if(p.length>2&&p[0]==="page"){const g=parseInt(p[1]);if(isNaN(g)||g<0||g>=n.page.length){console.error("Invalid top-level index:",g),u();return}let y=n.page[g];const x=p.slice(2);x.length>=3&&x[0]==="slots"&&(m=x[1],h=`page.${g}`);for(let E=0;E<x.length-1;E++){if(!y||typeof y!="object"){console.error("Invalid path:",f),u();return}y=y[x[E]]}const N=x[x.length-1];if(y&&typeof y=="object")if(Array.isArray(y)){const E=parseInt(N);!isNaN(E)&&E>=0&&E<y.length?y.splice(E,1):console.error("Invalid array index:",N)}else N in y?delete y[N]: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,n);if(!h)return;const m=h.slots;if(!m||!Array.isArray(m[p]))return;const g=m[p];if(g.length===0){const y=h.part_id,x=n.parts,N=[...x.common,...x.individual];let E=null,v=null;for(const M of N){const k=M.parts.find(w=>w.id===y);if(k){E=M,v=k;break}}if(!E||!v)return;const A=v?.slots?.[p];if(A){const M=A.allowedParts;if(M&&M.length===1){const k=M[0];let w=null,b=null;for(const R of N){const B=R.parts.find(O=>O.id===k);if(B){w=R,b=B;break}}if(w&&b){const R=d(w,b.id);g.push(R)}}}}}function d(f,p){const h=p&&f.parts.find(N=>N.id===p)||f.parts[0];if(!h)throw new Error(`Part not found for type: ${f.type}`);const m=Fn(h.body),g={};m.forEach(N=>{N.optional?g[N.fieldName]=void 0:N.type==="text"?g[N.fieldName]=N.defaultValue:N.type==="radio"?g[N.fieldName]=N.options?.[0]:N.type==="checkbox"?g[N.fieldName]=[]:N.type==="boolean"?g[N.fieldName]=!0:N.type==="rich"?g[N.fieldName]=N.defaultValue?`<p>${N.defaultValue}</p>`:"<p></p>":N.type==="image"&&(g[N.fieldName]=N.defaultValue||"")});const y={id:jn(),part_id:h.id,...g},x=h.slots;if(x){const N={};Object.entries(x).forEach(([E,v])=>{const A=v.allowedParts;if(A&&A.length===1){const M=A[0],k=n.parts,w=[...k.common,...k.individual];let b=null,R=null;for(const B of w){const O=B.parts.find(D=>D.id===M);if(O){b=B,R=O;break}}if(b&&R){const B=d(b,R.id);N[E]=[B]}else N[E]=[]}else N[E]=[]}),Object.keys(N).length>0&&(y.slots=N)}return y}function u(){if(i.value&&e.value){const f=e.value.querySelector(`[data-zcode-path="${i.value}"]`);f&&Jt(f)}r.value=null,i.value=""}return{deleteConfirmComponent:r,deleteConfirmPath:i,handleDeleteClick:a,confirmDelete:l,cancelDelete:u}}function vN(n,e){const t=s.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 g=d[f+1],y=u[p+1];return g===y}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=Gd(l);if(d&&e.value){const u=e.value.querySelector(`[data-zcode-path="${d}"]`);u&&mn(u)}if(t.value=l,e.value){const u=e.value.querySelector(`[data-zcode-path="${l}"]`);u&&(Kt(u,"reorder"),rr(u))}return}if(t.value===l){i();return}if(!o(t.value,l)){alert("この要素とは並べ替えできません。同じ階層の要素を選択してください。"),i();return}a(t.value,l)||alert("並べ替えに失敗しました。同じ階層の要素を選択してください。"),i()}function i(){if(t.value&&e.value){const l=e.value.querySelector(`[data-zcode-path="${t.value}"]`);l&&Jt(l)}t.value=""}function a(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 k=d.length-1;k>=0;k--)if(d[k]==="slots"){f=k;break}for(let k=u.length-1;k>=0;k--)if(u[k]==="slots"){p=k;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 g=d[f+1],y=u[p+1];if(g!==y)return!1;const x=parseInt(d[d.length-1]),N=parseInt(u[u.length-1]);if(isNaN(x)||isNaN(N)||x===N)return!1;const E=dn(h,n);if(!E||!E.slots||!E.slots[g])return!1;const v=E.slots[g];let A=[];if(Array.isArray(v))A=v;else if(v&&typeof v=="object"&&v.children)A=v.children||[];else return!1;const[M]=A.splice(x,1);return A.splice(N,0,M),!Array.isArray(v)&&typeof v=="object"&&v.children&&(v.children=A),!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 g=parseInt(d[1]);let y=n.page[g];for(let x=2;x<d.length-1;x++)y=y[d[x]];if(Array.isArray(y)){const[x]=y.splice(h,1);return y.splice(m,0,x),!0}}}}return!1}return{reorderSourcePath:t,handleReorderClick:r,canReorderWith:o,cancelReorder:i}}function TN(n,e,t,o,r,i,a,l,c){const d=s.computed(()=>o.value?Gd(o.value):null),u=s.computed(()=>{if(!d.value)return!1;const p=dn(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=dn(p,n);if(m){if(o.value&&e.value){const g=e.value.querySelector(`[data-zcode-path="${o.value}"]`);g&&mn(g)}switch(t.value){case"edit":r(p,m);break;case"add":i(p,!0);break;case"reorder":if(c.value){const g=e.value.querySelector(`[data-zcode-path="${c.value}"]`);g&&Jt(g),c.value=""}a(p);break;case"delete":l(p,m);break}}}return{parentPath:d,canSelectParent:u,selectParentElement:f}}function zN(n,e,t,o,r,i,a,l,c,d,u,f,p,h){const m=new Map;function g(){if(!e.value)return;y();const x=e.value.querySelectorAll("[data-zcode-id]"),N=k=>{const w=k.target;if(!w)return;const b=w.closest("[data-zcode-add-slot]");if(!b)return;const R=b.closest("[data-zcode-slot-path]"),B=R?.getAttribute("data-zcode-slot-path");if(!B)return;k.preventDefault(),k.stopPropagation(),k.stopImmediatePropagation();const O=()=>{const D=e.value?.querySelector(`[data-zcode-slot-path="${B}"]`);D&&(mn(D),Kt(D,"add"))};if(R&&mn(R),t.value!=="add"){p("add"),s.nextTick(()=>{c(B),s.nextTick(()=>{O()})});return}O(),s.nextTick(()=>{c(B),s.nextTick(()=>{O()})})};let E=null;const v=k=>o.value===k||r.value===k||i.value===k||a.value===k,A=k=>{const b=k.target;if(!b)return;const R=b.closest("[data-zcode-slot-path]");if(!R){if(E){const O=E.getAttribute("data-zcode-slot-path")||"";(!O||!v(O))&&mn(E),E=null}return}if(E===R)return;if(E){const O=E.getAttribute("data-zcode-slot-path")||"";(!O||!v(O))&&mn(E)}E=R;const B=R.getAttribute("data-zcode-slot-path")||"";B&&!v(B)&&oc(R,t.value)},M=k=>{const w=k,b=w.target;if(!b)return;const R=w.relatedTarget,B=b.closest("[data-zcode-slot-path]");if(!B||R&&B.contains(R))return;const O=B.getAttribute("data-zcode-slot-path")||"";(!O||!v(O))&&mn(B),E===B&&(E=null)};e.value.addEventListener("click",N,!0),e.value.addEventListener("mouseover",A,!0),e.value.addEventListener("mouseout",M,!0),m.set(e.value,[{type:"click",listener:N,options:!0},{type:"mouseover",listener:A,options:!0},{type:"mouseout",listener:M,options:!0}]),x.forEach(k=>{const w=k,b=w.getAttribute("data-zcode-path");if(!b)return;const R=P=>{const q=P.target,V=q?.closest("[data-zcode-path]")?.getAttribute("data-zcode-path");if(V&&V!==b)return;q?.closest("a[href]")&&(h.value||P.preventDefault()),h.value||(P.stopPropagation(),P.stopImmediatePropagation());const J=dn(b,n);if(J)switch(mn(w),t.value){case"edit":l(b,J);break;case"add":c(b);break;case"reorder":if(i.value){const oe=i.value.split("."),ne=b.split(".");if(oe.length!==ne.length&&oe.indexOf("rows")!==-1){const Z=ne.indexOf("cells");if(Z!==-1){let Y=-1;for(let te=Z-1;te>=0;te--)if(ne[te]==="slots"){Y=te;break}if(Y!==-1){const te=ne.slice(0,Y).join(".");if(te&&f(i.value,te)){d(te);return}}}}}d(b);break;case"delete":u(b,J);break}},B=P=>{if(o.value===P||r.value===P||i.value===P||a.value===P)return!0;if(P.includes(".slots.")){const W=P.split(".");let V=-1;for(let G=W.length-1;G>=0;G--)if(W[G]==="slots"){V=G;break}if(V!==-1&&V+1<W.length){const G=W.slice(0,V+2).join(".");return r.value===G||o.value===G||i.value===G||a.value===G}}return!1},O=()=>{B(b)||(t.value==="reorder"&&i.value?f(i.value,b)&&oc(w,t.value):oc(w,t.value)),t.value==="reorder"?w.style.cursor=i.value&&f(i.value,b)?"move":i.value?"not-allowed":"move":w.style.cursor="pointer"},D=()=>{B(b)||mn(w),w.style.cursor=""};w.addEventListener("click",R,!0),w.addEventListener("mouseenter",O),w.addEventListener("mouseleave",D),m.set(w,[{type:"click",listener:R,options:!0},{type:"mouseenter",listener:O},{type:"mouseleave",listener:D}])}),s.nextTick(()=>{s.nextTick(()=>{if(t.value==="edit"&&o.value&&e.value){const k=e.value.querySelector(`[data-zcode-path="${o.value}"]`);k&&Kt(k,"edit")}if(t.value==="add"&&r.value&&e.value){const k=e.value.querySelector(`[data-zcode-path="${r.value}"]`);if(k)Kt(k,"add");else{const w=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);w&&Kt(w,"add")}}if(t.value==="reorder"&&i.value&&e.value){const k=e.value.querySelector(`[data-zcode-path="${i.value}"]`);k&&Kt(k,"reorder")}if(t.value==="delete"&&a.value&&e.value){const k=e.value.querySelector(`[data-zcode-path="${a.value}"]`);k&&Kt(k,"delete")}})})}function y(){m.forEach((x,N)=>{x.forEach(({type:E,listener:v,options:A})=>{N.removeEventListener(E,v,A)})}),m.clear()}return{setupClickHandlers:g,cleanupEventListeners:y}}function MN(n,e,t,o,r,i,a,l,c,d,u,f,p){function h(m){n.value&&n.value.querySelectorAll("[data-zcode-path], [data-zcode-slot-path]").forEach(y=>{Jt(y),mn(y)}),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"&&a.value&&p(),t(m)}return{switchMode:h}}function AN(n,e,t){const o=s.ref(!1),r=s.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 a(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:a,closeMenu:l,setupContextMenu:u,cleanupContextMenu:f}}function IN(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 rc(n,e){const t=[],o=(r,i)=>{Object.keys(r).forEach(a=>{a.includes("image")&&r[a]===n&&t.push({path:i,component:r,fieldName:a})}),r.slots&&Object.entries(r.slots).forEach(([a,l])=>{Array.isArray(l)&&l.forEach((c,d)=>{o(c,`${i}.slots.${a}.${d}`)})})};return e.forEach((r,i)=>{o(r,`page.${i}`)}),t}const _N={key:0,class:"zcode-save-banner zcode-save-banner--error",role:"alert"},ON={class:"zcode-save-banner-text"},DN=["aria-label"],PN={key:1,class:"zcode-save-controls-fixed"},RN={class:"zcode-save-confirm-dialog"},LN={class:"zcode-save-confirm-dialog-header"},$N={class:"zcode-save-confirm-dialog-title"},VN={class:"zcode-save-confirm-dialog-body"},BN={class:"zcode-save-confirm-dialog-footer"},Ps=s.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}=Vt(),o=n,r=s.ref("manage"),i=s.ref(!1),l=(se=>{if(!se)return{};try{return JSON.parse(se)}catch(ue){return console.warn("[ZeroCodeCMS] Failed to parse config:",ue),{}}})(o.config),c=s.computed(()=>{const se={common:{add:!1,delete:!1},individual:{add:!1,delete:!1},special:{add:!1,delete:!1}},ue=l.cms?.imageModalActions;return ue?{common:{...se.common,...ue.common},individual:{...se.individual,...ue.individual},special:{...se.special,...ue.special}}:se}),d=s.computed(()=>{const se=["page"],ue=c.value;return(ue.common?.add||ue.common?.delete)&&se.push("images-common"),(ue.individual?.add||ue.individual?.delete)&&se.push("images-individual"),(ue.special?.add||ue.special?.delete)&&se.push("images-special"),se}),u=(se,ue,we)=>{const We=Xd();return We[se]!==void 0?We[se]:we!==void 0?we:ue},f=s.ref(u("devRightPadding",!1,l.cms?.devRightPadding)),p=s.ref(u("enableContextMenu",!1,l.cms?.enableContextMenu)),h=s.ref(u("showSaveConfirm",!0,l.cms?.showSaveConfirm)),m=s.computed(()=>f.value),g=s.ref(!1),{cmsData:y,loadDataFromProps:x,getData:N,setData:E}=jh(o),{fullPageHtml:v,renderComponentToHtml:A}=gi(y,!0);function M(se){if(se!=="css")return se?N(se):N()}const k=s.ref(null),w=s.ref(null),b=s.computed(()=>w.value?.previewArea||null),{currentMode:R,switchMode:B,allowDynamicContentInteraction:O}=wN(),D=u("allowDynamicContentInteraction",!1,l.cms?.allowDynamicContentInteraction),P=s.ref(D);O.value=D;let q=!1;s.watch(r,(se,ue)=>{se==="preview"?(q=P.value,P.value=!0,O.value=!0,s.nextTick(()=>{fe()})):ue==="preview"&&(P.value=q,O.value=q,s.nextTick(()=>{fe()})),Dt("view-mode-changed",{mode:se,previousMode:ue})});const{editingComponent:W,editingComponentPath:V,editingAvailableFields:G,handleEditClick:J,saveFieldEdit:oe,closeEditPanel:ne}=SN(y,b),X=s.ref({}),Z=s.ref([]),Y=s.ref({visible:!1,message:""});function te(se){if(se?.fieldName&&X.value[se.fieldName]){const ue={...X.value};delete ue[se.fieldName],X.value=ue}oe(se)}const{addTargetPath:de,addSelectedType:me,addSelectedPart:Me,clickedComponent:Le,addPartCategory:C,addTypeTab:L,keepAdding:$,availablePartTypes:S,groupedPartsByType:K,hasSpecialParts:z,handleAddClick:U,handleCategoryTabClick:ie,handleTypeTabClick:Se,selectPart:ve,getPartPreviewHtml:T,getClickedComponentPreviewHtml:I,confirmAddPart:Q,cancelAdd:ge}=CN(y,b,A,l),{reorderSourcePath:Te,handleReorderClick:ye,canReorderWith:H,cancelReorder:ee}=vN(y,b),{deleteConfirmComponent:ze,deleteConfirmPath:Pe,handleDeleteClick:dt,confirmDelete:Xt,cancelDelete:Ot}=NN(y,b,B,s.nextTick),{switchMode:$t}=MN(b,R,B,V,de,Te,Pe,W,me,Me,C,L,Ot),_n=s.computed(()=>R.value==="edit"&&V.value?V.value:R.value==="add"&&de.value?de.value:R.value==="reorder"&&Te.value?Te.value:R.value==="delete"&&Pe.value?Pe.value:null),{canSelectParent:F,selectParentElement:j}=TN(y,b,R,_n,J,U,ye,dt,Te),le=s.computed(()=>!!(W.value||de.value||Te.value||ze.value)),fe=()=>{if(b.value){const se=b.value.getRootNode();if(se instanceof ShadowRoot){let We=0;const bt=()=>{We++;const tt=se;if(typeof tt.__zcmsSetAllowDynamicContentInteraction=="function"){tt.__zcmsSetAllowDynamicContentInteraction(P.value);return}We<30&&setTimeout(bt,50)};bt()}}},{setupClickHandlers:_e,cleanupEventListeners:Qe}=zN(y,b,R,V,de,Te,Pe,J,U,ye,dt,H,$t,P),{isVisible:gn,position:Kr,handleModeSelect:vo,closeMenu:lc,setupContextMenu:Jr,cleanupContextMenu:Ke}=AN(b,p,$t);function Dt(se,ue){const we=Ko();if(we){const bt=new CustomEvent(se,{detail:ue,bubbles:!0,composed:!0});we.dispatchEvent(bt);return}const We=new CustomEvent(se,{detail:ue,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(We)}function cc(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Ko(){if(k.value){const ue=k.value.getRootNode();if(ue instanceof ShadowRoot&&ue.host)return ue.host;const we=k.value.closest?.("zcode-cms")||k.value.closest?.("zcode-editor");if(we)return we}const se=s.getCurrentInstance();if(se){const ue=se.vnode.el;if(ue instanceof HTMLElement){const we=ue.getRootNode();if(we instanceof ShadowRoot&&we.host)return we.host;const We=ue.closest?.("zcode-cms")||ue.closest?.("zcode-editor");return We||null}if(ue instanceof Node){const we=ue.getRootNode();if(we instanceof ShadowRoot&&we.host)return we.host}}return null}function Jo(se){return typeof se=="object"&&se!==null}function Fs(se){return Array.isArray(se)?se.filter(ue=>Jo(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 Xr(se){if(!se){X.value={};return}const ue={};for(const we of Z.value){const We=typeof we?.path=="string"?we.path:null,bt=typeof we?.field=="string"?we.field:null,tt=typeof we?.message=="string"?we.message:null;!bt||!tt||We&&We!==se||(ue[bt]=tt)}X.value=ue}const dc=(se,ue)=>{ue==="common"?y.images.common.push(se):ue==="individual"?y.images.individual.push(se):y.images.special.push(se)},Yt=se=>{rc(se,y.page).forEach(tt=>{Object.keys(tt.component).forEach(ke=>{ke.includes("image")&&tt.component[ke]===se&&(tt.component[ke]="")})});const we=y.images.common.findIndex(tt=>tt.id===se);we!==-1&&y.images.common.splice(we,1);const We=y.images.individual.findIndex(tt=>tt.id===se);We!==-1&&y.images.individual.splice(We,1);const bt=y.images.special.findIndex(tt=>tt.id===se);bt!==-1&&y.images.special.splice(bt,1)};function yn(se){const ue=se.detail;if(!Jo(ue))return;const we=ue;if(we.ok===!0){Y.value.visible=!1,Y.value.message="",Z.value=[],X.value={};return}if(we.ok!==!1)return;const We=Fs(we.errors);Z.value=We;const bt=We.length,tt=typeof We[0]?.message=="string"&&We[0].message?We[0].message:null;Y.value.visible=!0,Y.value.requestId=typeof we.requestId=="string"?we.requestId:void 0,Y.value.target=typeof we.target=="string"?we.target:void 0,Y.value.message=tt?t("editor.saveFailedWithMessage",{count:bt,message:tt}):t("editor.saveFailedWithCount",{count:bt}),Xr(V.value||null)}s.onMounted(()=>{x(),s.nextTick(()=>{_e(),p.value&&Jr(),fe(),Dt("zcode-dom-updated",{})});const se=Ko();se&&se.addEventListener("save-result",yn)}),s.onUnmounted(()=>{Qe(),Ke();const se=Ko();se&&se.removeEventListener("save-result",yn)}),s.watch(()=>V.value,se=>{Xr(se||null)}),s.watch([()=>o.page,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial],()=>{x()}),s.watch(y,()=>{s.nextTick(()=>{_e(),Dt("zcode-dom-updated",{})})},{deep:!0}),s.watch([r,b],([se,ue])=>{se==="manage"&&ue?s.nextTick(()=>{_e(),p.value&&Jr(),fe(),Dt("zcode-dom-updated",{})}):Ke()}),s.watch(R,()=>{s.nextTick(()=>{Dt("zcode-dom-updated",{})})}),s.watch(f,se=>{yi({devRightPadding:se})}),s.watch(P,se=>{r.value==="manage"&&yi({allowDynamicContentInteraction:se}),O.value=se,s.nextTick(()=>{_e(),fe(),Dt("zcode-dom-updated",{})})}),s.watch(p,se=>{yi({enableContextMenu:se}),se?s.nextTick(()=>{Jr()}):Ke()}),s.watch(h,se=>{yi({showSaveConfirm:se})});function js(){if(!h.value){Yr();return}g.value=!0}function Yr(){const se=cc();Dt("save-request",{requestId:se,source:"cms",targets:d.value,timestamp:Date.now()})}function Qr(){g.value=!1,Yr()}function Zr(){g.value=!1}return e({getData:M,setData:E,validateData:IN,cmsData:y,currentMode:R,switchMode:$t,allowDynamicContentInteraction:P,devRightPadding:f,devRightPaddingValue:m,settingsPanelOpen:i}),(se,ue)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"containerRef",ref:k,class:s.normalizeClass(["zcode-cms-container",{"zcode-dev-padding":f.value&&le.value}])},[s.createVNode(Kd,{"current-mode":s.unref(R),"view-mode":r.value,"allow-dynamic-content-interaction":P.value,onSwitchMode:s.unref($t),onSwitchViewMode:ue[0]||(ue[0]=we=>r.value=we),onOpenSettings:ue[1]||(ue[1]=we=>i.value=!0)},null,8,["current-mode","view-mode","allow-dynamic-content-interaction","onSwitchMode"]),Y.value.visible?(s.openBlock(),s.createElementBlock("div",_N,[s.createElementVNode("div",ON,s.toDisplayString(Y.value.message),1),s.createElementVNode("button",{class:"zcode-save-banner-close","aria-label":se.$t("common.close"),onClick:ue[2]||(ue[2]=we=>Y.value.visible=!1)}," × ",8,DN)])):s.createCommentVNode("",!0),r.value==="manage"?(s.openBlock(),s.createElementBlock("div",PN,[s.createElementVNode("button",{class:"zcode-save-btn",onClick:js},[s.createVNode(s.unref(xc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(se.$t("common.save")),1)])])):s.createCommentVNode("",!0),r.value==="preview"?(s.openBlock(),s.createBlock(xa,{key:2,"cms-data":s.unref(y),"allow-dynamic-content-interaction":!0},null,8,["cms-data"])):s.createCommentVNode("",!0),r.value==="manage"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:3},[s.createVNode(Sc,{ref_key:"previewAreaRef",ref:w,"cms-data":s.unref(y),"full-page-html":s.unref(v),"on-add-click":s.unref(U),"allow-dynamic-content-interaction":P.value},null,8,["cms-data","full-page-html","on-add-click","allow-dynamic-content-interaction"]),s.createVNode(Fh,{"editing-component":s.unref(W),"editing-available-fields":s.unref(G),"field-errors":X.value,"current-mode":s.unref(R),"can-select-parent":s.unref(F),"images-common":s.unref(y).images.common,"images-individual":s.unref(y).images.individual,"images-special":s.unref(y).images.special,"image-modal-actions":c.value,onClose:s.unref(ne),onSelectParent:s.unref(j),onSaveField:te,onAddImage:dc,onDeleteImage:Yt},null,8,["editing-component","editing-available-fields","field-errors","current-mode","can-select-parent","images-common","images-individual","images-special","image-modal-actions","onClose","onSelectParent"]),s.createVNode(CC,{"delete-confirm-component":s.unref(ze),"current-mode":s.unref(R),"can-select-parent":s.unref(F),onConfirm:s.unref(Xt),onCancel:s.unref(Ot),onSelectParent:s.unref(j)},null,8,["delete-confirm-component","current-mode","can-select-parent","onConfirm","onCancel","onSelectParent"]),s.createVNode(_C,{"reorder-source-path":s.unref(Te),"current-mode":s.unref(R),"can-select-parent":s.unref(F),onCancel:s.unref(ee),onSelectParent:s.unref(j)},null,8,["reorder-source-path","current-mode","can-select-parent","onCancel","onSelectParent"]),s.createVNode(yN,{"add-target-path":s.unref(de),"add-part-category":s.unref(C),"add-type-tab":s.unref(L),"add-selected-part":s.unref(Me),"add-selected-type":s.unref(me),"has-special-parts":s.unref(z),"clicked-component":s.unref(Le),"available-part-types":s.unref(S),config:s.unref(l),"grouped-parts-by-type":s.unref(K),"can-select-parent":s.unref(F),"get-part-preview-html":s.unref(T),"get-clicked-component-preview-html":s.unref(I),"keep-adding":s.unref($),onCancel:s.unref(ge),onSelectParent:s.unref(j),onCategoryTabClick:s.unref(ie),onTypeTabClick:s.unref(Se),onSelectPart:s.unref(ve),onConfirmAdd:s.unref(Q),onUpdateKeepAdding:ue[3]||(ue[3]=we=>$.value=we)},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)):s.createCommentVNode("",!0),s.createVNode(Zd,{"is-open":i.value,"view-mode":r.value,mode:"toolbar","allow-dynamic-content-interaction":P.value,"dev-right-padding":m.value,"enable-context-menu":p.value,"show-save-confirm":h.value,onClose:ue[4]||(ue[4]=we=>i.value=!1),onToggleDynamicContent:ue[5]||(ue[5]=we=>P.value=we),onToggleDevPadding:ue[6]||(ue[6]=we=>f.value=we),onToggleContextMenu:ue[7]||(ue[7]=we=>p.value=we),onToggleSaveConfirm:ue[8]||(ue[8]=we=>h.value=we)},null,8,["is-open","view-mode","allow-dynamic-content-interaction","dev-right-padding","enable-context-menu","show-save-confirm"]),s.createVNode(bN,{"is-visible":s.unref(gn),position:s.unref(Kr),"current-mode":s.unref(R),onSelectMode:s.unref(vo),onClose:s.unref(lc)},null,8,["is-visible","position","current-mode","onSelectMode","onClose"]),g.value?(s.openBlock(),s.createElementBlock("div",{key:4,class:"zcode-save-confirm-dialog-overlay",onClick:s.withModifiers(Zr,["self"])},[s.createElementVNode("div",RN,[s.createElementVNode("div",LN,[s.createElementVNode("div",$N,s.toDisplayString(se.$t("saveConfirm.title")),1)]),s.createElementVNode("div",VN,[s.createElementVNode("p",null,s.toDisplayString(se.$t("saveConfirm.simpleMessage")),1)]),s.createElementVNode("div",BN,[s.createElementVNode("button",{class:"zcode-btn-secondary",onClick:Zr},s.toDisplayString(se.$t("common.cancel")),1),s.createElementVNode("button",{class:"zcode-btn-primary",onClick:Qr},s.toDisplayString(se.$t("saveConfirm.saveButton")),1)])])])):s.createCommentVNode("",!0)],2))}}),Wh=":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-side-tabs{display:flex;gap:0;padding:8px 12px 0;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-part-editor-side-tab{padding:8px 12px;font-size:13px;color:#6b7280;background:transparent;border:none;border-bottom:2px solid transparent;cursor:pointer;margin-bottom:-1px}.zcode-part-editor-side-tab:hover{color:#374151}.zcode-part-editor-side-tab.active{color:#1f2937;font-weight:600;border-bottom-color:#3b82f6}.zcode-edit-panel-preview-heading{font-size:14px;font-weight:600;color:#1f2937;margin-bottom:4px}.zcode-part-editor-pane-body .zcode-edit-panel-preview-desc{margin-bottom:12px;font-size:12px;color:#6b7280;line-height:1.5}.zcode-edit-panel-preview-empty{padding:24px 12px;text-align:center;font-size:13px;color:#6b7280;background:#f9fafb;border-radius:6px;border:1px dashed #e5e7eb}.zcode-edit-panel-preview-wrap{display:flex;flex-direction:column;min-height:0;overflow:hidden}.zcode-edit-panel-preview{position:static;top:auto;right:auto;width:auto;height:auto;max-height:none;box-shadow:none;z-index:auto;display:flex;flex-direction:column;background:transparent;overflow:visible}.zcode-edit-panel-preview .zcode-field-editor{padding:0 4px}.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-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}.zcode-edit-panel-preview{position:static;inset:auto;width:auto;height:auto;max-height:none;box-shadow:none;z-index:auto;border-radius:0;animation:none}@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}.zcode-part-editor-main{display:grid;grid-template-columns:1fr 1fr;gap:24px;align-items:stretch;min-height:0}.zcode-part-editor-main .zcode-part-editor-pane--side{position:sticky;top:0;align-self:start;max-height:calc(100vh - 120px)}.zcode-part-editor-pane--side .zcode-part-editor-pane-body{overflow-y:auto}.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-slots-config-in-pane{padding:12px 0;overflow-y:auto;min-height:0}.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}}",FN={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:"設定項目はありません。"},emptyState:{message:"パーツを追加してください",addPart:"+ パーツを追加"},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
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:"条件分岐(表示/非表示)",tag:"タグ選択",slot:"スロット(子要素挿入)",note:"補足",suggestionNote:"予測変換を有効にすると、<code>$</code>、<code>(</code>、<code>z</code>を入力時に自動補完が表示されます",fieldNameNote:"フィールド名は英数字とアンダースコアが使用できます",defaultValueNote:"デフォルト値は省略可能です(空文字になります)"},validationError:"エラー:",dangerousTagWarning:"<{tag}> タグが含まれています。",dangerousAttrWarning:"{attr} 属性が含まれています。",slotSettings:"スロット設定",slot:"スロット",templateHelpButton:"テンプレート記法のヘルプ",clickToEnlarge:"クリックで拡大",displayPreview:"表示プレビュー",editPanelPreview:"編集パネルプレビュー",editPanelPreviewNoFields:"編集可能なフィールドはありません",editPanelPreviewDesc:"ページ編集時に表示される編集パネルの項目一覧です。"},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:"動的ページ(例:店舗ごと、商品ごと)や特定の条件で使用されるパーツ・画像を想定しています。動的ルートやURLパラメータに応じて生成されるページで使用できる想定です。"}}},contextMenu:{edit:"編集",add:"追加",reorder:"並べ替え",delete:"削除",close:"閉じる"},editor:{pageManagement:"ページ管理",partsManagement:"パーツ管理",imagesManagement:"画像管理",dataViewer:"データビューアー",loading:"データを読み込み中..."}},jN={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."},emptyState:{message:"Please add a part",addPart:"+ Add Part"},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)",tag:"Tag selection",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",displayPreview:"Display preview",editPanelPreview:"Edit panel preview",editPanelPreviewNoFields:"No editable fields",editPanelPreviewDesc:"List of fields shown in the edit panel when editing a page.",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 generated according to dynamic routes or URL parameters."}}},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 HN(n="ja"){return hy({locale:n,fallbackLocale:"ja",messages:{ja:FN,en:jN},globalInjection:!0})}const qh={UNDEFINED_PROPERTIES:"Cannot read properties of undefined",APP_REFERENCE:"app"};function Gh(){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(qh.UNDEFINED_PROPERTIES)&&t.includes(qh.APP_REFERENCE)){e.preventDefault();return}}}),n.__zcodeI18nErrorHandlerSetup=!0)}function UN(){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 Rs(n,e="ja"){const t=tb(null);if(t)return t;const o=n.getAttribute("locale");return o==="ja"||o==="en"?o:e}function Ls(n,e){UN();const t=HN(e);try{n.use(t)}catch(o){console.warn("[ZeroCode] Failed to setup i18n:",o)}}Gh();class WN 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")||"[]",a=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=Rs(this);this.app=s.createApp(Ps,{locale:p,page:e,cssCommon:t,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:a,partsSpecial:l,imagesCommon:c,imagesIndividual:d,imagesSpecial:u,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}),Ls(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"),a=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=Rs(this);this.app=s.createApp(Ps,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:a,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")||""}),Ls(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=Wh,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 a=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=a(u);f.onload=()=>{c++,c===d&&(Io(this._shadowRoot,e),setTimeout(()=>{i.forEach(p=>{this._shadowRoot.appendChild(a(p))}),l()},50))},this._shadowRoot.appendChild(f)})}else Io(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(a(c))}),l()}injectLightDOMScripts(){let e=[];if(this.__savedScriptSlots&&this.__savedScriptSlots.length>0)e=this.__savedScriptSlots.map(i=>{const a=document.createElement("script");return a.src=i.src,i.type&&(a.type=i.type),i.async&&(a.async=!0),i.defer&&(a.defer=!0),i.integrity&&(a.integrity=i.integrity),i.crossOrigin&&(a.crossOrigin=i.crossOrigin),a});else{const i=this.querySelectorAll('[slot="script"]');e=Array.from(i)}const t=[],o=[];e.forEach(i=>{const a=i;if(!a.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}a.src.includes("jquery")||a.src.includes("code.jquery.com")?t.push(a):o.push(a)});const r=i=>{const a=document.createElement("script");return a.src=i.src,i.type&&(a.type=i.type),i.async&&(a.async=!0),i.defer&&(a.defer=!0),i.integrity&&(a.integrity=i.integrity),i.crossOrigin&&(a.crossOrigin=i.crossOrigin),a.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},a};if(t.length>0){let i=0;const a=t.length;t.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===a&&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(),Io(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",WN);function qN(n){const{t:e}=Vt(),t=s.ref("common"),o=s.ref(null),r=s.ref(null),i=s.ref(null),a=s.ref(null),l=s.ref(!1),c=s.ref(null),d=s.ref(null),{renderComponentToHtml:u}=gi(n,!1),f=s.computed(()=>{const N=n.parts;return t.value==="common"?N.common:t.value==="individual"?N.individual:N.special}),p=s.computed(()=>{const N=f.value,L=new Map;return N.forEach($=>{L.has($.type)||L.set($.type,[]),$.parts.forEach((S,K)=>{L.get($.type).push({type:$,partIndex:K})})}),Array.from(L.entries()).map(([$,S])=>({type:$,parts:S.map(K=>({...K.type,_partIndex:K.partIndex,_displayPart:K.type.parts[K.partIndex]}))}))});function h(){const N=n.parts;return t.value==="common"?N.common:t.value==="individual"?N.individual:N.special}function m(N){return f.value.find(L=>L.type===N)||null}function g(N){return i.value&&i.value.partIndex===N&&i.value.part.slots||null}function y(N,L,$){if(i.value&&i.value.partIndex===N){const S=i.value.part;return S.slots||(S.slots={}),$(S.slots),!0}return!1}function x(N){const L={};return N.forEach($=>{if($.optional)L[$.fieldName]=void 0;else switch($.type){case"text":L[$.fieldName]=$.defaultValue||"";break;case"radio":L[$.fieldName]=$.options?.[0]||"";break;case"checkbox":L[$.fieldName]=[];break;case"boolean":L[$.fieldName]=!0;break;case"rich":L[$.fieldName]=$.defaultValue?`<p>${$.defaultValue}</p>`:"<p></p>";break;case"image":L[$.fieldName]=$.defaultValue||"";break}}),L}function C(N){o.value=N,r.value=null,l.value=!1}function E(){r.value=s.reactive({id:jn(),type:"",description:"",parts:[{id:jn(),title:"part_1",description:"",body:"<div>{$content:コンテンツを入力}</div>"}]}),a.value="type",l.value=!0,o.value=null}function v(N){r.value=s.reactive(JSON.parse(JSON.stringify(N))),a.value="type",l.value=!1,o.value=N}function A(N,L){const $=N.parts[L];if(!$)return;const S=JSON.parse(JSON.stringify($));S.slots||(S.slots={}),i.value={type:s.reactive(JSON.parse(JSON.stringify(N))),partIndex:L,part:s.reactive(S)},a.value="part"}async function M(N){const L=m(N.type);if(!L)return;const $=s.reactive(JSON.parse(JSON.stringify(L))),S={id:jn(),title:`part_${$.parts.length+1}`,description:"",body:"<div>{$content:コンテンツを入力}</div>"};$.parts.push(S);const K=$.parts.length-1;await s.nextTick(),i.value={type:$,partIndex:K,part:s.reactive(JSON.parse(JSON.stringify(S))),isNewPart:!0},a.value="part"}async function k(){if(!r.value)return;const N=Le(r.value);if(!N.valid){alert(e("partsManager.validationError")+`
465
- `+N.errors.join(`
466
- `));return}const L=JSON.parse(JSON.stringify(s.toRaw(r.value))),$=h();if(l.value)$.push(L);else{const S=$.findIndex(K=>K.id===r.value.id);S!==-1&&($[S]=L)}await s.nextTick(),f.value,p.value,r.value=null,a.value=null,l.value=!1}function w(N){const L=[],$=N.toLowerCase(),S=["script","iframe","object","embed"],K=["onclick","onerror","onload","onmouseover","onfocus","onblur"];return S.forEach(z=>{$.includes(`<${z}`)&&L.push(e("partsManager.dangerousTagWarning",{tag:z}))}),K.forEach(z=>{$.includes(`${z}=`)&&L.push(e("partsManager.dangerousAttrWarning",{attr:z}))}),{hasWarning:L.length>0,messages:L}}async function b(){if(!i.value)return;const N=i.value.part.body||"",L=w(N);if(L.hasWarning&&!confirm(`テンプレートにセキュリティ上注意が必要な記述が含まれています。
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)",tag:"Tag selection",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",displayPreview:"Display preview",editPanelPreview:"Edit panel preview",editPanelPreviewNoFields:"No editable fields",editPanelPreviewDesc:"List of fields shown in the edit panel when editing a page.",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 generated according to dynamic routes or URL parameters."}}},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 HN(n="ja"){return hy({locale:n,fallbackLocale:"ja",messages:{ja:FN,en:jN},globalInjection:!0})}const qh={UNDEFINED_PROPERTIES:"Cannot read properties of undefined",APP_REFERENCE:"app"};function Gh(){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(qh.UNDEFINED_PROPERTIES)&&t.includes(qh.APP_REFERENCE)){e.preventDefault();return}}}),n.__zcodeI18nErrorHandlerSetup=!0)}function UN(){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 Rs(n,e="ja"){const t=tb(null);if(t)return t;const o=n.getAttribute("locale");return o==="ja"||o==="en"?o:e}function Ls(n,e){UN();const t=HN(e);try{n.use(t)}catch(o){console.warn("[ZeroCode] Failed to setup i18n:",o)}}Gh();class WN 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")||"[]",a=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=Rs(this);this.app=s.createApp(Ps,{locale:p,page:e,cssCommon:t,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:a,partsSpecial:l,imagesCommon:c,imagesIndividual:d,imagesSpecial:u,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}),Ls(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"),a=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=Rs(this);this.app=s.createApp(Ps,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:a,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")||""}),Ls(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=Wh,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 a=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=a(u);f.onload=()=>{c++,c===d&&(Io(this._shadowRoot,e),setTimeout(()=>{i.forEach(p=>{this._shadowRoot.appendChild(a(p))}),l()},50))},this._shadowRoot.appendChild(f)})}else Io(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(a(c))}),l()}injectLightDOMScripts(){let e=[];if(this.__savedScriptSlots&&this.__savedScriptSlots.length>0)e=this.__savedScriptSlots.map(i=>{const a=document.createElement("script");return a.src=i.src,i.type&&(a.type=i.type),i.async&&(a.async=!0),i.defer&&(a.defer=!0),i.integrity&&(a.integrity=i.integrity),i.crossOrigin&&(a.crossOrigin=i.crossOrigin),a});else{const i=this.querySelectorAll('[slot="script"]');e=Array.from(i)}const t=[],o=[];e.forEach(i=>{const a=i;if(!a.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}a.src.includes("jquery")||a.src.includes("code.jquery.com")?t.push(a):o.push(a)});const r=i=>{const a=document.createElement("script");return a.src=i.src,i.type&&(a.type=i.type),i.async&&(a.async=!0),i.defer&&(a.defer=!0),i.integrity&&(a.integrity=i.integrity),i.crossOrigin&&(a.crossOrigin=i.crossOrigin),a.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},a};if(t.length>0){let i=0;const a=t.length;t.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===a&&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(),Io(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",WN);function qN(n){const{t:e}=Vt(),t=s.ref("common"),o=s.ref(null),r=s.ref(null),i=s.ref(null),a=s.ref(null),l=s.ref(!1),c=s.ref(null),d=s.ref(null),{renderComponentToHtml:u}=gi(n,!1),f=s.computed(()=>{const C=n.parts;return t.value==="common"?C.common:t.value==="individual"?C.individual:C.special}),p=s.computed(()=>{const C=f.value,L=new Map;return C.forEach($=>{L.has($.type)||L.set($.type,[]),$.parts.forEach((S,K)=>{L.get($.type).push({type:$,partIndex:K})})}),Array.from(L.entries()).map(([$,S])=>({type:$,parts:S.map(K=>({...K.type,_partIndex:K.partIndex,_displayPart:K.type.parts[K.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(L=>L.type===C)||null}function g(C){return i.value&&i.value.partIndex===C&&i.value.part.slots||null}function y(C,L,$){if(i.value&&i.value.partIndex===C){const S=i.value.part;return S.slots||(S.slots={}),$(S.slots),!0}return!1}function x(C){const L={};return C.forEach($=>{if($.optional)L[$.fieldName]=void 0;else switch($.type){case"text":L[$.fieldName]=$.defaultValue||"";break;case"radio":L[$.fieldName]=$.options?.[0]||"";break;case"checkbox":L[$.fieldName]=[];break;case"boolean":L[$.fieldName]=!0;break;case"rich":L[$.fieldName]=$.defaultValue?`<p>${$.defaultValue}</p>`:"<p></p>";break;case"image":L[$.fieldName]=$.defaultValue||"";break}}),L}function N(C){o.value=C,r.value=null,l.value=!1}function E(){r.value=s.reactive({id:jn(),type:"",description:"",parts:[{id:jn(),title:"part_1",description:"",body:"<div>{$content:コンテンツを入力}</div>"}]}),a.value="type",l.value=!0,o.value=null}function v(C){r.value=s.reactive(JSON.parse(JSON.stringify(C))),a.value="type",l.value=!1,o.value=C}function A(C,L){const $=C.parts[L];if(!$)return;const S=JSON.parse(JSON.stringify($));S.slots||(S.slots={}),i.value={type:s.reactive(JSON.parse(JSON.stringify(C))),partIndex:L,part:s.reactive(S)},a.value="part"}async function M(C){const L=m(C.type);if(!L)return;const $=s.reactive(JSON.parse(JSON.stringify(L))),S={id:jn(),title:`part_${$.parts.length+1}`,description:"",body:"<div>{$content:コンテンツを入力}</div>"};$.parts.push(S);const K=$.parts.length-1;await s.nextTick(),i.value={type:$,partIndex:K,part:s.reactive(JSON.parse(JSON.stringify(S))),isNewPart:!0},a.value="part"}async function k(){if(!r.value)return;const C=Le(r.value);if(!C.valid){alert(e("partsManager.validationError")+`
465
+ `+C.errors.join(`
466
+ `));return}const L=JSON.parse(JSON.stringify(s.toRaw(r.value))),$=h();if(l.value)$.push(L);else{const S=$.findIndex(K=>K.id===r.value.id);S!==-1&&($[S]=L)}await s.nextTick(),f.value,p.value,r.value=null,a.value=null,l.value=!1}function w(C){const L=[],$=C.toLowerCase(),S=["script","iframe","object","embed"],K=["onclick","onerror","onload","onmouseover","onfocus","onblur"];return S.forEach(z=>{$.includes(`<${z}`)&&L.push(e("partsManager.dangerousTagWarning",{tag:z}))}),K.forEach(z=>{$.includes(`${z}=`)&&L.push(e("partsManager.dangerousAttrWarning",{attr:z}))}),{hasWarning:L.length>0,messages:L}}async function b(){if(!i.value)return;const C=i.value.part.body||"",L=w(C);if(L.hasWarning&&!confirm(`テンプレートにセキュリティ上注意が必要な記述が含まれています。
467
467
 
468
468
  ${L.messages.join(`
469
469
  `)}
470
470
 
471
- このまま保存しますか?`))return;const $=h(),S=$.findIndex(U=>U.id===i.value.type.id);if(S===-1)return;const K=$[S],z=JSON.parse(JSON.stringify(s.toRaw(i.value.part)));i.value.isNewPart?K.parts.push(z):K.parts[i.value.partIndex]=z,await s.nextTick(),f.value,p.value,i.value=null,a.value=null}function R(N){const L=f.value.find($=>$.id===N.id);if(L){if(N._partIndex!==void 0&&N._partIndex!==null)if(L.parts.length>1)L.parts.splice(N._partIndex,1);else{const $=f.value.findIndex(S=>S.id===N.id);$!==-1&&f.value.splice($,1)}else{const $=f.value.findIndex(S=>S.id===N.id);$!==-1&&f.value.splice($,1)}o.value=null,r.value=null}}function B(N){const L=[],$=(S,K)=>{const z=S.part_id,U=n.parts,ie=[...U.common,...U.individual];for(const Se of ie)if(Se.parts.find(T=>T.id===z)&&Se.type===N){L.push({path:K,component:S});break}S.slots&&Object.entries(S.slots).forEach(([Se,ve])=>{Array.isArray(ve)&&ve.forEach((T,I)=>{$(T,`${K}.slots.${Se}.${I}`)})})};return n.page.forEach((S,K)=>{$(S,`page.${K}`)}),L}function O(N,L){const $=Fn(L.body),S=x($),K={id:"preview",part_id:L.id,...S},z=new Set;z.add(`${N.id}:${L.id}`);const U=L.slots;if(U){const ie={};Object.entries(U).forEach(([Se,ve])=>{const T=ve.allowedParts;if(T&&T.length>0){const I=T[T.length-1],Q=n.parts,ge=[...Q.common,...Q.individual];let Te=null,ye=null;for(const H of ge){const ee=H.parts.find(ze=>ze.id===I);if(ee){Te=H,ye=ee;break}}if(Te&&ye){const H=D(Te,ye.id,z);ie[Se]=[H]}else ie[Se]=[]}else ie[Se]=[]}),Object.keys(ie).length>0&&(K.slots=ie)}return K}function D(N,L,$=new Set){const S=L&&N.parts.find(ve=>ve.id===L)||N.parts[0];if(!S)throw new Error(`Part not found for type: ${N.type}`);const K=`${N.id}:${S.id}`;if($.has(K)){const ve=Fn(S.body),T=x(ve);return{id:"preview",part_id:S.id,...T}}$.add(K);const z=Fn(S.body),U=x(z),ie={id:"preview",part_id:S.id,...U},Se=S.slots;if(Se){const ve={};Object.entries(Se).forEach(([T,I])=>{const Q=I.allowedParts;if(Q&&Q.length>0){const ge=Q[Q.length-1],Te=n.parts,ye=[...Te.common,...Te.individual];let H=null,ee=null;for(const ze of ye){const Pe=ze.parts.find(dt=>dt.id===ge);if(Pe){H=ze,ee=Pe;break}}if(H&&ee){const ze=D(H,ee.id,$);ve[T]=[ze]}else ve[T]=[]}else ve[T]=[]}),Object.keys(ve).length>0&&(ie.slots=ve)}return ie}function P(N,L){if(!L)return"";const $=O(N,L);return mi(L.body,$,"",S=>{const K=n.parts,z=[...K.common,...K.individual,...K.special];for(const U of z){const ie=U.parts.find(Se=>Se.id===S);if(ie)return ie}return null},(S,K)=>u(S,K),!1,n.images.common,n.images.individual,n.images.special)}function q(N){const L=[];try{const K=new DOMParser().parseFromString(`<template>${N}</template>`,"text/html").querySelector("template");if(!K)return L;K.content.querySelectorAll("[z-slot]").forEach(U=>{const ie=U.getAttribute("z-slot")||"default";L.includes(ie)||L.push(ie)})}catch($){console.error("Failed to parse template:",$)}return L}function W(N){if(i.value&&i.value.partIndex===N){const L=i.value.part.body,$=q(L),S=Object.keys(i.value.part.slots||{});return $.filter(K=>!S.includes(K))}return[]}function V(N,L){let $=L||null;if(!$&&($=prompt("スロット名を入力してください:"),!$?.trim()))return;y(N,$.trim(),K=>{if(K[$.trim()]){alert("このスロット名は既に存在します");return}K[$.trim()]={}})||alert("パーツが見つかりません")}function G(N,L){g(N)?.[L]&&confirm(`スロット「${L}」を削除しますか?`)&&y(N,L,S=>{delete S[L]})}function J(N,L,$){y(N,L,K=>{K[L]&&(K[L].allowedParts=$)})||console.warn(`Failed to update allowed parts for slot ${L}`)}function oe(N,L){if(!c.value){c.value={type:N.type,partIndex:L};return}if(c.value.type===N.type&&c.value.partIndex===L){Z();return}const $=c.value,S={type:N.type,partIndex:L};if(!ne($,S)){alert("同じタイプ内のパーツのみ並べ替えできます"),Z();return}X($,S),Z()}function ne(N,L){return!(N.type!==L.type||N.partIndex===L.partIndex)}function X(N,L){const $=h(),S=$.findIndex(ie=>ie.type===N.type);if(S===-1)return;const z=$[S].parts,[U]=z.splice(N.partIndex,1);z.splice(L.partIndex,0,U)}function Z(){c.value=null}function Y(N){const L=h(),$=B(N);if($.length>0){if(!confirm(`タイプ「${N}」は${$.length}箇所で使用されています。削除しますか?`))return}else if(!confirm(`タイプ「${N}」を削除しますか?`))return;for(let S=L.length-1;S>=0;S--)L[S].type===N&&L.splice(S,1)}function te(N,L){if(N===L)return;const $=h(),S=new Map,K=[];$.forEach(ve=>{S.has(ve.type)||(S.set(ve.type,[]),K.push(ve.type)),S.get(ve.type).push(ve)});const z=K.map(ve=>({type:ve,types:S.get(ve)})),U=z.findIndex(ve=>ve.type===N),ie=z.findIndex(ve=>ve.type===L);if(U===-1||ie===-1)return;const[Se]=z.splice(U,1);z.splice(ie,0,Se),$.splice(0,$.length),z.forEach(ve=>{ve.types.forEach(T=>$.push(T))})}function de(N){if(!d.value){d.value=N;return}if(d.value===N){d.value=null;return}te(d.value,N),d.value=null}function me(){r.value=null,a.value=null,l.value=!1}function Me(){i.value=null,a.value=null}function Le(N){const L=[];if(!N.type||N.type.trim()==="")L.push("タイプ名は必須です");else if(l.value){const $=n.parts;[...$.common,...$.individual].some(z=>z.type===N.type.trim())&&L.push(`タイプ「${N.type}」は既に存在します`)}return!N.parts||N.parts.length===0?L.push("最低1つのパーツが必要です"):N.parts.forEach(($,S)=>{(!$.title||$.title.trim()==="")&&L.push(`パーツ ${S+1} のタイトルは必須です`),(!$.body||$.body.trim()==="")&&L.push(`パーツ ${S+1} のテンプレートは必須です`)}),{valid:L.length===0,errors:L}}return{reorderSourcePart:c,handleReorderClick:oe,canReorderParts:ne,cancelReorder:Z,activeCategory:t,selectedType:o,editingType:r,editingPart:i,editingLevel:a,isCreatingNew:l,currentTypes:f,groupedPartsByType:p,selectType:C,startCreating:E,startEditingType:v,startEditingPart:A,addPartToType:M,saveType:k,savePart:b,deletePart:R,checkTypeUsage:B,cancelEditingType:me,cancelEditingPart:Me,getPartPreviewHtml:P,createTempComponentFromType:O,validateType:Le,addPartSlot:V,removePartSlot:G,updatePartSlotAllowedParts:J,getAvailableSlotsForPart:W,extractSlotsFromTemplate:q,reorderSourceType:d,startReorderType:de,deletePartType:Y}}function Kh(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 GN(n){if(Array.isArray(n))return n}function KN(n,e,t){return(e=tv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function JN(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var o,r,i,a,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&&(a=t.return(),Object(a)!==a))return}finally{if(d)throw r}}return l}}function XN(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
471
+ このまま保存しますか?`))return;const $=h(),S=$.findIndex(U=>U.id===i.value.type.id);if(S===-1)return;const K=$[S],z=JSON.parse(JSON.stringify(s.toRaw(i.value.part)));i.value.isNewPart?K.parts.push(z):K.parts[i.value.partIndex]=z,await s.nextTick(),f.value,p.value,i.value=null,a.value=null}function R(C){const L=f.value.find($=>$.id===C.id);if(L){if(C._partIndex!==void 0&&C._partIndex!==null)if(L.parts.length>1)L.parts.splice(C._partIndex,1);else{const $=f.value.findIndex(S=>S.id===C.id);$!==-1&&f.value.splice($,1)}else{const $=f.value.findIndex(S=>S.id===C.id);$!==-1&&f.value.splice($,1)}o.value=null,r.value=null}}function B(C){const L=[],$=(S,K)=>{const z=S.part_id,U=n.parts,ie=[...U.common,...U.individual];for(const Se of ie)if(Se.parts.find(T=>T.id===z)&&Se.type===C){L.push({path:K,component:S});break}S.slots&&Object.entries(S.slots).forEach(([Se,ve])=>{Array.isArray(ve)&&ve.forEach((T,I)=>{$(T,`${K}.slots.${Se}.${I}`)})})};return n.page.forEach((S,K)=>{$(S,`page.${K}`)}),L}function O(C,L){const $=Fn(L.body),S=x($),K={id:"preview",part_id:L.id,...S},z=new Set;z.add(`${C.id}:${L.id}`);const U=L.slots;if(U){const ie={};Object.entries(U).forEach(([Se,ve])=>{const T=ve.allowedParts;if(T&&T.length>0){const I=T[T.length-1],Q=n.parts,ge=[...Q.common,...Q.individual];let Te=null,ye=null;for(const H of ge){const ee=H.parts.find(ze=>ze.id===I);if(ee){Te=H,ye=ee;break}}if(Te&&ye){const H=D(Te,ye.id,z);ie[Se]=[H]}else ie[Se]=[]}else ie[Se]=[]}),Object.keys(ie).length>0&&(K.slots=ie)}return K}function D(C,L,$=new Set){const S=L&&C.parts.find(ve=>ve.id===L)||C.parts[0];if(!S)throw new Error(`Part not found for type: ${C.type}`);const K=`${C.id}:${S.id}`;if($.has(K)){const ve=Fn(S.body),T=x(ve);return{id:"preview",part_id:S.id,...T}}$.add(K);const z=Fn(S.body),U=x(z),ie={id:"preview",part_id:S.id,...U},Se=S.slots;if(Se){const ve={};Object.entries(Se).forEach(([T,I])=>{const Q=I.allowedParts;if(Q&&Q.length>0){const ge=Q[Q.length-1],Te=n.parts,ye=[...Te.common,...Te.individual];let H=null,ee=null;for(const ze of ye){const Pe=ze.parts.find(dt=>dt.id===ge);if(Pe){H=ze,ee=Pe;break}}if(H&&ee){const ze=D(H,ee.id,$);ve[T]=[ze]}else ve[T]=[]}else ve[T]=[]}),Object.keys(ve).length>0&&(ie.slots=ve)}return ie}function P(C,L){if(!L)return"";const $=O(C,L);return mi(L.body,$,"",S=>{const K=n.parts,z=[...K.common,...K.individual,...K.special];for(const U of z){const ie=U.parts.find(Se=>Se.id===S);if(ie)return ie}return null},(S,K)=>u(S,K),!1,n.images.common,n.images.individual,n.images.special)}function q(C){const L=[];try{const K=new DOMParser().parseFromString(`<template>${C}</template>`,"text/html").querySelector("template");if(!K)return L;K.content.querySelectorAll("[z-slot]").forEach(U=>{const ie=U.getAttribute("z-slot")||"default";L.includes(ie)||L.push(ie)})}catch($){console.error("Failed to parse template:",$)}return L}function W(C){if(i.value&&i.value.partIndex===C){const L=i.value.part.body,$=q(L),S=Object.keys(i.value.part.slots||{});return $.filter(K=>!S.includes(K))}return[]}function V(C,L){let $=L||null;if(!$&&($=prompt("スロット名を入力してください:"),!$?.trim()))return;y(C,$.trim(),K=>{if(K[$.trim()]){alert("このスロット名は既に存在します");return}K[$.trim()]={}})||alert("パーツが見つかりません")}function G(C,L){g(C)?.[L]&&confirm(`スロット「${L}」を削除しますか?`)&&y(C,L,S=>{delete S[L]})}function J(C,L,$){y(C,L,K=>{K[L]&&(K[L].allowedParts=$)})||console.warn(`Failed to update allowed parts for slot ${L}`)}function oe(C,L){if(!c.value){c.value={type:C.type,partIndex:L};return}if(c.value.type===C.type&&c.value.partIndex===L){Z();return}const $=c.value,S={type:C.type,partIndex:L};if(!ne($,S)){alert("同じタイプ内のパーツのみ並べ替えできます"),Z();return}X($,S),Z()}function ne(C,L){return!(C.type!==L.type||C.partIndex===L.partIndex)}function X(C,L){const $=h(),S=$.findIndex(ie=>ie.type===C.type);if(S===-1)return;const z=$[S].parts,[U]=z.splice(C.partIndex,1);z.splice(L.partIndex,0,U)}function Z(){c.value=null}function Y(C){const L=h(),$=B(C);if($.length>0){if(!confirm(`タイプ「${C}」は${$.length}箇所で使用されています。削除しますか?`))return}else if(!confirm(`タイプ「${C}」を削除しますか?`))return;for(let S=L.length-1;S>=0;S--)L[S].type===C&&L.splice(S,1)}function te(C,L){if(C===L)return;const $=h(),S=new Map,K=[];$.forEach(ve=>{S.has(ve.type)||(S.set(ve.type,[]),K.push(ve.type)),S.get(ve.type).push(ve)});const z=K.map(ve=>({type:ve,types:S.get(ve)})),U=z.findIndex(ve=>ve.type===C),ie=z.findIndex(ve=>ve.type===L);if(U===-1||ie===-1)return;const[Se]=z.splice(U,1);z.splice(ie,0,Se),$.splice(0,$.length),z.forEach(ve=>{ve.types.forEach(T=>$.push(T))})}function de(C){if(!d.value){d.value=C;return}if(d.value===C){d.value=null;return}te(d.value,C),d.value=null}function me(){r.value=null,a.value=null,l.value=!1}function Me(){i.value=null,a.value=null}function Le(C){const L=[];if(!C.type||C.type.trim()==="")L.push("タイプ名は必須です");else if(l.value){const $=n.parts;[...$.common,...$.individual].some(z=>z.type===C.type.trim())&&L.push(`タイプ「${C.type}」は既に存在します`)}return!C.parts||C.parts.length===0?L.push("最低1つのパーツが必要です"):C.parts.forEach(($,S)=>{(!$.title||$.title.trim()==="")&&L.push(`パーツ ${S+1} のタイトルは必須です`),(!$.body||$.body.trim()==="")&&L.push(`パーツ ${S+1} のテンプレートは必須です`)}),{valid:L.length===0,errors:L}}return{reorderSourcePart:c,handleReorderClick:oe,canReorderParts:ne,cancelReorder:Z,activeCategory:t,selectedType:o,editingType:r,editingPart:i,editingLevel:a,isCreatingNew:l,currentTypes:f,groupedPartsByType:p,selectType:N,startCreating:E,startEditingType:v,startEditingPart:A,addPartToType:M,saveType:k,savePart:b,deletePart:R,checkTypeUsage:B,cancelEditingType:me,cancelEditingPart:Me,getPartPreviewHtml:P,createTempComponentFromType:O,validateType:Le,addPartSlot:V,removePartSlot:G,updatePartSlotAllowedParts:J,getAvailableSlotsForPart:W,extractSlotsFromTemplate:q,reorderSourceType:d,startReorderType:de,deletePartType:Y}}function Kh(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 GN(n){if(Array.isArray(n))return n}function KN(n,e,t){return(e=tv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function JN(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var o,r,i,a,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&&(a=t.return(),Object(a)!==a))return}finally{if(d)throw r}}return l}}function XN(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
472
472
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jh(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 Xh(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Jh(Object(t),!0).forEach(function(o){KN(n,o,t[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Jh(Object(t)).forEach(function(o){Object.defineProperty(n,o,Object.getOwnPropertyDescriptor(t,o))})}return n}function YN(n,e){if(n==null)return{};var t,o,r=QN(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 QN(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 ZN(n,e){return GN(n)||JN(n,e)||nv(n,e)||XN()}function ev(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 tv(n){var e=ev(n,"string");return typeof e=="symbol"?e:e+""}function nv(n,e){if(n){if(typeof n=="string")return Kh(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)?Kh(n,e):void 0}}function ov(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yh(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?Yh(Object(t),!0).forEach(function(o){ov(n,o,t[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Yh(Object(t)).forEach(function(o){Object.defineProperty(n,o,Object.getOwnPropertyDescriptor(t,o))})}return n}function rv(){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 Ur(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 a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return e.apply(t,[].concat(r,l))}}}function $s(n){return{}.toString.call(n).includes("Object")}function iv(n){return!Object.keys(n).length}function Wr(n){return typeof n=="function"}function sv(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function av(n,e){return $s(e)||so("changeType"),Object.keys(e).some(function(t){return!sv(n,t)})&&so("changeField"),e}function lv(n){Wr(n)||so("selectorType")}function cv(n){Wr(n)||$s(n)||so("handlerType"),$s(n)&&Object.values(n).some(function(e){return!Wr(e)})&&so("handlersType")}function dv(n){n||so("initialIsRequired"),$s(n)||so("initialType"),iv(n)&&so("initialContent")}function uv(n,e){throw new Error(n[e]||n.default)}var fv={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"},so=Ur(uv)(fv),Vs={changes:av,selector:lv,handler:cv,initial:dv};function pv(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Vs.initial(n),Vs.handler(e);var t={current:n},o=Ur(gv)(t,e),r=Ur(mv)(t),i=Ur(Vs.changes)(n),a=Ur(hv)(t);function l(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(u){return u};return Vs.selector(d),d(t.current)}function c(d){rv(o,r,i,a)(d)}return[l,c]}function hv(n,e){return Wr(e)?e(n.current):e}function mv(n,e){return n.current=Qh(Qh({},n.current),e),e}function gv(n,e,t){return Wr(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 yv={create:pv},bv={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function xv(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 a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return e.apply(t,[].concat(r,l))}}}function kv(n){return{}.toString.call(n).includes("Object")}function Ev(n){return n||em("configIsRequired"),kv(n)||em("configType"),n.urls?(wv(),{paths:{vs:n.urls.monacoBase}}):n}function wv(){console.warn(Zh.deprecation)}function Sv(n,e){throw new Error(n[e]||n.default)}var Zh={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!
473
473
  You are using deprecated way of configuration.
474
474
 
@@ -478,8 +478,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
478
478
  monaco.config({ paths: { vs: '...' } })
479
479
 
480
480
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
481
- `},em=xv(Sv)(Zh),Cv={config:Ev},Nv=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,a){return a(i)},r)}};function tm(n,e){return Object.keys(e).forEach(function(t){e[t]instanceof Object&&n[t]&&Object.assign(e[t],tm(n[t],e[t]))}),Xh(Xh({},n),e)}var vv={type:"cancelation",msg:"operation is manually canceled"};function ic(n){var e=!1,t=new Promise(function(o,r){n.then(function(i){return e?r(vv):o(i)}),n.catch(r)});return t.cancel=function(){return e=!0},t}var Tv=["monaco"],zv=yv.create({config:bv,isInitialized:!1,resolve:null,reject:null,monaco:null}),nm=ZN(zv,2),qr=nm[0],Bs=nm[1];function Mv(n){var e=Cv.config(n),t=e.monaco,o=YN(e,Tv);Bs(function(r){return{config:tm(r.config,o),monaco:t}})}function Av(){var n=qr(function(e){var t=e.monaco,o=e.isInitialized,r=e.resolve;return{monaco:t,isInitialized:o,resolve:r}});if(!n.isInitialized){if(Bs({isInitialized:!0}),n.monaco)return n.resolve(n.monaco),ic(sc);if(window.monaco&&window.monaco.editor)return om(window.monaco),n.resolve(window.monaco),ic(sc);Nv(Iv,Ov)(Dv)}return ic(sc)}function Iv(n){return document.body.appendChild(n)}function _v(n){var e=document.createElement("script");return n&&(e.src=n),e}function Ov(n){var e=qr(function(o){var r=o.config,i=o.reject;return{config:r,reject:i}}),t=_v("".concat(e.config.paths.vs,"/loader.js"));return t.onload=function(){return n()},t.onerror=e.reject,t}function Dv(){var n=qr(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;om(o),n.resolve(o)},function(t){n.reject(t)})}function om(n){qr().monaco||Bs({monaco:n})}function Pv(){return qr(function(n){var e=n.monaco;return e})}var sc=new Promise(function(n,e){return Bs({resolve:n,reject:e})}),Rv={config:Mv,init:Av,__getMonacoInstance:Pv};const Lv={class:"monaco-editor-wrapper"},$v={key:0,class:"monaco-editor-error"},rm=((n,e)=>{const t=n.__vccOpts||n;for(const[o,r]of e)t[o]=r;return t})(s.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=s.ref(null),i=s.ref(null);let a=null,l=null,c=null,d=!1,u=[];function f(){const h=r.value;if(!h)return;const m=h.getRootNode();if(!(m instanceof ShadowRoot))return;const g=m;Array.from(document.head.querySelectorAll('style, link[rel="stylesheet"]')).filter(C=>{if(C.tagName==="LINK"){const v=C.href||"";return v.includes("monaco")||v.includes("/vs/")||v.includes("vs/")}const E=C.textContent||"";return E.includes(".monaco-editor")||E.includes(".monaco-editor-background")}).forEach(C=>{if(C.tagName==="LINK"){const v=C.href;if(!!g.querySelector(`link[rel="stylesheet"][href="${v}"]`))return}else{const v=C.getAttribute("data-name")||"";if(v&&!!g.querySelector(`style[data-name="${v}"]`))return}const E=C.cloneNode(!0);E.setAttribute("data-zcode-monaco-style","true"),g.appendChild(E),u.push(E)})}function p(){if(!(!a||!r.value||!l)&&t.autoHeight!==!1)try{const h=a.getOption(l.editor.EditorOption.lineHeight)||19;let y=(a.getModel()?.getLineCount()||1)*h+20;t.maxHeight!==void 0&&(y=Math.min(y,t.maxHeight)),r.value.style.height=`${y}px`,a.layout()}catch{r.value.style.height="200px"}}return s.onMounted(async()=>{if(r.value)try{l=await Rv.init(),f(),c=l.languages.registerCompletionItemProvider("html",{provideCompletionItems:(m,g)=>{const y=m.getWordUntilPosition(g),x={startLineNumber:g.lineNumber,endLineNumber:g.lineNumber,startColumn:y.startColumn,endColumn:y.endColumn},C=m.getValueInRange({startLineNumber:g.lineNumber,startColumn:Math.max(1,g.column-10),endLineNumber:g.lineNumber,endColumn:g.column}),E=[];return(C.endsWith("$")||C.endsWith("{$"))&&E.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:{startLineNumber:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-(C.endsWith("{$")?2:1),endColumn:g.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-(C.endsWith("{$")?2:1),endColumn:g.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-(C.endsWith("{$")?2:1),endColumn:g.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-(C.endsWith("{$")?2:1),endColumn:g.column}}),(C.endsWith("(")||C.endsWith("$("))&&E.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-(C.endsWith("$(")?2:1),endColumn:g.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-(C.endsWith("$(")?2:1),endColumn:g.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-(C.endsWith("$(")?2:1),endColumn:g.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-(C.endsWith("$(")?2:1),endColumn:g.column}}),(C.endsWith("z-")||C.endsWith(" z-"))&&E.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-2,endColumn:g.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-2,endColumn:g.column}}),E.length===0&&E.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:x},{label:"{$field:default:rich}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:x},{label:"{$field:default:image}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:x},{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:x},{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:x},{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:x},{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:x},{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:x},{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:x},{label:'z-empty="$fieldName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-empty="$${1:fieldName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"オプショナルフィールドが空の場合、親要素を削除",detail:"テンプレート記法 - 条件分岐(空の場合削除)",range:x},{label:'z-slot="slotName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:x}),{suggestions:E}},triggerCharacters:["$","(","z"]});const h=t.enableSuggestions!==!1;a=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:h,quickSuggestions:h?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:h,acceptSuggestionOnEnter:h?"on":"off",suggestSelection:"first",mouseWheelScrollSensitivity:1,fastScrollSensitivity:5,scrollbar:{alwaysConsumeMouseWheel:!1}}),a.onDidChangeModelContent(()=>{if(!d){const m=a.getValue();o("update:modelValue",m),p()}}),p()}catch(h){i.value=`Monaco Editorの読み込みに失敗しました: ${h}`,console.error("Monaco Editor error:",h)}}),s.watch(()=>t.modelValue,async h=>{a&&a.getValue()!==h&&(d=!0,await s.nextTick(),a.setValue(h||""),d=!1,p())}),s.watch(()=>t.enableSuggestions,h=>{if(a&&l){const m=h!==!1;a.updateOptions({suggestOnTriggerCharacters:m,quickSuggestions:m?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:m,acceptSuggestionOnEnter:m?"on":"off"})}}),s.onUnmounted(()=>{c?.dispose(),c=null,a&&(a.dispose(),a=null),u.forEach(h=>h.remove()),u=[]}),(h,m)=>(s.openBlock(),s.createElementBlock("div",Lv,[s.createElementVNode("div",{ref_key:"editorContainer",ref:r,class:"monaco-editor-container"},null,512),i.value?(s.openBlock(),s.createElementBlock("div",$v,s.toDisplayString(i.value),1)):s.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}"]]]),Vv={class:"zcode-parts-manager"},Bv={class:"zcode-parts-category-tabs"},Fv={class:"zcode-parts-category-tab-group"},jv=["onClick"],Hv=["title"],Uv={class:"zcode-parts-add-wrapper"},Wv={class:"zcode-parts-manager-content"},qv={class:"zcode-parts-items"},Gv={class:"zcode-part-type-title",role:"heading","aria-level":"5"},Kv={class:"zcode-part-type-actions"},Jv=["title","onClick"],Xv=["title","onClick"],Yv=["title","onClick"],Qv={class:"zcode-part-type-items"},Zv=["onClick"],eT={key:0,class:"zcode-reorder-source-indicator"},tT={class:"zcode-part-item-header"},nT={class:"zcode-part-type"},oT={class:"zcode-part-item-actions"},rT=["title","onClick"],iT=["title","onClick"],sT=["title","onClick"],aT={class:"zcode-part-item-content"},lT={class:"zcode-part-modules"},cT={key:0,class:"zcode-part-preview"},dT=["innerHTML"],uT=["onClick"],fT={class:"zcode-part-item-add-content"},pT={class:"zcode-part-editor-header"},hT={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},mT=["aria-label"],gT={class:"zcode-part-editor-form"},yT={class:"zcode-form-field"},bT=["placeholder"],xT={class:"zcode-form-field"},kT=["placeholder"],ET={class:"zcode-part-editor-actions"},wT={class:"zcode-part-editor-header"},ST={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},CT=["aria-label"],NT={class:"zcode-part-editor-form"},vT={class:"zcode-part-editor-topbar"},TT={class:"zcode-part-editor-topfields"},zT={class:"zcode-form-field"},MT={class:"zcode-form-field"},AT=["placeholder"],IT={class:"zcode-part-editor-main"},_T={class:"zcode-part-editor-pane zcode-part-editor-pane--code"},OT={class:"zcode-part-editor-pane-header"},DT=["aria-label"],PT=["aria-selected"],RT=["aria-selected"],LT=["aria-selected"],$T={class:"zcode-part-editor-pane-header-actions"},VT={key:0,class:"zcode-css-warning-compact"},BT={class:"zcode-css-warning-compact-text"},FT=["title"],jT={key:1,class:"zcode-checkbox-label zcode-checkbox-label-inline"},HT=["title"],UT={class:"zcode-part-editor-pane-body"},WT={key:0,class:"zcode-slots-config zcode-slots-config-in-pane"},qT={class:"zcode-slot-config-header"},GT={class:"zcode-slot-config-title"},KT=["onClick"],JT={class:"zcode-slot-config-body"},XT={class:"zcode-checkbox-group"},YT=["onUpdate:modelValue","placeholder"],QT=["checked","onChange"],ZT={key:0,class:"zcode-slot-add-section"},ez={class:"zcode-slot-add-controls"},tz={value:""},nz=["value"],oz=["disabled"],rz={class:"zcode-part-editor-pane zcode-part-editor-pane--side"},iz=["aria-label"],sz=["aria-selected"],az=["aria-selected"],lz={class:"zcode-part-editor-pane-body"},cz=["innerHTML"],dz={class:"zcode-part-editor-preview-hint"},uz={class:"zcode-edit-panel-preview-heading"},fz={class:"zcode-edit-panel-preview-desc"},pz={class:"zcode-edit-panel-preview-wrap"},hz={key:1,class:"zcode-edit-panel-preview-empty"},mz={class:"zcode-part-editor-actions"},gz={class:"zcode-preview-modal-header"},yz={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},bz=["innerHTML"],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-warning-content"},Cz={class:"zcode-warning-text"},Nz={class:"zcode-warning-list"},vz={class:"zcode-css-warning-modal-footer"},Tz={class:"zcode-checkbox-label",style:{"margin-bottom":"12px"}},zz={class:"zcode-help-modal-header"},Mz={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},Az=["aria-label"],Iz={class:"zcode-help-modal-body"},_z={class:"zcode-help-section"},Oz={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Dz={class:"zcode-help-section-item"},Pz={class:"zcode-help-section"},Rz={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Lz={class:"zcode-help-section-item"},$z={class:"zcode-help-section"},Vz={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Bz={class:"zcode-help-section-item"},Fz={class:"zcode-help-modal-header"},jz={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},Hz=["aria-label"],Uz={class:"zcode-help-modal-body"},Wz={class:"zcode-help-table"},qz={class:"zcode-help-section"},Gz={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Kz={role:"list",class:"zcode-help-section-list"},Jz=["innerHTML"],Xz={role:"listitem",class:"zcode-help-section-item"},Yz={role:"listitem",class:"zcode-help-section-item"},Qz=s.defineComponent({__name:"PartsManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(n,{expose:e}){const{t}=Vt(),o=n,r=s.ref(!1),i=s.ref(ob("enableTemplateSuggestions",!1)),a=s.ref(!1),l=s.ref(!1),c=s.ref(!1),d=s.ref(rb()),u=s.ref("html"),f=s.ref("preview"),p=s.ref(""),h=s.ref(""),m={common:"zcode-css-style-parts-manager-preview-common",individual:"zcode-css-style-parts-manager-preview-individual",special:"zcode-css-style-parts-manager-preview-special"},g=new Map,y=s.computed(()=>B.value==="common"?o.cmsData.css?.common??"":B.value==="individual"?o.cmsData.css?.individual??"":o.cmsData.css?.special??"");function x(F){["common","individual","special"].forEach(le=>{const fe=F[le];if(!fe||!fe.trim()){const Qe=g.get(le);Qe&&(Qe.remove(),g.delete(le));return}let _e=g.get(le);_e||(_e=document.createElement("style"),_e.id=m[le],_e.setAttribute("data-zcode-css","true"),_e.setAttribute("data-zcode-css-parts-preview","true"),_e.setAttribute("data-zcode-css-category",le),_e.parentNode||document.head.appendChild(_e),g.set(le,_e)),_e.textContent=fe})}function C(){g.forEach(F=>{F.remove()}),g.clear()}function E(){a.value=!0}function v(){a.value=!1}function A(){(B.value==="common"||B.value==="individual"||B.value==="special")&&(l.value=!0)}function M(){l.value=!1,ib(d.value)}s.watch(i,F=>{Ea({enableTemplateSuggestions:F})});const k=s.computed(()=>o.config?.categoryOrder||"common"),w=s.computed(()=>{const F=[],j=o.cmsData.parts.special.length>0;return k.value==="individual"?(F.push("individual","common"),j&&F.push("special")):k.value==="special"?(j&&F.push("special"),F.push("common","individual")):(F.push("common","individual"),j&&F.push("special")),F}),{reorderSourcePart:b,handleReorderClick:R,activeCategory:B,editingType:O,editingPart:D,editingLevel:P,isCreatingNew:q,groupedPartsByType:W,startCreating:V,startEditingType:G,startEditingPart:J,addPartToType:oe,saveType:ne,savePart:X,deletePart:Z,checkTypeUsage:Y,cancelEditingType:te,cancelEditingPart:de,getPartPreviewHtml:me,createTempComponentFromType:Me,addPartSlot:Le,removePartSlot:N,updatePartSlotAllowedParts:L,getAvailableSlotsForPart:$,extractSlotsFromTemplate:S,reorderSourceType:K,startReorderType:z,deletePartType:U}=qN(o.cmsData),ie=s.ref(null);s.watch(()=>D.value,F=>{if(!F){ie.value=null;return}const j=Me(F.type,F.part);ie.value=s.reactive({...j,type:F.type.type})},{deep:!0});const Se=s.computed(()=>{const F=D.value,j=ie.value;return!F||!j?[]:Hh(F.part,j)});function ve(F){const j=ie.value;j&&(j[F.fieldName]=F.currentValue)}o.config?.categoryOrder==="individual"&&(B.value="individual");const T=s.computed(()=>(P?.value??P)==="part"&&!!D.value);s.watch(()=>T.value,F=>{if(!F){C();return}s.nextTick(()=>{const j=y.value;h.value=j,p.value=j,x({common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special})})},{immediate:!0}),s.watch(()=>B.value,()=>{T.value&&s.nextTick(()=>{const F=y.value;h.value=F,p.value=F})}),s.watch([()=>p.value,()=>T.value,()=>B.value],([F,j,le])=>{j&&s.nextTick(()=>{const fe={common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special};le==="common"?fe.common=F??"":le==="individual"?fe.individual=F??"":fe.special=F??"",x(fe)})});async function I(){await X(),!D.value&&o.cmsData.css&&(B.value==="common"?o.cmsData.css.common=p.value:B.value==="individual"?o.cmsData.css.individual=p.value:o.cmsData.css.special=p.value,h.value=p.value)}function Q(){p.value=h.value,C(),r.value=!1,de()}s.onBeforeUnmount(()=>{C()}),s.watch(()=>D.value,F=>{F&&(u.value="html")}),s.watch(()=>u.value,F=>{F==="css"&&T.value&&(B.value==="common"||B.value==="individual"||B.value==="special")&&!d.value&&s.nextTick(()=>{A()})}),e({activeCategory:B});async function ge(){await ne()}const Te=s.computed(()=>D.value?$(D.value.partIndex):[]),ye=s.computed(()=>{if(!D.value)return!1;const F=D.value.part.body,j=F?S(F).length>0:!1,le=D.value.part.slots&&Object.keys(D.value.part.slots).length>0;return j||le});s.watch([()=>ye.value,()=>u.value],([F,j])=>{!F&&j==="slots"&&(u.value="html")});const H=s.ref(""),ee=()=>{!H.value||!D.value||(Le(D.value.partIndex,H.value),H.value="")};s.watch(()=>D.value?.part.body,()=>{H.value=""});const ze=s.computed(()=>{const F=[],j=o.cmsData.parts;return[...j.common,...j.individual,...j.special||[]].forEach(fe=>{fe.parts.forEach(_e=>{F.push({id:_e.id,title:_e.title,typeName:fe.type,description:_e.description})})}),F.sort((fe,_e)=>fe.typeName!==_e.typeName?fe.typeName.localeCompare(_e.typeName):fe.title.localeCompare(_e.title))}),Pe=s.ref({}),dt=F=>{const j=Pe.value[F]||"";if(!j)return ze.value;const le=j.toLowerCase();return ze.value.filter(fe=>fe.title.toLowerCase().includes(le)||fe.typeName.toLowerCase().includes(le))},Xt=F=>{if(!D.value)return[];const j=D.value.part.slots?.[F];return j?j.allowedParts||[]:[]},Ot=(F,j,le)=>{if(!D.value)return;const fe=le.target.checked,Qe=D.value.part.slots?.[F]?.allowedParts||[];let gn;fe?gn=[...Qe,j]:gn=Qe.filter(Kr=>Kr!==j),L(D.value.partIndex,F,gn)};function $t(F,j){const le=["zcode-part-item"];return b.value&&b.value.type===F.type&&b.value.partIndex===j&&le.push("zcode-reorder-source"),le.join(" ")}function _n(F){const j=F._partIndex,le=j!=null,fe=le&&j!==void 0?j+1:0,_e=F.parts.length;if(le&&_e>1){if(!confirm(t("partsManager.deletePartConfirm",{number:fe})))return}else{const Qe=Y(F.type);if(Qe.length>0){if(!confirm(t("partsManager.deleteTypeWithUsagesConfirm",{type:F.type,count:Qe.length})))return}else if(!confirm(t("partsManager.deleteTypeConfirm")))return}Z(F)}return(F,j)=>(s.openBlock(),s.createElementBlock("div",Vv,[s.createElementVNode("div",Bv,[s.createElementVNode("div",Fv,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(w.value,le=>(s.openBlock(),s.createElementBlock("button",{key:le,class:s.normalizeClass([{active:s.unref(B)===le},"zcode-category-tab"]),onClick:fe=>B.value=le},s.toDisplayString(le==="common"?F.$t("dataViewer.common"):le==="individual"?F.$t("dataViewer.individual"):F.$t("dataViewer.special")),11,jv))),128)),s.createElementVNode("button",{class:"zcode-help-btn",title:F.$t("dataViewer.categoryInfo.title"),onClick:j[0]||(j[0]=le=>c.value=!0)},[s.createVNode(s.unref(Dn),{size:14})],8,Hv)]),s.createElementVNode("div",Uv,[s.createElementVNode("button",{class:"zcode-btn-primary zcode-parts-new-btn",onClick:j[1]||(j[1]=(...le)=>s.unref(V)&&s.unref(V)(...le))},[s.createVNode(s.unref(ao),{size:14}),s.createElementVNode("span",null,s.toDisplayString(F.$t("partsManager.createType")),1)])])]),s.createElementVNode("div",Wv,[s.createElementVNode("div",qv,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(W),le=>(s.openBlock(),s.createElementBlock("div",{key:le.type,class:"zcode-part-type-group"},[s.createElementVNode("div",Gv,[s.createTextVNode(s.toDisplayString(le.type)+" ",1),s.createElementVNode("div",Kv,[le.parts.length>0?(s.openBlock(),s.createElementBlock("button",{key:0,class:"zcode-part-type-edit-btn",title:F.$t("partsManager.editTypeButton"),onClick:s.withModifiers(fe=>s.unref(G)(le.parts[0]),["stop"])},[s.createVNode(s.unref(Us),{size:14})],8,Jv)):s.createCommentVNode("",!0),s.createElementVNode("button",{class:s.normalizeClass(["zcode-action-btn",{active:s.unref(K)===le.type}]),title:F.$t("partsManager.reorderType"),onClick:s.withModifiers(fe=>s.unref(z)(le.type),["stop"])},[s.createVNode(s.unref(Zo),{size:14})],10,Xv),s.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:F.$t("partsManager.deleteTypeButton"),onClick:s.withModifiers(fe=>s.unref(U)(le.type),["stop"])},[s.createVNode(s.unref(Pn),{size:14})],8,Yv)])]),s.createElementVNode("div",Qv,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(le.parts,(fe,_e)=>(s.openBlock(),s.createElementBlock("div",{key:`${le.type}-${_e}`,class:s.normalizeClass($t(fe,fe._partIndex??0)),onClick:Qe=>s.unref(J)(fe,fe._partIndex??0)},[s.unref(b)&&s.unref(b).type===fe.type&&s.unref(b).partIndex===(fe._partIndex??0)?(s.openBlock(),s.createElementBlock("div",eT,s.toDisplayString(F.$t("partsManager.source")),1)):s.createCommentVNode("",!0),s.createElementVNode("div",tT,[s.createElementVNode("span",nT,s.toDisplayString(fe._displayPart?.title||fe.type),1),s.createElementVNode("div",oT,[s.createElementVNode("button",{class:"zcode-action-btn",title:F.$t("partsManager.editPartButton"),onClick:s.withModifiers(Qe=>s.unref(J)(fe,fe._partIndex??0),["stop"])},[s.createVNode(s.unref(Us),{size:14})],8,rT),s.createElementVNode("button",{class:s.normalizeClass(["zcode-action-btn",{active:s.unref(b)?.type===fe.type&&s.unref(b)?.partIndex===(fe._partIndex??0)}]),title:F.$t("partsManager.reorderPart"),onClick:s.withModifiers(Qe=>s.unref(R)(fe,fe._partIndex??0),["stop"])},[s.createVNode(s.unref(Zo),{size:14})],10,iT),s.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:F.$t("partsManager.deletePartButton"),onClick:s.withModifiers(Qe=>_n({...fe,_partIndex:fe._partIndex??0}),["stop"])},[s.createVNode(s.unref(Pn),{size:14})],8,sT)])]),s.createElementVNode("div",aT,[s.createElementVNode("div",{class:s.normalizeClass(["zcode-part-description",{"zcode-description-empty":!fe._displayPart?.description&&!fe.description}])},s.toDisplayString(fe._displayPart?.description||fe.description||F.$t("partsManager.noDescription")),3),s.createElementVNode("div",lT,s.toDisplayString(F.$t("partsManager.partNumber",{current:(fe._partIndex??0)+1,total:fe.parts.length})),1),fe._displayPart?(s.openBlock(),s.createElementBlock("div",cT,[s.createElementVNode("div",{class:"zcode-part-preview-content",innerHTML:s.unref(me)(fe,fe._displayPart)},null,8,dT)])):s.createCommentVNode("",!0)])],10,Zv))),128)),le.parts.length>0?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-part-item zcode-part-item-add",onClick:s.withModifiers(fe=>s.unref(oe)(le.parts[0]),["stop"])},[s.createElementVNode("div",fT,[s.createVNode(s.unref(ao),{size:20}),s.createElementVNode("span",null,s.toDisplayString(F.$t("partsManager.addPart")),1)])],8,uT)):s.createCommentVNode("",!0)])]))),128))]),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[s.unref(O)&&(s.unref(P)==="type"||s.unref(q))?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:j[7]||(j[7]=s.withModifiers((...le)=>s.unref(te)&&s.unref(te)(...le),["self"]))},[s.createElementVNode("div",{class:"zcode-part-modal-content",onClick:j[6]||(j[6]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",pT,[s.createElementVNode("div",hT,s.toDisplayString(s.unref(q)?F.$t("partsManager.createType"):F.$t("partsManager.editType")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":F.$t("common.close"),onClick:j[2]||(j[2]=(...le)=>s.unref(te)&&s.unref(te)(...le))},[s.createVNode(s.unref(Ye),{size:18})],8,mT)]),s.createElementVNode("div",gT,[s.createElementVNode("div",yT,[s.createElementVNode("label",null,[s.createTextVNode(s.toDisplayString(F.$t("partsManager.typeName"))+" ",1),j[30]||(j[30]=s.createElementVNode("span",{class:"zcode-required"},"*",-1))]),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":j[3]||(j[3]=le=>s.unref(O).type=le),type:"text",placeholder:F.$t("partsManager.typeNamePlaceholder"),class:"zcode-text-input",required:""},null,8,bT),[[s.vModelText,s.unref(O).type]])]),s.createElementVNode("div",xT,[s.createElementVNode("label",null,s.toDisplayString(F.$t("partsManager.typeDescription")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":j[4]||(j[4]=le=>s.unref(O).description=le),type:"text",placeholder:F.$t("partsManager.typeDescriptionPlaceholder"),class:"zcode-text-input"},null,8,kT),[[s.vModelText,s.unref(O).description]])])]),s.createElementVNode("div",ET,[s.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:ge},[s.createVNode(s.unref(er),{size:16}),s.createElementVNode("span",null,s.toDisplayString(F.$t("common.confirm")),1)]),s.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:j[5]||(j[5]=(...le)=>s.unref(te)&&s.unref(te)(...le))},[s.createVNode(s.unref(Ye),{size:16}),s.createElementVNode("span",null,s.toDisplayString(F.$t("common.cancel")),1)])])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[s.unref(D)&&s.unref(P)==="part"?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:s.withModifiers(Q,["self"])},[s.createElementVNode("div",{class:"zcode-part-modal-content",onClick:j[20]||(j[20]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",wT,[s.createElementVNode("div",ST,s.toDisplayString(F.$t("partsManager.editPart",{title:s.unref(D).part.title})),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":F.$t("common.close"),onClick:Q},[s.createVNode(s.unref(Ye),{size:18})],8,CT)]),s.createElementVNode("div",NT,[s.createElementVNode("div",vT,[s.createElementVNode("div",TT,[s.createElementVNode("div",zT,[s.createElementVNode("label",null,[s.createTextVNode(s.toDisplayString(F.$t("partsManager.partTitle"))+" ",1),j[31]||(j[31]=s.createElementVNode("span",{class:"zcode-required"},"*",-1))]),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":j[8]||(j[8]=le=>s.unref(D).part.title=le),type:"text",class:"zcode-text-input",required:""},null,512),[[s.vModelText,s.unref(D).part.title]])]),s.createElementVNode("div",MT,[s.createElementVNode("label",null,s.toDisplayString(F.$t("partsManager.partDescription")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":j[9]||(j[9]=le=>s.unref(D).part.description=le),type:"text",class:"zcode-text-input",placeholder:F.$t("partsManager.partDescriptionPlaceholder")},null,8,AT),[[s.vModelText,s.unref(D).part.description]])])])]),s.createElementVNode("div",IT,[s.createElementVNode("div",_T,[s.createElementVNode("div",OT,[s.createElementVNode("div",{class:"zcode-template-tabs",role:"tablist","aria-label":F.$t("partsManager.codeEdit")},[s.createElementVNode("button",{type:"button",class:s.normalizeClass(["zcode-template-tab",{active:u.value==="html"}]),role:"tab","aria-selected":u.value==="html",onClick:j[10]||(j[10]=le=>u.value="html")}," HTML ",10,PT),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["zcode-template-tab",{active:u.value==="css"}]),role:"tab","aria-selected":u.value==="css",onClick:j[11]||(j[11]=le=>u.value="css")}," CSS ",10,RT),ye.value?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:s.normalizeClass(["zcode-template-tab",{active:u.value==="slots"}]),role:"tab","aria-selected":u.value==="slots",onClick:j[12]||(j[12]=le=>u.value="slots")},s.toDisplayString(F.$t("partsManager.slotSettings")),11,LT)):s.createCommentVNode("",!0)],8,DT),s.createElementVNode("div",$T,[u.value==="css"?(s.openBlock(),s.createElementBlock("div",VT,[s.createVNode(s.unref(Hs),{size:14,class:"zcode-css-warning-compact-icon"}),s.createElementVNode("span",BT,s.toDisplayString(F.$t("partsManager.cssEditInfo")),1),s.createElementVNode("button",{class:"zcode-help-btn",type:"button",title:F.$t("partsManager.cssEditWarning"),onClick:A},[s.createVNode(s.unref(Dn),{size:14})],8,FT)])):s.createCommentVNode("",!0),u.value==="html"?(s.openBlock(),s.createElementBlock("label",jT,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":j[13]||(j[13]=le=>i.value=le),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[s.vModelCheckbox,i.value]]),s.createElementVNode("span",null,s.toDisplayString(F.$t("partsManager.templateSuggestions")),1)])):s.createCommentVNode("",!0),u.value==="html"?(s.openBlock(),s.createElementBlock("button",{key:2,class:"zcode-help-btn",type:"button",title:F.$t("partsManager.templateHelpButton"),onClick:E},[s.createVNode(s.unref(Dn),{size:16})],8,HT)):s.createCommentVNode("",!0)])]),s.createElementVNode("div",UT,[u.value==="slots"?(s.openBlock(),s.createElementBlock("div",WT,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(D).part.slots||{},(le,fe)=>(s.openBlock(),s.createElementBlock("div",{key:`part-${s.unref(D).partIndex}-${fe}`,class:"zcode-slot-config-item"},[s.createElementVNode("div",qT,[s.createElementVNode("div",GT,s.toDisplayString(F.$t("partsManager.slot"))+": "+s.toDisplayString(fe),1),s.createElementVNode("button",{class:"zcode-btn-small",onClick:_e=>s.unref(N)(s.unref(D).partIndex,fe)},[s.createVNode(s.unref(Pn),{size:12})],8,KT)]),s.createElementVNode("div",JT,[s.createElementVNode("label",null,s.toDisplayString(F.$t("partsManager.allowedParts")),1),s.createElementVNode("div",XT,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":_e=>Pe.value[fe]=_e,type:"text",placeholder:F.$t("partsManager.searchParts"),class:"zcode-text-input",style:{"margin-bottom":"8px"}},null,8,YT),[[s.vModelText,Pe.value[fe]]]),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(dt(fe),_e=>(s.openBlock(),s.createElementBlock("label",{key:`allowed-${fe}-${_e.typeName}-${_e.id}`,class:"zcode-checkbox-item"},[s.createElementVNode("input",{type:"checkbox",checked:Xt(fe).includes(_e.id),class:"zcode-checkbox",onChange:Qe=>Ot(fe,_e.id,Qe)},null,40,QT),s.createElementVNode("span",null,s.toDisplayString(_e.title)+" ("+s.toDisplayString(_e.typeName)+")",1)]))),128))])])]))),128)),Te.value.length>0?(s.openBlock(),s.createElementBlock("div",ZT,[s.createElementVNode("label",null,s.toDisplayString(F.$t("partsManager.addSlot")),1),s.createElementVNode("div",ez,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":j[14]||(j[14]=le=>H.value=le),class:"zcode-select-input"},[s.createElementVNode("option",tz,s.toDisplayString(F.$t("partsManager.selectSlot")),1),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(Te.value,le=>(s.openBlock(),s.createElementBlock("option",{key:le,value:le},s.toDisplayString(le==="default"?F.$t("partsManager.defaultSlot"):le),9,nz))),128))],512),[[s.vModelSelect,H.value]]),s.createElementVNode("button",{disabled:!H.value,class:"zcode-btn-secondary",onClick:ee},[s.createVNode(s.unref(ao),{size:16}),s.createElementVNode("span",null,s.toDisplayString(F.$t("common.add")),1)],8,oz)])])):s.createCommentVNode("",!0)])):u.value==="html"?(s.openBlock(),s.createBlock(rm,{key:1,modelValue:s.unref(D).part.body,"onUpdate:modelValue":j[15]||(j[15]=le=>s.unref(D).part.body=le),language:"html",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":i.value,class:"zcode-monaco-editor"},null,8,["modelValue","enable-suggestions"])):(s.openBlock(),s.createBlock(rm,{key:2,modelValue:p.value,"onUpdate:modelValue":j[16]||(j[16]=le=>p.value=le),language:"css",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":!0,class:"zcode-monaco-editor"},null,8,["modelValue"]))])]),s.createElementVNode("div",rz,[s.createElementVNode("div",{class:"zcode-part-editor-side-tabs",role:"tablist","aria-label":F.$t("partsManager.preview")},[s.createElementVNode("button",{type:"button",class:s.normalizeClass(["zcode-part-editor-side-tab",{active:f.value==="preview"}]),role:"tab","aria-selected":f.value==="preview",onClick:j[17]||(j[17]=le=>f.value="preview")},s.toDisplayString(F.$t("partsManager.displayPreview")),11,sz),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["zcode-part-editor-side-tab",{active:f.value==="editPanel"}]),role:"tab","aria-selected":f.value==="editPanel",onClick:j[18]||(j[18]=le=>f.value="editPanel")},s.toDisplayString(F.$t("partsManager.editPanelPreview")),11,az)],8,iz),s.createElementVNode("div",lz,[f.value==="preview"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createElementVNode("div",{class:"zcode-part-editor-preview-tab",onClick:j[19]||(j[19]=le=>r.value=!0),innerHTML:s.unref(me)(s.unref(D).type,s.unref(D).part)},null,8,cz),s.createElementVNode("div",dz,s.toDisplayString(F.$t("partsManager.clickToEnlarge")),1)],64)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createElementVNode("div",uz,s.toDisplayString(F.$t("partsManager.editPanelPreview")),1),s.createElementVNode("div",fz,s.toDisplayString(F.$t("partsManager.editPanelPreviewDesc")),1),s.createElementVNode("div",pz,[ie.value?(s.openBlock(),s.createBlock(Fh,{key:0,"editing-component":ie.value,"editing-available-fields":Se.value,"current-mode":"edit","can-select-parent":!1,"images-common":n.cmsData.images?.common??[],"images-individual":n.cmsData.images?.individual??[],"images-special":n.cmsData.images?.special??[],"preview-mode":!0,onSaveField:ve,onClose:()=>{},onAddImage:()=>{},onDeleteImage:()=>{}},null,8,["editing-component","editing-available-fields","images-common","images-individual","images-special"])):(s.openBlock(),s.createElementBlock("div",hz,s.toDisplayString(F.$t("partsManager.editPanelPreviewNoFields")),1))])],64))])])])]),s.createElementVNode("div",mz,[s.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:I},[s.createVNode(s.unref(er),{size:16}),s.createElementVNode("span",null,s.toDisplayString(F.$t("common.confirm")),1)]),s.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:Q},[s.createVNode(s.unref(Ye),{size:16}),s.createElementVNode("span",null,s.toDisplayString(F.$t("common.cancel")),1)])])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[r.value&&s.unref(D)?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:j[23]||(j[23]=le=>r.value=!1)},[s.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:j[22]||(j[22]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",gz,[s.createElementVNode("div",yz,s.toDisplayString(F.$t("partsManager.preview"))+" "+s.toDisplayString(s.unref(D).part.title),1),s.createElementVNode("button",{class:"zcode-close-btn",onClick:j[21]||(j[21]=le=>r.value=!1)},[s.createVNode(s.unref(Ye),{size:18})])]),s.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:s.unref(me)(s.unref(D).type,s.unref(D).part)},null,8,bz)])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[l.value&&(s.unref(B)==="common"||s.unref(B)==="individual"||s.unref(B)==="special")?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:s.withModifiers(M,["self"])},[s.createElementVNode("div",{class:"zcode-help-modal zcode-css-warning-modal",onClick:j[25]||(j[25]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",xz,[s.createElementVNode("div",kz,[s.createVNode(s.unref(Ec),{size:20,class:"zcode-css-warning-modal-title-icon"}),s.createElementVNode("span",null,s.toDisplayString(F.$t("partsManager.cssEditWarning")),1)]),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":F.$t("common.close"),onClick:M},[s.createVNode(s.unref(Ye),{size:20})],8,Ez)]),s.createElementVNode("div",wz,[s.createElementVNode("div",Sz,[s.createElementVNode("div",Cz,[s.createElementVNode("ul",Nz,[s.createElementVNode("li",null,[s.unref(B)==="common"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createTextVNode(s.toDisplayString(F.$t("partsManager.cssEditWarningMessageCommon")),1)],64)):s.unref(B)==="individual"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createTextVNode(s.toDisplayString(F.$t("partsManager.cssEditWarningMessageIndividual")),1)],64)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:2},[s.createTextVNode(s.toDisplayString(F.$t("partsManager.cssEditWarningMessageSpecial")),1)],64))])])])])]),s.createElementVNode("div",vz,[s.createElementVNode("label",Tz,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":j[24]||(j[24]=le=>d.value=le),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[s.vModelCheckbox,d.value]]),s.createElementVNode("span",null,s.toDisplayString(F.$t("partsManager.dontShowAgain")),1)]),s.createElementVNode("button",{class:"zcode-btn-primary",onClick:M},s.toDisplayString(F.$t("partsManager.understood")),1)])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[c.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:j[28]||(j[28]=s.withModifiers(le=>c.value=!1,["self"]))},[s.createElementVNode("div",{class:"zcode-help-modal",onClick:j[27]||(j[27]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",zz,[s.createElementVNode("div",Mz,[s.createVNode(s.unref(Hs),{size:20,class:"zcode-css-warning-modal-title-icon"}),s.createElementVNode("span",null,s.toDisplayString(F.$t("dataViewer.categoryInfo.title")),1)]),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":F.$t("common.close"),onClick:j[26]||(j[26]=le=>c.value=!1)},[s.createVNode(s.unref(Ye),{size:18})],8,Az)]),s.createElementVNode("div",Iz,[s.createElementVNode("div",_z,[s.createElementVNode("div",Oz,s.toDisplayString(F.$t("dataViewer.categoryInfo.common.title")),1),s.createElementVNode("div",Dz,s.toDisplayString(F.$t("dataViewer.categoryInfo.common.description")),1)]),s.createElementVNode("div",Pz,[s.createElementVNode("div",Rz,s.toDisplayString(F.$t("dataViewer.categoryInfo.individual.title")),1),s.createElementVNode("div",Lz,s.toDisplayString(F.$t("dataViewer.categoryInfo.individual.description")),1)]),s.createElementVNode("div",$z,[s.createElementVNode("div",Vz,s.toDisplayString(F.$t("dataViewer.categoryInfo.special.title")),1),s.createElementVNode("div",Bz,s.toDisplayString(F.$t("dataViewer.categoryInfo.special.description")),1)])])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[a.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:v},[s.createElementVNode("div",{class:"zcode-help-modal",onClick:j[29]||(j[29]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",Fz,[s.createElementVNode("div",jz,s.toDisplayString(F.$t("partsManager.templateHelpTitle")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":F.$t("common.close"),onClick:v},[s.createVNode(s.unref(Ye),{size:20})],8,Hz)]),s.createElementVNode("div",Uz,[s.createElementVNode("table",Wz,[s.createElementVNode("thead",null,[s.createElementVNode("tr",null,[s.createElementVNode("th",null,s.toDisplayString(F.$t("partsManager.syntax")),1),s.createElementVNode("th",null,s.toDisplayString(F.$t("partsManager.description")),1),s.createElementVNode("th",null,s.toDisplayString(F.$t("partsManager.example")),1)])]),s.createElementVNode("tbody",null,[s.createElementVNode("tr",null,[j[32]||(j[32]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$field:default}")],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.textField")),1),j[33]||(j[33]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$title:タイトル}")],-1))]),s.createElementVNode("tr",null,[j[34]||(j[34]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$field:default:rich}")],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.richText")),1),j[35]||(j[35]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$content:本文:rich}")],-1))]),s.createElementVNode("tr",null,[j[36]||(j[36]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$field:default:textarea}")],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.textarea")),1),j[37]||(j[37]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$description:説明:textarea}")],-1))]),s.createElementVNode("tr",null,[j[38]||(j[38]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$field:default:image}")],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.image")),1),j[39]||(j[39]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$hero:default.jpg:image}")],-1))]),s.createElementVNode("tr",null,[j[40]||(j[40]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($field:option1|option2)")],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.radio")),1),j[41]||(j[41]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($color:red|blue|green)")],-1))]),s.createElementVNode("tr",null,[j[42]||(j[42]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($field:option1,option2)")],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.checkbox")),1),j[43]||(j[43]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($features:fast,secure)")],-1))]),s.createElementVNode("tr",null,[j[44]||(j[44]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($field@:option1|option2)")],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.selectSingle")),1),j[45]||(j[45]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($size@:S|M|L)")],-1))]),s.createElementVNode("tr",null,[j[46]||(j[46]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($field@:option1,option2)")],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.selectMultiple")),1),j[47]||(j[47]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($tags@:tag1,tag2,tag3)")],-1))]),s.createElementVNode("tr",null,[j[48]||(j[48]=s.createElementVNode("td",null,[s.createElementVNode("code",null,'z-if="show_field"')],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.conditional")),1),j[49]||(j[49]=s.createElementVNode("td",null,[s.createElementVNode("code",null,'<div z-if="show_content">...</div>')],-1))]),s.createElementVNode("tr",null,[j[50]||(j[50]=s.createElementVNode("td",null,[s.createElementVNode("code",null,'z-slot="name"')],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.slot")),1),j[51]||(j[51]=s.createElementVNode("td",null,[s.createElementVNode("code",null,'<div z-slot="content"></div>')],-1))])])]),s.createElementVNode("div",qz,[s.createElementVNode("div",Gz,s.toDisplayString(F.$t("partsManager.templateHelp.note")),1),s.createElementVNode("div",Kz,[s.createElementVNode("div",{role:"listitem",class:"zcode-help-section-item",innerHTML:F.$t("partsManager.templateHelp.suggestionNote")},null,8,Jz),s.createElementVNode("div",Xz,s.toDisplayString(F.$t("partsManager.templateHelp.fieldNameNote")),1),s.createElementVNode("div",Yz,s.toDisplayString(F.$t("partsManager.templateHelp.defaultValueNote")),1)])])])])])):s.createCommentVNode("",!0)]))])]))}});function Zz(n){const e=s.ref("common"),t=s.ref(null),o=s.ref(null),r=s.ref(!1),i=s.ref(null),a=s.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((C,E)=>{const v=new FileReader;v.onload=A=>{const M=A.target?.result,k={id:`img-${Date.now()}`,name:x.name,url:M,mimeType:x.type,needsUpload:!0};e.value==="common"?n.images.common.push(k):e.value==="individual"?n.images.individual.push(k):n.images.special.push(k),C(k)},v.onerror=E,v.readAsDataURL(x)})}function d(x){rc(x,n.page).forEach(M=>{Object.keys(M.component).forEach(k=>{k.includes("image")&&M.component[k]===x&&(M.component[k]="")})});const E=n.images.common.findIndex(M=>M.id===x);E!==-1&&n.images.common.splice(E,1);const v=n.images.individual.findIndex(M=>M.id===x);v!==-1&&n.images.individual.splice(v,1);const A=n.images.special.findIndex(M=>M.id===x);A!==-1&&n.images.special.splice(A,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 C=x.findIndex(E=>E.id===o.value.id);C!==-1&&(x[C]=o.value),o.value=null,r.value=!1}function p(){o.value=null,r.value=!1}function h(x){return rc(x,n.page)}function m(x){if(!i.value){i.value=x;return}if(i.value===x){y();return}g(i.value,x),y()}function g(x,C){let E;e.value==="common"?E=n.images.common:e.value==="individual"?E=n.images.individual:E=n.images.special;const v=E.findIndex(k=>k.id===x),A=E.findIndex(k=>k.id===C);if(v===-1||A===-1)return;const[M]=E.splice(v,1);E.splice(A,0,M)}function y(){i.value=null}return{reorderSourceImage:i,handleReorderClick:m,cancelReorder:y,activeCategory:e,selectedImage:t,editingImage:o,isCreatingNew:r,currentImages:a,selectImage:l,addImage:c,deleteImage:d,startEditing:u,saveImage:f,cancelEditing:p,checkImageUsage:h}}const eM={class:"zcode-images-manager"},tM={class:"zcode-images-category-tabs"},nM={class:"zcode-images-category-tab-group"},oM=["onClick"],rM=["title"],iM={class:"zcode-images-add-wrapper"},sM={class:"zcode-images-manager-content"},aM={class:"zcode-images-grid"},lM=["onClick"],cM={key:0,class:"zcode-reorder-source-indicator"},dM=["src","alt"],uM={class:"zcode-image-item-overlay"},fM={class:"zcode-image-item-actions"},pM=["title","onClick"],hM=["title","onClick"],mM={class:"zcode-image-item-name"},gM={class:"zcode-image-editor-header"},yM={class:"zcode-image-editor-header-title",role:"heading","aria-level":"4"},bM=["aria-label"],xM={class:"zcode-image-editor-form"},kM={class:"zcode-image-preview-large"},EM=["src","alt"],wM={class:"zcode-form-field"},SM={class:"zcode-form-field"},CM={class:"zcode-image-editor-actions"},NM={class:"zcode-help-modal-header"},vM={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},TM=["aria-label"],zM={class:"zcode-help-modal-body"},MM={class:"zcode-help-section"},AM={class:"zcode-help-section-title",role:"heading","aria-level":"4"},IM={class:"zcode-help-section-item"},_M={class:"zcode-help-section"},OM={class:"zcode-help-section-title",role:"heading","aria-level":"4"},DM={class:"zcode-help-section-item"},PM={class:"zcode-help-section"},RM={class:"zcode-help-section-title",role:"heading","aria-level":"4"},LM={class:"zcode-help-section-item"},$M=s.defineComponent({__name:"ImagesManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(n,{expose:e}){const{t}=Vt(),o=n,r=s.ref(null),i=s.ref(!1),a=s.computed(()=>o.config?.categoryOrder||"common"),l=s.computed(()=>{const M=[],k=o.cmsData.images.special.length>0;return a.value==="individual"?(M.push("individual","common"),k&&M.push("special")):a.value==="special"?(k&&M.push("special"),M.push("common","individual")):(M.push("common","individual"),k&&M.push("special")),M}),{reorderSourceImage:c,handleReorderClick:d,activeCategory:u,editingImage:f,currentImages:p,addImage:h,deleteImage:m,startEditing:g,saveImage:y,cancelEditing:x,checkImageUsage:C}=Zz(o.cmsData);o.config?.categoryOrder==="individual"?u.value="individual":o.config?.categoryOrder==="special"&&(u.value="special"),e({activeCategory:u});async function E(M){const k=M.target,w=k.files?.[0];if(w)try{await h(w),k&&(k.value="")}catch(b){console.error("画像追加エラー:",b),alert(t("imagesManager.addImageFailed"))}}function v(M){const k=["zcode-image-item"];return c.value===M.id&&k.push("zcode-reorder-source"),k.join(" ")}function A(M){const k=C(M.id);if(k.length>0){if(!confirm(t("imagesManager.deleteImageWithUsagesConfirm",{count:k.length})))return}else if(!confirm(t("imagesManager.deleteImageConfirm")))return;m(M.id)}return(M,k)=>(s.openBlock(),s.createElementBlock("div",eM,[s.createElementVNode("div",tM,[s.createElementVNode("div",nM,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(l.value,w=>(s.openBlock(),s.createElementBlock("button",{key:w,class:s.normalizeClass([{active:s.unref(u)===w},"zcode-category-tab"]),onClick:b=>u.value=w},s.toDisplayString(w==="common"?M.$t("dataViewer.common"):w==="individual"?M.$t("dataViewer.individual"):M.$t("dataViewer.special")),11,oM))),128)),s.createElementVNode("button",{class:"zcode-help-btn",title:M.$t("dataViewer.categoryInfo.title"),onClick:k[0]||(k[0]=w=>i.value=!0)},[s.createVNode(s.unref(Dn),{size:14})],8,rM)]),s.createElementVNode("div",iM,[s.createElementVNode("input",{ref_key:"fileInput",ref:r,type:"file",accept:"image/*",style:{display:"none"},onChange:E},null,544),s.createElementVNode("button",{class:"zcode-btn-primary zcode-images-add-btn",onClick:k[1]||(k[1]=w=>r.value?.click())},[s.createVNode(s.unref(ao),{size:14}),s.createElementVNode("span",null,s.toDisplayString(M.$t("imagesManager.addImage")),1)])])]),s.createElementVNode("div",sM,[s.createElementVNode("div",aM,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(p),w=>(s.openBlock(),s.createElementBlock("div",{key:w.id,class:s.normalizeClass(v(w)),onClick:b=>s.unref(g)(w)},[s.unref(c)===w.id?(s.openBlock(),s.createElementBlock("div",cM,s.toDisplayString(M.$t("partsManager.source")),1)):s.createCommentVNode("",!0),s.createElementVNode("img",{src:w.url,alt:w.name},null,8,dM),s.createElementVNode("div",uM,[s.createElementVNode("div",fM,[s.createElementVNode("button",{class:s.normalizeClass(["zcode-action-btn",{active:s.unref(c)===w.id}]),title:M.$t("partsManager.reorderPart"),onClick:s.withModifiers(b=>s.unref(d)(w.id),["stop"])},[s.createVNode(s.unref(Zo),{size:16})],10,pM),s.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:M.$t("partsManager.deletePartButton"),onClick:s.withModifiers(b=>A(w),["stop"])},[s.createVNode(s.unref(Pn),{size:16})],8,hM)])]),s.createElementVNode("div",mM,s.toDisplayString(w.name),1)],10,lM))),128))])]),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[s.unref(f)?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:k[8]||(k[8]=s.withModifiers((...w)=>s.unref(x)&&s.unref(x)(...w),["self"]))},[s.createElementVNode("div",{class:"zcode-image-modal-content","data-edit-mode":"",onClick:k[7]||(k[7]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",gM,[s.createElementVNode("div",yM,s.toDisplayString(M.$t("imagesManager.editImage")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":M.$t("common.close"),onClick:k[2]||(k[2]=(...w)=>s.unref(x)&&s.unref(x)(...w))},[s.createVNode(s.unref(Ye),{size:18})],8,bM)]),s.createElementVNode("div",xM,[s.createElementVNode("div",kM,[s.createElementVNode("img",{src:s.unref(f).url,alt:s.unref(f).name,class:"zcode-image-preview-large-img"},null,8,EM)]),s.createElementVNode("div",wM,[s.createElementVNode("label",null,s.toDisplayString(M.$t("imagesManager.imageId")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":k[3]||(k[3]=w=>s.unref(f).id=w),type:"text",class:"zcode-text-input",disabled:""},null,512),[[s.vModelText,s.unref(f).id]])]),s.createElementVNode("div",SM,[s.createElementVNode("label",null,s.toDisplayString(M.$t("imagesManager.imageName")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":k[4]||(k[4]=w=>s.unref(f).name=w),type:"text",class:"zcode-text-input"},null,512),[[s.vModelText,s.unref(f).name]])]),s.createElementVNode("div",CM,[s.createElementVNode("button",{class:"zcode-btn-primary zcode-image-editor-actions-btn",onClick:k[5]||(k[5]=(...w)=>s.unref(y)&&s.unref(y)(...w))},[s.createVNode(s.unref(er),{size:16}),s.createElementVNode("span",null,s.toDisplayString(M.$t("common.confirm")),1)]),s.createElementVNode("button",{class:"zcode-btn-cancel zcode-image-editor-actions-btn",onClick:k[6]||(k[6]=(...w)=>s.unref(x)&&s.unref(x)(...w))},[s.createVNode(s.unref(Ye),{size:16}),s.createElementVNode("span",null,s.toDisplayString(M.$t("common.cancel")),1)])])])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[i.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:k[11]||(k[11]=s.withModifiers(w=>i.value=!1,["self"]))},[s.createElementVNode("div",{class:"zcode-help-modal",onClick:k[10]||(k[10]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",NM,[s.createElementVNode("div",vM,[s.createVNode(s.unref(Hs),{size:20,class:"zcode-css-warning-modal-title-icon"}),s.createElementVNode("span",null,s.toDisplayString(M.$t("dataViewer.categoryInfo.title")),1)]),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":M.$t("common.close"),onClick:k[9]||(k[9]=w=>i.value=!1)},[s.createVNode(s.unref(Ye),{size:18})],8,TM)]),s.createElementVNode("div",zM,[s.createElementVNode("div",MM,[s.createElementVNode("div",AM,s.toDisplayString(M.$t("dataViewer.categoryInfo.common.title")),1),s.createElementVNode("div",IM,s.toDisplayString(M.$t("dataViewer.categoryInfo.common.description")),1)]),s.createElementVNode("div",_M,[s.createElementVNode("div",OM,s.toDisplayString(M.$t("dataViewer.categoryInfo.individual.title")),1),s.createElementVNode("div",DM,s.toDisplayString(M.$t("dataViewer.categoryInfo.individual.description")),1)]),s.createElementVNode("div",PM,[s.createElementVNode("div",RM,s.toDisplayString(M.$t("dataViewer.categoryInfo.special.title")),1),s.createElementVNode("div",LM,s.toDisplayString(M.$t("dataViewer.categoryInfo.special.description")),1)])])])])):s.createCommentVNode("",!0)]))]))}}),VM={class:"zcode-data-viewer"},BM={class:"zcode-data-viewer-header"},FM={class:"zcode-data-viewer-content-tabs"},jM={class:"zcode-data-viewer-tabs"},HM=["onClick"],UM={class:"zcode-data-viewer-content"},WM={class:"zcode-data-viewer-display-wrapper"},qM={class:"zcode-data-viewer-display"},GM=["title"],KM=s.defineComponent({__name:"DataViewer",props:{cmsData:{type:Object},config:{type:Object}},setup(n,{expose:e}){const t=n,o=s.ref("page"),r=s.ref("json"),i=s.ref(!1),a=s.computed(()=>t.config?.categoryOrder||"common"),l=s.computed(()=>{const C=[],E=o.value==="parts"?t.cmsData.parts.special.length>0:t.cmsData.images.special.length>0;return a.value==="individual"?(C.push("individual","common"),E&&C.push("special")):a.value==="special"?(E&&C.push("special"),C.push("common","individual")):(C.push("common","individual"),E&&C.push("special")),C}),c=s.ref(t.config?.categoryOrder==="individual"?"individual":t.config?.categoryOrder==="special"?"special":"common"),{fullPageHtml:d}=gi(t.cmsData,!1),u=s.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=s.ref("");let p="";function h(){try{const C=u.value,E=JSON.stringify(C,null,2);if(E===p)return;f.value=E,p=E}catch{f.value=String(u.value),p=f.value}}function m(C){let E=C.replace(/\\\\/g,"\0").replace(/\\u([0-9a-fA-F]{4})/g,(v,A)=>String.fromCharCode(parseInt(A,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 g(C){if(!C)return"";const v=C.replace(/>\s+</g,"><").replace(/></g,`>
481
+ `},em=xv(Sv)(Zh),Cv={config:Ev},Nv=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,a){return a(i)},r)}};function tm(n,e){return Object.keys(e).forEach(function(t){e[t]instanceof Object&&n[t]&&Object.assign(e[t],tm(n[t],e[t]))}),Xh(Xh({},n),e)}var vv={type:"cancelation",msg:"operation is manually canceled"};function ic(n){var e=!1,t=new Promise(function(o,r){n.then(function(i){return e?r(vv):o(i)}),n.catch(r)});return t.cancel=function(){return e=!0},t}var Tv=["monaco"],zv=yv.create({config:bv,isInitialized:!1,resolve:null,reject:null,monaco:null}),nm=ZN(zv,2),qr=nm[0],Bs=nm[1];function Mv(n){var e=Cv.config(n),t=e.monaco,o=YN(e,Tv);Bs(function(r){return{config:tm(r.config,o),monaco:t}})}function Av(){var n=qr(function(e){var t=e.monaco,o=e.isInitialized,r=e.resolve;return{monaco:t,isInitialized:o,resolve:r}});if(!n.isInitialized){if(Bs({isInitialized:!0}),n.monaco)return n.resolve(n.monaco),ic(sc);if(window.monaco&&window.monaco.editor)return om(window.monaco),n.resolve(window.monaco),ic(sc);Nv(Iv,Ov)(Dv)}return ic(sc)}function Iv(n){return document.body.appendChild(n)}function _v(n){var e=document.createElement("script");return n&&(e.src=n),e}function Ov(n){var e=qr(function(o){var r=o.config,i=o.reject;return{config:r,reject:i}}),t=_v("".concat(e.config.paths.vs,"/loader.js"));return t.onload=function(){return n()},t.onerror=e.reject,t}function Dv(){var n=qr(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;om(o),n.resolve(o)},function(t){n.reject(t)})}function om(n){qr().monaco||Bs({monaco:n})}function Pv(){return qr(function(n){var e=n.monaco;return e})}var sc=new Promise(function(n,e){return Bs({resolve:n,reject:e})}),Rv={config:Mv,init:Av,__getMonacoInstance:Pv};const Lv={class:"monaco-editor-wrapper"},$v={key:0,class:"monaco-editor-error"},rm=((n,e)=>{const t=n.__vccOpts||n;for(const[o,r]of e)t[o]=r;return t})(s.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=s.ref(null),i=s.ref(null);let a=null,l=null,c=null,d=!1,u=[];function f(){const h=r.value;if(!h)return;const m=h.getRootNode();if(!(m instanceof ShadowRoot))return;const g=m;Array.from(document.head.querySelectorAll('style, link[rel="stylesheet"]')).filter(N=>{if(N.tagName==="LINK"){const v=N.href||"";return v.includes("monaco")||v.includes("/vs/")||v.includes("vs/")}const E=N.textContent||"";return E.includes(".monaco-editor")||E.includes(".monaco-editor-background")}).forEach(N=>{if(N.tagName==="LINK"){const v=N.href;if(!!g.querySelector(`link[rel="stylesheet"][href="${v}"]`))return}else{const v=N.getAttribute("data-name")||"";if(v&&!!g.querySelector(`style[data-name="${v}"]`))return}const E=N.cloneNode(!0);E.setAttribute("data-zcode-monaco-style","true"),g.appendChild(E),u.push(E)})}function p(){if(!(!a||!r.value||!l)&&t.autoHeight!==!1)try{const h=a.getOption(l.editor.EditorOption.lineHeight)||19;let y=(a.getModel()?.getLineCount()||1)*h+20;t.maxHeight!==void 0&&(y=Math.min(y,t.maxHeight)),r.value.style.height=`${y}px`,a.layout()}catch{r.value.style.height="200px"}}return s.onMounted(async()=>{if(r.value)try{l=await Rv.init(),f(),c=l.languages.registerCompletionItemProvider("html",{provideCompletionItems:(m,g)=>{const y=m.getWordUntilPosition(g),x={startLineNumber:g.lineNumber,endLineNumber:g.lineNumber,startColumn:y.startColumn,endColumn:y.endColumn},N=m.getValueInRange({startLineNumber:g.lineNumber,startColumn:Math.max(1,g.column-10),endLineNumber:g.lineNumber,endColumn:g.column}),E=[];return(N.endsWith("$")||N.endsWith("{$"))&&E.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:{startLineNumber:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-(N.endsWith("{$")?2:1),endColumn:g.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-(N.endsWith("{$")?2:1),endColumn:g.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-(N.endsWith("{$")?2:1),endColumn:g.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-(N.endsWith("{$")?2:1),endColumn:g.column}}),(N.endsWith("(")||N.endsWith("$("))&&E.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-(N.endsWith("$(")?2:1),endColumn:g.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-(N.endsWith("$(")?2:1),endColumn:g.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-(N.endsWith("$(")?2:1),endColumn:g.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-(N.endsWith("$(")?2:1),endColumn:g.column}}),(N.endsWith("z-")||N.endsWith(" z-"))&&E.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-2,endColumn:g.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:g.lineNumber,endLineNumber:g.lineNumber,startColumn:g.column-2,endColumn:g.column}}),E.length===0&&E.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:x},{label:"{$field:default:rich}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:x},{label:"{$field:default:image}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:x},{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:x},{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:x},{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:x},{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:x},{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:x},{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:x},{label:'z-empty="$fieldName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-empty="$${1:fieldName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"オプショナルフィールドが空の場合、親要素を削除",detail:"テンプレート記法 - 条件分岐(空の場合削除)",range:x},{label:'z-slot="slotName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:x}),{suggestions:E}},triggerCharacters:["$","(","z"]});const h=t.enableSuggestions!==!1;a=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:h,quickSuggestions:h?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:h,acceptSuggestionOnEnter:h?"on":"off",suggestSelection:"first",mouseWheelScrollSensitivity:1,fastScrollSensitivity:5,scrollbar:{alwaysConsumeMouseWheel:!1}}),a.onDidChangeModelContent(()=>{if(!d){const m=a.getValue();o("update:modelValue",m),p()}}),p()}catch(h){i.value=`Monaco Editorの読み込みに失敗しました: ${h}`,console.error("Monaco Editor error:",h)}}),s.watch(()=>t.modelValue,async h=>{a&&a.getValue()!==h&&(d=!0,await s.nextTick(),a.setValue(h||""),d=!1,p())}),s.watch(()=>t.enableSuggestions,h=>{if(a&&l){const m=h!==!1;a.updateOptions({suggestOnTriggerCharacters:m,quickSuggestions:m?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:m,acceptSuggestionOnEnter:m?"on":"off"})}}),s.onUnmounted(()=>{c?.dispose(),c=null,a&&(a.dispose(),a=null),u.forEach(h=>h.remove()),u=[]}),(h,m)=>(s.openBlock(),s.createElementBlock("div",Lv,[s.createElementVNode("div",{ref_key:"editorContainer",ref:r,class:"monaco-editor-container"},null,512),i.value?(s.openBlock(),s.createElementBlock("div",$v,s.toDisplayString(i.value),1)):s.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}"]]]),Vv={class:"zcode-parts-manager"},Bv={class:"zcode-parts-category-tabs"},Fv={class:"zcode-parts-category-tab-group"},jv=["onClick"],Hv=["title"],Uv={class:"zcode-parts-add-wrapper"},Wv={class:"zcode-parts-manager-content"},qv={class:"zcode-parts-items"},Gv={class:"zcode-part-type-title",role:"heading","aria-level":"5"},Kv={class:"zcode-part-type-actions"},Jv=["title","onClick"],Xv=["title","onClick"],Yv=["title","onClick"],Qv={class:"zcode-part-type-items"},Zv=["onClick"],eT={key:0,class:"zcode-reorder-source-indicator"},tT={class:"zcode-part-item-header"},nT={class:"zcode-part-type"},oT={class:"zcode-part-item-actions"},rT=["title","onClick"],iT=["title","onClick"],sT=["title","onClick"],aT={class:"zcode-part-item-content"},lT={class:"zcode-part-modules"},cT={key:0,class:"zcode-part-preview"},dT=["innerHTML"],uT=["onClick"],fT={class:"zcode-part-item-add-content"},pT={class:"zcode-part-editor-header"},hT={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},mT=["aria-label"],gT={class:"zcode-part-editor-form"},yT={class:"zcode-form-field"},bT=["placeholder"],xT={class:"zcode-form-field"},kT=["placeholder"],ET={class:"zcode-part-editor-actions"},wT={class:"zcode-part-editor-header"},ST={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},CT=["aria-label"],NT={class:"zcode-part-editor-form"},vT={class:"zcode-part-editor-topbar"},TT={class:"zcode-part-editor-topfields"},zT={class:"zcode-form-field"},MT={class:"zcode-form-field"},AT=["placeholder"],IT={class:"zcode-part-editor-main"},_T={class:"zcode-part-editor-pane zcode-part-editor-pane--code"},OT={class:"zcode-part-editor-pane-header"},DT=["aria-label"],PT=["aria-selected"],RT=["aria-selected"],LT=["aria-selected"],$T={class:"zcode-part-editor-pane-header-actions"},VT={key:0,class:"zcode-css-warning-compact"},BT={class:"zcode-css-warning-compact-text"},FT=["title"],jT={key:1,class:"zcode-checkbox-label zcode-checkbox-label-inline"},HT=["title"],UT={class:"zcode-part-editor-pane-body"},WT={key:0,class:"zcode-slots-config zcode-slots-config-in-pane"},qT={class:"zcode-slot-config-header"},GT={class:"zcode-slot-config-title"},KT=["onClick"],JT={class:"zcode-slot-config-body"},XT={class:"zcode-checkbox-group"},YT=["onUpdate:modelValue","placeholder"],QT=["checked","onChange"],ZT={key:0,class:"zcode-slot-add-section"},ez={class:"zcode-slot-add-controls"},tz={value:""},nz=["value"],oz=["disabled"],rz={class:"zcode-part-editor-pane zcode-part-editor-pane--side"},iz=["aria-label"],sz=["aria-selected"],az=["aria-selected"],lz={class:"zcode-part-editor-pane-body"},cz=["innerHTML"],dz={class:"zcode-part-editor-preview-hint"},uz={class:"zcode-edit-panel-preview-heading"},fz={class:"zcode-edit-panel-preview-desc"},pz={class:"zcode-edit-panel-preview-wrap"},hz={key:1,class:"zcode-edit-panel-preview-empty"},mz={class:"zcode-part-editor-actions"},gz={class:"zcode-preview-modal-header"},yz={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},bz=["innerHTML"],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-warning-content"},Cz={class:"zcode-warning-text"},Nz={class:"zcode-warning-list"},vz={class:"zcode-css-warning-modal-footer"},Tz={class:"zcode-checkbox-label",style:{"margin-bottom":"12px"}},zz={class:"zcode-help-modal-header"},Mz={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},Az=["aria-label"],Iz={class:"zcode-help-modal-body"},_z={class:"zcode-help-section"},Oz={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Dz={class:"zcode-help-section-item"},Pz={class:"zcode-help-section"},Rz={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Lz={class:"zcode-help-section-item"},$z={class:"zcode-help-section"},Vz={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Bz={class:"zcode-help-section-item"},Fz={class:"zcode-help-modal-header"},jz={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},Hz=["aria-label"],Uz={class:"zcode-help-modal-body"},Wz={class:"zcode-help-table"},qz={class:"zcode-help-section"},Gz={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Kz={role:"list",class:"zcode-help-section-list"},Jz=["innerHTML"],Xz={role:"listitem",class:"zcode-help-section-item"},Yz={role:"listitem",class:"zcode-help-section-item"},Qz=s.defineComponent({__name:"PartsManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(n,{expose:e}){const{t}=Vt(),o=n,r=s.ref(!1),i=s.ref(ob("enableTemplateSuggestions",!1)),a=s.ref(!1),l=s.ref(!1),c=s.ref(!1),d=s.ref(rb()),u=s.ref("html"),f=s.ref("preview"),p=s.ref(""),h=s.ref(""),m={common:"zcode-css-style-parts-manager-preview-common",individual:"zcode-css-style-parts-manager-preview-individual",special:"zcode-css-style-parts-manager-preview-special"},g=new Map,y=s.computed(()=>B.value==="common"?o.cmsData.css?.common??"":B.value==="individual"?o.cmsData.css?.individual??"":o.cmsData.css?.special??"");function x(F){["common","individual","special"].forEach(le=>{const fe=F[le];if(!fe||!fe.trim()){const Qe=g.get(le);Qe&&(Qe.remove(),g.delete(le));return}let _e=g.get(le);_e||(_e=document.createElement("style"),_e.id=m[le],_e.setAttribute("data-zcode-css","true"),_e.setAttribute("data-zcode-css-parts-preview","true"),_e.setAttribute("data-zcode-css-category",le),_e.parentNode||document.head.appendChild(_e),g.set(le,_e)),_e.textContent=fe})}function N(){g.forEach(F=>{F.remove()}),g.clear()}function E(){a.value=!0}function v(){a.value=!1}function A(){(B.value==="common"||B.value==="individual"||B.value==="special")&&(l.value=!0)}function M(){l.value=!1,ib(d.value)}s.watch(i,F=>{Ea({enableTemplateSuggestions:F})});const k=s.computed(()=>o.config?.categoryOrder||"common"),w=s.computed(()=>{const F=[];return k.value==="individual"?F.push("individual","common","special"):k.value==="special"?F.push("special","common","individual"):F.push("common","individual","special"),F}),{reorderSourcePart:b,handleReorderClick:R,activeCategory:B,editingType:O,editingPart:D,editingLevel:P,isCreatingNew:q,groupedPartsByType:W,startCreating:V,startEditingType:G,startEditingPart:J,addPartToType:oe,saveType:ne,savePart:X,deletePart:Z,checkTypeUsage:Y,cancelEditingType:te,cancelEditingPart:de,getPartPreviewHtml:me,createTempComponentFromType:Me,addPartSlot:Le,removePartSlot:C,updatePartSlotAllowedParts:L,getAvailableSlotsForPart:$,extractSlotsFromTemplate:S,reorderSourceType:K,startReorderType:z,deletePartType:U}=qN(o.cmsData),ie=s.ref(null);s.watch(()=>D.value,F=>{if(!F){ie.value=null;return}const j=Me(F.type,F.part);ie.value=s.reactive({...j,type:F.type.type})},{deep:!0});const Se=s.computed(()=>{const F=D.value,j=ie.value;return!F||!j?[]:Hh(F.part,j)});function ve(F){const j=ie.value;j&&(j[F.fieldName]=F.currentValue)}o.config?.categoryOrder==="individual"&&(B.value="individual");const T=s.computed(()=>(P?.value??P)==="part"&&!!D.value);s.watch(()=>T.value,F=>{if(!F){N();return}s.nextTick(()=>{const j=y.value;h.value=j,p.value=j,x({common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special})})},{immediate:!0}),s.watch(()=>B.value,()=>{T.value&&s.nextTick(()=>{const F=y.value;h.value=F,p.value=F})}),s.watch([()=>p.value,()=>T.value,()=>B.value],([F,j,le])=>{j&&s.nextTick(()=>{const fe={common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special};le==="common"?fe.common=F??"":le==="individual"?fe.individual=F??"":fe.special=F??"",x(fe)})});async function I(){await X(),!D.value&&o.cmsData.css&&(B.value==="common"?o.cmsData.css.common=p.value:B.value==="individual"?o.cmsData.css.individual=p.value:o.cmsData.css.special=p.value,h.value=p.value)}function Q(){p.value=h.value,N(),r.value=!1,de()}s.onBeforeUnmount(()=>{N()}),s.watch(()=>D.value,F=>{F&&(u.value="html")}),s.watch(()=>u.value,F=>{F==="css"&&T.value&&(B.value==="common"||B.value==="individual"||B.value==="special")&&!d.value&&s.nextTick(()=>{A()})}),e({activeCategory:B});async function ge(){await ne()}const Te=s.computed(()=>D.value?$(D.value.partIndex):[]),ye=s.computed(()=>{if(!D.value)return!1;const F=D.value.part.body,j=F?S(F).length>0:!1,le=D.value.part.slots&&Object.keys(D.value.part.slots).length>0;return j||le});s.watch([()=>ye.value,()=>u.value],([F,j])=>{!F&&j==="slots"&&(u.value="html")});const H=s.ref(""),ee=()=>{!H.value||!D.value||(Le(D.value.partIndex,H.value),H.value="")};s.watch(()=>D.value?.part.body,()=>{H.value=""});const ze=s.computed(()=>{const F=[],j=o.cmsData.parts;return[...j.common,...j.individual,...j.special||[]].forEach(fe=>{fe.parts.forEach(_e=>{F.push({id:_e.id,title:_e.title,typeName:fe.type,description:_e.description})})}),F.sort((fe,_e)=>fe.typeName!==_e.typeName?fe.typeName.localeCompare(_e.typeName):fe.title.localeCompare(_e.title))}),Pe=s.ref({}),dt=F=>{const j=Pe.value[F]||"";if(!j)return ze.value;const le=j.toLowerCase();return ze.value.filter(fe=>fe.title.toLowerCase().includes(le)||fe.typeName.toLowerCase().includes(le))},Xt=F=>{if(!D.value)return[];const j=D.value.part.slots?.[F];return j?j.allowedParts||[]:[]},Ot=(F,j,le)=>{if(!D.value)return;const fe=le.target.checked,Qe=D.value.part.slots?.[F]?.allowedParts||[];let gn;fe?gn=[...Qe,j]:gn=Qe.filter(Kr=>Kr!==j),L(D.value.partIndex,F,gn)};function $t(F,j){const le=["zcode-part-item"];return b.value&&b.value.type===F.type&&b.value.partIndex===j&&le.push("zcode-reorder-source"),le.join(" ")}function _n(F){const j=F._partIndex,le=j!=null,fe=le&&j!==void 0?j+1:0,_e=F.parts.length;if(le&&_e>1){if(!confirm(t("partsManager.deletePartConfirm",{number:fe})))return}else{const Qe=Y(F.type);if(Qe.length>0){if(!confirm(t("partsManager.deleteTypeWithUsagesConfirm",{type:F.type,count:Qe.length})))return}else if(!confirm(t("partsManager.deleteTypeConfirm")))return}Z(F)}return(F,j)=>(s.openBlock(),s.createElementBlock("div",Vv,[s.createElementVNode("div",Bv,[s.createElementVNode("div",Fv,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(w.value,le=>(s.openBlock(),s.createElementBlock("button",{key:le,class:s.normalizeClass([{active:s.unref(B)===le},"zcode-category-tab"]),onClick:fe=>B.value=le},s.toDisplayString(le==="common"?F.$t("dataViewer.common"):le==="individual"?F.$t("dataViewer.individual"):F.$t("dataViewer.special")),11,jv))),128)),s.createElementVNode("button",{class:"zcode-help-btn",title:F.$t("dataViewer.categoryInfo.title"),onClick:j[0]||(j[0]=le=>c.value=!0)},[s.createVNode(s.unref(Dn),{size:14})],8,Hv)]),s.createElementVNode("div",Uv,[s.createElementVNode("button",{class:"zcode-btn-primary zcode-parts-new-btn",onClick:j[1]||(j[1]=(...le)=>s.unref(V)&&s.unref(V)(...le))},[s.createVNode(s.unref(ao),{size:14}),s.createElementVNode("span",null,s.toDisplayString(F.$t("partsManager.createType")),1)])])]),s.createElementVNode("div",Wv,[s.createElementVNode("div",qv,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(W),le=>(s.openBlock(),s.createElementBlock("div",{key:le.type,class:"zcode-part-type-group"},[s.createElementVNode("div",Gv,[s.createTextVNode(s.toDisplayString(le.type)+" ",1),s.createElementVNode("div",Kv,[le.parts.length>0?(s.openBlock(),s.createElementBlock("button",{key:0,class:"zcode-part-type-edit-btn",title:F.$t("partsManager.editTypeButton"),onClick:s.withModifiers(fe=>s.unref(G)(le.parts[0]),["stop"])},[s.createVNode(s.unref(Us),{size:14})],8,Jv)):s.createCommentVNode("",!0),s.createElementVNode("button",{class:s.normalizeClass(["zcode-action-btn",{active:s.unref(K)===le.type}]),title:F.$t("partsManager.reorderType"),onClick:s.withModifiers(fe=>s.unref(z)(le.type),["stop"])},[s.createVNode(s.unref(Zo),{size:14})],10,Xv),s.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:F.$t("partsManager.deleteTypeButton"),onClick:s.withModifiers(fe=>s.unref(U)(le.type),["stop"])},[s.createVNode(s.unref(Pn),{size:14})],8,Yv)])]),s.createElementVNode("div",Qv,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(le.parts,(fe,_e)=>(s.openBlock(),s.createElementBlock("div",{key:`${le.type}-${_e}`,class:s.normalizeClass($t(fe,fe._partIndex??0)),onClick:Qe=>s.unref(J)(fe,fe._partIndex??0)},[s.unref(b)&&s.unref(b).type===fe.type&&s.unref(b).partIndex===(fe._partIndex??0)?(s.openBlock(),s.createElementBlock("div",eT,s.toDisplayString(F.$t("partsManager.source")),1)):s.createCommentVNode("",!0),s.createElementVNode("div",tT,[s.createElementVNode("span",nT,s.toDisplayString(fe._displayPart?.title||fe.type),1),s.createElementVNode("div",oT,[s.createElementVNode("button",{class:"zcode-action-btn",title:F.$t("partsManager.editPartButton"),onClick:s.withModifiers(Qe=>s.unref(J)(fe,fe._partIndex??0),["stop"])},[s.createVNode(s.unref(Us),{size:14})],8,rT),s.createElementVNode("button",{class:s.normalizeClass(["zcode-action-btn",{active:s.unref(b)?.type===fe.type&&s.unref(b)?.partIndex===(fe._partIndex??0)}]),title:F.$t("partsManager.reorderPart"),onClick:s.withModifiers(Qe=>s.unref(R)(fe,fe._partIndex??0),["stop"])},[s.createVNode(s.unref(Zo),{size:14})],10,iT),s.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:F.$t("partsManager.deletePartButton"),onClick:s.withModifiers(Qe=>_n({...fe,_partIndex:fe._partIndex??0}),["stop"])},[s.createVNode(s.unref(Pn),{size:14})],8,sT)])]),s.createElementVNode("div",aT,[s.createElementVNode("div",{class:s.normalizeClass(["zcode-part-description",{"zcode-description-empty":!fe._displayPart?.description&&!fe.description}])},s.toDisplayString(fe._displayPart?.description||fe.description||F.$t("partsManager.noDescription")),3),s.createElementVNode("div",lT,s.toDisplayString(F.$t("partsManager.partNumber",{current:(fe._partIndex??0)+1,total:fe.parts.length})),1),fe._displayPart?(s.openBlock(),s.createElementBlock("div",cT,[s.createElementVNode("div",{class:"zcode-part-preview-content",innerHTML:s.unref(me)(fe,fe._displayPart)},null,8,dT)])):s.createCommentVNode("",!0)])],10,Zv))),128)),le.parts.length>0?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-part-item zcode-part-item-add",onClick:s.withModifiers(fe=>s.unref(oe)(le.parts[0]),["stop"])},[s.createElementVNode("div",fT,[s.createVNode(s.unref(ao),{size:20}),s.createElementVNode("span",null,s.toDisplayString(F.$t("partsManager.addPart")),1)])],8,uT)):s.createCommentVNode("",!0)])]))),128))]),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[s.unref(O)&&(s.unref(P)==="type"||s.unref(q))?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:j[7]||(j[7]=s.withModifiers((...le)=>s.unref(te)&&s.unref(te)(...le),["self"]))},[s.createElementVNode("div",{class:"zcode-part-modal-content",onClick:j[6]||(j[6]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",pT,[s.createElementVNode("div",hT,s.toDisplayString(s.unref(q)?F.$t("partsManager.createType"):F.$t("partsManager.editType")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":F.$t("common.close"),onClick:j[2]||(j[2]=(...le)=>s.unref(te)&&s.unref(te)(...le))},[s.createVNode(s.unref(Ye),{size:18})],8,mT)]),s.createElementVNode("div",gT,[s.createElementVNode("div",yT,[s.createElementVNode("label",null,[s.createTextVNode(s.toDisplayString(F.$t("partsManager.typeName"))+" ",1),j[30]||(j[30]=s.createElementVNode("span",{class:"zcode-required"},"*",-1))]),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":j[3]||(j[3]=le=>s.unref(O).type=le),type:"text",placeholder:F.$t("partsManager.typeNamePlaceholder"),class:"zcode-text-input",required:""},null,8,bT),[[s.vModelText,s.unref(O).type]])]),s.createElementVNode("div",xT,[s.createElementVNode("label",null,s.toDisplayString(F.$t("partsManager.typeDescription")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":j[4]||(j[4]=le=>s.unref(O).description=le),type:"text",placeholder:F.$t("partsManager.typeDescriptionPlaceholder"),class:"zcode-text-input"},null,8,kT),[[s.vModelText,s.unref(O).description]])])]),s.createElementVNode("div",ET,[s.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:ge},[s.createVNode(s.unref(er),{size:16}),s.createElementVNode("span",null,s.toDisplayString(F.$t("common.confirm")),1)]),s.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:j[5]||(j[5]=(...le)=>s.unref(te)&&s.unref(te)(...le))},[s.createVNode(s.unref(Ye),{size:16}),s.createElementVNode("span",null,s.toDisplayString(F.$t("common.cancel")),1)])])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[s.unref(D)&&s.unref(P)==="part"?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:s.withModifiers(Q,["self"])},[s.createElementVNode("div",{class:"zcode-part-modal-content",onClick:j[20]||(j[20]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",wT,[s.createElementVNode("div",ST,s.toDisplayString(F.$t("partsManager.editPart",{title:s.unref(D).part.title})),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":F.$t("common.close"),onClick:Q},[s.createVNode(s.unref(Ye),{size:18})],8,CT)]),s.createElementVNode("div",NT,[s.createElementVNode("div",vT,[s.createElementVNode("div",TT,[s.createElementVNode("div",zT,[s.createElementVNode("label",null,[s.createTextVNode(s.toDisplayString(F.$t("partsManager.partTitle"))+" ",1),j[31]||(j[31]=s.createElementVNode("span",{class:"zcode-required"},"*",-1))]),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":j[8]||(j[8]=le=>s.unref(D).part.title=le),type:"text",class:"zcode-text-input",required:""},null,512),[[s.vModelText,s.unref(D).part.title]])]),s.createElementVNode("div",MT,[s.createElementVNode("label",null,s.toDisplayString(F.$t("partsManager.partDescription")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":j[9]||(j[9]=le=>s.unref(D).part.description=le),type:"text",class:"zcode-text-input",placeholder:F.$t("partsManager.partDescriptionPlaceholder")},null,8,AT),[[s.vModelText,s.unref(D).part.description]])])])]),s.createElementVNode("div",IT,[s.createElementVNode("div",_T,[s.createElementVNode("div",OT,[s.createElementVNode("div",{class:"zcode-template-tabs",role:"tablist","aria-label":F.$t("partsManager.codeEdit")},[s.createElementVNode("button",{type:"button",class:s.normalizeClass(["zcode-template-tab",{active:u.value==="html"}]),role:"tab","aria-selected":u.value==="html",onClick:j[10]||(j[10]=le=>u.value="html")}," HTML ",10,PT),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["zcode-template-tab",{active:u.value==="css"}]),role:"tab","aria-selected":u.value==="css",onClick:j[11]||(j[11]=le=>u.value="css")}," CSS ",10,RT),ye.value?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:s.normalizeClass(["zcode-template-tab",{active:u.value==="slots"}]),role:"tab","aria-selected":u.value==="slots",onClick:j[12]||(j[12]=le=>u.value="slots")},s.toDisplayString(F.$t("partsManager.slotSettings")),11,LT)):s.createCommentVNode("",!0)],8,DT),s.createElementVNode("div",$T,[u.value==="css"?(s.openBlock(),s.createElementBlock("div",VT,[s.createVNode(s.unref(Hs),{size:14,class:"zcode-css-warning-compact-icon"}),s.createElementVNode("span",BT,s.toDisplayString(F.$t("partsManager.cssEditInfo")),1),s.createElementVNode("button",{class:"zcode-help-btn",type:"button",title:F.$t("partsManager.cssEditWarning"),onClick:A},[s.createVNode(s.unref(Dn),{size:14})],8,FT)])):s.createCommentVNode("",!0),u.value==="html"?(s.openBlock(),s.createElementBlock("label",jT,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":j[13]||(j[13]=le=>i.value=le),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[s.vModelCheckbox,i.value]]),s.createElementVNode("span",null,s.toDisplayString(F.$t("partsManager.templateSuggestions")),1)])):s.createCommentVNode("",!0),u.value==="html"?(s.openBlock(),s.createElementBlock("button",{key:2,class:"zcode-help-btn",type:"button",title:F.$t("partsManager.templateHelpButton"),onClick:E},[s.createVNode(s.unref(Dn),{size:16})],8,HT)):s.createCommentVNode("",!0)])]),s.createElementVNode("div",UT,[u.value==="slots"?(s.openBlock(),s.createElementBlock("div",WT,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(D).part.slots||{},(le,fe)=>(s.openBlock(),s.createElementBlock("div",{key:`part-${s.unref(D).partIndex}-${fe}`,class:"zcode-slot-config-item"},[s.createElementVNode("div",qT,[s.createElementVNode("div",GT,s.toDisplayString(F.$t("partsManager.slot"))+": "+s.toDisplayString(fe),1),s.createElementVNode("button",{class:"zcode-btn-small",onClick:_e=>s.unref(C)(s.unref(D).partIndex,fe)},[s.createVNode(s.unref(Pn),{size:12})],8,KT)]),s.createElementVNode("div",JT,[s.createElementVNode("label",null,s.toDisplayString(F.$t("partsManager.allowedParts")),1),s.createElementVNode("div",XT,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":_e=>Pe.value[fe]=_e,type:"text",placeholder:F.$t("partsManager.searchParts"),class:"zcode-text-input",style:{"margin-bottom":"8px"}},null,8,YT),[[s.vModelText,Pe.value[fe]]]),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(dt(fe),_e=>(s.openBlock(),s.createElementBlock("label",{key:`allowed-${fe}-${_e.typeName}-${_e.id}`,class:"zcode-checkbox-item"},[s.createElementVNode("input",{type:"checkbox",checked:Xt(fe).includes(_e.id),class:"zcode-checkbox",onChange:Qe=>Ot(fe,_e.id,Qe)},null,40,QT),s.createElementVNode("span",null,s.toDisplayString(_e.title)+" ("+s.toDisplayString(_e.typeName)+")",1)]))),128))])])]))),128)),Te.value.length>0?(s.openBlock(),s.createElementBlock("div",ZT,[s.createElementVNode("label",null,s.toDisplayString(F.$t("partsManager.addSlot")),1),s.createElementVNode("div",ez,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":j[14]||(j[14]=le=>H.value=le),class:"zcode-select-input"},[s.createElementVNode("option",tz,s.toDisplayString(F.$t("partsManager.selectSlot")),1),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(Te.value,le=>(s.openBlock(),s.createElementBlock("option",{key:le,value:le},s.toDisplayString(le==="default"?F.$t("partsManager.defaultSlot"):le),9,nz))),128))],512),[[s.vModelSelect,H.value]]),s.createElementVNode("button",{disabled:!H.value,class:"zcode-btn-secondary",onClick:ee},[s.createVNode(s.unref(ao),{size:16}),s.createElementVNode("span",null,s.toDisplayString(F.$t("common.add")),1)],8,oz)])])):s.createCommentVNode("",!0)])):u.value==="html"?(s.openBlock(),s.createBlock(rm,{key:1,modelValue:s.unref(D).part.body,"onUpdate:modelValue":j[15]||(j[15]=le=>s.unref(D).part.body=le),language:"html",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":i.value,class:"zcode-monaco-editor"},null,8,["modelValue","enable-suggestions"])):(s.openBlock(),s.createBlock(rm,{key:2,modelValue:p.value,"onUpdate:modelValue":j[16]||(j[16]=le=>p.value=le),language:"css",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":!0,class:"zcode-monaco-editor"},null,8,["modelValue"]))])]),s.createElementVNode("div",rz,[s.createElementVNode("div",{class:"zcode-part-editor-side-tabs",role:"tablist","aria-label":F.$t("partsManager.preview")},[s.createElementVNode("button",{type:"button",class:s.normalizeClass(["zcode-part-editor-side-tab",{active:f.value==="preview"}]),role:"tab","aria-selected":f.value==="preview",onClick:j[17]||(j[17]=le=>f.value="preview")},s.toDisplayString(F.$t("partsManager.displayPreview")),11,sz),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["zcode-part-editor-side-tab",{active:f.value==="editPanel"}]),role:"tab","aria-selected":f.value==="editPanel",onClick:j[18]||(j[18]=le=>f.value="editPanel")},s.toDisplayString(F.$t("partsManager.editPanelPreview")),11,az)],8,iz),s.createElementVNode("div",lz,[f.value==="preview"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createElementVNode("div",{class:"zcode-part-editor-preview-tab",onClick:j[19]||(j[19]=le=>r.value=!0),innerHTML:s.unref(me)(s.unref(D).type,s.unref(D).part)},null,8,cz),s.createElementVNode("div",dz,s.toDisplayString(F.$t("partsManager.clickToEnlarge")),1)],64)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createElementVNode("div",uz,s.toDisplayString(F.$t("partsManager.editPanelPreview")),1),s.createElementVNode("div",fz,s.toDisplayString(F.$t("partsManager.editPanelPreviewDesc")),1),s.createElementVNode("div",pz,[ie.value?(s.openBlock(),s.createBlock(Fh,{key:0,"editing-component":ie.value,"editing-available-fields":Se.value,"current-mode":"edit","can-select-parent":!1,"images-common":n.cmsData.images?.common??[],"images-individual":n.cmsData.images?.individual??[],"images-special":n.cmsData.images?.special??[],"preview-mode":!0,onSaveField:ve,onClose:()=>{},onAddImage:()=>{},onDeleteImage:()=>{}},null,8,["editing-component","editing-available-fields","images-common","images-individual","images-special"])):(s.openBlock(),s.createElementBlock("div",hz,s.toDisplayString(F.$t("partsManager.editPanelPreviewNoFields")),1))])],64))])])])]),s.createElementVNode("div",mz,[s.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:I},[s.createVNode(s.unref(er),{size:16}),s.createElementVNode("span",null,s.toDisplayString(F.$t("common.confirm")),1)]),s.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:Q},[s.createVNode(s.unref(Ye),{size:16}),s.createElementVNode("span",null,s.toDisplayString(F.$t("common.cancel")),1)])])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[r.value&&s.unref(D)?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:j[23]||(j[23]=le=>r.value=!1)},[s.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:j[22]||(j[22]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",gz,[s.createElementVNode("div",yz,s.toDisplayString(F.$t("partsManager.preview"))+" "+s.toDisplayString(s.unref(D).part.title),1),s.createElementVNode("button",{class:"zcode-close-btn",onClick:j[21]||(j[21]=le=>r.value=!1)},[s.createVNode(s.unref(Ye),{size:18})])]),s.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:s.unref(me)(s.unref(D).type,s.unref(D).part)},null,8,bz)])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[l.value&&(s.unref(B)==="common"||s.unref(B)==="individual"||s.unref(B)==="special")?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:s.withModifiers(M,["self"])},[s.createElementVNode("div",{class:"zcode-help-modal zcode-css-warning-modal",onClick:j[25]||(j[25]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",xz,[s.createElementVNode("div",kz,[s.createVNode(s.unref(Ec),{size:20,class:"zcode-css-warning-modal-title-icon"}),s.createElementVNode("span",null,s.toDisplayString(F.$t("partsManager.cssEditWarning")),1)]),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":F.$t("common.close"),onClick:M},[s.createVNode(s.unref(Ye),{size:20})],8,Ez)]),s.createElementVNode("div",wz,[s.createElementVNode("div",Sz,[s.createElementVNode("div",Cz,[s.createElementVNode("ul",Nz,[s.createElementVNode("li",null,[s.unref(B)==="common"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createTextVNode(s.toDisplayString(F.$t("partsManager.cssEditWarningMessageCommon")),1)],64)):s.unref(B)==="individual"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createTextVNode(s.toDisplayString(F.$t("partsManager.cssEditWarningMessageIndividual")),1)],64)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:2},[s.createTextVNode(s.toDisplayString(F.$t("partsManager.cssEditWarningMessageSpecial")),1)],64))])])])])]),s.createElementVNode("div",vz,[s.createElementVNode("label",Tz,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":j[24]||(j[24]=le=>d.value=le),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[s.vModelCheckbox,d.value]]),s.createElementVNode("span",null,s.toDisplayString(F.$t("partsManager.dontShowAgain")),1)]),s.createElementVNode("button",{class:"zcode-btn-primary",onClick:M},s.toDisplayString(F.$t("partsManager.understood")),1)])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[c.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:j[28]||(j[28]=s.withModifiers(le=>c.value=!1,["self"]))},[s.createElementVNode("div",{class:"zcode-help-modal",onClick:j[27]||(j[27]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",zz,[s.createElementVNode("div",Mz,[s.createVNode(s.unref(Hs),{size:20,class:"zcode-css-warning-modal-title-icon"}),s.createElementVNode("span",null,s.toDisplayString(F.$t("dataViewer.categoryInfo.title")),1)]),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":F.$t("common.close"),onClick:j[26]||(j[26]=le=>c.value=!1)},[s.createVNode(s.unref(Ye),{size:18})],8,Az)]),s.createElementVNode("div",Iz,[s.createElementVNode("div",_z,[s.createElementVNode("div",Oz,s.toDisplayString(F.$t("dataViewer.categoryInfo.common.title")),1),s.createElementVNode("div",Dz,s.toDisplayString(F.$t("dataViewer.categoryInfo.common.description")),1)]),s.createElementVNode("div",Pz,[s.createElementVNode("div",Rz,s.toDisplayString(F.$t("dataViewer.categoryInfo.individual.title")),1),s.createElementVNode("div",Lz,s.toDisplayString(F.$t("dataViewer.categoryInfo.individual.description")),1)]),s.createElementVNode("div",$z,[s.createElementVNode("div",Vz,s.toDisplayString(F.$t("dataViewer.categoryInfo.special.title")),1),s.createElementVNode("div",Bz,s.toDisplayString(F.$t("dataViewer.categoryInfo.special.description")),1)])])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[a.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:v},[s.createElementVNode("div",{class:"zcode-help-modal",onClick:j[29]||(j[29]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",Fz,[s.createElementVNode("div",jz,s.toDisplayString(F.$t("partsManager.templateHelpTitle")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":F.$t("common.close"),onClick:v},[s.createVNode(s.unref(Ye),{size:20})],8,Hz)]),s.createElementVNode("div",Uz,[s.createElementVNode("table",Wz,[s.createElementVNode("thead",null,[s.createElementVNode("tr",null,[s.createElementVNode("th",null,s.toDisplayString(F.$t("partsManager.syntax")),1),s.createElementVNode("th",null,s.toDisplayString(F.$t("partsManager.description")),1),s.createElementVNode("th",null,s.toDisplayString(F.$t("partsManager.example")),1)])]),s.createElementVNode("tbody",null,[s.createElementVNode("tr",null,[j[32]||(j[32]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$field:default}")],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.textField")),1),j[33]||(j[33]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$title:タイトル}")],-1))]),s.createElementVNode("tr",null,[j[34]||(j[34]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$field:default:rich}")],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.richText")),1),j[35]||(j[35]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$content:本文:rich}")],-1))]),s.createElementVNode("tr",null,[j[36]||(j[36]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$field:default:textarea}")],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.textarea")),1),j[37]||(j[37]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$description:説明:textarea}")],-1))]),s.createElementVNode("tr",null,[j[38]||(j[38]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$field:default:image}")],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.image")),1),j[39]||(j[39]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$hero:default.jpg:image}")],-1))]),s.createElementVNode("tr",null,[j[40]||(j[40]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($field:option1|option2)")],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.radio")),1),j[41]||(j[41]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($color:red|blue|green)")],-1))]),s.createElementVNode("tr",null,[j[42]||(j[42]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($field:option1,option2)")],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.checkbox")),1),j[43]||(j[43]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($features:fast,secure)")],-1))]),s.createElementVNode("tr",null,[j[44]||(j[44]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($field@:option1|option2)")],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.selectSingle")),1),j[45]||(j[45]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($size@:S|M|L)")],-1))]),s.createElementVNode("tr",null,[j[46]||(j[46]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($field@:option1,option2)")],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.selectMultiple")),1),j[47]||(j[47]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($tags@:tag1,tag2,tag3)")],-1))]),s.createElementVNode("tr",null,[j[48]||(j[48]=s.createElementVNode("td",null,[s.createElementVNode("code",null,'z-if="show_field"')],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.conditional")),1),j[49]||(j[49]=s.createElementVNode("td",null,[s.createElementVNode("code",null,'<div z-if="show_content">...</div>')],-1))]),s.createElementVNode("tr",null,[j[50]||(j[50]=s.createElementVNode("td",null,[s.createElementVNode("code",null,'z-slot="name"')],-1)),s.createElementVNode("td",null,s.toDisplayString(F.$t("partsManager.templateHelp.slot")),1),j[51]||(j[51]=s.createElementVNode("td",null,[s.createElementVNode("code",null,'<div z-slot="content"></div>')],-1))])])]),s.createElementVNode("div",qz,[s.createElementVNode("div",Gz,s.toDisplayString(F.$t("partsManager.templateHelp.note")),1),s.createElementVNode("div",Kz,[s.createElementVNode("div",{role:"listitem",class:"zcode-help-section-item",innerHTML:F.$t("partsManager.templateHelp.suggestionNote")},null,8,Jz),s.createElementVNode("div",Xz,s.toDisplayString(F.$t("partsManager.templateHelp.fieldNameNote")),1),s.createElementVNode("div",Yz,s.toDisplayString(F.$t("partsManager.templateHelp.defaultValueNote")),1)])])])])])):s.createCommentVNode("",!0)]))])]))}});function Zz(n){const e=s.ref("common"),t=s.ref(null),o=s.ref(null),r=s.ref(!1),i=s.ref(null),a=s.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((N,E)=>{const v=new FileReader;v.onload=A=>{const M=A.target?.result,k={id:`img-${Date.now()}`,name:x.name,url:M,mimeType:x.type,needsUpload:!0};e.value==="common"?n.images.common.push(k):e.value==="individual"?n.images.individual.push(k):n.images.special.push(k),N(k)},v.onerror=E,v.readAsDataURL(x)})}function d(x){rc(x,n.page).forEach(M=>{Object.keys(M.component).forEach(k=>{k.includes("image")&&M.component[k]===x&&(M.component[k]="")})});const E=n.images.common.findIndex(M=>M.id===x);E!==-1&&n.images.common.splice(E,1);const v=n.images.individual.findIndex(M=>M.id===x);v!==-1&&n.images.individual.splice(v,1);const A=n.images.special.findIndex(M=>M.id===x);A!==-1&&n.images.special.splice(A,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 N=x.findIndex(E=>E.id===o.value.id);N!==-1&&(x[N]=o.value),o.value=null,r.value=!1}function p(){o.value=null,r.value=!1}function h(x){return rc(x,n.page)}function m(x){if(!i.value){i.value=x;return}if(i.value===x){y();return}g(i.value,x),y()}function g(x,N){let E;e.value==="common"?E=n.images.common:e.value==="individual"?E=n.images.individual:E=n.images.special;const v=E.findIndex(k=>k.id===x),A=E.findIndex(k=>k.id===N);if(v===-1||A===-1)return;const[M]=E.splice(v,1);E.splice(A,0,M)}function y(){i.value=null}return{reorderSourceImage:i,handleReorderClick:m,cancelReorder:y,activeCategory:e,selectedImage:t,editingImage:o,isCreatingNew:r,currentImages:a,selectImage:l,addImage:c,deleteImage:d,startEditing:u,saveImage:f,cancelEditing:p,checkImageUsage:h}}const eM={class:"zcode-images-manager"},tM={class:"zcode-images-category-tabs"},nM={class:"zcode-images-category-tab-group"},oM=["onClick"],rM=["title"],iM={class:"zcode-images-add-wrapper"},sM={class:"zcode-images-manager-content"},aM={class:"zcode-images-grid"},lM=["onClick"],cM={key:0,class:"zcode-reorder-source-indicator"},dM=["src","alt"],uM={class:"zcode-image-item-overlay"},fM={class:"zcode-image-item-actions"},pM=["title","onClick"],hM=["title","onClick"],mM={class:"zcode-image-item-name"},gM={class:"zcode-image-editor-header"},yM={class:"zcode-image-editor-header-title",role:"heading","aria-level":"4"},bM=["aria-label"],xM={class:"zcode-image-editor-form"},kM={class:"zcode-image-preview-large"},EM=["src","alt"],wM={class:"zcode-form-field"},SM={class:"zcode-form-field"},CM={class:"zcode-image-editor-actions"},NM={class:"zcode-help-modal-header"},vM={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},TM=["aria-label"],zM={class:"zcode-help-modal-body"},MM={class:"zcode-help-section"},AM={class:"zcode-help-section-title",role:"heading","aria-level":"4"},IM={class:"zcode-help-section-item"},_M={class:"zcode-help-section"},OM={class:"zcode-help-section-title",role:"heading","aria-level":"4"},DM={class:"zcode-help-section-item"},PM={class:"zcode-help-section"},RM={class:"zcode-help-section-title",role:"heading","aria-level":"4"},LM={class:"zcode-help-section-item"},$M=s.defineComponent({__name:"ImagesManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(n,{expose:e}){const{t}=Vt(),o=n,r=s.ref(null),i=s.ref(!1),a=s.computed(()=>o.config?.categoryOrder||"common"),l=s.computed(()=>{const M=[];return a.value==="individual"?M.push("individual","common","special"):a.value==="special"?M.push("special","common","individual"):M.push("common","individual","special"),M}),{reorderSourceImage:c,handleReorderClick:d,activeCategory:u,editingImage:f,currentImages:p,addImage:h,deleteImage:m,startEditing:g,saveImage:y,cancelEditing:x,checkImageUsage:N}=Zz(o.cmsData);o.config?.categoryOrder==="individual"?u.value="individual":o.config?.categoryOrder==="special"&&(u.value="special"),e({activeCategory:u});async function E(M){const k=M.target,w=k.files?.[0];if(w)try{await h(w),k&&(k.value="")}catch(b){console.error("画像追加エラー:",b),alert(t("imagesManager.addImageFailed"))}}function v(M){const k=["zcode-image-item"];return c.value===M.id&&k.push("zcode-reorder-source"),k.join(" ")}function A(M){const k=N(M.id);if(k.length>0){if(!confirm(t("imagesManager.deleteImageWithUsagesConfirm",{count:k.length})))return}else if(!confirm(t("imagesManager.deleteImageConfirm")))return;m(M.id)}return(M,k)=>(s.openBlock(),s.createElementBlock("div",eM,[s.createElementVNode("div",tM,[s.createElementVNode("div",nM,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(l.value,w=>(s.openBlock(),s.createElementBlock("button",{key:w,class:s.normalizeClass([{active:s.unref(u)===w},"zcode-category-tab"]),onClick:b=>u.value=w},s.toDisplayString(w==="common"?M.$t("dataViewer.common"):w==="individual"?M.$t("dataViewer.individual"):M.$t("dataViewer.special")),11,oM))),128)),s.createElementVNode("button",{class:"zcode-help-btn",title:M.$t("dataViewer.categoryInfo.title"),onClick:k[0]||(k[0]=w=>i.value=!0)},[s.createVNode(s.unref(Dn),{size:14})],8,rM)]),s.createElementVNode("div",iM,[s.createElementVNode("input",{ref_key:"fileInput",ref:r,type:"file",accept:"image/*",style:{display:"none"},onChange:E},null,544),s.createElementVNode("button",{class:"zcode-btn-primary zcode-images-add-btn",onClick:k[1]||(k[1]=w=>r.value?.click())},[s.createVNode(s.unref(ao),{size:14}),s.createElementVNode("span",null,s.toDisplayString(M.$t("imagesManager.addImage")),1)])])]),s.createElementVNode("div",sM,[s.createElementVNode("div",aM,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(p),w=>(s.openBlock(),s.createElementBlock("div",{key:w.id,class:s.normalizeClass(v(w)),onClick:b=>s.unref(g)(w)},[s.unref(c)===w.id?(s.openBlock(),s.createElementBlock("div",cM,s.toDisplayString(M.$t("partsManager.source")),1)):s.createCommentVNode("",!0),s.createElementVNode("img",{src:w.url,alt:w.name},null,8,dM),s.createElementVNode("div",uM,[s.createElementVNode("div",fM,[s.createElementVNode("button",{class:s.normalizeClass(["zcode-action-btn",{active:s.unref(c)===w.id}]),title:M.$t("partsManager.reorderPart"),onClick:s.withModifiers(b=>s.unref(d)(w.id),["stop"])},[s.createVNode(s.unref(Zo),{size:16})],10,pM),s.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:M.$t("partsManager.deletePartButton"),onClick:s.withModifiers(b=>A(w),["stop"])},[s.createVNode(s.unref(Pn),{size:16})],8,hM)])]),s.createElementVNode("div",mM,s.toDisplayString(w.name),1)],10,lM))),128))])]),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[s.unref(f)?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:k[8]||(k[8]=s.withModifiers((...w)=>s.unref(x)&&s.unref(x)(...w),["self"]))},[s.createElementVNode("div",{class:"zcode-image-modal-content","data-edit-mode":"",onClick:k[7]||(k[7]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",gM,[s.createElementVNode("div",yM,s.toDisplayString(M.$t("imagesManager.editImage")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":M.$t("common.close"),onClick:k[2]||(k[2]=(...w)=>s.unref(x)&&s.unref(x)(...w))},[s.createVNode(s.unref(Ye),{size:18})],8,bM)]),s.createElementVNode("div",xM,[s.createElementVNode("div",kM,[s.createElementVNode("img",{src:s.unref(f).url,alt:s.unref(f).name,class:"zcode-image-preview-large-img"},null,8,EM)]),s.createElementVNode("div",wM,[s.createElementVNode("label",null,s.toDisplayString(M.$t("imagesManager.imageId")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":k[3]||(k[3]=w=>s.unref(f).id=w),type:"text",class:"zcode-text-input",disabled:""},null,512),[[s.vModelText,s.unref(f).id]])]),s.createElementVNode("div",SM,[s.createElementVNode("label",null,s.toDisplayString(M.$t("imagesManager.imageName")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":k[4]||(k[4]=w=>s.unref(f).name=w),type:"text",class:"zcode-text-input"},null,512),[[s.vModelText,s.unref(f).name]])]),s.createElementVNode("div",CM,[s.createElementVNode("button",{class:"zcode-btn-primary zcode-image-editor-actions-btn",onClick:k[5]||(k[5]=(...w)=>s.unref(y)&&s.unref(y)(...w))},[s.createVNode(s.unref(er),{size:16}),s.createElementVNode("span",null,s.toDisplayString(M.$t("common.confirm")),1)]),s.createElementVNode("button",{class:"zcode-btn-cancel zcode-image-editor-actions-btn",onClick:k[6]||(k[6]=(...w)=>s.unref(x)&&s.unref(x)(...w))},[s.createVNode(s.unref(Ye),{size:16}),s.createElementVNode("span",null,s.toDisplayString(M.$t("common.cancel")),1)])])])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[i.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:k[11]||(k[11]=s.withModifiers(w=>i.value=!1,["self"]))},[s.createElementVNode("div",{class:"zcode-help-modal",onClick:k[10]||(k[10]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",NM,[s.createElementVNode("div",vM,[s.createVNode(s.unref(Hs),{size:20,class:"zcode-css-warning-modal-title-icon"}),s.createElementVNode("span",null,s.toDisplayString(M.$t("dataViewer.categoryInfo.title")),1)]),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":M.$t("common.close"),onClick:k[9]||(k[9]=w=>i.value=!1)},[s.createVNode(s.unref(Ye),{size:18})],8,TM)]),s.createElementVNode("div",zM,[s.createElementVNode("div",MM,[s.createElementVNode("div",AM,s.toDisplayString(M.$t("dataViewer.categoryInfo.common.title")),1),s.createElementVNode("div",IM,s.toDisplayString(M.$t("dataViewer.categoryInfo.common.description")),1)]),s.createElementVNode("div",_M,[s.createElementVNode("div",OM,s.toDisplayString(M.$t("dataViewer.categoryInfo.individual.title")),1),s.createElementVNode("div",DM,s.toDisplayString(M.$t("dataViewer.categoryInfo.individual.description")),1)]),s.createElementVNode("div",PM,[s.createElementVNode("div",RM,s.toDisplayString(M.$t("dataViewer.categoryInfo.special.title")),1),s.createElementVNode("div",LM,s.toDisplayString(M.$t("dataViewer.categoryInfo.special.description")),1)])])])])):s.createCommentVNode("",!0)]))]))}}),VM={class:"zcode-data-viewer"},BM={class:"zcode-data-viewer-header"},FM={class:"zcode-data-viewer-content-tabs"},jM={class:"zcode-data-viewer-tabs"},HM=["onClick"],UM={class:"zcode-data-viewer-content"},WM={class:"zcode-data-viewer-display-wrapper"},qM={class:"zcode-data-viewer-display"},GM=["title"],KM=s.defineComponent({__name:"DataViewer",props:{cmsData:{type:Object},config:{type:Object}},setup(n,{expose:e}){const t=n,o=s.ref("page"),r=s.ref("json"),i=s.ref(!1),a=s.computed(()=>t.config?.categoryOrder||"common"),l=s.computed(()=>{const N=[];return a.value==="individual"?N.push("individual","common","special"):a.value==="special"?N.push("special","common","individual"):N.push("common","individual","special"),N}),c=s.ref(t.config?.categoryOrder==="individual"?"individual":t.config?.categoryOrder==="special"?"special":"common"),{fullPageHtml:d}=gi(t.cmsData,!1),u=s.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=s.ref("");let p="";function h(){try{const N=u.value,E=JSON.stringify(N,null,2);if(E===p)return;f.value=E,p=E}catch{f.value=String(u.value),p=f.value}}function m(N){let E=N.replace(/\\\\/g,"\0").replace(/\\u([0-9a-fA-F]{4})/g,(v,A)=>String.fromCharCode(parseInt(A,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 g(N){if(!N)return"";const v=N.replace(/>\s+</g,"><").replace(/></g,`>
483
483
  <`).split(`
484
484
  `),A=[];let M=0;for(const k of v){const w=k.trim();if(!w)continue;const b=/^<\/[^>]+>/.test(w),R=/\/>$/.test(w)||/^<!/.test(w),B=/^<[^/!][^>]*>$/.test(w)&&!R;b&&(M=Math.max(M-1,0)),A.push(" ".repeat(M)+w),B&&M++}return A.join(`
485
- `)}const y=s.computed(()=>o.value==="page"&&r.value==="html"?g(d.value):m(f.value));s.watch(u,()=>{h()},{deep:!0,immediate:!1}),s.watch(()=>t.cmsData,()=>{h()},{deep:!0}),s.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}),s.watch(c,()=>{h()}),s.watch(o,()=>{c.value=t.config?.categoryOrder==="individual"?"individual":"common",h()});const x=async()=>{const C=y.value;try{await navigator.clipboard.writeText(C),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(E){console.error("コピーに失敗しました:",E);const v=document.createElement("textarea");v.value=C,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(A){console.error("コピーに失敗しました:",A)}document.body.removeChild(v)}};return h(),e({internalActiveTab:o,activeCategory:c}),(C,E)=>(s.openBlock(),s.createElementBlock("div",VM,[s.createElementVNode("div",BM,[s.createElementVNode("div",FM,[s.createElementVNode("button",{class:s.normalizeClass([{active:o.value==="page"},"zcode-data-viewer-content-tab"]),onClick:E[0]||(E[0]=v=>o.value="page")},s.toDisplayString(C.$t("dataViewer.page")),3),s.createElementVNode("button",{class:s.normalizeClass([{active:o.value==="parts"},"zcode-data-viewer-content-tab"]),onClick:E[1]||(E[1]=v=>o.value="parts")},s.toDisplayString(C.$t("dataViewer.parts")),3),s.createElementVNode("button",{class:s.normalizeClass([{active:o.value==="images"},"zcode-data-viewer-content-tab"]),onClick:E[2]||(E[2]=v=>o.value="images")},s.toDisplayString(C.$t("dataViewer.images")),3)]),s.createElementVNode("div",jM,[o.value==="page"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createElementVNode("button",{class:s.normalizeClass([{active:r.value==="json"},"zcode-data-viewer-tab"]),onClick:E[3]||(E[3]=v=>r.value="json")},s.toDisplayString(C.$t("dataViewer.json")),3),s.createElementVNode("button",{class:s.normalizeClass([{active:r.value==="html"},"zcode-data-viewer-tab"]),onClick:E[4]||(E[4]=v=>r.value="html")},s.toDisplayString(C.$t("dataViewer.html")),3)],64)):(s.openBlock(!0),s.createElementBlock(s.Fragment,{key:1},s.renderList(l.value,v=>(s.openBlock(),s.createElementBlock("button",{key:v,class:s.normalizeClass([{active:c.value===v},"zcode-data-viewer-tab"]),onClick:A=>c.value=v},s.toDisplayString(v==="common"?C.$t("dataViewer.common"):v==="individual"?C.$t("dataViewer.individual"):C.$t("dataViewer.special")),11,HM))),128))])]),s.createElementVNode("div",UM,[s.createElementVNode("div",WM,[s.createElementVNode("pre",qM,s.toDisplayString(y.value),1),s.createElementVNode("button",{class:"zcode-data-viewer-copy-btn",title:i.value?C.$t("common.copied"):C.$t("common.copy"),onClick:x},[i.value?(s.openBlock(),s.createBlock(s.unref(er),{key:0,size:18})):(s.openBlock(),s.createBlock(s.unref(ym),{key:1,size:18}))],8,GM)])])]))}}),JM={class:"zcode-dev-container"},XM={class:"zcode-dev-header"},YM={class:"zcode-dev-tabs"},QM=["title"],ZM={key:3,class:"zcode-loading-message"},eA={class:"zcode-loading-message-text"},tA={key:5,class:"zcode-loading-message"},nA={class:"zcode-loading-message-text"},oA={key:6,class:"zcode-save-controls-fixed"},rA={class:"zcode-save-confirm-dialog"},iA={class:"zcode-save-confirm-dialog-header"},sA={class:"zcode-save-confirm-dialog-title"},aA={class:"zcode-save-confirm-dialog-body"},lA={class:"zcode-save-confirm-targets"},cA={class:"zcode-save-confirm-dialog-footer"},ac=s.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}=Vt(),o=n,r=s.computed(()=>o.enablePartsManager!==!1),i=s.computed(()=>o.enableImagesManager!==!1),a=s.ref("manage"),l=s.ref("edit"),c=s.ref(null),d=s.ref(null),u=s.ref(null),f=s.ref(null),p=s.ref(!1),h=s.ref(!1),m=s.ref([]),y=(z=>{if(!z)return{};try{return JSON.parse(z)}catch(U){return console.warn("[ZeroCodeEditor] Failed to parse config:",U),{}}})(o.config);function x(){const z={common:{add:!1,delete:!1},individual:{add:!1,delete:!1},special:{add:!1,delete:!1}},U=y.cms?.imageModalActions;return U?{common:{...z.common,...U.common},individual:{...z.individual,...U.individual},special:{...z.special,...U.special}}:z}function C(z){return typeof z=="object"&&z!==null}function E(z){return z==="common"||z==="individual"||z==="special"}function v(z){return z==="page"||z==="parts"||z==="images"}function A(z){if(C(z)&&"value"in z)return z.value}function M(z){const U=A(z);if(typeof U=="boolean")return U;if(typeof z=="boolean")return z}function k(z){const U=A(z);if(typeof U=="string")return U;if(typeof z=="string")return z}function w(z,U){return C(z)&&"value"in z?(z.value=U,!0):!1}function b(z,U){if(C(z))return z[U]}function R(z){const U=b(z,"activeCategory");if(E(U))return U;const ie=A(U);return E(ie)?ie:void 0}function B(z){const U=b(z,"internalActiveTab");if(v(U))return U;const ie=A(U);return v(ie)?ie:void 0}function O(){const z=c.value;return!C(z)||!("cmsData"in z)||!("currentMode"in z)||!("switchMode"in z)||!("allowDynamicContentInteraction"in z)||!("settingsPanelOpen"in z)||!("setData"in z)?null:z}const D=(z,U,ie)=>{const Se=Yd();return Se[z]!==void 0?Se[z]:ie!==void 0?ie:U},P=s.ref(D("showDataViewer",!1,y.dev?.showDataViewer)),q=s.ref(D("showSaveConfirm",!0,y.dev?.showSaveConfirm)),{cmsData:W,loadDataFromProps:V}=jh(o),G=s.computed(()=>{const z=O();return z?z.cmsData:W}),J=s.computed(()=>{const z=O();return(z?k(z.currentMode):void 0)??"edit"}),oe=z=>{c.value?.switchMode&&c.value.switchMode(z)};function ne(z){l.value=z,(z==="parts"||z==="images"||z==="data")&&(a.value="manage")}function X(){const z=O();z&&!w(z.settingsPanelOpen,!0)&&(z.settingsPanelOpen=!0)}const Z=s.computed(()=>{if(a.value==="preview")return!0;const z=O();if(z){const U=M(z.allowDynamicContentInteraction);if(U!==void 0)return U}return nb("allowDynamicContentInteraction",!1)});function Y(z){const U=G.value;if(!z)return U;const ie=z.split(".");let Se=U;for(const ve of ie)if(!C(Se)||(Se=Se[ve],Se===void 0))return;return Se}function te(z,U){const ie=O();return ie?ie.setData(z,U):!1}s.onMounted(()=>{V()}),s.watch([()=>o.page,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial],()=>{V()}),s.watch(P,z=>{Ea({showDataViewer:z})}),s.watch(q,z=>{Ea({showSaveConfirm:z})}),s.watch(a,(z,U)=>{me("view-mode-changed",{mode:z,previousMode:U})});function de(z){q.value=z}function me(z,U){const ie=document.querySelector("zcode-editor");if(ie){const ve=new CustomEvent(z,{detail:U,bubbles:!0,composed:!0});ie.dispatchEvent(ve);return}const Se=new CustomEvent(z,{detail:U,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(Se)}function Me(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Le(){if(!G.value)return[];let z;if(l.value==="edit")z="page";else if(l.value==="parts")if(!d.value)console.warn('[ZeroCode] partsManagerRefが設定されていません。デフォルトで"common"を使用します。'),z="parts-common";else{const ie=R(d.value);ie==null?(console.warn('[ZeroCode] parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),z="parts-common"):ie==="common"?z="parts-common":ie==="individual"?z="parts-individual":z="parts-special"}else if(l.value==="images")if(!u.value)console.warn('[ZeroCode] imagesManagerRefが設定されていません。デフォルトで"common"を使用します。'),z="images-common";else{const ie=R(u.value);ie==null?(console.warn('[ZeroCode] images activeCategoryが取得できません。デフォルトで"common"を使用します。'),z="images-common"):ie==="common"?z="images-common":ie==="individual"?z="images-individual":z="images-special"}else if(l.value==="data")if(!f.value)console.warn('[ZeroCode] dataViewerRefが設定されていません。デフォルトで"page"を使用します。'),z="page";else{const ie=B(f.value),Se=R(f.value);if(ie==null)console.warn('[ZeroCode] dataViewer internalActiveTabが取得できません。デフォルトで"page"を使用します。'),z="page";else if(ie==="page")z="page";else if(ie==="parts")Se==null?(console.warn('[ZeroCode] dataViewer parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),z="parts-common"):Se==="common"?z="parts-common":Se==="individual"?z="parts-individual":z="parts-special";else if(ie==="images")Se==null?(console.warn('[ZeroCode] dataViewer images activeCategoryが取得できません。デフォルトで"common"を使用します。'),z="images-common"):Se==="common"?z="images-common":Se==="individual"?z="images-individual":z="images-special";else return console.warn(`[ZeroCode] dataViewer 不明なinternalActiveTab: ${ie}`),[]}else return[];let U;if(z==="page"){U=["page"];const ie=x();(ie.common?.add||ie.common?.delete)&&U.push("images-common"),(ie.individual?.add||ie.individual?.delete)&&U.push("images-individual"),(ie.special?.add||ie.special?.delete)&&U.push("images-special")}else z==="parts-common"?U=[z,"parts-common-css"]:z==="parts-individual"?U=[z,"parts-individual-css"]:z==="parts-special"?U=[z,"parts-special-css"]:U=[z];return U}function N(){if(!q.value){L();return}const z=Le();if(z.length===0){console.warn(`[ZeroCode] ${t("editor.noSaveTargets")}`);return}m.value=z,h.value=!0}function L(){const z=Le();if(z.length===0){console.warn(`[ZeroCode] ${t("editor.noSaveTargets")}`);return}me("save-request",{requestId:Me(),source:"editor",targets:z,timestamp:Date.now()})}function $(){h.value=!1,L()}function S(){h.value=!1,m.value=[]}function K(z){const{t:U}=Vt();return{page:U("saveConfirm.targets.page"),"parts-common":U("saveConfirm.targets.parts-common"),"parts-individual":U("saveConfirm.targets.parts-individual"),"parts-special":U("saveConfirm.targets.parts-special"),"images-common":U("saveConfirm.targets.images-common"),"images-individual":U("saveConfirm.targets.images-individual"),"images-special":U("saveConfirm.targets.images-special"),"parts-common-css":U("saveConfirm.targets.parts-common-css"),"parts-individual-css":U("saveConfirm.targets.parts-individual-css"),"parts-special-css":U("saveConfirm.targets.parts-special-css")}[z]||z}return e({getData:Y,setData:te,allowDynamicContentInteraction:Z}),(z,U)=>(s.openBlock(),s.createElementBlock("div",JM,[s.createElementVNode("div",XM,[s.createElementVNode("div",YM,[s.createElementVNode("button",{class:s.normalizeClass([{active:l.value==="edit"},"zcode-dev-tab"]),onClick:U[0]||(U[0]=ie=>ne("edit"))},[s.createVNode(s.unref(Us),{size:16}),s.createElementVNode("span",null,s.toDisplayString(z.$t("editor.pageManagement")),1)],2),r.value?(s.openBlock(),s.createElementBlock("button",{key:0,class:s.normalizeClass([{active:l.value==="parts"},"zcode-dev-tab"]),onClick:U[1]||(U[1]=ie=>ne("parts"))},[s.createVNode(s.unref(Cm),{size:16}),s.createElementVNode("span",null,s.toDisplayString(z.$t("editor.partsManagement")),1)],2)):s.createCommentVNode("",!0),i.value?(s.openBlock(),s.createElementBlock("button",{key:1,class:s.normalizeClass([{active:l.value==="images"},"zcode-dev-tab"]),onClick:U[2]||(U[2]=ie=>ne("images"))},[s.createVNode(s.unref(yc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(z.$t("editor.imagesManagement")),1)],2)):s.createCommentVNode("",!0),s.createElementVNode("button",{class:s.normalizeClass([{active:l.value==="data"},"zcode-dev-tab"]),onClick:U[3]||(U[3]=ie=>ne("data"))},[s.createVNode(s.unref(bm),{size:16}),s.createElementVNode("span",null,s.toDisplayString(z.$t("editor.dataViewer")),1)],2),s.createElementVNode("button",{class:"zcode-dev-tab zcode-dev-settings-btn",title:z.$t("toolbar.settings"),onClick:U[4]||(U[4]=ie=>p.value=!0)},[s.createVNode(s.unref(kc),{size:16})],8,QM)])]),l.value==="edit"?(s.openBlock(),s.createBlock(Kd,{key:0,"current-mode":J.value,"view-mode":a.value,"allow-dynamic-content-interaction":Z.value,onSwitchMode:oe,onSwitchViewMode:U[5]||(U[5]=ie=>a.value=ie),onOpenSettings:X},null,8,["current-mode","view-mode","allow-dynamic-content-interaction"])):s.createCommentVNode("",!0),a.value==="preview"&&G.value?(s.openBlock(),s.createBlock(xa,{key:1,"cms-data":G.value,"allow-dynamic-content-interaction":Z.value},null,8,["cms-data","allow-dynamic-content-interaction"])):s.createCommentVNode("",!0),s.withDirectives(s.createVNode(Ps,{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"]),[[s.vShow,a.value==="manage"&&l.value==="edit"]]),a.value==="manage"&&r.value&&l.value==="parts"&&G.value?(s.openBlock(),s.createBlock(Qz,{key:2,ref_key:"partsManagerRef",ref:d,"cms-data":G.value,config:s.unref(y)},null,8,["cms-data","config"])):s.createCommentVNode("",!0),a.value==="manage"&&r.value&&l.value==="parts"&&!G.value?(s.openBlock(),s.createElementBlock("div",ZM,[s.createElementVNode("div",eA,s.toDisplayString(z.$t("editor.loading")),1)])):s.createCommentVNode("",!0),a.value==="manage"&&i.value&&l.value==="images"&&G.value?(s.openBlock(),s.createBlock($M,{key:4,ref_key:"imagesManagerRef",ref:u,"cms-data":G.value,config:s.unref(y)},null,8,["cms-data","config"])):s.createCommentVNode("",!0),a.value==="manage"&&i.value&&l.value==="images"&&!G.value?(s.openBlock(),s.createElementBlock("div",tA,[s.createElementVNode("div",nA,s.toDisplayString(z.$t("editor.loading")),1)])):s.createCommentVNode("",!0),s.withDirectives(s.createVNode(KM,{ref_key:"dataViewerRef",ref:f,"cms-data":G.value,config:s.unref(y)},null,8,["cms-data","config"]),[[s.vShow,a.value==="manage"&&l.value==="data"&&G.value]]),s.withDirectives(s.createVNode(Zd,{"is-open":p.value,"view-mode":a.value,mode:"dev-tabs","show-save-confirm":q.value,onClose:U[6]||(U[6]=ie=>p.value=!1),onToggleSaveConfirm:de},null,8,["is-open","view-mode","show-save-confirm"]),[[s.vShow,p.value]]),a.value==="manage"?(s.openBlock(),s.createElementBlock("div",oA,[s.createElementVNode("button",{class:"zcode-save-btn",onClick:N},[s.createVNode(s.unref(xc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(z.$t("common.save")),1)])])):s.createCommentVNode("",!0),h.value?(s.openBlock(),s.createElementBlock("div",{key:7,class:"zcode-save-confirm-dialog-overlay",onClick:s.withModifiers(S,["self"])},[s.createElementVNode("div",rA,[s.createElementVNode("div",iA,[s.createElementVNode("div",sA,s.toDisplayString(z.$t("saveConfirm.title")),1)]),s.createElementVNode("div",aA,[s.createElementVNode("p",null,s.toDisplayString(z.$t("saveConfirm.message")),1),s.createElementVNode("ul",lA,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(m.value,ie=>(s.openBlock(),s.createElementBlock("li",{key:ie},s.toDisplayString(K(ie)),1))),128))])]),s.createElementVNode("div",cA,[s.createElementVNode("button",{class:"zcode-btn-secondary",onClick:S},s.toDisplayString(z.$t("common.cancel")),1),s.createElementVNode("button",{class:"zcode-btn-primary",onClick:$},s.toDisplayString(z.$t("saveConfirm.saveButton")),1)])])])):s.createCommentVNode("",!0)]))}});Gh();class dA 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")||"[]",a=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=Rs(this);this.app=s.createApp(ac,{locale:f,page:e,cssCommon:t,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:a,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"}),Ls(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"),a=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=Rs(this);this.app=s.createApp(ac,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:a,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"}),Ls(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=Wh,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 a=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=a(u);f.onload=()=>{c++,c===d&&(Io(this._shadowRoot,e),requestAnimationFrame(()=>{i.forEach(p=>{this._shadowRoot.appendChild(a(p))}),l()}))},this._shadowRoot.appendChild(f)})}else Io(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(a(c))}),l()}injectLightDOMScripts(){const e=this.querySelectorAll('[slot="script"]'),t=[],o=[];e.forEach(i=>{const a=i;if(!a.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}a.src.includes("jquery")||a.src.includes("code.jquery.com")?t.push(a):o.push(a)});const r=i=>{const a=document.createElement("script");return a.src=i.src,i.type&&(a.type=i.type),i.async&&(a.async=!0),i.defer&&(a.defer=!0),i.integrity&&(a.integrity=i.integrity),i.crossOrigin&&(a.crossOrigin=i.crossOrigin),a.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},a};if(t.length>0){let i=0;const a=t.length;t.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===a&&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(),Io(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",dA);class Gr extends Error{constructor(e,t,o){super(o),this.code=e,this.path=t,this.name="RenderError"}}function uA(n,e={}){const{enableEditorAttributes:t=!1}=e,o=n.backendData;if(!n)throw new Gr("PARSE_ERROR","","データが提供されていません");const r=n.parts||{common:[],individual:[],special:[]},i=n.images||{common:[],individual:[],special:[]},a=n.page||[];function l(d){return ba(d,r)}function c(d,u="",f=new Set){if(f.has(u))throw new Gr("CIRCULAR_REFERENCE",u,`循環参照が検出されました: ${u}`);f.add(u);const p=d.part_id,h=l(p);if(!h)throw new Gr("PART_NOT_FOUND",u,`パーツが見つかりません: ${p}`);const m=mi(h.body,d,u,l,(g,y)=>c(g,y,f),t,i.common,i.individual,i.special,o);return t?Wd(m,{"data-zcode-id":d.id,"data-zcode-path":u,"data-zcode-part":p}):m}return a.map((d,u)=>{try{return c(d,`page.${u}`)}catch(f){if(f instanceof Gr)return`<div class="zcode-error-message" data-error-code="${f.code}">${f.message}</div>`;throw f}}).join("")}Qt.RenderError=Gr,Qt.ZeroCodeCMS=Ps,Qt.ZeroCodeEditor=ac,Qt.ZeroCodePreview=xa,Qt.renderToHtml=uA,Object.defineProperty(Qt,Symbol.toStringTag,{value:"Module"})}));
485
+ `)}const y=s.computed(()=>o.value==="page"&&r.value==="html"?g(d.value):m(f.value));s.watch(u,()=>{h()},{deep:!0,immediate:!1}),s.watch(()=>t.cmsData,()=>{h()},{deep:!0}),s.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}),s.watch(c,()=>{h()}),s.watch(o,()=>{c.value=t.config?.categoryOrder==="individual"?"individual":"common",h()});const x=async()=>{const N=y.value;try{await navigator.clipboard.writeText(N),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(E){console.error("コピーに失敗しました:",E);const v=document.createElement("textarea");v.value=N,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(A){console.error("コピーに失敗しました:",A)}document.body.removeChild(v)}};return h(),e({internalActiveTab:o,activeCategory:c}),(N,E)=>(s.openBlock(),s.createElementBlock("div",VM,[s.createElementVNode("div",BM,[s.createElementVNode("div",FM,[s.createElementVNode("button",{class:s.normalizeClass([{active:o.value==="page"},"zcode-data-viewer-content-tab"]),onClick:E[0]||(E[0]=v=>o.value="page")},s.toDisplayString(N.$t("dataViewer.page")),3),s.createElementVNode("button",{class:s.normalizeClass([{active:o.value==="parts"},"zcode-data-viewer-content-tab"]),onClick:E[1]||(E[1]=v=>o.value="parts")},s.toDisplayString(N.$t("dataViewer.parts")),3),s.createElementVNode("button",{class:s.normalizeClass([{active:o.value==="images"},"zcode-data-viewer-content-tab"]),onClick:E[2]||(E[2]=v=>o.value="images")},s.toDisplayString(N.$t("dataViewer.images")),3)]),s.createElementVNode("div",jM,[o.value==="page"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createElementVNode("button",{class:s.normalizeClass([{active:r.value==="json"},"zcode-data-viewer-tab"]),onClick:E[3]||(E[3]=v=>r.value="json")},s.toDisplayString(N.$t("dataViewer.json")),3),s.createElementVNode("button",{class:s.normalizeClass([{active:r.value==="html"},"zcode-data-viewer-tab"]),onClick:E[4]||(E[4]=v=>r.value="html")},s.toDisplayString(N.$t("dataViewer.html")),3)],64)):(s.openBlock(!0),s.createElementBlock(s.Fragment,{key:1},s.renderList(l.value,v=>(s.openBlock(),s.createElementBlock("button",{key:v,class:s.normalizeClass([{active:c.value===v},"zcode-data-viewer-tab"]),onClick:A=>c.value=v},s.toDisplayString(v==="common"?N.$t("dataViewer.common"):v==="individual"?N.$t("dataViewer.individual"):N.$t("dataViewer.special")),11,HM))),128))])]),s.createElementVNode("div",UM,[s.createElementVNode("div",WM,[s.createElementVNode("pre",qM,s.toDisplayString(y.value),1),s.createElementVNode("button",{class:"zcode-data-viewer-copy-btn",title:i.value?N.$t("common.copied"):N.$t("common.copy"),onClick:x},[i.value?(s.openBlock(),s.createBlock(s.unref(er),{key:0,size:18})):(s.openBlock(),s.createBlock(s.unref(ym),{key:1,size:18}))],8,GM)])])]))}}),JM={class:"zcode-dev-container"},XM={class:"zcode-dev-header"},YM={class:"zcode-dev-tabs"},QM=["title"],ZM={key:3,class:"zcode-loading-message"},eA={class:"zcode-loading-message-text"},tA={key:5,class:"zcode-loading-message"},nA={class:"zcode-loading-message-text"},oA={key:6,class:"zcode-save-controls-fixed"},rA={class:"zcode-save-confirm-dialog"},iA={class:"zcode-save-confirm-dialog-header"},sA={class:"zcode-save-confirm-dialog-title"},aA={class:"zcode-save-confirm-dialog-body"},lA={class:"zcode-save-confirm-targets"},cA={class:"zcode-save-confirm-dialog-footer"},ac=s.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}=Vt(),o=n,r=s.computed(()=>o.enablePartsManager!==!1),i=s.computed(()=>o.enableImagesManager!==!1),a=s.ref("manage"),l=s.ref("edit"),c=s.ref(null),d=s.ref(null),u=s.ref(null),f=s.ref(null),p=s.ref(!1),h=s.ref(!1),m=s.ref([]),y=(z=>{if(!z)return{};try{return JSON.parse(z)}catch(U){return console.warn("[ZeroCodeEditor] Failed to parse config:",U),{}}})(o.config);function x(){const z={common:{add:!1,delete:!1},individual:{add:!1,delete:!1},special:{add:!1,delete:!1}},U=y.cms?.imageModalActions;return U?{common:{...z.common,...U.common},individual:{...z.individual,...U.individual},special:{...z.special,...U.special}}:z}function N(z){return typeof z=="object"&&z!==null}function E(z){return z==="common"||z==="individual"||z==="special"}function v(z){return z==="page"||z==="parts"||z==="images"}function A(z){if(N(z)&&"value"in z)return z.value}function M(z){const U=A(z);if(typeof U=="boolean")return U;if(typeof z=="boolean")return z}function k(z){const U=A(z);if(typeof U=="string")return U;if(typeof z=="string")return z}function w(z,U){return N(z)&&"value"in z?(z.value=U,!0):!1}function b(z,U){if(N(z))return z[U]}function R(z){const U=b(z,"activeCategory");if(E(U))return U;const ie=A(U);return E(ie)?ie:void 0}function B(z){const U=b(z,"internalActiveTab");if(v(U))return U;const ie=A(U);return v(ie)?ie:void 0}function O(){const z=c.value;return!N(z)||!("cmsData"in z)||!("currentMode"in z)||!("switchMode"in z)||!("allowDynamicContentInteraction"in z)||!("settingsPanelOpen"in z)||!("setData"in z)?null:z}const D=(z,U,ie)=>{const Se=Yd();return Se[z]!==void 0?Se[z]:ie!==void 0?ie:U},P=s.ref(D("showDataViewer",!1,y.dev?.showDataViewer)),q=s.ref(D("showSaveConfirm",!0,y.dev?.showSaveConfirm)),{cmsData:W,loadDataFromProps:V}=jh(o),G=s.computed(()=>{const z=O();return z?z.cmsData:W}),J=s.computed(()=>{const z=O();return(z?k(z.currentMode):void 0)??"edit"}),oe=z=>{c.value?.switchMode&&c.value.switchMode(z)};function ne(z){l.value=z,(z==="parts"||z==="images"||z==="data")&&(a.value="manage")}function X(){const z=O();z&&!w(z.settingsPanelOpen,!0)&&(z.settingsPanelOpen=!0)}const Z=s.computed(()=>{if(a.value==="preview")return!0;const z=O();if(z){const U=M(z.allowDynamicContentInteraction);if(U!==void 0)return U}return nb("allowDynamicContentInteraction",!1)});function Y(z){const U=G.value;if(!z)return U;const ie=z.split(".");let Se=U;for(const ve of ie)if(!N(Se)||(Se=Se[ve],Se===void 0))return;return Se}function te(z,U){const ie=O();return ie?ie.setData(z,U):!1}s.onMounted(()=>{V()}),s.watch([()=>o.page,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial],()=>{V()}),s.watch(P,z=>{Ea({showDataViewer:z})}),s.watch(q,z=>{Ea({showSaveConfirm:z})}),s.watch(a,(z,U)=>{me("view-mode-changed",{mode:z,previousMode:U})});function de(z){q.value=z}function me(z,U){const ie=document.querySelector("zcode-editor");if(ie){const ve=new CustomEvent(z,{detail:U,bubbles:!0,composed:!0});ie.dispatchEvent(ve);return}const Se=new CustomEvent(z,{detail:U,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(Se)}function Me(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Le(){if(!G.value)return[];let z;if(l.value==="edit")z="page";else if(l.value==="parts")if(!d.value)console.warn('[ZeroCode] partsManagerRefが設定されていません。デフォルトで"common"を使用します。'),z="parts-common";else{const ie=R(d.value);ie==null?(console.warn('[ZeroCode] parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),z="parts-common"):ie==="common"?z="parts-common":ie==="individual"?z="parts-individual":z="parts-special"}else if(l.value==="images")if(!u.value)console.warn('[ZeroCode] imagesManagerRefが設定されていません。デフォルトで"common"を使用します。'),z="images-common";else{const ie=R(u.value);ie==null?(console.warn('[ZeroCode] images activeCategoryが取得できません。デフォルトで"common"を使用します。'),z="images-common"):ie==="common"?z="images-common":ie==="individual"?z="images-individual":z="images-special"}else if(l.value==="data")if(!f.value)console.warn('[ZeroCode] dataViewerRefが設定されていません。デフォルトで"page"を使用します。'),z="page";else{const ie=B(f.value),Se=R(f.value);if(ie==null)console.warn('[ZeroCode] dataViewer internalActiveTabが取得できません。デフォルトで"page"を使用します。'),z="page";else if(ie==="page")z="page";else if(ie==="parts")Se==null?(console.warn('[ZeroCode] dataViewer parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),z="parts-common"):Se==="common"?z="parts-common":Se==="individual"?z="parts-individual":z="parts-special";else if(ie==="images")Se==null?(console.warn('[ZeroCode] dataViewer images activeCategoryが取得できません。デフォルトで"common"を使用します。'),z="images-common"):Se==="common"?z="images-common":Se==="individual"?z="images-individual":z="images-special";else return console.warn(`[ZeroCode] dataViewer 不明なinternalActiveTab: ${ie}`),[]}else return[];let U;if(z==="page"){U=["page"];const ie=x();(ie.common?.add||ie.common?.delete)&&U.push("images-common"),(ie.individual?.add||ie.individual?.delete)&&U.push("images-individual"),(ie.special?.add||ie.special?.delete)&&U.push("images-special")}else z==="parts-common"?U=[z,"parts-common-css"]:z==="parts-individual"?U=[z,"parts-individual-css"]:z==="parts-special"?U=[z,"parts-special-css"]:U=[z];return U}function C(){if(!q.value){L();return}const z=Le();if(z.length===0){console.warn(`[ZeroCode] ${t("editor.noSaveTargets")}`);return}m.value=z,h.value=!0}function L(){const z=Le();if(z.length===0){console.warn(`[ZeroCode] ${t("editor.noSaveTargets")}`);return}me("save-request",{requestId:Me(),source:"editor",targets:z,timestamp:Date.now()})}function $(){h.value=!1,L()}function S(){h.value=!1,m.value=[]}function K(z){const{t:U}=Vt();return{page:U("saveConfirm.targets.page"),"parts-common":U("saveConfirm.targets.parts-common"),"parts-individual":U("saveConfirm.targets.parts-individual"),"parts-special":U("saveConfirm.targets.parts-special"),"images-common":U("saveConfirm.targets.images-common"),"images-individual":U("saveConfirm.targets.images-individual"),"images-special":U("saveConfirm.targets.images-special"),"parts-common-css":U("saveConfirm.targets.parts-common-css"),"parts-individual-css":U("saveConfirm.targets.parts-individual-css"),"parts-special-css":U("saveConfirm.targets.parts-special-css")}[z]||z}return e({getData:Y,setData:te,allowDynamicContentInteraction:Z}),(z,U)=>(s.openBlock(),s.createElementBlock("div",JM,[s.createElementVNode("div",XM,[s.createElementVNode("div",YM,[s.createElementVNode("button",{class:s.normalizeClass([{active:l.value==="edit"},"zcode-dev-tab"]),onClick:U[0]||(U[0]=ie=>ne("edit"))},[s.createVNode(s.unref(Us),{size:16}),s.createElementVNode("span",null,s.toDisplayString(z.$t("editor.pageManagement")),1)],2),r.value?(s.openBlock(),s.createElementBlock("button",{key:0,class:s.normalizeClass([{active:l.value==="parts"},"zcode-dev-tab"]),onClick:U[1]||(U[1]=ie=>ne("parts"))},[s.createVNode(s.unref(Cm),{size:16}),s.createElementVNode("span",null,s.toDisplayString(z.$t("editor.partsManagement")),1)],2)):s.createCommentVNode("",!0),i.value?(s.openBlock(),s.createElementBlock("button",{key:1,class:s.normalizeClass([{active:l.value==="images"},"zcode-dev-tab"]),onClick:U[2]||(U[2]=ie=>ne("images"))},[s.createVNode(s.unref(yc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(z.$t("editor.imagesManagement")),1)],2)):s.createCommentVNode("",!0),s.createElementVNode("button",{class:s.normalizeClass([{active:l.value==="data"},"zcode-dev-tab"]),onClick:U[3]||(U[3]=ie=>ne("data"))},[s.createVNode(s.unref(bm),{size:16}),s.createElementVNode("span",null,s.toDisplayString(z.$t("editor.dataViewer")),1)],2),s.createElementVNode("button",{class:"zcode-dev-tab zcode-dev-settings-btn",title:z.$t("toolbar.settings"),onClick:U[4]||(U[4]=ie=>p.value=!0)},[s.createVNode(s.unref(kc),{size:16})],8,QM)])]),l.value==="edit"?(s.openBlock(),s.createBlock(Kd,{key:0,"current-mode":J.value,"view-mode":a.value,"allow-dynamic-content-interaction":Z.value,onSwitchMode:oe,onSwitchViewMode:U[5]||(U[5]=ie=>a.value=ie),onOpenSettings:X},null,8,["current-mode","view-mode","allow-dynamic-content-interaction"])):s.createCommentVNode("",!0),a.value==="preview"&&G.value?(s.openBlock(),s.createBlock(xa,{key:1,"cms-data":G.value,"allow-dynamic-content-interaction":Z.value},null,8,["cms-data","allow-dynamic-content-interaction"])):s.createCommentVNode("",!0),s.withDirectives(s.createVNode(Ps,{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"]),[[s.vShow,a.value==="manage"&&l.value==="edit"]]),a.value==="manage"&&r.value&&l.value==="parts"&&G.value?(s.openBlock(),s.createBlock(Qz,{key:2,ref_key:"partsManagerRef",ref:d,"cms-data":G.value,config:s.unref(y)},null,8,["cms-data","config"])):s.createCommentVNode("",!0),a.value==="manage"&&r.value&&l.value==="parts"&&!G.value?(s.openBlock(),s.createElementBlock("div",ZM,[s.createElementVNode("div",eA,s.toDisplayString(z.$t("editor.loading")),1)])):s.createCommentVNode("",!0),a.value==="manage"&&i.value&&l.value==="images"&&G.value?(s.openBlock(),s.createBlock($M,{key:4,ref_key:"imagesManagerRef",ref:u,"cms-data":G.value,config:s.unref(y)},null,8,["cms-data","config"])):s.createCommentVNode("",!0),a.value==="manage"&&i.value&&l.value==="images"&&!G.value?(s.openBlock(),s.createElementBlock("div",tA,[s.createElementVNode("div",nA,s.toDisplayString(z.$t("editor.loading")),1)])):s.createCommentVNode("",!0),s.withDirectives(s.createVNode(KM,{ref_key:"dataViewerRef",ref:f,"cms-data":G.value,config:s.unref(y)},null,8,["cms-data","config"]),[[s.vShow,a.value==="manage"&&l.value==="data"&&G.value]]),s.withDirectives(s.createVNode(Zd,{"is-open":p.value,"view-mode":a.value,mode:"dev-tabs","show-save-confirm":q.value,onClose:U[6]||(U[6]=ie=>p.value=!1),onToggleSaveConfirm:de},null,8,["is-open","view-mode","show-save-confirm"]),[[s.vShow,p.value]]),a.value==="manage"?(s.openBlock(),s.createElementBlock("div",oA,[s.createElementVNode("button",{class:"zcode-save-btn",onClick:C},[s.createVNode(s.unref(xc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(z.$t("common.save")),1)])])):s.createCommentVNode("",!0),h.value?(s.openBlock(),s.createElementBlock("div",{key:7,class:"zcode-save-confirm-dialog-overlay",onClick:s.withModifiers(S,["self"])},[s.createElementVNode("div",rA,[s.createElementVNode("div",iA,[s.createElementVNode("div",sA,s.toDisplayString(z.$t("saveConfirm.title")),1)]),s.createElementVNode("div",aA,[s.createElementVNode("p",null,s.toDisplayString(z.$t("saveConfirm.message")),1),s.createElementVNode("ul",lA,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(m.value,ie=>(s.openBlock(),s.createElementBlock("li",{key:ie},s.toDisplayString(K(ie)),1))),128))])]),s.createElementVNode("div",cA,[s.createElementVNode("button",{class:"zcode-btn-secondary",onClick:S},s.toDisplayString(z.$t("common.cancel")),1),s.createElementVNode("button",{class:"zcode-btn-primary",onClick:$},s.toDisplayString(z.$t("saveConfirm.saveButton")),1)])])])):s.createCommentVNode("",!0)]))}});Gh();class dA 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")||"[]",a=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=Rs(this);this.app=s.createApp(ac,{locale:f,page:e,cssCommon:t,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:a,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"}),Ls(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"),a=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=Rs(this);this.app=s.createApp(ac,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:a,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"}),Ls(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=Wh,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 a=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=a(u);f.onload=()=>{c++,c===d&&(Io(this._shadowRoot,e),requestAnimationFrame(()=>{i.forEach(p=>{this._shadowRoot.appendChild(a(p))}),l()}))},this._shadowRoot.appendChild(f)})}else Io(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(a(c))}),l()}injectLightDOMScripts(){const e=this.querySelectorAll('[slot="script"]'),t=[],o=[];e.forEach(i=>{const a=i;if(!a.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}a.src.includes("jquery")||a.src.includes("code.jquery.com")?t.push(a):o.push(a)});const r=i=>{const a=document.createElement("script");return a.src=i.src,i.type&&(a.type=i.type),i.async&&(a.async=!0),i.defer&&(a.defer=!0),i.integrity&&(a.integrity=i.integrity),i.crossOrigin&&(a.crossOrigin=i.crossOrigin),a.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},a};if(t.length>0){let i=0;const a=t.length;t.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===a&&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(),Io(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",dA);class Gr extends Error{constructor(e,t,o){super(o),this.code=e,this.path=t,this.name="RenderError"}}function uA(n,e={}){const{enableEditorAttributes:t=!1}=e,o=n.backendData;if(!n)throw new Gr("PARSE_ERROR","","データが提供されていません");const r=n.parts||{common:[],individual:[],special:[]},i=n.images||{common:[],individual:[],special:[]},a=n.page||[];function l(d){return ba(d,r)}function c(d,u="",f=new Set){if(f.has(u))throw new Gr("CIRCULAR_REFERENCE",u,`循環参照が検出されました: ${u}`);f.add(u);const p=d.part_id,h=l(p);if(!h)throw new Gr("PART_NOT_FOUND",u,`パーツが見つかりません: ${p}`);const m=mi(h.body,d,u,l,(g,y)=>c(g,y,f),t,i.common,i.individual,i.special,o);return t?Wd(m,{"data-zcode-id":d.id,"data-zcode-path":u,"data-zcode-part":p}):m}return a.map((d,u)=>{try{return c(d,`page.${u}`)}catch(f){if(f instanceof Gr)return`<div class="zcode-error-message" data-error-code="${f.code}">${f.message}</div>`;throw f}}).join("")}Qt.RenderError=Gr,Qt.ZeroCodeCMS=Ps,Qt.ZeroCodeEditor=ac,Qt.ZeroCodePreview=xa,Qt.renderToHtml=uA,Object.defineProperty(Qt,Symbol.toStringTag,{value:"Module"})}));