zerocodejs 1.0.1-beta.2 → 1.0.1-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +199 -0
- package/README.md +128 -102
- package/dist/components/ZeroCodeCMS.vue.d.ts +7 -0
- package/dist/components/ZeroCodeCMS.vue.d.ts.map +1 -1
- package/dist/components/ZeroCodeEditor.vue.d.ts +60 -1
- package/dist/components/ZeroCodeEditor.vue.d.ts.map +1 -1
- package/dist/components/ZeroCodeStudio.vue.d.ts +398 -0
- package/dist/components/ZeroCodeStudio.vue.d.ts.map +1 -0
- package/dist/core/composables/useZeroCodeData.d.ts +3 -0
- package/dist/core/composables/useZeroCodeData.d.ts.map +1 -1
- package/dist/core/composables/useZeroCodeRenderer.d.ts.map +1 -1
- package/dist/core/renderer/renderer.d.ts +30 -1
- package/dist/core/renderer/renderer.d.ts.map +1 -1
- package/dist/core/utils/css-manager.d.ts.map +1 -1
- package/dist/core/utils/dom-utils.d.ts +3 -0
- package/dist/core/utils/dom-utils.d.ts.map +1 -1
- package/dist/core/utils/edit-panel-fields.d.ts +17 -0
- package/dist/core/utils/edit-panel-fields.d.ts.map +1 -0
- package/dist/core/utils/field-extractor.d.ts.map +1 -1
- package/dist/core/utils/i18n-setup.d.ts.map +1 -1
- package/dist/core/utils/image-utils.d.ts.map +1 -1
- package/dist/core/utils/logger.d.ts +5 -0
- package/dist/core/utils/logger.d.ts.map +1 -0
- package/dist/core/utils/path-utils.d.ts +5 -1
- package/dist/core/utils/path-utils.d.ts.map +1 -1
- package/dist/core/utils/sanitize.d.ts +6 -0
- package/dist/core/utils/sanitize.d.ts.map +1 -1
- package/dist/core/utils/storage.d.ts +0 -1
- package/dist/core/utils/storage.d.ts.map +1 -1
- package/dist/core/utils/template-processor.d.ts +6 -1
- package/dist/core/utils/template-processor.d.ts.map +1 -1
- package/dist/core/utils/template-regex.d.ts +0 -1
- package/dist/core/utils/template-regex.d.ts.map +1 -1
- package/dist/core/utils/template-utils.d.ts +3 -1
- package/dist/core/utils/template-utils.d.ts.map +1 -1
- package/dist/features/add/components/AddPanel.vue.d.ts.map +1 -1
- package/dist/features/add/composables/useAddMode.d.ts +7 -1
- package/dist/features/add/composables/useAddMode.d.ts.map +1 -1
- package/dist/features/data-viewer/components/DataViewer.vue.d.ts +1 -0
- package/dist/features/data-viewer/components/DataViewer.vue.d.ts.map +1 -1
- package/dist/features/delete/components/DeletePanel.vue.d.ts.map +1 -1
- package/dist/features/delete/composables/useDeleteMode.d.ts.map +1 -1
- package/dist/features/editor/components/ContextMenu.vue.d.ts.map +1 -1
- package/dist/features/editor/components/EditPanel.vue.d.ts +1 -4
- package/dist/features/editor/components/EditPanel.vue.d.ts.map +1 -1
- package/dist/features/editor/components/ImageSelectModal.vue.d.ts +1 -7
- package/dist/features/editor/components/ImageSelectModal.vue.d.ts.map +1 -1
- package/dist/features/editor/components/RichTextEditor.vue.d.ts.map +1 -1
- package/dist/features/editor/components/SettingsPanel.vue.d.ts.map +1 -1
- package/dist/features/editor/components/Toolbar.vue.d.ts.map +1 -1
- package/dist/features/editor/composables/useClickHandlers.d.ts.map +1 -1
- package/dist/features/editor/composables/useEditMode.d.ts +4 -16
- package/dist/features/editor/composables/useEditMode.d.ts.map +1 -1
- package/dist/features/editor/composables/useOutlineManager.d.ts.map +1 -1
- package/dist/features/images-manager/components/ImagesManagerPanel.vue.d.ts +2 -0
- package/dist/features/images-manager/components/ImagesManagerPanel.vue.d.ts.map +1 -1
- package/dist/features/parts-manager/components/MonacoEditor.vue.d.ts +3 -1
- package/dist/features/parts-manager/components/MonacoEditor.vue.d.ts.map +1 -1
- package/dist/features/parts-manager/components/PartsManagerPanel.vue.d.ts +44 -1
- package/dist/features/parts-manager/components/PartsManagerPanel.vue.d.ts.map +1 -1
- package/dist/features/parts-manager/composables/usePartsManager.d.ts +15 -1
- package/dist/features/parts-manager/composables/usePartsManager.d.ts.map +1 -1
- package/dist/features/preview/PreviewArea.vue.d.ts.map +1 -1
- package/dist/features/reorder/components/ReorderPanel.vue.d.ts.map +1 -1
- package/dist/features/reorder/composables/useReorderMode.d.ts +3 -1
- package/dist/features/reorder/composables/useReorderMode.d.ts.map +1 -1
- package/dist/i18n/index.d.ts +36 -2
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/locales/en.d.ts +18 -1
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/ja.d.ts +18 -1
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/ssr-entry.d.ts +6 -0
- package/dist/ssr-entry.d.ts.map +1 -0
- package/dist/types/index.d.ts +7 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/web-components/zcode-cms.d.ts.map +1 -1
- package/dist/web-components/zcode-editor.d.ts.map +1 -1
- package/dist/web-components/zcode-studio.d.ts +28 -0
- package/dist/web-components/zcode-studio.d.ts.map +1 -0
- package/dist/zerocode-ssr.es.js +1409 -0
- package/dist/zerocode.es.js +15764 -15347
- package/dist/zerocode.umd.js +68 -72
- package/dist/zerocodejs.css +1 -1
- package/package.json +27 -7
- package/dist/__tests__/fixtures/sample-data.d.ts +0 -23
- package/dist/__tests__/fixtures/sample-data.d.ts.map +0 -1
- package/dist/__tests__/fixtures/sample-templates.d.ts +0 -25
- package/dist/__tests__/fixtures/sample-templates.d.ts.map +0 -1
- package/dist/core/utils/component-initializer.test.d.ts +0 -2
- package/dist/core/utils/component-initializer.test.d.ts.map +0 -1
- package/dist/core/utils/field-extractor.test.d.ts +0 -2
- package/dist/core/utils/field-extractor.test.d.ts.map +0 -1
- package/dist/core/utils/image-utils.test.d.ts +0 -2
- package/dist/core/utils/image-utils.test.d.ts.map +0 -1
- package/dist/core/utils/path-utils.test.d.ts +0 -2
- package/dist/core/utils/path-utils.test.d.ts.map +0 -1
- package/dist/core/utils/storage.test.d.ts +0 -2
- package/dist/core/utils/storage.test.d.ts.map +0 -1
- package/dist/core/utils/template-processor.test.d.ts +0 -2
- package/dist/core/utils/template-processor.test.d.ts.map +0 -1
- package/dist/core/utils/template-utils.test.d.ts +0 -2
- package/dist/core/utils/template-utils.test.d.ts.map +0 -1
- package/dist/core/utils/validation.test.d.ts +0 -2
- package/dist/core/utils/validation.test.d.ts.map +0 -1
- package/dist/css/common.css +0 -677
- package/dist/css/docs.css +0 -396
- package/dist/css/index.css +0 -1039
- package/dist/css/page.css +0 -290
- package/dist/css/sample.css +0 -26
- package/dist/css/site-common.css +0 -218
- package/dist/footer.html +0 -10
- package/dist/header.html +0 -10
- package/dist/images/customer-avatar.jpg +0 -0
- package/dist/images/default-avatar.jpg +0 -0
- package/dist/images/default.jpg +0 -0
- package/dist/images/hero-bg.jpg +0 -0
- package/dist/images/kv_image.jpg +0 -0
- package/dist/images/page-specific-hero.jpg +0 -0
- package/dist/images/sample-1.jpg +0 -0
- package/dist/images/sample-2.jpg +0 -0
- package/dist/images/sample-3.jpg +0 -0
- package/dist/images/zcode_top_01.png +0 -0
- package/dist/js/accordion.js +0 -24
- package/dist/js/common.js +0 -1093
- package/dist/web-component.d.ts +0 -14
- package/dist/web-component.d.ts.map +0 -1
- package/dist/zerocode.es.js.map +0 -1
- package/dist/zerocode.umd.js.map +0 -1
package/dist/zerocode.umd.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
(function(en,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(en=typeof globalThis<"u"?globalThis:en||self,a(en.ZeroCode={},en.Vue))})(this,(function(en,a){"use strict";const Oc=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Wm=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,o)=>o?o.toUpperCase():n.toLowerCase()),Gm=t=>{const e=Wm(t);return e.charAt(0).toUpperCase()+e.slice(1)},qm=(...t)=>t.filter((e,n,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===n).join(" ").trim(),Dc=t=>t==="";var rr={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const Km=({name:t,iconNode:e,absoluteStrokeWidth:n,"absolute-stroke-width":o,strokeWidth:r,"stroke-width":i,size:s=rr.width,color:l=rr.stroke,...c},{slots:d})=>a.h("svg",{...rr,...c,width:s,height:s,stroke:l,"stroke-width":Dc(n)||Dc(o)||n===!0||o===!0?Number(r||i||rr["stroke-width"])*24/Number(s):r||i||rr["stroke-width"],class:qm("lucide",c.class,...t?[`lucide-${Oc(Gm(t))}-icon`,`lucide-${Oc(t)}`]:["lucide-icon"])},[...e.map(u=>a.h(...u)),...d.default?[d.default()]:[]]);const He=(t,e)=>(n,{slots:o,attrs:r})=>a.h(Km,{...r,...n,iconNode:e,name:t},o);const ir=He("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);const Jm=He("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const sr=He("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const si=He("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Vn=He("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Xm=He("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const Ym=He("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);const Qm=He("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const Rc=He("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);const na=He("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const Zm=He("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const eg=He("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const tg=He("list-ordered",[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]);const ng=He("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]);const og=He("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);const Pc=He("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const uo=He("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Lc=He("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const $c=He("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const oa=He("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);const rg=He("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);const Bn=He("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);const Vc=He("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Qe=He("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const Bc=He("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);class ig{styleElements=new Map;container=null;setContainer(e){this.container!==e&&(this.container=e,this.removeAllCSS())}applyCSS(e){if(!this.container){console.warn("[PageCSSManager] Container not set");return}if(!e||!e.trim()){this.removeCSS("default");return}this.applyCSSForCategory("default",e)}applyMultipleCSS(e){if(!this.container){console.warn("[PageCSSManager] Container not set");return}["common","individual","special"].forEach(o=>{const r=e[o];r&&r.trim()?this.applyCSSForCategory(o,r):this.removeCSS(o)})}applyCSSForCategory(e,n){if(!this.container)return;let o=this.styleElements.get(e);o||(o=document.createElement("style"),o.id=`zcode-css-style-${e}`,o.setAttribute("data-zcode-css","true"),o.setAttribute("data-zcode-css-category",e),this.container.appendChild(o),this.styleElements.set(e,o)),o.textContent=n}removeCSS(e="default"){const n=this.styleElements.get(e);n&&(n.remove(),this.styleElements.delete(e))}removeAllCSS(){this.styleElements.forEach(e=>{e.remove()}),this.styleElements.clear()}cleanup(){this.removeAllCSS(),this.container=null}}const sg=["innerHTML"],ag={key:0,class:"zcode-empty-state"},Fc=a.defineComponent({__name:"PreviewArea",props:{cmsData:{type:Object},fullPageHtml:{type:String},onAddClick:{type:Function},allowDynamicContentInteraction:{type:Boolean}},setup(t,{expose:e}){const n=t,o=a.ref(null),r=a.ref(null),i=new ig;let s=null,l=!1;const c=u=>{if(n.allowDynamicContentInteraction===!1){const f=u.target;(f.tagName==="A"||f.closest("a"))&&(u.preventDefault(),u.stopPropagation())}};a.watch(()=>n.fullPageHtml,()=>{a.nextTick(()=>{r.value&&(l=!0,s&&s.disconnect(),s=new MutationObserver(()=>{l&&(l=!1,a.nextTick(()=>{window.dispatchEvent(new CustomEvent("zcode-dom-updated",{})),s&&(s.disconnect(),s=null)}))}),s.observe(r.value,{childList:!0,subtree:!0,characterData:!0}))})},{immediate:!1}),a.watch(()=>[n.cmsData.css?.common,n.cmsData.css?.individual,n.cmsData.css?.special],()=>{a.nextTick(()=>{d()})},{deep:!0});function d(){if(!o.value)return;const u=o.value.getRootNode();u instanceof ShadowRoot?i.setContainer(u):i.setContainer(document.head);const f={common:n.cmsData.css?.common,individual:n.cmsData.css?.individual,special:n.cmsData.css?.special};i.applyMultipleCSS(f)}return a.onMounted(()=>{a.nextTick(()=>{r.value&&(window.dispatchEvent(new CustomEvent("zcode-dom-updated",{})),r.value.addEventListener("click",c,!0)),d()})}),a.onUnmounted(()=>{s&&(s.disconnect(),s=null),r.value&&r.value.removeEventListener("click",c,!0),i.cleanup()}),e({previewArea:o}),(u,f)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"previewArea",ref:o},[a.createElementVNode("div",{ref_key:"htmlContainer",ref:r,innerHTML:t.fullPageHtml},null,8,sg),t.cmsData.page.length===0&&t.onAddClick?(a.openBlock(),a.createElementBlock("div",ag,[f[1]||(f[1]=a.createElementVNode("p",null,"パーツを追加してください",-1)),a.createElementVNode("button",{class:"zcode-add-btn",onClick:f[0]||(f[0]=p=>t.onAddClick("page.0"))}," + パーツを追加 ")])):a.createCommentVNode("",!0)],512))}});function ra(){if(typeof window<"u"&&typeof DOMParser<"u")return DOMParser;if(typeof require<"u")try{const{JSDOM:t}=require("jsdom");return new t().window.DOMParser}catch{throw new Error("jsdom is required for server-side rendering. Please install it: npm install jsdom")}if(typeof DOMParser<"u")return DOMParser;throw new Error("DOMParser is not available in this environment")}function lg(t){const e=window;e.__zcmsShadowRoots||(e.__zcmsShadowRoots=new Map);const n=`script-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return e.__zcmsShadowRoots.set(n,t),`
|
|
1
|
+
(function(gt,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],s):(gt=typeof globalThis<"u"?globalThis:gt||self,s(gt.ZeroCode={},gt.Vue))})(this,(function(gt,s){"use strict";const Ac=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),zm=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,o)=>o?o.toUpperCase():t.toLowerCase()),Tm=n=>{const e=zm(n);return e.charAt(0).toUpperCase()+e.slice(1)},Mm=(...n)=>n.filter((e,t,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===t).join(" ").trim(),Ic=n=>n==="";var lr={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 Am=({name:n,iconNode:e,absoluteStrokeWidth:t,"absolute-stroke-width":o,strokeWidth:r,"stroke-width":i,size:a=lr.width,color:l=lr.stroke,...c},{slots:d})=>s.h("svg",{...lr,...c,width:a,height:a,stroke:l,"stroke-width":Ic(t)||Ic(o)||t===!0||o===!0?Number(r||i||lr["stroke-width"])*24/Number(a):r||i||lr["stroke-width"],class:Mm("lucide",c.class,...n?[`lucide-${Ac(Tm(n))}-icon`,`lucide-${Ac(n)}`]:["lucide-icon"])},[...e.map(u=>s.h(...u)),...d.default?[d.default()]:[]]);const He=(n,e)=>(t,{slots:o,attrs:r})=>s.h(Am,{...r,...t,iconNode:e,name:n},o);const cr=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 Im=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 dr=He("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const ai=He("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Bn=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 _m=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 _c=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 Om=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 li=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 Qs=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 Dm=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 Rm=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 Pm=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 $m=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 Oc=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 Dc=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 Do=He("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Zs=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 ea=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 Lm=He("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]);const ci=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 Vm=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 mo=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 Rc=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 Ze=He("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const Pc=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"}]]),$c="[ZeroCode]",ge={warn(n,...e){console.warn(`${$c} ${n}`,...e)},error(n,...e){console.error(`${$c} ${n}`,...e)}};class Bm{styleElements=new Map;container=null;setContainer(e){this.container!==e&&(this.container=e,this.removeAllCSS())}applyCSS(e){if(!this.container){ge.warn("PageCSSManager: Container not set");return}if(!e||!e.trim()){this.removeCSS("default");return}this.applyCSSForCategory("default",e)}applyMultipleCSS(e){if(!this.container){ge.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 Fm=["innerHTML"],jm={key:0,class:"zcode-empty-state"},Lc=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 Bm;let a=null,l=!1;const c=u=>{if(t.allowDynamicContentInteraction===!1){const p=u.target;(p.tagName==="A"||p.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 p={common:t.cmsData.css?.common,individual:t.cmsData.css?.individual,special:t.cmsData.css?.special};i.applyMultipleCSS(p)}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,p)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"previewArea",ref:o},[s.createElementVNode("div",{ref_key:"htmlContainer",ref:r,innerHTML:n.fullPageHtml},null,8,Fm),n.cmsData.page.length===0&&n.onAddClick?(s.openBlock(),s.createElementBlock("div",jm,[s.createElementVNode("p",null,s.toDisplayString(u.$t("emptyState.message")),1),s.createElementVNode("button",{class:"zcode-add-btn",onClick:p[0]||(p[0]=f=>n.onAddClick("page.0"))},s.toDisplayString(u.$t("emptyState.addPart")),1)])):s.createCommentVNode("",!0)],512))}});function Hm(n,e){typeof console<"u"&&(console.warn("[intlify] "+n),e&&console.warn(e.stack))}const Vc=typeof window<"u",Fn=(n,e=!1)=>e?Symbol.for(n):Symbol(n),Um=(n,e,t)=>Wm({l:n,k:e,s:t}),Wm=n=>JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),st=n=>typeof n=="number"&&isFinite(n),qm=n=>Uc(n)==="[object Date]",di=n=>Uc(n)==="[object RegExp]",ui=n=>Ve(n)&&Object.keys(n).length===0,St=Object.assign,Gm=Object.create,Fe=(n=null)=>Gm(n);let Bc;const pi=()=>Bc||(Bc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:Fe());function Fc(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/").replace(/=/g,"=")}function jc(n){return n.replace(/&(?![a-zA-Z0-9#]{2,6};)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function Km(n){return n=n.replace(/(\w+)\s*=\s*"([^"]*)"/g,(o,r,i)=>`${r}="${jc(i)}"`),n=n.replace(/(\w+)\s*=\s*'([^']*)'/g,(o,r,i)=>`${r}='${jc(i)}'`),/\s*on\w+\s*=\s*["']?[^"'>]+["']?/gi.test(n)&&(n=n.replace(/(\s+)(on)(\w+\s*=)/gi,"$1on$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:")}),n}const Jm=Object.prototype.hasOwnProperty;function tn(n,e){return Jm.call(n,e)}const rt=Array.isArray,Xe=n=>typeof n=="function",xe=n=>typeof n=="string",Ke=n=>typeof n=="boolean",Le=n=>n!==null&&typeof n=="object",Xm=n=>Le(n)&&Xe(n.then)&&Xe(n.catch),Hc=Object.prototype.toString,Uc=n=>Hc.call(n),Ve=n=>{if(!Le(n))return!1;const e=Object.getPrototypeOf(n);return e===null||e.constructor===Object},Ym=n=>n==null?"":rt(n)||Ve(n)&&n.toString===Hc?JSON.stringify(n,null,2):String(n);function Qm(n,e=""){return n.reduce((t,o,r)=>r===0?t+o:t+e+o,"")}function fi(n){let e=n;return()=>++e}const hi=n=>!Le(n)||rt(n);function mi(n,e){if(hi(n)||hi(e))throw new Error("Invalid value");const t=[{src:n,des:e}];for(;t.length;){const{src:o,des:r}=t.pop();Object.keys(o).forEach(i=>{i!=="__proto__"&&(Le(o[i])&&!Le(r[i])&&(r[i]=Array.isArray(o[i])?[]:Fe()),hi(r[i])||hi(o[i])?r[i]=o[i]:t.push({src:o[i],des:r[i]}))})}}function Zm(n,e,t){return{line:n,column:e,offset:t}}function gi(n,e,t){return{start:n,end:e}}const eg=/\{([0-9a-zA-Z]+)\}/g;function Wc(n,...e){return e.length===1&&tg(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),n.replace(eg,(t,o)=>e.hasOwnProperty(o)?e[o]:"")}const qc=Object.assign,Gc=n=>typeof n=="string",tg=n=>n!==null&&typeof n=="object";function Kc(n,e=""){return n.reduce((t,o,r)=>r===0?t+o:t+e+o,"")}const ta={USE_MODULO_SYNTAX:1,__EXTEND_POINT__:2},ng={[ta.USE_MODULO_SYNTAX]:"Use modulo before '{{0}}'."};function og(n,e,...t){const o=Wc(ng[n],...t||[]),r={message:String(o),code:n};return e&&(r.location=e),r}const Ne={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16,__EXTEND_POINT__:17},rg={[Ne.EXPECTED_TOKEN]:"Expected token: '{0}'",[Ne.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[Ne.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[Ne.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[Ne.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[Ne.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[Ne.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[Ne.EMPTY_PLACEHOLDER]:"Empty placeholder",[Ne.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[Ne.INVALID_LINKED_FORMAT]:"Invalid linked format",[Ne.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[Ne.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[Ne.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[Ne.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[Ne.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[Ne.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function Ro(n,e,t={}){const{domain:o,messages:r,args:i}=t,a=Wc((r||rg)[n]||"",...i||[]),l=new SyntaxError(String(a));return l.code=n,e&&(l.location=e),l.domain=o,l}function ig(n){throw n}const wn=" ",sg="\r",Ct=`
|
|
2
|
+
`,ag="\u2028",lg="\u2029";function cg(n){const e=n;let t=0,o=1,r=1,i=0;const a=E=>e[E]===sg&&e[E+1]===Ct,l=E=>e[E]===Ct,c=E=>e[E]===lg,d=E=>e[E]===ag,u=E=>a(E)||l(E)||c(E)||d(E),p=()=>t,f=()=>o,h=()=>r,m=()=>i,g=E=>a(E)||c(E)||d(E)?Ct:e[E],y=()=>g(t),x=()=>g(t+i);function T(){return i=0,u(t)&&(o++,r=0),a(t)&&t++,t++,r++,e[t]}function S(){return a(t+i)&&i++,i++,e[t+i]}function z(){t=0,o=1,r=1,i=0}function b(E=0){i=E}function v(){const E=t+i;for(;E!==t;)T();i=0}return{index:p,line:f,column:h,peekOffset:m,charAt:g,currentChar:y,currentPeek:x,next:T,peek:S,reset:z,resetPeek:b,skipToPeek:v}}const jn=void 0,dg=".",Jc="'",ug="tokenizer";function pg(n,e={}){const t=e.location!==!1,o=cg(n),r=()=>o.index(),i=()=>Zm(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 p(A,_,W,...de){const Pe=d();if(_.column+=W,_.offset+=W,u){const ue=t?gi(Pe.startLoc,_):null,q=Ro(A,ue,{domain:ug,args:de});u(q)}}function f(A,_,W){A.endLoc=i(),A.currentType=_;const de={type:_};return t&&(de.loc=gi(A.startLoc,A.endLoc)),W!=null&&(de.value=W),de}const h=A=>f(A,14);function m(A,_){return A.currentChar()===_?(A.next(),_):(p(Ne.EXPECTED_TOKEN,i(),0,_),"")}function g(A){let _="";for(;A.currentPeek()===wn||A.currentPeek()===Ct;)_+=A.currentPeek(),A.peek();return _}function y(A){const _=g(A);return A.skipToPeek(),_}function x(A){if(A===jn)return!1;const _=A.charCodeAt(0);return _>=97&&_<=122||_>=65&&_<=90||_===95}function T(A){if(A===jn)return!1;const _=A.charCodeAt(0);return _>=48&&_<=57}function S(A,_){const{currentType:W}=_;if(W!==2)return!1;g(A);const de=x(A.currentPeek());return A.resetPeek(),de}function z(A,_){const{currentType:W}=_;if(W!==2)return!1;g(A);const de=A.currentPeek()==="-"?A.peek():A.currentPeek(),Pe=T(de);return A.resetPeek(),Pe}function b(A,_){const{currentType:W}=_;if(W!==2)return!1;g(A);const de=A.currentPeek()===Jc;return A.resetPeek(),de}function v(A,_){const{currentType:W}=_;if(W!==8)return!1;g(A);const de=A.currentPeek()===".";return A.resetPeek(),de}function E(A,_){const{currentType:W}=_;if(W!==9)return!1;g(A);const de=x(A.currentPeek());return A.resetPeek(),de}function C(A,_){const{currentType:W}=_;if(!(W===8||W===12))return!1;g(A);const de=A.currentPeek()===":";return A.resetPeek(),de}function M(A,_){const{currentType:W}=_;if(W!==10)return!1;const de=()=>{const ue=A.currentPeek();return ue==="{"?x(A.peek()):ue==="@"||ue==="%"||ue==="|"||ue===":"||ue==="."||ue===wn||!ue?!1:ue===Ct?(A.peek(),de()):P(A,!1)},Pe=de();return A.resetPeek(),Pe}function D(A){g(A);const _=A.currentPeek()==="|";return A.resetPeek(),_}function $(A){const _=g(A),W=A.currentPeek()==="%"&&A.peek()==="{";return A.resetPeek(),{isModulo:W,hasSpace:_.length>0}}function P(A,_=!0){const W=(Pe=!1,ue="",q=!1)=>{const Q=A.currentPeek();return Q==="{"?ue==="%"?!1:Pe:Q==="@"||!Q?ue==="%"?!0:Pe:Q==="%"?(A.peek(),W(Pe,"%",!0)):Q==="|"?ue==="%"||q?!0:!(ue===wn||ue===Ct):Q===wn?(A.peek(),W(!0,wn,q)):Q===Ct?(A.peek(),W(!0,Ct,q)):!0},de=W();return _&&A.resetPeek(),de}function L(A,_){const W=A.currentChar();return W===jn?jn:_(W)?(A.next(),W):null}function V(A){const _=A.charCodeAt(0);return _>=97&&_<=122||_>=65&&_<=90||_>=48&&_<=57||_===95||_===36}function F(A){return L(A,V)}function H(A){const _=A.charCodeAt(0);return _>=97&&_<=122||_>=65&&_<=90||_>=48&&_<=57||_===95||_===36||_===45}function U(A){return L(A,H)}function G(A){const _=A.charCodeAt(0);return _>=48&&_<=57}function K(A){return L(A,G)}function J(A){const _=A.charCodeAt(0);return _>=48&&_<=57||_>=65&&_<=70||_>=97&&_<=102}function ne(A){return L(A,J)}function ee(A){let _="",W="";for(;_=K(A);)W+=_;return W}function Y(A){y(A);const _=A.currentChar();return _!=="%"&&p(Ne.EXPECTED_TOKEN,i(),0,_),A.next(),"%"}function te(A){let _="";for(;;){const W=A.currentChar();if(W==="{"||W==="}"||W==="@"||W==="|"||!W)break;if(W==="%")if(P(A))_+=W,A.next();else break;else if(W===wn||W===Ct)if(P(A))_+=W,A.next();else{if(D(A))break;_+=W,A.next()}else _+=W,A.next()}return _}function se(A){y(A);let _="",W="";for(;_=U(A);)W+=_;return A.currentChar()===jn&&p(Ne.UNTERMINATED_CLOSING_BRACE,i(),0),W}function ce(A){y(A);let _="";return A.currentChar()==="-"?(A.next(),_+=`-${ee(A)}`):_+=ee(A),A.currentChar()===jn&&p(Ne.UNTERMINATED_CLOSING_BRACE,i(),0),_}function ke(A){return A!==Jc&&A!==Ct}function Se(A){y(A),m(A,"'");let _="",W="";for(;_=L(A,ke);)_==="\\"?W+=Oe(A):W+=_;const de=A.currentChar();return de===Ct||de===jn?(p(Ne.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,i(),0),de===Ct&&(A.next(),m(A,"'")),W):(m(A,"'"),W)}function Oe(A){const _=A.currentChar();switch(_){case"\\":case"'":return A.next(),`\\${_}`;case"u":return N(A,_,4);case"U":return N(A,_,6);default:return p(Ne.UNKNOWN_ESCAPE_SEQUENCE,i(),0,_),""}}function N(A,_,W){m(A,_);let de="";for(let Pe=0;Pe<W;Pe++){const ue=ne(A);if(!ue){p(Ne.INVALID_UNICODE_ESCAPE_SEQUENCE,i(),0,`\\${_}${de}${A.currentChar()}`);break}de+=ue}return`\\${_}${de}`}function X(A){return A!=="{"&&A!=="}"&&A!==wn&&A!==Ct}function oe(A){y(A);let _="",W="";for(;_=L(A,X);)W+=_;return W}function k(A){let _="",W="";for(;_=F(A);)W+=_;return W}function w(A){const _=W=>{const de=A.currentChar();return de==="{"||de==="%"||de==="@"||de==="|"||de==="("||de===")"||!de||de===wn?W:(W+=de,A.next(),_(W))};return _("")}function I(A){y(A);const _=m(A,"|");return y(A),_}function j(A,_){let W=null;switch(A.currentChar()){case"{":return _.braceNest>=1&&p(Ne.NOT_ALLOW_NEST_PLACEHOLDER,i(),0),A.next(),W=f(_,2,"{"),y(A),_.braceNest++,W;case"}":return _.braceNest>0&&_.currentType===2&&p(Ne.EMPTY_PLACEHOLDER,i(),0),A.next(),W=f(_,3,"}"),_.braceNest--,_.braceNest>0&&y(A),_.inLinked&&_.braceNest===0&&(_.inLinked=!1),W;case"@":return _.braceNest>0&&p(Ne.UNTERMINATED_CLOSING_BRACE,i(),0),W=le(A,_)||h(_),_.braceNest=0,W;default:{let Pe=!0,ue=!0,q=!0;if(D(A))return _.braceNest>0&&p(Ne.UNTERMINATED_CLOSING_BRACE,i(),0),W=f(_,1,I(A)),_.braceNest=0,_.inLinked=!1,W;if(_.braceNest>0&&(_.currentType===5||_.currentType===6||_.currentType===7))return p(Ne.UNTERMINATED_CLOSING_BRACE,i(),0),_.braceNest=0,Ce(A,_);if(Pe=S(A,_))return W=f(_,5,se(A)),y(A),W;if(ue=z(A,_))return W=f(_,6,ce(A)),y(A),W;if(q=b(A,_))return W=f(_,7,Se(A)),y(A),W;if(!Pe&&!ue&&!q)return W=f(_,13,oe(A)),p(Ne.INVALID_TOKEN_IN_PLACEHOLDER,i(),0,W.value),y(A),W;break}}return W}function le(A,_){const{currentType:W}=_;let de=null;const Pe=A.currentChar();switch((W===8||W===9||W===12||W===10)&&(Pe===Ct||Pe===wn)&&p(Ne.INVALID_LINKED_FORMAT,i(),0),Pe){case"@":return A.next(),de=f(_,8,"@"),_.inLinked=!0,de;case".":return y(A),A.next(),f(_,9,".");case":":return y(A),A.next(),f(_,10,":");default:return D(A)?(de=f(_,1,I(A)),_.braceNest=0,_.inLinked=!1,de):v(A,_)||C(A,_)?(y(A),le(A,_)):E(A,_)?(y(A),f(_,12,k(A))):M(A,_)?(y(A),Pe==="{"?j(A,_)||de:f(_,11,w(A))):(W===8&&p(Ne.INVALID_LINKED_FORMAT,i(),0),_.braceNest=0,_.inLinked=!1,Ce(A,_))}}function Ce(A,_){let W={type:14};if(_.braceNest>0)return j(A,_)||h(_);if(_.inLinked)return le(A,_)||h(_);switch(A.currentChar()){case"{":return j(A,_)||h(_);case"}":return p(Ne.UNBALANCED_CLOSING_BRACE,i(),0),A.next(),f(_,3,"}");case"@":return le(A,_)||h(_);default:{if(D(A))return W=f(_,1,I(A)),_.braceNest=0,_.inLinked=!1,W;const{isModulo:Pe,hasSpace:ue}=$(A);if(Pe)return ue?f(_,0,te(A)):f(_,4,Y(A));if(P(A))return f(_,0,te(A));break}}return W}function Be(){const{currentType:A,offset:_,startLoc:W,endLoc:de}=c;return c.lastType=A,c.lastOffset=_,c.lastStartLoc=W,c.lastEndLoc=de,c.offset=r(),c.startLoc=i(),o.currentChar()===jn?f(c,14):Ce(o,c)}return{nextToken:Be,currentOffset:r,currentPosition:i,context:d}}const fg="parser",hg=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function mg(n,e,t){switch(n){case"\\\\":return"\\";case"\\'":return"'";default:{const o=parseInt(e||t,16);return o<=55295||o>=57344?String.fromCodePoint(o):"�"}}}function gg(n={}){const e=n.location!==!1,{onError:t,onWarn:o}=n;function r(S,z,b,v,...E){const C=S.currentPosition();if(C.offset+=v,C.column+=v,t){const M=e?gi(b,C):null,D=Ro(z,M,{domain:fg,args:E});t(D)}}function i(S,z,b,v,...E){const C=S.currentPosition();if(C.offset+=v,C.column+=v,o){const M=e?gi(b,C):null;o(og(z,M,E))}}function a(S,z,b){const v={type:S};return e&&(v.start=z,v.end=z,v.loc={start:b,end:b}),v}function l(S,z,b,v){e&&(S.end=z,S.loc&&(S.loc.end=b))}function c(S,z){const b=S.context(),v=a(3,b.offset,b.startLoc);return v.value=z,l(v,S.currentOffset(),S.currentPosition()),v}function d(S,z){const b=S.context(),{lastOffset:v,lastStartLoc:E}=b,C=a(5,v,E);return C.index=parseInt(z,10),S.nextToken(),l(C,S.currentOffset(),S.currentPosition()),C}function u(S,z,b){const v=S.context(),{lastOffset:E,lastStartLoc:C}=v,M=a(4,E,C);return M.key=z,b===!0&&(M.modulo=!0),S.nextToken(),l(M,S.currentOffset(),S.currentPosition()),M}function p(S,z){const b=S.context(),{lastOffset:v,lastStartLoc:E}=b,C=a(9,v,E);return C.value=z.replace(hg,mg),S.nextToken(),l(C,S.currentOffset(),S.currentPosition()),C}function f(S){const z=S.nextToken(),b=S.context(),{lastOffset:v,lastStartLoc:E}=b,C=a(8,v,E);return z.type!==12?(r(S,Ne.UNEXPECTED_EMPTY_LINKED_MODIFIER,b.lastStartLoc,0),C.value="",l(C,v,E),{nextConsumeToken:z,node:C}):(z.value==null&&r(S,Ne.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,nn(z)),C.value=z.value||"",l(C,S.currentOffset(),S.currentPosition()),{node:C})}function h(S,z){const b=S.context(),v=a(7,b.offset,b.startLoc);return v.value=z,l(v,S.currentOffset(),S.currentPosition()),v}function m(S){const z=S.context(),b=a(6,z.offset,z.startLoc);let v=S.nextToken();if(v.type===9){const E=f(S);b.modifier=E.node,v=E.nextConsumeToken||S.nextToken()}switch(v.type!==10&&r(S,Ne.UNEXPECTED_LEXICAL_ANALYSIS,z.lastStartLoc,0,nn(v)),v=S.nextToken(),v.type===2&&(v=S.nextToken()),v.type){case 11:v.value==null&&r(S,Ne.UNEXPECTED_LEXICAL_ANALYSIS,z.lastStartLoc,0,nn(v)),b.key=h(S,v.value||"");break;case 5:v.value==null&&r(S,Ne.UNEXPECTED_LEXICAL_ANALYSIS,z.lastStartLoc,0,nn(v)),b.key=u(S,v.value||"");break;case 6:v.value==null&&r(S,Ne.UNEXPECTED_LEXICAL_ANALYSIS,z.lastStartLoc,0,nn(v)),b.key=d(S,v.value||"");break;case 7:v.value==null&&r(S,Ne.UNEXPECTED_LEXICAL_ANALYSIS,z.lastStartLoc,0,nn(v)),b.key=p(S,v.value||"");break;default:{r(S,Ne.UNEXPECTED_EMPTY_LINKED_KEY,z.lastStartLoc,0);const E=S.context(),C=a(7,E.offset,E.startLoc);return C.value="",l(C,E.offset,E.startLoc),b.key=C,l(b,E.offset,E.startLoc),{nextConsumeToken:v,node:b}}}return l(b,S.currentOffset(),S.currentPosition()),{node:b}}function g(S){const z=S.context(),b=z.currentType===1?S.currentOffset():z.offset,v=z.currentType===1?z.endLoc:z.startLoc,E=a(2,b,v);E.items=[];let C=null,M=null;do{const P=C||S.nextToken();switch(C=null,P.type){case 0:P.value==null&&r(S,Ne.UNEXPECTED_LEXICAL_ANALYSIS,z.lastStartLoc,0,nn(P)),E.items.push(c(S,P.value||""));break;case 6:P.value==null&&r(S,Ne.UNEXPECTED_LEXICAL_ANALYSIS,z.lastStartLoc,0,nn(P)),E.items.push(d(S,P.value||""));break;case 4:M=!0;break;case 5:P.value==null&&r(S,Ne.UNEXPECTED_LEXICAL_ANALYSIS,z.lastStartLoc,0,nn(P)),E.items.push(u(S,P.value||"",!!M)),M&&(i(S,ta.USE_MODULO_SYNTAX,z.lastStartLoc,0,nn(P)),M=null);break;case 7:P.value==null&&r(S,Ne.UNEXPECTED_LEXICAL_ANALYSIS,z.lastStartLoc,0,nn(P)),E.items.push(p(S,P.value||""));break;case 8:{const L=m(S);E.items.push(L.node),C=L.nextConsumeToken||null;break}}}while(z.currentType!==14&&z.currentType!==1);const D=z.currentType===1?z.lastOffset:S.currentOffset(),$=z.currentType===1?z.lastEndLoc:S.currentPosition();return l(E,D,$),E}function y(S,z,b,v){const E=S.context();let C=v.items.length===0;const M=a(1,z,b);M.cases=[],M.cases.push(v);do{const D=g(S);C||(C=D.items.length===0),M.cases.push(D)}while(E.currentType!==14);return C&&r(S,Ne.MUST_HAVE_MESSAGES_IN_PLURAL,b,0),l(M,S.currentOffset(),S.currentPosition()),M}function x(S){const z=S.context(),{offset:b,startLoc:v}=z,E=g(S);return z.currentType===14?E:y(S,b,v,E)}function T(S){const z=pg(S,qc({},n)),b=z.context(),v=a(0,b.offset,b.startLoc);return e&&v.loc&&(v.loc.source=S),v.body=x(z),n.onCacheKey&&(v.cacheKey=n.onCacheKey(S)),b.currentType!==14&&r(z,Ne.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,S[b.offset]||""),l(v,z.currentOffset(),z.currentPosition()),v}return{parse:T}}function nn(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 yg(n,e={}){const t={ast:n,helpers:new Set};return{context:()=>t,helper:i=>(t.helpers.add(i),i)}}function Xc(n,e){for(let t=0;t<n.length;t++)na(n[t],e)}function na(n,e){switch(n.type){case 1:Xc(n.cases,e),e.helper("plural");break;case 2:Xc(n.items,e);break;case 6:{na(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 bg(n,e={}){const t=yg(n);t.helper("normalize"),n.body&&na(n.body,t);const o=t.context();n.helpers=Array.from(o.helpers)}function xg(n){const e=n.body;return e.type===2?Yc(e):e.cases.forEach(t=>Yc(t)),n}function Yc(n){if(n.items.length===1){const e=n.items[0];(e.type===3||e.type===9)&&(n.static=e.value,delete e.value)}else{const e=[];for(let t=0;t<n.items.length;t++){const o=n.items[t];if(!(o.type===3||o.type===9)||o.value==null)break;e.push(o.value)}if(e.length===n.items.length){n.static=Kc(e);for(let t=0;t<n.items.length;t++){const o=n.items[t];(o.type===3||o.type===9)&&delete o.value}}}}const kg="minifier";function Po(n){switch(n.t=n.type,n.type){case 0:{const e=n;Po(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++)Po(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++)Po(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;Po(e.key),e.k=e.key,delete e.key,e.modifier&&(Po(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 Ro(Ne.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:kg,args:[n.type]})}delete n.type}const Eg="parser";function wg(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 p(g=!0){const y=--a.indentLevel;g&&d(y)}function f(){d(a.indentLevel)}return{context:l,push:c,indent:u,deindent:p,newline:f,helper:g=>`_${g}`,needIndent:()=>a.needIndent}}function Sg(n,e){const{helper:t}=n;n.push(`${t("linked")}(`),$o(n,e.key),e.modifier?(n.push(", "),$o(n,e.modifier),n.push(", _type")):n.push(", undefined, _type"),n.push(")")}function Cg(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&&($o(n,e.items[i]),i!==r-1);i++)n.push(", ");n.deindent(o()),n.push("])")}function vg(n,e){const{helper:t,needIndent:o}=n;if(e.cases.length>1){n.push(`${t("plural")}([`),n.indent(o());const r=e.cases.length;for(let i=0;i<r&&($o(n,e.cases[i]),i!==r-1);i++)n.push(", ");n.deindent(o()),n.push("])")}}function Ng(n,e){e.body?$o(n,e.body):n.push("null")}function $o(n,e){const{helper:t}=n;switch(e.type){case 0:Ng(n,e);break;case 1:vg(n,e);break;case 2:Cg(n,e);break;case 6:Sg(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 Ro(Ne.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:Eg,args:[e.type]})}}const zg=(n,e={})=>{const t=Gc(e.mode)?e.mode:"normal",o=Gc(e.filename)?e.filename:"message.intl";e.sourceMap;const r=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":`
|
|
3
|
+
`,i=e.needIndent?e.needIndent:t!=="arrow",a=n.helpers||[],l=wg(n,{filename:o,breakLineCode:r,needIndent:i});l.push(t==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),l.indent(i),a.length>0&&(l.push(`const { ${Kc(a.map(u=>`${u}: _${u}`),", ")} } = ctx`),l.newline()),l.push("return "),$o(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 Tg(n,e={}){const t=qc({},e),o=!!t.jit,r=!!t.minify,i=t.optimize==null?!0:t.optimize,l=gg(t).parse(n);return o?(i&&xg(l),r&&Po(l),{ast:l,code:""}):(bg(l,t),zg(l,t))}function Mg(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(pi().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(pi().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function hn(n){return Le(n)&&oa(n)===0&&(tn(n,"b")||tn(n,"body"))}const Qc=["b","body"];function Ag(n){return Hn(n,Qc)}const Zc=["c","cases"];function Ig(n){return Hn(n,Zc,[])}const ed=["s","static"];function _g(n){return Hn(n,ed)}const td=["i","items"];function Og(n){return Hn(n,td,[])}const nd=["t","type"];function oa(n){return Hn(n,nd)}const od=["v","value"];function yi(n,e){const t=Hn(n,od);if(t!=null)return t;throw ur(e)}const rd=["m","modifier"];function Dg(n){return Hn(n,rd)}const id=["k","key"];function Rg(n){const e=Hn(n,id);if(e)return e;throw ur(6)}function Hn(n,e,t){for(let o=0;o<e.length;o++){const r=e[o];if(tn(n,r)&&n[r]!=null)return n[r]}return t}const sd=[...Qc,...Zc,...ed,...td,...id,...rd,...od,...nd];function ur(n){return new Error(`unhandled node type: ${n}`)}const Un=[];Un[0]={w:[0],i:[3,0],"[":[4],o:[7]},Un[1]={w:[1],".":[2],"[":[4],o:[7]},Un[2]={w:[2],i:[3,0],0:[3,0]},Un[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},Un[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},Un[5]={"'":[4,0],o:8,l:[5,0]},Un[6]={'"':[4,0],o:8,l:[6,0]};const Pg=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function $g(n){return Pg.test(n)}function Lg(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 Vg(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 Bg(n){const e=n.trim();return n.charAt(0)==="0"&&isNaN(parseInt(n))?!1:$g(e)?Lg(e):"*"+e}function Fg(n){const e=[];let t=-1,o=0,r=0,i,a,l,c,d,u,p;const f=[];f[0]=()=>{a===void 0?a=l:a+=l},f[1]=()=>{a!==void 0&&(e.push(a),a=void 0)},f[2]=()=>{f[0](),r++},f[3]=()=>{if(r>0)r--,o=4,f[0]();else{if(r=0,a===void 0||(a=Bg(a),a===!1))return!1;f[1]()}};function h(){const m=n[t+1];if(o===5&&m==="'"||o===6&&m==='"')return t++,l="\\"+m,f[0](),!0}for(;o!==null;)if(t++,i=n[t],!(i==="\\"&&h())){if(c=Vg(i),p=Un[o],d=p[c]||p.l||8,d===8||(o=d[0],d[1]!==void 0&&(u=f[d[1]],u&&(l=i,u()===!1))))return;if(o===7)return e}}const ad=new Map;function jg(n,e){return Le(n)?n[e]:null}function Hg(n,e){if(!Le(n))return null;let t=ad.get(e);if(t||(t=Fg(e),t&&ad.set(e,t)),!t)return null;const o=t.length;let r=n,i=0;for(;i<o;){const a=t[i];if(sd.includes(a)&&hn(r))return null;const l=r[a];if(l===void 0||Xe(r))return null;r=l,i++}return r}const Ug=n=>n,Wg=n=>"",qg="text",Gg=n=>n.length===0?"":Qm(n),Kg=Ym;function ld(n,e){return n=Math.abs(n),e===2?n?n>1?1:0:1:n?Math.min(n,2):0}function Jg(n){const e=st(n.pluralIndex)?n.pluralIndex:-1;return n.named&&(st(n.named.count)||st(n.named.n))?st(n.named.count)?n.named.count:st(n.named.n)?n.named.n:e:e}function Xg(n,e){e.count||(e.count=n),e.n||(e.n=n)}function Yg(n={}){const e=n.locale,t=Jg(n),o=Le(n.pluralRules)&&xe(e)&&Xe(n.pluralRules[e])?n.pluralRules[e]:ld,r=Le(n.pluralRules)&&xe(e)&&Xe(n.pluralRules[e])?ld:void 0,i=x=>x[o(t,x.length,r)],a=n.list||[],l=x=>a[x],c=n.named||Fe();st(n.pluralIndex)&&Xg(t,c);const d=x=>c[x];function u(x){const T=Xe(n.messages)?n.messages(x):Le(n.messages)?n.messages[x]:!1;return T||(n.parent?n.parent.message(x):Wg)}const p=x=>n.modifiers?n.modifiers[x]:Ug,f=Ve(n.processor)&&Xe(n.processor.normalize)?n.processor.normalize:Gg,h=Ve(n.processor)&&Xe(n.processor.interpolate)?n.processor.interpolate:Kg,m=Ve(n.processor)&&xe(n.processor.type)?n.processor.type:qg,y={list:l,named:d,plural:i,linked:(x,...T)=>{const[S,z]=T;let b="text",v="";T.length===1?Le(S)?(v=S.modifier||v,b=S.type||b):xe(S)&&(v=S||v):T.length===2&&(xe(S)&&(v=S||v),xe(z)&&(b=z||b));const E=u(x)(y),C=b==="vnode"&&rt(E)&&v?E[0]:E;return v?p(v)(C,b):C},message:u,type:m,interpolate:h,normalize:f,values:St(Fe(),a,c)};return y}const Qg=ta.__EXTEND_POINT__,go=fi(Qg),Zg={FALLBACK_TO_TRANSLATE:go(),CANNOT_FORMAT_NUMBER:go(),FALLBACK_TO_NUMBER_FORMAT:go(),CANNOT_FORMAT_DATE:go(),FALLBACK_TO_DATE_FORMAT:go(),EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:go(),__EXTEND_POINT__:go()},cd=Ne.__EXTEND_POINT__,yo=fi(cd),on={INVALID_ARGUMENT:cd,INVALID_DATE_ARGUMENT:yo(),INVALID_ISO_DATE_ARGUMENT:yo(),NOT_SUPPORT_NON_STRING_MESSAGE:yo(),NOT_SUPPORT_LOCALE_PROMISE_VALUE:yo(),NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:yo(),NOT_SUPPORT_LOCALE_TYPE:yo(),__EXTEND_POINT__:yo()};function mn(n){return Ro(n,null,void 0)}function ra(n,e){return e.locale!=null?dd(e.locale):dd(n.locale)}let ia;function dd(n){if(xe(n))return n;if(Xe(n)){if(n.resolvedOnce&&ia!=null)return ia;if(n.constructor.name==="Function"){const e=n();if(Xm(e))throw mn(on.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return ia=e}else throw mn(on.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw mn(on.NOT_SUPPORT_LOCALE_TYPE)}function ey(n,e,t){return[...new Set([t,...rt(e)?e:Le(e)?Object.keys(e):xe(e)?[e]:[t]])]}function ud(n,e,t){const o=xe(t)?t:xi,r=n;r.__localeChainCache||(r.__localeChainCache=new Map);let i=r.__localeChainCache.get(o);if(!i){i=[];let a=[t];for(;rt(a);)a=pd(i,a,e);const l=rt(e)||!Ve(e)?e:e.default?e.default:null;a=xe(l)?[l]:l,rt(a)&&pd(i,a,!1),r.__localeChainCache.set(o,i)}return i}function pd(n,e,t){let o=!0;for(let r=0;r<e.length&&Ke(o);r++){const i=e[r];xe(i)&&(o=ty(n,e[r],t))}return o}function ty(n,e,t){let o;const r=e.split("-");do{const i=r.join("-");o=ny(n,i,t),r.splice(-1,1)}while(r.length&&o===!0);return o}function ny(n,e,t){let o=!1;if(!n.includes(e)&&(o=!0,e)){o=e[e.length-1]!=="!";const r=e.replace(/!/g,"");n.push(r),(rt(t)||Ve(t))&&t[r]&&(o=t[r])}return o}const oy="9.14.5",bi=-1,xi="en-US",fd="",hd=n=>`${n.charAt(0).toLocaleUpperCase()}${n.substr(1)}`;function ry(){return{upper:(n,e)=>e==="text"&&xe(n)?n.toUpperCase():e==="vnode"&&Le(n)&&"__v_isVNode"in n?n.children.toUpperCase():n,lower:(n,e)=>e==="text"&&xe(n)?n.toLowerCase():e==="vnode"&&Le(n)&&"__v_isVNode"in n?n.children.toLowerCase():n,capitalize:(n,e)=>e==="text"&&xe(n)?hd(n):e==="vnode"&&Le(n)&&"__v_isVNode"in n?hd(n.children):n}}let md;function gd(n){md=n}let yd;function iy(n){yd=n}let bd;function sy(n){bd=n}const gI=n=>{};let xd=null;const kd=n=>{xd=n},ay=()=>xd;let Ed=0;function ly(n={}){const e=Xe(n.onWarn)?n.onWarn:Hm,t=xe(n.version)?n.version:oy,o=xe(n.locale)||Xe(n.locale)?n.locale:xi,r=Xe(o)?xi:o,i=rt(n.fallbackLocale)||Ve(n.fallbackLocale)||xe(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:r,a=Ve(n.messages)?n.messages:sa(r),l=Ve(n.datetimeFormats)?n.datetimeFormats:sa(r),c=Ve(n.numberFormats)?n.numberFormats:sa(r),d=St(Fe(),n.modifiers,ry()),u=n.pluralRules||Fe(),p=Xe(n.missing)?n.missing:null,f=Ke(n.missingWarn)||di(n.missingWarn)?n.missingWarn:!0,h=Ke(n.fallbackWarn)||di(n.fallbackWarn)?n.fallbackWarn:!0,m=!!n.fallbackFormat,g=!!n.unresolving,y=Xe(n.postTranslation)?n.postTranslation:null,x=Ve(n.processor)?n.processor:null,T=Ke(n.warnHtmlMessage)?n.warnHtmlMessage:!0,S=!!n.escapeParameter,z=Xe(n.messageCompiler)?n.messageCompiler:md,b=Xe(n.messageResolver)?n.messageResolver:yd||jg,v=Xe(n.localeFallbacker)?n.localeFallbacker:bd||ey,E=Le(n.fallbackContext)?n.fallbackContext:void 0,C=n,M=Le(C.__datetimeFormatters)?C.__datetimeFormatters:new Map,D=Le(C.__numberFormatters)?C.__numberFormatters:new Map,$=Le(C.__meta)?C.__meta:{};Ed++;const P={version:t,cid:Ed,locale:o,fallbackLocale:i,messages:a,modifiers:d,pluralRules:u,missing:p,missingWarn:f,fallbackWarn:h,fallbackFormat:m,unresolving:g,postTranslation:y,processor:x,warnHtmlMessage:T,escapeParameter:S,messageCompiler:z,messageResolver:b,localeFallbacker:v,fallbackContext:E,onWarn:e,__meta:$};return P.datetimeFormats=l,P.numberFormats=c,P.__datetimeFormatters=M,P.__numberFormatters=D,P}const sa=n=>({[n]:Fe()});function aa(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 pr(n,e,t){const o=n;o.__localeChainCache=new Map,n.localeFallbacker(n,t,e)}function cy(n,e){return n===e?!1:n.split("-")[0]===e.split("-")[0]}function dy(n,e){const t=e.indexOf(n);if(t===-1)return!1;for(let o=t+1;o<e.length;o++)if(cy(n,e[o]))return!0;return!1}function la(n){return t=>uy(t,n)}function uy(n,e){const t=Ag(e);if(t==null)throw ur(0);if(oa(t)===1){const i=Ig(t);return n.plural(i.reduce((a,l)=>[...a,wd(n,l)],[]))}else return wd(n,t)}function wd(n,e){const t=_g(e);if(t!=null)return n.type==="text"?t:n.normalize([t]);{const o=Og(e).reduce((r,i)=>[...r,ca(n,i)],[]);return n.normalize(o)}}function ca(n,e){const t=oa(e);switch(t){case 3:return yi(e,t);case 9:return yi(e,t);case 4:{const o=e;if(tn(o,"k")&&o.k)return n.interpolate(n.named(o.k));if(tn(o,"key")&&o.key)return n.interpolate(n.named(o.key));throw ur(t)}case 5:{const o=e;if(tn(o,"i")&&st(o.i))return n.interpolate(n.list(o.i));if(tn(o,"index")&&st(o.index))return n.interpolate(n.list(o.index));throw ur(t)}case 6:{const o=e,r=Dg(o),i=Rg(o);return n.linked(ca(n,i),r?ca(n,r):void 0,n.type)}case 7:return yi(e,t);case 8:return yi(e,t);default:throw new Error(`unhandled node on format message part: ${t}`)}}const Sd=n=>n;let Lo=Fe();function Cd(n,e={}){let t=!1;const o=e.onError||ig;return e.onError=r=>{t=!0,o(r)},{...Tg(n,e),detectError:t}}const py=(n,e)=>{if(!xe(n))throw mn(on.NOT_SUPPORT_NON_STRING_MESSAGE);{Ke(e.warnHtmlMessage)&&e.warnHtmlMessage;const o=(e.onCacheKey||Sd)(n),r=Lo[o];if(r)return r;const{code:i,detectError:a}=Cd(n,e),l=new Function(`return ${i}`)();return a?l:Lo[o]=l}};function fy(n,e){if(__INTLIFY_JIT_COMPILATION__&&!__INTLIFY_DROP_MESSAGE_COMPILER__&&xe(n)){Ke(e.warnHtmlMessage)&&e.warnHtmlMessage;const o=(e.onCacheKey||Sd)(n),r=Lo[o];if(r)return r;const{ast:i,detectError:a}=Cd(n,{...e,location:!1,jit:!0}),l=la(i);return a?l:Lo[o]=l}else{const t=n.cacheKey;if(t){const o=Lo[t];return o||(Lo[t]=la(n))}else return la(n)}}const vd=()=>"",Sn=n=>Xe(n);function Nd(n,...e){const{fallbackFormat:t,postTranslation:o,unresolving:r,messageCompiler:i,fallbackLocale:a,messages:l}=n,[c,d]=da(...e),u=Ke(d.missingWarn)?d.missingWarn:n.missingWarn,p=Ke(d.fallbackWarn)?d.fallbackWarn:n.fallbackWarn,f=Ke(d.escapeParameter)?d.escapeParameter:n.escapeParameter,h=!!d.resolvedMessage,m=xe(d.default)||Ke(d.default)?Ke(d.default)?i?c:()=>c:d.default:t?i?c:()=>c:"",g=t||m!=="",y=ra(n,d);f&&hy(d);let[x,T,S]=h?[c,y,l[y]||Fe()]:zd(n,c,y,a,p,u),z=x,b=c;if(!h&&!(xe(z)||hn(z)||Sn(z))&&g&&(z=m,b=z),!h&&(!(xe(z)||hn(z)||Sn(z))||!xe(T)))return r?bi:c;let v=!1;const E=()=>{v=!0},C=Sn(z)?z:Td(n,c,T,z,b,E);if(v)return z;const M=yy(n,T,S,d),D=Yg(M),$=my(n,C,D);let P=o?o($,c):$;return f&&xe(P)&&(P=Km(P)),P}function hy(n){rt(n.list)?n.list=n.list.map(e=>xe(e)?Fc(e):e):Le(n.named)&&Object.keys(n.named).forEach(e=>{xe(n.named[e])&&(n.named[e]=Fc(n.named[e]))})}function zd(n,e,t,o,r,i){const{messages:a,onWarn:l,messageResolver:c,localeFallbacker:d}=n,u=d(n,o,t);let p=Fe(),f,h=null;const m="translate";for(let g=0;g<u.length&&(f=u[g],p=a[f]||Fe(),(h=c(p,e))===null&&(h=p[e]),!(xe(h)||hn(h)||Sn(h)));g++)if(!dy(f,u)){const y=aa(n,e,f,i,m);y!==e&&(h=y)}return[h,f,p]}function Td(n,e,t,o,r,i){const{messageCompiler:a,warnHtmlMessage:l}=n;if(Sn(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,gy(n,t,r,o,l,i));return c.locale=t,c.key=e,c.source=o,c}function my(n,e,t){return e(t)}function da(...n){const[e,t,o]=n,r=Fe();if(!xe(e)&&!st(e)&&!Sn(e)&&!hn(e))throw mn(on.INVALID_ARGUMENT);const i=st(e)?String(e):(Sn(e),e);return st(t)?r.plural=t:xe(t)?r.default=t:Ve(t)&&!ui(t)?r.named=t:rt(t)&&(r.list=t),st(o)?r.plural=o:xe(o)?r.default=o:Ve(o)&&St(r,o),[i,r]}function gy(n,e,t,o,r,i){return{locale:e,key:t,warnHtmlMessage:r,onError:a=>{throw i&&i(a),a},onCacheKey:a=>Um(e,t,a)}}function yy(n,e,t,o){const{modifiers:r,pluralRules:i,messageResolver:a,fallbackLocale:l,fallbackWarn:c,missingWarn:d,fallbackContext:u}=n,f={locale:e,modifiers:r,pluralRules:i,messages:h=>{let m=a(t,h);if(m==null&&u){const[,,g]=zd(u,h,e,l,c,d);m=a(g,h)}if(xe(m)||hn(m)){let g=!1;const x=Td(n,h,e,m,h,()=>{g=!0});return g?vd:x}else return Sn(m)?m:vd}};return n.processor&&(f.processor=n.processor),o.list&&(f.list=o.list),o.named&&(f.named=o.named),st(o.plural)&&(f.pluralIndex=o.plural),f}function Md(n,...e){const{datetimeFormats:t,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:a}=n,{__datetimeFormatters:l}=n,[c,d,u,p]=ua(...e),f=Ke(u.missingWarn)?u.missingWarn:n.missingWarn;Ke(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn;const h=!!u.part,m=ra(n,u),g=a(n,r,m);if(!xe(c)||c==="")return new Intl.DateTimeFormat(m,p).format(d);let y={},x,T=null;const S="datetime format";for(let v=0;v<g.length&&(x=g[v],y=t[x]||{},T=y[c],!Ve(T));v++)aa(n,c,x,f,S);if(!Ve(T)||!xe(x))return o?bi:c;let z=`${x}__${c}`;ui(p)||(z=`${z}__${JSON.stringify(p)}`);let b=l.get(z);return b||(b=new Intl.DateTimeFormat(x,St({},T,p)),l.set(z,b)),h?b.formatToParts(d):b.format(d)}const Ad=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function ua(...n){const[e,t,o,r]=n,i=Fe();let a=Fe(),l;if(xe(e)){const c=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!c)throw mn(on.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 mn(on.INVALID_ISO_DATE_ARGUMENT)}}else if(qm(e)){if(isNaN(e.getTime()))throw mn(on.INVALID_DATE_ARGUMENT);l=e}else if(st(e))l=e;else throw mn(on.INVALID_ARGUMENT);return xe(t)?i.key=t:Ve(t)&&Object.keys(t).forEach(c=>{Ad.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 Id(n,e,t){const o=n;for(const r in t){const i=`${e}__${r}`;o.__datetimeFormatters.has(i)&&o.__datetimeFormatters.delete(i)}}function _d(n,...e){const{numberFormats:t,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:a}=n,{__numberFormatters:l}=n,[c,d,u,p]=pa(...e),f=Ke(u.missingWarn)?u.missingWarn:n.missingWarn;Ke(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn;const h=!!u.part,m=ra(n,u),g=a(n,r,m);if(!xe(c)||c==="")return new Intl.NumberFormat(m,p).format(d);let y={},x,T=null;const S="number format";for(let v=0;v<g.length&&(x=g[v],y=t[x]||{},T=y[c],!Ve(T));v++)aa(n,c,x,f,S);if(!Ve(T)||!xe(x))return o?bi:c;let z=`${x}__${c}`;ui(p)||(z=`${z}__${JSON.stringify(p)}`);let b=l.get(z);return b||(b=new Intl.NumberFormat(x,St({},T,p)),l.set(z,b)),h?b.formatToParts(d):b.format(d)}const Od=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function pa(...n){const[e,t,o,r]=n,i=Fe();let a=Fe();if(!st(e))throw mn(on.INVALID_ARGUMENT);const l=e;return xe(t)?i.key=t:Ve(t)&&Object.keys(t).forEach(c=>{Od.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 Dd(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 by="9.14.5";function xy(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(pi().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(pi().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}const ky=Zg.__EXTEND_POINT__,Cn=fi(ky);Cn(),Cn(),Cn(),Cn(),Cn(),Cn(),Cn(),Cn(),Cn();const Rd=on.__EXTEND_POINT__,It=fi(Rd),vn={UNEXPECTED_RETURN_TYPE:Rd,INVALID_ARGUMENT:It(),MUST_BE_CALL_SETUP_TOP:It(),NOT_INSTALLED:It(),NOT_AVAILABLE_IN_LEGACY_MODE:It(),REQUIRED_VALUE:It(),INVALID_VALUE:It(),CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:It(),NOT_INSTALLED_WITH_PROVIDE:It(),UNEXPECTED_ERROR:It(),NOT_COMPATIBLE_LEGACY_VUE_I18N:It(),BRIDGE_SUPPORT_VUE_2_ONLY:It(),MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION:It(),NOT_AVAILABLE_COMPOSITION_IN_LEGACY:It(),__EXTEND_POINT__:It()};function Wn(n,...e){return Ro(n,null,void 0)}const fa=Fn("__translateVNode"),ha=Fn("__datetimeParts"),ma=Fn("__numberParts"),Ey=Fn("__setPluralRules"),wy=Fn("__injectWithOption"),ga=Fn("__dispose");function fr(n){if(!Le(n)||hn(n))return n;for(const e in n)if(tn(n,e))if(!e.includes("."))Le(n[e])&&fr(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]]=Fe()),!Le(r[t[a]])){i=!0;break}r=r[t[a]]}if(i||(hn(r)?sd.includes(t[o])||delete n[e]:(r[t[o]]=n[e],delete n[e])),!hn(r)){const a=r[t[o]];Le(a)&&fr(a)}}return n}function Pd(n,e){const{messages:t,__i18n:o,messageResolver:r,flatJson:i}=e,a=Ve(t)?t:rt(o)?Fe():{[n]:Fe()};if(rt(o)&&o.forEach(l=>{if("locale"in l&&"resource"in l){const{locale:c,resource:d}=l;c?(a[c]=a[c]||Fe(),mi(d,a[c])):mi(d,a)}else xe(l)&&mi(JSON.parse(l),a)}),r==null&&i)for(const l in a)tn(a,l)&&fr(a[l]);return a}function $d(n){return n.type}function Sy(n,e,t){let o=Le(e.messages)?e.messages:Fe();"__i18nGlobal"in t&&(o=Pd(n.locale.value,{messages:o,__i18n:t.__i18nGlobal}));const r=Object.keys(o);r.length&&r.forEach(i=>{n.mergeLocaleMessage(i,o[i])});{if(Le(e.datetimeFormats)){const i=Object.keys(e.datetimeFormats);i.length&&i.forEach(a=>{n.mergeDateTimeFormat(a,e.datetimeFormats[a])})}if(Le(e.numberFormats)){const i=Object.keys(e.numberFormats);i.length&&i.forEach(a=>{n.mergeNumberFormat(a,e.numberFormats[a])})}}}function Ld(n){return s.createVNode(s.Text,null,n,0)}const Vd="__INTLIFY_META__",Bd=()=>[],Cy=()=>!1;let Fd=0;function jd(n){return((e,t,o,r)=>n(t,o,s.getCurrentInstance()||void 0,r))}const yI=()=>{const n=s.getCurrentInstance();let e=null;return n&&(e=$d(n)[Vd])?{[Vd]:e}:null};function Hd(n={},e){const{__root:t,__injectWithOption:o}=n,r=t===void 0,i=n.flatJson,a=Vc?s.ref:s.shallowRef,l=!!n.translateExistCompatible;let c=Ke(n.inheritLocale)?n.inheritLocale:!0;const d=a(t&&c?t.locale.value:xe(n.locale)?n.locale:xi),u=a(t&&c?t.fallbackLocale.value:xe(n.fallbackLocale)||rt(n.fallbackLocale)||Ve(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:d.value),p=a(Pd(d.value,n)),f=a(Ve(n.datetimeFormats)?n.datetimeFormats:{[d.value]:{}}),h=a(Ve(n.numberFormats)?n.numberFormats:{[d.value]:{}});let m=t?t.missingWarn:Ke(n.missingWarn)||di(n.missingWarn)?n.missingWarn:!0,g=t?t.fallbackWarn:Ke(n.fallbackWarn)||di(n.fallbackWarn)?n.fallbackWarn:!0,y=t?t.fallbackRoot:Ke(n.fallbackRoot)?n.fallbackRoot:!0,x=!!n.fallbackFormat,T=Xe(n.missing)?n.missing:null,S=Xe(n.missing)?jd(n.missing):null,z=Xe(n.postTranslation)?n.postTranslation:null,b=t?t.warnHtmlMessage:Ke(n.warnHtmlMessage)?n.warnHtmlMessage:!0,v=!!n.escapeParameter;const E=t?t.modifiers:Ve(n.modifiers)?n.modifiers:{};let C=n.pluralRules||t&&t.pluralRules,M;M=(()=>{r&&kd(null);const q={version:by,locale:d.value,fallbackLocale:u.value,messages:p.value,modifiers:E,pluralRules:C,missing:S===null?void 0:S,missingWarn:m,fallbackWarn:g,fallbackFormat:x,unresolving:!0,postTranslation:z===null?void 0:z,warnHtmlMessage:b,escapeParameter:v,messageResolver:n.messageResolver,messageCompiler:n.messageCompiler,__meta:{framework:"vue"}};q.datetimeFormats=f.value,q.numberFormats=h.value,q.__datetimeFormatters=Ve(M)?M.__datetimeFormatters:void 0,q.__numberFormatters=Ve(M)?M.__numberFormatters:void 0;const Q=ly(q);return r&&kd(Q),Q})(),pr(M,d.value,u.value);function $(){return[d.value,u.value,p.value,f.value,h.value]}const P=s.computed({get:()=>d.value,set:q=>{d.value=q,M.locale=d.value}}),L=s.computed({get:()=>u.value,set:q=>{u.value=q,M.fallbackLocale=u.value,pr(M,d.value,q)}}),V=s.computed(()=>p.value),F=s.computed(()=>f.value),H=s.computed(()=>h.value);function U(){return Xe(z)?z:null}function G(q){z=q,M.postTranslation=q}function K(){return T}function J(q){q!==null&&(S=jd(q)),T=q,M.missing=S}const ne=(q,Q,Te,De,qe,Je)=>{$();let kt;try{r||(M.fallbackContext=t?ay():void 0),kt=q(M)}finally{r||(M.fallbackContext=void 0)}if(Te!=="translate exists"&&st(kt)&&kt===bi||Te==="translate exists"&&!kt){const[At,en]=Q();return t&&y?De(t):qe(At)}else{if(Je(kt))return kt;throw Wn(vn.UNEXPECTED_RETURN_TYPE)}};function ee(...q){return ne(Q=>Reflect.apply(Nd,null,[Q,...q]),()=>da(...q),"translate",Q=>Reflect.apply(Q.t,Q,[...q]),Q=>Q,Q=>xe(Q))}function Y(...q){const[Q,Te,De]=q;if(De&&!Le(De))throw Wn(vn.INVALID_ARGUMENT);return ee(Q,Te,St({resolvedMessage:!0},De||{}))}function te(...q){return ne(Q=>Reflect.apply(Md,null,[Q,...q]),()=>ua(...q),"datetime format",Q=>Reflect.apply(Q.d,Q,[...q]),()=>fd,Q=>xe(Q))}function se(...q){return ne(Q=>Reflect.apply(_d,null,[Q,...q]),()=>pa(...q),"number format",Q=>Reflect.apply(Q.n,Q,[...q]),()=>fd,Q=>xe(Q))}function ce(q){return q.map(Q=>xe(Q)||st(Q)||Ke(Q)?Ld(String(Q)):Q)}const Se={normalize:ce,interpolate:q=>q,type:"vnode"};function Oe(...q){return ne(Q=>{let Te;const De=Q;try{De.processor=Se,Te=Reflect.apply(Nd,null,[De,...q])}finally{De.processor=null}return Te},()=>da(...q),"translate",Q=>Q[fa](...q),Q=>[Ld(Q)],Q=>rt(Q))}function N(...q){return ne(Q=>Reflect.apply(_d,null,[Q,...q]),()=>pa(...q),"number format",Q=>Q[ma](...q),Bd,Q=>xe(Q)||rt(Q))}function X(...q){return ne(Q=>Reflect.apply(Md,null,[Q,...q]),()=>ua(...q),"datetime format",Q=>Q[ha](...q),Bd,Q=>xe(Q)||rt(Q))}function oe(q){C=q,M.pluralRules=C}function k(q,Q){return ne(()=>{if(!q)return!1;const Te=xe(Q)?Q:d.value,De=j(Te),qe=M.messageResolver(De,q);return l?qe!=null:hn(qe)||Sn(qe)||xe(qe)},()=>[q],"translate exists",Te=>Reflect.apply(Te.te,Te,[q,Q]),Cy,Te=>Ke(Te))}function w(q){let Q=null;const Te=ud(M,u.value,d.value);for(let De=0;De<Te.length;De++){const qe=p.value[Te[De]]||{},Je=M.messageResolver(qe,q);if(Je!=null){Q=Je;break}}return Q}function I(q){const Q=w(q);return Q??(t?t.tm(q)||{}:{})}function j(q){return p.value[q]||{}}function le(q,Q){if(i){const Te={[q]:Q};for(const De in Te)tn(Te,De)&&fr(Te[De]);Q=Te[q]}p.value[q]=Q,M.messages=p.value}function Ce(q,Q){p.value[q]=p.value[q]||{};const Te={[q]:Q};if(i)for(const De in Te)tn(Te,De)&&fr(Te[De]);Q=Te[q],mi(Q,p.value[q]),M.messages=p.value}function Be(q){return f.value[q]||{}}function A(q,Q){f.value[q]=Q,M.datetimeFormats=f.value,Id(M,q,Q)}function _(q,Q){f.value[q]=St(f.value[q]||{},Q),M.datetimeFormats=f.value,Id(M,q,Q)}function W(q){return h.value[q]||{}}function de(q,Q){h.value[q]=Q,M.numberFormats=h.value,Dd(M,q,Q)}function Pe(q,Q){h.value[q]=St(h.value[q]||{},Q),M.numberFormats=h.value,Dd(M,q,Q)}Fd++,t&&Vc&&(s.watch(t.locale,q=>{c&&(d.value=q,M.locale=q,pr(M,d.value,u.value))}),s.watch(t.fallbackLocale,q=>{c&&(u.value=q,M.fallbackLocale=q,pr(M,d.value,u.value))}));const ue={id:Fd,locale:P,fallbackLocale:L,get inheritLocale(){return c},set inheritLocale(q){c=q,q&&t&&(d.value=t.locale.value,u.value=t.fallbackLocale.value,pr(M,d.value,u.value))},get availableLocales(){return Object.keys(p.value).sort()},messages:V,get modifiers(){return E},get pluralRules(){return C||{}},get isGlobal(){return r},get missingWarn(){return m},set missingWarn(q){m=q,M.missingWarn=m},get fallbackWarn(){return g},set fallbackWarn(q){g=q,M.fallbackWarn=g},get fallbackRoot(){return y},set fallbackRoot(q){y=q},get fallbackFormat(){return x},set fallbackFormat(q){x=q,M.fallbackFormat=x},get warnHtmlMessage(){return b},set warnHtmlMessage(q){b=q,M.warnHtmlMessage=q},get escapeParameter(){return v},set escapeParameter(q){v=q,M.escapeParameter=q},t:ee,getLocaleMessage:j,setLocaleMessage:le,mergeLocaleMessage:Ce,getPostTranslationHandler:U,setPostTranslationHandler:G,getMissingHandler:K,setMissingHandler:J,[Ey]:oe};return ue.datetimeFormats=F,ue.numberFormats=H,ue.rt=Y,ue.te=k,ue.tm=I,ue.d=te,ue.n=se,ue.getDateTimeFormat=Be,ue.setDateTimeFormat=A,ue.mergeDateTimeFormat=_,ue.getNumberFormat=W,ue.setNumberFormat=de,ue.mergeNumberFormat=Pe,ue[wy]=o,ue[fa]=Oe,ue[ha]=X,ue[ma]=N,ue}const ya={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:n=>n==="parent"||n==="global",default:"parent"},i18n:{type:Object}};function vy({slots:n},e){return e.length===1&&e[0]==="default"?(n.default?n.default():[]).reduce((o,r)=>[...o,...r.type===s.Fragment?r.children:[r]],[]):e.reduce((t,o)=>{const r=n[o];return r&&(t[o]=r()),t},Fe())}function Ud(n){return s.Fragment}St({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:n=>st(n)||!isNaN(n)}},ya);function Ny(n){return rt(n)&&!xe(n[0])}function Wd(n,e,t,o){const{slots:r,attrs:i}=e;return()=>{const a={part:!0};let l=Fe();n.locale&&(a.locale=n.locale),xe(n.format)?a.key=n.format:Le(n.format)&&(xe(n.format.key)&&(a.key=n.format.key),l=Object.keys(n.format).reduce((f,h)=>t.includes(h)?St(Fe(),f,{[h]:n.format[h]}):f,Fe()));const c=o(n.value,a,l);let d=[a.key];rt(c)?d=c.map((f,h)=>{const m=r[f.type],g=m?m({[f.type]:f.value,index:h,parts:c}):[f.value];return Ny(g)&&(g[0].key=`${f.type}-${h}`),g}):xe(c)&&(d=[c]);const u=St(Fe(),i),p=xe(n.tag)||Le(n.tag)?n.tag:Ud();return s.h(p,u,d)}}St({value:{type:Number,required:!0},format:{type:[String,Object]}},ya),St({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},ya);const zy=Fn("global-vue-i18n");function Ty(n={},e){const t=Ke(n.globalInjection)?n.globalInjection:!0,o=!0,r=new Map,[i,a]=My(n),l=Fn("");function c(p){return r.get(p)||null}function d(p,f){r.set(p,f)}function u(p){r.delete(p)}{const p={get mode(){return"composition"},get allowComposition(){return o},async install(f,...h){if(f.__VUE_I18N_SYMBOL__=l,f.provide(f.__VUE_I18N_SYMBOL__,p),Ve(h[0])){const y=h[0];p.__composerExtend=y.__composerExtend,p.__vueI18nExtend=y.__vueI18nExtend}let m=null;t&&(m=$y(f,p.global));const g=f.unmount;f.unmount=()=>{m&&m(),p.dispose(),g()}},get global(){return a},dispose(){i.stop()},__instances:r,__getInstance:c,__setInstance:d,__deleteInstance:u};return p}}function rn(n={}){const e=s.getCurrentInstance();if(e==null)throw Wn(vn.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw Wn(vn.NOT_INSTALLED);const t=Ay(e),o=_y(t),r=$d(e),i=Iy(n,r);if(i==="global")return Sy(o,n,r),o;if(i==="parent"){let c=Oy(t,e,n.__useComponent);return c==null&&(c=o),c}const a=t;let l=a.__getInstance(e);if(l==null){const c=St({},n);"__i18n"in r&&(c.__i18n=r.__i18n),o&&(c.__root=o),l=Hd(c),a.__composerExtend&&(l[ga]=a.__composerExtend(l)),Ry(a,e,l),a.__setInstance(e,l)}return l}function My(n,e,t){const o=s.effectScope();{const r=o.run(()=>Hd(n));if(r==null)throw Wn(vn.UNEXPECTED_ERROR);return[o,r]}}function Ay(n){{const e=s.inject(n.isCE?zy:n.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw Wn(n.isCE?vn.NOT_INSTALLED_WITH_PROVIDE:vn.UNEXPECTED_ERROR);return e}}function Iy(n,e){return ui(n)?"__i18n"in e?"local":"global":n.useScope?n.useScope:"local"}function _y(n){return n.mode==="composition"?n.global:n.global.__composer}function Oy(n,e,t=!1){let o=null;const r=e.root;let i=Dy(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 Dy(n,e=!1){return n==null?null:e&&n.vnode.ctx||n.parent}function Ry(n,e,t){s.onMounted(()=>{},e),s.onUnmounted(()=>{const o=t;n.__deleteInstance(e);const r=o[ga];r&&(r(),delete o[ga])},e)}const Py=["locale","fallbackLocale","availableLocales"],qd=["t","rt","d","n","tm","te"];function $y(n,e){const t=Object.create(null);return Py.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i)throw Wn(vn.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,qd.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i||!i.value)throw Wn(vn.UNEXPECTED_ERROR);Object.defineProperty(n.config.globalProperties,`$${r}`,i)}),()=>{delete n.config.globalProperties.$i18n,qd.forEach(r=>{delete n.config.globalProperties[`$${r}`]})}}xy(),__INTLIFY_JIT_COMPILATION__?gd(fy):gd(py),iy(Hg),sy(ud);const ki=1,Ei=3;function ba(){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 Ly(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
4
|
(function() {
|
|
3
|
-
const scriptId = '${
|
|
5
|
+
const scriptId = '${t}'
|
|
4
6
|
const shadowRoot = window.__zcmsShadowRoots?.get(scriptId)
|
|
5
7
|
if (!shadowRoot || !(shadowRoot instanceof ShadowRoot)) {
|
|
6
8
|
return
|
|
@@ -334,30 +336,25 @@
|
|
|
334
336
|
}
|
|
335
337
|
})
|
|
336
338
|
})()
|
|
337
|
-
`}function Mo(t,e=!1){const n=t,o=t.querySelector("script[data-zcode-shadow-extension]");if(o)if(e){if(n.__zcmsEventListeners){const i=n.__zcmsEventListeners;i.forEach(function(s){s.forEach(function(l){t.removeEventListener(l.eventName,l.handler,!0)})}),i.clear()}o.remove(),n.__zcmsJQueryExtended&&delete n.__zcmsJQueryExtended,n.__zcmsNativeAPIExtended&&delete n.__zcmsNativeAPIExtended}else return;const r=document.createElement("script");r.setAttribute("data-zcode-shadow-extension","true"),r.textContent=lg(t),t.insertBefore(r,t.firstChild)}function cg(){if(typeof window>"u")return 20;try{let t=document.querySelector(".zcode-toolbar");if(!t){const n=document.querySelectorAll("zcode-cms, zcode-editor");for(const o of Array.from(n)){const r=o.shadowRoot;if(r){const i=r.querySelector(".zcode-toolbar");if(i){t=i;break}}}}if(!t)return 20;const e=t.getBoundingClientRect();return e.height>0?e.height:20}catch(t){return console.warn("Failed to get toolbar height:",t),20}}function ar(t,e=0){if(!(typeof window>"u"||!t))try{const n=t.getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,r=cg(),i=n.top+o-r-e;window.scrollTo({top:Math.max(0,i),behavior:"smooth"})}catch(n){console.warn("Failed to scroll to element:",n);try{const o=t.getBoundingClientRect(),r=window.pageYOffset||document.documentElement.scrollTop,i=o.top+r-20;window.scrollTo({top:Math.max(0,i),behavior:"smooth"})}catch(o){console.error("Scroll fallback also failed:",o)}}}const{entries:jc,setPrototypeOf:Uc,isFrozen:dg,getPrototypeOf:ug,getOwnPropertyDescriptor:fg}=Object;let{freeze:wt,seal:Ft,create:ia}=Object,{apply:sa,construct:aa}=typeof Reflect<"u"&&Reflect;wt||(wt=function(e){return e}),Ft||(Ft=function(e){return e}),sa||(sa=function(e,n){for(var o=arguments.length,r=new Array(o>2?o-2:0),i=2;i<o;i++)r[i-2]=arguments[i];return e.apply(n,r)}),aa||(aa=function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return new e(...o)});const ai=Nt(Array.prototype.forEach),pg=Nt(Array.prototype.lastIndexOf),Hc=Nt(Array.prototype.pop),lr=Nt(Array.prototype.push),hg=Nt(Array.prototype.splice),li=Nt(String.prototype.toLowerCase),la=Nt(String.prototype.toString),ca=Nt(String.prototype.match),cr=Nt(String.prototype.replace),mg=Nt(String.prototype.indexOf),gg=Nt(String.prototype.trim),tn=Nt(Object.prototype.hasOwnProperty),St=Nt(RegExp.prototype.test),dr=bg(TypeError);function Nt(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return sa(t,e,o)}}function bg(t){return function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return aa(t,n)}}function De(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:li;Uc&&Uc(t,null);let o=e.length;for(;o--;){let r=e[o];if(typeof r=="string"){const i=n(r);i!==r&&(dg(e)||(e[o]=i),r=i)}t[r]=!0}return t}function yg(t){for(let e=0;e<t.length;e++)tn(t,e)||(t[e]=null);return t}function cn(t){const e=ia(null);for(const[n,o]of jc(t))tn(t,n)&&(Array.isArray(o)?e[n]=yg(o):o&&typeof o=="object"&&o.constructor===Object?e[n]=cn(o):e[n]=o);return e}function ur(t,e){for(;t!==null;){const o=fg(t,e);if(o){if(o.get)return Nt(o.get);if(typeof o.value=="function")return Nt(o.value)}t=ug(t)}function n(){return null}return n}const Wc=wt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),da=wt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ua=wt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),xg=wt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),fa=wt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Eg=wt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Gc=wt(["#text"]),qc=wt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),pa=wt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Kc=wt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ci=wt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),kg=Ft(/\{\{[\w\W]*|[\w\W]*\}\}/gm),wg=Ft(/<%[\w\W]*|[\w\W]*%>/gm),Sg=Ft(/\$\{[\w\W]*/gm),Ng=Ft(/^data-[\-\w.\u00B7-\uFFFF]+$/),Cg=Ft(/^aria-[\-\w]+$/),Jc=Ft(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),vg=Ft(/^(?:\w+script|data):/i),Tg=Ft(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Xc=Ft(/^html$/i),zg=Ft(/^[a-z][.\w]*(-[.\w]+)+$/i);var Yc=Object.freeze({__proto__:null,ARIA_ATTR:Cg,ATTR_WHITESPACE:Tg,CUSTOM_ELEMENT:zg,DATA_ATTR:Ng,DOCTYPE_NAME:Xc,ERB_EXPR:wg,IS_ALLOWED_URI:Jc,IS_SCRIPT_OR_DATA:vg,MUSTACHE_EXPR:kg,TMPLIT_EXPR:Sg});const fr={element:1,text:3,progressingInstruction:7,comment:8,document:9},_g=function(){return typeof window>"u"?null:window},Ag=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let o=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(o=n.getAttribute(r));const i="dompurify"+(o?"#"+o:"");try{return e.createPolicy(i,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Qc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Zc(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_g();const e=xe=>Zc(xe);if(e.version="3.3.1",e.removed=[],!t||!t.document||t.document.nodeType!==fr.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const o=n,r=o.currentScript,{DocumentFragment:i,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:h}=t,m=c.prototype,b=ur(m,"cloneNode"),g=ur(m,"remove"),x=ur(m,"nextSibling"),v=ur(m,"childNodes"),w=ur(m,"parentNode");if(typeof s=="function"){const xe=n.createElement("template");xe.content&&xe.content.ownerDocument&&(n=xe.content.ownerDocument)}let T,M="";const{implementation:A,createNodeIterator:y,createDocumentFragment:E,getElementsByTagName:S}=n,{importNode:D}=o;let W=Qc();e.isSupported=typeof jc=="function"&&typeof w=="function"&&A&&A.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:z,ERB_EXPR:P,TMPLIT_EXPR:V,DATA_ATTR:j,ARIA_ATTR:L,IS_SCRIPT_OR_DATA:H,ATTR_WHITESPACE:Q,CUSTOM_ELEMENT:G}=Yc;let{IS_ALLOWED_URI:se}=Yc,Z=null;const X=De({},[...Wc,...da,...ua,...fa,...Gc]);let J=null;const K=De({},[...qc,...pa,...Kc,...ci]);let Y=Object.seal(ia(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ce=null,Ee=null;const _e=Object.seal(ia(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Le=!0,C=!0,N=!1,O=!0,k=!1,U=!0,te=!1,me=!1,ve=!1,Ve=!1,Ce=!1,_=!1,I=!0,q=!1;const fe="user-content-";let Ae=!0,Te=!1,we={},B=null;const ee=De({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Me=null;const $=De({},["audio","video","img","source","image","track"]);let F=null;const re=De({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ae="http://www.w3.org/1998/Math/MathML",ke="http://www.w3.org/2000/svg",Fe="http://www.w3.org/1999/xhtml";let st=Fe,xn=!1,oi=null;const Tc=De({},[ae,ke,Fe],la);let Zo=De({},["mi","mo","mn","ms","mtext"]),er=De({},["annotation-xml"]);const zc=De({},["title","style","font","a","script"]);let Pn=null;const ri=["application/xhtml+xml","text/html"],Ln="text/html";let Ze=null,En=null;const Xs=n.createElement("form"),Ys=function(R){return R instanceof RegExp||R instanceof Function},tr=function(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(En&&En===R)){if((!R||typeof R!="object")&&(R={}),R=cn(R),Pn=ri.indexOf(R.PARSER_MEDIA_TYPE)===-1?Ln:R.PARSER_MEDIA_TYPE,Ze=Pn==="application/xhtml+xml"?la:li,Z=tn(R,"ALLOWED_TAGS")?De({},R.ALLOWED_TAGS,Ze):X,J=tn(R,"ALLOWED_ATTR")?De({},R.ALLOWED_ATTR,Ze):K,oi=tn(R,"ALLOWED_NAMESPACES")?De({},R.ALLOWED_NAMESPACES,la):Tc,F=tn(R,"ADD_URI_SAFE_ATTR")?De(cn(re),R.ADD_URI_SAFE_ATTR,Ze):re,Me=tn(R,"ADD_DATA_URI_TAGS")?De(cn($),R.ADD_DATA_URI_TAGS,Ze):$,B=tn(R,"FORBID_CONTENTS")?De({},R.FORBID_CONTENTS,Ze):ee,ce=tn(R,"FORBID_TAGS")?De({},R.FORBID_TAGS,Ze):cn({}),Ee=tn(R,"FORBID_ATTR")?De({},R.FORBID_ATTR,Ze):cn({}),we=tn(R,"USE_PROFILES")?R.USE_PROFILES:!1,Le=R.ALLOW_ARIA_ATTR!==!1,C=R.ALLOW_DATA_ATTR!==!1,N=R.ALLOW_UNKNOWN_PROTOCOLS||!1,O=R.ALLOW_SELF_CLOSE_IN_ATTR!==!1,k=R.SAFE_FOR_TEMPLATES||!1,U=R.SAFE_FOR_XML!==!1,te=R.WHOLE_DOCUMENT||!1,Ve=R.RETURN_DOM||!1,Ce=R.RETURN_DOM_FRAGMENT||!1,_=R.RETURN_TRUSTED_TYPE||!1,ve=R.FORCE_BODY||!1,I=R.SANITIZE_DOM!==!1,q=R.SANITIZE_NAMED_PROPS||!1,Ae=R.KEEP_CONTENT!==!1,Te=R.IN_PLACE||!1,se=R.ALLOWED_URI_REGEXP||Jc,st=R.NAMESPACE||Fe,Zo=R.MATHML_TEXT_INTEGRATION_POINTS||Zo,er=R.HTML_INTEGRATION_POINTS||er,Y=R.CUSTOM_ELEMENT_HANDLING||{},R.CUSTOM_ELEMENT_HANDLING&&Ys(R.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Y.tagNameCheck=R.CUSTOM_ELEMENT_HANDLING.tagNameCheck),R.CUSTOM_ELEMENT_HANDLING&&Ys(R.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Y.attributeNameCheck=R.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),R.CUSTOM_ELEMENT_HANDLING&&typeof R.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=R.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),k&&(C=!1),Ce&&(Ve=!0),we&&(Z=De({},Gc),J=[],we.html===!0&&(De(Z,Wc),De(J,qc)),we.svg===!0&&(De(Z,da),De(J,pa),De(J,ci)),we.svgFilters===!0&&(De(Z,ua),De(J,pa),De(J,ci)),we.mathMl===!0&&(De(Z,fa),De(J,Kc),De(J,ci))),R.ADD_TAGS&&(typeof R.ADD_TAGS=="function"?_e.tagCheck=R.ADD_TAGS:(Z===X&&(Z=cn(Z)),De(Z,R.ADD_TAGS,Ze))),R.ADD_ATTR&&(typeof R.ADD_ATTR=="function"?_e.attributeCheck=R.ADD_ATTR:(J===K&&(J=cn(J)),De(J,R.ADD_ATTR,Ze))),R.ADD_URI_SAFE_ATTR&&De(F,R.ADD_URI_SAFE_ATTR,Ze),R.FORBID_CONTENTS&&(B===ee&&(B=cn(B)),De(B,R.FORBID_CONTENTS,Ze)),R.ADD_FORBID_CONTENTS&&(B===ee&&(B=cn(B)),De(B,R.ADD_FORBID_CONTENTS,Ze)),Ae&&(Z["#text"]=!0),te&&De(Z,["html","head","body"]),Z.table&&(De(Z,["tbody"]),delete ce.tbody),R.TRUSTED_TYPES_POLICY){if(typeof R.TRUSTED_TYPES_POLICY.createHTML!="function")throw dr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof R.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw dr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=R.TRUSTED_TYPES_POLICY,M=T.createHTML("")}else T===void 0&&(T=Ag(h,r)),T!==null&&typeof M=="string"&&(M=T.createHTML(""));wt&&wt(R),En=R}},Qs=De({},[...da,...ua,...xg]),Zs=De({},[...fa,...Eg]),ea=function(R){let ie=w(R);(!ie||!ie.tagName)&&(ie={namespaceURI:st,tagName:"template"});const ge=li(R.tagName),Xe=li(ie.tagName);return oi[R.namespaceURI]?R.namespaceURI===ke?ie.namespaceURI===Fe?ge==="svg":ie.namespaceURI===ae?ge==="svg"&&(Xe==="annotation-xml"||Zo[Xe]):!!Qs[ge]:R.namespaceURI===ae?ie.namespaceURI===Fe?ge==="math":ie.namespaceURI===ke?ge==="math"&&er[Xe]:!!Zs[ge]:R.namespaceURI===Fe?ie.namespaceURI===ke&&!er[Xe]||ie.namespaceURI===ae&&!Zo[Xe]?!1:!Zs[ge]&&(zc[ge]||!Qs[ge]):!!(Pn==="application/xhtml+xml"&&oi[R.namespaceURI]):!1},Zt=function(R){lr(e.removed,{element:R});try{w(R).removeChild(R)}catch{g(R)}},kn=function(R,ie){try{lr(e.removed,{attribute:ie.getAttributeNode(R),from:ie})}catch{lr(e.removed,{attribute:null,from:ie})}if(ie.removeAttribute(R),R==="is")if(Ve||Ce)try{Zt(ie)}catch{}else try{ie.setAttribute(R,"")}catch{}},ta=function(R){let ie=null,ge=null;if(ve)R="<remove></remove>"+R;else{const rt=ca(R,/^[\r\n\t ]+/);ge=rt&&rt[0]}Pn==="application/xhtml+xml"&&st===Fe&&(R='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+R+"</body></html>");const Xe=T?T.createHTML(R):R;if(st===Fe)try{ie=new p().parseFromString(Xe,Pn)}catch{}if(!ie||!ie.documentElement){ie=A.createDocument(st,"template",null);try{ie.documentElement.innerHTML=xn?M:Xe}catch{}}const kt=ie.body||ie.documentElement;return R&&ge&&kt.insertBefore(n.createTextNode(ge),kt.childNodes[0]||null),st===Fe?S.call(ie,te?"html":"body")[0]:te?ie.documentElement:kt},ii=function(R){return y.call(R.ownerDocument||R,R,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},le=function(R){return R instanceof f&&(typeof R.nodeName!="string"||typeof R.textContent!="string"||typeof R.removeChild!="function"||!(R.attributes instanceof u)||typeof R.removeAttribute!="function"||typeof R.setAttribute!="function"||typeof R.namespaceURI!="string"||typeof R.insertBefore!="function"||typeof R.hasChildNodes!="function")},de=function(R){return typeof l=="function"&&R instanceof l};function be(xe,R,ie){ai(xe,ge=>{ge.call(e,R,ie,En)})}const Ge=function(R){let ie=null;if(be(W.beforeSanitizeElements,R,null),le(R))return Zt(R),!0;const ge=Ze(R.nodeName);if(be(W.uponSanitizeElement,R,{tagName:ge,allowedTags:Z}),U&&R.hasChildNodes()&&!de(R.firstElementChild)&&St(/<[/\w!]/g,R.innerHTML)&&St(/<[/\w!]/g,R.textContent)||R.nodeType===fr.progressingInstruction||U&&R.nodeType===fr.comment&&St(/<[/\w]/g,R.data))return Zt(R),!0;if(!(_e.tagCheck instanceof Function&&_e.tagCheck(ge))&&(!Z[ge]||ce[ge])){if(!ce[ge]&&At(ge)&&(Y.tagNameCheck instanceof RegExp&&St(Y.tagNameCheck,ge)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(ge)))return!1;if(Ae&&!B[ge]){const Xe=w(R)||R.parentNode,kt=v(R)||R.childNodes;if(kt&&Xe){const rt=kt.length;for(let Lt=rt-1;Lt>=0;--Lt){const $n=b(kt[Lt],!0);$n.__removalCount=(R.__removalCount||0)+1,Xe.insertBefore($n,x(R))}}}return Zt(R),!0}return R instanceof c&&!ea(R)||(ge==="noscript"||ge==="noembed"||ge==="noframes")&&St(/<\/no(script|embed|frames)/i,R.innerHTML)?(Zt(R),!0):(k&&R.nodeType===fr.text&&(ie=R.textContent,ai([z,P,V],Xe=>{ie=cr(ie,Xe," ")}),R.textContent!==ie&&(lr(e.removed,{element:R.cloneNode()}),R.textContent=ie)),be(W.afterSanitizeElements,R,null),!1)},et=function(R,ie,ge){if(I&&(ie==="id"||ie==="name")&&(ge in n||ge in Xs))return!1;if(!(C&&!Ee[ie]&&St(j,ie))){if(!(Le&&St(L,ie))){if(!(_e.attributeCheck instanceof Function&&_e.attributeCheck(ie,R))){if(!J[ie]||Ee[ie]){if(!(At(R)&&(Y.tagNameCheck instanceof RegExp&&St(Y.tagNameCheck,R)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(R))&&(Y.attributeNameCheck instanceof RegExp&&St(Y.attributeNameCheck,ie)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(ie,R))||ie==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&St(Y.tagNameCheck,ge)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(ge))))return!1}else if(!F[ie]){if(!St(se,cr(ge,Q,""))){if(!((ie==="src"||ie==="xlink:href"||ie==="href")&&R!=="script"&&mg(ge,"data:")===0&&Me[R])){if(!(N&&!St(H,cr(ge,Q,"")))){if(ge)return!1}}}}}}}return!0},At=function(R){return R!=="annotation-xml"&&ca(R,G)},Lm=function(R){be(W.beforeSanitizeAttributes,R,null);const{attributes:ie}=R;if(!ie||le(R))return;const ge={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J,forceKeepAttr:void 0};let Xe=ie.length;for(;Xe--;){const kt=ie[Xe],{name:rt,namespaceURI:Lt,value:$n}=kt,nr=Ze(rt),_c=$n;let bt=rt==="value"?_c:gg(_c);if(ge.attrName=nr,ge.attrValue=bt,ge.keepAttr=!0,ge.forceKeepAttr=void 0,be(W.uponSanitizeAttribute,R,ge),bt=ge.attrValue,q&&(nr==="id"||nr==="name")&&(kn(rt,R),bt=fe+bt),U&&St(/((--!?|])>)|<\/(style|title|textarea)/i,bt)){kn(rt,R);continue}if(nr==="attributename"&&ca(bt,"href")){kn(rt,R);continue}if(ge.forceKeepAttr)continue;if(!ge.keepAttr){kn(rt,R);continue}if(!O&&St(/\/>/i,bt)){kn(rt,R);continue}k&&ai([z,P,V],Vm=>{bt=cr(bt,Vm," ")});const $m=Ze(R.nodeName);if(!et($m,nr,bt)){kn(rt,R);continue}if(T&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Lt)switch(h.getAttributeType($m,nr)){case"TrustedHTML":{bt=T.createHTML(bt);break}case"TrustedScriptURL":{bt=T.createScriptURL(bt);break}}if(bt!==_c)try{Lt?R.setAttributeNS(Lt,rt,bt):R.setAttribute(rt,bt),le(R)?Zt(R):Hc(e.removed)}catch{kn(rt,R)}}be(W.afterSanitizeAttributes,R,null)},bM=function xe(R){let ie=null;const ge=ii(R);for(be(W.beforeSanitizeShadowDOM,R,null);ie=ge.nextNode();)be(W.uponSanitizeShadowNode,ie,null),Ge(ie),Lm(ie),ie.content instanceof i&&xe(ie.content);be(W.afterSanitizeShadowDOM,R,null)};return e.sanitize=function(xe){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie=null,ge=null,Xe=null,kt=null;if(xn=!xe,xn&&(xe="<!-->"),typeof xe!="string"&&!de(xe))if(typeof xe.toString=="function"){if(xe=xe.toString(),typeof xe!="string")throw dr("dirty is not a string, aborting")}else throw dr("toString is not a function");if(!e.isSupported)return xe;if(me||tr(R),e.removed=[],typeof xe=="string"&&(Te=!1),Te){if(xe.nodeName){const $n=Ze(xe.nodeName);if(!Z[$n]||ce[$n])throw dr("root node is forbidden and cannot be sanitized in-place")}}else if(xe instanceof l)ie=ta("<!---->"),ge=ie.ownerDocument.importNode(xe,!0),ge.nodeType===fr.element&&ge.nodeName==="BODY"||ge.nodeName==="HTML"?ie=ge:ie.appendChild(ge);else{if(!Ve&&!k&&!te&&xe.indexOf("<")===-1)return T&&_?T.createHTML(xe):xe;if(ie=ta(xe),!ie)return Ve?null:_?M:""}ie&&ve&&Zt(ie.firstChild);const rt=ii(Te?xe:ie);for(;Xe=rt.nextNode();)Ge(Xe),Lm(Xe),Xe.content instanceof i&&bM(Xe.content);if(Te)return xe;if(Ve){if(Ce)for(kt=E.call(ie.ownerDocument);ie.firstChild;)kt.appendChild(ie.firstChild);else kt=ie;return(J.shadowroot||J.shadowrootmode)&&(kt=D.call(o,kt,!0)),kt}let Lt=te?ie.outerHTML:ie.innerHTML;return te&&Z["!doctype"]&&ie.ownerDocument&&ie.ownerDocument.doctype&&ie.ownerDocument.doctype.name&&St(Xc,ie.ownerDocument.doctype.name)&&(Lt="<!DOCTYPE "+ie.ownerDocument.doctype.name+`>
|
|
338
|
-
`+Lt),k&&ai([z,P,V],$n=>{Lt=cr(Lt,$n," ")}),T&&_?T.createHTML(Lt):Lt},e.setConfig=function(){let xe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tr(xe),me=!0},e.clearConfig=function(){En=null,me=!1},e.isValidAttribute=function(xe,R,ie){En||tr({});const ge=Ze(xe),Xe=Ze(R);return et(ge,Xe,ie)},e.addHook=function(xe,R){typeof R=="function"&&lr(W[xe],R)},e.removeHook=function(xe,R){if(R!==void 0){const ie=pg(W[xe],R);return ie===-1?void 0:hg(W[xe],ie,1)[0]}return Hc(W[xe])},e.removeHooks=function(xe){W[xe]=[]},e.removeAllHooks=function(){W=Qc()},e}var Mg=Zc();function ed(t){return Mg.sanitize(t,{ALLOWED_TAGS:["p","br","strong","em","s","u","ul","ol","li","a","hr"],ALLOWED_ATTR:["href","target","rel"],ALLOW_DATA_ATTR:!1,FORBID_TAGS:["script","iframe","object","embed","form","input","button","style"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur"]})}function it(t){return typeof t!="string"?"":t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function Ct(t){if(!t||typeof t!="string")return"";const e=t.trim(),n=e.toLowerCase();return n.startsWith("javascript:")||n.startsWith("vbscript:")||n.startsWith("file:")?"":n.startsWith("data:")?n.startsWith("data:image/")?e:"":e}const pe={TEXT_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):([^}]+)\}/g,TEXT_FIELD:/\{\$(\w+):([^}]+)\}/g,RICH_TEXT_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):rich(?::[^}]+)?\}/g,RICH_TEXT_FIELD:/\{\$(\w+):(.+?):rich(?::[^}]+)?\}/g,TEXTAREA_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):textarea(?::[^}]+)?\}/g,TEXTAREA_FIELD:/\{\$(\w+):(.+?):textarea(?::[^}]+)?\}/g,IMAGE_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):image(?::[^}]+)?\}/g,IMAGE_FIELD:/\{\$(\w+):(.+?):image(?::[^}]+)?\}/g,SELECT_FIELD_WITH_GROUP:/\(\$(\w+)\.(\w+)@:([^)]+)\)/g,SELECT_FIELD:/\(\$(\w+)@:([^)]+)\)/g,RADIO_CHECKBOX_FIELD_WITH_GROUP:/\(\$(\w+)\.(\w+):([^)]+)\)/g,RADIO_FIELD:/\(\$(\w+):([^)]+)\)/g,BACKEND_DATA:/\{@([\w.[\]]+)\}/g};function Ig(t){const e={};for(const n of t){if(n==="required"){e.required=!0;continue}if(n==="readonly"){e.readonly=!0;continue}if(n==="disabled"){e.disabled=!0;continue}if(n.startsWith("max=")){const o=Number(n.slice(4));Number.isFinite(o)&&(e.maxLength=o)}}return e}function ze(t){const e=t.split(":"),n=[],o=r=>r==="required"||r==="readonly"||r==="disabled"||/^max=\d+$/.test(r);for(;e.length>0&&o(e[e.length-1]);)n.unshift(e.pop());return{defaultValue:e.join(":"),validation:Ig(n)}}function Fn(t){const e=[],n=new Set,o=ra(),s=new o().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template");if(!s)return e;const l=d=>{if(d.nodeType===Node.TEXT_NODE){const u=d.textContent||"",f=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(f)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]){const U=k[1],te=k[2];if(!n.has(U)){const{defaultValue:me,validation:ve}=ze(k[3]);e.push({fieldName:U,groupName:te,type:"rich",defaultValue:me,optional:!0,...ve}),n.add(U)}}});const h=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(h)).forEach(k=>{if(k&&k[1]&&k[2]){const U=k[1];if(!n.has(U)){const{defaultValue:te,validation:me}=ze(k[2]);e.push({fieldName:U,type:"rich",defaultValue:te,optional:!0,...me}),n.add(U)}}});const b=new RegExp(pe.RICH_TEXT_FIELD_WITH_GROUP.source,pe.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(b)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]){const U=k[1],te=k[2];if(!n.has(U)){const{defaultValue:me,validation:ve}=ze(k[3]);e.push({fieldName:U,groupName:te,type:"rich",defaultValue:me,...ve}),n.add(U)}}});const x=new RegExp(pe.RICH_TEXT_FIELD.source,pe.RICH_TEXT_FIELD.flags);Array.from(u.matchAll(x)).forEach(k=>{if(k&&k[1]&&k[2]){const U=k[1];if(!n.has(U)){const{defaultValue:te,validation:me}=ze(k[2]);e.push({fieldName:U,type:"rich",defaultValue:te,...me}),n.add(U)}}});const w=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(w)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"textarea",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const M=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(M)).forEach(k=>{if(k&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"textarea",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const y=new RegExp(pe.TEXTAREA_FIELD_WITH_GROUP.source,pe.TEXTAREA_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(y)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"textarea",defaultValue:U,...te}),n.add(k[1])}});const S=new RegExp(pe.TEXTAREA_FIELD.source,pe.TEXTAREA_FIELD.flags);Array.from(u.matchAll(S)).forEach(k=>{if(k&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"textarea",defaultValue:U,...te}),n.add(k[1])}});const W=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(W)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"image",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const P=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(P)).forEach(k=>{if(k&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"image",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const j=new RegExp(pe.IMAGE_FIELD_WITH_GROUP.source,pe.IMAGE_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(j)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"image",defaultValue:U,...te}),n.add(k[1])}});const H=new RegExp(pe.IMAGE_FIELD.source,pe.IMAGE_FIELD.flags);Array.from(u.matchAll(H)).forEach(k=>{if(k&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"image",defaultValue:U,...te}),n.add(k[1])}});const G=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(G)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"text",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const Z=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(Z)).forEach(k=>{if(k&&k[0]&&!/:rich(?::[^}]*)?\}$/.test(k[0])&&!/:image(?::[^}]*)?\}$/.test(k[0])&&!/:textarea(?::[^}]*)?\}$/.test(k[0])&&!k[0].includes(".")&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"text",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const J=new RegExp(pe.TEXT_FIELD_WITH_GROUP.source,pe.TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(J)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"text",defaultValue:U,...te}),n.add(k[1])}});const Y=new RegExp(pe.TEXT_FIELD.source,pe.TEXT_FIELD.flags);Array.from(u.matchAll(Y)).forEach(k=>{if(k&&k[0]&&!/:rich(?::[^}]*)?\}$/.test(k[0])&&!/:image(?::[^}]*)?\}$/.test(k[0])&&!/:textarea(?::[^}]*)?\}$/.test(k[0])&&!k[0].includes(".")&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"text",defaultValue:U,...te}),n.add(k[1])}});const Ee=new RegExp(pe.SELECT_FIELD_WITH_GROUP.source,pe.SELECT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(Ee)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const U=k[1],te=k[2],me=k[3];me.includes("|")?e.push({fieldName:U,groupName:te,type:"select",options:me.split("|")}):me.includes(",")&&e.push({fieldName:U,groupName:te,type:"select-multiple",options:me.split(",")}),n.add(U)}}),(u.match(pe.SELECT_FIELD)||[]).forEach(k=>{const U=k.match(/\(\$(\w+)@:([^)]+)\)/);if(U&&!n.has(U[1])){const te=U[1],me=U[2];me.includes("|")?e.push({fieldName:te,type:"select",options:me.split("|")}):me.includes(",")&&e.push({fieldName:te,type:"select-multiple",options:me.split(",")}),n.add(te)}});const C=new RegExp(pe.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,pe.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(C)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const U=k[1],te=k[2],me=k[3];me.includes("|")?e.push({fieldName:U,groupName:te,type:"radio",options:me.split("|")}):me.includes(",")&&e.push({fieldName:U,groupName:te,type:"checkbox",options:me.split(",")}),n.add(U)}}),(u.match(pe.RADIO_FIELD)||[]).forEach(k=>{const U=k.match(/\(\$(\w+):([^)]+)\)/);if(U&&!n.has(U[1])){const te=U[1],me=U[2];me.includes("|")?e.push({fieldName:te,type:"radio",options:me.split("|")}):me.includes(",")&&e.push({fieldName:te,type:"checkbox",options:me.split(",")}),n.add(te)}});return}else if(d.nodeType===Node.ELEMENT_NODE){const u=d,f=u.getAttribute("z-if");f&&!n.has(f)&&(e.push({fieldName:f,type:"boolean",defaultValue:"true"}),n.add(f));const p=u.getAttribute("z-tag");if(p){const m=p.match(/^\$(\w+)(?::(.+))?$/);if(m){const b=m[1],g=m[2];if(!n.has(b)){const x=g?g.split("|").map(T=>T.trim()):void 0,v=u.tagName.toLowerCase();let w=v;x&&!x.includes(v)&&(typeof process<"u"&&process.env?.NODE_ENV==="development"&&console.warn(`[ZeroCode] z-tag="${p}": 現在のタグ名 "${v}" が選択肢に含まれていません。デフォルト値として "${x[0]}" を使用します。`),w=x[0]),e.push({fieldName:b,type:"tag",defaultValue:w,options:x,optional:!1}),n.add(b)}}}Array.from(u.attributes).forEach(m=>{const b=m.value,g=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(b.matchAll(g)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"rich",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const v=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(b.matchAll(v)).forEach(C=>{if(C&&C[1]&&C[2]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"rich",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const T=new RegExp(pe.RICH_TEXT_FIELD_WITH_GROUP.source,pe.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(T)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"rich",defaultValue:N,...O}),n.add(C[1])}});const A=new RegExp(pe.RICH_TEXT_FIELD.source,pe.RICH_TEXT_FIELD.flags);Array.from(b.matchAll(A)).forEach(C=>{if(C&&C[1]&&C[2]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"rich",defaultValue:N,...O}),n.add(C[1])}});const E=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(b.matchAll(E)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"image",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const D=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(b.matchAll(D)).forEach(C=>{if(C&&C[1]&&C[2]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"image",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const z=new RegExp(pe.IMAGE_FIELD_WITH_GROUP.source,pe.IMAGE_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(z)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"image",defaultValue:N,...O}),n.add(C[1])}});const V=new RegExp(pe.IMAGE_FIELD.source,pe.IMAGE_FIELD.flags);Array.from(b.matchAll(V)).forEach(C=>{if(C&&C[1]&&C[2]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"image",defaultValue:N,...O}),n.add(C[1])}});const L=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(b.matchAll(L)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"text",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const Q=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(b.matchAll(Q)).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]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"text",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const se=new RegExp(pe.TEXT_FIELD_WITH_GROUP.source,pe.TEXT_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(se)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"text",defaultValue:N,...O}),n.add(C[1])}});const X=new RegExp(pe.TEXT_FIELD.source,pe.TEXT_FIELD.flags);Array.from(b.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]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"text",defaultValue:N,...O}),n.add(C[1])}});const K=new RegExp(pe.SELECT_FIELD_WITH_GROUP.source,pe.SELECT_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(K)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const N=C[1],O=C[2],k=C[3];k.includes("|")?e.push({fieldName:N,groupName:O,type:"select",options:k.split("|")}):k.includes(",")&&e.push({fieldName:N,groupName:O,type:"select-multiple",options:k.split(",")}),n.add(N)}}),(b.match(pe.SELECT_FIELD)||[]).forEach(C=>{const N=C.match(/\(\$(\w+)@:([^)]+)\)/);if(N&&!n.has(N[1])){const O=N[1],k=N[2];k.includes("|")?e.push({fieldName:O,type:"select",options:k.split("|")}):k.includes(",")&&e.push({fieldName:O,type:"select-multiple",options:k.split(",")}),n.add(O)}});const Ee=new RegExp(pe.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,pe.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(Ee)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const N=C[1],O=C[2],k=C[3];k.includes("|")?e.push({fieldName:N,groupName:O,type:"radio",options:k.split("|")}):k.includes(",")&&e.push({fieldName:N,groupName:O,type:"checkbox",options:k.split(",")}),n.add(N)}}),(b.match(pe.RADIO_FIELD)||[]).forEach(C=>{const N=C.match(/\(\$(\w+):([^)]+)\)/);if(N&&!n.has(N[1])){const O=N[1],k=N[2];k.includes("|")?e.push({fieldName:O,type:"radio",options:k.split("|")}):k.includes(",")&&e.push({fieldName:O,type:"checkbox",options:k.split(",")}),n.add(O)}})}),Array.from(d.childNodes).forEach(m=>l(m));return}else if(d.nodeType===Node.DOCUMENT_FRAGMENT_NODE){Array.from(d.childNodes).forEach(f=>l(f));return}};return Array.from(s.content.childNodes).forEach(d=>l(d)),e}function td(t,e){const n=ra(),i=new n().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template");if(!i||!i.content.firstElementChild)return console.warn("Failed to parse HTML:",t),t;const s=i.content.firstElementChild;return Object.entries(e).forEach(([l,c])=>{s.setAttribute(l,c)}),s.outerHTML}function di(t,e,n,o,r=[]){const i=[...n,...o,...r];if(t){const s=i.find(l=>l.id===t);if(s)return s.url}if(e){const s=i.find(l=>l.id===e);if(s)return console.warn(`Image not found: ${t}, using default: ${e}`),s.url}return console.warn(`Image not found: ${t}, default: ${e}`),""}function Og(t){return typeof t=="object"&&t!==null}function nd(t,e){if(!t||!e)return"";try{const n=[];let o="";for(let i=0;i<e.length;i++){const s=e[i];s==="["||s==="]"||s==="."?o&&(n.push(o),o=""):o+=s}o&&n.push(o);let r=t;for(let i=0;i<n.length;i++){const s=n[i];if(s.match(/^\d+$/)){const l=parseInt(s,10);if(Array.isArray(r)&&l>=0&&l<r.length)r=r[l];else return""}else if(Og(r)&&s in r)r=r[s];else return""}return r==null?"":String(r)}catch(n){return console.warn(`[ZeroCode] Failed to resolve backend data path: ${e}`,n),""}}function Dg(t,e){return!t||!e?t:t.replace(/\{(\w+)\}/g,(n,o)=>{const r=e[o];return r==null?n:String(r)})}function ui(t,e,n,o,r,i=!0,s=[],l=[],c=[],d){const u=ra(),f=new u,p=f.parseFromString(`<template>${t}</template>`,"text/html"),h=p.querySelector("template");if(!h||!h.content)return console.error("Failed to parse template HTML"),t;const m=y=>{if(y.nodeType===Node.TEXT_NODE){let E=y.textContent||"";d&&(E=E.replace(pe.BACKEND_DATA,(Z,X)=>nd(d,X)));let D=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(E),W=!1;if(D&&y.parentNode?W=!0:D=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(E),D&&y.parentNode){const Z=D[1],X=W?D[3]:D[2],{defaultValue:J}=ze(X),K=e[Z];if(typeof K=="boolean"){const N=y.parentNode,O=D.index||0,k=E.substring(0,O),U=E.substring(O+D[0].length);k&&N.insertBefore(p.createTextNode(k),y),U&&N.insertBefore(p.createTextNode(U),y),y.parentNode&&y.parentNode.removeChild(y);return}let Y=K===void 0?"":typeof K=="string"?K:String(K||J);i||(Y=ed(Y));const ce=y.parentNode,Ee=D.index||0,_e=E.substring(0,Ee),Le=E.substring(Ee+D[0].length);Y?Y.trim().startsWith("<p")||(Y=`<p>${Y}</p>`):Y="";const C=p.createElement("div");C.innerHTML=Y,_e&&ce.insertBefore(p.createTextNode(_e),y),Array.from(C.childNodes).forEach(N=>{ce.insertBefore(N.cloneNode(!0),y)}),Le&&ce.insertBefore(p.createTextNode(Le),y),y.parentNode&&y.parentNode.removeChild(y);return}let P=new RegExp(pe.RICH_TEXT_FIELD_WITH_GROUP.source,pe.RICH_TEXT_FIELD_WITH_GROUP.flags).exec(E),V=!1;if(P&&y.parentNode?V=!0:P=new RegExp(pe.RICH_TEXT_FIELD.source,pe.RICH_TEXT_FIELD.flags).exec(E),P&&y.parentNode){const Z=P[1],X=V?P[3]:P[2],J=e[Z];let K=J===void 0?"":typeof J=="string"?J:String(J||X);i||(K=ed(K));const Y=y.parentNode,ce=P.index||0,Ee=E.substring(0,ce),_e=E.substring(ce+P[0].length);K?K.trim().startsWith("<p")||(K=`<p>${K}</p>`):K="<p></p>";const Le=p.createElement("div");Le.innerHTML=K,Ee&&Y.insertBefore(p.createTextNode(Ee),y),Array.from(Le.childNodes).forEach(C=>{Y.insertBefore(C.cloneNode(!0),y)}),_e&&Y.insertBefore(p.createTextNode(_e),y),y.parentNode&&y.parentNode.removeChild(y);return}let L=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(E),H=!1;if(L&&y.parentNode?H=!0:L=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(E),L&&y.parentNode){const Z=L[1],X=H?L[3]:L[2],{defaultValue:J}=ze(X),K=e[Z],Y=K===void 0?"":String(K||J),ce=y.parentNode,Ee=L.index||0,_e=E.substring(0,Ee),Le=E.substring(Ee+L[0].length);_e&&ce.insertBefore(p.createTextNode(_e),y);const C=Y.split(`
|
|
339
|
-
`);if(
|
|
340
|
-
`);if(Le.forEach((C,N)=>{C&&Y.insertBefore(p.createTextNode(C),y),N<Le.length-1&&Y.insertBefore(p.createElement("br"),y)}),_e){const C=p.createTextNode(_e);Y.insertBefore(C,y),m(C)}y.parentNode&&y.parentNode.removeChild(y);return}E=E.replace(/\{\$(\w+)\?:([^}]+)\}/g,(Z,X,J)=>{if(/:textarea(?::[^}]*)?$/.test(Z))return Z;const K=e[X];if(K===void 0||typeof K=="boolean")return"";const{defaultValue:Y}=ze(J);return String(K||Y)}),E=E.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(Z,X,J,K)=>{if(/:textarea(?::[^}]*)?$/.test(Z))return Z;const Y=e[X];if(Y===void 0||typeof Y=="boolean")return"";const{defaultValue:ce}=ze(K);return String(Y||ce)}),E=E.replace(pe.TEXT_FIELD_WITH_GROUP,(Z,X,J,K)=>{const Y=e[X];if(Y===void 0)return"";const{defaultValue:ce}=ze(K);return String(Y||ce)}),E=E.replace(pe.TEXT_FIELD,(Z,X,J)=>{const K=e[X];if(K===void 0)return"";const{defaultValue:Y}=ze(J);return String(K||Y)}),y.textContent=E}else if(y.nodeType===Node.ELEMENT_NODE){const E=y,S=[];Array.from(E.attributes).forEach(D=>{const W=D.value;let z=D.value;const P=D.name.toLowerCase();if(P==="z-if"||P==="z-for"||P==="z-slot"||P==="z-empty"||P==="z-tag"||P.startsWith("data-zcode-"))return;const V=/^\{\$[\w.]+?\?:[^}]+\}(?::(rich|image|textarea))?$/.test(W.trim());d&&((P==="href"||P==="src"||P==="action")&&(z=Dg(z,d)),z=z.replace(pe.BACKEND_DATA,(j,L)=>{const H=nd(d,L);return P==="href"||P==="src"||P==="action"?Ct(H):it(H)})),z=z.replace(/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(j,L,H)=>{const Q=e[L];if(Q===void 0||typeof Q=="boolean")return"";const{defaultValue:G}=ze(H);return it(String(Q||G))}),z=z.replace(/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(j,L,H,Q)=>{const G=e[L];if(G===void 0||typeof G=="boolean")return"";const{defaultValue:se}=ze(Q);return it(String(G||se))}),z=z.replace(/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(j,L,H)=>{const Q=e[L];if(Q===void 0)return"";const{defaultValue:G}=ze(H),se=typeof Q=="string"?Q:String(Q||G),Z=di(se,G,s,l,c),X=typeof Z=="string"?Z:String(Z||G);return P==="href"||P==="src"?Ct(X):it(X)}),z=z.replace(/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(j,L,H,Q)=>{const G=e[L];if(G===void 0)return"";const{defaultValue:se}=ze(Q),Z=typeof G=="string"?G:String(G||se),X=di(Z,se,s,l,c),J=typeof X=="string"?X:String(X||se);return P==="href"||P==="src"?Ct(J):it(J)}),z=z.replace(pe.RICH_TEXT_FIELD_WITH_GROUP,(j,L,H,Q)=>{const G=e[L];return G===void 0?"":it(String(G||Q))}),z=z.replace(pe.RICH_TEXT_FIELD,(j,L,H)=>{const Q=e[L];return Q===void 0?"":it(String(Q||H))}),z=z.replace(pe.IMAGE_FIELD_WITH_GROUP,(j,L,H,Q)=>{const G=e[L];if(G===void 0)return"";const se=di(G||Q,Q,s,l,c);return P==="href"||P==="src"?Ct(se||Q):it(se||Q)}),z=z.replace(pe.IMAGE_FIELD,(j,L,H)=>{const Q=e[L];if(Q===void 0)return"";const G=di(Q||H,H,s,l,c);return P==="href"||P==="src"?Ct(G||H):it(G||H)}),z=z.replace(/\{\$(\w+)\?:([^}]+)\}/g,(j,L,H)=>{const Q=e[L];if(Q===void 0||typeof Q=="boolean")return"";const{defaultValue:G}=ze(H),se=String(Q||G);return P==="href"||P==="src"||P==="action"?Ct(se):it(se)}),z=z.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(j,L,H,Q)=>{const G=e[L];if(G===void 0||typeof G=="boolean")return"";const{defaultValue:se}=ze(Q),Z=String(G||se);return P==="href"||P==="src"||P==="action"?Ct(Z):it(Z)}),z=z.replace(pe.TEXT_FIELD_WITH_GROUP,(j,L,H,Q)=>{const G=e[L];if(G===void 0)return"";const{defaultValue:se}=ze(Q),Z=String(G||se);return P==="href"||P==="src"||P==="action"?Ct(Z):it(Z)}),z=z.replace(pe.TEXT_FIELD,(j,L,H)=>{const Q=e[L];if(Q===void 0)return"";const{defaultValue:G}=ze(H),se=String(Q||G);return P==="href"||P==="src"||P==="action"?Ct(se):it(se)}),V&&z.trim()===""?S.push(D.name):D.value=z}),S.forEach(D=>{E.removeAttribute(D)})}Array.from(y.childNodes).forEach(E=>m(E))};m(h.content);const b=y=>{if(y.nodeType===Node.TEXT_NODE){let E=y.textContent||"";E=E.replace(pe.SELECT_FIELD_WITH_GROUP,(S,D,W,z)=>{if(z.includes("|"))return e[D]||z.split("|")[0];if(z.includes(",")){const P=e[D],V=Array.isArray(P)?P:[],j=z.split(",");return V.filter(L=>typeof L=="string"&&j.includes(L)).join(" ")}return e[D]||z}),E=E.replace(pe.SELECT_FIELD,(S,D,W)=>{if(W.includes("|")){const P=e[D];return typeof P=="string"?P:W.split("|")[0]}else if(W.includes(",")){const P=e[D],V=Array.isArray(P)?P:[],j=W.split(",");return V.filter(L=>typeof L=="string"&&j.includes(L)).join(" ")}const z=e[D];return typeof z=="string"?z:W}),E=E.replace(pe.RADIO_CHECKBOX_FIELD_WITH_GROUP,(S,D,W,z)=>{if(z.includes("|")){const V=e[D];return typeof V=="string"?V:z.split("|")[0]}else if(z.includes(",")){const V=e[D],j=Array.isArray(V)?V:[],L=z.split(",");return j.filter(H=>typeof H=="string"&&L.includes(H)).join(" ")}const P=e[D];return typeof P=="string"?P:z}),E=E.replace(pe.RADIO_FIELD,(S,D,W)=>{if(W.includes("|")){const P=e[D];return typeof P=="string"?P:W.split("|")[0]}else if(W.includes(",")){const P=e[D],V=Array.isArray(P)?P:[],j=W.split(",");return V.filter(L=>typeof L=="string"&&j.includes(L)).join(" ")}const z=e[D];return typeof z=="string"?z:W}),y.textContent=E}else y.nodeType===Node.ELEMENT_NODE&&Array.from(y.attributes).forEach(S=>{let D=S.value;const W=S.name.toLowerCase();D=D.replace(pe.SELECT_FIELD_WITH_GROUP,(z,P,V,j)=>{let L;if(j.includes("|"))L=e[P]||j.split("|")[0];else if(j.includes(",")){const H=e[P],Q=Array.isArray(H)?H:[],G=j.split(",");L=Q.filter(se=>typeof se=="string"&&G.includes(se)).join(" ")}else{const H=e[P];L=typeof H=="string"?H:j}return W==="href"||W==="src"||W==="action"?Ct(String(L)):it(String(L))}),D=D.replace(pe.SELECT_FIELD,(z,P,V)=>{let j;if(V.includes("|"))j=e[P]||V.split("|")[0];else if(V.includes(",")){const L=e[P],H=Array.isArray(L)?L:[],Q=V.split(",");j=H.filter(G=>typeof G=="string"&&Q.includes(G)).join(" ")}else{const L=e[P];j=typeof L=="string"?L:V}return W==="href"||W==="src"||W==="action"?Ct(String(j)):it(String(j))}),D=D.replace(pe.RADIO_CHECKBOX_FIELD_WITH_GROUP,(z,P,V,j)=>{let L;if(j.includes("|"))L=e[P]||j.split("|")[0];else if(j.includes(",")){const H=e[P],Q=Array.isArray(H)?H:[],G=j.split(",");L=Q.filter(se=>typeof se=="string"&&G.includes(se)).join(" ")}else{const H=e[P];L=typeof H=="string"?H:j}return W==="href"||W==="src"||W==="action"?Ct(String(L)):it(String(L))}),D=D.replace(pe.RADIO_FIELD,(z,P,V)=>{let j;if(V.includes("|"))j=e[P]||V.split("|")[0];else if(V.includes(",")){const L=e[P],H=Array.isArray(L)?L:[],Q=V.split(",");j=H.filter(G=>typeof G=="string"&&Q.includes(G)).join(" ")}else{const L=e[P];j=typeof L=="string"?L:V}return W==="href"||W==="src"||W==="action"?Ct(String(j)):it(String(j))}),S.value=D});y.childNodes.forEach(E=>b(E))};b(h.content),h.content.querySelectorAll("[z-if]").forEach(y=>{const E=y.getAttribute("z-if");E?(e[E]!==void 0?e[E]:!0)?y.removeAttribute("z-if"):y.remove():y.removeAttribute("z-if")}),h.content.querySelectorAll("[z-tag]").forEach(y=>{const E=y.getAttribute("z-tag");if(E){const S=E.match(/^\$(\w+)(?::(.+))?$/);if(S){const D=S[1],W=e[D],z=typeof W=="string"?W:y.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"],V=typeof z=="string"?z.toLowerCase():z;if(typeof V=="string"&&P.includes(V)){const j=p.createElement(V);Array.from(y.attributes).forEach(L=>{L.name!=="z-tag"&&j.setAttribute(L.name,L.value)}),Array.from(y.childNodes).forEach(L=>{j.appendChild(L.cloneNode(!0))}),y.parentNode?.replaceChild(j,y)}}}}),h.content.querySelectorAll("[z-empty]").forEach(y=>{const E=y.getAttribute("z-empty");if(E){const S=E.match(/^\$(\w+)$/);if(S){const D=S[1],W=e[D];(P=>{if(P==null||P==="")return!0;if(typeof P=="string"){const V=P.trim();if(V===""||V==="<p></p>"||V==="<p> </p>"||/^<p>\s*<\/p>$/i.test(V)||/^<p>\s*<br\s*\/?>\s*<\/p>$/i.test(V))return!0}return!1})(W)?y.remove():y.removeAttribute("z-empty")}else y.removeAttribute("z-empty")}else y.removeAttribute("z-empty")});const w=()=>{Array.from(h.content.querySelectorAll("[z-for]")).forEach(E=>{const S=E.getAttribute("z-for");if(!S){E.removeAttribute("z-for");return}const D=S.match(/^(\w+)\s+in\s+(.+)$/);if(!D){console.warn(`[ZeroCode] Invalid z-for syntax: ${S}`),E.removeAttribute("z-for");return}const[,W,z]=D;if(!z.startsWith("{@")||!z.endsWith("}")){console.warn(`[ZeroCode] z-for only supports backend data: ${z}`),E.removeAttribute("z-for");return}const P=z.slice(2,-1);if(!d){E.remove();return}let V;try{const L=P.split(".");let H=d;for(const Q of L)if(H&&typeof H=="object"&&Q in H)H=H[Q];else{H=null;break}V=H}catch(L){console.warn(`[ZeroCode] Failed to resolve data source: ${P}`,L),E.remove();return}if(!Array.isArray(V)||V.length===0){E.remove();return}const j=document.createDocumentFragment();V.forEach(L=>{const H=E.cloneNode(!0);H.removeAttribute("z-for"),T(H,W,L,e,d),j.appendChild(H)}),E.parentNode&&E.parentNode.replaceChild(j,E)})},T=(y,E,S,D,W,z)=>{const P=j=>{if(j.nodeType===Node.TEXT_NODE){let L=j.textContent||"";const H=new RegExp(`\\{${E}\\.([\\w\\.\\[\\]]+)\\}`,"g");L=L.replace(H,(Q,G)=>{try{const se=G.split(/[.[\]]/).filter(X=>X);let Z=S;for(const X of se)if(X.match(/^\d+$/)){const J=parseInt(X,10);if(Array.isArray(Z)&&J>=0&&J<Z.length)Z=Z[J];else return""}else if(Z&&typeof Z=="object"&&X in Z)Z=Z[X];else return"";return Z==null?"":String(Z)}catch{return""}}),L=L.replace(new RegExp(`\\{${E}\\}`,"g"),()=>typeof S=="object"&&S!==null?JSON.stringify(S):String(S)),j.textContent=L}else if(j.nodeType===Node.ELEMENT_NODE){const L=j;Array.from(L.attributes).forEach(H=>{let Q=H.value;const G=new RegExp(`\\{${E}\\.([\\w\\.\\[\\]]+)\\}`,"g");Q=Q.replace(G,(se,Z)=>{try{const X=Z.split(/[.[\]]/).filter(Y=>Y);let J=S;for(const Y of X)if(Y.match(/^\d+$/)){const ce=parseInt(Y,10);if(Array.isArray(J)&&ce>=0&&ce<J.length)J=J[ce];else return""}else if(J&&typeof J=="object"&&Y in J)J=J[Y];else return"";const K=J==null?"":String(J);return H.name==="href"||H.name==="src"||H.name==="action"?Ct(K):it(K)}catch{return""}}),Q=Q.replace(new RegExp(`\\{${E}\\}`,"g"),()=>{const se=typeof S=="object"&&S!==null?JSON.stringify(S):String(S);return H.name==="href"||H.name==="src"||H.name==="action"?Ct(se):it(se)}),H.value=Q}),Array.from(L.childNodes).forEach(H=>P(H))}};Array.from(y.childNodes).forEach(j=>P(j));const V=y.innerHTML;if(V){const j=ui(V,D,n,o,r,i,s,l,c,W);y.innerHTML=j}};w();const M=y=>{y.forEach(E=>{const S=E.getAttribute("z-slot")||"default",D=e.slots?.[S];let W=[];if(Array.isArray(D)?W=D:D&&typeof D=="object"&&D.children&&(W=D.children||[]),W.length===0){E.removeAttribute("z-slot"),i?(E.setAttribute("data-zcode-empty-slot",S),E.setAttribute("data-zcode-slot-path",n?`${n}.slots.${S}`:`slots.${S}`),E.innerHTML=`<div class="zcode-empty-slot" data-zcode-empty-slot-content>
|
|
341
|
-
<button class="zcode-add-slot-btn" data-zcode-add-slot
|
|
342
|
-
</div>`
|
|
343
|
-
`)}function mi(t){let e=t;return()=>++e}function pd(){const t=new Map;return{events:t,on(n,o){const r=t.get(n);r&&r.push(o)||t.set(n,[o])},off(n,o){const r=t.get(n);r&&r.splice(r.indexOf(o)>>>0,1)},emit(n,o){(t.get(n)||[]).slice().map(r=>r(o)),(t.get("*")||[]).slice().map(r=>r(n,o))}}}const gi=t=>!Re(t)||tt(t);function bi(t,e){if(gi(t)||gi(e))throw new Error("Invalid value");const n=[{src:t,des:e}];for(;n.length;){const{src:o,des:r}=n.pop();Object.keys(o).forEach(i=>{i!=="__proto__"&&(Re(o[i])&&!Re(r[i])&&(r[i]=Array.isArray(o[i])?[]:Be()),gi(r[i])||gi(o[i])?r[i]=o[i]:n.push({src:o[i],des:r[i]}))})}}function Xg(t,e,n){return{line:t,column:e,offset:n}}function yi(t,e,n){return{start:t,end:e}}const Yg=/\{([0-9a-zA-Z]+)\}/g;function hd(t,...e){return e.length===1&&Qg(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),t.replace(Yg,(n,o)=>e.hasOwnProperty(o)?e[o]:"")}const md=Object.assign,gd=t=>typeof t=="string",Qg=t=>t!==null&&typeof t=="object";function bd(t,e=""){return t.reduce((n,o,r)=>r===0?n+o:n+e+o,"")}const xi={USE_MODULO_SYNTAX:1,__EXTEND_POINT__:2},Zg={[xi.USE_MODULO_SYNTAX]:"Use modulo before '{{0}}'."};function eb(t,e,...n){const o=hd(Zg[t],...n||[]),r={message:String(o),code:t};return e&&(r.location=e),r}const Se={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16,__EXTEND_POINT__:17},tb={[Se.EXPECTED_TOKEN]:"Expected token: '{0}'",[Se.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[Se.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[Se.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[Se.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[Se.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[Se.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[Se.EMPTY_PLACEHOLDER]:"Empty placeholder",[Se.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[Se.INVALID_LINKED_FORMAT]:"Invalid linked format",[Se.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[Se.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[Se.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[Se.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[Se.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[Se.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function Io(t,e,n={}){const{domain:o,messages:r,args:i}=n,s=hd((r||tb)[t]||"",...i||[]),l=new SyntaxError(String(s));return l.code=t,e&&(l.location=e),l.domain=o,l}function nb(t){throw t}const ob=/<\/?[\w\s="/.':;#-\/]+>/,rb=t=>ob.test(t),Sn=" ",ib="\r",vt=`
|
|
344
|
-
`,sb="\u2028",ab="\u2029";function lb(t){const e=t;let n=0,o=1,r=1,i=0;const s=y=>e[y]===ib&&e[y+1]===vt,l=y=>e[y]===vt,c=y=>e[y]===ab,d=y=>e[y]===sb,u=y=>s(y)||l(y)||c(y)||d(y),f=()=>n,p=()=>o,h=()=>r,m=()=>i,b=y=>s(y)||c(y)||d(y)?vt:e[y],g=()=>b(n),x=()=>b(n+i);function v(){return i=0,u(n)&&(o++,r=0),s(n)&&n++,n++,r++,e[n]}function w(){return s(n+i)&&i++,i++,e[n+i]}function T(){n=0,o=1,r=1,i=0}function M(y=0){i=y}function A(){const y=n+i;for(;y!==n;)v();i=0}return{index:f,line:p,column:h,peekOffset:m,charAt:b,currentChar:g,currentPeek:x,next:v,peek:w,reset:T,resetPeek:M,skipToPeek:A}}const Un=void 0,cb=".",yd="'",db="tokenizer";function ub(t,e={}){const n=e.location!==!1,o=lb(t),r=()=>o.index(),i=()=>Xg(o.line(),o.column(),o.index()),s=i(),l=r(),c={currentType:14,offset:l,startLoc:s,endLoc:s,lastType:14,lastOffset:l,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},d=()=>c,{onError:u}=e;function f(_,I,q,...fe){const Ae=d();if(I.column+=q,I.offset+=q,u){const Te=n?yi(Ae.startLoc,I):null,we=Io(_,Te,{domain:db,args:fe});u(we)}}function p(_,I,q){_.endLoc=i(),_.currentType=I;const fe={type:I};return n&&(fe.loc=yi(_.startLoc,_.endLoc)),q!=null&&(fe.value=q),fe}const h=_=>p(_,14);function m(_,I){return _.currentChar()===I?(_.next(),I):(f(Se.EXPECTED_TOKEN,i(),0,I),"")}function b(_){let I="";for(;_.currentPeek()===Sn||_.currentPeek()===vt;)I+=_.currentPeek(),_.peek();return I}function g(_){const I=b(_);return _.skipToPeek(),I}function x(_){if(_===Un)return!1;const I=_.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I===95}function v(_){if(_===Un)return!1;const I=_.charCodeAt(0);return I>=48&&I<=57}function w(_,I){const{currentType:q}=I;if(q!==2)return!1;b(_);const fe=x(_.currentPeek());return _.resetPeek(),fe}function T(_,I){const{currentType:q}=I;if(q!==2)return!1;b(_);const fe=_.currentPeek()==="-"?_.peek():_.currentPeek(),Ae=v(fe);return _.resetPeek(),Ae}function M(_,I){const{currentType:q}=I;if(q!==2)return!1;b(_);const fe=_.currentPeek()===yd;return _.resetPeek(),fe}function A(_,I){const{currentType:q}=I;if(q!==8)return!1;b(_);const fe=_.currentPeek()===".";return _.resetPeek(),fe}function y(_,I){const{currentType:q}=I;if(q!==9)return!1;b(_);const fe=x(_.currentPeek());return _.resetPeek(),fe}function E(_,I){const{currentType:q}=I;if(!(q===8||q===12))return!1;b(_);const fe=_.currentPeek()===":";return _.resetPeek(),fe}function S(_,I){const{currentType:q}=I;if(q!==10)return!1;const fe=()=>{const Te=_.currentPeek();return Te==="{"?x(_.peek()):Te==="@"||Te==="%"||Te==="|"||Te===":"||Te==="."||Te===Sn||!Te?!1:Te===vt?(_.peek(),fe()):z(_,!1)},Ae=fe();return _.resetPeek(),Ae}function D(_){b(_);const I=_.currentPeek()==="|";return _.resetPeek(),I}function W(_){const I=b(_),q=_.currentPeek()==="%"&&_.peek()==="{";return _.resetPeek(),{isModulo:q,hasSpace:I.length>0}}function z(_,I=!0){const q=(Ae=!1,Te="",we=!1)=>{const B=_.currentPeek();return B==="{"?Te==="%"?!1:Ae:B==="@"||!B?Te==="%"?!0:Ae:B==="%"?(_.peek(),q(Ae,"%",!0)):B==="|"?Te==="%"||we?!0:!(Te===Sn||Te===vt):B===Sn?(_.peek(),q(!0,Sn,we)):B===vt?(_.peek(),q(!0,vt,we)):!0},fe=q();return I&&_.resetPeek(),fe}function P(_,I){const q=_.currentChar();return q===Un?Un:I(q)?(_.next(),q):null}function V(_){const I=_.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36}function j(_){return P(_,V)}function L(_){const I=_.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36||I===45}function H(_){return P(_,L)}function Q(_){const I=_.charCodeAt(0);return I>=48&&I<=57}function G(_){return P(_,Q)}function se(_){const I=_.charCodeAt(0);return I>=48&&I<=57||I>=65&&I<=70||I>=97&&I<=102}function Z(_){return P(_,se)}function X(_){let I="",q="";for(;I=G(_);)q+=I;return q}function J(_){g(_);const I=_.currentChar();return I!=="%"&&f(Se.EXPECTED_TOKEN,i(),0,I),_.next(),"%"}function K(_){let I="";for(;;){const q=_.currentChar();if(q==="{"||q==="}"||q==="@"||q==="|"||!q)break;if(q==="%")if(z(_))I+=q,_.next();else break;else if(q===Sn||q===vt)if(z(_))I+=q,_.next();else{if(D(_))break;I+=q,_.next()}else I+=q,_.next()}return I}function Y(_){g(_);let I="",q="";for(;I=H(_);)q+=I;return _.currentChar()===Un&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),q}function ce(_){g(_);let I="";return _.currentChar()==="-"?(_.next(),I+=`-${X(_)}`):I+=X(_),_.currentChar()===Un&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),I}function Ee(_){return _!==yd&&_!==vt}function _e(_){g(_),m(_,"'");let I="",q="";for(;I=P(_,Ee);)I==="\\"?q+=Le(_):q+=I;const fe=_.currentChar();return fe===vt||fe===Un?(f(Se.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,i(),0),fe===vt&&(_.next(),m(_,"'")),q):(m(_,"'"),q)}function Le(_){const I=_.currentChar();switch(I){case"\\":case"'":return _.next(),`\\${I}`;case"u":return C(_,I,4);case"U":return C(_,I,6);default:return f(Se.UNKNOWN_ESCAPE_SEQUENCE,i(),0,I),""}}function C(_,I,q){m(_,I);let fe="";for(let Ae=0;Ae<q;Ae++){const Te=Z(_);if(!Te){f(Se.INVALID_UNICODE_ESCAPE_SEQUENCE,i(),0,`\\${I}${fe}${_.currentChar()}`);break}fe+=Te}return`\\${I}${fe}`}function N(_){return _!=="{"&&_!=="}"&&_!==Sn&&_!==vt}function O(_){g(_);let I="",q="";for(;I=P(_,N);)q+=I;return q}function k(_){let I="",q="";for(;I=j(_);)q+=I;return q}function U(_){const I=q=>{const fe=_.currentChar();return fe==="{"||fe==="%"||fe==="@"||fe==="|"||fe==="("||fe===")"||!fe||fe===Sn?q:(q+=fe,_.next(),I(q))};return I("")}function te(_){g(_);const I=m(_,"|");return g(_),I}function me(_,I){let q=null;switch(_.currentChar()){case"{":return I.braceNest>=1&&f(Se.NOT_ALLOW_NEST_PLACEHOLDER,i(),0),_.next(),q=p(I,2,"{"),g(_),I.braceNest++,q;case"}":return I.braceNest>0&&I.currentType===2&&f(Se.EMPTY_PLACEHOLDER,i(),0),_.next(),q=p(I,3,"}"),I.braceNest--,I.braceNest>0&&g(_),I.inLinked&&I.braceNest===0&&(I.inLinked=!1),q;case"@":return I.braceNest>0&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),q=ve(_,I)||h(I),I.braceNest=0,q;default:{let Ae=!0,Te=!0,we=!0;if(D(_))return I.braceNest>0&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),q=p(I,1,te(_)),I.braceNest=0,I.inLinked=!1,q;if(I.braceNest>0&&(I.currentType===5||I.currentType===6||I.currentType===7))return f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),I.braceNest=0,Ve(_,I);if(Ae=w(_,I))return q=p(I,5,Y(_)),g(_),q;if(Te=T(_,I))return q=p(I,6,ce(_)),g(_),q;if(we=M(_,I))return q=p(I,7,_e(_)),g(_),q;if(!Ae&&!Te&&!we)return q=p(I,13,O(_)),f(Se.INVALID_TOKEN_IN_PLACEHOLDER,i(),0,q.value),g(_),q;break}}return q}function ve(_,I){const{currentType:q}=I;let fe=null;const Ae=_.currentChar();switch((q===8||q===9||q===12||q===10)&&(Ae===vt||Ae===Sn)&&f(Se.INVALID_LINKED_FORMAT,i(),0),Ae){case"@":return _.next(),fe=p(I,8,"@"),I.inLinked=!0,fe;case".":return g(_),_.next(),p(I,9,".");case":":return g(_),_.next(),p(I,10,":");default:return D(_)?(fe=p(I,1,te(_)),I.braceNest=0,I.inLinked=!1,fe):A(_,I)||E(_,I)?(g(_),ve(_,I)):y(_,I)?(g(_),p(I,12,k(_))):S(_,I)?(g(_),Ae==="{"?me(_,I)||fe:p(I,11,U(_))):(q===8&&f(Se.INVALID_LINKED_FORMAT,i(),0),I.braceNest=0,I.inLinked=!1,Ve(_,I))}}function Ve(_,I){let q={type:14};if(I.braceNest>0)return me(_,I)||h(I);if(I.inLinked)return ve(_,I)||h(I);switch(_.currentChar()){case"{":return me(_,I)||h(I);case"}":return f(Se.UNBALANCED_CLOSING_BRACE,i(),0),_.next(),p(I,3,"}");case"@":return ve(_,I)||h(I);default:{if(D(_))return q=p(I,1,te(_)),I.braceNest=0,I.inLinked=!1,q;const{isModulo:Ae,hasSpace:Te}=W(_);if(Ae)return Te?p(I,0,K(_)):p(I,4,J(_));if(z(_))return p(I,0,K(_));break}}return q}function Ce(){const{currentType:_,offset:I,startLoc:q,endLoc:fe}=c;return c.lastType=_,c.lastOffset=I,c.lastStartLoc=q,c.lastEndLoc=fe,c.offset=r(),c.startLoc=i(),o.currentChar()===Un?p(c,14):Ve(o,c)}return{nextToken:Ce,currentOffset:r,currentPosition:i,context:d}}const fb="parser",pb=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function hb(t,e,n){switch(t){case"\\\\":return"\\";case"\\'":return"'";default:{const o=parseInt(e||n,16);return o<=55295||o>=57344?String.fromCodePoint(o):"�"}}}function mb(t={}){const e=t.location!==!1,{onError:n,onWarn:o}=t;function r(w,T,M,A,...y){const E=w.currentPosition();if(E.offset+=A,E.column+=A,n){const S=e?yi(M,E):null,D=Io(T,S,{domain:fb,args:y});n(D)}}function i(w,T,M,A,...y){const E=w.currentPosition();if(E.offset+=A,E.column+=A,o){const S=e?yi(M,E):null;o(eb(T,S,y))}}function s(w,T,M){const A={type:w};return e&&(A.start=T,A.end=T,A.loc={start:M,end:M}),A}function l(w,T,M,A){e&&(w.end=T,w.loc&&(w.loc.end=M))}function c(w,T){const M=w.context(),A=s(3,M.offset,M.startLoc);return A.value=T,l(A,w.currentOffset(),w.currentPosition()),A}function d(w,T){const M=w.context(),{lastOffset:A,lastStartLoc:y}=M,E=s(5,A,y);return E.index=parseInt(T,10),w.nextToken(),l(E,w.currentOffset(),w.currentPosition()),E}function u(w,T,M){const A=w.context(),{lastOffset:y,lastStartLoc:E}=A,S=s(4,y,E);return S.key=T,M===!0&&(S.modulo=!0),w.nextToken(),l(S,w.currentOffset(),w.currentPosition()),S}function f(w,T){const M=w.context(),{lastOffset:A,lastStartLoc:y}=M,E=s(9,A,y);return E.value=T.replace(pb,hb),w.nextToken(),l(E,w.currentOffset(),w.currentPosition()),E}function p(w){const T=w.nextToken(),M=w.context(),{lastOffset:A,lastStartLoc:y}=M,E=s(8,A,y);return T.type!==12?(r(w,Se.UNEXPECTED_EMPTY_LINKED_MODIFIER,M.lastStartLoc,0),E.value="",l(E,A,y),{nextConsumeToken:T,node:E}):(T.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,M.lastStartLoc,0,on(T)),E.value=T.value||"",l(E,w.currentOffset(),w.currentPosition()),{node:E})}function h(w,T){const M=w.context(),A=s(7,M.offset,M.startLoc);return A.value=T,l(A,w.currentOffset(),w.currentPosition()),A}function m(w){const T=w.context(),M=s(6,T.offset,T.startLoc);let A=w.nextToken();if(A.type===9){const y=p(w);M.modifier=y.node,A=y.nextConsumeToken||w.nextToken()}switch(A.type!==10&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),A=w.nextToken(),A.type===2&&(A=w.nextToken()),A.type){case 11:A.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=h(w,A.value||"");break;case 5:A.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=u(w,A.value||"");break;case 6:A.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=d(w,A.value||"");break;case 7:A.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=f(w,A.value||"");break;default:{r(w,Se.UNEXPECTED_EMPTY_LINKED_KEY,T.lastStartLoc,0);const y=w.context(),E=s(7,y.offset,y.startLoc);return E.value="",l(E,y.offset,y.startLoc),M.key=E,l(M,y.offset,y.startLoc),{nextConsumeToken:A,node:M}}}return l(M,w.currentOffset(),w.currentPosition()),{node:M}}function b(w){const T=w.context(),M=T.currentType===1?w.currentOffset():T.offset,A=T.currentType===1?T.endLoc:T.startLoc,y=s(2,M,A);y.items=[];let E=null,S=null;do{const z=E||w.nextToken();switch(E=null,z.type){case 0:z.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(c(w,z.value||""));break;case 6:z.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(d(w,z.value||""));break;case 4:S=!0;break;case 5:z.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(u(w,z.value||"",!!S)),S&&(i(w,xi.USE_MODULO_SYNTAX,T.lastStartLoc,0,on(z)),S=null);break;case 7:z.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(f(w,z.value||""));break;case 8:{const P=m(w);y.items.push(P.node),E=P.nextConsumeToken||null;break}}}while(T.currentType!==14&&T.currentType!==1);const D=T.currentType===1?T.lastOffset:w.currentOffset(),W=T.currentType===1?T.lastEndLoc:w.currentPosition();return l(y,D,W),y}function g(w,T,M,A){const y=w.context();let E=A.items.length===0;const S=s(1,T,M);S.cases=[],S.cases.push(A);do{const D=b(w);E||(E=D.items.length===0),S.cases.push(D)}while(y.currentType!==14);return E&&r(w,Se.MUST_HAVE_MESSAGES_IN_PLURAL,M,0),l(S,w.currentOffset(),w.currentPosition()),S}function x(w){const T=w.context(),{offset:M,startLoc:A}=T,y=b(w);return T.currentType===14?y:g(w,M,A,y)}function v(w){const T=ub(w,md({},t)),M=T.context(),A=s(0,M.offset,M.startLoc);return e&&A.loc&&(A.loc.source=w),A.body=x(T),t.onCacheKey&&(A.cacheKey=t.onCacheKey(w)),M.currentType!==14&&r(T,Se.UNEXPECTED_LEXICAL_ANALYSIS,M.lastStartLoc,0,w[M.offset]||""),l(A,T.currentOffset(),T.currentPosition()),A}return{parse:v}}function on(t){if(t.type===14)return"EOF";const e=(t.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function gb(t,e={}){const n={ast:t,helpers:new Set};return{context:()=>n,helper:i=>(n.helpers.add(i),i)}}function xd(t,e){for(let n=0;n<t.length;n++)ba(t[n],e)}function ba(t,e){switch(t.type){case 1:xd(t.cases,e),e.helper("plural");break;case 2:xd(t.items,e);break;case 6:{ba(t.key,e),e.helper("linked"),e.helper("type");break}case 5:e.helper("interpolate"),e.helper("list");break;case 4:e.helper("interpolate"),e.helper("named");break}}function bb(t,e={}){const n=gb(t);n.helper("normalize"),t.body&&ba(t.body,n);const o=n.context();t.helpers=Array.from(o.helpers)}function yb(t){const e=t.body;return e.type===2?Ed(e):e.cases.forEach(n=>Ed(n)),t}function Ed(t){if(t.items.length===1){const e=t.items[0];(e.type===3||e.type===9)&&(t.static=e.value,delete e.value)}else{const e=[];for(let n=0;n<t.items.length;n++){const o=t.items[n];if(!(o.type===3||o.type===9)||o.value==null)break;e.push(o.value)}if(e.length===t.items.length){t.static=bd(e);for(let n=0;n<t.items.length;n++){const o=t.items[n];(o.type===3||o.type===9)&&delete o.value}}}}const xb="minifier";function Oo(t){switch(t.t=t.type,t.type){case 0:{const e=t;Oo(e.body),e.b=e.body,delete e.body;break}case 1:{const e=t,n=e.cases;for(let o=0;o<n.length;o++)Oo(n[o]);e.c=n,delete e.cases;break}case 2:{const e=t,n=e.items;for(let o=0;o<n.length;o++)Oo(n[o]);e.i=n,delete e.items,e.static&&(e.s=e.static,delete e.static);break}case 3:case 9:case 8:case 7:{const e=t;e.value&&(e.v=e.value,delete e.value);break}case 6:{const e=t;Oo(e.key),e.k=e.key,delete e.key,e.modifier&&(Oo(e.modifier),e.m=e.modifier,delete e.modifier);break}case 5:{const e=t;e.i=e.index,delete e.index;break}case 4:{const e=t;e.k=e.key,delete e.key;break}default:throw Io(Se.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:xb,args:[t.type]})}delete t.type}const Eb="parser";function kb(t,e){const{filename:n,breakLineCode:o,needIndent:r}=e,i=e.location!==!1,s={filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:r,indentLevel:0};i&&t.loc&&(s.source=t.loc.source);const l=()=>s;function c(b,g){s.code+=b}function d(b,g=!0){const x=g?o:"";c(r?x+" ".repeat(b):x)}function u(b=!0){const g=++s.indentLevel;b&&d(g)}function f(b=!0){const g=--s.indentLevel;b&&d(g)}function p(){d(s.indentLevel)}return{context:l,push:c,indent:u,deindent:f,newline:p,helper:b=>`_${b}`,needIndent:()=>s.needIndent}}function wb(t,e){const{helper:n}=t;t.push(`${n("linked")}(`),Do(t,e.key),e.modifier?(t.push(", "),Do(t,e.modifier),t.push(", _type")):t.push(", undefined, _type"),t.push(")")}function Sb(t,e){const{helper:n,needIndent:o}=t;t.push(`${n("normalize")}([`),t.indent(o());const r=e.items.length;for(let i=0;i<r&&(Do(t,e.items[i]),i!==r-1);i++)t.push(", ");t.deindent(o()),t.push("])")}function Nb(t,e){const{helper:n,needIndent:o}=t;if(e.cases.length>1){t.push(`${n("plural")}([`),t.indent(o());const r=e.cases.length;for(let i=0;i<r&&(Do(t,e.cases[i]),i!==r-1);i++)t.push(", ");t.deindent(o()),t.push("])")}}function Cb(t,e){e.body?Do(t,e.body):t.push("null")}function Do(t,e){const{helper:n}=t;switch(e.type){case 0:Cb(t,e);break;case 1:Nb(t,e);break;case 2:Sb(t,e);break;case 6:wb(t,e);break;case 8:t.push(JSON.stringify(e.value),e);break;case 7:t.push(JSON.stringify(e.value),e);break;case 5:t.push(`${n("interpolate")}(${n("list")}(${e.index}))`,e);break;case 4:t.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(e.key)}))`,e);break;case 9:t.push(JSON.stringify(e.value),e);break;case 3:t.push(JSON.stringify(e.value),e);break;default:throw Io(Se.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:Eb,args:[e.type]})}}const vb=(t,e={})=>{const n=gd(e.mode)?e.mode:"normal",o=gd(e.filename)?e.filename:"message.intl";e.sourceMap;const r=e.breakLineCode!=null?e.breakLineCode:n==="arrow"?";":`
|
|
345
|
-
`,i=e.needIndent?e.needIndent:n!=="arrow",s=t.helpers||[],l=kb(t,{filename:o,breakLineCode:r,needIndent:i});l.push(n==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),l.indent(i),s.length>0&&(l.push(`const { ${bd(s.map(u=>`${u}: _${u}`),", ")} } = ctx`),l.newline()),l.push("return "),Do(l,t),l.deindent(i),l.push("}"),delete t.helpers;const{code:c,map:d}=l.context();return{ast:t,code:c,map:d?d.toJSON():void 0}};function Tb(t,e={}){const n=md({},e),o=!!n.jit,r=!!n.minify,i=n.optimize==null?!0:n.optimize,l=mb(n).parse(t);return o?(i&&yb(l),r&&Oo(l),{ast:l,code:""}):(bb(l,n),vb(l,n))}function zb(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(pr().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(pr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function jt(t){return Re(t)&&ya(t)===0&&(nn(t,"b")||nn(t,"body"))}const kd=["b","body"];function _b(t){return Hn(t,kd)}const wd=["c","cases"];function Ab(t){return Hn(t,wd,[])}const Sd=["s","static"];function Mb(t){return Hn(t,Sd)}const Nd=["i","items"];function Ib(t){return Hn(t,Nd,[])}const Cd=["t","type"];function ya(t){return Hn(t,Cd)}const vd=["v","value"];function Ei(t,e){const n=Hn(t,vd);if(n!=null)return n;throw hr(e)}const Td=["m","modifier"];function Ob(t){return Hn(t,Td)}const zd=["k","key"];function Db(t){const e=Hn(t,zd);if(e)return e;throw hr(6)}function Hn(t,e,n){for(let o=0;o<e.length;o++){const r=e[o];if(nn(t,r)&&t[r]!=null)return t[r]}return n}const _d=[...kd,...wd,...Sd,...Nd,...zd,...Td,...vd,...Cd];function hr(t){return new Error(`unhandled node type: ${t}`)}const Wn=[];Wn[0]={w:[0],i:[3,0],"[":[4],o:[7]},Wn[1]={w:[1],".":[2],"[":[4],o:[7]},Wn[2]={w:[2],i:[3,0],0:[3,0]},Wn[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},Wn[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},Wn[5]={"'":[4,0],o:8,l:[5,0]},Wn[6]={'"':[4,0],o:8,l:[6,0]};const Rb=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function Pb(t){return Rb.test(t)}function Lb(t){const e=t.charCodeAt(0),n=t.charCodeAt(t.length-1);return e===n&&(e===34||e===39)?t.slice(1,-1):t}function $b(t){if(t==null)return"o";switch(t.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return t;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function Vb(t){const e=t.trim();return t.charAt(0)==="0"&&isNaN(parseInt(t))?!1:Pb(e)?Lb(e):"*"+e}function Bb(t){const e=[];let n=-1,o=0,r=0,i,s,l,c,d,u,f;const p=[];p[0]=()=>{s===void 0?s=l:s+=l},p[1]=()=>{s!==void 0&&(e.push(s),s=void 0)},p[2]=()=>{p[0](),r++},p[3]=()=>{if(r>0)r--,o=4,p[0]();else{if(r=0,s===void 0||(s=Vb(s),s===!1))return!1;p[1]()}};function h(){const m=t[n+1];if(o===5&&m==="'"||o===6&&m==='"')return n++,l="\\"+m,p[0](),!0}for(;o!==null;)if(n++,i=t[n],!(i==="\\"&&h())){if(c=$b(i),f=Wn[o],d=f[c]||f.l||8,d===8||(o=d[0],d[1]!==void 0&&(u=p[d[1]],u&&(l=i,u()===!1))))return;if(o===7)return e}}const Ad=new Map;function Fb(t,e){return Re(t)?t[e]:null}function jb(t,e){if(!Re(t))return null;let n=Ad.get(e);if(n||(n=Bb(e),n&&Ad.set(e,n)),!n)return null;const o=n.length;let r=t,i=0;for(;i<o;){const s=n[i];if(_d.includes(s)&&jt(r))return null;const l=r[s];if(l===void 0||qe(r))return null;r=l,i++}return r}const Ub=t=>t,Hb=t=>"",Wb="text",Gb=t=>t.length===0?"":Kg(t),qb=qg;function Md(t,e){return t=Math.abs(t),e===2?t?t>1?1:0:1:t?Math.min(t,2):0}function Kb(t){const e=at(t.pluralIndex)?t.pluralIndex:-1;return t.named&&(at(t.named.count)||at(t.named.n))?at(t.named.count)?t.named.count:at(t.named.n)?t.named.n:e:e}function Jb(t,e){e.count||(e.count=t),e.n||(e.n=t)}function Xb(t={}){const e=t.locale,n=Kb(t),o=Re(t.pluralRules)&&he(e)&&qe(t.pluralRules[e])?t.pluralRules[e]:Md,r=Re(t.pluralRules)&&he(e)&&qe(t.pluralRules[e])?Md:void 0,i=x=>x[o(n,x.length,r)],s=t.list||[],l=x=>s[x],c=t.named||Be();at(t.pluralIndex)&&Jb(n,c);const d=x=>c[x];function u(x){const v=qe(t.messages)?t.messages(x):Re(t.messages)?t.messages[x]:!1;return v||(t.parent?t.parent.message(x):Hb)}const f=x=>t.modifiers?t.modifiers[x]:Ub,p=$e(t.processor)&&qe(t.processor.normalize)?t.processor.normalize:Gb,h=$e(t.processor)&&qe(t.processor.interpolate)?t.processor.interpolate:qb,m=$e(t.processor)&&he(t.processor.type)?t.processor.type:Wb,g={list:l,named:d,plural:i,linked:(x,...v)=>{const[w,T]=v;let M="text",A="";v.length===1?Re(w)?(A=w.modifier||A,M=w.type||M):he(w)&&(A=w||A):v.length===2&&(he(w)&&(A=w||A),he(T)&&(M=T||M));const y=u(x)(g),E=M==="vnode"&&tt(y)&&A?y[0]:y;return A?f(A)(E,M):E},message:u,type:m,interpolate:h,normalize:p,values:yt(Be(),s,c)};return g}let mr=null;function Yb(t){mr=t}function Qb(t,e,n){mr&&mr.emit("i18n:init",{timestamp:Date.now(),i18n:t,version:e,meta:n})}const Zb=ey("function:translate");function ey(t){return e=>mr&&mr.emit(t,e)}const Id=xi.__EXTEND_POINT__,po=mi(Id),Tt={NOT_FOUND_KEY:Id,FALLBACK_TO_TRANSLATE:po(),CANNOT_FORMAT_NUMBER:po(),FALLBACK_TO_NUMBER_FORMAT:po(),CANNOT_FORMAT_DATE:po(),FALLBACK_TO_DATE_FORMAT:po(),EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:po(),__EXTEND_POINT__:po()},ty={[Tt.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[Tt.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[Tt.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[Tt.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[Tt.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[Tt.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[Tt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]:"This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future."};function ho(t,...e){return ga(ty[t],...e)}const Od=Se.__EXTEND_POINT__,mo=mi(Od),lt={INVALID_ARGUMENT:Od,INVALID_DATE_ARGUMENT:mo(),INVALID_ISO_DATE_ARGUMENT:mo(),NOT_SUPPORT_NON_STRING_MESSAGE:mo(),NOT_SUPPORT_LOCALE_PROMISE_VALUE:mo(),NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:mo(),NOT_SUPPORT_LOCALE_TYPE:mo(),__EXTEND_POINT__:mo()};function pn(t){return Io(t,null,process.env.NODE_ENV!=="production"?{messages:ny}:void 0)}const ny={[lt.INVALID_ARGUMENT]:"Invalid arguments",[lt.INVALID_DATE_ARGUMENT]:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",[lt.INVALID_ISO_DATE_ARGUMENT]:"The argument provided is not a valid ISO date string",[lt.NOT_SUPPORT_NON_STRING_MESSAGE]:"Not support non-string message",[lt.NOT_SUPPORT_LOCALE_PROMISE_VALUE]:"cannot support promise value",[lt.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]:"cannot support async function",[lt.NOT_SUPPORT_LOCALE_TYPE]:"cannot support locale type"};function xa(t,e){return e.locale!=null?Dd(e.locale):Dd(t.locale)}let Ea;function Dd(t){if(he(t))return t;if(qe(t)){if(t.resolvedOnce&&Ea!=null)return Ea;if(t.constructor.name==="Function"){const e=t();if(Gg(e))throw pn(lt.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Ea=e}else throw pn(lt.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw pn(lt.NOT_SUPPORT_LOCALE_TYPE)}function oy(t,e,n){return[...new Set([n,...tt(e)?e:Re(e)?Object.keys(e):he(e)?[e]:[n]])]}function Rd(t,e,n){const o=he(n)?n:wi,r=t;r.__localeChainCache||(r.__localeChainCache=new Map);let i=r.__localeChainCache.get(o);if(!i){i=[];let s=[n];for(;tt(s);)s=Pd(i,s,e);const l=tt(e)||!$e(e)?e:e.default?e.default:null;s=he(l)?[l]:l,tt(s)&&Pd(i,s,!1),r.__localeChainCache.set(o,i)}return i}function Pd(t,e,n){let o=!0;for(let r=0;r<e.length&&Ke(o);r++){const i=e[r];he(i)&&(o=ry(t,e[r],n))}return o}function ry(t,e,n){let o;const r=e.split("-");do{const i=r.join("-");o=iy(t,i,n),r.splice(-1,1)}while(r.length&&o===!0);return o}function iy(t,e,n){let o=!1;if(!t.includes(e)&&(o=!0,e)){o=e[e.length-1]!=="!";const r=e.replace(/!/g,"");t.push(r),(tt(n)||$e(n))&&n[r]&&(o=n[r])}return o}const sy="9.14.5",ki=-1,wi="en-US",Si="",Ld=t=>`${t.charAt(0).toLocaleUpperCase()}${t.substr(1)}`;function ay(){return{upper:(t,e)=>e==="text"&&he(t)?t.toUpperCase():e==="vnode"&&Re(t)&&"__v_isVNode"in t?t.children.toUpperCase():t,lower:(t,e)=>e==="text"&&he(t)?t.toLowerCase():e==="vnode"&&Re(t)&&"__v_isVNode"in t?t.children.toLowerCase():t,capitalize:(t,e)=>e==="text"&&he(t)?Ld(t):e==="vnode"&&Re(t)&&"__v_isVNode"in t?Ld(t.children):t}}let $d;function Vd(t){$d=t}let Bd;function ly(t){Bd=t}let Fd;function cy(t){Fd=t}let jd=null;const dy=t=>{jd=t},uy=()=>jd;let Ud=null;const Hd=t=>{Ud=t},fy=()=>Ud;let Wd=0;function py(t={}){const e=qe(t.onWarn)?t.onWarn:un,n=he(t.version)?t.version:sy,o=he(t.locale)||qe(t.locale)?t.locale:wi,r=qe(o)?wi:o,i=tt(t.fallbackLocale)||$e(t.fallbackLocale)||he(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:r,s=$e(t.messages)?t.messages:ka(r),l=$e(t.datetimeFormats)?t.datetimeFormats:ka(r),c=$e(t.numberFormats)?t.numberFormats:ka(r),d=yt(Be(),t.modifiers,ay()),u=t.pluralRules||Be(),f=qe(t.missing)?t.missing:null,p=Ke(t.missingWarn)||pi(t.missingWarn)?t.missingWarn:!0,h=Ke(t.fallbackWarn)||pi(t.fallbackWarn)?t.fallbackWarn:!0,m=!!t.fallbackFormat,b=!!t.unresolving,g=qe(t.postTranslation)?t.postTranslation:null,x=$e(t.processor)?t.processor:null,v=Ke(t.warnHtmlMessage)?t.warnHtmlMessage:!0,w=!!t.escapeParameter,T=qe(t.messageCompiler)?t.messageCompiler:$d;process.env.NODE_ENV!=="production"&&qe(t.messageCompiler)&&sd(ho(Tt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));const M=qe(t.messageResolver)?t.messageResolver:Bd||Fb,A=qe(t.localeFallbacker)?t.localeFallbacker:Fd||oy,y=Re(t.fallbackContext)?t.fallbackContext:void 0,E=t,S=Re(E.__datetimeFormatters)?E.__datetimeFormatters:new Map,D=Re(E.__numberFormatters)?E.__numberFormatters:new Map,W=Re(E.__meta)?E.__meta:{};Wd++;const z={version:n,cid:Wd,locale:o,fallbackLocale:i,messages:s,modifiers:d,pluralRules:u,missing:f,missingWarn:p,fallbackWarn:h,fallbackFormat:m,unresolving:b,postTranslation:g,processor:x,warnHtmlMessage:v,escapeParameter:w,messageCompiler:T,messageResolver:M,localeFallbacker:A,fallbackContext:y,onWarn:e,__meta:W};return z.datetimeFormats=l,z.numberFormats=c,z.__datetimeFormatters=S,z.__numberFormatters=D,process.env.NODE_ENV!=="production"&&(z.__v_emitter=E.__v_emitter!=null?E.__v_emitter:void 0),process.env.NODE_ENV!=="production"&&Qb(z,n,W),z}const ka=t=>({[t]:Be()});function Ni(t,e){return t instanceof RegExp?t.test(e):t}function Gd(t,e){return t instanceof RegExp?t.test(e):t}function wa(t,e,n,o,r){const{missing:i,onWarn:s}=t;if(process.env.NODE_ENV!=="production"){const l=t.__v_emitter;l&&l.emit("missing",{locale:n,key:e,type:r,groupId:`${r}:${e}`})}if(i!==null){const l=i(t,n,e,r);return he(l)?l:e}else return process.env.NODE_ENV!=="production"&&Gd(o,e)&&s(ho(Tt.NOT_FOUND_KEY,{key:e,locale:n})),e}function gr(t,e,n){const o=t;o.__localeChainCache=new Map,t.localeFallbacker(t,n,e)}function qd(t,e){return t===e?!1:t.split("-")[0]===e.split("-")[0]}function hy(t,e){const n=e.indexOf(t);if(n===-1)return!1;for(let o=n+1;o<e.length;o++)if(qd(t,e[o]))return!0;return!1}function Sa(t){return n=>my(n,t)}function my(t,e){const n=_b(e);if(n==null)throw hr(0);if(ya(n)===1){const i=Ab(n);return t.plural(i.reduce((s,l)=>[...s,Kd(t,l)],[]))}else return Kd(t,n)}function Kd(t,e){const n=Mb(e);if(n!=null)return t.type==="text"?n:t.normalize([n]);{const o=Ib(e).reduce((r,i)=>[...r,Na(t,i)],[]);return t.normalize(o)}}function Na(t,e){const n=ya(e);switch(n){case 3:return Ei(e,n);case 9:return Ei(e,n);case 4:{const o=e;if(nn(o,"k")&&o.k)return t.interpolate(t.named(o.k));if(nn(o,"key")&&o.key)return t.interpolate(t.named(o.key));throw hr(n)}case 5:{const o=e;if(nn(o,"i")&&at(o.i))return t.interpolate(t.list(o.i));if(nn(o,"index")&&at(o.index))return t.interpolate(t.list(o.index));throw hr(n)}case 6:{const o=e,r=Ob(o),i=Db(o);return t.linked(Na(t,i),r?Na(t,r):void 0,t.type)}case 7:return Ei(e,n);case 8:return Ei(e,n);default:throw new Error(`unhandled node on format message part: ${n}`)}}const gy="Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.";function Jd(t,e){e&&rb(t)&&un(ga(gy,{source:t}))}const Xd=t=>t;let Ro=Be();function Yd(t){t.code===xi.USE_MODULO_SYNTAX&&un(`The use of named interpolation with modulo syntax is deprecated. It will be removed in v10.
|
|
346
|
-
reference: https://vue-i18n.intlify.dev/guide/essentials/syntax#rails-i18n-format
|
|
347
|
-
(message compiler warning message: ${t.message})`)}function Qd(t,e={}){let n=!1;const o=e.onError||nb;return e.onError=r=>{n=!0,o(r)},{...Tb(t,e),detectError:n}}const by=(t,e)=>{if(!he(t))throw pn(lt.NOT_SUPPORT_NON_STRING_MESSAGE);process.env.NODE_ENV!=="production"&&(e.onWarn=Yd);{const n=Ke(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&Jd(t,n);const r=(e.onCacheKey||Xd)(t),i=Ro[r];if(i)return i;const{code:s,detectError:l}=Qd(t,e),c=new Function(`return ${s}`)();return l?c:Ro[r]=c}};function yy(t,e){if(process.env.NODE_ENV!=="production"&&(e.onWarn=Yd),__INTLIFY_JIT_COMPILATION__&&!__INTLIFY_DROP_MESSAGE_COMPILER__&&he(t)){const n=Ke(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&Jd(t,n);const r=(e.onCacheKey||Xd)(t),i=Ro[r];if(i)return i;const{ast:s,detectError:l}=Qd(t,{...e,location:process.env.NODE_ENV!=="production",jit:!0}),c=Sa(s);return l?c:Ro[r]=c}else{if(process.env.NODE_ENV!=="production"&&!jt(t))return un(`the message that is resolve with key '${e.key}' is not supported for jit compilation`),(()=>t);const n=t.cacheKey;if(n){const o=Ro[n];return o||(Ro[n]=Sa(t))}else return Sa(t)}}const Zd=()=>"",Ut=t=>qe(t);function eu(t,...e){const{fallbackFormat:n,postTranslation:o,unresolving:r,messageCompiler:i,fallbackLocale:s,messages:l}=t,[c,d]=Ca(...e),u=Ke(d.missingWarn)?d.missingWarn:t.missingWarn,f=Ke(d.fallbackWarn)?d.fallbackWarn:t.fallbackWarn,p=Ke(d.escapeParameter)?d.escapeParameter:t.escapeParameter,h=!!d.resolvedMessage,m=he(d.default)||Ke(d.default)?Ke(d.default)?i?c:()=>c:d.default:n?i?c:()=>c:"",b=n||m!=="",g=xa(t,d);p&&xy(d);let[x,v,w]=h?[c,g,l[g]||Be()]:tu(t,c,g,s,f,u),T=x,M=c;if(!h&&!(he(T)||jt(T)||Ut(T))&&b&&(T=m,M=T),!h&&(!(he(T)||jt(T)||Ut(T))||!he(v)))return r?ki:c;if(process.env.NODE_ENV!=="production"&&he(T)&&t.messageCompiler==null)return un(`The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return '${c}'.`),c;let A=!1;const y=()=>{A=!0},E=Ut(T)?T:nu(t,c,v,T,M,y);if(A)return T;const S=Sy(t,v,w,d),D=Xb(S),W=Ey(t,E,D);let z=o?o(W,c):W;if(p&&he(z)&&(z=Hg(z)),process.env.NODE_ENV!=="production"){const P={timestamp:Date.now(),key:he(c)?c:Ut(T)?T.key:"",locale:v||(Ut(T)?T.locale:""),format:he(T)?T:Ut(T)?T.source:"",message:z};P.meta=yt({},t.__meta,uy()||{}),Zb(P)}return z}function xy(t){tt(t.list)?t.list=t.list.map(e=>he(e)?ld(e):e):Re(t.named)&&Object.keys(t.named).forEach(e=>{he(t.named[e])&&(t.named[e]=ld(t.named[e]))})}function tu(t,e,n,o,r,i){const{messages:s,onWarn:l,messageResolver:c,localeFallbacker:d}=t,u=d(t,o,n);let f=Be(),p,h=null,m=n,b=null;const g="translate";for(let x=0;x<u.length;x++){if(p=b=u[x],process.env.NODE_ENV!=="production"&&n!==p&&!qd(n,p)&&Ni(r,e)&&l(ho(Tt.FALLBACK_TO_TRANSLATE,{key:e,target:p})),process.env.NODE_ENV!=="production"&&n!==p){const M=t.__v_emitter;M&&M.emit("fallback",{type:g,key:e,from:m,to:b,groupId:`${g}:${e}`})}f=s[p]||Be();let v=null,w,T;if(process.env.NODE_ENV!=="production"&&wn&&(v=window.performance.now(),w="intlify-message-resolve-start",T="intlify-message-resolve-end",$t&&$t(w)),(h=c(f,e))===null&&(h=f[e]),process.env.NODE_ENV!=="production"&&wn){const M=window.performance.now(),A=t.__v_emitter;A&&v&&h&&A.emit("message-resolve",{type:"message-resolve",key:e,message:h,time:M-v,groupId:`${g}:${e}`}),w&&T&&$t&&fo&&($t(T),fo("intlify message resolve",w,T))}if(he(h)||jt(h)||Ut(h))break;if(!hy(p,u)){const M=wa(t,e,p,i,g);M!==e&&(h=M)}m=b}return[h,p,f]}function nu(t,e,n,o,r,i){const{messageCompiler:s,warnHtmlMessage:l}=t;if(Ut(o)){const p=o;return p.locale=p.locale||n,p.key=p.key||e,p}if(s==null){const p=(()=>o);return p.locale=n,p.key=e,p}let c=null,d,u;process.env.NODE_ENV!=="production"&&wn&&(c=window.performance.now(),d="intlify-message-compilation-start",u="intlify-message-compilation-end",$t&&$t(d));const f=s(o,ky(t,n,r,o,l,i));if(process.env.NODE_ENV!=="production"&&wn){const p=window.performance.now(),h=t.__v_emitter;h&&c&&h.emit("message-compilation",{type:"message-compilation",message:o,time:p-c,groupId:`translate:${e}`}),d&&u&&$t&&fo&&($t(u),fo("intlify message compilation",d,u))}return f.locale=n,f.key=e,f.source=o,f}function Ey(t,e,n){let o=null,r,i;process.env.NODE_ENV!=="production"&&wn&&(o=window.performance.now(),r="intlify-message-evaluation-start",i="intlify-message-evaluation-end",$t&&$t(r));const s=e(n);if(process.env.NODE_ENV!=="production"&&wn){const l=window.performance.now(),c=t.__v_emitter;c&&o&&c.emit("message-evaluation",{type:"message-evaluation",value:s,time:l-o,groupId:`translate:${e.key}`}),r&&i&&$t&&fo&&($t(i),fo("intlify message evaluation",r,i))}return s}function Ca(...t){const[e,n,o]=t,r=Be();if(!he(e)&&!at(e)&&!Ut(e)&&!jt(e))throw pn(lt.INVALID_ARGUMENT);const i=at(e)?String(e):(Ut(e),e);return at(n)?r.plural=n:he(n)?r.default=n:$e(n)&&!hi(n)?r.named=n:tt(n)&&(r.list=n),at(o)?r.plural=o:he(o)?r.default=o:$e(o)&&yt(r,o),[i,r]}function ky(t,e,n,o,r,i){return{locale:e,key:n,warnHtmlMessage:r,onError:s=>{if(i&&i(s),process.env.NODE_ENV!=="production"){const l=wy(o),c=`Message compilation error: ${s.message}`,d=s.location&&l&&Jg(l,s.location.start.offset,s.location.end.offset),u=t.__v_emitter;u&&l&&u.emit("compile-error",{message:l,error:s.message,start:s.location&&s.location.start.offset,end:s.location&&s.location.end.offset,groupId:`translate:${n}`}),console.error(d?`${c}
|
|
348
|
-
${d}`:c)}else throw s},onCacheKey:s=>Bg(e,n,s)}}function wy(t){if(he(t))return t;if(t.loc&&t.loc.source)return t.loc.source}function Sy(t,e,n,o){const{modifiers:r,pluralRules:i,messageResolver:s,fallbackLocale:l,fallbackWarn:c,missingWarn:d,fallbackContext:u}=t,p={locale:e,modifiers:r,pluralRules:i,messages:h=>{let m=s(n,h);if(m==null&&u){const[,,b]=tu(u,h,e,l,c,d);m=s(b,h)}if(he(m)||jt(m)){let b=!1;const x=nu(t,h,e,m,h,()=>{b=!0});return b?Zd:x}else return Ut(m)?m:Zd}};return t.processor&&(p.processor=t.processor),o.list&&(p.list=o.list),o.named&&(p.named=o.named),at(o.plural)&&(p.pluralIndex=o.plural),p}const ou=typeof Intl<"u",ru={dateTimeFormat:ou&&typeof Intl.DateTimeFormat<"u",numberFormat:ou&&typeof Intl.NumberFormat<"u"};function iu(t,...e){const{datetimeFormats:n,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:s}=t,{__datetimeFormatters:l}=t;if(process.env.NODE_ENV!=="production"&&!ru.dateTimeFormat)return i(ho(Tt.CANNOT_FORMAT_DATE)),Si;const[c,d,u,f]=va(...e),p=Ke(u.missingWarn)?u.missingWarn:t.missingWarn,h=Ke(u.fallbackWarn)?u.fallbackWarn:t.fallbackWarn,m=!!u.part,b=xa(t,u),g=s(t,r,b);if(!he(c)||c==="")return new Intl.DateTimeFormat(b,f).format(d);let x={},v,w=null,T=b,M=null;const A="datetime format";for(let S=0;S<g.length;S++){if(v=M=g[S],process.env.NODE_ENV!=="production"&&b!==v&&Ni(h,c)&&i(ho(Tt.FALLBACK_TO_DATE_FORMAT,{key:c,target:v})),process.env.NODE_ENV!=="production"&&b!==v){const D=t.__v_emitter;D&&D.emit("fallback",{type:A,key:c,from:T,to:M,groupId:`${A}:${c}`})}if(x=n[v]||{},w=x[c],$e(w))break;wa(t,c,v,p,A),T=M}if(!$e(w)||!he(v))return o?ki:c;let y=`${v}__${c}`;hi(f)||(y=`${y}__${JSON.stringify(f)}`);let E=l.get(y);return E||(E=new Intl.DateTimeFormat(v,yt({},w,f)),l.set(y,E)),m?E.formatToParts(d):E.format(d)}const su=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function va(...t){const[e,n,o,r]=t,i=Be();let s=Be(),l;if(he(e)){const c=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!c)throw pn(lt.INVALID_ISO_DATE_ARGUMENT);const d=c[3]?c[3].trim().startsWith("T")?`${c[1].trim()}${c[3].trim()}`:`${c[1].trim()}T${c[3].trim()}`:c[1].trim();l=new Date(d);try{l.toISOString()}catch{throw pn(lt.INVALID_ISO_DATE_ARGUMENT)}}else if(jg(e)){if(isNaN(e.getTime()))throw pn(lt.INVALID_DATE_ARGUMENT);l=e}else if(at(e))l=e;else throw pn(lt.INVALID_ARGUMENT);return he(n)?i.key=n:$e(n)&&Object.keys(n).forEach(c=>{su.includes(c)?s[c]=n[c]:i[c]=n[c]}),he(o)?i.locale=o:$e(o)&&(s=o),$e(r)&&(s=r),[i.key||"",l,i,s]}function au(t,e,n){const o=t;for(const r in n){const i=`${e}__${r}`;o.__datetimeFormatters.has(i)&&o.__datetimeFormatters.delete(i)}}function lu(t,...e){const{numberFormats:n,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:s}=t,{__numberFormatters:l}=t;if(process.env.NODE_ENV!=="production"&&!ru.numberFormat)return i(ho(Tt.CANNOT_FORMAT_NUMBER)),Si;const[c,d,u,f]=Ta(...e),p=Ke(u.missingWarn)?u.missingWarn:t.missingWarn,h=Ke(u.fallbackWarn)?u.fallbackWarn:t.fallbackWarn,m=!!u.part,b=xa(t,u),g=s(t,r,b);if(!he(c)||c==="")return new Intl.NumberFormat(b,f).format(d);let x={},v,w=null,T=b,M=null;const A="number format";for(let S=0;S<g.length;S++){if(v=M=g[S],process.env.NODE_ENV!=="production"&&b!==v&&Ni(h,c)&&i(ho(Tt.FALLBACK_TO_NUMBER_FORMAT,{key:c,target:v})),process.env.NODE_ENV!=="production"&&b!==v){const D=t.__v_emitter;D&&D.emit("fallback",{type:A,key:c,from:T,to:M,groupId:`${A}:${c}`})}if(x=n[v]||{},w=x[c],$e(w))break;wa(t,c,v,p,A),T=M}if(!$e(w)||!he(v))return o?ki:c;let y=`${v}__${c}`;hi(f)||(y=`${y}__${JSON.stringify(f)}`);let E=l.get(y);return E||(E=new Intl.NumberFormat(v,yt({},w,f)),l.set(y,E)),m?E.formatToParts(d):E.format(d)}const cu=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function Ta(...t){const[e,n,o,r]=t,i=Be();let s=Be();if(!at(e))throw pn(lt.INVALID_ARGUMENT);const l=e;return he(n)?i.key=n:$e(n)&&Object.keys(n).forEach(c=>{cu.includes(c)?s[c]=n[c]:i[c]=n[c]}),he(o)?i.locale=o:$e(o)&&(s=o),$e(r)&&(s=r),[i.key||"",l,i,s]}function du(t,e,n){const o=t;for(const r in n){const i=`${e}__${r}`;o.__numberFormatters.has(i)&&o.__numberFormatters.delete(i)}}zb();function Ny(){return uu().__VUE_DEVTOOLS_GLOBAL_HOOK__}function uu(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const Cy=typeof Proxy=="function",vy="devtools-plugin:setup",Ty="plugin:settings:set";let Po,za;function zy(){var t;return Po!==void 0||(typeof window<"u"&&window.performance?(Po=!0,za=window.performance):typeof globalThis<"u"&&(!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance)?(Po=!0,za=globalThis.perf_hooks.performance):Po=!1),Po}function _y(){return zy()?za.now():Date.now()}class Ay{constructor(e,n){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=n;const o={};if(e.settings)for(const s in e.settings){const l=e.settings[s];o[s]=l.defaultValue}const r=`__vue-devtools-plugin-settings__${e.id}`;let i=Object.assign({},o);try{const s=localStorage.getItem(r),l=JSON.parse(s);Object.assign(i,l)}catch{}this.fallbacks={getSettings(){return i},setSettings(s){try{localStorage.setItem(r,JSON.stringify(s))}catch{}i=s},now(){return _y()}},n&&n.on(Ty,(s,l)=>{s===this.plugin.id&&this.fallbacks.setSettings(l)}),this.proxiedOn=new Proxy({},{get:(s,l)=>this.target?this.target.on[l]:(...c)=>{this.onQueue.push({method:l,args:c})}}),this.proxiedTarget=new Proxy({},{get:(s,l)=>this.target?this.target[l]:l==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(l)?(...c)=>(this.targetQueue.push({method:l,args:c,resolve:()=>{}}),this.fallbacks[l](...c)):(...c)=>new Promise(d=>{this.targetQueue.push({method:l,args:c,resolve:d})})})}async setRealTarget(e){this.target=e;for(const n of this.onQueue)this.target.on[n.method](...n.args);for(const n of this.targetQueue)n.resolve(await this.target[n.method](...n.args))}}function My(t,e){const n=t,o=uu(),r=Ny(),i=Cy&&n.enableEarlyProxy;if(r&&(o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!i))r.emit(vy,t,e);else{const s=i?new Ay(n,r):null;(o.__VUE_DEVTOOLS_PLUGINS__=o.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:e,proxy:s}),s&&e(s.proxiedTarget)}}const Iy="9.14.5";function Oy(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(pr().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(pr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}const fu=Tt.__EXTEND_POINT__,Nn=mi(fu),Mt={FALLBACK_TO_ROOT:fu,NOT_SUPPORTED_PRESERVE:Nn(),NOT_SUPPORTED_FORMATTER:Nn(),NOT_SUPPORTED_PRESERVE_DIRECTIVE:Nn(),NOT_SUPPORTED_GET_CHOICE_INDEX:Nn(),COMPONENT_NAME_LEGACY_COMPATIBLE:Nn(),NOT_FOUND_PARENT_SCOPE:Nn(),IGNORE_OBJ_FLATTEN:Nn(),NOTICE_DROP_ALLOW_COMPOSITION:Nn(),NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG:Nn()},Dy={[Mt.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[Mt.NOT_SUPPORTED_PRESERVE]:"Not supported 'preserve'.",[Mt.NOT_SUPPORTED_FORMATTER]:"Not supported 'formatter'.",[Mt.NOT_SUPPORTED_PRESERVE_DIRECTIVE]:"Not supported 'preserveDirectiveContent'.",[Mt.NOT_SUPPORTED_GET_CHOICE_INDEX]:"Not supported 'getChoiceIndex'.",[Mt.COMPONENT_NAME_LEGACY_COMPATIBLE]:"Component name legacy compatible: '{name}' -> 'i18n'",[Mt.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[Mt.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[Mt.NOTICE_DROP_ALLOW_COMPOSITION]:"'allowComposition' option will be dropped in the next major version. For more information, please see 👉 https://tinyurl.com/2p97mcze",[Mt.NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG]:"'translateExistCompatible' option will be dropped in the next major version."};function Ci(t,...e){return ga(Dy[t],...e)}const pu=lt.__EXTEND_POINT__,It=mi(pu),Je={UNEXPECTED_RETURN_TYPE:pu,INVALID_ARGUMENT:It(),MUST_BE_CALL_SETUP_TOP:It(),NOT_INSTALLED:It(),NOT_AVAILABLE_IN_LEGACY_MODE:It(),REQUIRED_VALUE:It(),INVALID_VALUE:It(),CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:It(),NOT_INSTALLED_WITH_PROVIDE:It(),UNEXPECTED_ERROR:It(),NOT_COMPATIBLE_LEGACY_VUE_I18N:It(),BRIDGE_SUPPORT_VUE_2_ONLY:It(),MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION:It(),NOT_AVAILABLE_COMPOSITION_IN_LEGACY:It(),__EXTEND_POINT__:It()};function Cn(t,...e){return Io(t,null,process.env.NODE_ENV!=="production"?{messages:Ry,args:e}:void 0)}const Ry={[Je.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[Je.INVALID_ARGUMENT]:"Invalid argument",[Je.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[Je.NOT_INSTALLED]:"Need to install with `app.use` function",[Je.UNEXPECTED_ERROR]:"Unexpected error",[Je.NOT_AVAILABLE_IN_LEGACY_MODE]:"Not available in legacy mode",[Je.REQUIRED_VALUE]:"Required in value: {0}",[Je.INVALID_VALUE]:"Invalid value",[Je.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[Je.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[Je.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[Je.BRIDGE_SUPPORT_VUE_2_ONLY]:"vue-i18n-bridge support Vue 2.x only",[Je.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION]:"Must define ‘i18n’ option or custom block in Composition API with using local scope in Legacy API mode",[Je.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly"},_a=fn("__translateVNode"),Aa=fn("__datetimeParts"),Ma=fn("__numberParts"),br=fn("__enableEmitter"),Ia=fn("__disableEmitter"),Py=fn("__setPluralRules"),Ly=fn("__injectWithOption"),Oa=fn("__dispose");function yr(t){if(!Re(t)||jt(t))return t;for(const e in t)if(nn(t,e))if(!e.includes("."))Re(t[e])&&yr(t[e]);else{const n=e.split("."),o=n.length-1;let r=t,i=!1;for(let s=0;s<o;s++){if(n[s]==="__proto__")throw new Error(`unsafe key: ${n[s]}`);if(n[s]in r||(r[n[s]]=Be()),!Re(r[n[s]])){process.env.NODE_ENV!=="production"&&un(Ci(Mt.IGNORE_OBJ_FLATTEN,{key:n[s]})),i=!0;break}r=r[n[s]]}if(i||(jt(r)?_d.includes(n[o])||delete t[e]:(r[n[o]]=t[e],delete t[e])),!jt(r)){const s=r[n[o]];Re(s)&&yr(s)}}return t}function hu(t,e){const{messages:n,__i18n:o,messageResolver:r,flatJson:i}=e,s=$e(n)?n:tt(o)?Be():{[t]:Be()};if(tt(o)&&o.forEach(l=>{if("locale"in l&&"resource"in l){const{locale:c,resource:d}=l;c?(s[c]=s[c]||Be(),bi(d,s[c])):bi(d,s)}else he(l)&&bi(JSON.parse(l),s)}),r==null&&i)for(const l in s)nn(s,l)&&yr(s[l]);return s}function mu(t){return t.type}function $y(t,e,n){let o=Re(e.messages)?e.messages:Be();"__i18nGlobal"in n&&(o=hu(t.locale.value,{messages:o,__i18n:n.__i18nGlobal}));const r=Object.keys(o);r.length&&r.forEach(i=>{t.mergeLocaleMessage(i,o[i])});{if(Re(e.datetimeFormats)){const i=Object.keys(e.datetimeFormats);i.length&&i.forEach(s=>{t.mergeDateTimeFormat(s,e.datetimeFormats[s])})}if(Re(e.numberFormats)){const i=Object.keys(e.numberFormats);i.length&&i.forEach(s=>{t.mergeNumberFormat(s,e.numberFormats[s])})}}}function gu(t){return a.createVNode(a.Text,null,t,0)}const bu="__INTLIFY_META__",yu=()=>[],Vy=()=>!1;let xu=0;function Eu(t){return((e,n,o,r)=>t(n,o,a.getCurrentInstance()||void 0,r))}const By=()=>{const t=a.getCurrentInstance();let e=null;return t&&(e=mu(t)[bu])?{[bu]:e}:null};function ku(t={},e){const{__root:n,__injectWithOption:o}=t,r=n===void 0,i=t.flatJson,s=wn?a.ref:a.shallowRef,l=!!t.translateExistCompatible;process.env.NODE_ENV!=="production"&&l&&sd(Ci(Mt.NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG));let c=Ke(t.inheritLocale)?t.inheritLocale:!0;const d=s(n&&c?n.locale.value:he(t.locale)?t.locale:wi),u=s(n&&c?n.fallbackLocale.value:he(t.fallbackLocale)||tt(t.fallbackLocale)||$e(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:d.value),f=s(hu(d.value,t)),p=s($e(t.datetimeFormats)?t.datetimeFormats:{[d.value]:{}}),h=s($e(t.numberFormats)?t.numberFormats:{[d.value]:{}});let m=n?n.missingWarn:Ke(t.missingWarn)||pi(t.missingWarn)?t.missingWarn:!0,b=n?n.fallbackWarn:Ke(t.fallbackWarn)||pi(t.fallbackWarn)?t.fallbackWarn:!0,g=n?n.fallbackRoot:Ke(t.fallbackRoot)?t.fallbackRoot:!0,x=!!t.fallbackFormat,v=qe(t.missing)?t.missing:null,w=qe(t.missing)?Eu(t.missing):null,T=qe(t.postTranslation)?t.postTranslation:null,M=n?n.warnHtmlMessage:Ke(t.warnHtmlMessage)?t.warnHtmlMessage:!0,A=!!t.escapeParameter;const y=n?n.modifiers:$e(t.modifiers)?t.modifiers:{};let E=t.pluralRules||n&&n.pluralRules,S;S=(()=>{r&&Hd(null);const B={version:Iy,locale:d.value,fallbackLocale:u.value,messages:f.value,modifiers:y,pluralRules:E,missing:w===null?void 0:w,missingWarn:m,fallbackWarn:b,fallbackFormat:x,unresolving:!0,postTranslation:T===null?void 0:T,warnHtmlMessage:M,escapeParameter:A,messageResolver:t.messageResolver,messageCompiler:t.messageCompiler,__meta:{framework:"vue"}};B.datetimeFormats=p.value,B.numberFormats=h.value,B.__datetimeFormatters=$e(S)?S.__datetimeFormatters:void 0,B.__numberFormatters=$e(S)?S.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(B.__v_emitter=$e(S)?S.__v_emitter:void 0);const ee=py(B);return r&&Hd(ee),ee})(),gr(S,d.value,u.value);function W(){return[d.value,u.value,f.value,p.value,h.value]}const z=a.computed({get:()=>d.value,set:B=>{d.value=B,S.locale=d.value}}),P=a.computed({get:()=>u.value,set:B=>{u.value=B,S.fallbackLocale=u.value,gr(S,d.value,B)}}),V=a.computed(()=>f.value),j=a.computed(()=>p.value),L=a.computed(()=>h.value);function H(){return qe(T)?T:null}function Q(B){T=B,S.postTranslation=B}function G(){return v}function se(B){B!==null&&(w=Eu(B)),v=B,S.missing=w}function Z(B,ee){return B!=="translate"||!ee.resolvedMessage}const X=(B,ee,Me,$,F,re)=>{W();let ae;try{process.env.NODE_ENV,r||(S.fallbackContext=n?fy():void 0),ae=B(S)}finally{process.env.NODE_ENV,r||(S.fallbackContext=void 0)}if(Me!=="translate exists"&&at(ae)&&ae===ki||Me==="translate exists"&&!ae){const[ke,Fe]=ee();if(process.env.NODE_ENV!=="production"&&n&&he(ke)&&Z(Me,Fe)&&(g&&(Ni(b,ke)||Gd(m,ke))&&un(Ci(Mt.FALLBACK_TO_ROOT,{key:ke,type:Me})),process.env.NODE_ENV!=="production")){const{__v_emitter:st}=S;st&&g&&st.emit("fallback",{type:Me,key:ke,to:"global",groupId:`${Me}:${ke}`})}return n&&g?$(n):F(ke)}else{if(re(ae))return ae;throw Cn(Je.UNEXPECTED_RETURN_TYPE)}};function J(...B){return X(ee=>Reflect.apply(eu,null,[ee,...B]),()=>Ca(...B),"translate",ee=>Reflect.apply(ee.t,ee,[...B]),ee=>ee,ee=>he(ee))}function K(...B){const[ee,Me,$]=B;if($&&!Re($))throw Cn(Je.INVALID_ARGUMENT);return J(ee,Me,yt({resolvedMessage:!0},$||{}))}function Y(...B){return X(ee=>Reflect.apply(iu,null,[ee,...B]),()=>va(...B),"datetime format",ee=>Reflect.apply(ee.d,ee,[...B]),()=>Si,ee=>he(ee))}function ce(...B){return X(ee=>Reflect.apply(lu,null,[ee,...B]),()=>Ta(...B),"number format",ee=>Reflect.apply(ee.n,ee,[...B]),()=>Si,ee=>he(ee))}function Ee(B){return B.map(ee=>he(ee)||at(ee)||Ke(ee)?gu(String(ee)):ee)}const Le={normalize:Ee,interpolate:B=>B,type:"vnode"};function C(...B){return X(ee=>{let Me;const $=ee;try{$.processor=Le,Me=Reflect.apply(eu,null,[$,...B])}finally{$.processor=null}return Me},()=>Ca(...B),"translate",ee=>ee[_a](...B),ee=>[gu(ee)],ee=>tt(ee))}function N(...B){return X(ee=>Reflect.apply(lu,null,[ee,...B]),()=>Ta(...B),"number format",ee=>ee[Ma](...B),yu,ee=>he(ee)||tt(ee))}function O(...B){return X(ee=>Reflect.apply(iu,null,[ee,...B]),()=>va(...B),"datetime format",ee=>ee[Aa](...B),yu,ee=>he(ee)||tt(ee))}function k(B){E=B,S.pluralRules=E}function U(B,ee){return X(()=>{if(!B)return!1;const Me=he(ee)?ee:d.value,$=ve(Me),F=S.messageResolver($,B);return l?F!=null:jt(F)||Ut(F)||he(F)},()=>[B],"translate exists",Me=>Reflect.apply(Me.te,Me,[B,ee]),Vy,Me=>Ke(Me))}function te(B){let ee=null;const Me=Rd(S,u.value,d.value);for(let $=0;$<Me.length;$++){const F=f.value[Me[$]]||{},re=S.messageResolver(F,B);if(re!=null){ee=re;break}}return ee}function me(B){const ee=te(B);return ee??(n?n.tm(B)||{}:{})}function ve(B){return f.value[B]||{}}function Ve(B,ee){if(i){const Me={[B]:ee};for(const $ in Me)nn(Me,$)&&yr(Me[$]);ee=Me[B]}f.value[B]=ee,S.messages=f.value}function Ce(B,ee){f.value[B]=f.value[B]||{};const Me={[B]:ee};if(i)for(const $ in Me)nn(Me,$)&&yr(Me[$]);ee=Me[B],bi(ee,f.value[B]),S.messages=f.value}function _(B){return p.value[B]||{}}function I(B,ee){p.value[B]=ee,S.datetimeFormats=p.value,au(S,B,ee)}function q(B,ee){p.value[B]=yt(p.value[B]||{},ee),S.datetimeFormats=p.value,au(S,B,ee)}function fe(B){return h.value[B]||{}}function Ae(B,ee){h.value[B]=ee,S.numberFormats=h.value,du(S,B,ee)}function Te(B,ee){h.value[B]=yt(h.value[B]||{},ee),S.numberFormats=h.value,du(S,B,ee)}xu++,n&&wn&&(a.watch(n.locale,B=>{c&&(d.value=B,S.locale=B,gr(S,d.value,u.value))}),a.watch(n.fallbackLocale,B=>{c&&(u.value=B,S.fallbackLocale=B,gr(S,d.value,u.value))}));const we={id:xu,locale:z,fallbackLocale:P,get inheritLocale(){return c},set inheritLocale(B){c=B,B&&n&&(d.value=n.locale.value,u.value=n.fallbackLocale.value,gr(S,d.value,u.value))},get availableLocales(){return Object.keys(f.value).sort()},messages:V,get modifiers(){return y},get pluralRules(){return E||{}},get isGlobal(){return r},get missingWarn(){return m},set missingWarn(B){m=B,S.missingWarn=m},get fallbackWarn(){return b},set fallbackWarn(B){b=B,S.fallbackWarn=b},get fallbackRoot(){return g},set fallbackRoot(B){g=B},get fallbackFormat(){return x},set fallbackFormat(B){x=B,S.fallbackFormat=x},get warnHtmlMessage(){return M},set warnHtmlMessage(B){M=B,S.warnHtmlMessage=B},get escapeParameter(){return A},set escapeParameter(B){A=B,S.escapeParameter=B},t:J,getLocaleMessage:ve,setLocaleMessage:Ve,mergeLocaleMessage:Ce,getPostTranslationHandler:H,setPostTranslationHandler:Q,getMissingHandler:G,setMissingHandler:se,[Py]:k};return we.datetimeFormats=j,we.numberFormats=L,we.rt=K,we.te=U,we.tm=me,we.d=Y,we.n=ce,we.getDateTimeFormat=_,we.setDateTimeFormat=I,we.mergeDateTimeFormat=q,we.getNumberFormat=fe,we.setNumberFormat=Ae,we.mergeNumberFormat=Te,we[Ly]=o,we[_a]=C,we[Aa]=O,we[Ma]=N,process.env.NODE_ENV!=="production"&&(we[br]=B=>{S.__v_emitter=B},we[Ia]=()=>{S.__v_emitter=void 0}),we}const Da={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:t=>t==="parent"||t==="global",default:"parent"},i18n:{type:Object}};function Fy({slots:t},e){return e.length===1&&e[0]==="default"?(t.default?t.default():[]).reduce((o,r)=>[...o,...r.type===a.Fragment?r.children:[r]],[]):e.reduce((n,o)=>{const r=t[o];return r&&(n[o]=r()),n},Be())}function wu(t){return a.Fragment}yt({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:t=>at(t)||!isNaN(t)}},Da);function jy(t){return tt(t)&&!he(t[0])}function Su(t,e,n,o){const{slots:r,attrs:i}=e;return()=>{const s={part:!0};let l=Be();t.locale&&(s.locale=t.locale),he(t.format)?s.key=t.format:Re(t.format)&&(he(t.format.key)&&(s.key=t.format.key),l=Object.keys(t.format).reduce((p,h)=>n.includes(h)?yt(Be(),p,{[h]:t.format[h]}):p,Be()));const c=o(t.value,s,l);let d=[s.key];tt(c)?d=c.map((p,h)=>{const m=r[p.type],b=m?m({[p.type]:p.value,index:h,parts:c}):[p.value];return jy(b)&&(b[0].key=`${p.type}-${h}`),b}):he(c)&&(d=[c]);const u=yt(Be(),i),f=he(t.tag)||Re(t.tag)?t.tag:wu();return a.h(f,u,d)}}yt({value:{type:Number,required:!0},format:{type:[String,Object]}},Da),yt({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},Da);const Ra={"vue-devtools-plugin-vue-i18n":"Vue I18n devtools","vue-i18n-resource-inspector":"I18n Resources","vue-i18n-timeline":"Vue I18n"},Uy={"vue-i18n-resource-inspector":"Search for scopes ..."},Hy={"vue-i18n-timeline":16764185},Nu="vue-i18n: composer properties";let Pa;async function Wy(t,e){return new Promise((n,o)=>{try{My({id:"vue-devtools-plugin-vue-i18n",label:Ra["vue-devtools-plugin-vue-i18n"],packageName:"vue-i18n",homepage:"https://vue-i18n.intlify.dev",logo:"https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png",componentStateTypes:[Nu],app:t},r=>{Pa=r,r.on.visitComponentTree(({componentInstance:s,treeNode:l})=>{Gy(s,l,e)}),r.on.inspectComponent(({componentInstance:s,instanceData:l})=>{s.vnode.el&&s.vnode.el.__VUE_I18N__&&l&&(e.mode==="legacy"?s.vnode.el.__VUE_I18N__!==e.global.__composer&&vu(l,s.vnode.el.__VUE_I18N__):vu(l,s.vnode.el.__VUE_I18N__))}),r.addInspector({id:"vue-i18n-resource-inspector",label:Ra["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:Uy["vue-i18n-resource-inspector"]}),r.on.getInspectorTree(s=>{s.app===t&&s.inspectorId==="vue-i18n-resource-inspector"&&Yy(s,e)});const i=new Map;r.on.getInspectorState(async s=>{if(s.app===t&&s.inspectorId==="vue-i18n-resource-inspector")if(r.unhighlightElement(),Zy(s,e),s.nodeId==="global"){if(!i.has(s.app)){const[l]=await r.getComponentInstances(s.app);i.set(s.app,l)}r.highlightElement(i.get(s.app))}else{const l=Qy(s.nodeId,e);l&&r.highlightElement(l)}}),r.on.editInspectorState(s=>{s.app===t&&s.inspectorId==="vue-i18n-resource-inspector"&&t1(s,e)}),r.addTimelineLayer({id:"vue-i18n-timeline",label:Ra["vue-i18n-timeline"],color:Hy["vue-i18n-timeline"]}),n(!0)})}catch(r){console.error(r),o(!1)}})}function Cu(t){return t.type.name||t.type.displayName||t.type.__file||"Anonymous"}function Gy(t,e,n){const o=n.mode==="composition"?n.global:n.global.__composer;if(t&&t.vnode.el&&t.vnode.el.__VUE_I18N__&&t.vnode.el.__VUE_I18N__!==o){const r={label:`i18n (${Cu(t)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(r)}}function vu(t,e){const n=Nu;t.state.push({type:n,key:"locale",editable:!0,value:e.locale.value}),t.state.push({type:n,key:"availableLocales",editable:!1,value:e.availableLocales}),t.state.push({type:n,key:"fallbackLocale",editable:!0,value:e.fallbackLocale.value}),t.state.push({type:n,key:"inheritLocale",editable:!0,value:e.inheritLocale}),t.state.push({type:n,key:"messages",editable:!1,value:La(e.messages.value)}),t.state.push({type:n,key:"datetimeFormats",editable:!1,value:e.datetimeFormats.value}),t.state.push({type:n,key:"numberFormats",editable:!1,value:e.numberFormats.value})}function La(t){const e={};return Object.keys(t).forEach(n=>{const o=t[n];qe(o)&&"source"in o?e[n]=Xy(o):jt(o)&&o.loc&&o.loc.source?e[n]=o.loc.source:Re(o)?e[n]=La(o):e[n]=o}),e}const qy={"<":"<",">":">",'"':""","&":"&"};function Ky(t){return t.replace(/[<>"&]/g,Jy)}function Jy(t){return qy[t]||t}function Xy(t){return{_custom:{type:"function",display:`<span>ƒ</span> ${t.source?`("${Ky(t.source)}")`:"(?)"}`}}}function Yy(t,e){t.rootNodes.push({id:"global",label:"Global Scope"});const n=e.mode==="composition"?e.global:e.global.__composer;for(const[o,r]of e.__instances){const i=e.mode==="composition"?r:r.__composer;n!==i&&t.rootNodes.push({id:i.id.toString(),label:`${Cu(o)} Scope`})}}function Qy(t,e){let n=null;if(t!=="global"){for(const[o,r]of e.__instances.entries())if(r.id.toString()===t){n=o;break}}return n}function Tu(t,e){if(t==="global")return e.mode==="composition"?e.global:e.global.__composer;{const n=Array.from(e.__instances.values()).find(o=>o.id.toString()===t);return n?e.mode==="composition"?n:n.__composer:null}}function Zy(t,e){const n=Tu(t.nodeId,e);return n&&(t.state=e1(n)),null}function e1(t){const e={},n="Locale related info",o=[{type:n,key:"locale",editable:!0,value:t.locale.value},{type:n,key:"fallbackLocale",editable:!0,value:t.fallbackLocale.value},{type:n,key:"availableLocales",editable:!1,value:t.availableLocales},{type:n,key:"inheritLocale",editable:!0,value:t.inheritLocale}];e[n]=o;const r="Locale messages info",i=[{type:r,key:"messages",editable:!1,value:La(t.messages.value)}];e[r]=i;{const s="Datetime formats info",l=[{type:s,key:"datetimeFormats",editable:!1,value:t.datetimeFormats.value}];e[s]=l;const c="Datetime formats info",d=[{type:c,key:"numberFormats",editable:!1,value:t.numberFormats.value}];e[c]=d}return e}function $a(t,e){if(Pa){let n;e&&"groupId"in e&&(n=e.groupId,delete e.groupId),Pa.addTimelineEvent({layerId:"vue-i18n-timeline",event:{title:t,groupId:n,time:Date.now(),meta:{},data:e||{},logType:t==="compile-error"?"error":t==="fallback"||t==="missing"?"warning":"default"}})}}function t1(t,e){const n=Tu(t.nodeId,e);if(n){const[o]=t.path;o==="locale"&&he(t.state.value)?n.locale.value=t.state.value:o==="fallbackLocale"&&(he(t.state.value)||tt(t.state.value)||Re(t.state.value))?n.fallbackLocale.value=t.state.value:o==="inheritLocale"&&Ke(t.state.value)&&(n.inheritLocale=t.state.value)}}const n1=fn("global-vue-i18n");function o1(t={},e){const n=Ke(t.globalInjection)?t.globalInjection:!0,o=!0,r=new Map,[i,s]=r1(t),l=fn(process.env.NODE_ENV!=="production"?"vue-i18n":"");process.env.NODE_ENV;function c(f){return r.get(f)||null}function d(f,p){r.set(f,p)}function u(f){r.delete(f)}{const f={get mode(){return"composition"},get allowComposition(){return o},async install(p,...h){if(process.env.NODE_ENV!=="production"&&(p.__VUE_I18N__=f),p.__VUE_I18N_SYMBOL__=l,p.provide(p.__VUE_I18N_SYMBOL__,f),$e(h[0])){const g=h[0];f.__composerExtend=g.__composerExtend,f.__vueI18nExtend=g.__vueI18nExtend}let m=null;n&&(m=f1(p,f.global));const b=p.unmount;if(p.unmount=()=>{m&&m(),f.dispose(),b()},process.env.NODE_ENV!=="production"){if(!await Wy(p,f))throw Cn(Je.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const x=pd();{const v=s;v[br]&&v[br](x)}x.on("*",$a)}},get global(){return s},dispose(){i.stop()},__instances:r,__getInstance:c,__setInstance:d,__deleteInstance:u};return f}}function rn(t={}){const e=a.getCurrentInstance();if(e==null)throw Cn(Je.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw Cn(Je.NOT_INSTALLED);const n=i1(e),o=a1(n),r=mu(e),i=s1(t,r);if(i==="global")return $y(o,t,r),o;if(i==="parent"){let c=l1(n,e,t.__useComponent);return c==null&&(process.env.NODE_ENV!=="production"&&un(Ci(Mt.NOT_FOUND_PARENT_SCOPE)),c=o),c}const s=n;let l=s.__getInstance(e);if(l==null){const c=yt({},t);"__i18n"in r&&(c.__i18n=r.__i18n),o&&(c.__root=o),l=ku(c),s.__composerExtend&&(l[Oa]=s.__composerExtend(l)),d1(s,e,l),s.__setInstance(e,l)}return l}function r1(t,e,n){const o=a.effectScope();{const r=o.run(()=>ku(t));if(r==null)throw Cn(Je.UNEXPECTED_ERROR);return[o,r]}}function i1(t){{const e=a.inject(t.isCE?n1:t.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw Cn(t.isCE?Je.NOT_INSTALLED_WITH_PROVIDE:Je.UNEXPECTED_ERROR);return e}}function s1(t,e){return hi(t)?"__i18n"in e?"local":"global":t.useScope?t.useScope:"local"}function a1(t){return t.mode==="composition"?t.global:t.global.__composer}function l1(t,e,n=!1){let o=null;const r=e.root;let i=c1(e,n);for(;i!=null;){const s=t;if(t.mode==="composition"&&(o=s.__getInstance(i)),o!=null||r===i)break;i=i.parent}return o}function c1(t,e=!1){return t==null?null:e&&t.vnode.ctx||t.parent}function d1(t,e,n){let o=null;a.onMounted(()=>{if(process.env.NODE_ENV!=="production"&&e.vnode.el){e.vnode.el.__VUE_I18N__=n,o=pd();const r=n;r[br]&&r[br](o),o.on("*",$a)}},e),a.onUnmounted(()=>{const r=n;process.env.NODE_ENV!=="production"&&e.vnode.el&&e.vnode.el.__VUE_I18N__&&(o&&o.off("*",$a),r[Ia]&&r[Ia](),delete e.vnode.el.__VUE_I18N__),t.__deleteInstance(e);const i=r[Oa];i&&(i(),delete r[Oa])},e)}const u1=["locale","fallbackLocale","availableLocales"],zu=["t","rt","d","n","tm","te"];function f1(t,e){const n=Object.create(null);return u1.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i)throw Cn(Je.UNEXPECTED_ERROR);const s=a.isRef(i.value)?{get(){return i.value.value},set(l){i.value.value=l}}:{get(){return i.get&&i.get()}};Object.defineProperty(n,r,s)}),t.config.globalProperties.$i18n=n,zu.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i||!i.value)throw Cn(Je.UNEXPECTED_ERROR);Object.defineProperty(t.config.globalProperties,`$${r}`,i)}),()=>{delete t.config.globalProperties.$i18n,zu.forEach(r=>{delete t.config.globalProperties[`$${r}`]})}}if(Oy(),__INTLIFY_JIT_COMPILATION__?Vd(yy):Vd(by),ly(jb),cy(Rd),process.env.NODE_ENV!=="production"){const t=pr();t.__INTLIFY__=!0,Yb(t.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const _u="zcode-user-settings";function Lo(){try{const t=localStorage.getItem(_u);return t?JSON.parse(t):{}}catch(t){return console.warn("[ZeroCode] Failed to load user settings:",t),{}}}function Va(t){try{const e=Lo(),n={locale:t.locale??e.locale,cms:t.cms?{...e.cms||{},...t.cms}:e.cms,dev:t.dev?{...e.dev||{},...t.dev}:e.dev};localStorage.setItem(_u,JSON.stringify(n))}catch(e){console.warn("[ZeroCode] Failed to save user settings:",e)}}function p1(t=null){const e=Lo();return e.locale!==void 0?e.locale:t}function Au(){return Lo().cms||{}}function vi(t){const e=Lo();Va({cms:{...e.cms,...t}})}function h1(t,e){return Au()[t]??e}function Mu(){return Lo().dev||{}}function Ba(t){const e=Lo();Va({dev:{...e.dev,...t}})}function m1(t,e){return Mu()[t]??e}const Iu="zcode-dont-show-css-warning-parts";function g1(){try{return sessionStorage.getItem(Iu)==="true"}catch{return!1}}function b1(t){try{sessionStorage.setItem(Iu,String(t))}catch(e){console.warn("[ZeroCode] Failed to save CSS warning setting:",e)}}const y1={class:"zcode-settings-panel-header"},x1={class:"zcode-settings-panel-header-title",role:"heading","aria-level":"3"},E1={class:"zcode-settings-panel-header-actions"},k1=["value","aria-label"],w1={value:"ja"},S1={value:"en"},N1={class:"zcode-settings-panel-content"},C1={key:0},v1={key:0,class:"zcode-setting-item"},T1={class:"zcode-setting-label"},z1=["checked"],_1=["title"],A1={key:0,class:"zcode-setting-description"},M1={key:1,class:"zcode-setting-item"},I1={class:"zcode-setting-label"},O1=["checked"],D1=["title"],R1={key:0,class:"zcode-setting-description"},P1={key:2,class:"zcode-setting-item"},L1={class:"zcode-setting-label"},$1=["checked"],V1=["title"],B1={key:0,class:"zcode-setting-description"},F1={key:3,class:"zcode-setting-item"},j1={class:"zcode-setting-label"},U1=["checked"],H1=["title"],W1={key:0,class:"zcode-setting-description"},G1={key:1,class:"zcode-setting-item"},q1={class:"zcode-setting-info"},Ou=a.defineComponent({__name:"SettingsPanel",props:{isOpen:{type:Boolean},viewMode:{type:String},mode:{type:String},allowDynamicContentInteraction:{type:Boolean},devRightPadding:{type:Boolean},enableContextMenu:{type:Boolean},showSaveConfirm:{type:Boolean}},emits:["close","toggle-dynamic-content","toggle-dev-padding","toggle-context-menu","toggle-save-confirm"],setup(t){const e=t,{locale:n}=rn(),o=a.computed(()=>n.value||"ja");function r(u){const p=u.target.value;n.value=p,Va({locale:p})}const i=a.ref(!1),s=a.ref(!1),l=a.ref(!1),c=a.ref(!1),d=a.computed(()=>e.devRightPadding!==void 0?e.devRightPadding:!1);return(u,f)=>t.isOpen?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-settings-panel-overlay",onClick:f[10]||(f[10]=a.withModifiers(p=>u.$emit("close"),["self"]))},[a.createElementVNode("div",{class:"zcode-settings-panel",onClick:f[9]||(f[9]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",y1,[a.createElementVNode("div",x1,a.toDisplayString(u.$t("settings.title")),1),a.createElementVNode("div",E1,[a.createElementVNode("select",{value:o.value,class:"zcode-language-select","aria-label":u.$t("settings.language.label"),onChange:r},[a.createElementVNode("option",w1,a.toDisplayString(u.$t("settings.language.ja")),1),a.createElementVNode("option",S1,a.toDisplayString(u.$t("settings.language.en")),1)],40,k1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":"$t('common.close')",onClick:f[0]||(f[0]=p=>u.$emit("close"))},[a.createVNode(a.unref(Qe),{size:18})])])]),a.createElementVNode("div",N1,[t.viewMode==="manage"?(a.openBlock(),a.createElementBlock("div",C1,[e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",v1,[a.createElementVNode("label",T1,[a.createElementVNode("input",{type:"checkbox",checked:e.allowDynamicContentInteraction??!1,class:"zcode-setting-checkbox",onChange:f[1]||(f[1]=p=>u.$emit("toggle-dynamic-content",p.target.checked))},null,40,z1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.enableDynamicContent")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[2]||(f[2]=a.withModifiers(p=>i.value=!i.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,_1)]),i.value?(a.openBlock(),a.createElementBlock("div",A1,a.toDisplayString(u.$t("settings.enableDynamicContentDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",M1,[a.createElementVNode("label",I1,[a.createElementVNode("input",{type:"checkbox",checked:d.value,class:"zcode-setting-checkbox",onChange:f[3]||(f[3]=p=>u.$emit("toggle-dev-padding",p.target.checked))},null,40,O1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.devRightPadding")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[4]||(f[4]=a.withModifiers(p=>s.value=!s.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,D1)]),s.value?(a.openBlock(),a.createElementBlock("div",R1,a.toDisplayString(u.$t("settings.devRightPaddingDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",P1,[a.createElementVNode("label",L1,[a.createElementVNode("input",{type:"checkbox",checked:e.enableContextMenu??!1,class:"zcode-setting-checkbox",onChange:f[5]||(f[5]=p=>u.$emit("toggle-context-menu",p.target.checked))},null,40,$1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.enableContextMenu")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[6]||(f[6]=a.withModifiers(p=>l.value=!l.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,V1)]),l.value?(a.openBlock(),a.createElementBlock("div",B1,a.toDisplayString(u.$t("settings.enableContextMenuDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="dev-tabs"?(a.openBlock(),a.createElementBlock("div",F1,[a.createElementVNode("label",j1,[a.createElementVNode("input",{type:"checkbox",checked:e.showSaveConfirm??!0,class:"zcode-setting-checkbox",onChange:f[7]||(f[7]=p=>u.$emit("toggle-save-confirm",p.target.checked))},null,40,U1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.showSaveConfirm")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[8]||(f[8]=a.withModifiers(p=>c.value=!c.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,H1)]),c.value?(a.openBlock(),a.createElementBlock("div",W1,a.toDisplayString(u.$t("settings.showSaveConfirmDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)])):(a.openBlock(),a.createElementBlock("div",G1,[a.createElementVNode("div",q1,a.toDisplayString(u.$t("settings.previewModeInfo")),1)]))])])])):a.createCommentVNode("",!0)}});function pt(t){this.content=t}pt.prototype={constructor:pt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var o=n&&n!=t?this.remove(n):this,r=o.find(t),i=o.content.slice();return r==-1?i.push(n||t,e):(i[r+1]=e,n&&(i[r]=n)),new pt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new pt(n)},addToStart:function(t,e){return new pt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new pt(n)},addBefore:function(t,e,n){var o=this.remove(e),r=o.content.slice(),i=o.find(t);return r.splice(i==-1?r.length:i,0,e,n),new pt(r)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=pt.from(t),t.size?new pt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=pt.from(t),t.size?new pt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=pt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},pt.from=function(t){if(t instanceof pt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new pt(e)};function Du(t,e,n){for(let o=0;;o++){if(o==t.childCount||o==e.childCount)return t.childCount==e.childCount?null:n;let r=t.child(o),i=e.child(o);if(r==i){n+=r.nodeSize;continue}if(!r.sameMarkup(i))return n;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)n++;return n}if(r.content.size||i.content.size){let s=Du(r.content,i.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function Ru(t,e,n,o){for(let r=t.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:n,b:o};let s=t.child(--r),l=e.child(--i),c=s.nodeSize;if(s==l){n-=c,o-=c;continue}if(!s.sameMarkup(l))return{a:n,b:o};if(s.isText&&s.text!=l.text){let d=0,u=Math.min(s.text.length,l.text.length);for(;d<u&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,n--,o--;return{a:n,b:o}}if(s.content.size||l.content.size){let d=Ru(s.content,l.content,n-1,o-1);if(d)return d}n-=c,o-=c}}class ne{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,n,o,r=0,i){for(let s=0,l=0;l<n;s++){let c=this.content[s],d=l+c.nodeSize;if(d>e&&o(c,r+l,i||null,s)!==!1&&c.content.size){let u=l+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,n-u),o,r+u)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,o,r){let i="",s=!0;return this.nodesBetween(e,n,(l,c)=>{let d=l.isText?l.text.slice(Math.max(e,c)-c,n-c):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=d},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(o)&&(r[r.length-1]=n.withText(n.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new ne(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let o=[],r=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],c=s+l.nodeSize;c>e&&((s<e||c>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),o.push(l),r+=l.nodeSize),s=c}return new ne(o,r)}cutByIndex(e,n){return e==n?ne.empty:e==0&&n==this.content.length?this:new ne(this.content.slice(e,n))}replaceChild(e,n){let o=this.content[e];if(o==n)return this;let r=this.content.slice(),i=this.size+n.nodeSize-o.nodeSize;return r[e]=n,new ne(r,i)}addToStart(e){return new ne([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ne(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,o=0;n<this.content.length;n++){let r=this.content[n];e(r,o,n),o+=r.nodeSize}}findDiffStart(e,n=0){return Du(this,e,n)}findDiffEnd(e,n=this.size,o=e.size){return Ru(this,e,n,o)}findIndex(e){if(e==0)return Ti(0,e);if(e==this.size)return Ti(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,o=0;;n++){let r=this.child(n),i=o+r.nodeSize;if(i>=e)return i==e?Ti(n+1,i):Ti(n,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return ne.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ne(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ne.empty;let n,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(n||(n=e.slice(0,r)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new ne(n||e,o)}static from(e){if(!e)return ne.empty;if(e instanceof ne)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ne([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ne.empty=new ne([],0);const Fa={index:0,offset:0};function Ti(t,e){return Fa.index=t,Fa.offset=e,Fa}function zi(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let o=0;o<t.length;o++)if(!zi(t[o],e[o]))return!1}else{for(let o in t)if(!(o in e)||!zi(t[o],e[o]))return!1;for(let o in e)if(!(o in t))return!1}return!0}let je=class Ac{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,r)),n.push(this),o=!0),n&&n.push(i)}}return n||(n=e.slice()),o||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&zi(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[n.type];if(!o)throw new RangeError(`There is no mark type ${n.type} in this schema`);let r=o.create(n.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(n[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ac.none;if(e instanceof Ac)return[e];let n=e.slice();return n.sort((o,r)=>o.type.rank-r.type.rank),n}};je.none=[];class _i extends Error{}class ue{constructor(e,n,o){this.content=e,this.openStart=n,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let o=Lu(this.content,e+this.openStart,n);return o&&new ue(o,this.openStart,this.openEnd)}removeBetween(e,n){return new ue(Pu(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return ue.empty;let o=n.openStart||0,r=n.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ue(ne.fromJSON(e,n.content),o,r)}static maxOpen(e,n=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)r++;return new ue(e,o,r)}}ue.empty=new ue(ne.empty,0,0);function Pu(t,e,n){let{index:o,offset:r}=t.findIndex(e),i=t.maybeChild(o),{index:s,offset:l}=t.findIndex(n);if(r==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(o!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(o,i.copy(Pu(i.content,e-r-1,n-r-1)))}function Lu(t,e,n,o){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r);if(i==e||s.isText)return o&&!o.canReplace(r,r,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=Lu(s.content,e-i-1,n,s);return l&&t.replaceChild(r,s.copy(l))}function K1(t,e,n){if(n.openStart>t.depth)throw new _i("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new _i("Inconsistent open depths");return $u(t,e,n,0)}function $u(t,e,n,o){let r=t.index(o),i=t.node(o);if(r==e.index(o)&&o<t.depth-n.openStart){let s=$u(t,e,n,o+1);return i.copy(i.content.replaceChild(r,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==o&&e.depth==o){let s=t.parent,l=s.content;return bo(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=J1(n,t);return bo(i,Bu(t,s,l,e,o))}else return bo(i,Ai(t,e,o))}function Vu(t,e){if(!e.type.compatibleContent(t.type))throw new _i("Cannot join "+e.type.name+" onto "+t.type.name)}function ja(t,e,n){let o=t.node(n);return Vu(o,e.node(n)),o}function go(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function xr(t,e,n,o){let r=(e||t).node(n),i=0,s=e?e.index(n):r.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(go(t.nodeAfter,o),i++));for(let l=i;l<s;l++)go(r.child(l),o);e&&e.depth==n&&e.textOffset&&go(e.nodeBefore,o)}function bo(t,e){return t.type.checkContent(e),t.copy(e)}function Bu(t,e,n,o,r){let i=t.depth>r&&ja(t,e,r+1),s=o.depth>r&&ja(n,o,r+1),l=[];return xr(null,t,r,l),i&&s&&e.index(r)==n.index(r)?(Vu(i,s),go(bo(i,Bu(t,e,n,o,r+1)),l)):(i&&go(bo(i,Ai(t,e,r+1)),l),xr(e,n,r,l),s&&go(bo(s,Ai(n,o,r+1)),l)),xr(o,null,r,l),new ne(l)}function Ai(t,e,n){let o=[];if(xr(null,t,n,o),t.depth>n){let r=ja(t,e,n+1);go(bo(r,Ai(t,e,n+1)),o)}return xr(e,null,n,o),new ne(o)}function J1(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)r=e.node(i).copy(ne.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class Er{constructor(e,n,o){this.pos=e,this.path=n,this.parentOffset=o,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],r=e.child(n);return o?e.child(n).cut(o):r}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let o=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)r+=o.child(i).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return je.none;if(this.textOffset)return e.child(n).marks;let o=e.maybeChild(n-1),r=e.maybeChild(n);if(!o){let l=o;o=r,r=l}let i=o.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let o=n.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!n||n(this.node(o))))return new Mi(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let o=[],r=0,i=n;for(let s=e;;){let{index:l,offset:c}=s.content.findIndex(i),d=i-c;if(o.push(s,l,r+c),!d||(s=s.child(l),s.isText))break;i=d-1,r+=c+1}return new Er(n,o,i)}static resolveCached(e,n){let o=Fu.get(e);if(o)for(let i=0;i<o.elts.length;i++){let s=o.elts[i];if(s.pos==n)return s}else Fu.set(e,o=new X1);let r=o.elts[o.i]=Er.resolve(e,n);return o.i=(o.i+1)%Y1,r}}class X1{constructor(){this.elts=[],this.i=0}}const Y1=12,Fu=new WeakMap;class Mi{constructor(e,n,o){this.$from=e,this.$to=n,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Q1=Object.create(null);let Gn=class Mc{constructor(e,n,o,r=je.none){this.type=e,this.attrs=n,this.marks=r,this.content=o||ne.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,o,r=0){this.content.nodesBetween(e,n,o,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,o,r){return this.content.textBetween(e,n,o,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,o){return this.type==e&&zi(this.attrs,n||e.defaultAttrs||Q1)&&je.sameSet(this.marks,o||je.none)}copy(e=null){return e==this.content?this:new Mc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Mc(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,o=!1){if(e==n)return ue.empty;let r=this.resolve(e),i=this.resolve(n),s=o?0:r.sharedDepth(n),l=r.start(s),d=r.node(s).content.cut(r.pos-l,i.pos-l);return new ue(d,r.depth-s,i.depth-s)}replace(e,n,o){return K1(this.resolve(e),this.resolve(n),o)}nodeAt(e){for(let n=this;;){let{index:o,offset:r}=n.content.findIndex(e);if(n=n.maybeChild(o),!n)return null;if(r==e||n.isText)return n;e-=r+1}}childAfter(e){let{index:n,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(n),index:n,offset:o};let r=this.content.child(n-1);return{node:r,index:n-1,offset:o-r.nodeSize}}resolve(e){return Er.resolveCached(this,e)}resolveNoCache(e){return Er.resolve(this,e)}rangeHasMark(e,n,o){let r=!1;return n>e&&this.nodesBetween(e,n,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),ju(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,o=ne.empty,r=0,i=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,r,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let c=r;c<i;c++)if(!this.type.allowsMarks(o.child(c).marks))return!1;return!0}canReplaceWith(e,n,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(o),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=je.none;for(let n=0;n<this.marks.length;n++){let o=this.marks[n];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!je.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let o;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,o)}let r=ne.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};Gn.prototype.text=void 0;class Ii extends Gn{constructor(e,n,o,r){if(super(e,n,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ju(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ii(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ii(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function ju(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class yo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let o=new Z1(e,n);if(o.next==null)return yo.empty;let r=Uu(o);o.next&&o.err("Unexpected trailing text");let i=s0(i0(r));return a0(i,o),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,o=e.childCount){let r=this;for(let i=n;r&&i<o;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let o=0;o<e.next.length;o++)if(this.next[n].type==e.next[o].type)return!0;return!1}fillBefore(e,n=!1,o=0){let r=[this];function i(s,l){let c=s.matchFragment(e,o);if(c&&(!n||c.validEnd))return ne.from(l.map(d=>d.createAndFill()));for(let d=0;d<s.next.length;d++){let{type:u,next:f}=s.next[d];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(f)==-1){r.push(f);let p=i(f,l.concat(u));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(e)){let s=[];for(let l=r;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:c}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!r.type||c.validEnd)&&(o.push({match:l.contentMatch,type:l,via:r}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&n(o.next[r].next)}return n(this),e.map((o,r)=>{let i=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)i+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return i}).join(`
|
|
349
|
-
`)}}yo.empty=new yo(!0);class Z1{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Uu(t){let e=[];do e.push(e0(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function e0(t){let e=[];do e.push(t0(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function t0(t){let e=r0(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=n0(t,e);else break;return e}function Hu(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function n0(t,e){let n=Hu(t),o=n;return t.eat(",")&&(t.next!="}"?o=Hu(t):o=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:e}}function o0(t,e){let n=t.nodeTypes,o=n[e];if(o)return[o];let r=[];for(let i in n){let s=n[i];s.isInGroup(e)&&r.push(s)}return r.length==0&&t.err("No node type or group '"+e+"' found"),r}function r0(t){if(t.eat("(")){let e=Uu(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=o0(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function i0(t){let e=[[]];return r(i(t,0),n()),e;function n(){return e.push([])-1}function o(s,l,c){let d={term:c,to:l};return e[s].push(d),d}function r(s,l){s.forEach(c=>c.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((c,d)=>c.concat(i(d,l)),[]);if(s.type=="seq")for(let c=0;;c++){let d=i(s.exprs[c],l);if(c==s.exprs.length-1)return d;r(d,l=n())}else if(s.type=="star"){let c=n();return o(l,c),r(i(s.expr,c),c),[o(c)]}else if(s.type=="plus"){let c=n();return r(i(s.expr,l),c),r(i(s.expr,c),c),[o(c)]}else{if(s.type=="opt")return[o(l)].concat(i(s.expr,l));if(s.type=="range"){let c=l;for(let d=0;d<s.min;d++){let u=n();r(i(s.expr,c),u),c=u}if(s.max==-1)r(i(s.expr,c),c);else for(let d=s.min;d<s.max;d++){let u=n();o(c,u),r(i(s.expr,c),u),c=u}return[o(c)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Wu(t,e){return e-t}function Gu(t,e){let n=[];return o(e),n.sort(Wu);function o(r){let i=t[r];if(i.length==1&&!i[0].term)return o(i[0].to);n.push(r);for(let s=0;s<i.length;s++){let{term:l,to:c}=i[s];!l&&n.indexOf(c)==-1&&o(c)}}}function s0(t){let e=Object.create(null);return n(Gu(t,0));function n(o){let r=[];o.forEach(s=>{t[s].forEach(({term:l,to:c})=>{if(!l)return;let d;for(let u=0;u<r.length;u++)r[u][0]==l&&(d=r[u][1]);Gu(t,c).forEach(u=>{d||r.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let i=e[o.join(",")]=new yo(o.indexOf(t.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(Wu);i.next.push({type:r[s][0],next:e[l.join(",")]||n(l)})}return i}}function a0(t,e){for(let n=0,o=[t];n<o.length;n++){let r=o[n],i=!r.validEnd,s=[];for(let l=0;l<r.next.length;l++){let{type:c,next:d}=r.next[l];s.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),o.indexOf(d)==-1&&o.push(d)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function qu(t){let e=Object.create(null);for(let n in t){let o=t[n];if(!o.hasDefault)return null;e[n]=o.default}return e}function Ku(t,e){let n=Object.create(null);for(let o in t){let r=e&&e[o];if(r===void 0){let i=t[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}n[o]=r}return n}function Ju(t,e,n,o){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let r in t){let i=t[r];i.validate&&i.validate(e[r])}}function Xu(t,e){let n=Object.create(null);if(e)for(let o in e)n[o]=new c0(t,o,e[o]);return n}let Yu=class Bm{constructor(e,n,o){this.name=e,this.schema=n,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=Xu(e,o.attrs),this.defaultAttrs=qu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==yo.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Ku(this.attrs,e)}create(e=null,n,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Gn(this,this.computeAttrs(e),ne.from(n),je.setFrom(o))}createChecked(e=null,n,o){return n=ne.from(n),this.checkContent(n),new Gn(this,this.computeAttrs(e),n,je.setFrom(o))}createAndFill(e=null,n,o){if(e=this.computeAttrs(e),n=ne.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let r=this.contentMatch.matchFragment(n),i=r&&r.fillBefore(ne.empty,!0);return i?new Gn(this,e,n.append(i),je.setFrom(o)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ju(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?n&&n.push(e[o]):n||(n=e.slice(0,o));return n?n.length?n:je.none:e}static compile(e,n){let o=Object.create(null);e.forEach((i,s)=>o[i]=new Bm(i,n,s));let r=n.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function l0(t,e,n){let o=n.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${t}, got ${i}`)}}class c0{constructor(e,n,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?l0(e,n,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class Oi{constructor(e,n,o,r){this.name=e,this.rank=n,this.schema=o,this.spec=r,this.attrs=Xu(e,r.attrs),this.excluded=null;let i=qu(this.attrs);this.instance=i?new je(this,i):null}create(e=null){return!e&&this.instance?this.instance:new je(this,Ku(this.attrs,e))}static compile(e,n){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new Oi(i,r++,n,s)),o}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Ju(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Qu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let r in e)n[r]=e[r];n.nodes=pt.from(e.nodes),n.marks=pt.from(e.marks||{}),this.nodes=Yu.compile(this.spec.nodes,this),this.marks=Oi.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=o[s]||(o[s]=yo.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?Zu(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Zu(this,s.split(" "))}this.nodeFromJSON=r=>Gn.fromJSON(this,r),this.markFromJSON=r=>je.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Yu){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,o,r)}text(e,n){let o=this.nodes.text;return new Ii(o,o.defaultAttrs,e,je.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Zu(t,e){let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=t.marks[r],s=i;if(i)n.push(i);else for(let l in t.marks){let c=t.marks[l];(r=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(r)>-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return n}function d0(t){return t.tag!=null}function u0(t){return t.style!=null}let kr=class Ic{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let o=this.matchedStyles=[];n.forEach(r=>{if(d0(r))this.tags.push(r);else if(u0(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let o=new of(this,n,!1);return o.addAll(e,je.none,n.from,n.to),o.finish()}parseSlice(e,n={}){let o=new of(this,n,!0);return o.addAll(e,je.none,n.from,n.to),ue.maxOpen(o.finish())}matchTag(e,n,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(h0(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let c=s.getAttrs(n);if(c===!1)continue;s.attrs=c||void 0}return s}}}static schemaRules(e){let n=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=rf(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=rf(s)),s.node||s.ignore||s.mark||(s.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ic(e,Ic.schemaRules(e)))}};const ef={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},f0={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},tf={ol:!0,ul:!0},wr=1,Ua=2,Sr=4;function nf(t,e,n){return e!=null?(e?wr:0)|(e==="full"?Ua:0):t&&t.whitespace=="pre"?wr|Ua:n&~Sr}class Di{constructor(e,n,o,r,i,s){this.type=e,this.attrs=n,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=je.none,this.match=i||(s&Sr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ne.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&wr)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let n=ne.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ne.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ef.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class of{constructor(e,n,o){this.parser=e,this.options=n,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=n.topNode,i,s=nf(null,n.preserveWhitespace,0)|(o?Sr:0);r?i=new Di(r.type,r.attrs,je.none,!0,n.topMatch||r.type.contentMatch,s):o?i=new Di(null,null,je.none,!0,null,s):i=new Di(e.schema.topNodeType,null,je.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let o=e.nodeValue,r=this.top,i=r.options&Ua?"full":this.localPreserveWS||(r.options&wr)>0,{schema:s}=this.parser;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)if(i==="full")o=o.replace(/\r\n?/g,`
|
|
350
|
-
|
|
351
|
-
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.getPropertyValue(i);if(s)for(let l=void 0;;){let c=this.parser.matchStyle(i,s,this,l);if(!c)break;if(c.ignore)return null;if(c.clearMark?n=n.filter(d=>!c.clearMark(d)):n=n.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)l=c;else break}}return n}addElementByRule(e,n,o,r){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let c=this.enter(s,n.attrs||null,o,n.preserveWhitespace);c&&(i=!0,o=c)}else{let c=this.parser.schema.marks[n.mark];o=o.concat(c.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,o,!1));else{let c=e;typeof n.contentElement=="string"?c=e.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(e):n.contentElement&&(c=n.contentElement),this.findAround(e,c,!0),this.addAll(c,o),this.findAround(e,c,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,o){let r,i;for(let s=this.open,l=0;s>=0;s--){let c=this.nodes[s],d=c.findWrapping(e);if(d&&(!r||r.length>d.length+l)&&(r=d,i=c,!d.length))break;if(c.solid){if(o)break;l+=2}}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)n=this.enterInner(r[s],null,n,!1);return n}insertNode(e,n,o){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let r=this.findPlace(e,n,o);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=je.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):sf(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,o,r){let i=this.findPlace(e.create(n),o,!1);return i&&(i=this.enterInner(e,n,o,!0,r)),i}enterInner(e,n,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=nf(e,i,s.options);s.options&Sr&&s.content.length==0&&(l|=Sr);let c=je.none;return o=o.filter(d=>(s.type?s.type.allowsMarkType(d.type):sf(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new Di(e,n,c,r,null,l)),this.open++,o}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=wr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let o=this.nodes[n].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==n&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,o){if(e!=n&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&n.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,c)=>{for(;l>=0;l--){let d=n[l];if(d==""){if(l==n.length-1||l==0)continue;for(;c>=i;c--)if(s(l-1,c))return!0;return!1}else{let u=c>0||c==0&&r?this.nodes[c].type:o&&c>=i?o.node(c-i).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;c--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let n in this.parser.schema.nodes){let o=this.parser.schema.nodes[n];if(o.isTextblock&&o.defaultAttrs)return o}}}function p0(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&tf.hasOwnProperty(o)&&n?(n.appendChild(e),e=n):o=="li"?n=e:o&&(n=null)}}function h0(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function rf(t){let e={};for(let n in t)e[n]=t[n];return e}function sf(t,e){let n=e.schema.nodes;for(let o in n){let r=n[o];if(!r.allowsMarkType(t))continue;let i=[],s=l=>{i.push(l);for(let c=0;c<l.edgeCount;c++){let{type:d,next:u}=l.edge(c);if(d==e||i.indexOf(u)<0&&s(u))return!0}};if(s(r.contentMatch))return!0}}class xo{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},o){o||(o=Ha(n).createDocumentFragment());let r=o,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,c=0;for(;l<i.length&&c<s.marks.length;){let d=s.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(i[l][0])||d.type.spec.spanning===!1)break;l++,c++}for(;l<i.length;)r=i.pop()[1];for(;c<s.marks.length;){let d=s.marks[c++],u=this.serializeMark(d,s.isInline,n);u&&(i.push([d,r]),r.appendChild(u.dom),r=u.contentDOM||u.dom)}}r.appendChild(this.serializeNodeInner(s,n))}),o}serializeNodeInner(e,n){let{dom:o,contentDOM:r}=Ri(Ha(n),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,r)}return o}serializeNode(e,n={}){let o=this.serializeNodeInner(e,n);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(e,n,o={}){let r=this.marks[e.type.name];return r&&Ri(Ha(o),r(e,n),null,e.attrs)}static renderSpec(e,n,o=null,r){return Ri(e,n,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new xo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=af(e.nodes);return n.text||(n.text=o=>o.text),n}static marksFromSchema(e){return af(e.marks)}}function af(t){let e={};for(let n in t){let o=t[n].spec.toDOM;o&&(e[n]=o)}return e}function Ha(t){return t.document||window.document}const lf=new WeakMap;function m0(t){let e=lf.get(t);return e===void 0&&lf.set(t,e=g0(t)),e}function g0(t){let e=null;function n(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)n(o[r]);else for(let r in o)n(o[r])}return n(t),e}function Ri(t,e,n,o){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=m0(o))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(n=r.slice(0,s),r=r.slice(s+1));let l,c=n?t.createElementNS(n,r):t.createElement(r),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let f in d)if(d[f]!=null){let p=f.indexOf(" ");p>0?c.setAttributeNS(f.slice(0,p),f.slice(p+1),d[f]):f=="style"&&c.style?c.style.cssText=d[f]:c.setAttribute(f,d[f])}}for(let f=u;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:h,contentDOM:m}=Ri(t,p,n,o);if(c.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:c,contentDOM:l}}const cf=65535,df=Math.pow(2,16);function b0(t,e){return t+e*df}function uf(t){return t&cf}function y0(t){return(t-(t&cf))/df}const ff=1,pf=2,Pi=4,hf=8;class Wa{constructor(e,n,o){this.pos=e,this.delInfo=n,this.recover=o}get deleted(){return(this.delInfo&hf)>0}get deletedBefore(){return(this.delInfo&(ff|Pi))>0}get deletedAfter(){return(this.delInfo&(pf|Pi))>0}get deletedAcross(){return(this.delInfo&Pi)>0}}class Vt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Vt.empty)return Vt.empty}recover(e){let n=0,o=uf(e);if(!this.inverted)for(let r=0;r<o;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+n+y0(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[l+i],u=this.ranges[l+s],f=c+d;if(e<=f){let p=d?e==c?-1:e==f?1:n:n,h=c+r+(p<0?0:u);if(o)return h;let m=e==(n<0?c:f)?null:b0(l/3,e-c),b=e==c?pf:e==f?ff:Pi;return(n<0?e!=c:e!=f)&&(b|=hf),new Wa(h,b,m)}r+=u-d}return o?e+r:new Wa(e+r,0,null)}touches(e,n){let o=0,r=uf(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?o:0);if(c>e)break;let d=this.ranges[l+i],u=c+d;if(e<=u&&l==r*3)return!0;o+=this.ranges[l+s]-d}return!1}forEach(e){let n=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),c=s+(this.inverted?0:i),d=this.ranges[r+n],u=this.ranges[r+o];e(l,l+d,c,c+u),i+=u-d}}invert(){return new Vt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Vt.empty:new Vt(e<0?[0,-e,0]:[0,0,e])}}Vt.empty=new Vt([]);class Li{constructor(e,n,o=0,r=e?e.length:0){this.mirror=n,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Li(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,o=this._maps.length;n<e._maps.length;n++){let r=e.getMirror(n);this.appendMap(e._maps[n],r!=null&&r<n?o+r:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,o=this._maps.length+e._maps.length;n>=0;n--){let r=e.getMirror(n);this.appendMap(e._maps[n].invert(),r!=null&&r>n?o-r-1:void 0)}}invert(){let e=new Li;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,n);if(l.recover!=null){let c=this.getMirror(i);if(c!=null&&c>i&&c<this.to){i=c,e=this._maps[c].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new Wa(e,r,null)}}const Ga=Object.create(null);class xt{getMap(){return Vt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Ga[n.stepType];if(!o)throw new RangeError(`No step type ${n.stepType} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in Ga)throw new RangeError("Duplicate use of step JSON ID "+e);return Ga[e]=n,n.prototype.jsonID=e,n}}class nt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new nt(e,null)}static fail(e){return new nt(null,e)}static fromReplace(e,n,o,r){try{return nt.ok(e.replace(n,o,r))}catch(i){if(i instanceof _i)return nt.fail(i.message);throw i}}}function qa(t,e,n){let o=[];for(let r=0;r<t.childCount;r++){let i=t.child(r);i.content.size&&(i=i.copy(qa(i.content,e,i))),i.isInline&&(i=e(i,n,r)),o.push(i)}return ne.fromArray(o)}class qn extends xt{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new ue(qa(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),n.openStart,n.openEnd);return nt.fromReplace(e,this.from,this.to,i)}invert(){return new sn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new qn(n.pos,o.pos,this.mark)}merge(e){return e instanceof qn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new qn(n.from,n.to,e.markFromJSON(n.mark))}}xt.jsonID("addMark",qn);class sn extends xt{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=new ue(qa(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return nt.fromReplace(e,this.from,this.to,o)}invert(){return new qn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new sn(n.pos,o.pos,this.mark)}merge(e){return e instanceof sn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new sn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new sn(n.from,n.to,e.markFromJSON(n.mark))}}xt.jsonID("removeMark",sn);class Kn extends xt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nt.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return nt.fromReplace(e,this.pos,this.pos+1,new ue(ne.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let o=this.mark.addToSet(n.marks);if(o.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(o))return new Kn(this.pos,n.marks[r]);return new Kn(this.pos,this.mark)}}return new Eo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Kn(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Kn(n.pos,e.markFromJSON(n.mark))}}xt.jsonID("addNodeMark",Kn);class Eo extends xt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nt.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return nt.fromReplace(e,this.pos,this.pos+1,new ue(ne.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Kn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Eo(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Eo(n.pos,e.markFromJSON(n.mark))}}xt.jsonID("removeNodeMark",Eo);class ct extends xt{constructor(e,n,o,r=!1){super(),this.from=e,this.to=n,this.slice=o,this.structure=r}apply(e){return this.structure&&Ka(e,this.from,this.to)?nt.fail("Structure replace would overwrite content"):nt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Vt([this.from,this.to-this.from,this.slice.size])}invert(e){return new ct(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deletedAcross&&o.deletedAcross?null:new ct(n.pos,Math.max(n.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ct)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ue.empty:new ue(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ct(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ue.empty:new ue(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ct(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ct(n.from,n.to,ue.fromJSON(e,n.slice),!!n.structure)}}xt.jsonID("replace",ct);class dt extends xt{constructor(e,n,o,r,i,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Ka(e,this.from,this.gapFrom)||Ka(e,this.gapTo,this.to)))return nt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return nt.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,n.content);return o?nt.fromReplace(e,this.from,this.to,o):nt.fail("Content does not fit in gap")}getMap(){return new Vt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new dt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return n.deletedAcross&&o.deletedAcross||r<n.pos||i>o.pos?null:new dt(n.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new dt(n.from,n.to,n.gapFrom,n.gapTo,ue.fromJSON(e,n.slice),n.insert,!!n.structure)}}xt.jsonID("replaceAround",dt);function Ka(t,e,n){let o=t.resolve(e),r=n-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function x0(t,e,n,o){let r=[],i=[],s,l;t.doc.nodesBetween(e,n,(c,d,u)=>{if(!c.isInline)return;let f=c.marks;if(!o.isInSet(f)&&u.type.allowsMarkType(o.type)){let p=Math.max(d,e),h=Math.min(d+c.nodeSize,n),m=o.addToSet(f);for(let b=0;b<f.length;b++)f[b].isInSet(m)||(s&&s.to==p&&s.mark.eq(f[b])?s.to=h:r.push(s=new sn(p,h,f[b])));l&&l.to==p?l.to=h:i.push(l=new qn(p,h,o))}}),r.forEach(c=>t.step(c)),i.forEach(c=>t.step(c))}function E0(t,e,n,o){let r=[],i=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;i++;let c=null;if(o instanceof Oi){let d=s.marks,u;for(;u=o.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else o?o.isInSet(s.marks)&&(c=[o]):c=s.marks;if(c&&c.length){let d=Math.min(l+s.nodeSize,n);for(let u=0;u<c.length;u++){let f=c[u],p;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&f.eq(r[h].style)&&(p=m)}p?(p.to=d,p.step=i):r.push({style:f,from:Math.max(l,e),to:d,step:i})}}}),r.forEach(s=>t.step(new sn(s.from,s.to,s.style)))}function Ja(t,e,n,o=n.contentMatch,r=!0){let i=t.doc.nodeAt(e),s=[],l=e+1;for(let c=0;c<i.childCount;c++){let d=i.child(c),u=l+d.nodeSize,f=o.matchType(d.type);if(!f)s.push(new ct(l,u,ue.empty));else{o=f;for(let p=0;p<d.marks.length;p++)n.allowsMarkType(d.marks[p].type)||t.step(new sn(l,u,d.marks[p]));if(r&&d.isText&&n.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(d.text);)m||(m=new ue(ne.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),s.push(new ct(l+p.index,l+p.index+p[0].length,m))}}l=u}if(!o.validEnd){let c=o.fillBefore(ne.empty,!0);t.replace(l,l,new ue(c,0,0))}for(let c=s.length-1;c>=0;c--)t.step(s[c])}function k0(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function $o(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let o=t.depth,r=0,i=0;;--o){let s=t.$from.node(o),l=t.$from.index(o)+r,c=t.$to.indexAfter(o)-i;if(o<t.depth&&s.canReplace(l,c,n))return o;if(o==0||s.type.spec.isolating||!k0(s,l,c))break;l&&(r=1),c<s.childCount&&(i=1)}return null}function w0(t,e,n){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),c=s,d=l,u=ne.empty,f=0;for(let m=i,b=!1;m>n;m--)b||o.index(m)>0?(b=!0,u=ne.from(o.node(m).copy(u)),f++):c--;let p=ne.empty,h=0;for(let m=i,b=!1;m>n;m--)b||r.after(m+1)<r.end(m)?(b=!0,p=ne.from(r.node(m).copy(p)),h++):d++;t.step(new dt(c,d,s,l,new ue(u.append(p),f,h),u.size-f,!0))}function Xa(t,e,n=null,o=t){let r=S0(t,e),i=r&&N0(o,e);return i?r.map(mf).concat({type:e,attrs:n}).concat(i.map(mf)):null}function mf(t){return{type:t,attrs:null}}function S0(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.contentMatchAt(o).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(o,r,s)?i:null}function N0(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.child(o),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let c=(s.length?s[s.length-1]:e).contentMatch;for(let d=o;c&&d<r;d++)c=c.matchType(n.child(d).type);return!c||!c.validEnd?null:s}function C0(t,e,n){let o=ne.empty;for(let s=n.length-1;s>=0;s--){if(o.size){let l=n[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=ne.from(n[s].type.create(n[s].attrs,o))}let r=e.start,i=e.end;t.step(new dt(r,i,r,i,new ue(o,0,0),n.length,!0))}function v0(t,e,n,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let c=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,c)&&T0(t.doc,t.mapping.slice(i).map(l),o)){let d=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?d=!1:!h&&m&&(d=!0)}d===!1&&bf(t,s,l,i),Ja(t,t.mapping.slice(i).map(l,1),o,void 0,d===null);let u=t.mapping.slice(i),f=u.map(l,1),p=u.map(l+s.nodeSize,1);return t.step(new dt(f,p,f+1,p-1,new ue(ne.from(o.create(c,null,s.marks)),0,0),1,!0)),d===!0&&gf(t,s,l,i),!1}})}function gf(t,e,n,o){e.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let c=t.mapping.slice(o).map(n+1+i+s.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function bf(t,e,n,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=t.mapping.slice(o).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
|
|
352
|
-
`))}})}function T0(t,e,n){let o=t.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,n)}function z0(t,e,n,o,r){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(o,null,r||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new dt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ue(ne.from(s),0,0),1,!0))}function vn(t,e,n=1,o){let r=t.resolve(e),i=r.depth-n,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let d=r.depth-1,u=n-2;d>i;d--,u--){let f=r.node(d),p=r.index(d);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=o&&o[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let b=o&&o[u]||f;if(!f.canReplace(p+1,f.childCount)||!b.type.validContent(h))return!1}let l=r.indexAfter(i),c=o&&o[0];return r.node(i).canReplaceWith(l,l,c?c.type:r.node(i+1).type)}function _0(t,e,n=1,o){let r=t.doc.resolve(e),i=ne.empty,s=ne.empty;for(let l=r.depth,c=r.depth-n,d=n-1;l>c;l--,d--){i=ne.from(r.node(l).copy(i));let u=o&&o[d];s=ne.from(u?u.type.create(u.attrs,s):r.node(l).copy(s))}t.step(new ct(e,e,new ue(i.append(s),n,n),!0))}function Jn(t,e){let n=t.resolve(e),o=n.index();return yf(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(o,o+1)}function A0(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:o}=t.type.schema;for(let r=0;r<e.childCount;r++){let i=e.child(r),s=i.type==o?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function yf(t,e){return!!(t&&e&&!t.isLeaf&&A0(t,e))}function $i(t,e,n=-1){let o=t.resolve(e);for(let r=o.depth;;r--){let i,s,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,s=o.nodeAfter):n>0?(i=o.node(r+1),l++,s=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),s=o.node(r+1)),i&&!i.isTextblock&&yf(i,s)&&o.node(r).canReplace(l,l+1))return e;if(r==0)break;e=n<0?o.before(r):o.after(r)}}function M0(t,e,n){let o=null,{linebreakReplacement:r}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(r&&s.inlineContent){let u=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);u&&!f?o=!1:!u&&f&&(o=!0)}let l=t.steps.length;if(o===!1){let u=t.doc.resolve(e+n);bf(t,u.node(),u.before(),l)}s.inlineContent&&Ja(t,e+n-1,s,i.node().contentMatchAt(i.index()),o==null);let c=t.mapping.slice(l),d=c.map(e-n);if(t.step(new ct(d,c.map(e+n,-1),ue.empty,!0)),o===!0){let u=t.doc.resolve(d);gf(t,u.node(),u.before(),t.steps.length)}return t}function I0(t,e,n){let o=t.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),n))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,n))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,n))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function O0(t,e,n){let o=t.resolve(e);if(!n.content.size)return e;let r=n.content;for(let i=0;i<n.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=o.depth;s>=0;s--){let l=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,c=o.index(s)+(l>0?1:0),d=o.node(s),u=!1;if(i==1)u=d.canReplace(c,c,r);else{let f=d.contentMatchAt(c).findWrapping(r.firstChild.type);u=f&&d.canReplaceWith(c,c,f[0])}if(u)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function Vi(t,e,n=e,o=ue.empty){if(e==n&&!o.size)return null;let r=t.resolve(e),i=t.resolve(n);return xf(r,i,o)?new ct(e,n,o):new D0(r,i,o).fit()}function xf(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class D0{constructor(e,n,o){this.$from=e,this.$to=n,this.unplaced=o,this.frontier=[],this.placed=ne.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=ne.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let c=new ue(i,s,l);return e>-1?new dt(o.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||o.pos!=this.$to.pos?new ct(o.pos,r.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=n.firstChild;if(n.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}n=i.content}for(let n=1;n<=2;n++)for(let o=n==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=Ya(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:d}=this.frontier[l],u,f=null;if(n==1&&(s?d.matchType(s.type)||(f=d.fillBefore(ne.from(s),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(n==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:u};if(i&&d.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Ya(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new ue(e,n+1,Math.max(o,r.size+n>=e.size-o?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Ya(e,n);if(r.childCount<=1&&n>0){let i=e.size-n<=n+r.size;this.unplaced=new ue(Nr(e,n-1,1),n-1,i?n-1:o)}else this.unplaced=new ue(Nr(e,n,1),n,o)}placeNodes({sliceDepth:e,frontierDepth:n,parent:o,inject:r,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let b=0;b<i.length;b++)this.openFrontierNode(i[b]);let s=this.unplaced,l=o?o.content:s.content,c=s.openStart-e,d=0,u=[],{match:f,type:p}=this.frontier[n];if(r){for(let b=0;b<r.childCount;b++)u.push(r.child(b));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;d<l.childCount;){let b=l.child(d),g=f.matchType(b.type);if(!g)break;d++,(d>1||c==0||b.content.size)&&(f=g,u.push(Ef(b.mark(p.allowedMarks(b.marks)),d==1?c:0,d==l.childCount?h:-1)))}let m=d==l.childCount;m||(h=-1),this.placed=Cr(this.placed,n,ne.from(u)),this.frontier[n].match=f,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let b=0,g=l;b<h;b++){let x=g.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),g=x.content}this.unplaced=m?e==0?ue.empty:new ue(Nr(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new ue(Nr(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Qa(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:o,type:r}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Qa(e,n,r,o,i);if(s){for(let l=n-1;l>=0;l--){let{match:c,type:d}=this.frontier[l],u=Qa(e,l,d,c,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Cr(this.placed,n.depth,n.fit)),e=n.move;for(let o=n.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,n=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Cr(this.placed,this.depth,ne.from(e.create(n,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ne.empty,!0);n.childCount&&(this.placed=Cr(this.placed,this.frontier.length,n))}}function Nr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Nr(t.firstChild.content,e-1,n)))}function Cr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Cr(t.lastChild.content,e-1,n)))}function Ya(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Ef(t,e,n){if(e<=0)return t;let o=t.content;return e>1&&(o=o.replaceChild(0,Ef(o.firstChild,e-1,o.childCount==1?n-1:0))),e>0&&(o=t.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(ne.empty,!0)))),t.copy(o)}function Qa(t,e,n,o,r){let i=t.node(e),s=r?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!R0(n,i.content,s)?l:null}function R0(t,e,n){for(let o=n;o<e.childCount;o++)if(!t.allowsMarks(e.child(o).marks))return!0;return!1}function P0(t){return t.spec.defining||t.spec.definingForContent}function L0(t,e,n,o){if(!o.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),i=t.doc.resolve(n);if(xf(r,i,o))return t.step(new ct(e,n,o));let s=wf(r,i);s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let p=r.depth,h=r.pos-1;p>0;p--,h--){let m=r.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?l=p:r.before(p)==h&&s.splice(1,0,-p)}let c=s.indexOf(l),d=[],u=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(d.push(m),h==o.openStart)break;p=m.content}for(let p=u-1;p>=0;p--){let h=d[p],m=P0(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))u=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+u+1)%(o.openStart+1),m=d[h];if(m)for(let b=0;b<s.length;b++){let g=s[(b+c)%s.length],x=!0;g<0&&(x=!1,g=-g);let v=r.node(g-1),w=r.index(g-1);if(v.canReplaceWith(w,w,m.type,m.marks))return t.replace(r.before(g),x?i.after(g):n,new ue(kf(o.content,0,o.openStart,h),h,o.openEnd))}}let f=t.steps.length;for(let p=s.length-1;p>=0&&(t.replace(e,n,o),!(t.steps.length>f));p--){let h=s[p];h<0||(e=r.before(h),n=i.after(h))}}function kf(t,e,n,o,r){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(kf(i.content,e+1,n,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(ne.empty,!0))}return t}function $0(t,e,n,o){if(!o.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=I0(t.doc,e,o.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new ue(ne.from(o),0,0))}function V0(t,e,n){let o=t.doc.resolve(e),r=t.doc.resolve(n),i=wf(o,r);for(let s=0;s<i.length;s++){let l=i[s],c=s==i.length-1;if(c&&l==0||o.node(l).type.contentMatch.validEnd)return t.delete(o.start(l),r.end(l));if(l>0&&(c||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return t.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&n>o.end(s)&&r.end(s)-n!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return t.delete(o.before(s),n);t.delete(e,n)}function wf(t,e){let n=[],o=Math.min(t.depth,e.depth);for(let r=o;r>=0;r--){let i=t.start(r);if(i<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&n.push(r)}return n}class Vo extends xt{constructor(e,n,o){super(),this.pos=e,this.attr=n,this.value=o}apply(e){let n=e.nodeAt(this.pos);if(!n)return nt.fail("No node at attribute step's position");let o=Object.create(null);for(let i in n.attrs)o[i]=n.attrs[i];o[this.attr]=this.value;let r=n.type.create(o,null,n.marks);return nt.fromReplace(e,this.pos,this.pos+1,new ue(ne.from(r),0,n.isLeaf?0:1))}getMap(){return Vt.empty}invert(e){return new Vo(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Vo(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Vo(n.pos,n.attr,n.value)}}xt.jsonID("attr",Vo);class vr extends xt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let o=e.type.create(n,e.content,e.marks);return nt.ok(o)}getMap(){return Vt.empty}invert(e){return new vr(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new vr(n.attr,n.value)}}xt.jsonID("docAttr",vr);let Bo=class extends Error{};Bo=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},Bo.prototype=Object.create(Error.prototype),Bo.prototype.constructor=Bo,Bo.prototype.name="TransformError";class Sf{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Li}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Bo(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,o=ue.empty){let r=Vi(this.doc,e,n,o);return r&&this.step(r),this}replaceWith(e,n,o){return this.replace(e,n,new ue(ne.from(o),0,0))}delete(e,n){return this.replace(e,n,ue.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,o){return L0(this,e,n,o),this}replaceRangeWith(e,n,o){return $0(this,e,n,o),this}deleteRange(e,n){return V0(this,e,n),this}lift(e,n){return w0(this,e,n),this}join(e,n=1){return M0(this,e,n),this}wrap(e,n){return C0(this,e,n),this}setBlockType(e,n=e,o,r=null){return v0(this,e,n,o,r),this}setNodeMarkup(e,n,o=null,r){return z0(this,e,n,o,r),this}setNodeAttribute(e,n,o){return this.step(new Vo(e,n,o)),this}setDocAttribute(e,n){return this.step(new vr(e,n)),this}addNodeMark(e,n){return this.step(new Kn(e,n)),this}removeNodeMark(e,n){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(n instanceof je)n.isInSet(o.marks)&&this.step(new Eo(e,n));else{let r=o.marks,i,s=[];for(;i=n.isInSet(r);)s.push(new Eo(e,i)),r=i.removeFromSet(r);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,n=1,o){return _0(this,e,n,o),this}addMark(e,n,o){return x0(this,e,n,o),this}removeMark(e,n,o){return E0(this,e,n,o),this}clearIncompatible(e,n,o){return Ja(this,e,n,o),this}}const Za=Object.create(null);class Pe{constructor(e,n,o){this.$anchor=e,this.$head=n,this.ranges=o||[new B0(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=ue.empty){let o=n.content.lastChild,r=null;for(let l=0;l<n.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:c,$to:d}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(c.pos),u.map(d.pos),l?ue.empty:n),l==0&&vf(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,n){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],c=e.mapping.slice(o),d=c.map(s.pos),u=c.map(l.pos);i?e.deleteRange(d,u):(e.replaceRangeWith(d,u,n),vf(e,o,n.isInline?-1:1))}}static findFrom(e,n,o=!1){let r=e.parent.inlineContent?new Oe(e):Fo(e.node(0),e.parent,e.pos,e.index(),n,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=n<0?Fo(e.node(0),e.node(i),e.before(i+1),e.index(i),n,o):Fo(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,o);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Bt(e.node(0))}static atStart(e){return Fo(e,e,0,0,1)||new Bt(e)}static atEnd(e){return Fo(e,e,e.content.size,e.childCount,-1)||new Bt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Za[n.type];if(!o)throw new RangeError(`No selection type ${n.type} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in Za)throw new RangeError("Duplicate use of selection JSON ID "+e);return Za[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Oe.between(this.$anchor,this.$head).getBookmark()}}Pe.prototype.visible=!0;class B0{constructor(e,n){this.$from=e,this.$to=n}}let Nf=!1;function Cf(t){!Nf&&!t.parent.inlineContent&&(Nf=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Oe extends Pe{constructor(e,n=e){Cf(e),Cf(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let o=e.resolve(n.map(this.head));if(!o.parent.inlineContent)return Pe.near(o);let r=e.resolve(n.map(this.anchor));return new Oe(r.parent.inlineContent?r:o,o)}replace(e,n=ue.empty){if(super.replace(e,n),n==ue.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof Oe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Bi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Oe(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){let r=e.resolve(n);return new this(r,o==n?r:e.resolve(o))}static between(e,n,o){let r=e.pos-n.pos;if((!o||r)&&(o=r>=0?1:-1),!n.parent.inlineContent){let i=Pe.findFrom(n,o,!0)||Pe.findFrom(n,-o,!0);if(i)n=i.$head;else return Pe.near(n,o)}return e.parent.inlineContent||(r==0?e=n:(e=(Pe.findFrom(e,-o,!0)||Pe.findFrom(e,o,!0)).$anchor,e.pos<n.pos!=r<0&&(e=n))),new Oe(e,n)}}Pe.jsonID("text",Oe);class Bi{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Bi(e.map(this.anchor),e.map(this.head))}resolve(e){return Oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ne extends Pe{constructor(e){let n=e.nodeAfter,o=e.node(0).resolve(e.pos+n.nodeSize);super(e,o),this.node=n}map(e,n){let{deleted:o,pos:r}=n.mapResult(this.anchor),i=e.resolve(r);return o?Pe.near(i):new Ne(i)}content(){return new ue(ne.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 el(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ne(e.resolve(n.anchor))}static create(e,n){return new Ne(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ne.prototype.visible=!1,Pe.jsonID("node",Ne);class el{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:o}=e.mapResult(this.anchor);return n?new Bi(o,o):new el(o)}resolve(e){let n=e.resolve(this.anchor),o=n.nodeAfter;return o&&Ne.isSelectable(o)?new Ne(n):Pe.near(n)}}class Bt extends Pe{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ue.empty){if(n==ue.empty){e.delete(0,e.doc.content.size);let o=Pe.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Bt(e)}map(e){return new Bt(e)}eq(e){return e instanceof Bt}getBookmark(){return F0}}Pe.jsonID("all",Bt);const F0={map(){return this},resolve(t){return new Bt(t)}};function Fo(t,e,n,o,r,i=!1){if(e.inlineContent)return Oe.create(t,n);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let l=e.child(s);if(l.isAtom){if(!i&&Ne.isSelectable(l))return Ne.create(t,n-(r<0?l.nodeSize:0))}else{let c=Fo(t,l,n+r,r<0?l.childCount:0,r,i);if(c)return c}n+=l.nodeSize*r}return null}function vf(t,e,n){let o=t.steps.length-1;if(o<e)return;let r=t.steps[o];if(!(r instanceof ct||r instanceof dt))return;let i=t.mapping.maps[o],s;i.forEach((l,c,d,u)=>{s==null&&(s=u)}),t.setSelection(Pe.near(t.doc.resolve(s),n))}const Tf=1,Fi=2,zf=4;class j0 extends Sf{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Tf)&~Fi,this.storedMarks=null,this}get selectionSet(){return(this.updated&Tf)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Fi,this}ensureMarks(e){return je.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Fi)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Fi,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let o=this.selection;return n&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||je.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,o){let r=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(o==null&&(o=n),!e)return this.deleteRange(n,o);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=o==n?s.marks():s.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(n,o,r.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Pe.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=zf,this}get scrolledIntoView(){return(this.updated&zf)>0}}function _f(t,e){return!e||!t?t:t.bind(e)}class Tr{constructor(e,n,o){this.name=e,this.init=_f(n.init,o),this.apply=_f(n.apply,o)}}const U0=[new Tr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Tr("selection",{init(t,e){return t.selection||Pe.atStart(e.doc)},apply(t){return t.selection}}),new Tr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,o){return o.selection.$cursor?t.storedMarks:null}}),new Tr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class tl{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=U0.slice(),n&&n.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new Tr(o.key,o.spec.state,o))})}}class jo{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let o=0;o<this.config.plugins.length;o++)if(o!=n){let r=this.config.plugins[o];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],o=this.applyInner(e),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let c=r?r[s].n:0,d=r?r[s].state:this,u=c<n.length&&l.spec.appendTransaction.call(l,c?n.slice(c):n,d,o);if(u&&o.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!r){r=[];for(let f=0;f<this.config.plugins.length;f++)r.push(f<s?{state:o,n:n.length}:{state:this,n:0})}n.push(u),o=o.applyInner(u),i=!0}r&&(r[s]={state:o,n:n.length})}}if(!i)return{state:o,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new jo(this.config),o=this.config.fields;for(let r=0;r<o.length;r++){let i=o[r];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new j0(this)}static create(e){let n=new tl(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new jo(n);for(let r=0;r<n.fields.length;r++)o[n.fields[r].name]=n.fields[r].init(e,o);return o}reconfigure(e){let n=new tl(this.schema,e.plugins),o=n.fields,r=new jo(n);for(let i=0;i<o.length;i++){let s=o[i].name;r[s]=this.hasOwnProperty(s)?this[s]:o[i].init(e,r)}return r}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[o],i=r.spec.state;i&&i.toJSON&&(n[o]=i.toJSON.call(r,this[r.key]))}return n}static fromJSON(e,n,o){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new tl(e.schema,e.plugins),i=new jo(r);return r.fields.forEach(s=>{if(s.name=="doc")i.doc=Gn.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=Pe.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let l in o){let c=o[l],d=c.spec.state;if(c.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[s.name]=d.fromJSON.call(c,e,n[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function Af(t,e,n){for(let o in t){let r=t[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=Af(r,e,{})),n[o]=r}return n}class Ot{constructor(e){this.spec=e,this.props={},e.props&&Af(e.props,this,this.props),this.key=e.key?e.key.key:Mf("plugin")}getState(e){return e[this.key]}}const nl=Object.create(null);function Mf(t){return t in nl?t+"$"+ ++nl[t]:(nl[t]=0,t+"$")}class an{constructor(e="key"){this.key=Mf(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ol=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function If(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Of=(t,e,n)=>{let o=If(t,n);if(!o)return!1;let r=rl(o);if(!r){let s=o.blockRange(),l=s&&$o(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(jf(t,r,e,-1))return!0;if(o.parent.content.size==0&&(Uo(i,"end")||Ne.isSelectable(i)))for(let s=o.depth;;s--){let l=Vi(t.doc,o.before(s),o.after(s),ue.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(Uo(i,"end")?Pe.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(s==1||o.node(s-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},H0=(t,e,n)=>{let o=If(t,n);if(!o)return!1;let r=rl(o);return r?Df(t,r,e):!1},W0=(t,e,n)=>{let o=Pf(t,n);if(!o)return!1;let r=il(o);return r?Df(t,r,e):!1};function Df(t,e,n){let o=e.nodeBefore,r=o,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let u=r.lastChild;if(!u)return!1;r=u}let s=e.nodeAfter,l=s,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let d=Vi(t.doc,i,c,ue.empty);if(!d||d.from!=i||d instanceof ct&&d.slice.size>=c-i)return!1;if(n){let u=t.tr.step(d);u.setSelection(Oe.create(u.doc,i)),n(u.scrollIntoView())}return!0}function Uo(t,e,n=!1){for(let o=t;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(n&&o.childCount!=1)return!1}return!1}const Rf=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):o.parentOffset>0)return!1;i=rl(o)}let s=i&&i.nodeBefore;return!s||!Ne.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Ne.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function rl(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Pf(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Lf=(t,e,n)=>{let o=Pf(t,n);if(!o)return!1;let r=il(o);if(!r)return!1;let i=r.nodeAfter;if(jf(t,r,e,1))return!0;if(o.parent.content.size==0&&(Uo(i,"start")||Ne.isSelectable(i))){let s=Vi(t.doc,o.before(),o.after(),ue.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(Uo(i,"start")?Pe.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(t.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},$f=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):o.parentOffset<o.parent.content.size)return!1;i=il(o)}let s=i&&i.nodeAfter;return!s||!Ne.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Ne.create(t.doc,i.pos)).scrollIntoView()),!0)};function il(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const G0=(t,e)=>{let n=t.selection,o=n instanceof Ne,r;if(o){if(n.node.isTextblock||!Jn(t.doc,n.from))return!1;r=n.from}else if(r=$i(t.doc,n.from,-1),r==null)return!1;if(e){let i=t.tr.join(r);o&&i.setSelection(Ne.create(i.doc,r-t.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},q0=(t,e)=>{let n=t.selection,o;if(n instanceof Ne){if(n.node.isTextblock||!Jn(t.doc,n.to))return!1;o=n.to}else if(o=$i(t.doc,n.to,1),o==null)return!1;return e&&e(t.tr.join(o).scrollIntoView()),!0},K0=(t,e)=>{let{$from:n,$to:o}=t.selection,r=n.blockRange(o),i=r&&$o(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},Vf=(t,e)=>{let{$head:n,$anchor:o}=t.selection;return!n.parent.type.spec.code||!n.sameParent(o)?!1:(e&&e(t.tr.insertText(`
|
|
353
|
-
`).scrollIntoView()),!0)};function sl(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const J0=(t,e)=>{let{$head:n,$anchor:o}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(o))return!1;let r=n.node(-1),i=n.indexAfter(-1),s=sl(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(e){let l=n.after(),c=t.tr.replaceWith(l,l,s.createAndFill());c.setSelection(Pe.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},Bf=(t,e)=>{let n=t.selection,{$from:o,$to:r}=n;if(n instanceof Bt||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=sl(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=t.tr.insert(s,i.createAndFill());l.setSelection(Oe.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},Ff=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(vn(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let o=n.blockRange(),r=o&&$o(o);return r==null?!1:(e&&e(t.tr.lift(o,r).scrollIntoView()),!0)};function X0(t){return(e,n)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof Ne&&e.selection.node.isBlock)return!o.parentOffset||!vn(e.doc,o.pos)?!1:(n&&n(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],s,l,c=!1,d=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){c=o.end(h)==o.pos+(o.depth-h),d=o.start(h)==o.pos-(o.depth-h),l=sl(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(c&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof Oe||e.selection instanceof Bt)&&u.deleteSelection();let f=u.mapping.map(o.pos),p=vn(u.doc,f,i.length,i);if(p||(i[0]=l?{type:l}:null,p=vn(u.doc,f,i.length,i)),!p)return!1;if(u.split(f,i.length,i),!c&&d&&o.node(s).type!=l){let h=u.mapping.map(o.before(s)),m=u.doc.resolve(h);l&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,l)&&u.setNodeMarkup(u.mapping.map(o.before(s)),l)}return n&&n(u.scrollIntoView()),!0}}const Y0=X0(),Q0=(t,e)=>{let{$from:n,to:o}=t.selection,r,i=n.sharedDepth(o);return i==0?!1:(r=n.before(i),e&&e(t.tr.setSelection(Ne.create(t.doc,r))),!0)};function Z0(t,e,n){let o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(r.isTextblock||Jn(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function jf(t,e,n,o){let r=e.nodeBefore,i=e.nodeAfter,s,l,c=r.type.spec.isolating||i.type.spec.isolating;if(!c&&Z0(t,e,n))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(s=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,m=ne.empty;for(let x=s.length-1;x>=0;x--)m=ne.from(s[x].create(null,m));m=ne.from(r.copy(m));let b=t.tr.step(new dt(e.pos-1,h,e.pos,h,new ue(m,1,0),s.length,!0)),g=b.doc.resolve(h+2*s.length);g.nodeAfter&&g.nodeAfter.type==r.type&&Jn(b.doc,g.pos)&&b.join(g.pos),n(b.scrollIntoView())}return!0}let u=i.type.spec.isolating||o>0&&c?null:Pe.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),p=f&&$o(f);if(p!=null&&p>=e.depth)return n&&n(t.tr.lift(f,p).scrollIntoView()),!0;if(d&&Uo(i,"start",!0)&&Uo(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let b=i,g=1;for(;!b.isTextblock;b=b.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,b.content)){if(n){let x=ne.empty;for(let w=m.length-1;w>=0;w--)x=ne.from(m[w].copy(x));let v=t.tr.step(new dt(e.pos-m.length,e.pos+i.nodeSize,e.pos+g,e.pos+i.nodeSize-g,new ue(x,m.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function Uf(t){return function(e,n){let o=e.selection,r=t<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(n&&n(e.tr.setSelection(Oe.create(e.doc,t<0?r.start(i):r.end(i)))),!0):!1}}const ex=Uf(-1),tx=Uf(1);function nx(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i),l=s&&Xa(s,t,e);return l?(o&&o(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Hf(t,e=null){return function(n,o){let r=!1;for(let i=0;i<n.selection.ranges.length&&!r;i++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(c,d)=>{if(r)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)r=!0;else{let u=n.doc.resolve(d),f=u.index();r=u.parent.canReplaceWith(f,f+1,t)}})}if(!r)return!1;if(o){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[s];i.setBlockType(l,c,t,e)}o(i.scrollIntoView())}return!0}}function al(...t){return function(e,n,o){for(let r=0;r<t.length;r++)if(t[r](e,n,o))return!0;return!1}}al(ol,Of,Rf),al(ol,Lf,$f),al(Vf,Bf,Ff,Y0),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function ox(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i);if(!s)return!1;let l=o?n.tr:null;return rx(l,s,t,e)?(o&&o(l.scrollIntoView()),!0):!1}}function rx(t,e,n,o=null){let r=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=s.resolve(e.start-2);i=new Mi(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new Mi(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=Xa(i,n,o,e);return l?(t&&ix(t,e,l,r,n),!0):!1}function ix(t,e,n,o,r){let i=ne.empty;for(let u=n.length-1;u>=0;u--)i=ne.from(n[u].type.create(n[u].attrs,i));t.step(new dt(e.start-(o?2:0),e.end,e.start,e.end,new ue(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==r&&(s=u+1);let l=n.length-s,c=e.start+n.length-(o?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,p=!0;u<f;u++,p=!1)!p&&vn(t.doc,c,l)&&(t.split(c,l),c+=2*l),c+=d.child(u).nodeSize;return t}function sx(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==t);return i?n?o.node(i.depth-1).type==t?ax(e,n,t,i):lx(e,n,i):!0:!1}}function ax(t,e,n,o){let r=t.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new dt(i-1,s,i,s,new ue(ne.from(n.create(null,o.parent.copy())),1,0),1,!0)),o=new Mi(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=$o(o);if(l==null)return!1;r.lift(o,l);let c=r.doc.resolve(r.mapping.map(i,-1)-1);return Jn(r.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&r.join(c.pos),e(r.scrollIntoView()),!0}function lx(t,e,n){let o=t.tr,r=n.parent;for(let h=n.end,m=n.endIndex-1,b=n.startIndex;m>b;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(n.start),s=i.nodeAfter;if(o.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,c=n.endIndex==r.childCount,d=i.node(-1),u=i.index(-1);if(!d.canReplace(u+(l?0:1),u+1,s.content.append(c?ne.empty:ne.from(r))))return!1;let f=i.pos,p=f+s.nodeSize;return o.step(new dt(f-(l?1:0),p+(c?1:0),f+1,p-1,new ue((l?ne.empty:ne.from(r.copy(ne.empty))).append(c?ne.empty:ne.from(r.copy(ne.empty))),l?0:1,c?0:1),l?0:1)),e(o.scrollIntoView()),!0}function cx(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,d=>d.childCount>0&&d.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,c=l.child(s-1);if(c.type!=t)return!1;if(n){let d=c.lastChild&&c.lastChild.type==l.type,u=ne.from(d?t.create():null),f=new ue(ne.from(t.create(null,ne.from(l.type.create(null,u)))),d?3:1,0),p=i.start,h=i.end;n(e.tr.step(new dt(p-(d?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}const ht=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ho=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let ll=null;const Tn=function(t,e,n){let o=ll||(ll=document.createRange());return o.setEnd(t,n??t.nodeValue.length),o.setStart(t,e||0),o},dx=function(){ll=null},ko=function(t,e,n,o){return n&&(Wf(t,e,n,o,-1)||Wf(t,e,n,o,1))},ux=/^(img|br|input|textarea|hr)$/i;function Wf(t,e,n,o,r){for(var i;;){if(t==n&&e==o)return!0;if(e==(r<0?0:Ht(t))){let s=t.parentNode;if(!s||s.nodeType!=1||zr(t)||ux.test(t.nodeName)||t.contentEditable=="false")return!1;e=ht(t)+(r<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(r<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=r;else return!1;else t=s,e=r<0?Ht(t):0}else return!1}}function Ht(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function fx(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Ht(t)}else if(t.parentNode&&!zr(t))e=ht(t),t=t.parentNode;else return null}}function px(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!zr(t))e=ht(t)+1,t=t.parentNode;else return null}}function hx(t,e,n){for(let o=e==0,r=e==Ht(t);o||r;){if(t==n)return!0;let i=ht(t);if(t=t.parentNode,!t)return!1;o=o&&i==0,r=r&&i==Ht(t)}}function zr(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const ji=function(t){return t.focusNode&&ko(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function wo(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function mx(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function gx(t,e,n){if(t.caretPositionFromPoint)try{let o=t.caretPositionFromPoint(e,n);if(o)return{node:o.offsetNode,offset:Math.min(Ht(o.offsetNode),o.offset)}}catch{}if(t.caretRangeFromPoint){let o=t.caretRangeFromPoint(e,n);if(o)return{node:o.startContainer,offset:Math.min(Ht(o.startContainer),o.startOffset)}}}const hn=typeof navigator<"u"?navigator:null,Gf=typeof document<"u"?document:null,Xn=hn&&hn.userAgent||"",cl=/Edge\/(\d+)/.exec(Xn),qf=/MSIE \d/.exec(Xn),dl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Xn),Dt=!!(qf||dl||cl),Yn=qf?document.documentMode:dl?+dl[1]:cl?+cl[1]:0,Wt=!Dt&&/gecko\/(\d+)/i.test(Xn);Wt&&+(/Firefox\/(\d+)/.exec(Xn)||[0,0])[1];const ul=!Dt&&/Chrome\/(\d+)/.exec(Xn),ut=!!ul,Kf=ul?+ul[1]:0,mt=!Dt&&!!hn&&/Apple Computer/.test(hn.vendor),Wo=mt&&(/Mobile\/\w+/.test(Xn)||!!hn&&hn.maxTouchPoints>2),Gt=Wo||(hn?/Mac/.test(hn.platform):!1),Jf=hn?/Win/.test(hn.platform):!1,zn=/Android \d/.test(Xn),_r=!!Gf&&"webkitFontSmoothing"in Gf.documentElement.style,bx=_r?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function yx(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function _n(t,e){return typeof t=="number"?t:t[e]}function xx(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,o=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*o}}function Xf(t,e,n){let o=t.someProp("scrollThreshold")||0,r=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=Ho(s);continue}let l=s,c=l==i.body,d=c?yx(i):xx(l),u=0,f=0;if(e.top<d.top+_n(o,"top")?f=-(d.top-e.top+_n(r,"top")):e.bottom>d.bottom-_n(o,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+_n(r,"top")-d.top:e.bottom-d.bottom+_n(r,"bottom")),e.left<d.left+_n(o,"left")?u=-(d.left-e.left+_n(r,"left")):e.right>d.right-_n(o,"right")&&(u=e.right-d.right+_n(r,"right")),u||f)if(c)i.defaultView.scrollBy(u,f);else{let h=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);let b=l.scrollLeft-h,g=l.scrollTop-m;e={left:e.left-b,top:e.top-g,right:e.right-b,bottom:e.bottom-g}}let p=c?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:Ho(s)}}function Ex(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),o,r;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=t.root.elementFromPoint(i,s);if(!l||l==t.dom||!t.dom.contains(l))continue;let c=l.getBoundingClientRect();if(c.top>=n-20){o=l,r=c.top;break}}return{refDOM:o,refTop:r,stack:Yf(t.dom)}}function Yf(t){let e=[],n=t.ownerDocument;for(let o=t;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),t!=n);o=Ho(o));return e}function kx({refDOM:t,refTop:e,stack:n}){let o=t?t.getBoundingClientRect().top:0;Qf(n,o==0?0:o-e)}function Qf(t,e){for(let n=0;n<t.length;n++){let{dom:o,top:r,left:i}=t[n];o.scrollTop!=r+e&&(o.scrollTop=r+e),o.scrollLeft!=i&&(o.scrollLeft=i)}}let Go=null;function wx(t){if(t.setActive)return t.setActive();if(Go)return t.focus(Go);let e=Yf(t);t.focus(Go==null?{get preventScroll(){return Go={preventScroll:!0},!0}}:void 0),Go||(Go=!1,Qf(e,0))}function Zf(t,e){let n,o=2e8,r,i=0,s=e.top,l=e.top,c,d;for(let u=t.firstChild,f=0;u;u=u.nextSibling,f++){let p;if(u.nodeType==1)p=u.getClientRects();else if(u.nodeType==3)p=Tn(u).getClientRects();else continue;for(let h=0;h<p.length;h++){let m=p[h];if(m.top<=s&&m.bottom>=l){s=Math.max(m.bottom,s),l=Math.min(m.top,l);let b=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(b<o){n=u,o=b,r=b&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&b&&(i=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=f+1)}}return!n&&c&&(n=c,r=d,o=0),n&&n.nodeType==3?Sx(n,r):!n||o&&n.nodeType==1?{node:t,offset:i}:Zf(n,r)}function Sx(t,e){let n=t.nodeValue.length,o=document.createRange(),r;for(let i=0;i<n;i++){o.setEnd(t,i+1),o.setStart(t,i);let s=Qn(o,1);if(s.top!=s.bottom&&fl(e,s)){r={node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return o.detach(),r||{node:t,offset:0}}function fl(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Nx(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Cx(t,e,n){let{node:o,offset:r}=Zf(e,n),i=-1;if(o.nodeType==1&&!o.firstChild){let s=o.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(o,r,i)}function vx(t,e,n,o){let r=-1;for(let i=e,s=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!0),c;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((c=l.dom.getBoundingClientRect()).width||c.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&c.left>o.left||c.top>o.top?r=l.posBefore:(!s&&c.right<o.left||c.bottom<o.top)&&(r=l.posAfter),s=!0),!l.contentDOM&&r<0&&!l.node.isText))return(l.node.isBlock?o.top<(c.top+c.bottom)/2:o.left<(c.left+c.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return r>-1?r:t.docView.posFromDOM(e,n,-1)}function ep(t,e,n){let o=t.childNodes.length;if(o&&n.top<n.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-n.top)/(n.bottom-n.top))-2)),i=r;;){let s=t.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(fl(e,d))return ep(s,e,d)}}if((i=(i+1)%o)==r)break}return t}function Tx(t,e){let n=t.dom.ownerDocument,o,r=0,i=gx(n,e.left,e.top);i&&({node:o,offset:r}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let d=t.dom.getBoundingClientRect();if(!fl(e,d)||(s=ep(t.dom,e,d),!s))return null}if(mt)for(let d=s;o&&d;d=Ho(d))d.draggable&&(o=void 0);if(s=Nx(s,e),o){if(Wt&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let u=o.childNodes[r],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&r++}let d;_r&&r&&o.nodeType==1&&(d=o.childNodes[r-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&r--,o==t.dom&&r==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(r==0||o.nodeType!=1||o.childNodes[r-1].nodeName!="BR")&&(l=vx(t,o,r,e))}l==null&&(l=Cx(t,s,e));let c=t.docView.nearestDesc(s,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function tp(t){return t.top<t.bottom||t.left<t.right}function Qn(t,e){let n=t.getClientRects();if(n.length){let o=n[e<0?0:n.length-1];if(tp(o))return o}return Array.prototype.find.call(n,tp)||t.getBoundingClientRect()}const zx=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function np(t,e,n){let{node:o,offset:r,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=_r||Wt;if(o.nodeType==3)if(s&&(zx.test(o.nodeValue)||(n<0?!r:r==o.nodeValue.length))){let c=Qn(Tn(o,r,r),n);if(Wt&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let d=Qn(Tn(o,r-1,r-1),-1);if(d.top==c.top){let u=Qn(Tn(o,r,r+1),-1);if(u.top!=c.top)return Ar(u,u.left<d.left)}}return c}else{let c=r,d=r,u=n<0?1:-1;return n<0&&!r?(d++,u=-1):n>=0&&r==o.nodeValue.length?(c--,u=1):n<0?c--:d++,Ar(Qn(Tn(o,c,d),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(n<0||r==Ht(o))){let c=o.childNodes[r-1];if(c.nodeType==1)return pl(c.getBoundingClientRect(),!1)}if(i==null&&r<Ht(o)){let c=o.childNodes[r];if(c.nodeType==1)return pl(c.getBoundingClientRect(),!0)}return pl(o.getBoundingClientRect(),n>=0)}if(i==null&&r&&(n<0||r==Ht(o))){let c=o.childNodes[r-1],d=c.nodeType==3?Tn(c,Ht(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return Ar(Qn(d,1),!1)}if(i==null&&r<Ht(o)){let c=o.childNodes[r];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?Tn(c,0,s?0:1):c.nodeType==1?c:null:null;if(d)return Ar(Qn(d,-1),!0)}return Ar(Qn(o.nodeType==3?Tn(o):o,-n),n>=0)}function Ar(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function pl(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function op(t,e,n){let o=t.state,r=t.root.activeElement;o!=e&&t.updateState(e),r!=t.dom&&t.focus();try{return n()}finally{o!=e&&t.updateState(o),r!=t.dom&&r&&r.focus()}}function _x(t,e,n){let o=e.selection,r=n=="up"?o.$from:o.$to;return op(t,e,()=>{let{node:i}=t.docView.domFromPos(r.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=np(t,r.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let c;if(l.nodeType==1)c=l.getClientRects();else if(l.nodeType==3)c=Tn(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const Ax=/[\u0590-\u08ac]/;function Mx(t,e,n){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,s=r==o.parent.content.size,l=t.domSelection();return l?!Ax.test(o.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:op(t,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:f}=t.domSelectionRange(),p=l.caretBidiLevel;l.modify("move",n,"character");let h=o.depth?t.docView.domAfterPos(o.before()):t.dom,{focusNode:m,focusOffset:b}=t.domSelectionRange(),g=m&&!h.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==b;try{l.collapse(u,f),c&&(c!=u||d!=f)&&l.extend&&l.extend(c,d)}catch{}return p!=null&&(l.caretBidiLevel=p),g}):o.pos==o.start()||o.pos==o.end()}let rp=null,ip=null,sp=!1;function Ix(t,e,n){return rp==e&&ip==n?sp:(rp=e,ip=n,sp=n=="up"||n=="down"?_x(t,e,n):Mx(t,e,n))}const qt=0,ap=1,So=2,mn=3;class Mr{constructor(e,n,o,r){this.parent=e,this.children=n,this.dom=o,this.contentDOM=r,this.dirty=qt,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,o){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,o=this.posAtStart;;n++){let r=this.children[n];if(r==e)return o;o+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=n>ht(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!1;break}if(i.previousSibling)break}if(r==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!0;break}if(i.nextSibling)break}}return r??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let o=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),s;if(i&&(!n||i.node))if(o&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))o=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let o=n;o;o=o.parent)if(o==this)return n}posFromDOM(e,n,o){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,n,o)}return-1}descAt(e){for(let n=0,o=0;n<this.children.length;n++){let r=this.children[n],i=o+r.size;if(o==e&&i!=o){for(;!r.border&&r.children.length;)for(let s=0;s<r.children.length;s++){let l=r.children[s];if(l.size){r=l;break}}return r}if(e<i)return r.descAt(e-o-r.border);o=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,r=0;for(let i=0;o<this.children.length;o++){let s=this.children[o],l=i+s.size;if(l>e||s instanceof dp){r=e-i;break}i=l}if(r)return this.children[o].domFromPos(r-this.children[o].border,n);for(let i;o&&!(i=this.children[o-1]).size&&i instanceof lp&&i.side>=0;o--);if(n<=0){let i,s=!0;for(;i=o?this.children[o-1]:null,!(!i||i.dom.parentNode==this.contentDOM);o--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?ht(i.dom)+1:0}}else{let i,s=!0;for(;i=o<this.children.length?this.children[o]:null,!(!i||i.dom.parentNode==this.contentDOM);o++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?ht(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=o,l=0;;l++){let c=this.children[l],d=s+c.size;if(r==-1&&e<=d){let u=s+c.border;if(e>=u&&n<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,u);e=s;for(let f=l;f>0;f--){let p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=ht(p.dom)+1;break}e-=p.size}r==-1&&(r=0)}if(r>-1&&(d>n||l==this.children.length-1)){n=d;for(let u=l+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=ht(f.dom);break}n+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=d}return{node:this.contentDOM,from:e,to:n,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:o}=this.domFromPos(e,0);if(n.nodeType!=1||o==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[o]}setSelection(e,n,o,r=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let h=0,m=0;h<this.children.length;h++){let b=this.children[h],g=m+b.size;if(i>m&&s<g)return b.setSelection(e-m-b.border,n-m-b.border,o,r);m=g}let l=this.domFromPos(e,e?-1:1),c=n==e?l:this.domFromPos(n,n?-1:1),d=o.root.getSelection(),u=o.domSelectionRange(),f=!1;if((Wt||mt)&&e==n){let{node:h,offset:m}=l;if(h.nodeType==3){if(f=!!(m&&h.nodeValue[m-1]==`
|
|
354
|
-
`),f&&m==h.nodeValue.length)for(let b=h,g;b;b=b.parentNode){if(g=b.nextSibling){g.nodeName=="BR"&&(l=c={node:g.parentNode,offset:ht(g)+1});break}let x=b.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let b=h.childNodes[m-1];f=b&&(b.nodeName=="BR"||b.contentEditable=="false")}}if(Wt&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(r=!0)}if(!(r||f&&mt)&&ko(l.node,l.offset,u.anchorNode,u.anchorOffset)&&ko(c.node,c.offset,u.focusNode,u.focusOffset))return;let p=!1;if((d.extend||e==n)&&!(f&&Wt)){d.collapse(l.node,l.offset);try{e!=n&&d.extend(c.node,c.offset),p=!0}catch{}}if(!p){if(e>n){let m=l;l=c,c=m}let h=document.createRange();h.setEnd(c.node,c.offset),h.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let o=0,r=0;r<this.children.length;r++){let i=this.children[r],s=o+i.size;if(o==s?e<=s&&n>=o:e<s&&n>o){let l=o+i.border,c=s-i.border;if(e>=l&&n<=c){this.dirty=e==o||n==s?So:ap,e==l&&n==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=mn:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?So:mn}o=s}this.dirty=So}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let o=e==1?So:ap;n.dirty<o&&(n.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class lp extends Mr{constructor(e,n,o,r){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(o,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==qt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Ox extends Mr{constructor(e,n,o,r){super(e,[],n,null),this.textDOM=o,this.text=r}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class No extends Mr{constructor(e,n,o,r,i){super(e,[],o,r),this.mark=n,this.spec=i}static create(e,n,o,r){let i=r.nodeViews[n.type.name],s=i&&i(n,r,o);return(!s||!s.dom)&&(s=xo.renderSpec(document,n.type.spec.toDOM(n,o),null,n.attrs)),new No(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&mn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=mn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=qt){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=qt}}slice(e,n,o){let r=No.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;n<s&&(i=ml(i,n,s,o)),e>0&&(i=ml(i,0,e,o));for(let l=0;l<i.length;l++)i[l].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Zn extends Mr{constructor(e,n,o,r,i,s,l,c,d){super(e,[],i,s),this.node=n,this.outerDeco=o,this.innerDeco=r,this.nodeDOM=l}static create(e,n,o,r,i,s){let l=i.nodeViews[n.type.name],c,d=l&&l(n,i,()=>{if(!c)return s;if(c.parent)return c.parent.posBeforeChild(c)},o,r),u=d&&d.dom,f=d&&d.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=xo.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let p=u;return u=pp(u,o,n),d?c=new Dx(e,n,o,r,u,f||null,p,d,i,s+1):n.isText?new Ui(e,n,o,r,u,p,i):new Zn(e,n,o,r,u,f||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let o=this.children[n];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>ne.empty)}return e}matchesNode(e,n,o){return this.dirty==qt&&e.eq(this.node)&&Hi(n,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let o=this.node.inlineContent,r=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,c=new Px(this,s&&s.node,e);Vx(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?c.syncToMarks(d.spec.marks,o,e,u):d.type.side>=0&&!f&&c.syncToMarks(u==this.node.childCount?je.none:this.node.child(u).marks,o,e,u),c.placeWidget(d,e,r)},(d,u,f,p)=>{c.syncToMarks(d.marks,o,e,p);let h;c.findNodeMatch(d,u,f,p)||l&&e.state.selection.from>r&&e.state.selection.to<r+d.nodeSize&&(h=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(d,u,f,h,e)||c.updateNextNode(d,u,f,e,p,r)||c.addNode(d,u,f,e,r),r+=d.nodeSize}),c.syncToMarks([],o,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==So)&&(s&&this.protectLocalComposition(e,s),up(this.contentDOM,this.children,e),Wo&&Bx(this.dom))}localCompositionInfo(e,n){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof Oe)||o<n||r>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=Fx(this.node.content,s,o-n,r-n);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:o,text:r}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new Ox(this,i,n,r);e.input.compositionNodes.push(s),this.children=ml(this.children,o,o+r.length,e,s)}update(e,n,o,r){return this.dirty==mn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,o,r),!0)}updateInner(e,n,o,r){this.updateOuterDeco(n),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=qt}updateOuterDeco(e){if(Hi(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=fp(this.dom,this.nodeDOM,hl(this.outerDeco,this.node,n),hl(e,this.node,n)),this.dom!=o&&(o.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function cp(t,e,n,o,r){pp(o,e,t);let i=new Zn(void 0,t,e,n,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class Ui extends Zn{constructor(e,n,o,r,i,s,l){super(e,n,o,r,i,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,o,r){return this.dirty==mn||this.dirty!=qt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=qt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=qt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,o){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,o){let r=this.node.cut(e,n),i=document.createTextNode(r.text);return new Ui(this.parent,r,this.outerDeco,this.innerDeco,i,i,o)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=mn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class dp extends Mr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==qt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Dx extends Zn{constructor(e,n,o,r,i,s,l,c,d,u){super(e,n,o,r,i,s,l,d,u),this.spec=c}update(e,n,o,r){if(this.dirty==mn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,o);return i&&this.updateInner(e,n,o,r),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,o,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,o,r){this.spec.setSelection?this.spec.setSelection(e,n,o.root):super.setSelection(e,n,o,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function up(t,e,n){let o=t.firstChild,r=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==t){for(;l!=o;)o=hp(o),r=!0;o=o.nextSibling}else r=!0,t.insertBefore(l,o);if(s instanceof No){let c=o?o.previousSibling:t.lastChild;up(s.contentDOM,s.children,n),o=c?c.nextSibling:t.firstChild}}for(;o;)o=hp(o),r=!0;r&&n.trackWrites==t&&(n.trackWrites=null)}const Ir=function(t){t&&(this.nodeName=t)};Ir.prototype=Object.create(null);const Co=[new Ir];function hl(t,e,n){if(t.length==0)return Co;let o=n?Co[0]:new Ir,r=[o];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&r.push(o=new Ir(s.nodeName));for(let l in s){let c=s[l];c!=null&&(n&&r.length==1&&r.push(o=new Ir(e.isInline?"span":"div")),l=="class"?o.class=(o.class?o.class+" ":"")+c:l=="style"?o.style=(o.style?o.style+";":"")+c:l!="nodeName"&&(o[l]=c))}}}return r}function fp(t,e,n,o){if(n==Co&&o==Co)return e;let r=e;for(let i=0;i<o.length;i++){let s=o[i],l=n[i];if(i){let c;l&&l.nodeName==s.nodeName&&r!=t&&(c=r.parentNode)&&c.nodeName.toLowerCase()==s.nodeName||(c=document.createElement(s.nodeName),c.pmIsDeco=!0,c.appendChild(r),l=Co[0]),r=c}Rx(r,l||Co[0],s)}return r}function Rx(t,e,n){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in n)&&t.removeAttribute(o);for(let o in n)o!="class"&&o!="style"&&o!="nodeName"&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){let o=e.class?e.class.split(" ").filter(Boolean):[],r=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.remove(o[i]);for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.add(r[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=o.exec(e.style);)t.style.removeProperty(r[1])}n.style&&(t.style.cssText+=n.style)}}function pp(t,e,n){return fp(t,t,Co,hl(e,n,t.nodeType!=1))}function Hi(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function hp(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Px{constructor(e,n,o){this.lock=n,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Lx(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let o=e;o<n;o++)this.top.children[o].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,o,r){let i=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;i<l&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=qt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let c=-1,d=this.top.children.length;r<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let u=this.index;u<d;u++){let f=this.top.children[u];if(f.matchesMark(e[s])&&!this.isLocked(f.dom)){c=u;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let u=No.create(this.top,e[s],n,o);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,o,r){let i=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,o))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,c=Math.min(this.top.children.length,l+5);l<c;l++){let d=this.top.children[l];if(d.matchesNode(e,n,o)&&!this.preMatch.matched.has(d)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,o,r,i){let s=this.top.children[r];return s.dirty==mn&&s.dom==s.contentDOM&&(s.dirty=So),s.update(e,n,o,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==o)return r}return-1}e=n}}updateNextNode(e,n,o,r,i,s){for(let l=this.index;l<this.top.children.length;l++){let c=this.top.children[l];if(c instanceof Zn){let d=this.preMatch.matched.get(c);if(d!=null&&d!=i)return!1;let u=c.dom,f,p=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=mn&&Hi(n,c.outerDeco));if(!p&&c.update(e,n,o,r))return this.destroyBetween(this.index,l),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!p&&(f=this.recreateWrapper(c,e,n,o,r,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=So,f.updateChildren(r,s+1),f.dirty=qt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,o,r,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Hi(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=Zn.create(this.top,n,o,r,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let c of l.children)c.parent=l}return e.destroy(),l}addNode(e,n,o,r,i){let s=Zn.create(this.top,e,n,o,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,o){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let i=new lp(this.top,e,n,o);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof No;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Ui)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((mt||ut)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let r=new dp(this.top,[],o,null);n!=this.top?n.children.push(r):n.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Lx(t,e){let n=e,o=n.children.length,r=t.childCount,i=new Map,s=[];e:for(;r>0;){let l;for(;;)if(o){let d=n.children[o-1];if(d instanceof No)n=d,o=d.children.length;else{l=d,o--;break}}else{if(n==e)break e;o=n.parent.children.indexOf(n),n=n.parent}let c=l.node;if(c){if(c!=t.child(r-1))break;--r,i.set(l,r),s.push(l)}}return{index:r,matched:i,matches:s.reverse()}}function $x(t,e){return t.type.side-e.type.side}function Vx(t,e,n,o){let r=e.locals(t),i=0;if(r.length==0){for(let d=0;d<t.childCount;d++){let u=t.child(d);o(u,r,e.forChild(i,u),d),i+=u.nodeSize}return}let s=0,l=[],c=null;for(let d=0;;){let u,f;for(;s<r.length&&r[s].to==i;){let g=r[s++];g.widget&&(u?(f||(f=[u])).push(g):u=g)}if(u)if(f){f.sort($x);for(let g=0;g<f.length;g++)n(f[g],d,!!c)}else n(u,d,!!c);let p,h;if(c)h=-1,p=c,c=null;else if(d<t.childCount)h=d,p=t.child(d++);else break;for(let g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;s<r.length&&r[s].from<=i&&r[s].to>i;)l.push(r[s++]);let m=i+p.nodeSize;if(p.isText){let g=m;s<r.length&&r[s].from<g&&(g=r[s].from);for(let x=0;x<l.length;x++)l[x].to<g&&(g=l[x].to);g<m&&(c=p.cut(g-i),p=p.cut(0,g-i),m=g,h=-1)}else for(;s<r.length&&r[s].to<m;)s++;let b=p.isInline&&!p.isLeaf?l.filter(g=>!g.inline):l.slice();o(p,b,e.forChild(i,p),h),i=m}}function Bx(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Fx(t,e,n,o){for(let r=0,i=0;r<t.childCount&&i<=o;){let s=t.child(r++),l=i;if(i+=s.nodeSize,!s.isText)continue;let c=s.text;for(;r<t.childCount;){let d=t.child(r++);if(i+=d.nodeSize,!d.isText)break;c+=d.text}if(i>=n){if(i>=o&&c.slice(o-e.length-l,o-l)==e)return o-e.length;let d=l<o?c.lastIndexOf(e,o-l-1):-1;if(d>=0&&d+e.length+l>=n)return l+d;if(n==o&&c.length>=o+e.length-l&&c.slice(o-l,o-l+e.length)==e)return o}}return-1}function ml(t,e,n,o,r){let i=[];for(let s=0,l=0;s<t.length;s++){let c=t[s],d=l,u=l+=c.size;d>=n||u<=e?i.push(c):(d<e&&i.push(c.slice(0,e-d,o)),r&&(i.push(r),r=void 0),u>n&&i.push(c.slice(n-d,c.size,o)))}return i}function gl(t,e=null){let n=t.domSelectionRange(),o=t.state.doc;if(!n.focusNode)return null;let r=t.docView.nearestDesc(n.focusNode),i=r&&r.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=o.resolve(s),c,d;if(ji(n)){for(c=s;r&&!r.node;)r=r.parent;let f=r.node;if(r&&f.isAtom&&Ne.isSelectable(f)&&r.parent&&!(f.isInline&&hx(n.focusNode,n.focusOffset,r.dom))){let p=r.posBefore;d=new Ne(s==p?l:o.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=s,p=s;for(let h=0;h<n.rangeCount;h++){let m=n.getRangeAt(h);f=Math.min(f,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[c,s]=p==t.state.selection.anchor?[p,f]:[f,p],l=o.resolve(s)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=o.resolve(c);if(!d){let f=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;d=yl(t,u,l,f)}return d}function mp(t){return t.editable?t.hasFocus():wp(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function An(t,e=!1){let n=t.state.selection;if(xp(t,n),!!mp(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ut){let o=t.domSelectionRange(),r=t.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&ko(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Ux(t);else{let{anchor:o,head:r}=n,i,s;gp&&!(n instanceof Oe)&&(n.$from.parent.inlineContent||(i=bp(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=bp(t,n.to))),t.docView.setSelection(o,r,t,e),gp&&(i&&yp(i),s&&yp(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&jx(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const gp=mt||ut&&Kf<63;function bp(t,e){let{node:n,offset:o}=t.docView.domFromPos(e,0),r=o<n.childNodes.length?n.childNodes[o]:null,i=o?n.childNodes[o-1]:null;if(mt&&r&&r.contentEditable=="false")return bl(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return bl(r);if(i)return bl(i)}}function bl(t){return t.contentEditable="true",mt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function yp(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function jx(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),o=n.anchorNode,r=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=o||n.anchorOffset!=r)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!mp(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Ux(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,o=n.nodeName=="IMG";o?e.collapse(n.parentNode,ht(n)+1):e.collapse(n,0),!o&&!t.state.selection.visible&&Dt&&Yn<=11&&(n.disabled=!0,n.disabled=!1)}function xp(t,e){if(e instanceof Ne){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Ep(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Ep(t)}function Ep(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function yl(t,e,n,o){return t.someProp("createSelectionBetween",r=>r(t,e,n))||Oe.between(e,n,o)}function kp(t){return t.editable&&!t.hasFocus()?!1:wp(t)}function wp(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Hx(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ko(e.node,e.offset,n.anchorNode,n.anchorOffset)}function xl(t,e){let{$anchor:n,$head:o}=t.selection,r=e>0?n.max(o):n.min(o),i=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return i&&Pe.findFrom(i,e)}function eo(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Sp(t,e,n){let o=t.state.selection;if(o instanceof Oe)if(n.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return eo(t,new Oe(o.$anchor,s))}else if(o.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=xl(t.state,e);return r&&r instanceof Ne?eo(t,r):!1}else if(!(Gt&&n.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?Ne.isSelectable(i)?eo(t,new Ne(e<0?t.state.doc.resolve(r.pos-i.nodeSize):r)):_r?eo(t,new Oe(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof Ne&&o.node.isInline)return eo(t,new Oe(e>0?o.$to:o.$from));{let r=xl(t.state,e);return r?eo(t,r):!1}}}function Wi(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Or(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function qo(t,e){return e<0?Wx(t):Gx(t)}function Wx(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r,i,s=!1;for(Wt&&n.nodeType==1&&o<Wi(n)&&Or(n.childNodes[o],-1)&&(s=!0);;)if(o>0){if(n.nodeType!=1)break;{let l=n.childNodes[o-1];if(Or(l,-1))r=n,i=--o;else if(l.nodeType==3)n=l,o=n.nodeValue.length;else break}}else{if(Np(n))break;{let l=n.previousSibling;for(;l&&Or(l,-1);)r=n.parentNode,i=ht(l),l=l.previousSibling;if(l)n=l,o=Wi(n);else{if(n=n.parentNode,n==t.dom)break;o=0}}}s?El(t,n,o):r&&El(t,r,i)}function Gx(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r=Wi(n),i,s;for(;;)if(o<r){if(n.nodeType!=1)break;let l=n.childNodes[o];if(Or(l,1))i=n,s=++o;else break}else{if(Np(n))break;{let l=n.nextSibling;for(;l&&Or(l,1);)i=l.parentNode,s=ht(l)+1,l=l.nextSibling;if(l)n=l,o=0,r=Wi(n);else{if(n=n.parentNode,n==t.dom)break;o=r=0}}}i&&El(t,i,s)}function Np(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function qx(t,e){for(;t&&e==t.childNodes.length&&!zr(t);)e=ht(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Kx(t,e){for(;t&&!e&&!zr(t);)e=ht(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function El(t,e,n){if(e.nodeType!=3){let i,s;(s=qx(e,n))?(e=s,n=0):(i=Kx(e,n))&&(e=i,n=i.nodeValue.length)}let o=t.domSelection();if(!o)return;if(ji(o)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(e,n);t.domObserver.setCurSelection();let{state:r}=t;setTimeout(()=>{t.state==r&&An(t)},50)}function Cp(t,e){let n=t.state.doc.resolve(e);if(!(ut||Jf)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function vp(t,e,n){let o=t.state.selection;if(o instanceof Oe&&!o.empty||n.indexOf("s")>-1||Gt&&n.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=xl(t.state,e);if(s&&s instanceof Ne)return eo(t,s)}if(!r.parent.inlineContent){let s=e<0?r:i,l=o instanceof Bt?Pe.near(s,e):Pe.findFrom(s,e);return l?eo(t,l):!1}return!1}function Tp(t,e){if(!(t.state.selection instanceof Oe))return!0;let{$head:n,$anchor:o,empty:r}=t.state.selection;if(!n.sameParent(o))return!0;if(!r)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function zp(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Jx(t){if(!mt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;zp(t,o,"true"),setTimeout(()=>zp(t,o,"false"),20)}return!1}function Xx(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Yx(t,e){let n=e.keyCode,o=Xx(e);if(n==8||Gt&&n==72&&o=="c")return Tp(t,-1)||qo(t,-1);if(n==46&&!e.shiftKey||Gt&&n==68&&o=="c")return Tp(t,1)||qo(t,1);if(n==13||n==27)return!0;if(n==37||Gt&&n==66&&o=="c"){let r=n==37?Cp(t,t.state.selection.from)=="ltr"?-1:1:-1;return Sp(t,r,o)||qo(t,r)}else if(n==39||Gt&&n==70&&o=="c"){let r=n==39?Cp(t,t.state.selection.from)=="ltr"?1:-1:1;return Sp(t,r,o)||qo(t,r)}else{if(n==38||Gt&&n==80&&o=="c")return vp(t,-1,o)||qo(t,-1);if(n==40||Gt&&n==78&&o=="c")return Jx(t)||vp(t,1,o)||qo(t,1);if(o==(Gt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function kl(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:o,openStart:r,openEnd:i}=e;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let h=o.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let s=t.someProp("clipboardSerializer")||xo.fromSchema(t.state.schema),l=Pp(),c=l.createElement("div");c.appendChild(s.serializeFragment(o,{document:l}));let d=c.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=Dp[d.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=l.createElement(u[h]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),f++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${r} ${i}${f?` -${f}`:""} ${JSON.stringify(n)}`);let p=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
|
|
355
|
-
|
|
356
|
-
`);return{dom:c,text:p,slice:e}}function _p(t,e,n,o,r){let i=r.parent.type.spec.code,s,l;if(!n&&!e)return null;let c=!!e&&(o||i||!n);if(c){if(t.someProp("transformPastedText",p=>{e=p(e,i||o,t)}),i)return l=new ue(ne.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
357
|
-
`))),0,0),t.someProp("transformPasted",p=>{l=p(l,t,!0)}),l;let f=t.someProp("clipboardTextParser",p=>p(e,r,o,t));if(f)l=f;else{let p=r.marks(),{schema:h}=t.state,m=xo.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(b=>{let g=s.appendChild(document.createElement("p"));b&&g.appendChild(m.serializeNode(h.text(b,p)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),s=tE(n),_r&&nE(s);let d=s&&s.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||kr.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||u),context:r,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!Qx.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)l=oE(Op(l,+u[1],+u[2]),u[4]);else if(l=ue.maxOpen(Zx(l.content,r),!0),l.openStart||l.openEnd){let f=0,p=0;for(let h=l.content.firstChild;f<l.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=l.content.lastChild;p<l.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);l=Op(l,f,p)}return t.someProp("transformPasted",f=>{l=f(l,t,c)}),l}const Qx=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Zx(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(l=>{if(!s)return;let c=r.findWrapping(l.type),d;if(!c)return s=null;if(d=s.length&&i.length&&Mp(c,i,l,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=Ip(s[s.length-1],i.length));let u=Ap(l,c);s.push(u),r=r.matchType(u.type),i=c}}),s)return ne.from(s)}return t}function Ap(t,e,n=0){for(let o=e.length-1;o>=n;o--)t=e[o].create(null,ne.from(t));return t}function Mp(t,e,n,o,r){if(r<t.length&&r<e.length&&t[r]==e[r]){let i=Mp(t,e,n,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==t.length-1?n.type:t[r+1]))return o.copy(o.content.append(ne.from(Ap(n,t,r+1))))}}function Ip(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Ip(t.lastChild,e-1)),o=t.contentMatchAt(t.childCount).fillBefore(ne.empty,!0);return t.copy(n.append(o))}function wl(t,e,n,o,r,i){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(i=0),r<o-1&&(l=wl(l,e,n,o,r+1,i)),r>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(ne.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function Op(t,e,n){return e<t.openStart&&(t=new ue(wl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ue(wl(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Dp={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Rp=null;function Pp(){return Rp||(Rp=document.implementation.createHTMLDocument("title"))}let Sl=null;function eE(t){let e=window.trustedTypes;return e?(Sl||(Sl=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Sl.createHTML(t)):t}function tE(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Pp().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t),r;if((r=o&&Dp[o[1].toLowerCase()])&&(t=r.map(i=>"<"+i+">").join("")+t+r.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=eE(t),r)for(let i=0;i<r.length;i++)n=n.querySelector(r[i])||n;return n}function nE(t){let e=t.querySelectorAll(ut?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let o=e[n];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),o)}}function oE(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return t}let{content:r,openStart:i,openEnd:s}=t;for(let l=o.length-2;l>=0;l-=2){let c=n.nodes[o[l]];if(!c||c.hasRequiredAttrs())break;r=ne.from(c.create(o[l+1],r)),i++,s++}return new ue(r,i,s)}const zt={},_t={},rE={touchstart:!0,touchmove:!0};class iE{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function sE(t){for(let e in zt){let n=zt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=o=>{lE(t,o)&&!Cl(t,o)&&(t.editable||!(o.type in _t))&&n(t,o)},rE[e]?{passive:!0}:void 0)}mt&&t.dom.addEventListener("input",()=>null),Nl(t)}function to(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function aE(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Nl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=o=>Cl(t,o))})}function Cl(t,e){return t.someProp("handleDOMEvents",n=>{let o=n[e.type];return o?o(t,e)||e.defaultPrevented:!1})}function lE(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function cE(t,e){!Cl(t,e)&&zt[e.type]&&(t.editable||!(e.type in _t))&&zt[e.type](t,e)}_t.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!$p(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(zn&&ut&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Wo&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let o=Date.now();t.input.lastIOSEnter=o,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==o&&(t.someProp("handleKeyDown",r=>r(t,wo(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",o=>o(t,n))||Yx(t,n)?n.preventDefault():to(t,"key")},_t.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},_t.keypress=(t,e)=>{let n=e;if($p(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Gt&&n.metaKey)return;if(t.someProp("handleKeyPress",r=>r(t,n))){n.preventDefault();return}let o=t.state.selection;if(!(o instanceof Oe)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!t.someProp("handleTextInput",s=>s(t,o.$from.pos,o.$to.pos,r,i))&&t.dispatch(i()),n.preventDefault()}};function Gi(t){return{left:t.clientX,top:t.clientY}}function dE(t,e){let n=e.x-t.clientX,o=e.y-t.clientY;return n*n+o*o<100}function vl(t,e,n,o,r){if(o==-1)return!1;let i=t.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,l=>s>i.depth?l(t,n,i.nodeAfter,i.before(s),r,!0):l(t,n,i.node(s),i.before(s),r,!1)))return!0;return!1}function Ko(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let o=t.state.tr.setSelection(e);o.setMeta("pointer",!0),t.dispatch(o)}function uE(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),o=n.nodeAfter;return o&&o.isAtom&&Ne.isSelectable(o)?(Ko(t,new Ne(n)),!0):!1}function fE(t,e){if(e==-1)return!1;let n=t.state.selection,o,r;n instanceof Ne&&(o=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(Ne.isSelectable(l)){o&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?r=i.before(n.$from.depth):r=i.before(s);break}}return r!=null?(Ko(t,Ne.create(t.state.doc,r)),!0):!1}function pE(t,e,n,o,r){return vl(t,"handleClickOn",e,n,o)||t.someProp("handleClick",i=>i(t,e,o))||(r?fE(t,n):uE(t,n))}function hE(t,e,n,o){return vl(t,"handleDoubleClickOn",e,n,o)||t.someProp("handleDoubleClick",r=>r(t,e,o))}function mE(t,e,n,o){return vl(t,"handleTripleClickOn",e,n,o)||t.someProp("handleTripleClick",r=>r(t,e,o))||gE(t,n,o)}function gE(t,e,n){if(n.button!=0)return!1;let o=t.state.doc;if(e==-1)return o.inlineContent?(Ko(t,Oe.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let s=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(s.inlineContent)Ko(t,Oe.create(o,l+1,l+1+s.content.size));else if(Ne.isSelectable(s))Ko(t,Ne.create(o,l));else continue;return!0}}function Tl(t){return qi(t)}const Lp=Gt?"metaKey":"ctrlKey";zt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let o=Tl(t),r=Date.now(),i="singleClick";r-t.input.lastClick.time<500&&dE(n,t.input.lastClick)&&!n[Lp]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(Gi(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new bE(t,s,n,!!o)):(i=="doubleClick"?hE:mE)(t,s.pos,s.inside,n)?n.preventDefault():to(t,"pointer"))};class bE{constructor(e,n,o,r){this.view=e,this.pos=n,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[Lp],this.allowDefault=o.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const l=r?null:o.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:d}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||d instanceof Ne&&d.from<=s&&d.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Wt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),to(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>An(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Gi(e))),this.updateAllowDefault(e),this.allowDefault||!n?to(this.view,"pointer"):pE(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||mt&&this.mightDrag&&!this.mightDrag.node.isAtom||ut&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Ko(this.view,Pe.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):to(this.view,"pointer")}move(e){this.updateAllowDefault(e),to(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}zt.touchstart=t=>{t.input.lastTouch=Date.now(),Tl(t),to(t,"pointer")},zt.touchmove=t=>{t.input.lastTouch=Date.now(),to(t,"pointer")},zt.contextmenu=t=>Tl(t);function $p(t,e){return t.composing?!0:mt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const yE=zn?5e3:-1;_t.compositionstart=_t.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Oe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||ut&&Jf&&xE(t)))t.markCursor=t.state.storedMarks||n.marks(),qi(t,!0),t.markCursor=null;else if(qi(t,!e.selection.empty),Wt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let o=t.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else r=s,i=-1}}t.input.composing=!0}Vp(t,yE)};function xE(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let o=e.childNodes[n];return o.nodeType==1&&o.contentEditable=="false"}_t.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Vp(t,20))};function Vp(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>qi(t),e))}function Bp(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=kE());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function EE(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=fx(e.focusNode,e.focusOffset),o=px(e.focusNode,e.focusOffset);if(n&&o&&n!=o){let r=o.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||o==i)return i;if(!r||!r.isText(o.nodeValue))return o;if(t.input.compositionNode==o){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return o}}return n||o}function kE(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function qi(t,e=!1){if(!(zn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Bp(t),e||t.docView&&t.docView.dirty){let n=gl(t),o=t.state.selection;return n&&!n.eq(o)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function wE(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Dr=Dt&&Yn<15||Wo&&bx<604;zt.copy=_t.cut=(t,e)=>{let n=e,o=t.state.selection,r=n.type=="cut";if(o.empty)return;let i=Dr?null:n.clipboardData,s=o.content(),{dom:l,text:c}=kl(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",c)):wE(t,l),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function SE(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function NE(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,o=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),o.parentNode&&o.parentNode.removeChild(o),n?Rr(t,o.value,null,r,e):Rr(t,o.textContent,o.innerHTML,r,e)},50)}function Rr(t,e,n,o,r){let i=_p(t,e,n,o,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,r,i||ue.empty)))return!0;if(!i)return!1;let s=SE(i),l=s?t.state.tr.replaceSelectionWith(s,o):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Fp(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}_t.paste=(t,e)=>{let n=e;if(t.composing&&!zn)return;let o=Dr?null:n.clipboardData,r=t.input.shiftKey&&t.input.lastKeyCode!=45;o&&Rr(t,Fp(o),o.getData("text/html"),r,n)?n.preventDefault():NE(t,n)};class jp{constructor(e,n,o){this.slice=e,this.move=n,this.node=o}}const CE=Gt?"altKey":"ctrlKey";function Up(t,e){let n=t.someProp("dragCopies",o=>!o(e));return n??!e[CE]}zt.dragstart=(t,e)=>{let n=e,o=t.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let r=t.state.selection,i=r.empty?null:t.posAtCoords(Gi(n)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof Ne?r.to-1:r.to))){if(o&&o.mightDrag)s=Ne.create(t.state.doc,o.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(s=Ne.create(t.state.doc,f.posBefore))}}let l=(s||t.state.selection).content(),{dom:c,text:d,slice:u}=kl(t,l);(!n.dataTransfer.files.length||!ut||Kf>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Dr?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Dr||n.dataTransfer.setData("text/plain",d),t.dragging=new jp(u,Up(t,n),s)},zt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},_t.dragover=_t.dragenter=(t,e)=>e.preventDefault(),_t.drop=(t,e)=>{try{vE(t,e,t.dragging)}finally{t.dragging=null}};function vE(t,e,n){if(!e.dataTransfer)return;let o=t.posAtCoords(Gi(e));if(!o)return;let r=t.state.doc.resolve(o.pos),i=n&&n.slice;i?t.someProp("transformPasted",h=>{i=h(i,t,!1)}):i=_p(t,Fp(e.dataTransfer),Dr?null:e.dataTransfer.getData("text/html"),!1,r);let s=!!(n&&Up(t,e));if(t.someProp("handleDrop",h=>h(t,e,i||ue.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?O0(t.state.doc,r.pos,i):r.pos;l==null&&(l=r.pos);let c=t.state.tr;if(s){let{node:h}=n;h?h.replace(c):c.deleteSelection()}let d=c.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=c.doc;if(u?c.replaceRangeWith(d,d,i.content.firstChild):c.replaceRange(d,d,i),c.doc.eq(f))return;let p=c.doc.resolve(d);if(u&&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,b,g,x)=>h=x),c.setSelection(yl(t,p,c.doc.resolve(h)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}zt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&An(t)},20))},zt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},zt.beforeinput=(t,e)=>{if(ut&&zn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:o}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=o||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,wo(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in _t)zt[t]=_t[t];function Pr(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Ki{constructor(e,n){this.toDOM=e,this.spec=n||vo,this.side=this.spec.side||0}map(e,n,o,r){let{pos:i,deleted:s}=e.mapResult(n.from+r,this.side<0?-1:1);return s?null:new ln(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof Ki&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Pr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class no{constructor(e,n){this.attrs=e,this.spec=n||vo}map(e,n,o,r){let i=e.map(n.from+r,this.spec.inclusiveStart?-1:1)-o,s=e.map(n.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new ln(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof no&&Pr(this.attrs,e.attrs)&&Pr(this.spec,e.spec)}static is(e){return e.type instanceof no}destroy(){}}class zl{constructor(e,n){this.attrs=e,this.spec=n||vo}map(e,n,o,r){let i=e.mapResult(n.from+r,1);if(i.deleted)return null;let s=e.mapResult(n.to+r,-1);return s.deleted||s.pos<=i.pos?null:new ln(i.pos-o,s.pos-o,this)}valid(e,n){let{index:o,offset:r}=e.content.findIndex(n.from),i;return r==n.from&&!(i=e.child(o)).isText&&r+i.nodeSize==n.to}eq(e){return this==e||e instanceof zl&&Pr(this.attrs,e.attrs)&&Pr(this.spec,e.spec)}destroy(){}}class ln{constructor(e,n,o){this.from=e,this.to=n,this.type=o}copy(e,n){return new ln(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,o){return this.type.map(e,this,n,o)}static widget(e,n,o){return new ln(e,e,new Ki(n,o))}static inline(e,n,o,r){return new ln(e,n,new no(o,r))}static node(e,n,o,r){return new ln(e,n,new zl(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof no}get widget(){return this.type instanceof Ki}}const Jo=[],vo={};class ft{constructor(e,n){this.local=e.length?e:Jo,this.children=n.length?n:Jo}static create(e,n){return n.length?Ji(n,e,0,vo):Et}find(e,n,o){let r=[];return this.findInner(e??0,n??1e9,r,0,o),r}findInner(e,n,o,r,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,o,r+l,i)}}map(e,n,o){return this==Et||e.maps.length==0?this:this.mapInner(e,n,0,0,o||vo)}mapInner(e,n,o,r,i){let s;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,o,r);c&&c.type.valid(n,c)?(s||(s=[])).push(c):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?TE(this.children,s||[],e,n,o,r,i):s?new ft(s.sort(To),Jo):Et}add(e,n){return n.length?this==Et?ft.create(e,n):this.addInner(e,n,0):this}addInner(e,n,o){let r,i=0;e.forEach((l,c)=>{let d=c+o,u;if(u=Wp(n,l,d)){for(r||(r=this.children.slice());i<r.length&&r[i]<c;)i+=3;r[i]==c?r[i+2]=r[i+2].addInner(l,u,d+1):r.splice(i,0,c,c+l.nodeSize,Ji(u,l,d+1,vo)),i+=3}});let s=Hp(i?Gp(n):n,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new ft(s.length?this.local.concat(s).sort(To):this.local,r||this.children)}remove(e){return e.length==0||this==Et?this:this.removeInner(e,0)}removeInner(e,n){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let s,l=o[i]+n,c=o[i+1]+n;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>l&&f.to<c&&(e[u]=null,(s||(s=[])).push(f));if(!s)continue;o==this.children&&(o=this.children.slice());let d=o[i+2].removeInner(s,l+1);d!=Et?o[i+2]=d:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<r.length;l++)r[l].eq(s,n)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new ft(r,o):Et}forChild(e,n){if(this==Et)return this;if(n.isLeaf)return ft.empty;let o,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let i=e+1,s=i+n.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<s&&c.to>i&&c.type instanceof no){let d=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;d<u&&(r||(r=[])).push(c.copy(d,u))}}if(r){let l=new ft(r.sort(To),Jo);return o?new oo([l,o]):l}return o||Et}eq(e){if(this==e)return!0;if(!(e instanceof ft)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return _l(this.localsInner(e))}localsInner(e){if(this==Et)return Jo;if(e.inlineContent||!this.local.some(no.is))return this.local;let n=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof no||n.push(this.local[o]);return n}forEachSet(e){e(this)}}ft.empty=new ft([],[]),ft.removeOverlap=_l;const Et=ft.empty;class oo{constructor(e){this.members=e}map(e,n){const o=this.members.map(r=>r.map(e,n,vo));return oo.from(o)}forChild(e,n){if(n.isLeaf)return ft.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,n);i!=Et&&(i instanceof oo?o=o.concat(i.members):o.push(i))}return oo.from(o)}eq(e){if(!(e instanceof oo)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!n)n=i;else{o&&(n=n.slice(),o=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?_l(o?n:n.sort(To)):Jo}static from(e){switch(e.length){case 0:return Et;case 1:return e[0];default:return new oo(e.every(n=>n instanceof ft)?e:e.reduce((n,o)=>n.concat(o instanceof ft?o:o.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function TE(t,e,n,o,r,i,s){let l=t.slice();for(let d=0,u=i;d<n.maps.length;d++){let f=0;n.maps[d].forEach((p,h,m,b)=>{let g=b-m-(h-p);for(let x=0;x<l.length;x+=3){let v=l[x+1];if(v<0||p>v+u-f)continue;let w=l[x]+u-f;h>=w?l[x+1]=p<=w?-2:-1:p>=u&&g&&(l[x]+=g,l[x+1]+=g)}f+=g}),u=n.maps[d].map(u,-1)}let c=!1;for(let d=0;d<l.length;d+=3)if(l[d+1]<0){if(l[d+1]==-2){c=!0,l[d+1]=-1;continue}let u=n.map(t[d]+i),f=u-r;if(f<0||f>=o.content.size){c=!0;continue}let p=n.map(t[d+1]+i,-1),h=p-r,{index:m,offset:b}=o.content.findIndex(f),g=o.maybeChild(m);if(g&&b==f&&b+g.nodeSize==h){let x=l[d+2].mapInner(n,g,u+1,t[d]+i+1,s);x!=Et?(l[d]=f,l[d+1]=h,l[d+2]=x):(l[d+1]=-2,c=!0)}else c=!0}if(c){let d=zE(l,t,e,n,r,i,s),u=Ji(d,o,0,s);e=u.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,p=0;f<u.children.length;f+=3){let h=u.children[f];for(;p<l.length&&l[p]<h;)p+=3;l.splice(p,0,u.children[f],u.children[f+1],u.children[f+2])}}return new ft(e.sort(To),l)}function Hp(t,e){if(!e||!t.length)return t;let n=[];for(let o=0;o<t.length;o++){let r=t[o];n.push(new ln(r.from+e,r.to+e,r.type))}return n}function zE(t,e,n,o,r,i,s){function l(c,d){for(let u=0;u<c.local.length;u++){let f=c.local[u].map(o,r,d);f?n.push(f):s.onRemove&&s.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)l(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&l(t[c+2],e[c]+i+1);return n}function Wp(t,e,n){if(e.isLeaf)return null;let o=n+e.nodeSize,r=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<o&&((r||(r=[])).push(s),t[i]=null);return r}function Gp(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Ji(t,e,n,o){let r=[],i=!1;e.forEach((l,c)=>{let d=Wp(t,l,c+n);if(d){i=!0;let u=Ji(d,l,n+c+1,o);u!=Et&&r.push(c,c+l.nodeSize,u)}});let s=Hp(i?Gp(t):t,-n).sort(To);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(o.onRemove&&o.onRemove(s[l].spec),s.splice(l--,1));return s.length||r.length?new ft(s,r):Et}function To(t,e){return t.from-e.from||t.to-e.to}function _l(t){let e=t;for(let n=0;n<e.length-1;n++){let o=e[n];if(o.from!=o.to)for(let r=n+1;r<e.length;r++){let i=e[r];if(i.from==o.from){i.to!=o.to&&(e==t&&(e=t.slice()),e[r]=i.copy(i.from,o.to),qp(e,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(e==t&&(e=t.slice()),e[n]=o.copy(o.from,i.from),qp(e,r,o.copy(i.from,o.to)));break}}}return e}function qp(t,e,n){for(;e<t.length&&To(n,t[e])>0;)e++;t.splice(e,0,n)}function Al(t){let e=[];return t.someProp("decorations",n=>{let o=n(t.state);o&&o!=Et&&e.push(o)}),t.cursorWrapper&&e.push(ft.create(t.state.doc,[t.cursorWrapper.deco])),oo.from(e)}const _E={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},AE=Dt&&Yn<=11;class ME{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class IE{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ME,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let r=0;r<o.length;r++)this.queue.push(o[r]);Dt&&Yn<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():mt&&e.composing&&o.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),AE&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,_E)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(kp(this.view)){if(this.suppressingSelectionUpdates)return An(this.view);if(Dt&&Yn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ko(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,o;for(let i=e.focusNode;i;i=Ho(i))n.add(i);for(let i=e.anchorNode;i;i=Ho(i))if(n.has(i)){o=i;break}let r=o&&this.view.docView.nearestDesc(o);if(r&&r.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let o=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&kp(e)&&!this.ignoreSelectionChange(o),i=-1,s=-1,l=!1,c=[];if(e.editable)for(let u=0;u<n.length;u++){let f=this.registerMutation(n[u],c);f&&(i=i<0?f.from:Math.min(f.from,i),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(l=!0))}if(Wt&&c.length){let u=c.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,p]=u;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of u){let h=p.parentNode;h&&h.nodeName=="LI"&&(!f||RE(e,f)!=h)&&p.remove()}}}else if((ut||mt)&&c.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of c)if(u.nodeName=="BR"&&u.parentNode){let f=u.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&u.parentNode.removeChild(u)}}let d=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ji(o)&&(d=gl(e))&&d.eq(Pe.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,An(e),this.currentSelection.set(o),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,s),OE(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,PE(e,c)),this.handleDOMChange(i,s,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||An(e),this.currentSelection.set(o))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let f=e.addedNodes[u];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let r=e.previousSibling,i=e.nextSibling;if(Dt&&Yn<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:p}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(r=f),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(i=p)}let s=r&&r.parentNode==e.target?ht(r)+1:0,l=o.localPosFromDOM(e.target,s,-1),c=i&&i.parentNode==e.target?ht(i):e.target.childNodes.length,d=o.localPosFromDOM(e.target,c,1);return{from:l,to:d}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Kp=new WeakMap,Jp=!1;function OE(t){if(!Kp.has(t)&&(Kp.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Wt,Jp)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Jp=!0}}function Xp(t,e){let n=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return ko(s.node,s.offset,r,i)&&([n,o,r,i]=[r,i,n,o]),{anchorNode:n,anchorOffset:o,focusNode:r,focusOffset:i}}function DE(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return Xp(t,r)}let n;function o(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",o,!0),n?Xp(t,n):null}function RE(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let o=t.docView.nearestDesc(n,!0);if(o&&o.node.isBlock)return n}return null}function PE(t,e){var n;let{focusNode:o,focusOffset:r}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let c=l.firstChild;if(!c||c.nodeType!=1||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;l=c}l.insertBefore(i,l.firstChild),o==i&&t.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function LE(t,e,n){let{node:o,fromOffset:r,toOffset:i,from:s,to:l}=t.docView.parseRange(e,n),c=t.domSelectionRange(),d,u=c.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],ji(c)||d.push({node:c.focusNode,offset:c.focusOffset})),ut&&t.input.lastKeyCode===8)for(let g=i;g>r;g--){let x=o.childNodes[g-1],v=x.pmViewDesc;if(x.nodeName=="BR"&&!v){i=g;break}if(!v||v.size)break}let f=t.state.doc,p=t.someProp("domParser")||kr.fromSchema(t.state.schema),h=f.resolve(s),m=null,b=p.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:r,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:$E,context:h});if(d&&d[0].pos!=null){let g=d[0].pos,x=d[1]&&d[1].pos;x==null&&(x=g),m={anchor:g+s,head:x+s}}return{doc:b,sel:m,from:s,to:l}}function $E(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(mt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||mt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const VE=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function BE(t,e,n,o,r){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let y=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,E=gl(t,y);if(E&&!t.state.selection.eq(E)){if(ut&&zn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",D=>D(t,wo(13,"Enter"))))return;let S=t.state.tr.setSelection(E);y=="pointer"?S.setMeta("pointer",!0):y=="key"&&S.scrollIntoView(),i&&S.setMeta("composition",i),t.dispatch(S)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let c=t.state.selection,d=LE(t,e,n),u=t.state.doc,f=u.slice(d.from,d.to),p,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(p=t.state.selection.to,h="end"):(p=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let m=UE(f.content,d.doc.content,d.from,p,h);if(m&&t.input.domChangeCount++,(Wo&&t.input.lastIOSEnter>Date.now()-225||zn)&&r.some(y=>y.nodeType==1&&!VE.test(y.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",y=>y(t,wo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof Oe&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let y=Yp(t,t.state.doc,d.sel);if(y&&!y.eq(t.state.selection)){let E=t.state.tr.setSelection(y);i&&E.setMeta("composition",i),t.dispatch(E)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof Oe&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=d.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=d.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Dt&&Yn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)==" "&&(m.start--,m.endA--,m.endB--);let b=d.doc.resolveNoCache(m.start-d.from),g=d.doc.resolveNoCache(m.endB-d.from),x=u.resolve(m.start),v=b.sameParent(g)&&b.parent.inlineContent&&x.end()>=m.endA;if((Wo&&t.input.lastIOSEnter>Date.now()-225&&(!v||r.some(y=>y.nodeName=="DIV"||y.nodeName=="P"))||!v&&b.pos<d.doc.content.size&&(!b.sameParent(g)||!b.parent.inlineContent)&&b.pos<g.pos&&!/\S/.test(d.doc.textBetween(b.pos,g.pos,"","")))&&t.someProp("handleKeyDown",y=>y(t,wo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&jE(u,m.start,m.endA,b,g)&&t.someProp("handleKeyDown",y=>y(t,wo(8,"Backspace")))){zn&&ut&&t.domObserver.suppressSelectionUpdates();return}ut&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),zn&&!v&&b.start()!=g.start()&&g.parentOffset==0&&b.depth==g.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,g=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{t.someProp("handleKeyDown",function(y){return y(t,wo(13,"Enter"))})},20));let w=m.start,T=m.endA,M=y=>{let E=y||t.state.tr.replace(w,T,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let S=Yp(t,E.doc,d.sel);S&&!(ut&&t.composing&&S.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(S.head==w||S.head==E.mapping.map(T)-1)||Dt&&S.empty&&S.head==w)&&E.setSelection(S)}return i&&E.setMeta("composition",i),E.scrollIntoView()},A;if(v)if(b.pos==g.pos){Dt&&Yn<=11&&b.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>An(t),20));let y=M(t.state.tr.delete(w,T)),E=u.resolve(m.start).marksAcross(u.resolve(m.endA));E&&y.ensureMarks(E),t.dispatch(y)}else if(m.endA==m.endB&&(A=FE(b.parent.content.cut(b.parentOffset,g.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start())))){let y=M(t.state.tr);A.type=="add"?y.addMark(w,T,A.mark):y.removeMark(w,T,A.mark),t.dispatch(y)}else if(b.parent.child(b.index()).isText&&b.index()==g.index()-(g.textOffset?0:1)){let y=b.parent.textBetween(b.parentOffset,g.parentOffset),E=()=>M(t.state.tr.insertText(y,w,T));t.someProp("handleTextInput",S=>S(t,w,T,y,E))||t.dispatch(E())}else t.dispatch(M());else t.dispatch(M())}function Yp(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:yl(t,e.resolve(n.anchor),e.resolve(n.head))}function FE(t,e){let n=t.firstChild.marks,o=e.firstChild.marks,r=n,i=o,s,l,c;for(let u=0;u<o.length;u++)r=o[u].removeFromSet(r);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(r.length==1&&i.length==0)l=r[0],s="add",c=u=>u.mark(l.addToSet(u.marks));else if(r.length==0&&i.length==1)l=i[0],s="remove",c=u=>u.mark(l.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(ne.from(d).eq(t))return{mark:l,type:s}}function jE(t,e,n,o,r){if(n-e<=r.pos-o.pos||Ml(o,!0,!1)<r.pos)return!1;let i=t.resolve(e);if(!o.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(Ml(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Ml(s,!0,!1)<n?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function Ml(t,e,n){let o=t.depth,r=e?t.end():t.pos;for(;o>0&&(e||t.indexAfter(o)==t.node(o).childCount);)o--,r++,e=!1;if(n){let i=t.node(o).maybeChild(t.indexAfter(o));for(;i&&!i.isLeaf;)i=i.firstChild,r++}return r}function UE(t,e,n,o,r){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(r=="end"){let c=Math.max(0,i-Math.min(s,l));o-=s+c-i}if(s<i&&t.size<e.size){let c=o<=i&&o>=s?i-o:0;i-=c,i&&i<e.size&&Qp(e.textBetween(i-1,i+1))&&(i+=c?1:-1),l=i+(l-s),s=i}else if(l<i){let c=o<=i&&o>=l?i-o:0;i-=c,i&&i<t.size&&Qp(t.textBetween(i-1,i+1))&&(i+=c?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function Qp(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Zp{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new iE,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(rh),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=nh(this),th(this),this.nodeViews=oh(this),this.docView=cp(this.state.doc,eh(this),Al(this),this.dom,this),this.domObserver=new IE(this,(o,r,i,s)=>BE(this,o,r,i,s)),this.domObserver.start(),sE(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Nl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(rh),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let o in this._props)n[o]=this._props[o];n.state=this.state;for(let o in e)n[o]=e[o];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var o;let r=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Bp(this),s=!0),this.state=e;let l=r.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=oh(this);WE(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Nl(this),this.editable=nh(this),th(this);let c=Al(this),d=eh(this),u=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,d,c);(f||!e.selection.eq(r.selection))&&(s=!0);let p=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Ex(this);if(s){this.domObserver.stop();let h=f&&(Dt||ut)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&HE(r.selection,e.selection);if(f){let m=ut?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=EE(this)),(i||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=cp(e.doc,d,c,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Hx(this))?An(this,h):(xp(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((o=this.dragging)===null||o===void 0)&&o.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():p&&kx(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Ne){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Xf(this,n.getBoundingClientRect(),e)}else Xf(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let o=this.directPlugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let o=this.state.plugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let o=this.pluginViews[n];o.update&&o.update(this,e)}}updateDraggedNode(e,n){let o=e.node,r=-1;if(this.state.doc.nodeAt(o.from)==o.node)r=o.from;else{let i=o.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==o.node&&(r=i)}this.dragging=new jp(e.slice,e.move,r<0?void 0:Ne.create(this.state.doc,r))}someProp(e,n){let o=this._props&&this._props[e],r;if(o!=null&&(r=n?n(o):o))return r;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(r=n?n(l):l))return r}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(r=n?n(l):l))return r}}hasFocus(){if(Dt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&wx(this.dom),An(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Tx(this,e)}coordsAtPos(e,n=1){return np(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,o=-1){let r=this.docView.posFromDOM(e,n,o);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,n){return Ix(this,n||this.state,e)}pasteHTML(e,n){return Rr(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Rr(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return kl(this,e)}destroy(){this.docView&&(aE(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Al(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,dx())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return cE(this,e)}domSelectionRange(){let e=this.domSelection();return e?mt&&this.root.nodeType===11&&mx(this.dom.ownerDocument)==this.dom&&DE(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Zp.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function eh(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let o in n)o=="class"?e.class+=" "+n[o]:o=="style"?e.style=(e.style?e.style+";":"")+n[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(n[o]))}),e.translate||(e.translate="no"),[ln.node(0,t.state.doc.content.size,e)]}function th(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:ln.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function nh(t){return!t.someProp("editable",e=>e(t.state)===!1)}function HE(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function oh(t){let e=Object.create(null);function n(o){for(let r in o)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=o[r])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function WE(t,e){let n=0,o=0;for(let r in t){if(t[r]!=e[r])return!0;n++}for(let r in e)o++;return n!=o}function rh(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var ro={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Xi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},GE=typeof navigator<"u"&&/Mac/.test(navigator.platform),qE=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),gt=0;gt<10;gt++)ro[48+gt]=ro[96+gt]=String(gt);for(var gt=1;gt<=24;gt++)ro[gt+111]="F"+gt;for(var gt=65;gt<=90;gt++)ro[gt]=String.fromCharCode(gt+32),Xi[gt]=String.fromCharCode(gt);for(var Il in ro)Xi.hasOwnProperty(Il)||(Xi[Il]=ro[Il]);function KE(t){var e=GE&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||qE&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Xi:ro)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const JE=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),XE=typeof navigator<"u"&&/Win/.test(navigator.platform);function YE(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let o,r,i,s;for(let l=0;l<e.length-1;l++){let c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))JE?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+c)}return o&&(n="Alt-"+n),r&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function QE(t){let e=Object.create(null);for(let n in t)e[YE(n)]=t[n];return e}function Ol(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function ZE(t){return new Ot({props:{handleKeyDown:ek(t)}})}function ek(t){let e=QE(t);return function(n,o){let r=KE(o),i,s=e[Ol(r,o)];if(s&&s(n.state,n.dispatch,n))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[Ol(r,o,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(XE&&o.ctrlKey&&o.altKey)&&(i=ro[o.keyCode])&&i!=r){let l=e[Ol(i,o)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var tk=Object.defineProperty,Dl=(t,e)=>{for(var n in e)tk(t,n,{get:e[n],enumerable:!0})};function Yi(t){const{state:e,transaction:n}=t;let{selection:o}=n,{doc:r}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return o},get doc(){return r},get tr(){return o=n.selection,r=n.doc,i=n.storedMarks,n}}}var Qi=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:o}=e,{tr:r}=n,i=this.buildProps(r);return Object.fromEntries(Object.entries(t).map(([s,l])=>[s,(...d)=>{const u=l(...d)(i);return!r.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(r),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:o,state:r}=this,{view:i}=o,s=[],l=!!t,c=t||r.tr,d=()=>(!l&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(c),s.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(n).map(([f,p])=>[f,(...m)=>{const b=this.buildProps(c,e),g=p(...m)(b);return s.push(g),u}])),run:d};return u}createCan(t){const{rawCommands:e,state:n}=this,o=!1,r=t||n.tr,i=this.buildProps(r,o);return{...Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...d)=>c(...d)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,o)}}buildProps(t,e=!0){const{rawCommands:n,editor:o,state:r}=this,{view:i}=o,s={tr:t,editor:o,view:i,state:Yi({state:r,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,c])=>[l,(...d)=>c(...d)(s)]))}};return s}},ih={};Dl(ih,{blur:()=>nk,clearContent:()=>ok,clearNodes:()=>rk,command:()=>ik,createParagraphNear:()=>sk,cut:()=>ak,deleteCurrentNode:()=>lk,deleteNode:()=>ck,deleteRange:()=>dk,deleteSelection:()=>uk,enter:()=>fk,exitCode:()=>pk,extendMarkRange:()=>hk,first:()=>mk,focus:()=>bk,forEach:()=>yk,insertContent:()=>xk,insertContentAt:()=>wk,joinBackward:()=>Ck,joinDown:()=>Nk,joinForward:()=>vk,joinItemBackward:()=>Tk,joinItemForward:()=>zk,joinTextblockBackward:()=>_k,joinTextblockForward:()=>Ak,joinUp:()=>Sk,keyboardShortcut:()=>Ik,lift:()=>Ok,liftEmptyBlock:()=>Dk,liftListItem:()=>Rk,newlineInCode:()=>Pk,resetAttributes:()=>Lk,scrollIntoView:()=>$k,selectAll:()=>Vk,selectNodeBackward:()=>Bk,selectNodeForward:()=>Fk,selectParentNode:()=>jk,selectTextblockEnd:()=>Uk,selectTextblockStart:()=>Hk,setContent:()=>Wk,setMark:()=>uw,setMeta:()=>fw,setNode:()=>pw,setNodeSelection:()=>hw,setTextDirection:()=>mw,setTextSelection:()=>gw,sinkListItem:()=>bw,splitBlock:()=>yw,splitListItem:()=>xw,toggleList:()=>Ew,toggleMark:()=>kw,toggleNode:()=>ww,toggleWrap:()=>Sw,undoInputRule:()=>Nw,unsetAllMarks:()=>Cw,unsetMark:()=>vw,unsetTextDirection:()=>Tw,updateAttributes:()=>zw,wrapIn:()=>_w,wrapInList:()=>Aw});var nk=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),ok=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),rk=()=>({state:t,tr:e,dispatch:n})=>{const{selection:o}=e,{ranges:r}=o;return n&&r.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(l,c)=>{if(l.type.isText)return;const{doc:d,mapping:u}=e,f=d.resolve(u.map(c)),p=d.resolve(u.map(c+l.nodeSize)),h=f.blockRange(p);if(!h)return;const m=$o(h);if(l.type.isTextblock){const{defaultType:b}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,b)}(m||m===0)&&e.lift(h,m)})}),!0},ik=t=>e=>t(e),sk=()=>({state:t,dispatch:e})=>Bf(t,e),ak=(t,e)=>({editor:n,tr:o})=>{const{state:r}=n,i=r.doc.slice(t.from,t.to);o.deleteRange(t.from,t.to);const s=o.mapping.map(e);return o.insert(s,i.content),o.setSelection(new Oe(o.doc.resolve(Math.max(s-1,0)))),!0},lk=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,o=n.$anchor.node();if(o.content.size>0)return!1;const r=t.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const l=r.before(i),c=r.after(i);t.delete(l,c).scrollIntoView()}return!0}return!1};function ot(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var ck=t=>({tr:e,state:n,dispatch:o})=>{const r=ot(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r){if(o){const c=i.before(s),d=i.after(s);e.delete(c,d).scrollIntoView()}return!0}return!1},dk=t=>({tr:e,dispatch:n})=>{const{from:o,to:r}=t;return n&&e.delete(o,r),!0},uk=()=>({state:t,dispatch:e})=>ol(t,e),fk=()=>({commands:t})=>t.keyboardShortcut("Enter"),pk=()=>({state:t,dispatch:e})=>J0(t,e);function Rl(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Zi(t,e,n={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>n.strict?e[r]===t[r]:Rl(e[r])?e[r].test(t[r]):e[r]===t[r]):!0}function sh(t,e,n={}){return t.find(o=>o.type===e&&Zi(Object.fromEntries(Object.keys(n).map(r=>[r,o.attrs[r]])),n))}function ah(t,e,n={}){return!!sh(t,e,n)}function Pl(t,e,n){var o;if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===e)||(n=n||((o=r.node.marks[0])==null?void 0:o.attrs),!sh([...r.node.marks],e,n)))return;let s=r.index,l=t.start()+r.offset,c=s+1,d=l+r.node.nodeSize;for(;s>0&&ah([...t.parent.child(s-1).marks],e,n);)s-=1,l-=t.parent.child(s).nodeSize;for(;c<t.parent.childCount&&ah([...t.parent.child(c).marks],e,n);)d+=t.parent.child(c).nodeSize,c+=1;return{from:l,to:d}}function Mn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var hk=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const i=Mn(t,o.schema),{doc:s,selection:l}=n,{$from:c,from:d,to:u}=l;if(r){const f=Pl(c,i,e);if(f&&f.from<=d&&f.to>=u){const p=Oe.create(s,f.from,f.to);n.setSelection(p)}}return!0},mk=t=>e=>{const n=typeof t=="function"?t(e):t;for(let o=0;o<n.length;o+=1)if(n[o](e))return!0;return!1};function lh(t){return t instanceof Oe}function zo(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function ch(t,e=null){if(!e)return null;const n=Pe.atStart(t),o=Pe.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return o;const r=n.from,i=o.to;return e==="all"?Oe.create(t,zo(0,r,i),zo(t.content.size,r,i)):Oe.create(t,zo(e,r,i),zo(e,r,i))}function dh(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function es(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function gk(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var bk=(t=null,e={})=>({editor:n,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(es()||dh())&&o.dom.focus(),gk()&&!es()&&!dh()&&o.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(o.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(o.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!lh(n.state.selection))return s(),!0;const l=ch(r.doc,t)||n.state.selection,c=n.state.selection.eq(l);return i&&(c||r.setSelection(l),c&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},yk=(t,e)=>n=>t.every((o,r)=>e(o,{...n,index:r})),xk=(t,e)=>({tr:n,commands:o})=>o.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),uh=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const o=e[n];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?t.removeChild(o):o.nodeType===1&&uh(o)}return t};function ts(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return uh(n)}function Lr(t,e,n){if(t instanceof Gn||t instanceof ne)return t;n={slice:!0,parseOptions:{},...n};const o=typeof t=="object"&&t!==null,r=typeof t=="string";if(o)try{if(Array.isArray(t)&&t.length>0)return ne.fromArray(t.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),Lr("",e,n)}if(r){if(n.errorOnInvalidContent){let s=!1,l="";const c=new Qu({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(s=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(n.slice?kr.fromSchema(c).parseSlice(ts(t),n.parseOptions):kr.fromSchema(c).parse(ts(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=kr.fromSchema(e);return n.slice?i.parseSlice(ts(t),n.parseOptions).content:i.parse(ts(t),n.parseOptions)}return Lr("",e,n)}function Ek(t,e,n){const o=t.steps.length-1;if(o<e)return;const r=t.steps[o];if(!(r instanceof ct||r instanceof dt))return;const i=t.mapping.maps[o];let s=0;i.forEach((l,c,d,u)=>{s===0&&(s=u)}),t.setSelection(Pe.near(t.doc.resolve(s),n))}var kk=t=>!("type"in t),wk=(t,e,n)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const c=g=>{i.emit("contentError",{editor:i,error:g,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Lr(e,i.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(g){c(g)}try{l=Lr(e,i.schema,{parseOptions:d,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(g){return c(g),!1}let{from:u,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},p=!0,h=!0;if((kk(l)?l:[l]).forEach(g=>{g.check(),p=p?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),u===f&&h){const{parent:g}=o.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,f+=1)}let b;if(p){if(Array.isArray(e))b=e.map(g=>g.text||"").join("");else if(e instanceof ne){let g="";e.forEach(x=>{x.text&&(g+=x.text)}),b=g}else typeof e=="object"&&e&&e.text?b=e.text:b=e;o.insertText(b,u,f)}else{b=l;const g=o.doc.resolve(u),x=g.node(),v=g.parentOffset===0,w=x.isText||x.isTextblock,T=x.content.size>0;v&&w&&T&&(u=Math.max(0,u-1)),o.replaceWith(u,f,b)}n.updateSelection&&Ek(o,o.steps.length-1,-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:u,text:b}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:u,text:b})}return!0},Sk=()=>({state:t,dispatch:e})=>G0(t,e),Nk=()=>({state:t,dispatch:e})=>q0(t,e),Ck=()=>({state:t,dispatch:e})=>Of(t,e),vk=()=>({state:t,dispatch:e})=>Lf(t,e),Tk=()=>({state:t,dispatch:e,tr:n})=>{try{const o=$i(t.doc,t.selection.$from.pos,-1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},zk=()=>({state:t,dispatch:e,tr:n})=>{try{const o=$i(t.doc,t.selection.$from.pos,1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},_k=()=>({state:t,dispatch:e})=>H0(t,e),Ak=()=>({state:t,dispatch:e})=>W0(t,e);function fh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Mk(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let o,r,i,s;for(let l=0;l<e.length-1;l+=1){const c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))es()||fh()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return o&&(n=`Alt-${n}`),r&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var Ik=t=>({editor:e,view:n,tr:o,dispatch:r})=>{const i=Mk(t).split(/-(?!$)/),s=i.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,l))});return c?.steps.forEach(d=>{const u=d.map(o.mapping);u&&r&&o.maybeStep(u)}),!0};function io(t,e,n={}){const{from:o,to:r,empty:i}=t.selection,s=e?ot(e,t.schema):null,l=[];t.doc.nodesBetween(o,r,(f,p)=>{if(f.isText)return;const h=Math.max(o,p),m=Math.min(r,p+f.nodeSize);l.push({node:f,from:h,to:m})});const c=r-o,d=l.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>Zi(f.node.attrs,n,{strict:!1}));return i?!!d.length:d.reduce((f,p)=>f+p.to-p.from,0)>=c}var Ok=(t,e={})=>({state:n,dispatch:o})=>{const r=ot(t,n.schema);return io(n,r,e)?K0(n,o):!1},Dk=()=>({state:t,dispatch:e})=>Ff(t,e),Rk=t=>({state:e,dispatch:n})=>{const o=ot(t,e.schema);return sx(o)(e,n)},Pk=()=>({state:t,dispatch:e})=>Vf(t,e);function ns(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ph(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((o,r)=>(n.includes(r)||(o[r]=t[r]),o),{})}var Lk=(t,e)=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=ns(typeof t=="string"?t:t.name,o.schema);if(!l)return!1;l==="node"&&(i=ot(t,o.schema)),l==="mark"&&(s=Mn(t,o.schema));let c=!1;return n.selection.ranges.forEach(d=>{o.doc.nodesBetween(d.$from.pos,d.$to.pos,(u,f)=>{i&&i===u.type&&(c=!0,r&&n.setNodeMarkup(f,void 0,ph(u.attrs,e))),s&&u.marks.length&&u.marks.forEach(p=>{s===p.type&&(c=!0,r&&n.addMark(f,f+u.nodeSize,s.create(ph(p.attrs,e))))})})}),c},$k=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Vk=()=>({tr:t,dispatch:e})=>{if(e){const n=new Bt(t.doc);t.setSelection(n)}return!0},Bk=()=>({state:t,dispatch:e})=>Rf(t,e),Fk=()=>({state:t,dispatch:e})=>$f(t,e),jk=()=>({state:t,dispatch:e})=>Q0(t,e),Uk=()=>({state:t,dispatch:e})=>tx(t,e),Hk=()=>({state:t,dispatch:e})=>ex(t,e);function Ll(t,e,n={},o={}){return Lr(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:o.errorOnInvalidContent})}var Wk=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:o={}}={})=>({editor:r,tr:i,dispatch:s,commands:l})=>{const{doc:c}=i;if(o.preserveWhitespace!=="full"){const d=Ll(t,r.schema,o,{errorOnInvalidContent:e??r.options.enableContentCheck});return s&&i.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:c.content.size},t,{parseOptions:o,errorOnInvalidContent:e??r.options.enableContentCheck})};function hh(t,e){const n=Mn(e,t.schema),{from:o,to:r,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(o,r,c=>{s.push(...c.marks)});const l=s.find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function mh(t,e){const n=new Sf(t);return e.forEach(o=>{o.steps.forEach(r=>{n.step(r)})}),n}function Gk(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function qk(t,e,n){const o=[];return t.nodesBetween(e.from,e.to,(r,i)=>{n(r)&&o.push({node:r,pos:i})}),o}function Kk(t,e){for(let n=t.depth;n>0;n-=1){const o=t.node(n);if(e(o))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:o}}}function rs(t){return e=>Kk(e.$from,t)}function ye(t,e,n){return t.config[e]===void 0&&t.parent?ye(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ye(t.parent,e,n):null}):t.config[e]}function $l(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},o=ye(e,"addExtensions",n);return o?[e,...$l(o())]:e}).flat(10)}function Vl(t,e){const n=xo.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function gh(t){return typeof t=="function"}function Ue(t,e=void 0,...n){return gh(t)?e?t.bind(e)(...n):t(...n):t}function Jk(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Xo(t){const e=t.filter(r=>r.type==="extension"),n=t.filter(r=>r.type==="node"),o=t.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:o}}function bh(t){const e=[],{nodeExtensions:n,markExtensions:o}=Xo(t),r=[...n,...o],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:r},c=ye(s,"addGlobalAttributes",l);if(!c)return;c().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([p,h])=>{e.push({type:f,name:p,attribute:{...i,...h}})})})})}),r.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},c=ye(s,"addAttributes",l);if(!c)return;const d=c();Object.entries(d).forEach(([u,f])=>{const p={...i,...f};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:s.name,name:u,attribute:p})})}),e}function Rt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const o={...e};return Object.entries(n).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const l=i?String(i).split(" "):[],c=o[r]?o[r].split(" "):[],d=l.filter(u=>!c.includes(u));o[r]=[...c,...d].join(" ")}else if(r==="style"){const l=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],c=o[r]?o[r].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;c.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),l.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),o[r]=Array.from(d.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else o[r]=i}),o},{})}function $r(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,o)=>Rt(n,o),{})}function Xk(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function yh(t,e){return"style"in t?t:{...t,getAttrs:n=>{const o=t.getAttrs?t.getAttrs(n):t.attrs;if(o===!1)return!1;const r=e.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(n):Xk(n.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...o,...r}}}}function xh(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Jk(n)?!1:n!=null))}function Eh(t){var e,n;const o={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(o.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(o.validate=t.attribute.validate),[t.name,o]}function Yk(t,e){var n;const o=bh(t),{nodeExtensions:r,markExtensions:i}=Xo(t),s=(n=r.find(d=>ye(d,"topNode")))==null?void 0:n.name,l=Object.fromEntries(r.map(d=>{const u=o.filter(x=>x.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=t.reduce((x,v)=>{const w=ye(v,"extendNodeSchema",f);return{...x,...w?w(d):{}}},{}),h=xh({...p,content:Ue(ye(d,"content",f)),marks:Ue(ye(d,"marks",f)),group:Ue(ye(d,"group",f)),inline:Ue(ye(d,"inline",f)),atom:Ue(ye(d,"atom",f)),selectable:Ue(ye(d,"selectable",f)),draggable:Ue(ye(d,"draggable",f)),code:Ue(ye(d,"code",f)),whitespace:Ue(ye(d,"whitespace",f)),linebreakReplacement:Ue(ye(d,"linebreakReplacement",f)),defining:Ue(ye(d,"defining",f)),isolating:Ue(ye(d,"isolating",f)),attrs:Object.fromEntries(u.map(Eh))}),m=Ue(ye(d,"parseHTML",f));m&&(h.parseDOM=m.map(x=>yh(x,u)));const b=ye(d,"renderHTML",f);b&&(h.toDOM=x=>b({node:x,HTMLAttributes:$r(x,u)}));const g=ye(d,"renderText",f);return g&&(h.toText=g),[d.name,h]})),c=Object.fromEntries(i.map(d=>{const u=o.filter(g=>g.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=t.reduce((g,x)=>{const v=ye(x,"extendMarkSchema",f);return{...g,...v?v(d):{}}},{}),h=xh({...p,inclusive:Ue(ye(d,"inclusive",f)),excludes:Ue(ye(d,"excludes",f)),group:Ue(ye(d,"group",f)),spanning:Ue(ye(d,"spanning",f)),code:Ue(ye(d,"code",f)),attrs:Object.fromEntries(u.map(Eh))}),m=Ue(ye(d,"parseHTML",f));m&&(h.parseDOM=m.map(g=>yh(g,u)));const b=ye(d,"renderHTML",f);return b&&(h.toDOM=g=>b({mark:g,HTMLAttributes:$r(g,u)})),[d.name,h]}));return new Qu({topNode:s,nodes:l,marks:c})}function Qk(t){const e=t.filter((n,o)=>t.indexOf(n)!==o);return Array.from(new Set(e))}function is(t){return t.sort((n,o)=>{const r=ye(n,"priority")||100,i=ye(o,"priority")||100;return r>i?-1:r<i?1:0})}function kh(t){const e=is($l(t)),n=Qk(e.map(o=>o.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),e}function wh(t,e,n){const{from:o,to:r}=e,{blockSeparator:i=`
|
|
358
|
-
|
|
359
|
-
`,textSerializers:s={}}=n||{};let l="";return t.nodesBetween(o,r,(c,d,u,f)=>{var p;c.isBlock&&d>o&&(l+=i);const h=s?.[c.type.name];if(h)return u&&(l+=h({node:c,pos:d,parent:u,index:f,range:e})),!1;c.isText&&(l+=(p=c?.text)==null?void 0:p.slice(Math.max(o,d)-d,r-d))}),l}function Zk(t,e){const n={from:0,to:t.content.size};return wh(t,n,e)}function Sh(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function ew(t,e){const n=ot(e,t.schema),{from:o,to:r}=t.selection,i=[];t.doc.nodesBetween(o,r,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function Nh(t,e){const n=ns(typeof e=="string"?e:e.name,t.schema);return n==="node"?ew(t,e):n==="mark"?hh(t,e):{}}function tw(t,e=JSON.stringify){const n={};return t.filter(o=>{const r=e(o);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function nw(t){const e=tw(t);return e.length===1?e:e.filter((n,o)=>!e.filter((i,s)=>s!==o).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function Ch(t){const{mapping:e,steps:n}=t,o=[];return e.maps.forEach((r,i)=>{const s=[];if(r.ranges.length)r.forEach((l,c)=>{s.push({from:l,to:c})});else{const{from:l,to:c}=n[i];if(l===void 0||c===void 0)return;s.push({from:l,to:c})}s.forEach(({from:l,to:c})=>{const d=e.slice(i).map(l,-1),u=e.slice(i).map(c),f=e.invert().map(d,-1),p=e.invert().map(u);o.push({oldRange:{from:f,to:p},newRange:{from:d,to:u}})})}),nw(o)}function Bl(t,e,n){const o=[];return t===e?n.resolve(t).marks().forEach(r=>{const i=n.resolve(t),s=Pl(i,r.type);s&&o.push({mark:r,...s})}):n.nodesBetween(t,e,(r,i)=>{!r||r?.nodeSize===void 0||o.push(...r.marks.map(s=>({from:i,to:i+r.nodeSize,mark:s})))}),o}var ow=(t,e,n,o=20)=>{const r=t.doc.resolve(n);let i=o,s=null;for(;i>0&&s===null;){const l=r.node(i);l?.type.name===e?s=l:i-=1}return[s,i]};function ss(t,e){return e.nodes[t]||e.marks[t]||null}function as(t,e,n){return Object.fromEntries(Object.entries(n).filter(([o])=>{const r=t.find(i=>i.type===e&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}var rw=(t,e=500)=>{let n="";const o=t.parentOffset;return t.parent.nodesBetween(Math.max(0,o-e),o,(r,i,s,l)=>{var c,d;const u=((d=(c=r.type.spec).toText)==null?void 0:d.call(c,{node:r,pos:i,parent:s,index:l}))||r.textContent||"%leaf%";n+=r.isAtom&&!r.isText?u:u.slice(0,Math.max(0,o-i))}),n};function Fl(t,e,n={}){const{empty:o,ranges:r}=t.selection,i=e?Mn(e,t.schema):null;if(o)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>i?i.name===f.type.name:!0).find(f=>Zi(f.attrs,n,{strict:!1}));let s=0;const l=[];if(r.forEach(({$from:f,$to:p})=>{const h=f.pos,m=p.pos;t.doc.nodesBetween(h,m,(b,g)=>{if(!b.isText&&!b.marks.length)return;const x=Math.max(h,g),v=Math.min(m,g+b.nodeSize),w=v-x;s+=w,l.push(...b.marks.map(T=>({mark:T,from:x,to:v})))})}),s===0)return!1;const c=l.filter(f=>i?i.name===f.mark.type.name:!0).filter(f=>Zi(f.mark.attrs,n,{strict:!1})).reduce((f,p)=>f+p.to-p.from,0),d=l.filter(f=>i?f.mark.type!==i&&f.mark.type.excludes(i):!0).reduce((f,p)=>f+p.to-p.from,0);return(c>0?c+d:c)>=s}function iw(t,e,n={}){if(!e)return io(t,null,n)||Fl(t,null,n);const o=ns(e,t.schema);return o==="node"?io(t,e,n):o==="mark"?Fl(t,e,n):!1}var sw=(t,e)=>{const{$from:n,$to:o,$anchor:r}=t.selection;if(e){const i=rs(l=>l.type.name===e)(t.selection);if(!i)return!1;const s=t.doc.resolve(i.pos+1);return r.pos+1===s.end()}return!(o.parentOffset<o.parent.nodeSize-2||n.pos!==o.pos)},aw=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function vh(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Th(t,e){const{nodeExtensions:n}=Xo(e),o=n.find(s=>s.name===t);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=Ue(ye(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function jl(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var o;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((o=t.text)!=null?o:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let r=!0;return t.content.forEach(i=>{r!==!1&&(jl(i,{ignoreWhitespace:n,checkChildren:e})||(r=!1))}),r}return!1}var zh=class Fm{constructor(e){this.position=e}static fromJSON(e){return new Fm(e.position)}toJSON(){return{position:this.position}}};function lw(t,e){const n=e.mapping.mapResult(t.position);return{position:new zh(n.pos),mapResult:n}}function cw(t){return new zh(t)}function dw(t,e,n){var o;const{selection:r}=e;let i=null;if(lh(r)&&(i=r.$cursor),i){const l=(o=t.storedMarks)!=null?o:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(d=>d.type.excludes(n)))}const{ranges:s}=r;return s.some(({$from:l,$to:c})=>{let d=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,c.pos,(u,f,p)=>{if(d)return!1;if(u.isInline){const h=!p||p.type.allowsMarkType(n),m=!!n.isInSet(u.marks)||!u.marks.some(b=>b.type.excludes(n));d=h&&m}return!d}),d})}var uw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const{selection:i}=n,{empty:s,ranges:l}=i,c=Mn(t,o.schema);if(r)if(s){const d=hh(o,c);n.addStoredMark(c.create({...d,...e}))}else l.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;o.doc.nodesBetween(u,f,(p,h)=>{const m=Math.max(h,u),b=Math.min(h+p.nodeSize,f);p.marks.find(x=>x.type===c)?p.marks.forEach(x=>{c===x.type&&n.addMark(m,b,c.create({...x.attrs,...e}))}):n.addMark(m,b,c.create(e))})});return dw(o,n,c)},fw=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),pw=(t,e={})=>({state:n,dispatch:o,chain:r})=>{const i=ot(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>Hf(i,{...s,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Hf(i,{...s,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},hw=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,r=zo(t,0,o.content.size),i=Ne.create(o,r);e.setSelection(i)}return!0},mw=(t,e)=>({tr:n,state:o,dispatch:r})=>{const{selection:i}=o;let s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=i.from,l=i.to),r&&n.doc.nodesBetween(s,l,(c,d)=>{c.isText||n.setNodeMarkup(d,void 0,{...c.attrs,dir:t})}),!0},gw=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,{from:r,to:i}=typeof t=="number"?{from:t,to:t}:t,s=Oe.atStart(o).from,l=Oe.atEnd(o).to,c=zo(r,s,l),d=zo(i,s,l),u=Oe.create(o,c,d);e.setSelection(u)}return!0},bw=t=>({state:e,dispatch:n})=>{const o=ot(t,e.schema);return cx(o)(e,n)};function _h(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const o=n.filter(r=>e?.includes(r.type.name));t.tr.ensureMarks(o)}}var yw=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:l,$to:c}=i,d=r.extensionManager.attributes,u=as(d,l.node().type.name,l.node().attrs);if(i instanceof Ne&&i.node.isBlock)return!l.parentOffset||!vn(s,l.pos)?!1:(o&&(t&&_h(n,r.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=c.parentOffset===c.parent.content.size,p=l.depth===0?void 0:Gk(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:u}]:void 0,m=vn(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&vn(e.doc,e.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:u}]:void 0),o){if(m&&(i instanceof Oe&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),p&&!f&&!l.parentOffset&&l.parent.type!==p)){const b=e.mapping.map(l.before()),g=e.doc.resolve(b);l.node(-1).canReplaceWith(g.index(),g.index()+1,p)&&e.setNodeMarkup(e.mapping.map(l.before()),p)}t&&_h(n,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},xw=(t,e={})=>({tr:n,state:o,dispatch:r,editor:i})=>{var s;const l=ot(t,o.schema),{$from:c,$to:d}=o.selection,u=o.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const f=c.node(-1);if(f.type!==l)return!1;const p=i.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(r){let x=ne.empty;const v=c.index(-1)?1:c.index(-2)?2:3;for(let E=c.depth-v;E>=c.depth-3;E-=1)x=ne.from(c.node(E).copy(x));const w=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,T={...as(p,c.node().type.name,c.node().attrs),...e},M=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(T))||void 0;x=x.append(ne.from(l.createAndFill(null,M)||void 0));const A=c.before(c.depth-(v-1));n.replace(A,c.after(-w),new ue(x,4-v,0));let y=-1;n.doc.nodesBetween(A,n.doc.content.size,(E,S)=>{if(y>-1)return!1;E.isTextblock&&E.content.size===0&&(y=S+1)}),y>-1&&n.setSelection(Oe.near(n.doc.resolve(y))),n.scrollIntoView()}return!0}const h=d.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...as(p,f.type.name,f.attrs),...e},b={...as(p,c.node().type.name,c.node().attrs),...e};n.delete(c.pos,d.pos);const g=h?[{type:l,attrs:m},{type:h,attrs:b}]:[{type:l,attrs:m}];if(!vn(n.doc,c.pos,2))return!1;if(r){const{selection:x,storedMarks:v}=o,{splittableMarks:w}=i.extensionManager,T=v||x.$to.parentOffset&&x.$from.marks();if(n.split(c.pos,2,g).scrollIntoView(),!T||!r)return!0;const M=T.filter(A=>w.includes(A.type.name));n.ensureMarks(M)}return!0},Ul=(t,e)=>{const n=rs(s=>s.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===r?.type&&Jn(t.doc,n.pos)&&t.join(n.pos),!0},Hl=(t,e)=>{const n=rs(s=>s.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(n.start).after(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===r?.type&&Jn(t.doc,o)&&t.join(o),!0},Ew=(t,e,n,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:c,commands:d,can:u})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,h=ot(t,s.schema),m=ot(e,s.schema),{selection:b,storedMarks:g}=s,{$from:x,$to:v}=b,w=x.blockRange(v),T=g||b.$to.parentOffset&&b.$from.marks();if(!w)return!1;const M=rs(A=>Th(A.type.name,f))(b);if(w.depth>=1&&M&&w.depth-M.depth<=1){if(M.node.type===h)return d.liftListItem(m);if(Th(M.node.type.name,f)&&h.validContent(M.node.content)&&l)return c().command(()=>(i.setNodeMarkup(M.pos,h),!0)).command(()=>Ul(i,h)).command(()=>Hl(i,h)).run()}return!n||!T||!l?c().command(()=>u().wrapInList(h,o)?!0:d.clearNodes()).wrapInList(h,o).command(()=>Ul(i,h)).command(()=>Hl(i,h)).run():c().command(()=>{const A=u().wrapInList(h,o),y=T.filter(E=>p.includes(E.type.name));return i.ensureMarks(y),A?!0:d.clearNodes()}).wrapInList(h,o).command(()=>Ul(i,h)).command(()=>Hl(i,h)).run()},kw=(t,e={},n={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=n,s=Mn(t,o.schema);return Fl(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},ww=(t,e,n={})=>({state:o,commands:r})=>{const i=ot(t,o.schema),s=ot(e,o.schema),l=io(o,i,n);let c;return o.selection.$anchor.sameParent(o.selection.$head)&&(c=o.selection.$anchor.parent.attrs),l?r.setNode(s,c):r.setNode(i,{...c,...n})},Sw=(t,e={})=>({state:n,commands:o})=>{const r=ot(t,n.schema);return io(n,r,e)?o.lift(r):o.wrapIn(r,e)},Nw=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let o=0;o<n.length;o+=1){const r=n[o];let i;if(r.spec.isInputRules&&(i=r.getState(t))){if(e){const s=t.tr,l=i.transform;for(let c=l.steps.length-1;c>=0;c-=1)s.step(l.steps[c].invert(l.docs[c]));if(i.text){const c=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,c))}else s.delete(i.from,i.to)}return!0}}return!1},Cw=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:o,ranges:r}=n;return o||e&&r.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},vw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,c=Mn(t,o.schema),{$from:d,empty:u,ranges:f}=l;if(!r)return!0;if(u&&s){let{from:p,to:h}=l;const m=(i=d.marks().find(g=>g.type===c))==null?void 0:i.attrs,b=Pl(d,c,m);b&&(p=b.from,h=b.to),n.removeMark(p,h,c)}else f.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,c)});return n.removeStoredMark(c),!0},Tw=t=>({tr:e,state:n,dispatch:o})=>{const{selection:r}=n;let i,s;return typeof t=="number"?(i=t,s=t):t&&"from"in t&&"to"in t?(i=t.from,s=t.to):(i=r.from,s=r.to),o&&e.doc.nodesBetween(i,s,(l,c)=>{if(l.isText)return;const d={...l.attrs};delete d.dir,e.setNodeMarkup(c,void 0,d)}),!0},zw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=ns(typeof t=="string"?t:t.name,o.schema);if(!l)return!1;l==="node"&&(i=ot(t,o.schema)),l==="mark"&&(s=Mn(t,o.schema));let c=!1;return n.selection.ranges.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;let p,h,m,b;n.selection.empty?o.doc.nodesBetween(u,f,(g,x)=>{i&&i===g.type&&(c=!0,m=Math.max(x,u),b=Math.min(x+g.nodeSize,f),p=x,h=g)}):o.doc.nodesBetween(u,f,(g,x)=>{x<u&&i&&i===g.type&&(c=!0,m=Math.max(x,u),b=Math.min(x+g.nodeSize,f),p=x,h=g),x>=u&&x<=f&&(i&&i===g.type&&(c=!0,r&&n.setNodeMarkup(x,void 0,{...g.attrs,...e})),s&&g.marks.length&&g.marks.forEach(v=>{if(s===v.type&&(c=!0,r)){const w=Math.max(x,u),T=Math.min(x+g.nodeSize,f);n.addMark(w,T,s.create({...v.attrs,...e}))}}))}),h&&(p!==void 0&&r&&n.setNodeMarkup(p,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(g=>{s===g.type&&r&&n.addMark(m,b,s.create({...g.attrs,...e}))}))}),c},_w=(t,e={})=>({state:n,dispatch:o})=>{const r=ot(t,n.schema);return nx(r,e)(n,o)},Aw=(t,e={})=>({state:n,dispatch:o})=>{const r=ot(t,n.schema);return ox(r,e)(n,o)},Mw=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(o=>o.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(o=>o!==e):delete this.callbacks[t]),this}once(t,e){const n=(...o)=>{this.off(t,n),e.apply(this,o)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Ah=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},Iw=(t,e)=>{if(Rl(e))return e.exec(t);const n=e(t);if(!n)return null;const o=[n.text];return o.index=n.index,o.input=t,o.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(n.replaceWith)),o};function ls(t){var e;const{editor:n,from:o,to:r,text:i,rules:s,plugin:l}=t,{view:c}=n;if(c.composing)return!1;const d=c.state.doc.resolve(o);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let u=!1;const f=rw(d)+i;return s.forEach(p=>{if(u)return;const h=Iw(f,p.find);if(!h)return;const m=c.state.tr,b=Yi({state:c.state,transaction:m}),g={from:o-(h[0].length-i.length),to:r},{commands:x,chain:v,can:w}=new Qi({editor:n,state:b});p.handler({state:b,range:g,match:h,commands:x,chain:v,can:w})===null||!m.steps.length||(p.undoable&&m.setMeta(l,{transform:m,from:o,to:r,text:i}),c.dispatch(m),u=!0)}),u}function Ow(t){const{editor:e,rules:n}=t,o=new Ot({state:{init(){return null},apply(r,i,s){const l=r.getMeta(o);if(l)return l;const c=r.getMeta("applyInputRules");return c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=Vl(ne.from(u),s.schema);const{from:f}=c,p=f+u.length;ls({editor:e,from:f,to:p,text:u,rules:n,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,s,l){return ls({editor:e,from:i,to:s,text:l,rules:n,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&ls({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:o})}),!1)},handleKeyDown(r,i){if(i.key!=="Enter")return!1;const{$cursor:s}=r.state.selection;return s?ls({editor:e,from:s.pos,to:s.pos,text:`
|
|
360
|
-
`,rules:n,plugin:o}):!1}},isInputRules:!0});return o}function Dw(t){return Object.prototype.toString.call(t).slice(8,-1)}function cs(t){return Dw(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Mh(t,e){const n={...t};return cs(t)&&cs(e)&&Object.keys(e).forEach(o=>{cs(e[o])&&cs(t[o])?n[o]=Mh(t[o],e[o]):n[o]=e[o]}),n}var Wl=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Ue(ye(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Ue(ye(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Mh(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Vr=class jm extends Wl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new jm(n)}static handleExit({editor:e,mark:n}){const{tr:o}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const s=r.marks();if(!!!s.find(d=>d?.type.name===n.name))return!1;const c=s.find(d=>d?.type.name===n.name);return c&&o.removeStoredMark(c),o.insertText(" ",r.pos),e.view.dispatch(o),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Rw(t){return typeof t=="number"}var Pw=class{constructor(t){this.find=t.find,this.handler=t.handler}},Lw=(t,e,n)=>{if(Rl(e))return[...t.matchAll(e)];const o=e(t,n);return o?o.map(r=>{const i=[r.text];return i.index=r.index,i.input=t,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function $w(t){const{editor:e,state:n,from:o,to:r,rule:i,pasteEvent:s,dropEvent:l}=t,{commands:c,chain:d,can:u}=new Qi({editor:e,state:n}),f=[];return n.doc.nodesBetween(o,r,(h,m)=>{var b,g,x,v,w;if((g=(b=h.type)==null?void 0:b.spec)!=null&&g.code||!(h.isText||h.isTextblock||h.isInline))return;const T=(w=(v=(x=h.content)==null?void 0:x.size)!=null?v:h.nodeSize)!=null?w:0,M=Math.max(o,m),A=Math.min(r,m+T);if(M>=A)return;const y=h.isText?h.text||"":h.textBetween(M-m,A-m,void 0,"");Lw(y,i.find,s).forEach(S=>{if(S.index===void 0)return;const D=M+S.index+1,W=D+S[0].length,z={from:n.tr.mapping.map(D),to:n.tr.mapping.map(W)},P=i.handler({state:n,range:z,match:S,commands:c,chain:d,can:u,pasteEvent:s,dropEvent:l});f.push(P)})}),f.every(h=>h!==null)}var ds=null,Vw=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function Bw(t){const{editor:e,rules:n}=t;let o=null,r=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const c=({state:u,from:f,to:p,rule:h,pasteEvt:m})=>{const b=u.tr,g=Yi({state:u,transaction:b});if(!(!$w({editor:e,state:g,from:Math.max(f-1,0),to:p.b-1,rule:h,pasteEvent:m,dropEvent:l})||!b.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,b}};return n.map(u=>new Ot({view(f){const p=m=>{var b;o=(b=f.dom.parentElement)!=null&&b.contains(m.target)?f.dom.parentElement:null,o&&(ds=e)},h=()=>{ds&&(ds=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,p)=>{if(i=o===f.dom.parentElement,l=p,!i){const h=ds;h?.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,p)=>{var h;const m=(h=p.clipboardData)==null?void 0:h.getData("text/html");return s=p,r=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,p,h)=>{const m=f[0],b=m.getMeta("uiEvent")==="paste"&&!r,g=m.getMeta("uiEvent")==="drop"&&!i,x=m.getMeta("applyPasteRules"),v=!!x;if(!b&&!g&&!v)return;if(v){let{text:M}=x;typeof M=="string"?M=M:M=Vl(ne.from(M),h.schema);const{from:A}=x,y=A+M.length,E=Vw(M);return c({rule:u,state:h,from:A,to:{b:y},pasteEvt:E})}const w=p.doc.content.findDiffStart(h.doc.content),T=p.doc.content.findDiffEnd(h.doc.content);if(!(!Rw(w)||!T||w===T.b))return c({rule:u,state:h,from:w,to:T,pasteEvt:s})}}))}var us=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=kh(t),this.schema=Yk(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ss(e.name,this.schema)},o=ye(e,"addCommands",n);return o?{...t,...o()}:t},{})}get plugins(){const{editor:t}=this;return is([...this.extensions].reverse()).flatMap(o=>{const r={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:t,type:ss(o.name,this.schema)},i=[],s=ye(o,"addKeyboardShortcuts",r);let l={};if(o.type==="mark"&&ye(o,"exitable",r)&&(l.ArrowRight=()=>Vr.handleExit({editor:t,mark:o})),s){const p=Object.fromEntries(Object.entries(s()).map(([h,m])=>[h,()=>m({editor:t})]));l={...l,...p}}const c=ZE(l);i.push(c);const d=ye(o,"addInputRules",r);if(vh(o,t.options.enableInputRules)&&d){const p=d();if(p&&p.length){const h=Ow({editor:t,rules:p}),m=Array.isArray(h)?h:[h];i.push(...m)}}const u=ye(o,"addPasteRules",r);if(vh(o,t.options.enablePasteRules)&&u){const p=u();if(p&&p.length){const h=Bw({editor:t,rules:p});i.push(...h)}}const f=ye(o,"addProseMirrorPlugins",r);if(f){const p=f();i.push(...p)}return i})}get attributes(){return bh(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Xo(this.extensions);return Object.fromEntries(e.filter(n=>!!ye(n,"addNodeView")).map(n=>{const o=this.attributes.filter(c=>c.type===n.name),r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ot(n.name,this.schema)},i=ye(n,"addNodeView",r);if(!i)return[];const s=i();if(!s)return[];const l=(c,d,u,f,p)=>{const h=$r(c,o);return s({node:c,view:d,getPos:u,decorations:f,innerDecorations:p,editor:t,extension:n,HTMLAttributes:h})};return[n.name,l]}))}dispatchTransaction(t){const{editor:e}=this;return is([...this.extensions].reverse()).reduceRight((o,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:ss(r.name,this.schema)},s=ye(r,"dispatchTransaction",i);return s?l=>{s.call(i,{transaction:l,next:o})}:o},t)}get markViews(){const{editor:t}=this,{markExtensions:e}=Xo(this.extensions);return Object.fromEntries(e.filter(n=>!!ye(n,"addMarkView")).map(n=>{const o=this.attributes.filter(l=>l.type===n.name),r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Mn(n.name,this.schema)},i=ye(n,"addMarkView",r);if(!i)return[];const s=(l,c,d)=>{const u=$r(l,o);return i()({mark:l,view:c,inline:d,editor:t,extension:n,HTMLAttributes:u,updateAttributes:f=>{Qw(l,t,f)}})};return[n.name,s]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const o={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ss(e.name,this.schema)};e.type==="mark"&&((n=Ue(ye(e,"keepOnSplit",o)))==null||n)&&this.splittableMarks.push(e.name);const r=ye(e,"onBeforeCreate",o),i=ye(e,"onCreate",o),s=ye(e,"onUpdate",o),l=ye(e,"onSelectionUpdate",o),c=ye(e,"onTransaction",o),d=ye(e,"onFocus",o),u=ye(e,"onBlur",o),f=ye(e,"onDestroy",o);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}};us.resolve=kh,us.sort=is,us.flatten=$l;var Fw={};Dl(Fw,{ClipboardTextSerializer:()=>Ih,Commands:()=>Oh,Delete:()=>Dh,Drop:()=>Rh,Editable:()=>Ph,FocusEvents:()=>$h,Keymap:()=>Vh,Paste:()=>Bh,Tabindex:()=>Fh,TextDirection:()=>jh,focusEventsPluginKey:()=>Lh});var Kt=class Um extends Wl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new Um(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Ih=Kt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ot({key:new an("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:o,selection:r}=e,{ranges:i}=r,s=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),c=Sh(n);return wh(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),Oh=Kt.create({name:"commands",addCommands(){return{...ih}}}),Dh=Kt.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,o,r;const i=()=>{var s,l,c,d;if((d=(c=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:c.call(l,t))!=null?d:t.getMeta("y-sync$"))return;const u=mh(t.before,[t,...e]);Ch(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,b)=>{const g=b+m.nodeSize-2,x=h.oldRange.from<=b&&g<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:b,to:g,newFrom:u.mapping.map(b),newTo:u.mapping.map(g),deletedRange:h.oldRange,newRange:h.newRange,partial:!x,editor:this.editor,transaction:t,combinedTransform:u})})});const p=u.mapping;u.steps.forEach((h,m)=>{var b,g;if(h instanceof sn){const x=p.slice(m).map(h.from,-1),v=p.slice(m).map(h.to),w=p.invert().map(x,-1),T=p.invert().map(v),M=(b=u.doc.nodeAt(x-1))==null?void 0:b.marks.some(y=>y.eq(h.mark)),A=(g=u.doc.nodeAt(v))==null?void 0:g.marks.some(y=>y.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:w,to:T},newRange:{from:x,to:v},partial:!!(A||M),editor:this.editor,transaction:t,combinedTransform:u})}})};(r=(o=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:o.async)==null||r?setTimeout(i,0):i()}}),Rh=Kt.create({name:"drop",addProseMirrorPlugins(){return[new Ot({key:new an("tiptapDrop"),props:{handleDrop:(t,e,n,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:o})}}})]}}),Ph=Kt.create({name:"editable",addProseMirrorPlugins(){return[new Ot({key:new an("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Lh=new an("focusEvents"),$h=Kt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ot({key:Lh,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const o=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,n)=>{t.isFocused=!1;const o=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),Vh=Kt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:c,doc:d}=l,{empty:u,$anchor:f}=c,{pos:p,parent:h}=f,m=f.parent.isTextblock&&p>0?l.doc.resolve(p-1):f,b=m.parent.type.spec.isolating,g=f.pos-f.parentOffset,x=b&&m.parent.childCount===1?g===f.pos:Pe.atStart(d).from===p;return!u||!h.type.isTextblock||h.textContent.length||!x||x&&f.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),o={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...o},i={...o,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return es()||fh()?i:r},addProseMirrorPlugins(){return[new Ot({key:new an("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(b=>b.getMeta("composition")))return;const o=t.some(b=>b.docChanged)&&!e.doc.eq(n.doc),r=t.some(b=>b.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:s,to:l}=e.selection,c=Pe.atStart(e.doc).from,d=Pe.atEnd(e.doc).to;if(i||!(s===c&&l===d)||!jl(n.doc))return;const p=n.tr,h=Yi({state:n,transaction:p}),{commands:m}=new Qi({editor:this.editor,state:h});if(m.clearNodes(),!!p.steps.length)return p}})]}}),Bh=Kt.create({name:"paste",addProseMirrorPlugins(){return[new Ot({key:new an("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Fh=Kt.create({name:"tabindex",addProseMirrorPlugins(){return[new Ot({key:new an("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),jh=Kt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Xo(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ot({key:new an("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),jw=class or{constructor(e,n,o=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=o,this.resolvedPos=e,this.editor=n,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,o=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,o=this.to-1}this.editor.commands.insertContentAt({from:n,to:o},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new or(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new or(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new or(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,o)=>{const r=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+o+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(s);if(!r&&l.depth<=this.depth)return;const c=new or(l,this.editor,r,r?n:null);r&&(c.actualDepth=this.depth+1),e.push(new or(l,this.editor,r,r?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let o=null,r=this.parent;for(;r&&!o;){if(r.node.type.name===e)if(Object.keys(n).length>0){const i=r.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){const c=s[l];if(i[c]!==n[c])break}}else o=r;r=r.parent}return o}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},o=!1){let r=[];if(!this.children||this.children.length===0)return r;const i=Object.keys(n);return this.children.forEach(s=>{o&&r.length>0||(s.node.type.name===e&&i.every(c=>n[c]===s.node.attrs[c])&&r.push(s),!(o&&r.length>0)&&(r=r.concat(s.querySelectorAll(e,n,o))))}),r}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},Uw=`.ProseMirror {
|
|
339
|
+
`}function Nn(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=Ly(n),n.insertBefore(r,n.firstChild)}function Vy(){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 ge.warn("Failed to get toolbar height:",n),20}}function sn(n,e=0){if(!(typeof window>"u"||!n))try{const t=n.getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,r=Vy(),i=t.top+o-r-e;window.scrollTo({top:Math.max(0,i),behavior:"smooth"})}catch(t){ge.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){ge.error("Scroll fallback also failed:",o)}}}const{entries:Gd,setPrototypeOf:Kd,isFrozen:By,getPrototypeOf:Fy,getOwnPropertyDescriptor:jy}=Object;let{freeze:vt,seal:Ut,create:xa}=Object,{apply:ka,construct:Ea}=typeof Reflect<"u"&&Reflect;vt||(vt=function(e){return e}),Ut||(Ut=function(e){return e}),ka||(ka=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)}),Ea||(Ea=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 wi=zt(Array.prototype.forEach),Hy=zt(Array.prototype.lastIndexOf),Jd=zt(Array.prototype.pop),hr=zt(Array.prototype.push),Uy=zt(Array.prototype.splice),Si=zt(String.prototype.toLowerCase),wa=zt(String.prototype.toString),Sa=zt(String.prototype.match),mr=zt(String.prototype.replace),Wy=zt(String.prototype.indexOf),qy=zt(String.prototype.trim),an=zt(Object.prototype.hasOwnProperty),Nt=zt(RegExp.prototype.test),gr=Gy(TypeError);function zt(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 ka(n,e,o)}}function Gy(n){return function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return Ea(n,t)}}function Re(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Si;Kd&&Kd(n,null);let o=e.length;for(;o--;){let r=e[o];if(typeof r=="string"){const i=t(r);i!==r&&(By(e)||(e[o]=i),r=i)}n[r]=!0}return n}function Ky(n){for(let e=0;e<n.length;e++)an(n,e)||(n[e]=null);return n}function gn(n){const e=xa(null);for(const[t,o]of Gd(n))an(n,t)&&(Array.isArray(o)?e[t]=Ky(o):o&&typeof o=="object"&&o.constructor===Object?e[t]=gn(o):e[t]=o);return e}function yr(n,e){for(;n!==null;){const o=jy(n,e);if(o){if(o.get)return zt(o.get);if(typeof o.value=="function")return zt(o.value)}n=Fy(n)}function t(){return null}return t}const Xd=vt(["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"]),Ca=vt(["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"]),va=vt(["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"]),Jy=vt(["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"]),Na=vt(["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"]),Xy=vt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Yd=vt(["#text"]),Qd=vt(["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"]),za=vt(["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"]),Zd=vt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ci=vt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Yy=Ut(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Qy=Ut(/<%[\w\W]*|[\w\W]*%>/gm),Zy=Ut(/\$\{[\w\W]*/gm),eb=Ut(/^data-[\-\w.\u00B7-\uFFFF]+$/),tb=Ut(/^aria-[\-\w]+$/),eu=Ut(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),nb=Ut(/^(?:\w+script|data):/i),ob=Ut(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),tu=Ut(/^html$/i),rb=Ut(/^[a-z][.\w]*(-[.\w]+)+$/i);var nu=Object.freeze({__proto__:null,ARIA_ATTR:tb,ATTR_WHITESPACE:ob,CUSTOM_ELEMENT:rb,DATA_ATTR:eb,DOCTYPE_NAME:tu,ERB_EXPR:Qy,IS_ALLOWED_URI:eu,IS_SCRIPT_OR_DATA:nb,MUSTACHE_EXPR:Yy,TMPLIT_EXPR:Zy});const br={element:1,text:3,progressingInstruction:7,comment:8,document:9},ib=function(){return typeof window>"u"?null:window},sb=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}},ou=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ru(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ib();const e=we=>ru(we);if(e.version="3.3.1",e.removed=[],!n||!n.document||n.document.nodeType!==br.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:p,DOMParser:f,trustedTypes:h}=n,m=c.prototype,g=yr(m,"cloneNode"),y=yr(m,"remove"),x=yr(m,"nextSibling"),T=yr(m,"childNodes"),S=yr(m,"parentNode");if(typeof a=="function"){const we=t.createElement("template");we.content&&we.content.ownerDocument&&(t=we.content.ownerDocument)}let z,b="";const{implementation:v,createNodeIterator:E,createDocumentFragment:C,getElementsByTagName:M}=t,{importNode:D}=o;let $=ou();e.isSupported=typeof Gd=="function"&&typeof S=="function"&&v&&v.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:P,ERB_EXPR:L,TMPLIT_EXPR:V,DATA_ATTR:F,ARIA_ATTR:H,IS_SCRIPT_OR_DATA:U,ATTR_WHITESPACE:G,CUSTOM_ELEMENT:K}=nu;let{IS_ALLOWED_URI:J}=nu,ne=null;const ee=Re({},[...Xd,...Ca,...va,...Na,...Yd]);let Y=null;const te=Re({},[...Qd,...za,...Zd,...Ci]);let se=Object.seal(xa(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}})),ce=null,ke=null;const Se=Object.seal(xa(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Oe=!0,N=!0,X=!1,oe=!0,k=!1,w=!0,I=!1,j=!1,le=!1,Ce=!1,Be=!1,A=!1,_=!0,W=!1;const de="user-content-";let Pe=!0,ue=!1,q={},Q=null;const Te=Re({},["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 De=null;const qe=Re({},["audio","video","img","source","image","track"]);let Je=null;const kt=Re({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),At="http://www.w3.org/1998/Math/MathML",en="http://www.w3.org/2000/svg",Pt="http://www.w3.org/1999/xhtml";let $t=Pt,Et=!1,Oo=null;const En=Re({},[At,en,Pt],wa);let Ft=Re({},["mi","mo","mn","ms","mtext"]),fo=Re({},["annotation-xml"]);const oi=Re({},["title","style","font","a","script"]);let $n=null;const ri=["application/xhtml+xml","text/html"],ii="text/html";let R=null,B=null;const Z=t.createElement("form"),pe=function(O){return O instanceof RegExp||O instanceof Function},Ae=function(){let O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(B&&B===O)){if((!O||typeof O!="object")&&(O={}),O=gn(O),$n=ri.indexOf(O.PARSER_MEDIA_TYPE)===-1?ii:O.PARSER_MEDIA_TYPE,R=$n==="application/xhtml+xml"?wa:Si,ne=an(O,"ALLOWED_TAGS")?Re({},O.ALLOWED_TAGS,R):ee,Y=an(O,"ALLOWED_ATTR")?Re({},O.ALLOWED_ATTR,R):te,Oo=an(O,"ALLOWED_NAMESPACES")?Re({},O.ALLOWED_NAMESPACES,wa):En,Je=an(O,"ADD_URI_SAFE_ATTR")?Re(gn(kt),O.ADD_URI_SAFE_ATTR,R):kt,De=an(O,"ADD_DATA_URI_TAGS")?Re(gn(qe),O.ADD_DATA_URI_TAGS,R):qe,Q=an(O,"FORBID_CONTENTS")?Re({},O.FORBID_CONTENTS,R):Te,ce=an(O,"FORBID_TAGS")?Re({},O.FORBID_TAGS,R):gn({}),ke=an(O,"FORBID_ATTR")?Re({},O.FORBID_ATTR,R):gn({}),q=an(O,"USE_PROFILES")?O.USE_PROFILES:!1,Oe=O.ALLOW_ARIA_ATTR!==!1,N=O.ALLOW_DATA_ATTR!==!1,X=O.ALLOW_UNKNOWN_PROTOCOLS||!1,oe=O.ALLOW_SELF_CLOSE_IN_ATTR!==!1,k=O.SAFE_FOR_TEMPLATES||!1,w=O.SAFE_FOR_XML!==!1,I=O.WHOLE_DOCUMENT||!1,Ce=O.RETURN_DOM||!1,Be=O.RETURN_DOM_FRAGMENT||!1,A=O.RETURN_TRUSTED_TYPE||!1,le=O.FORCE_BODY||!1,_=O.SANITIZE_DOM!==!1,W=O.SANITIZE_NAMED_PROPS||!1,Pe=O.KEEP_CONTENT!==!1,ue=O.IN_PLACE||!1,J=O.ALLOWED_URI_REGEXP||eu,$t=O.NAMESPACE||Pt,Ft=O.MATHML_TEXT_INTEGRATION_POINTS||Ft,fo=O.HTML_INTEGRATION_POINTS||fo,se=O.CUSTOM_ELEMENT_HANDLING||{},O.CUSTOM_ELEMENT_HANDLING&&pe(O.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(se.tagNameCheck=O.CUSTOM_ELEMENT_HANDLING.tagNameCheck),O.CUSTOM_ELEMENT_HANDLING&&pe(O.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(se.attributeNameCheck=O.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),O.CUSTOM_ELEMENT_HANDLING&&typeof O.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(se.allowCustomizedBuiltInElements=O.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),k&&(N=!1),Be&&(Ce=!0),q&&(ne=Re({},Yd),Y=[],q.html===!0&&(Re(ne,Xd),Re(Y,Qd)),q.svg===!0&&(Re(ne,Ca),Re(Y,za),Re(Y,Ci)),q.svgFilters===!0&&(Re(ne,va),Re(Y,za),Re(Y,Ci)),q.mathMl===!0&&(Re(ne,Na),Re(Y,Zd),Re(Y,Ci))),O.ADD_TAGS&&(typeof O.ADD_TAGS=="function"?Se.tagCheck=O.ADD_TAGS:(ne===ee&&(ne=gn(ne)),Re(ne,O.ADD_TAGS,R))),O.ADD_ATTR&&(typeof O.ADD_ATTR=="function"?Se.attributeCheck=O.ADD_ATTR:(Y===te&&(Y=gn(Y)),Re(Y,O.ADD_ATTR,R))),O.ADD_URI_SAFE_ATTR&&Re(Je,O.ADD_URI_SAFE_ATTR,R),O.FORBID_CONTENTS&&(Q===Te&&(Q=gn(Q)),Re(Q,O.FORBID_CONTENTS,R)),O.ADD_FORBID_CONTENTS&&(Q===Te&&(Q=gn(Q)),Re(Q,O.ADD_FORBID_CONTENTS,R)),Pe&&(ne["#text"]=!0),I&&Re(ne,["html","head","body"]),ne.table&&(Re(ne,["tbody"]),delete ce.tbody),O.TRUSTED_TYPES_POLICY){if(typeof O.TRUSTED_TYPES_POLICY.createHTML!="function")throw gr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof O.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw gr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');z=O.TRUSTED_TYPES_POLICY,b=z.createHTML("")}else z===void 0&&(z=sb(h,r)),z!==null&&typeof b=="string"&&(b=z.createHTML(""));vt&&vt(O),B=O}},nt=Re({},[...Ca,...va,...Jy]),ho=Re({},[...Na,...Xy]),rr=function(O){let ae=S(O);(!ae||!ae.tagName)&&(ae={namespaceURI:$t,tagName:"template"});const be=Si(O.tagName),Ge=Si(ae.tagName);return Oo[O.namespaceURI]?O.namespaceURI===en?ae.namespaceURI===Pt?be==="svg":ae.namespaceURI===At?be==="svg"&&(Ge==="annotation-xml"||Ft[Ge]):!!nt[be]:O.namespaceURI===At?ae.namespaceURI===Pt?be==="math":ae.namespaceURI===en?be==="math"&&fo[Ge]:!!ho[be]:O.namespaceURI===Pt?ae.namespaceURI===en&&!fo[Ge]||ae.namespaceURI===At&&!Ft[Ge]?!1:!ho[be]&&(oi[be]||!nt[be]):!!($n==="application/xhtml+xml"&&Oo[O.namespaceURI]):!1},jt=function(O){hr(e.removed,{element:O});try{S(O).removeChild(O)}catch{y(O)}},Ln=function(O,ae){try{hr(e.removed,{attribute:ae.getAttributeNode(O),from:ae})}catch{hr(e.removed,{attribute:null,from:ae})}if(ae.removeAttribute(O),O==="is")if(Ce||Be)try{jt(ae)}catch{}else try{ae.setAttribute(O,"")}catch{}},si=function(O){let ae=null,be=null;if(le)O="<remove></remove>"+O;else{const ot=Sa(O,/^[\r\n\t ]+/);be=ot&&ot[0]}$n==="application/xhtml+xml"&&$t===Pt&&(O='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+O+"</body></html>");const Ge=z?z.createHTML(O):O;if($t===Pt)try{ae=new f().parseFromString(Ge,$n)}catch{}if(!ae||!ae.documentElement){ae=v.createDocument($t,"template",null);try{ae.documentElement.innerHTML=Et?b:Ge}catch{}}const wt=ae.body||ae.documentElement;return O&&be&&wt.insertBefore(t.createTextNode(be),wt.childNodes[0]||null),$t===Pt?M.call(ae,I?"html":"body")[0]:I?ae.documentElement:wt},Ys=function(O){return E.call(O.ownerDocument||O,O,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},ir=function(O){return O instanceof p&&(typeof O.nodeName!="string"||typeof O.textContent!="string"||typeof O.removeChild!="function"||!(O.attributes instanceof u)||typeof O.removeAttribute!="function"||typeof O.setAttribute!="function"||typeof O.namespaceURI!="string"||typeof O.insertBefore!="function"||typeof O.hasChildNodes!="function")},he=function(O){return typeof l=="function"&&O instanceof l};function fe(we,O,ae){wi(we,be=>{be.call(e,O,ae,B)})}const ve=function(O){let ae=null;if(fe($.beforeSanitizeElements,O,null),ir(O))return jt(O),!0;const be=R(O.nodeName);if(fe($.uponSanitizeElement,O,{tagName:be,allowedTags:ne}),w&&O.hasChildNodes()&&!he(O.firstElementChild)&&Nt(/<[/\w!]/g,O.innerHTML)&&Nt(/<[/\w!]/g,O.textContent)||O.nodeType===br.progressingInstruction||w&&O.nodeType===br.comment&&Nt(/<[/\w]/g,O.data))return jt(O),!0;if(!(Se.tagCheck instanceof Function&&Se.tagCheck(be))&&(!ne[be]||ce[be])){if(!ce[be]&&Ht(be)&&(se.tagNameCheck instanceof RegExp&&Nt(se.tagNameCheck,be)||se.tagNameCheck instanceof Function&&se.tagNameCheck(be)))return!1;if(Pe&&!Q[be]){const Ge=S(O)||O.parentNode,wt=T(O)||O.childNodes;if(wt&&Ge){const ot=wt.length;for(let Lt=ot-1;Lt>=0;--Lt){const Vn=g(wt[Lt],!0);Vn.__removalCount=(O.__removalCount||0)+1,Ge.insertBefore(Vn,x(O))}}}return jt(O),!0}return O instanceof c&&!rr(O)||(be==="noscript"||be==="noembed"||be==="noframes")&&Nt(/<\/no(script|embed|frames)/i,O.innerHTML)?(jt(O),!0):(k&&O.nodeType===br.text&&(ae=O.textContent,wi([P,L,V],Ge=>{ae=mr(ae,Ge," ")}),O.textContent!==ae&&(hr(e.removed,{element:O.cloneNode()}),O.textContent=ae)),fe($.afterSanitizeElements,O,null),!1)},Qe=function(O,ae,be){if(_&&(ae==="id"||ae==="name")&&(be in t||be in Z))return!1;if(!(N&&!ke[ae]&&Nt(F,ae))){if(!(Oe&&Nt(H,ae))){if(!(Se.attributeCheck instanceof Function&&Se.attributeCheck(ae,O))){if(!Y[ae]||ke[ae]){if(!(Ht(O)&&(se.tagNameCheck instanceof RegExp&&Nt(se.tagNameCheck,O)||se.tagNameCheck instanceof Function&&se.tagNameCheck(O))&&(se.attributeNameCheck instanceof RegExp&&Nt(se.attributeNameCheck,ae)||se.attributeNameCheck instanceof Function&&se.attributeNameCheck(ae,O))||ae==="is"&&se.allowCustomizedBuiltInElements&&(se.tagNameCheck instanceof RegExp&&Nt(se.tagNameCheck,be)||se.tagNameCheck instanceof Function&&se.tagNameCheck(be))))return!1}else if(!Je[ae]){if(!Nt(J,mr(be,G,""))){if(!((ae==="src"||ae==="xlink:href"||ae==="href")&&O!=="script"&&Wy(be,"data:")===0&&De[O])){if(!(X&&!Nt(U,mr(be,G,"")))){if(be)return!1}}}}}}}return!0},Ht=function(O){return O!=="annotation-xml"&&Sa(O,K)},fn=function(O){fe($.beforeSanitizeAttributes,O,null);const{attributes:ae}=O;if(!ae||ir(O))return;const be={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let Ge=ae.length;for(;Ge--;){const wt=ae[Ge],{name:ot,namespaceURI:Lt,value:Vn}=wt,sr=R(ot),Nc=Vn;let mt=ot==="value"?Nc:qy(Nc);if(be.attrName=sr,be.attrValue=mt,be.keepAttr=!0,be.forceKeepAttr=void 0,fe($.uponSanitizeAttribute,O,be),mt=be.attrValue,W&&(sr==="id"||sr==="name")&&(Ln(ot,O),mt=de+mt),w&&Nt(/((--!?|])>)|<\/(style|title|textarea)/i,mt)){Ln(ot,O);continue}if(sr==="attributename"&&Sa(mt,"href")){Ln(ot,O);continue}if(be.forceKeepAttr)continue;if(!be.keepAttr){Ln(ot,O);continue}if(!oe&&Nt(/\/>/i,mt)){Ln(ot,O);continue}k&&wi([P,L,V],Em=>{mt=mr(mt,Em," ")});const km=R(O.nodeName);if(!Qe(km,sr,mt)){Ln(ot,O);continue}if(z&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Lt)switch(h.getAttributeType(km,sr)){case"TrustedHTML":{mt=z.createHTML(mt);break}case"TrustedScriptURL":{mt=z.createScriptURL(mt);break}}if(mt!==Nc)try{Lt?O.setAttributeNS(Lt,ot,mt):O.setAttribute(ot,mt),ir(O)?jt(O):Jd(e.removed)}catch{Ln(ot,O)}}fe($.afterSanitizeAttributes,O,null)},mI=function we(O){let ae=null;const be=Ys(O);for(fe($.beforeSanitizeShadowDOM,O,null);ae=be.nextNode();)fe($.uponSanitizeShadowNode,ae,null),ve(ae),fn(ae),ae.content instanceof i&&we(ae.content);fe($.afterSanitizeShadowDOM,O,null)};return e.sanitize=function(we){let O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ae=null,be=null,Ge=null,wt=null;if(Et=!we,Et&&(we="<!-->"),typeof we!="string"&&!he(we))if(typeof we.toString=="function"){if(we=we.toString(),typeof we!="string")throw gr("dirty is not a string, aborting")}else throw gr("toString is not a function");if(!e.isSupported)return we;if(j||Ae(O),e.removed=[],typeof we=="string"&&(ue=!1),ue){if(we.nodeName){const Vn=R(we.nodeName);if(!ne[Vn]||ce[Vn])throw gr("root node is forbidden and cannot be sanitized in-place")}}else if(we instanceof l)ae=si("<!---->"),be=ae.ownerDocument.importNode(we,!0),be.nodeType===br.element&&be.nodeName==="BODY"||be.nodeName==="HTML"?ae=be:ae.appendChild(be);else{if(!Ce&&!k&&!I&&we.indexOf("<")===-1)return z&&A?z.createHTML(we):we;if(ae=si(we),!ae)return Ce?null:A?b:""}ae&&le&&jt(ae.firstChild);const ot=Ys(ue?we:ae);for(;Ge=ot.nextNode();)ve(Ge),fn(Ge),Ge.content instanceof i&&mI(Ge.content);if(ue)return we;if(Ce){if(Be)for(wt=C.call(ae.ownerDocument);ae.firstChild;)wt.appendChild(ae.firstChild);else wt=ae;return(Y.shadowroot||Y.shadowrootmode)&&(wt=D.call(o,wt,!0)),wt}let Lt=I?ae.outerHTML:ae.innerHTML;return I&&ne["!doctype"]&&ae.ownerDocument&&ae.ownerDocument.doctype&&ae.ownerDocument.doctype.name&&Nt(tu,ae.ownerDocument.doctype.name)&&(Lt="<!DOCTYPE "+ae.ownerDocument.doctype.name+`>
|
|
340
|
+
`+Lt),k&&wi([P,L,V],Vn=>{Lt=mr(Lt,Vn," ")}),z&&A?z.createHTML(Lt):Lt},e.setConfig=function(){let we=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ae(we),j=!0},e.clearConfig=function(){B=null,j=!1},e.isValidAttribute=function(we,O,ae){B||Ae({});const be=R(we),Ge=R(O);return Qe(be,Ge,ae)},e.addHook=function(we,O){typeof O=="function"&&hr($[we],O)},e.removeHook=function(we,O){if(O!==void 0){const ae=Hy($[we],O);return ae===-1?void 0:Uy($[we],ae,1)[0]}return Jd($[we])},e.removeHooks=function(we){$[we]=[]},e.removeAllHooks=function(){$=ou()},e}var iu=ru();function Ta(n){return iu.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 it(n){return typeof n!="string"?"":n.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function yt(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}function su(n){return iu.sanitize(n,{ADD_TAGS:["img","picture","source","video","audio","svg","path","use"],ADD_ATTR:["z-if","z-tag","z-empty","z-for","z-slot","class","id","style","src","href","alt","title","width","height","target","rel","role","aria-level","aria-label","aria-hidden","loading","decoding","fetchpriority","data-*"],FORBID_TAGS:["script","iframe","object","embed","form","input","button","textarea","select"],FORBID_ATTR:["onerror","onload","onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","onfocus","onblur","onkeydown","onkeyup","onkeypress","onsubmit","onreset","onchange","oninput","oncontextmenu","ontouchstart","ontouchmove","ontouchend","onpointerdown","onpointerup","ontoggle","onscroll","onwheel","onresize","onanimationstart","onanimationend","ontransitionend"],ALLOW_DATA_ATTR:!0,WHOLE_DOCUMENT:!1,RETURN_DOM:!1,RETURN_DOM_FRAGMENT:!1})}const ye={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 ab(n){const e={};for(const t of n){if(t==="required"){e.required=!0;continue}if(t==="readonly"){e.readonly=!0;continue}if(t==="disabled"){e.disabled=!0;continue}if(t.startsWith("max=")){const o=Number(t.slice(4));Number.isFinite(o)&&(e.maxLength=o)}}return e}function Me(n){const e=n.split(":"),t=[],o=r=>r==="required"||r==="readonly"||r==="disabled"||/^max=\d+$/.test(r);for(;e.length>0&&o(e[e.length-1]);)t.unshift(e.pop());return{defaultValue:e.join(":"),validation:ab(t)}}function qn(n){const e=[],t=new Set,o=ba(),a=new o().parseFromString(`<template>${n}</template>`,"text/html").querySelector("template");if(!a)return e;const l=d=>{if(d.nodeType===Ei){const u=d.textContent||"",p=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(p)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]){const w=k[1],I=k[2];if(!t.has(w)){const{defaultValue:j,validation:le}=Me(k[3]);e.push({fieldName:w,groupName:I,type:"rich",defaultValue:j,optional:!0,...le}),t.add(w)}}});const h=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(h)).forEach(k=>{if(k&&k[1]&&k[2]){const w=k[1];if(!t.has(w)){const{defaultValue:I,validation:j}=Me(k[2]);e.push({fieldName:w,type:"rich",defaultValue:I,optional:!0,...j}),t.add(w)}}});const g=new RegExp(ye.RICH_TEXT_FIELD_WITH_GROUP.source,ye.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(g)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]){const w=k[1],I=k[2];if(!t.has(w)){const{defaultValue:j,validation:le}=Me(k[3]);e.push({fieldName:w,groupName:I,type:"rich",defaultValue:j,...le}),t.add(w)}}});const x=new RegExp(ye.RICH_TEXT_FIELD.source,ye.RICH_TEXT_FIELD.flags);Array.from(u.matchAll(x)).forEach(k=>{if(k&&k[1]&&k[2]){const w=k[1];if(!t.has(w)){const{defaultValue:I,validation:j}=Me(k[2]);e.push({fieldName:w,type:"rich",defaultValue:I,...j}),t.add(w)}}});const S=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(S)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!t.has(k[1])){const{defaultValue:w,validation:I}=Me(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"textarea",defaultValue:w,optional:!0,...I}),t.add(k[1])}});const b=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(b)).forEach(k=>{if(k&&k[1]&&k[2]&&!t.has(k[1])){const{defaultValue:w,validation:I}=Me(k[2]);e.push({fieldName:k[1],type:"textarea",defaultValue:w,optional:!0,...I}),t.add(k[1])}});const E=new RegExp(ye.TEXTAREA_FIELD_WITH_GROUP.source,ye.TEXTAREA_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(E)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!t.has(k[1])){const{defaultValue:w,validation:I}=Me(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"textarea",defaultValue:w,...I}),t.add(k[1])}});const M=new RegExp(ye.TEXTAREA_FIELD.source,ye.TEXTAREA_FIELD.flags);Array.from(u.matchAll(M)).forEach(k=>{if(k&&k[1]&&k[2]&&!t.has(k[1])){const{defaultValue:w,validation:I}=Me(k[2]);e.push({fieldName:k[1],type:"textarea",defaultValue:w,...I}),t.add(k[1])}});const $=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll($)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!t.has(k[1])){const{defaultValue:w,validation:I}=Me(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"image",defaultValue:w,optional:!0,...I}),t.add(k[1])}});const L=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(L)).forEach(k=>{if(k&&k[1]&&k[2]&&!t.has(k[1])){const{defaultValue:w,validation:I}=Me(k[2]);e.push({fieldName:k[1],type:"image",defaultValue:w,optional:!0,...I}),t.add(k[1])}});const F=new RegExp(ye.IMAGE_FIELD_WITH_GROUP.source,ye.IMAGE_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(F)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!t.has(k[1])){const{defaultValue:w,validation:I}=Me(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"image",defaultValue:w,...I}),t.add(k[1])}});const U=new RegExp(ye.IMAGE_FIELD.source,ye.IMAGE_FIELD.flags);Array.from(u.matchAll(U)).forEach(k=>{if(k&&k[1]&&k[2]&&!t.has(k[1])){const{defaultValue:w,validation:I}=Me(k[2]);e.push({fieldName:k[1],type:"image",defaultValue:w,...I}),t.add(k[1])}});const K=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(K)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!t.has(k[1])){const{defaultValue:w,validation:I}=Me(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"text",defaultValue:w,optional:!0,...I}),t.add(k[1])}});const ne=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(ne)).forEach(k=>{if(k&&k[0]&&!/:rich(?::[^}]*)?\}$/.test(k[0])&&!/:image(?::[^}]*)?\}$/.test(k[0])&&!/:textarea(?::[^}]*)?\}$/.test(k[0])&&!k[0].includes(".")&&k[1]&&k[2]&&!t.has(k[1])){const{defaultValue:w,validation:I}=Me(k[2]);e.push({fieldName:k[1],type:"text",defaultValue:w,optional:!0,...I}),t.add(k[1])}});const Y=new RegExp(ye.TEXT_FIELD_WITH_GROUP.source,ye.TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(Y)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!t.has(k[1])){const{defaultValue:w,validation:I}=Me(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"text",defaultValue:w,...I}),t.add(k[1])}});const se=new RegExp(ye.TEXT_FIELD.source,ye.TEXT_FIELD.flags);Array.from(u.matchAll(se)).forEach(k=>{if(k&&k[0]&&!/:rich(?::[^}]*)?\}$/.test(k[0])&&!/:image(?::[^}]*)?\}$/.test(k[0])&&!/:textarea(?::[^}]*)?\}$/.test(k[0])&&!k[0].includes(".")&&k[1]&&k[2]&&!t.has(k[1])){const{defaultValue:w,validation:I}=Me(k[2]);e.push({fieldName:k[1],type:"text",defaultValue:w,...I}),t.add(k[1])}});const ke=new RegExp(ye.SELECT_FIELD_WITH_GROUP.source,ye.SELECT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(ke)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!t.has(k[1])){const w=k[1],I=k[2],j=k[3];j.includes("|")?e.push({fieldName:w,groupName:I,type:"select",options:j.split("|")}):j.includes(",")&&e.push({fieldName:w,groupName:I,type:"select-multiple",options:j.split(",")}),t.add(w)}}),(u.match(ye.SELECT_FIELD)||[]).forEach(k=>{const w=k.match(/\(\$(\w+)@:([^)]+)\)/);if(w&&!t.has(w[1])){const I=w[1],j=w[2];j.includes("|")?e.push({fieldName:I,type:"select",options:j.split("|")}):j.includes(",")&&e.push({fieldName:I,type:"select-multiple",options:j.split(",")}),t.add(I)}});const N=new RegExp(ye.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,ye.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(N)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!t.has(k[1])){const w=k[1],I=k[2],j=k[3];j.includes("|")?e.push({fieldName:w,groupName:I,type:"radio",options:j.split("|")}):j.includes(",")&&e.push({fieldName:w,groupName:I,type:"checkbox",options:j.split(",")}),t.add(w)}}),(u.match(ye.RADIO_FIELD)||[]).forEach(k=>{const w=k.match(/\(\$(\w+):([^)]+)\)/);if(w&&!t.has(w[1])){const I=w[1],j=w[2];j.includes("|")?e.push({fieldName:I,type:"radio",options:j.split("|")}):j.includes(",")&&e.push({fieldName:I,type:"checkbox",options:j.split(",")}),t.add(I)}});return}else if(d.nodeType===ki){const u=d,p=u.getAttribute("z-if");p&&!t.has(p)&&(e.push({fieldName:p,type:"boolean",defaultValue:"true"}),t.add(p));const f=u.getAttribute("z-tag");if(f){const m=f.match(/^\$(\w+)(?::(.+))?$/);if(m){const g=m[1],y=m[2];if(!t.has(g)){const x=y?y.split("|").map(z=>z.trim()):void 0,T=u.tagName.toLowerCase();let S=T;x&&!x.includes(T)&&(S=x[0]),e.push({fieldName:g,type:"tag",defaultValue:S,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:X,validation:oe}=Me(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"rich",defaultValue:X,optional:!0,...oe}),t.add(N[1])}});const T=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(g.matchAll(T)).forEach(N=>{if(N&&N[1]&&N[2]&&!t.has(N[1])){const{defaultValue:X,validation:oe}=Me(N[2]);e.push({fieldName:N[1],type:"rich",defaultValue:X,optional:!0,...oe}),t.add(N[1])}});const z=new RegExp(ye.RICH_TEXT_FIELD_WITH_GROUP.source,ye.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(z)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!t.has(N[1])){const{defaultValue:X,validation:oe}=Me(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"rich",defaultValue:X,...oe}),t.add(N[1])}});const v=new RegExp(ye.RICH_TEXT_FIELD.source,ye.RICH_TEXT_FIELD.flags);Array.from(g.matchAll(v)).forEach(N=>{if(N&&N[1]&&N[2]&&!t.has(N[1])){const{defaultValue:X,validation:oe}=Me(N[2]);e.push({fieldName:N[1],type:"rich",defaultValue:X,...oe}),t.add(N[1])}});const C=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(g.matchAll(C)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!t.has(N[1])){const{defaultValue:X,validation:oe}=Me(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"image",defaultValue:X,optional:!0,...oe}),t.add(N[1])}});const D=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(g.matchAll(D)).forEach(N=>{if(N&&N[1]&&N[2]&&!t.has(N[1])){const{defaultValue:X,validation:oe}=Me(N[2]);e.push({fieldName:N[1],type:"image",defaultValue:X,optional:!0,...oe}),t.add(N[1])}});const P=new RegExp(ye.IMAGE_FIELD_WITH_GROUP.source,ye.IMAGE_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(P)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!t.has(N[1])){const{defaultValue:X,validation:oe}=Me(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"image",defaultValue:X,...oe}),t.add(N[1])}});const V=new RegExp(ye.IMAGE_FIELD.source,ye.IMAGE_FIELD.flags);Array.from(g.matchAll(V)).forEach(N=>{if(N&&N[1]&&N[2]&&!t.has(N[1])){const{defaultValue:X,validation:oe}=Me(N[2]);e.push({fieldName:N[1],type:"image",defaultValue:X,...oe}),t.add(N[1])}});const H=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(g.matchAll(H)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!t.has(N[1])){const{defaultValue:X,validation:oe}=Me(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"text",defaultValue:X,optional:!0,...oe}),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:X,validation:oe}=Me(N[2]);e.push({fieldName:N[1],type:"text",defaultValue:X,optional:!0,...oe}),t.add(N[1])}});const J=new RegExp(ye.TEXT_FIELD_WITH_GROUP.source,ye.TEXT_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(J)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!t.has(N[1])){const{defaultValue:X,validation:oe}=Me(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"text",defaultValue:X,...oe}),t.add(N[1])}});const ee=new RegExp(ye.TEXT_FIELD.source,ye.TEXT_FIELD.flags);Array.from(g.matchAll(ee)).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:X,validation:oe}=Me(N[2]);e.push({fieldName:N[1],type:"text",defaultValue:X,...oe}),t.add(N[1])}});const te=new RegExp(ye.SELECT_FIELD_WITH_GROUP.source,ye.SELECT_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(te)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!t.has(N[1])){const X=N[1],oe=N[2],k=N[3];k.includes("|")?e.push({fieldName:X,groupName:oe,type:"select",options:k.split("|")}):k.includes(",")&&e.push({fieldName:X,groupName:oe,type:"select-multiple",options:k.split(",")}),t.add(X)}}),(g.match(ye.SELECT_FIELD)||[]).forEach(N=>{const X=N.match(/\(\$(\w+)@:([^)]+)\)/);if(X&&!t.has(X[1])){const oe=X[1],k=X[2];k.includes("|")?e.push({fieldName:oe,type:"select",options:k.split("|")}):k.includes(",")&&e.push({fieldName:oe,type:"select-multiple",options:k.split(",")}),t.add(oe)}});const ke=new RegExp(ye.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,ye.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(g.matchAll(ke)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!t.has(N[1])){const X=N[1],oe=N[2],k=N[3];k.includes("|")?e.push({fieldName:X,groupName:oe,type:"radio",options:k.split("|")}):k.includes(",")&&e.push({fieldName:X,groupName:oe,type:"checkbox",options:k.split(",")}),t.add(X)}}),(g.match(ye.RADIO_FIELD)||[]).forEach(N=>{const X=N.match(/\(\$(\w+):([^)]+)\)/);if(X&&!t.has(X[1])){const oe=X[1],k=X[2];k.includes("|")?e.push({fieldName:oe,type:"radio",options:k.split("|")}):k.includes(",")&&e.push({fieldName:oe,type:"checkbox",options:k.split(",")}),t.add(oe)}})}),Array.from(d.childNodes).forEach(m=>l(m));return}else if(d.nodeType===Node.DOCUMENT_FRAGMENT_NODE){Array.from(d.childNodes).forEach(p=>l(p));return}};return Array.from(a.content.childNodes).forEach(d=>l(d)),e}function lb(n,e,t){const o=ba(),a=new o().parseFromString(`<template>${n}</template>`,"text/html").querySelector("template");if(!a||!a.content.firstElementChild)return ge.warn("Failed to parse HTML:",n),n;const l=a.content.firstElementChild;if(Object.entries(e).forEach(([c,d])=>{l.setAttribute(c,d)}),t?.addClass){const c=l.getAttribute("class")?.trim()||"",d=c?`${c} ${t.addClass}`:t.addClass;l.setAttribute("class",d)}return l.outerHTML}function vi(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 ge.warn(`Image not found: ${n}, using default: ${e}`),a.url}return ge.warn(`Image not found: ${n}, default: ${e}`),""}function cb(n){return typeof n=="object"&&n!==null}function au(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(cb(r)&&a in r)r=r[a];else return""}return r==null?"":String(r)}catch(t){return ge.warn(`Failed to resolve backend data path: ${e}`,t),""}}function db(n,e){return!n||!e?n:n.replace(/\{(\w+)\}/g,(t,o)=>{const r=e[o];return r==null?t:String(r)})}const ub=["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"];function pb(n,e){n.querySelectorAll("[z-if]").forEach(t=>{const o=t.getAttribute("z-if");o?(e[o]!==void 0?e[o]:!0)?t.removeAttribute("z-if"):t.remove():t.removeAttribute("z-if")})}function fb(n,e,t){n.querySelectorAll("[z-tag]").forEach(o=>{const r=o.getAttribute("z-tag");if(r){const i=r.match(/^\$(\w+)(?::(.+))?$/);if(i){const a=i[1],l=e[a],c=typeof l=="string"?l:o.tagName.toLowerCase(),d=typeof c=="string"?c.toLowerCase():c;if(typeof d=="string"&&ub.includes(d)){const u=t.createElement(d);Array.from(o.attributes).forEach(p=>{p.name!=="z-tag"&&u.setAttribute(p.name,p.value)}),Array.from(o.childNodes).forEach(p=>{u.appendChild(p.cloneNode(!0))}),o.parentNode?.replaceChild(u,o)}}}})}function hb(n){if(n==null||n==="")return!0;if(typeof n=="string"){const e=n.trim();if(e===""||e==="<p></p>"||e==="<p> </p>"||/^<p>\s*<\/p>$/i.test(e)||/^<p>\s*<br\s*\/?>\s*<\/p>$/i.test(e))return!0}return!1}function mb(n,e){n.querySelectorAll("[z-empty]").forEach(t=>{const o=t.getAttribute("z-empty");if(o){const r=o.match(/^\$(\w+)$/);if(r){const i=r[1],a=e[i];hb(a)?t.remove():t.removeAttribute("z-empty")}else t.removeAttribute("z-empty")}else t.removeAttribute("z-empty")})}function Ma(n,e,t,o,r,i=!0,a=[],l=[],c=[],d,u){const p=ba(),f=new p,h=f.parseFromString(`<template>${n}</template>`,"text/html"),m=h.querySelector("template");if(!m||!m.content)return ge.error("Failed to parse template HTML"),n;const g=b=>{if(b.nodeType===Ei){let v=b.textContent||"";d&&(v=v.replace(ye.BACKEND_DATA,(K,J)=>au(d,J)));let C=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(v),M=!1;if(C&&b.parentNode?M=!0:C=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(v),C&&b.parentNode){const K=C[1],J=M?C[3]:C[2],{defaultValue:ne}=Me(J),ee=e[K];if(typeof ee=="boolean"){const Oe=b.parentNode,N=C.index||0,X=v.substring(0,N),oe=v.substring(N+C[0].length);X&&Oe.insertBefore(h.createTextNode(X),b),oe&&Oe.insertBefore(h.createTextNode(oe),b),b.parentNode&&b.parentNode.removeChild(b);return}let Y=ee===void 0?"":typeof ee=="string"?ee:String(ee||ne);i||(Y=Ta(Y));const te=b.parentNode,se=C.index||0,ce=v.substring(0,se),ke=v.substring(se+C[0].length);Y?Y.trim().startsWith("<p")||(Y=`<p>${Y}</p>`):Y="";const Se=h.createElement("div");Se.innerHTML=Y,ce&&te.insertBefore(h.createTextNode(ce),b),Array.from(Se.childNodes).forEach(Oe=>{te.insertBefore(Oe.cloneNode(!0),b)}),ke&&te.insertBefore(h.createTextNode(ke),b),b.parentNode&&b.parentNode.removeChild(b);return}let $=new RegExp(ye.RICH_TEXT_FIELD_WITH_GROUP.source,ye.RICH_TEXT_FIELD_WITH_GROUP.flags).exec(v),P=!1;if($&&b.parentNode?P=!0:$=new RegExp(ye.RICH_TEXT_FIELD.source,ye.RICH_TEXT_FIELD.flags).exec(v),$&&b.parentNode){const K=$[1],J=P?$[3]:$[2],ne=e[K];let ee=ne===void 0?"":typeof ne=="string"?ne:String(ne||J);i||(ee=Ta(ee));const Y=b.parentNode,te=$.index||0,se=v.substring(0,te),ce=v.substring(te+$[0].length);ee?ee.trim().startsWith("<p")||(ee=`<p>${ee}</p>`):ee="<p></p>";const ke=h.createElement("div");ke.innerHTML=ee,se&&Y.insertBefore(h.createTextNode(se),b),Array.from(ke.childNodes).forEach(Se=>{Y.insertBefore(Se.cloneNode(!0),b)}),ce&&Y.insertBefore(h.createTextNode(ce),b),b.parentNode&&b.parentNode.removeChild(b);return}let V=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(v),F=!1;if(V&&b.parentNode?F=!0:V=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(v),V&&b.parentNode){const K=V[1],J=F?V[3]:V[2],{defaultValue:ne}=Me(J),ee=e[K],Y=ee===void 0?"":String(ee||ne),te=b.parentNode,se=V.index||0,ce=v.substring(0,se),ke=v.substring(se+V[0].length);ce&&te.insertBefore(h.createTextNode(ce),b);const Se=Y.split(`
|
|
341
|
+
`);if(Se.forEach((Oe,N)=>{Oe&&te.insertBefore(h.createTextNode(Oe),b),N<Se.length-1&&te.insertBefore(h.createElement("br"),b)}),ke){const Oe=h.createTextNode(ke);te.insertBefore(Oe,b),g(Oe)}b.parentNode&&b.parentNode.removeChild(b);return}let U=new RegExp(ye.TEXTAREA_FIELD_WITH_GROUP.source,ye.TEXTAREA_FIELD_WITH_GROUP.flags).exec(v),G=!1;if(U&&b.parentNode?G=!0:U=new RegExp(ye.TEXTAREA_FIELD.source,ye.TEXTAREA_FIELD.flags).exec(v),U&&b.parentNode){const K=U[1],J=G?U[3]:U[2],ne=e[K]??J??"",ee=String(ne),Y=b.parentNode,te=U.index||0,se=v.substring(0,te),ce=v.substring(te+U[0].length);se&&Y.insertBefore(h.createTextNode(se),b);const ke=ee.split(`
|
|
342
|
+
`);if(ke.forEach((Se,Oe)=>{Se&&Y.insertBefore(h.createTextNode(Se),b),Oe<ke.length-1&&Y.insertBefore(h.createElement("br"),b)}),ce){const Se=h.createTextNode(ce);Y.insertBefore(Se,b),g(Se)}b.parentNode&&b.parentNode.removeChild(b);return}v=v.replace(/\{\$(\w+)\?:([^}]+)\}/g,(K,J,ne)=>{if(/:textarea(?::[^}]*)?$/.test(K))return K;const ee=e[J];if(ee===void 0||typeof ee=="boolean")return"";const{defaultValue:Y}=Me(ne);return String(ee||Y)}),v=v.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(K,J,ne,ee)=>{if(/:textarea(?::[^}]*)?$/.test(K))return K;const Y=e[J];if(Y===void 0||typeof Y=="boolean")return"";const{defaultValue:te}=Me(ee);return String(Y||te)}),v=v.replace(ye.TEXT_FIELD_WITH_GROUP,(K,J,ne,ee)=>{const Y=e[J];if(Y===void 0)return"";const{defaultValue:te}=Me(ee);return String(Y||te)}),v=v.replace(ye.TEXT_FIELD,(K,J,ne)=>{const ee=e[J];if(ee===void 0)return"";const{defaultValue:Y}=Me(ne);return String(ee||Y)}),b.textContent=v}else if(b.nodeType===ki){const v=b,E=[];Array.from(v.attributes).forEach(C=>{const M=C.value;let D=C.value;const $=C.name.toLowerCase();if($==="z-if"||$==="z-for"||$==="z-slot"||$==="z-empty"||$==="z-tag"||$.startsWith("data-zcode-"))return;const P=/^\{\$[\w.]+?\?:[^}]+\}(?::(rich|image|textarea))?$/.test(M.trim());d&&(($==="href"||$==="src"||$==="action")&&(D=db(D,d)),D=D.replace(ye.BACKEND_DATA,(L,V)=>{const F=au(d,V);return $==="href"||$==="src"||$==="action"?yt(F):it(F)})),D=D.replace(/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(L,V,F)=>{const H=e[V];if(H===void 0||typeof H=="boolean")return"";const{defaultValue:U}=Me(F);return it(String(H||U))}),D=D.replace(/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(L,V,F,H)=>{const U=e[V];if(U===void 0||typeof U=="boolean")return"";const{defaultValue:G}=Me(H);return it(String(U||G))}),D=D.replace(/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(L,V,F)=>{const H=e[V];if(H===void 0)return"";const{defaultValue:U}=Me(F),G=typeof H=="string"?H:String(H||U),K=vi(G,U,a,l,c),J=typeof K=="string"?K:String(K||U);return $==="href"||$==="src"?yt(J):it(J)}),D=D.replace(/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(L,V,F,H)=>{const U=e[V];if(U===void 0)return"";const{defaultValue:G}=Me(H),K=typeof U=="string"?U:String(U||G),J=vi(K,G,a,l,c),ne=typeof J=="string"?J:String(J||G);return $==="href"||$==="src"?yt(ne):it(ne)}),D=D.replace(ye.RICH_TEXT_FIELD_WITH_GROUP,(L,V,F,H)=>{const U=e[V];return U===void 0?"":it(String(U||H))}),D=D.replace(ye.RICH_TEXT_FIELD,(L,V,F)=>{const H=e[V];return H===void 0?"":it(String(H||F))}),D=D.replace(ye.IMAGE_FIELD_WITH_GROUP,(L,V,F,H)=>{const U=e[V];if(U===void 0)return"";const G=vi(U||H,H,a,l,c);return $==="href"||$==="src"?yt(G||H):it(G||H)}),D=D.replace(ye.IMAGE_FIELD,(L,V,F)=>{const H=e[V];if(H===void 0)return"";const U=vi(H||F,F,a,l,c);return $==="href"||$==="src"?yt(U||F):it(U||F)}),D=D.replace(/\{\$(\w+)\?:([^}]+)\}/g,(L,V,F)=>{const H=e[V];if(H===void 0||typeof H=="boolean")return"";const{defaultValue:U}=Me(F),G=String(H||U);return $==="href"||$==="src"||$==="action"?yt(G):it(G)}),D=D.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(L,V,F,H)=>{const U=e[V];if(U===void 0||typeof U=="boolean")return"";const{defaultValue:G}=Me(H),K=String(U||G);return $==="href"||$==="src"||$==="action"?yt(K):it(K)}),D=D.replace(ye.TEXT_FIELD_WITH_GROUP,(L,V,F,H)=>{const U=e[V];if(U===void 0)return"";const{defaultValue:G}=Me(H),K=String(U||G);return $==="href"||$==="src"||$==="action"?yt(K):it(K)}),D=D.replace(ye.TEXT_FIELD,(L,V,F)=>{const H=e[V];if(H===void 0)return"";const{defaultValue:U}=Me(F),G=String(H||U);return $==="href"||$==="src"||$==="action"?yt(G):it(G)}),P&&D.trim()===""?E.push(C.name):C.value=D}),E.forEach(C=>{v.removeAttribute(C)})}Array.from(b.childNodes).forEach(v=>g(v))};g(m.content);const y=b=>{if(b.nodeType===Ei){let v=b.textContent||"";v=v.replace(ye.SELECT_FIELD_WITH_GROUP,(E,C,M,D)=>{if(D.includes("|"))return e[C]||D.split("|")[0];if(D.includes(",")){const $=e[C],P=Array.isArray($)?$:[],L=D.split(",");return P.filter(V=>typeof V=="string"&&L.includes(V)).join(" ")}return e[C]||D}),v=v.replace(ye.SELECT_FIELD,(E,C,M)=>{if(M.includes("|")){const $=e[C];return typeof $=="string"?$:M.split("|")[0]}else if(M.includes(",")){const $=e[C],P=Array.isArray($)?$:[],L=M.split(",");return P.filter(V=>typeof V=="string"&&L.includes(V)).join(" ")}const D=e[C];return typeof D=="string"?D:M}),v=v.replace(ye.RADIO_CHECKBOX_FIELD_WITH_GROUP,(E,C,M,D)=>{if(D.includes("|")){const P=e[C];return typeof P=="string"?P:D.split("|")[0]}else if(D.includes(",")){const P=e[C],L=Array.isArray(P)?P:[],V=D.split(",");return L.filter(F=>typeof F=="string"&&V.includes(F)).join(" ")}const $=e[C];return typeof $=="string"?$:D}),v=v.replace(ye.RADIO_FIELD,(E,C,M)=>{if(M.includes("|")){const $=e[C];return typeof $=="string"?$:M.split("|")[0]}else if(M.includes(",")){const $=e[C],P=Array.isArray($)?$:[],L=M.split(",");return P.filter(V=>typeof V=="string"&&L.includes(V)).join(" ")}const D=e[C];return typeof D=="string"?D:M}),b.textContent=v}else b.nodeType===ki&&Array.from(b.attributes).forEach(E=>{let C=E.value;const M=E.name.toLowerCase();C=C.replace(ye.SELECT_FIELD_WITH_GROUP,(D,$,P,L)=>{let V;if(L.includes("|"))V=e[$]||L.split("|")[0];else if(L.includes(",")){const F=e[$],H=Array.isArray(F)?F:[],U=L.split(",");V=H.filter(G=>typeof G=="string"&&U.includes(G)).join(" ")}else{const F=e[$];V=typeof F=="string"?F:L}return M==="href"||M==="src"||M==="action"?yt(String(V)):it(String(V))}),C=C.replace(ye.SELECT_FIELD,(D,$,P)=>{let L;if(P.includes("|"))L=e[$]||P.split("|")[0];else if(P.includes(",")){const V=e[$],F=Array.isArray(V)?V:[],H=P.split(",");L=F.filter(U=>typeof U=="string"&&H.includes(U)).join(" ")}else{const V=e[$];L=typeof V=="string"?V:P}return M==="href"||M==="src"||M==="action"?yt(String(L)):it(String(L))}),C=C.replace(ye.RADIO_CHECKBOX_FIELD_WITH_GROUP,(D,$,P,L)=>{let V;if(L.includes("|"))V=e[$]||L.split("|")[0];else if(L.includes(",")){const F=e[$],H=Array.isArray(F)?F:[],U=L.split(",");V=H.filter(G=>typeof G=="string"&&U.includes(G)).join(" ")}else{const F=e[$];V=typeof F=="string"?F:L}return M==="href"||M==="src"||M==="action"?yt(String(V)):it(String(V))}),C=C.replace(ye.RADIO_FIELD,(D,$,P)=>{let L;if(P.includes("|"))L=e[$]||P.split("|")[0];else if(P.includes(",")){const V=e[$],F=Array.isArray(V)?V:[],H=P.split(",");L=F.filter(U=>typeof U=="string"&&H.includes(U)).join(" ")}else{const V=e[$];L=typeof V=="string"?V:P}return M==="href"||M==="src"||M==="action"?yt(String(L)):it(String(L))}),E.value=C});b.childNodes.forEach(v=>y(v))};y(m.content),pb(m.content,e),fb(m.content,e,h),mb(m.content,e);const x=()=>{Array.from(m.content.querySelectorAll("[z-for]")).forEach(v=>{const E=v.getAttribute("z-for");if(!E){v.removeAttribute("z-for");return}const C=E.match(/^(\w+)\s+in\s+(.+)$/);if(!C){ge.warn(`Invalid z-for syntax: ${E}`),v.removeAttribute("z-for");return}const[,M,D]=C;if(!D.startsWith("{@")||!D.endsWith("}")){ge.warn(`z-for only supports backend data: ${D}`),v.removeAttribute("z-for");return}const $=D.slice(2,-1);if(!d){v.remove();return}let P;try{const F=$.split(".");let H=d;for(const U of F)if(H&&typeof H=="object"&&U in H)H=H[U];else{H=null;break}P=H}catch(F){ge.warn(`Failed to resolve data source: ${$}`,F),v.remove();return}if(!Array.isArray(P)||P.length===0){v.remove();return}const L=v.ownerDocument??(typeof document<"u"?document:null);if(!L)throw new Error("Document not available for createDocumentFragment");const V=L.createDocumentFragment();P.forEach(F=>{const H=v.cloneNode(!0);H.removeAttribute("z-for"),T(H,M,F,e,d),V.appendChild(H)}),v.parentNode&&v.parentNode.replaceChild(V,v)})},T=(b,v,E,C,M,D)=>{const $=L=>{if(L.nodeType===Ei){let V=L.textContent||"";const F=new RegExp(`\\{${v}\\.([\\w\\.\\[\\]]+)\\}`,"g");V=V.replace(F,(H,U)=>{try{const G=U.split(/[.[\]]/).filter(J=>J);let K=E;for(const J of G)if(J.match(/^\d+$/)){const ne=parseInt(J,10);if(Array.isArray(K)&&ne>=0&&ne<K.length)K=K[ne];else return""}else if(K&&typeof K=="object"&&J in K)K=K[J];else return"";return K==null?"":String(K)}catch{return""}}),V=V.replace(new RegExp(`\\{${v}\\}`,"g"),()=>typeof E=="object"&&E!==null?JSON.stringify(E):String(E)),L.textContent=V}else if(L.nodeType===ki){const V=L;Array.from(V.attributes).forEach(F=>{let H=F.value;const U=new RegExp(`\\{${v}\\.([\\w\\.\\[\\]]+)\\}`,"g");H=H.replace(U,(G,K)=>{try{const J=K.split(/[.[\]]/).filter(Y=>Y);let ne=E;for(const Y of J)if(Y.match(/^\d+$/)){const te=parseInt(Y,10);if(Array.isArray(ne)&&te>=0&&te<ne.length)ne=ne[te];else return""}else if(ne&&typeof ne=="object"&&Y in ne)ne=ne[Y];else return"";const ee=ne==null?"":String(ne);return F.name==="href"||F.name==="src"||F.name==="action"?yt(ee):it(ee)}catch{return""}}),H=H.replace(new RegExp(`\\{${v}\\}`,"g"),()=>{const G=typeof E=="object"&&E!==null?JSON.stringify(E):String(E);return F.name==="href"||F.name==="src"||F.name==="action"?yt(G):it(G)}),F.value=H}),Array.from(V.childNodes).forEach(F=>$(F))}};Array.from(b.childNodes).forEach(L=>$(L));const P=b.innerHTML;if(P){const L=Ma(P,C,t,o,r,i,a,l,c,M);b.innerHTML=L}};x();const S=b=>{b.forEach(v=>{const E=v.getAttribute("z-slot")||"default",C=e.slots?.[E];let M=[];if(Array.isArray(C)?M=C:C&&typeof C=="object"&&C.children&&(M=C.children||[]),M.length===0){if(v.removeAttribute("z-slot"),i){v.setAttribute("data-zcode-empty-slot",E),v.setAttribute("data-zcode-slot-path",t?`${t}.slots.${E}`:`slots.${E}`);const L=u?.translations?.addSlotButton??"+ Add Part";v.innerHTML=`<div class="zcode-empty-slot" data-zcode-empty-slot-content>
|
|
343
|
+
<button class="zcode-add-slot-btn" data-zcode-add-slot>${L}</button>
|
|
344
|
+
</div>`}else v.innerHTML="";return}const D=M.map((L,V)=>{const F=t?`${t}.slots.${E}.${V}`:`slots.${E}.${V}`;return r(L,F)}).join("");v.removeAttribute("z-slot");const P=f.parseFromString(`<template>${D}</template>`,"text/html").querySelector("template");if(P&&P.content)for(v.innerHTML="";P.content.firstChild;)v.appendChild(P.content.firstChild);else v.innerHTML=D})},z=Array.from(m.content.querySelectorAll("[z-slot]"));return S(z),m.innerHTML}function ln(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 Gn(){return`zcode-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function gb(n){return n.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^\s*([a-zA-Z])/,e=>e.toUpperCase())}function yb(n){return gb(n)}function lu(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 Aa(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 bb(n){return Array.isArray(n)?n:n.children??[]}function Ni(n,e,t){for(let o=0;o<n.length;o++){const r=n[o],i=e?`${e}.${o}`:String(o),a=t(r,i);if(a!==void 0)return a;if(r.slots)for(const[l,c]of Object.entries(r.slots)){const d=bb(c);if(d.length>0){const u=`${i}.slots.${l}`,p=Ni(d,u,t);if(p!==void 0)return p}}}}function xb(n,e){return Ni(n,"page",o=>{if(o.part_id===e)return o})??null}class Vo extends Error{constructor(e,t,o){super(o),this.code=e,this.path=t,this.name="RenderError"}}function cu(n,e,t,o,r){if(t.has(e))throw new Vo("CIRCULAR_REFERENCE",e,`循環参照が検出されました: ${e}`);t.add(e);const i=n.part_id,a=o.findPart(i);if(!a)throw new Vo("PART_NOT_FOUND",e,`パーツが見つかりません: ${i}`);const l=Ma(a.body,n,e,o.findPart,r,o.enableEditorAttributes,o.imagesCommon,o.imagesIndividual,o.imagesSpecial,o.backendData,o.options);return o.enableEditorAttributes?lb(l,{"data-zcode-id":n.id,"data-zcode-path":e,"data-zcode-part":i},a.outlinePosition==="inner"?{addClass:"zcode-outline-inner"}:void 0):l}const kb=["common","individual","special"];function Eb(n){return n?kb.filter(e=>n[e]?.trim()).map(e=>{const t=n[e].replace(/<\/style/gi,"<\\/style");return`<style id="zcode-css-style-${e}" data-zcode-css="true" data-zcode-css-category="${e}">${t}</style>`}).join(`
|
|
345
|
+
`):""}function wb(n,e={}){const{enableEditorAttributes:t=!1}=e,o=n.backendData;if(!n)throw new Vo("PARSE_ERROR","","データが提供されていません");const r=n.parts||{common:[],individual:[],special:[]},i=n.images||{common:[],individual:[],special:[]},a=n.page||[];function l(u){return Aa(u,r)}const c={findPart:l,enableEditorAttributes:t,imagesCommon:i.common,imagesIndividual:i.individual,imagesSpecial:i.special,backendData:o};function d(u,p,f){return cu(u,p,f,c,(h,m)=>d(h,m,f))}return a.map((u,p)=>{try{return d(u,`page.${p}`,new Set)}catch(f){if(f instanceof Vo)return`<div class="zcode-error-message" data-error-code="${f.code}">${f.message}</div>`;throw f}}).join("")}function Sb(n){return`<div class="zcode-error-message" data-error-code="${n.code}">${n.message}</div>`}function zi(n,e=!0){const{t}=rn();function o(l){return Aa(l,n.parts)}const r=s.computed(()=>({findPart:o,enableEditorAttributes:e,imagesCommon:n.images.common,imagesIndividual:n.images.individual,imagesSpecial:n.images.special,backendData:n.backendData,options:e?{translations:{addSlotButton:t("emptyState.addPart")}}:void 0}));function i(l,c="",d=new Set){try{return cu(l,c,d,r.value,(u,p)=>i(u,p,d))}catch(u){if(u instanceof Vo)return Sb(u);throw u}}return{fullPageHtml:s.computed(()=>n.page.map((l,c)=>i(l,`page.${c}`)).join("")),renderComponentToHtml:i,findPart:o}}const Ti=s.defineComponent({__name:"ZeroCodePreview",props:{cmsData:{type:Object},allowDynamicContentInteraction:{type:Boolean}},setup(n,{expose:e}){const t=n,{fullPageHtml:o}=zi(t.cmsData,!1),r=s.ref(null),i=s.computed(()=>r.value?.previewArea||null);return e({previewArea:i}),(a,l)=>(s.openBlock(),s.createBlock(Lc,{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"]))}}),Cb={class:"zcode-toolbar"},vb=["title"],Ia=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",Cb,[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(Om),{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(Dc),{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(Do),{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(cr),{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(mo),{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(ea),{size:16})],8,vb)]))}}),du="zcode-user-settings";function Bo(){try{const n=localStorage.getItem(du);return n?JSON.parse(n):{}}catch(n){return ge.warn("Failed to load user settings:",n),{}}}function _a(n){try{const e=Bo(),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(du,JSON.stringify(t))}catch(e){ge.warn("Failed to save user settings:",e)}}function Nb(n=null){const e=Bo();return e.locale!==void 0?e.locale:n}function uu(){return Bo().cms||{}}function Mi(n){const e=Bo();_a({cms:{...e.cms,...n}})}function pu(n,e){return uu()[n]??e}function fu(){return Bo().dev||{}}function Oa(n){const e=Bo();_a({dev:{...e.dev,...n}})}function zb(n,e){return fu()[n]??e}const hu="zcode-dont-show-css-warning-parts";function Tb(){try{return sessionStorage.getItem(hu)==="true"}catch{return!1}}function Mb(n){try{sessionStorage.setItem(hu,String(n))}catch(e){ge.warn("Failed to save CSS warning setting:",e)}}const Ab={class:"zcode-settings-panel-header"},Ib={class:"zcode-settings-panel-header-title",role:"heading","aria-level":"3"},_b={class:"zcode-settings-panel-header-actions"},Ob=["value","aria-label"],Db={value:"ja"},Rb={value:"en"},Pb={class:"zcode-settings-panel-content"},$b={key:0},Lb={key:0,class:"zcode-setting-item"},Vb={class:"zcode-setting-label"},Bb=["checked"],Fb=["title"],jb={key:0,class:"zcode-setting-description"},Hb={key:1,class:"zcode-setting-item"},Ub={class:"zcode-setting-label"},Wb=["checked"],qb=["title"],Gb={key:0,class:"zcode-setting-description"},Kb={key:2,class:"zcode-setting-item"},Jb={class:"zcode-setting-label"},Xb=["checked"],Yb=["title"],Qb={key:0,class:"zcode-setting-description"},Zb={key:3,class:"zcode-setting-item"},e1={class:"zcode-setting-label"},t1=["checked"],n1=["title"],o1={key:0,class:"zcode-setting-description"},r1={key:1,class:"zcode-setting-item"},i1={class:"zcode-setting-info"},Da=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}=rn(),o=s.computed(()=>t.value||"ja");function r(u){const f=u.target.value;t.value=f,_a({locale:f})}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,p)=>n.isOpen?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-settings-panel-overlay",onClick:p[10]||(p[10]=s.withModifiers(f=>u.$emit("close"),["self"]))},[s.createElementVNode("div",{class:"zcode-settings-panel",onClick:p[9]||(p[9]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",Ab,[s.createElementVNode("div",Ib,s.toDisplayString(u.$t("settings.title")),1),s.createElementVNode("div",_b,[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",Rb,s.toDisplayString(u.$t("settings.language.en")),1)],40,Ob),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":"$t('common.close')",onClick:p[0]||(p[0]=f=>u.$emit("close"))},[s.createVNode(s.unref(Ze),{size:18})])])]),s.createElementVNode("div",Pb,[n.viewMode==="manage"?(s.openBlock(),s.createElementBlock("div",$b,[e.mode==="toolbar"||e.mode===void 0?(s.openBlock(),s.createElementBlock("div",Lb,[s.createElementVNode("label",Vb,[s.createElementVNode("input",{type:"checkbox",checked:e.allowDynamicContentInteraction??!1,class:"zcode-setting-checkbox",onChange:p[1]||(p[1]=f=>u.$emit("toggle-dynamic-content",f.target.checked))},null,40,Bb),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:p[2]||(p[2]=s.withModifiers(f=>i.value=!i.value,["stop"]))},[s.createVNode(s.unref(Bn),{size:16})],8,Fb)]),i.value?(s.openBlock(),s.createElementBlock("div",jb,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",Hb,[s.createElementVNode("label",Ub,[s.createElementVNode("input",{type:"checkbox",checked:d.value,class:"zcode-setting-checkbox",onChange:p[3]||(p[3]=f=>u.$emit("toggle-dev-padding",f.target.checked))},null,40,Wb),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:p[4]||(p[4]=s.withModifiers(f=>a.value=!a.value,["stop"]))},[s.createVNode(s.unref(Bn),{size:16})],8,qb)]),a.value?(s.openBlock(),s.createElementBlock("div",Gb,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",Kb,[s.createElementVNode("label",Jb,[s.createElementVNode("input",{type:"checkbox",checked:e.enableContextMenu??!1,class:"zcode-setting-checkbox",onChange:p[5]||(p[5]=f=>u.$emit("toggle-context-menu",f.target.checked))},null,40,Xb),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:p[6]||(p[6]=s.withModifiers(f=>l.value=!l.value,["stop"]))},[s.createVNode(s.unref(Bn),{size:16})],8,Yb)]),l.value?(s.openBlock(),s.createElementBlock("div",Qb,s.toDisplayString(u.$t("settings.enableContextMenuDescription")),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),e.mode==="dev-tabs"?(s.openBlock(),s.createElementBlock("div",Zb,[s.createElementVNode("label",e1,[s.createElementVNode("input",{type:"checkbox",checked:e.showSaveConfirm??!0,class:"zcode-setting-checkbox",onChange:p[7]||(p[7]=f=>u.$emit("toggle-save-confirm",f.target.checked))},null,40,t1),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:p[8]||(p[8]=s.withModifiers(f=>c.value=!c.value,["stop"]))},[s.createVNode(s.unref(Bn),{size:16})],8,n1)]),c.value?(s.openBlock(),s.createElementBlock("div",o1,s.toDisplayString(u.$t("settings.showSaveConfirmDescription")),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)])):(s.openBlock(),s.createElementBlock("div",r1,[s.createElementVNode("div",i1,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 mu(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=mu(r.content,i.content,t+1);if(a!=null)return a}t+=r.nodeSize}}function gu(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=gu(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 mu(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return gu(this,e,t,o)}findIndex(e){if(e==0)return Ai(0,e);if(e==this.size)return Ai(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?Ai(t+1,i):Ai(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 Ra={index:0,offset:0};function Ai(n,e){return Ra.index=n,Ra.offset=e,Ra}function Ii(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(!Ii(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!Ii(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}let je=class zc{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&&Ii(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 zc.none;if(e instanceof zc)return[e];let t=e.slice();return t.sort((o,r)=>o.type.rank-r.type.rank),t}};je.none=[];class _i extends Error{}class me{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=bu(this.content,e+this.openStart,t);return o&&new me(o,this.openStart,this.openEnd)}removeBetween(e,t){return new me(yu(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 me.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 me(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 me(e,o,r)}}me.empty=new me(re.empty,0,0);function yu(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(yu(i.content,e-r-1,t-r-1)))}function bu(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=bu(a.content,e-i-1,t,a);return l&&n.replaceChild(r,a.copy(l))}function s1(n,e,t){if(t.openStart>n.depth)throw new _i("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new _i("Inconsistent open depths");return xu(n,e,t,0)}function xu(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=xu(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 xo(a,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:a,end:l}=a1(t,n);return xo(i,Eu(n,a,l,e,o))}else return xo(i,Oi(n,e,o))}function ku(n,e){if(!e.type.compatibleContent(n.type))throw new _i("Cannot join "+e.type.name+" onto "+n.type.name)}function Pa(n,e,t){let o=n.node(t);return ku(o,e.node(t)),o}function bo(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 xr(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&&(bo(n.nodeAfter,o),i++));for(let l=i;l<a;l++)bo(r.child(l),o);e&&e.depth==t&&e.textOffset&&bo(e.nodeBefore,o)}function xo(n,e){return n.type.checkContent(e),n.copy(e)}function Eu(n,e,t,o,r){let i=n.depth>r&&Pa(n,e,r+1),a=o.depth>r&&Pa(t,o,r+1),l=[];return xr(null,n,r,l),i&&a&&e.index(r)==t.index(r)?(ku(i,a),bo(xo(i,Eu(n,e,t,o,r+1)),l)):(i&&bo(xo(i,Oi(n,e,r+1)),l),xr(e,t,r,l),a&&bo(xo(a,Oi(t,o,r+1)),l)),xr(o,null,r,l),new re(l)}function Oi(n,e,t){let o=[];if(xr(null,n,t,o),n.depth>t){let r=Pa(n,e,t+1);bo(xo(r,Oi(n,e,t+1)),o)}return xr(e,null,t,o),new re(o)}function a1(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 kr{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 je.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 Di(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 kr(t,o,i)}static resolveCached(e,t){let o=wu.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 wu.set(e,o=new l1);let r=o.elts[o.i]=kr.resolve(e,t);return o.i=(o.i+1)%c1,r}}class l1{constructor(){this.elts=[],this.i=0}}const c1=12,wu=new WeakMap;class Di{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 d1=Object.create(null);let Kn=class Tc{constructor(e,t,o,r=je.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&&Ii(this.attrs,t||e.defaultAttrs||d1)&&je.sameSet(this.marks,o||je.none)}copy(e=null){return e==this.content?this:new Tc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Tc(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 me.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 me(d,r.depth-a,i.depth-a)}replace(e,t,o){return s1(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 kr.resolveCached(this,e)}resolveNoCache(e){return kr.resolve(this,e)}rangeHasMark(e,t,o){let r=!1;return t>e&&this.nodesBetween(e,t,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Su(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,o=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=je.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(!je.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}};Kn.prototype.text=void 0;class Ri extends Kn{constructor(e,t,o,r){if(super(e,t,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Su(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ri(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ri(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Su(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class ko{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let o=new u1(e,t);if(o.next==null)return ko.empty;let r=Cu(o);o.next&&o.err("Unexpected trailing text");let i=b1(y1(r));return x1(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:p}=a.next[d];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(p)==-1){r.push(p);let f=i(p,l.concat(u));if(f)return f}}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(`
|
|
346
|
+
`)}}ko.empty=new ko(!0);class u1{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(p1(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function p1(n){let e=[];do e.push(f1(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function f1(n){let e=g1(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=h1(n,e);else break;return e}function vu(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function h1(n,e){let t=vu(n),o=t;return n.eat(",")&&(n.next!="}"?o=vu(n):o=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:o,expr:e}}function m1(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 g1(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=m1(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 y1(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 Nu(n,e){return e-n}function zu(n,e){let t=[];return o(e),t.sort(Nu);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 b1(n){let e=Object.create(null);return t(zu(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]);zu(n,c).forEach(u=>{d||r.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let i=e[o.join(",")]=new ko(o.indexOf(n.length-1)>-1);for(let a=0;a<r.length;a++){let l=r[a][1].sort(Nu);i.next.push({type:r[a][0],next:e[l.join(",")]||t(l)})}return i}}function x1(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 Tu(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 Mu(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 Au(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 Iu(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new E1(n,o,e[o]);return t}let _u=class wm{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=Iu(e,o.attrs),this.defaultAttrs=Tu(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==ko.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:Mu(this.attrs,e)}create(e=null,t,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Kn(this,this.computeAttrs(e),re.from(t),je.setFrom(o))}createChecked(e=null,t,o){return t=re.from(t),this.checkContent(t),new Kn(this,this.computeAttrs(e),t,je.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 Kn(this,e,t.append(i),je.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){Au(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:je.none:e}static compile(e,t){let o=Object.create(null);e.forEach((i,a)=>o[i]=new wm(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 k1(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 E1{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?k1(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class Pi{constructor(e,t,o,r){this.name=e,this.rank=t,this.schema=o,this.spec=r,this.attrs=Iu(e,r.attrs),this.excluded=null;let i=Tu(this.attrs);this.instance=i?new je(this,i):null}create(e=null){return!e&&this.instance?this.instance:new je(this,Mu(this.attrs,e))}static compile(e,t){let o=Object.create(null),r=0;return e.forEach((i,a)=>o[i]=new Pi(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){Au(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Ou{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=_u.compile(this.spec.nodes,this),this.marks=Pi.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]=ko.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?Du(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==""?[]:Du(this,a.split(" "))}this.nodeFromJSON=r=>Kn.fromJSON(this,r),this.markFromJSON=r=>je.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof _u){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 Ri(o,o.defaultAttrs,e,je.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 Du(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 w1(n){return n.tag!=null}function S1(n){return n.style!=null}let Er=class Mc{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(r=>{if(w1(r))this.tags.push(r);else if(S1(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 Lu(this,t,!1);return o.addAll(e,je.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new Lu(this,t,!0);return o.addAll(e,je.none,t.from,t.to),me.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=Vu(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=Vu(a)),a.node||a.ignore||a.mark||(a.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Mc(e,Mc.schemaRules(e)))}};const Ru={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},C1={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Pu={ol:!0,ul:!0},wr=1,$a=2,Sr=4;function $u(n,e,t){return e!=null?(e?wr:0)|(e==="full"?$a:0):n&&n.whitespace=="pre"?wr|$a:t&~Sr}class $i{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=je.none,this.match=i||(a&Sr?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&wr)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let 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&&!Ru.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Lu{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=$u(null,t.preserveWhitespace,0)|(o?Sr:0);r?i=new $i(r.type,r.attrs,je.none,!0,t.topMatch||r.type.contentMatch,a):o?i=new $i(null,null,je.none,!0,null,a):i=new $i(e.schema.topNodeType,null,je.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&$a?"full":this.localPreserveWS||(r.options&wr)>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,`
|
|
347
|
+
`);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;Pu.hasOwnProperty(a)&&this.parser.normalizeLists&&v1(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(c?c.ignore:C1.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(Ru.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 p=c&&c.skip?t:this.readStyles(e,t);p&&this.addAll(e,p),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(`
|
|
348
|
+
`),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=je.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Bu(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=$u(e,i,a.options);a.options&Sr&&a.content.length==0&&(l|=Sr);let c=je.none;return o=o.filter(d=>(a.type?a.type.allowsMarkType(d.type):Bu(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new $i(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|=wr)}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 v1(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&Pu.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 Vu(n){let e={};for(let t in n)e[t]=n[t];return e}function Bu(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 Eo{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},o){o||(o=La(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}=Li(La(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&&Li(La(o),r(e,t),null,e.attrs)}static renderSpec(e,t,o=null,r){return Li(e,t,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Eo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Fu(e.nodes);return t.text||(t.text=o=>o.text),t}static marksFromSchema(e){return Fu(e.marks)}}function Fu(n){let e={};for(let t in n){let o=n[t].spec.toDOM;o&&(e[t]=o)}return e}function La(n){return n.document||window.document}const ju=new WeakMap;function z1(n){let e=ju.get(n);return e===void 0&&ju.set(n,e=T1(n)),e}function T1(n){let e=null;function t(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)t(o[r]);else for(let r in o)t(o[r])}return t(n),e}function Li(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=z1(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 p in d)if(d[p]!=null){let f=p.indexOf(" ");f>0?c.setAttributeNS(p.slice(0,f),p.slice(f+1),d[p]):p=="style"&&c.style?c.style.cssText=d[p]:c.setAttribute(p,d[p])}}for(let p=u;p<e.length;p++){let f=e[p];if(f===0){if(p<e.length-1||p>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}=Li(n,f,t,o);if(c.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:c,contentDOM:l}}const Hu=65535,Uu=Math.pow(2,16);function M1(n,e){return n+e*Uu}function Wu(n){return n&Hu}function A1(n){return(n-(n&Hu))/Uu}const qu=1,Gu=2,Vi=4,Ku=8;class Va{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&Ku)>0}get deletedBefore(){return(this.delInfo&(qu|Vi))>0}get deletedAfter(){return(this.delInfo&(Gu|Vi))>0}get deletedAcross(){return(this.delInfo&Vi)>0}}class Vt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Vt.empty)return Vt.empty}recover(e){let t=0,o=Wu(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+A1(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],p=c+d;if(e<=p){let f=d?e==c?-1:e==p?1:t:t,h=c+r+(f<0?0:u);if(o)return h;let m=e==(t<0?c:p)?null:M1(l/3,e-c),g=e==c?Gu:e==p?qu:Vi;return(t<0?e!=c:e!=p)&&(g|=Ku),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=Wu(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 Vt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Vt.empty:new Vt(e<0?[0,-e,0]:[0,0,e])}}Vt.empty=new Vt([]);class Bi{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 Bi(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 Bi;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 Ba=Object.create(null);class bt{getMap(){return Vt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Ba[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 Ba)throw new RangeError("Duplicate use of step JSON ID "+e);return Ba[e]=t,t.prototype.jsonID=e,t}}class et{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new et(e,null)}static fail(e){return new et(null,e)}static fromReplace(e,t,o,r){try{return et.ok(e.replace(t,o,r))}catch(i){if(i instanceof _i)return et.fail(i.message);throw i}}}function Fa(n,e,t){let o=[];for(let r=0;r<n.childCount;r++){let i=n.child(r);i.content.size&&(i=i.copy(Fa(i.content,e,i))),i.isInline&&(i=e(i,t,r)),o.push(i)}return re.fromArray(o)}class Jn extends bt{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 me(Fa(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 et.fromReplace(e,this.from,this.to,i)}invert(){return new cn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new Jn(t.pos,o.pos,this.mark)}merge(e){return e instanceof Jn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Jn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Jn(t.from,t.to,e.markFromJSON(t.mark))}}bt.jsonID("addMark",Jn);class cn extends bt{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 me(Fa(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return et.fromReplace(e,this.from,this.to,o)}invert(){return new Jn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new cn(t.pos,o.pos,this.mark)}merge(e){return e instanceof cn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new cn(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 cn(t.from,t.to,e.markFromJSON(t.mark))}}bt.jsonID("removeMark",cn);class Xn extends bt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return et.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return et.fromReplace(e,this.pos,this.pos+1,new me(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 Xn(this.pos,t.marks[r]);return new Xn(this.pos,this.mark)}}return new wo(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Xn(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 Xn(t.pos,e.markFromJSON(t.mark))}}bt.jsonID("addNodeMark",Xn);class wo extends bt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return et.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return et.fromReplace(e,this.pos,this.pos+1,new me(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 Xn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new wo(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 wo(t.pos,e.markFromJSON(t.mark))}}bt.jsonID("removeNodeMark",wo);class at extends bt{constructor(e,t,o,r=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=r}apply(e){return this.structure&&ja(e,this.from,this.to)?et.fail("Structure replace would overwrite content"):et.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Vt([this.from,this.to-this.from,this.slice.size])}invert(e){return new at(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 at(t.pos,Math.max(t.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof at)||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?me.empty:new me(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new at(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?me.empty:new me(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new at(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 at(t.from,t.to,me.fromJSON(e,t.slice),!!t.structure)}}bt.jsonID("replace",at);class lt extends bt{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&&(ja(e,this.from,this.gapFrom)||ja(e,this.gapTo,this.to)))return et.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return et.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,t.content);return o?et.fromReplace(e,this.from,this.to,o):et.fail("Content does not fit in gap")}getMap(){return new Vt([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 lt(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 lt(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 lt(t.from,t.to,t.gapFrom,t.gapTo,me.fromJSON(e,t.slice),t.insert,!!t.structure)}}bt.jsonID("replaceAround",lt);function ja(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 I1(n,e,t,o){let r=[],i=[],a,l;n.doc.nodesBetween(e,t,(c,d,u)=>{if(!c.isInline)return;let p=c.marks;if(!o.isInSet(p)&&u.type.allowsMarkType(o.type)){let f=Math.max(d,e),h=Math.min(d+c.nodeSize,t),m=o.addToSet(p);for(let g=0;g<p.length;g++)p[g].isInSet(m)||(a&&a.to==f&&a.mark.eq(p[g])?a.to=h:r.push(a=new cn(f,h,p[g])));l&&l.to==f?l.to=h:i.push(l=new Jn(f,h,o))}}),r.forEach(c=>n.step(c)),i.forEach(c=>n.step(c))}function _1(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 Pi){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 p=c[u],f;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&p.eq(r[h].style)&&(f=m)}f?(f.to=d,f.step=i):r.push({style:p,from:Math.max(l,e),to:d,step:i})}}}),r.forEach(a=>n.step(new cn(a.from,a.to,a.style)))}function Ha(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,p=o.matchType(d.type);if(!p)a.push(new at(l,u,me.empty));else{o=p;for(let f=0;f<d.marks.length;f++)t.allowsMarkType(d.marks[f].type)||n.step(new cn(l,u,d.marks[f]));if(r&&d.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(d.text);)m||(m=new me(re.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),a.push(new at(l+f.index,l+f.index+f[0].length,m))}}l=u}if(!o.validEnd){let c=o.fillBefore(re.empty,!0);n.replace(l,l,new me(c,0,0))}for(let c=a.length-1;c>=0;c--)n.step(a[c])}function O1(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Fo(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||!O1(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,p=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)),p++):c--;let f=re.empty,h=0;for(let m=i,g=!1;m>t;m--)g||r.after(m+1)<r.end(m)?(g=!0,f=re.from(r.node(m).copy(f)),h++):d++;n.step(new lt(c,d,a,l,new me(u.append(f),p,h),u.size-p,!0))}function Ua(n,e,t=null,o=n){let r=R1(n,e),i=r&&P1(o,e);return i?r.map(Ju).concat({type:e,attrs:t}).concat(i.map(Ju)):null}function Ju(n){return{type:n,attrs:null}}function R1(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 P1(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 $1(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 lt(r,i,r,i,new me(o,0,0),t.length,!0))}function L1(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)&&V1(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&&Yu(n,a,l,i),Ha(n,n.mapping.slice(i).map(l,1),o,void 0,d===null);let u=n.mapping.slice(i),p=u.map(l,1),f=u.map(l+a.nodeSize,1);return n.step(new lt(p,f,p+1,f-1,new me(re.from(o.create(c,null,a.marks)),0,0),1,!0)),d===!0&&Xu(n,a,l,i),!1}})}function Xu(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 Yu(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(`
|
|
349
|
+
`))}})}function V1(n,e,t){let o=n.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,t)}function B1(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 lt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new me(re.from(a),0,0),1,!0))}function zn(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 p=r.node(d),f=r.index(d);if(p.type.spec.isolating)return!1;let h=p.content.cutByIndex(f,p.childCount),m=o&&o[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=o&&o[u]||p;if(!p.canReplace(f+1,p.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 F1(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 at(e,e,new me(i.append(a),t,t),!0))}function Yn(n,e){let t=n.resolve(e),o=t.index();return Qu(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(o,o+1)}function j1(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 Qu(n,e){return!!(n&&e&&!n.isLeaf&&j1(n,e))}function Fi(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&&Qu(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 H1(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",p=!!a.contentMatch.matchType(r);u&&!p?o=!1:!u&&p&&(o=!0)}let l=n.steps.length;if(o===!1){let u=n.doc.resolve(e+t);Yu(n,u.node(),u.before(),l)}a.inlineContent&&Ha(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 at(d,c.map(e+t,-1),me.empty,!0)),o===!0){let u=n.doc.resolve(d);Xu(n,u.node(),u.before(),n.steps.length)}return n}function U1(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 W1(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 p=d.contentMatchAt(c).findWrapping(r.firstChild.type);u=p&&d.canReplaceWith(c,c,p[0])}if(u)return l==0?o.pos:l<0?o.before(a+1):o.after(a+1)}return null}function ji(n,e,t=e,o=me.empty){if(e==t&&!o.size)return null;let r=n.resolve(e),i=n.resolve(t);return Zu(r,i,o)?new at(e,t,o):new q1(r,i,o).fit()}function Zu(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class q1{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 me(i,a,l);return e>-1?new lt(o.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||o.pos!=this.$to.pos?new at(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=Wa(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,p=null;if(t==1&&(a?d.matchType(a.type)||(p=d.fillBefore(re.from(a),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:p};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=Wa(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new me(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=Wa(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new me(Cr(e,t-1,1),t-1,i?t-1:o)}else this.unplaced=new me(Cr(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:p,type:f}=this.frontier[t];if(r){for(let g=0;g<r.childCount;g++)u.push(r.child(g));p=p.matchFragment(r)}let h=l.size+e-(a.content.size-a.openEnd);for(;d<l.childCount;){let g=l.child(d),y=p.matchType(g.type);if(!y)break;d++,(d>1||c==0||g.content.size)&&(p=y,u.push(ep(g.mark(f.allowedMarks(g.marks)),d==1?c:0,d==l.childCount?h:-1)))}let m=d==l.childCount;m||(h=-1),this.placed=vr(this.placed,t,re.from(u)),this.frontier[t].match=p,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?me.empty:new me(Cr(a.content,e-1,1),e-1,h<0?a.openEnd:e-1):new me(Cr(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||!qa(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=qa(e,t,r,o,i);if(a){for(let l=t-1;l>=0;l--){let{match:c,type:d}=this.frontier[l],u=qa(e,l,d,c,!0);if(!u||u.childCount)continue e}return{depth: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=vr(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=vr(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=vr(this.placed,this.frontier.length,t))}}function Cr(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Cr(n.firstChild.content,e-1,t)))}function vr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(vr(n.lastChild.content,e-1,t)))}function Wa(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function ep(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,ep(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 qa(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&&!G1(t,i.content,a)?l:null}function G1(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function K1(n){return n.spec.defining||n.spec.definingForContent}function J1(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),i=n.doc.resolve(t);if(Zu(r,i,o))return n.step(new at(e,t,o));let a=np(r,i);a[a.length-1]==0&&a.pop();let l=-(r.depth+1);a.unshift(l);for(let f=r.depth,h=r.pos-1;f>0;f--,h--){let m=r.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;a.indexOf(f)>-1?l=f:r.before(f)==h&&a.splice(1,0,-f)}let c=a.indexOf(l),d=[],u=o.openStart;for(let f=o.content,h=0;;h++){let m=f.firstChild;if(d.push(m),h==o.openStart)break;f=m.content}for(let f=u-1;f>=0;f--){let h=d[f],m=K1(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))u=f;else if(m||!h.type.isTextblock)break}for(let f=o.openStart;f>=0;f--){let h=(f+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 T=r.node(y-1),S=r.index(y-1);if(T.canReplaceWith(S,S,m.type,m.marks))return n.replace(r.before(y),x?i.after(y):t,new me(tp(o.content,0,o.openStart,h),h,o.openEnd))}}let p=n.steps.length;for(let f=a.length-1;f>=0&&(n.replace(e,t,o),!(n.steps.length>p));f--){let h=a[f];h<0||(e=r.before(h),t=i.after(h))}}function tp(n,e,t,o,r){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(tp(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 X1(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=U1(n.doc,e,o.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new me(re.from(o),0,0))}function Y1(n,e,t){let o=n.doc.resolve(e),r=n.doc.resolve(t),i=np(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 np(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 jo extends bt{constructor(e,t,o){super(),this.pos=e,this.attr=t,this.value=o}apply(e){let t=e.nodeAt(this.pos);if(!t)return et.fail("No node at attribute step's position");let o=Object.create(null);for(let i in t.attrs)o[i]=t.attrs[i];o[this.attr]=this.value;let r=t.type.create(o,null,t.marks);return et.fromReplace(e,this.pos,this.pos+1,new me(re.from(r),0,t.isLeaf?0:1))}getMap(){return Vt.empty}invert(e){return new jo(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 jo(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 jo(t.pos,t.attr,t.value)}}bt.jsonID("attr",jo);class Nr extends bt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let o=e.type.create(t,e.content,e.marks);return et.ok(o)}getMap(){return Vt.empty}invert(e){return new Nr(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 Nr(t.attr,t.value)}}bt.jsonID("docAttr",Nr);let Ho=class extends Error{};Ho=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},Ho.prototype=Object.create(Error.prototype),Ho.prototype.constructor=Ho,Ho.prototype.name="TransformError";class op{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Bi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ho(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=me.empty){let r=ji(this.doc,e,t,o);return r&&this.step(r),this}replaceWith(e,t,o){return this.replace(e,t,new me(re.from(o),0,0))}delete(e,t){return this.replace(e,t,me.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return J1(this,e,t,o),this}replaceRangeWith(e,t,o){return X1(this,e,t,o),this}deleteRange(e,t){return Y1(this,e,t),this}lift(e,t){return D1(this,e,t),this}join(e,t=1){return H1(this,e,t),this}wrap(e,t){return $1(this,e,t),this}setBlockType(e,t=e,o,r=null){return L1(this,e,t,o,r),this}setNodeMarkup(e,t,o=null,r){return B1(this,e,t,o,r),this}setNodeAttribute(e,t,o){return this.step(new jo(e,t,o)),this}setDocAttribute(e,t){return this.step(new Nr(e,t)),this}addNodeMark(e,t){return this.step(new Xn(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 je)t.isInSet(o.marks)&&this.step(new wo(e,t));else{let r=o.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new wo(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 F1(this,e,t,o),this}addMark(e,t,o){return I1(this,e,t,o),this}removeMark(e,t,o){return _1(this,e,t,o),this}clearIncompatible(e,t,o){return Ha(this,e,t,o),this}}const Ga=Object.create(null);class $e{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new Q1(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=me.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?me.empty:t),l==0&&sp(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),sp(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let r=e.parent.inlineContent?new _e(e):Uo(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?Uo(e.node(0),e.node(i),e.before(i+1),e.index(i),t,o):Uo(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 Bt(e.node(0))}static atStart(e){return Uo(e,e,0,0,1)||new Bt(e)}static atEnd(e){return Uo(e,e,e.content.size,e.childCount,-1)||new Bt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Ga[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 Ga)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ga[e]=t,t.prototype.jsonID=e,t}getBookmark(){return _e.between(this.$anchor,this.$head).getBookmark()}}$e.prototype.visible=!0;class Q1{constructor(e,t){this.$from=e,this.$to=t}}let rp=!1;function ip(n){!rp&&!n.parent.inlineContent&&(rp=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class _e extends $e{constructor(e,t=e){ip(e),ip(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 $e.near(o);let r=e.resolve(t.map(this.anchor));return new _e(r.parent.inlineContent?r:o,o)}replace(e,t=me.empty){if(super.replace(e,t),t==me.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof _e&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Hi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new _e(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){let r=e.resolve(t);return new this(r,o==t?r:e.resolve(o))}static between(e,t,o){let r=e.pos-t.pos;if((!o||r)&&(o=r>=0?1:-1),!t.parent.inlineContent){let i=$e.findFrom(t,o,!0)||$e.findFrom(t,-o,!0);if(i)t=i.$head;else return $e.near(t,o)}return e.parent.inlineContent||(r==0?e=t:(e=($e.findFrom(e,-o,!0)||$e.findFrom(e,o,!0)).$anchor,e.pos<t.pos!=r<0&&(e=t))),new _e(e,t)}}$e.jsonID("text",_e);class Hi{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Hi(e.map(this.anchor),e.map(this.head))}resolve(e){return _e.between(e.resolve(this.anchor),e.resolve(this.head))}}class ze extends $e{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?$e.near(i):new ze(i)}content(){return new me(re.from(this.node),0,0)}eq(e){return e instanceof ze&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ka(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ze(e.resolve(t.anchor))}static create(e,t){return new ze(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ze.prototype.visible=!1,$e.jsonID("node",ze);class Ka{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new Hi(o,o):new Ka(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&ze.isSelectable(o)?new ze(t):$e.near(t)}}class Bt extends $e{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=me.empty){if(t==me.empty){e.delete(0,e.doc.content.size);let o=$e.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Bt(e)}map(e){return new Bt(e)}eq(e){return e instanceof Bt}getBookmark(){return Z1}}$e.jsonID("all",Bt);const Z1={map(){return this},resolve(n){return new Bt(n)}};function Uo(n,e,t,o,r,i=!1){if(e.inlineContent)return _e.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&&ze.isSelectable(l))return ze.create(n,t-(r<0?l.nodeSize:0))}else{let c=Uo(n,l,t+r,r<0?l.childCount:0,r,i);if(c)return c}t+=l.nodeSize*r}return null}function sp(n,e,t){let o=n.steps.length-1;if(o<e)return;let r=n.steps[o];if(!(r instanceof at||r instanceof lt))return;let i=n.mapping.maps[o],a;i.forEach((l,c,d,u)=>{a==null&&(a=u)}),n.setSelection($e.near(n.doc.resolve(a),t))}const ap=1,Ui=2,lp=4;class e0 extends op{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|ap)&~Ui,this.storedMarks=null,this}get selectionSet(){return(this.updated&ap)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ui,this}ensureMarks(e){return je.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ui)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Ui,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)||je.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($e.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|=lp,this}get scrolledIntoView(){return(this.updated&lp)>0}}function cp(n,e){return!e||!n?n:n.bind(e)}class zr{constructor(e,t,o){this.name=e,this.init=cp(t.init,o),this.apply=cp(t.apply,o)}}const t0=[new zr("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new zr("selection",{init(n,e){return n.selection||$e.atStart(e.doc)},apply(n){return n.selection}}),new zr("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new zr("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Ja{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=t0.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 zr(o.key,o.spec.state,o))})}}class Wo{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 p=0;p<this.config.plugins.length;p++)r.push(p<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 Wo(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 e0(this)}static create(e){let t=new Ja(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new Wo(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 Ja(this.schema,e.plugins),o=t.fields,r=new Wo(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 Ja(e.schema,e.plugins),i=new Wo(r);return r.fields.forEach(a=>{if(a.name=="doc")i.doc=Kn.fromJSON(e.schema,t.doc);else if(a.name=="selection")i.selection=$e.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 dp(n,e,t){for(let o in n){let r=n[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=dp(r,e,{})),t[o]=r}return t}class _t{constructor(e){this.spec=e,this.props={},e.props&&dp(e.props,this,this.props),this.key=e.key?e.key.key:up("plugin")}getState(e){return e[this.key]}}const Xa=Object.create(null);function up(n){return n in Xa?n+"$"+ ++Xa[n]:(Xa[n]=0,n+"$")}class dn{constructor(e="key"){this.key=up(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ya=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function pp(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const fp=(n,e,t)=>{let o=pp(n,t);if(!o)return!1;let r=Qa(o);if(!r){let a=o.blockRange(),l=a&&Fo(a);return l==null?!1:(e&&e(n.tr.lift(a,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(wp(n,r,e,-1))return!0;if(o.parent.content.size==0&&(qo(i,"end")||ze.isSelectable(i)))for(let a=o.depth;;a--){let l=ji(n.doc,o.before(a),o.after(a),me.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=n.tr.step(l);c.setSelection(qo(i,"end")?$e.findFrom(c.doc.resolve(c.mapping.map(r.pos,-1)),-1):ze.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},n0=(n,e,t)=>{let o=pp(n,t);if(!o)return!1;let r=Qa(o);return r?hp(n,r,e):!1},o0=(n,e,t)=>{let o=gp(n,t);if(!o)return!1;let r=Za(o);return r?hp(n,r,e):!1};function hp(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=ji(n.doc,i,c,me.empty);if(!d||d.from!=i||d instanceof at&&d.slice.size>=c-i)return!1;if(t){let u=n.tr.step(d);u.setSelection(_e.create(u.doc,i)),t(u.scrollIntoView())}return!0}function qo(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 mp=(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=Qa(o)}let a=i&&i.nodeBefore;return!a||!ze.isSelectable(a)?!1:(e&&e(n.tr.setSelection(ze.create(n.doc,i.pos-a.nodeSize)).scrollIntoView()),!0)};function Qa(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 gp(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const yp=(n,e,t)=>{let o=gp(n,t);if(!o)return!1;let r=Za(o);if(!r)return!1;let i=r.nodeAfter;if(wp(n,r,e,1))return!0;if(o.parent.content.size==0&&(qo(i,"start")||ze.isSelectable(i))){let a=ji(n.doc,o.before(),o.after(),me.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=n.tr.step(a);l.setSelection(qo(i,"start")?$e.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):ze.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},bp=(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=Za(o)}let a=i&&i.nodeAfter;return!a||!ze.isSelectable(a)?!1:(e&&e(n.tr.setSelection(ze.create(n.doc,i.pos)).scrollIntoView()),!0)};function Za(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 r0=(n,e)=>{let t=n.selection,o=t instanceof ze,r;if(o){if(t.node.isTextblock||!Yn(n.doc,t.from))return!1;r=t.from}else if(r=Fi(n.doc,t.from,-1),r==null)return!1;if(e){let i=n.tr.join(r);o&&i.setSelection(ze.create(i.doc,r-n.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},i0=(n,e)=>{let t=n.selection,o;if(t instanceof ze){if(t.node.isTextblock||!Yn(n.doc,t.to))return!1;o=t.to}else if(o=Fi(n.doc,t.to,1),o==null)return!1;return e&&e(n.tr.join(o).scrollIntoView()),!0},s0=(n,e)=>{let{$from:t,$to:o}=n.selection,r=t.blockRange(o),i=r&&Fo(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},xp=(n,e)=>{let{$head:t,$anchor:o}=n.selection;return!t.parent.type.spec.code||!t.sameParent(o)?!1:(e&&e(n.tr.insertText(`
|
|
350
|
+
`).scrollIntoView()),!0)};function el(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 a0=(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=el(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($e.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},kp=(n,e)=>{let t=n.selection,{$from:o,$to:r}=t;if(t instanceof Bt||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=el(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(_e.create(l.doc,a+1)),e(l.scrollIntoView())}return!0},Ep=(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(zn(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let o=t.blockRange(),r=o&&Fo(o);return r==null?!1:(e&&e(n.tr.lift(o,r).scrollIntoView()),!0)};function l0(n){return(e,t)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof ze&&e.selection.node.isBlock)return!o.parentOffset||!zn(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=el(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 _e||e.selection instanceof Bt)&&u.deleteSelection();let p=u.mapping.map(o.pos),f=zn(u.doc,p,i.length,i);if(f||(i[0]=l?{type:l}:null,f=zn(u.doc,p,i.length,i)),!f)return!1;if(u.split(p,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 c0=l0(),d0=(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(ze.create(n.doc,r))),!0)};function u0(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||Yn(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function wp(n,e,t,o){let r=e.nodeBefore,i=e.nodeAfter,a,l,c=r.type.spec.isolating||i.type.spec.isolating;if(!c&&u0(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 lt(e.pos-1,h,e.pos,h,new me(m,1,0),a.length,!0)),y=g.doc.resolve(h+2*a.length);y.nodeAfter&&y.nodeAfter.type==r.type&&Yn(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let u=i.type.spec.isolating||o>0&&c?null:$e.findFrom(e,1),p=u&&u.$from.blockRange(u.$to),f=p&&Fo(p);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(p,f).scrollIntoView()),!0;if(d&&qo(i,"start",!0)&&qo(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 S=m.length-1;S>=0;S--)x=re.from(m[S].copy(x));let T=n.tr.step(new lt(e.pos-m.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new me(x,m.length,0),0,!0));t(T.scrollIntoView())}return!0}}return!1}function Sp(n){return function(e,t){let o=e.selection,r=n<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(t&&t(e.tr.setSelection(_e.create(e.doc,n<0?r.start(i):r.end(i)))),!0):!1}}const p0=Sp(-1),f0=Sp(1);function h0(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,a=r.blockRange(i),l=a&&Ua(a,n,e);return l?(o&&o(t.tr.wrap(a,l).scrollIntoView()),!0):!1}}function Cp(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),p=u.index();r=u.parent.canReplaceWith(p,p+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 tl(...n){return function(e,t,o){for(let r=0;r<n.length;r++)if(n[r](e,t,o))return!0;return!1}}tl(Ya,fp,mp),tl(Ya,yp,bp),tl(xp,kp,Ep,c0),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function m0(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 g0(l,a,n,e)?(o&&o(l.scrollIntoView()),!0):!1}}function g0(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 Di(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new Di(e.$from,a.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=Ua(i,t,o,e);return l?(n&&y0(n,e,l,r,t),!0):!1}function y0(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 lt(e.start-(o?2:0),e.end,e.start,e.end,new me(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,p=e.endIndex,f=!0;u<p;u++,f=!1)!f&&zn(n.doc,c,l)&&(n.split(c,l),c+=2*l),c+=d.child(u).nodeSize;return n}function b0(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?x0(e,t,n,i):k0(e,t,i):!0:!1}}function x0(n,e,t,o){let r=n.tr,i=o.end,a=o.$to.end(o.depth);i<a&&(r.step(new lt(i-1,a,i,a,new me(re.from(t.create(null,o.parent.copy())),1,0),1,!0)),o=new Di(r.doc.resolve(o.$from.pos),r.doc.resolve(a),o.depth));const l=Fo(o);if(l==null)return!1;r.lift(o,l);let c=r.doc.resolve(r.mapping.map(i,-1)-1);return Yn(r.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&r.join(c.pos),e(r.scrollIntoView()),!0}function k0(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 p=i.pos,f=p+a.nodeSize;return o.step(new lt(p-(l?1:0),f+(c?1:0),p+1,f-1,new me((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 E0(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),p=new me(re.from(n.create(null,re.from(l.type.create(null,u)))),d?3:1,0),f=i.start,h=i.end;t(e.tr.step(new lt(f-(d?3:1),h,f,h,p,1,!0)).scrollIntoView())}return!0}}const pt=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Go=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let nl=null;const Tn=function(n,e,t){let o=nl||(nl=document.createRange());return o.setEnd(n,t??n.nodeValue.length),o.setStart(n,e||0),o},w0=function(){nl=null},So=function(n,e,t,o){return t&&(vp(n,e,t,o,-1)||vp(n,e,t,o,1))},S0=/^(img|br|input|textarea|hr)$/i;function vp(n,e,t,o,r){for(var i;;){if(n==t&&e==o)return!0;if(e==(r<0?0:Wt(n))){let a=n.parentNode;if(!a||a.nodeType!=1||Tr(n)||S0.test(n.nodeName)||n.contentEditable=="false")return!1;e=pt(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?Wt(n):0}else return!1}}function Wt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function C0(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=Wt(n)}else if(n.parentNode&&!Tr(n))e=pt(n),n=n.parentNode;else return null}}function v0(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&&!Tr(n))e=pt(n)+1,n=n.parentNode;else return null}}function N0(n,e,t){for(let o=e==0,r=e==Wt(n);o||r;){if(n==t)return!0;let i=pt(n);if(n=n.parentNode,!n)return!1;o=o&&i==0,r=r&&i==Wt(n)}}function Tr(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 Wi=function(n){return n.focusNode&&So(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Co(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function z0(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function T0(n,e,t){if(n.caretPositionFromPoint)try{let o=n.caretPositionFromPoint(e,t);if(o)return{node:o.offsetNode,offset:Math.min(Wt(o.offsetNode),o.offset)}}catch{}if(n.caretRangeFromPoint){let o=n.caretRangeFromPoint(e,t);if(o)return{node:o.startContainer,offset:Math.min(Wt(o.startContainer),o.startOffset)}}}const yn=typeof navigator<"u"?navigator:null,Np=typeof document<"u"?document:null,Qn=yn&&yn.userAgent||"",ol=/Edge\/(\d+)/.exec(Qn),zp=/MSIE \d/.exec(Qn),rl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Qn),Ot=!!(zp||rl||ol),Zn=zp?document.documentMode:rl?+rl[1]:ol?+ol[1]:0,qt=!Ot&&/gecko\/(\d+)/i.test(Qn);qt&&+(/Firefox\/(\d+)/.exec(Qn)||[0,0])[1];const il=!Ot&&/Chrome\/(\d+)/.exec(Qn),ct=!!il,Tp=il?+il[1]:0,ft=!Ot&&!!yn&&/Apple Computer/.test(yn.vendor),Ko=ft&&(/Mobile\/\w+/.test(Qn)||!!yn&&yn.maxTouchPoints>2),Gt=Ko||(yn?/Mac/.test(yn.platform):!1),Mp=yn?/Win/.test(yn.platform):!1,Mn=/Android \d/.test(Qn),Mr=!!Np&&"webkitFontSmoothing"in Np.documentElement.style,M0=Mr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function A0(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 An(n,e){return typeof n=="number"?n:n[e]}function I0(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 Ap(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=Go(a);continue}let l=a,c=l==i.body,d=c?A0(i):I0(l),u=0,p=0;if(e.top<d.top+An(o,"top")?p=-(d.top-e.top+An(r,"top")):e.bottom>d.bottom-An(o,"bottom")&&(p=e.bottom-e.top>d.bottom-d.top?e.top+An(r,"top")-d.top:e.bottom-d.bottom+An(r,"bottom")),e.left<d.left+An(o,"left")?u=-(d.left-e.left+An(r,"left")):e.right>d.right-An(o,"right")&&(u=e.right-d.right+An(r,"right")),u||p)if(c)i.defaultView.scrollBy(u,p);else{let h=l.scrollLeft,m=l.scrollTop;p&&(l.scrollTop+=p),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 f=c?"fixed":getComputedStyle(a).position;if(/^(fixed|sticky)$/.test(f))break;a=f=="absolute"?a.offsetParent:Go(a)}}function _0(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:Ip(n.dom)}}function Ip(n){let e=[],t=n.ownerDocument;for(let o=n;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),n!=t);o=Go(o));return e}function O0({refDOM:n,refTop:e,stack:t}){let o=n?n.getBoundingClientRect().top:0;_p(t,o==0?0:o-e)}function _p(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 Jo=null;function D0(n){if(n.setActive)return n.setActive();if(Jo)return n.focus(Jo);let e=Ip(n);n.focus(Jo==null?{get preventScroll(){return Jo={preventScroll:!0},!0}}:void 0),Jo||(Jo=!1,_p(e,0))}function Op(n,e){let t,o=2e8,r,i=0,a=e.top,l=e.top,c,d;for(let u=n.firstChild,p=0;u;u=u.nextSibling,p++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=Tn(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let m=f[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=p+(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=p+1)}}return!t&&c&&(t=c,r=d,o=0),t&&t.nodeType==3?R0(t,r):!t||o&&t.nodeType==1?{node:n,offset:i}:Op(t,r)}function R0(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=eo(o,1);if(a.top!=a.bottom&&sl(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 sl(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function P0(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function $0(n,e,t){let{node:o,offset:r}=Op(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 L0(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 Dp(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(sl(e,d))return Dp(a,e,d)}}if((i=(i+1)%o)==r)break}return n}function V0(n,e){let t=n.dom.ownerDocument,o,r=0,i=T0(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(!sl(e,d)||(a=Dp(n.dom,e,d),!a))return null}if(ft)for(let d=a;o&&d;d=Go(d))d.draggable&&(o=void 0);if(a=P0(a,e),o){if(qt&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let u=o.childNodes[r],p;u.nodeName=="IMG"&&(p=u.getBoundingClientRect()).right<=e.left&&p.bottom>e.top&&r++}let d;Mr&&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=L0(n,o,r,e))}l==null&&(l=$0(n,a,e));let c=n.docView.nearestDesc(a,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function Rp(n){return n.top<n.bottom||n.left<n.right}function eo(n,e){let t=n.getClientRects();if(t.length){let o=t[e<0?0:t.length-1];if(Rp(o))return o}return Array.prototype.find.call(t,Rp)||n.getBoundingClientRect()}const B0=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Pp(n,e,t){let{node:o,offset:r,atom:i}=n.docView.domFromPos(e,t<0?-1:1),a=Mr||qt;if(o.nodeType==3)if(a&&(B0.test(o.nodeValue)||(t<0?!r:r==o.nodeValue.length))){let c=eo(Tn(o,r,r),t);if(qt&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let d=eo(Tn(o,r-1,r-1),-1);if(d.top==c.top){let u=eo(Tn(o,r,r+1),-1);if(u.top!=c.top)return Ar(u,u.left<d.left)}}return c}else{let c=r,d=r,u=t<0?1:-1;return t<0&&!r?(d++,u=-1):t>=0&&r==o.nodeValue.length?(c--,u=1):t<0?c--:d++,Ar(eo(Tn(o,c,d),u),u<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(t<0||r==Wt(o))){let c=o.childNodes[r-1];if(c.nodeType==1)return al(c.getBoundingClientRect(),!1)}if(i==null&&r<Wt(o)){let c=o.childNodes[r];if(c.nodeType==1)return al(c.getBoundingClientRect(),!0)}return al(o.getBoundingClientRect(),t>=0)}if(i==null&&r&&(t<0||r==Wt(o))){let c=o.childNodes[r-1],d=c.nodeType==3?Tn(c,Wt(c)-(a?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return Ar(eo(d,1),!1)}if(i==null&&r<Wt(o)){let c=o.childNodes[r];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?Tn(c,0,a?0:1):c.nodeType==1?c:null:null;if(d)return Ar(eo(d,-1),!0)}return Ar(eo(o.nodeType==3?Tn(o):o,-t),t>=0)}function Ar(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 al(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 $p(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 F0(n,e,t){let o=e.selection,r=t=="up"?o.$from:o.$to;return $p(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=Pp(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=Tn(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(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 j0=/[\u0590-\u08ac]/;function H0(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?!j0.test(o.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:a:$p(n,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:p}=n.domSelectionRange(),f=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,p),c&&(c!=u||d!=p)&&l.extend&&l.extend(c,d)}catch{}return f!=null&&(l.caretBidiLevel=f),y}):o.pos==o.start()||o.pos==o.end()}let Lp=null,Vp=null,Bp=!1;function U0(n,e,t){return Lp==e&&Vp==t?Bp:(Lp=e,Vp=t,Bp=t=="up"||t=="down"?F0(n,e,t):H0(n,e,t))}const Kt=0,Fp=1,vo=2,bn=3;class Ir{constructor(e,t,o,r){this.parent=e,this.children=t,this.dom=o,this.contentDOM=r,this.dirty=Kt,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>pt(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 Up){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 jp&&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?pt(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?pt(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 p=l;p>0;p--){let f=this.children[p-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){r=pt(f.dom)+1;break}e-=f.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 p=this.children[u];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(-1)){i=pt(p.dom);break}t+=p.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(),p=!1;if((qt||ft)&&e==t){let{node:h,offset:m}=l;if(h.nodeType==3){if(p=!!(m&&h.nodeValue[m-1]==`
|
|
351
|
+
`),p&&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:pt(y)+1});break}let x=g.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let g=h.childNodes[m-1];p=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(qt&&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||p&&ft)&&So(l.node,l.offset,u.anchorNode,u.anchorOffset)&&So(c.node,c.offset,u.focusNode,u.focusOffset))return;let f=!1;if((d.extend||e==t)&&!(p&&qt)){d.collapse(l.node,l.offset);try{e!=t&&d.extend(c.node,c.offset),f=!0}catch{}}if(!f){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?vo:Fp,e==l&&t==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=bn:i.markDirty(e-l,t-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?vo:bn}o=a}this.dirty=vo}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let o=e==1?vo:Fp;t.dirty<o&&(t.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class jp extends Ir{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==Kt&&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 W0 extends Ir{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 No extends Ir{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=Eo.renderSpec(document,t.type.spec.toDOM(t,o),null,t.attrs)),new No(e,t,a.dom,a.contentDOM||a.dom,a)}parseRule(){return this.dirty&bn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=bn&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Kt){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=Kt}}slice(e,t,o){let r=No.create(this.parent,this.mark,!0,o),i=this.children,a=this.size;t<a&&(i=cl(i,t,a,o)),e>0&&(i=cl(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 to extends Ir{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,p=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:p}=Eo.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!p&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=Gp(u,o,t),d?c=new q0(e,t,o,r,u,p||null,f,d,i,a+1):t.isText?new qi(e,t,o,r,u,f,i):new to(e,t,o,r,u,p||null,f,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==Kt&&e.eq(this.node)&&Gi(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 K0(this,a&&a.node,e);Y0(this.node,this.innerDeco,(d,u,p)=>{d.spec.marks?c.syncToMarks(d.spec.marks,o,e,u):d.type.side>=0&&!p&&c.syncToMarks(u==this.node.childCount?je.none:this.node.child(u).marks,o,e,u),c.placeWidget(d,e,r)},(d,u,p,f)=>{c.syncToMarks(d.marks,o,e,f);let h;c.findNodeMatch(d,u,p,f)||l&&e.state.selection.from>r&&e.state.selection.to<r+d.nodeSize&&(h=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(d,u,p,h,e)||c.updateNextNode(d,u,p,e,f,r)||c.addNode(d,u,p,e,r),r+=d.nodeSize}),c.syncToMarks([],o,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==vo)&&(a&&this.protectLocalComposition(e,a),Wp(this.contentDOM,this.children,e),Ko&&Q0(this.dom))}localCompositionInfo(e,t){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof _e)||o<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let a=i.nodeValue,l=Z0(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 W0(this,i,t,r);e.input.compositionNodes.push(a),this.children=cl(this.children,o,o+r.length,e,a)}update(e,t,o,r){return this.dirty==bn||!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=Kt}updateOuterDeco(e){if(Gi(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=qp(this.dom,this.nodeDOM,ll(this.outerDeco,this.node,t),ll(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 Hp(n,e,t,o,r){Gp(o,e,n);let i=new to(void 0,n,e,t,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class qi extends to{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==bn||this.dirty!=Kt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Kt||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=Kt,!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 qi(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=bn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Up extends Ir{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Kt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class q0 extends to{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==bn)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 Wp(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=Kp(o),r=!0;o=o.nextSibling}else r=!0,n.insertBefore(l,o);if(a instanceof No){let c=o?o.previousSibling:n.lastChild;Wp(a.contentDOM,a.children,t),o=c?c.nextSibling:n.firstChild}}for(;o;)o=Kp(o),r=!0;r&&t.trackWrites==n&&(t.trackWrites=null)}const _r=function(n){n&&(this.nodeName=n)};_r.prototype=Object.create(null);const zo=[new _r];function ll(n,e,t){if(n.length==0)return zo;let o=t?zo[0]:new _r,r=[o];for(let i=0;i<n.length;i++){let a=n[i].type.attrs;if(a){a.nodeName&&r.push(o=new _r(a.nodeName));for(let l in a){let c=a[l];c!=null&&(t&&r.length==1&&r.push(o=new _r(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 qp(n,e,t,o){if(t==zo&&o==zo)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=zo[0]),r=c}G0(r,l||zo[0],a)}return r}function G0(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 Gp(n,e,t){return qp(n,n,zo,ll(e,t,n.nodeType!=1))}function Gi(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 Kp(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class K0{constructor(e,t,o){this.lock=t,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=J0(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=Kt,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 p=this.top.children[u];if(p.matchesMark(e[a])&&!this.isLocked(p.dom)){c=u;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let u=No.create(this.top,e[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==bn&&a.dom==a.contentDOM&&(a.dirty=vo),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 to){let d=this.preMatch.matched.get(c);if(d!=null&&d!=i)return!1;let u=c.dom,p,f=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=bn&&Gi(t,c.outerDeco));if(!f&&c.update(e,t,o,r))return this.destroyBetween(this.index,l),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(p=this.recreateWrapper(c,e,t,o,r,a)))return this.destroyBetween(this.index,l),this.top.children[this.index]=p,p.contentDOM&&(p.dirty=vo,p.updateChildren(r,a+1),p.dirty=Kt),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)||!Gi(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=to.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=to.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 jp(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 No;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof qi)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ft||ct)&&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 Up(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 J0(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 No)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 X0(n,e){return n.type.side-e.type.side}function Y0(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,p;for(;a<r.length&&r[a].to==i;){let y=r[a++];y.widget&&(u?(p||(p=[u])).push(y):u=y)}if(u)if(p){p.sort(X0);for(let y=0;y<p.length;y++)t(p[y],d,!!c)}else t(u,d,!!c);let f,h;if(c)h=-1,f=c,c=null;else if(d<n.childCount)h=d,f=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+f.nodeSize;if(f.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=f.cut(y-i),f=f.cut(0,y-i),m=y,h=-1)}else for(;a<r.length&&r[a].to<m;)a++;let g=f.isInline&&!f.isLeaf?l.filter(y=>!y.inline):l.slice();o(f,g,e.forChild(i,f),h),i=m}}function Q0(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 Z0(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 cl(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 dl(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(Wi(t)){for(c=a;r&&!r.node;)r=r.parent;let p=r.node;if(r&&p.isAtom&&ze.isSelectable(p)&&r.parent&&!(p.isInline&&N0(t.focusNode,t.focusOffset,r.dom))){let f=r.posBefore;d=new ze(a==f?l:o.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let p=a,f=a;for(let h=0;h<t.rangeCount;h++){let m=t.getRangeAt(h);p=Math.min(p,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(p<0)return null;[c,a]=f==n.state.selection.anchor?[f,p]:[p,f],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 p=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;d=pl(n,u,l,p)}return d}function Jp(n){return n.editable?n.hasFocus():nf(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function In(n,e=!1){let t=n.state.selection;if(Zp(n,t),!!Jp(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&ct){let o=n.domSelectionRange(),r=n.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&So(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)tx(n);else{let{anchor:o,head:r}=t,i,a;Xp&&!(t instanceof _e)&&(t.$from.parent.inlineContent||(i=Yp(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=Yp(n,t.to))),n.docView.setSelection(o,r,n,e),Xp&&(i&&Qp(i),a&&Qp(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&ex(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Xp=ft||ct&&Tp<63;function Yp(n,e){let{node:t,offset:o}=n.docView.domFromPos(e,0),r=o<t.childNodes.length?t.childNodes[o]:null,i=o?t.childNodes[o-1]:null;if(ft&&r&&r.contentEditable=="false")return ul(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return ul(r);if(i)return ul(i)}}function ul(n){return n.contentEditable="true",ft&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Qp(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function ex(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(()=>{(!Jp(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function tx(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,o=t.nodeName=="IMG";o?e.collapse(t.parentNode,pt(t)+1):e.collapse(t,0),!o&&!n.state.selection.visible&&Ot&&Zn<=11&&(t.disabled=!0,t.disabled=!1)}function Zp(n,e){if(e instanceof ze){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(ef(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else ef(n)}function ef(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function pl(n,e,t,o){return n.someProp("createSelectionBetween",r=>r(n,e,t))||_e.between(e,t,o)}function tf(n){return n.editable&&!n.hasFocus()?!1:nf(n)}function nf(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 nx(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return So(e.node,e.offset,t.anchorNode,t.anchorOffset)}function fl(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&&$e.findFrom(i,e)}function no(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function of(n,e,t){let o=n.state.selection;if(o instanceof _e)if(t.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=n.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return no(n,new _e(o.$anchor,a))}else if(o.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let r=fl(n.state,e);return r&&r instanceof ze?no(n,r):!1}else if(!(Gt&&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?ze.isSelectable(i)?no(n,new ze(e<0?n.state.doc.resolve(r.pos-i.nodeSize):r)):Mr?no(n,new _e(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof ze&&o.node.isInline)return no(n,new _e(e>0?o.$to:o.$from));{let r=fl(n.state,e);return r?no(n,r):!1}}}function Ki(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Or(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Xo(n,e){return e<0?ox(n):rx(n)}function ox(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r,i,a=!1;for(qt&&t.nodeType==1&&o<Ki(t)&&Or(t.childNodes[o],-1)&&(a=!0);;)if(o>0){if(t.nodeType!=1)break;{let l=t.childNodes[o-1];if(Or(l,-1))r=t,i=--o;else if(l.nodeType==3)t=l,o=t.nodeValue.length;else break}}else{if(rf(t))break;{let l=t.previousSibling;for(;l&&Or(l,-1);)r=t.parentNode,i=pt(l),l=l.previousSibling;if(l)t=l,o=Ki(t);else{if(t=t.parentNode,t==n.dom)break;o=0}}}a?hl(n,t,o):r&&hl(n,r,i)}function rx(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r=Ki(t),i,a;for(;;)if(o<r){if(t.nodeType!=1)break;let l=t.childNodes[o];if(Or(l,1))i=t,a=++o;else break}else{if(rf(t))break;{let l=t.nextSibling;for(;l&&Or(l,1);)i=l.parentNode,a=pt(l)+1,l=l.nextSibling;if(l)t=l,o=0,r=Ki(t);else{if(t=t.parentNode,t==n.dom)break;o=r=0}}}i&&hl(n,i,a)}function rf(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function ix(n,e){for(;n&&e==n.childNodes.length&&!Tr(n);)e=pt(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 sx(n,e){for(;n&&!e&&!Tr(n);)e=pt(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 hl(n,e,t){if(e.nodeType!=3){let i,a;(a=ix(e,t))?(e=a,t=0):(i=sx(e,t))&&(e=i,t=i.nodeValue.length)}let o=n.domSelection();if(!o)return;if(Wi(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&&In(n)},50)}function sf(n,e){let t=n.state.doc.resolve(e);if(!(ct||Mp)&&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 af(n,e,t){let o=n.state.selection;if(o instanceof _e&&!o.empty||t.indexOf("s")>-1||Gt&&t.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let a=fl(n.state,e);if(a&&a instanceof ze)return no(n,a)}if(!r.parent.inlineContent){let a=e<0?r:i,l=o instanceof Bt?$e.near(a,e):$e.findFrom(a,e);return l?no(n,l):!1}return!1}function lf(n,e){if(!(n.state.selection instanceof _e))return!0;let{$head:t,$anchor:o,empty:r}=n.state.selection;if(!t.sameParent(o))return!0;if(!r)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let 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 cf(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function ax(n){if(!ft||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;cf(n,o,"true"),setTimeout(()=>cf(n,o,"false"),20)}return!1}function lx(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function cx(n,e){let t=e.keyCode,o=lx(e);if(t==8||Gt&&t==72&&o=="c")return lf(n,-1)||Xo(n,-1);if(t==46&&!e.shiftKey||Gt&&t==68&&o=="c")return lf(n,1)||Xo(n,1);if(t==13||t==27)return!0;if(t==37||Gt&&t==66&&o=="c"){let r=t==37?sf(n,n.state.selection.from)=="ltr"?-1:1:-1;return of(n,r,o)||Xo(n,r)}else if(t==39||Gt&&t==70&&o=="c"){let r=t==39?sf(n,n.state.selection.from)=="ltr"?1:-1:1;return of(n,r,o)||Xo(n,r)}else{if(t==38||Gt&&t==80&&o=="c")return af(n,-1,o)||Xo(n,-1);if(t==40||Gt&&t==78&&o=="c")return ax(n)||af(n,1,o)||Xo(n,1);if(o==(Gt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function ml(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")||Eo.fromSchema(n.state.schema),l=yf(),c=l.createElement("div");c.appendChild(a.serializeFragment(o,{document:l}));let d=c.firstChild,u,p=0;for(;d&&d.nodeType==1&&(u=mf[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),p++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${r} ${i}${p?` -${p}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
|
|
352
|
+
|
|
353
|
+
`);return{dom:c,text:f,slice:e}}function df(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",f=>{e=f(e,i||o,n)}),i)return l=new me(re.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
|
354
|
+
`))),0,0),n.someProp("transformPasted",f=>{l=f(l,n,!0)}),l;let p=n.someProp("clipboardTextParser",f=>f(e,r,o,n));if(p)l=p;else{let f=r.marks(),{schema:h}=n.state,m=Eo.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,f)))})}}else n.someProp("transformPastedHTML",p=>{t=p(t,n)}),a=fx(t),Mr&&hx(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 p=+u[3];p>0;p--){let f=a.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;a=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||Er.fromSchema(n.state.schema)).parseSlice(a,{preserveWhitespace:!!(c||u),context:r,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!dx.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=mx(hf(l,+u[1],+u[2]),u[4]);else if(l=me.maxOpen(ux(l.content,r),!0),l.openStart||l.openEnd){let p=0,f=0;for(let h=l.content.firstChild;p<l.openStart&&!h.type.spec.isolating;p++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=hf(l,p,f)}return n.someProp("transformPasted",p=>{l=p(l,n,c)}),l}const dx=/^(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 ux(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&&pf(c,i,l,a[a.length-1],0))a[a.length-1]=d;else{a.length&&(a[a.length-1]=ff(a[a.length-1],i.length));let u=uf(l,c);a.push(u),r=r.matchType(u.type),i=c}}),a)return re.from(a)}return n}function uf(n,e,t=0){for(let o=e.length-1;o>=t;o--)n=e[o].create(null,re.from(n));return n}function pf(n,e,t,o,r){if(r<n.length&&r<e.length&&n[r]==e[r]){let i=pf(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(uf(t,n,r+1))))}}function ff(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,ff(n.lastChild,e-1)),o=n.contentMatchAt(n.childCount).fillBefore(re.empty,!0);return n.copy(t.append(o))}function gl(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=gl(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 hf(n,e,t){return e<n.openStart&&(n=new me(gl(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new me(gl(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const mf={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 gf=null;function yf(){return gf||(gf=document.implementation.createHTMLDocument("title"))}let yl=null;function px(n){let e=window.trustedTypes;return e?(yl||(yl=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),yl.createHTML(n)):n}function fx(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=yf().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(n),r;if((r=o&&mf[o[1].toLowerCase()])&&(n=r.map(i=>"<"+i+">").join("")+n+r.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=px(n),r)for(let i=0;i<r.length;i++)t=t.querySelector(r[i])||t;return t}function hx(n){let e=n.querySelectorAll(ct?"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 mx(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 me(r,i,a)}const Tt={},Mt={},gx={touchstart:!0,touchmove:!0};class yx{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 bx(n){for(let e in Tt){let t=Tt[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=o=>{kx(n,o)&&!xl(n,o)&&(n.editable||!(o.type in Mt))&&t(n,o)},gx[e]?{passive:!0}:void 0)}ft&&n.dom.addEventListener("input",()=>null),bl(n)}function oo(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function xx(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 bl(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=o=>xl(n,o))})}function xl(n,e){return n.someProp("handleDOMEvents",t=>{let o=t[e.type];return o?o(n,e)||e.defaultPrevented:!1})}function kx(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 Ex(n,e){!xl(n,e)&&Tt[e.type]&&(n.editable||!(e.type in Mt))&&Tt[e.type](n,e)}Mt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!xf(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Mn&&ct&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Ko&&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,Co(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",o=>o(n,t))||cx(n,t)?t.preventDefault():oo(n,"key")},Mt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},Mt.keypress=(n,e)=>{let t=e;if(xf(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Gt&&t.metaKey)return;if(n.someProp("handleKeyPress",r=>r(n,t))){t.preventDefault();return}let o=n.state.selection;if(!(o instanceof _e)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!n.someProp("handleTextInput",a=>a(n,o.$from.pos,o.$to.pos,r,i))&&n.dispatch(i()),t.preventDefault()}};function Ji(n){return{left:n.clientX,top:n.clientY}}function wx(n,e){let t=e.x-n.clientX,o=e.y-n.clientY;return t*t+o*o<100}function kl(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 Yo(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 Sx(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),o=t.nodeAfter;return o&&o.isAtom&&ze.isSelectable(o)?(Yo(n,new ze(t)),!0):!1}function Cx(n,e){if(e==-1)return!1;let t=n.state.selection,o,r;t instanceof ze&&(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(ze.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?(Yo(n,ze.create(n.state.doc,r)),!0):!1}function vx(n,e,t,o,r){return kl(n,"handleClickOn",e,t,o)||n.someProp("handleClick",i=>i(n,e,o))||(r?Cx(n,t):Sx(n,t))}function Nx(n,e,t,o){return kl(n,"handleDoubleClickOn",e,t,o)||n.someProp("handleDoubleClick",r=>r(n,e,o))}function zx(n,e,t,o){return kl(n,"handleTripleClickOn",e,t,o)||n.someProp("handleTripleClick",r=>r(n,e,o))||Tx(n,t,o)}function Tx(n,e,t){if(t.button!=0)return!1;let o=n.state.doc;if(e==-1)return o.inlineContent?(Yo(n,_e.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let a=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(a.inlineContent)Yo(n,_e.create(o,l+1,l+1+a.content.size));else if(ze.isSelectable(a))Yo(n,ze.create(o,l));else continue;return!0}}function El(n){return Xi(n)}const bf=Gt?"metaKey":"ctrlKey";Tt.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let o=El(n),r=Date.now(),i="singleClick";r-n.input.lastClick.time<500&&wx(t,n.input.lastClick)&&!t[bf]&&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(Ji(t));a&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Mx(n,a,t,!!o)):(i=="doubleClick"?Nx:zx)(n,a.pos,a.inside,t)?t.preventDefault():oo(n,"pointer"))};class Mx{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[bf],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 ze&&d.from<=a&&d.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&qt&&!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)),oo(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(()=>In(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(Ji(e))),this.updateAllowDefault(e),this.allowDefault||!t?oo(this.view,"pointer"):vx(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ft&&this.mightDrag&&!this.mightDrag.node.isAtom||ct&&!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)?(Yo(this.view,$e.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):oo(this.view,"pointer")}move(e){this.updateAllowDefault(e),oo(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)}}Tt.touchstart=n=>{n.input.lastTouch=Date.now(),El(n),oo(n,"pointer")},Tt.touchmove=n=>{n.input.lastTouch=Date.now(),oo(n,"pointer")},Tt.contextmenu=n=>El(n);function xf(n,e){return n.composing?!0:ft&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Ax=Mn?5e3:-1;Mt.compositionstart=Mt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof _e&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||ct&&Mp&&Ix(n)))n.markCursor=n.state.storedMarks||t.marks(),Xi(n,!0),n.markCursor=null;else if(Xi(n,!e.selection.empty),qt&&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}kf(n,Ax)};function Ix(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"}Mt.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++,kf(n,20))};function kf(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Xi(n),e))}function Ef(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Ox());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function _x(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=C0(e.focusNode,e.focusOffset),o=v0(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 Ox(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Xi(n,e=!1){if(!(Mn&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Ef(n),e||n.docView&&n.docView.dirty){let t=dl(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 Dr=Ot&&Zn<15||Ko&&M0<604;Tt.copy=Mt.cut=(n,e)=>{let t=e,o=n.state.selection,r=t.type=="cut";if(o.empty)return;let i=Dr?null:t.clipboardData,a=o.content(),{dom:l,text:c}=ml(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 Rx(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Px(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?Rr(n,o.value,null,r,e):Rr(n,o.textContent,o.innerHTML,r,e)},50)}function Rr(n,e,t,o,r){let i=df(n,e,t,o,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,r,i||me.empty)))return!0;if(!i)return!1;let a=Rx(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 wf(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," "):""}Mt.paste=(n,e)=>{let t=e;if(n.composing&&!Mn)return;let o=Dr?null:t.clipboardData,r=n.input.shiftKey&&n.input.lastKeyCode!=45;o&&Rr(n,wf(o),o.getData("text/html"),r,t)?t.preventDefault():Px(n,t)};class Sf{constructor(e,t,o){this.slice=e,this.move=t,this.node=o}}const $x=Gt?"altKey":"ctrlKey";function Cf(n,e){let t=n.someProp("dragCopies",o=>!o(e));return t??!e[$x]}Tt.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(Ji(t)),a;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof ze?r.to-1:r.to))){if(o&&o.mightDrag)a=ze.create(n.state.doc,o.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let p=n.docView.nearestDesc(t.target,!0);p&&p.node.type.spec.draggable&&p!=n.docView&&(a=ze.create(n.state.doc,p.posBefore))}}let l=(a||n.state.selection).content(),{dom:c,text:d,slice:u}=ml(n,l);(!t.dataTransfer.files.length||!ct||Tp>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Dr?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",Dr||t.dataTransfer.setData("text/plain",d),n.dragging=new Sf(u,Cf(n,t),a)},Tt.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},Mt.dragover=Mt.dragenter=(n,e)=>e.preventDefault(),Mt.drop=(n,e)=>{try{Lx(n,e,n.dragging)}finally{n.dragging=null}};function Lx(n,e,t){if(!e.dataTransfer)return;let o=n.posAtCoords(Ji(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=df(n,wf(e.dataTransfer),Dr?null:e.dataTransfer.getData("text/html"),!1,r);let a=!!(t&&Cf(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||me.empty,a))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?W1(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,p=c.doc;if(u?c.replaceRangeWith(d,d,i.content.firstChild):c.replaceRange(d,d,i),c.doc.eq(p))return;let f=c.doc.resolve(d);if(u&&ze.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new ze(f));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,x)=>h=x),c.setSelection(pl(n,f,c.doc.resolve(h)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))}Tt.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())&&In(n)},20))},Tt.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)},Tt.beforeinput=(n,e)=>{if(ct&&Mn&&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,Co(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 Mt)Tt[n]=Mt[n];function Pr(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 Yi{constructor(e,t){this.toDOM=e,this.spec=t||To,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 un(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof Yi&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Pr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ro{constructor(e,t){this.attrs=e,this.spec=t||To}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 un(i,a,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof ro&&Pr(this.attrs,e.attrs)&&Pr(this.spec,e.spec)}static is(e){return e.type instanceof ro}destroy(){}}class wl{constructor(e,t){this.attrs=e,this.spec=t||To}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 un(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 wl&&Pr(this.attrs,e.attrs)&&Pr(this.spec,e.spec)}destroy(){}}class un{constructor(e,t,o){this.from=e,this.to=t,this.type=o}copy(e,t){return new un(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 un(e,e,new Yi(t,o))}static inline(e,t,o,r){return new un(e,t,new ro(o,r))}static node(e,t,o,r){return new un(e,t,new wl(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof ro}get widget(){return this.type instanceof Yi}}const Qo=[],To={};class dt{constructor(e,t){this.local=e.length?e:Qo,this.children=t.length?t:Qo}static create(e,t){return t.length?Qi(t,e,0,To):xt}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==xt||e.maps.length==0?this:this.mapInner(e,t,0,0,o||To)}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?Vx(this.children,a||[],e,t,o,r,i):a?new dt(a.sort(Mo),Qo):xt}add(e,t){return t.length?this==xt?dt.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=Nf(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,Qi(u,l,d+1,To)),i+=3}});let a=vf(i?zf(t):t,-o);for(let l=0;l<a.length;l++)a[l].type.valid(e,a[l])||a.splice(l--,1);return new dt(a.length?this.local.concat(a).sort(Mo):this.local,r||this.children)}remove(e){return e.length==0||this==xt?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,p;u<e.length;u++)(p=e[u])&&p.from>l&&p.to<c&&(e[u]=null,(a||(a=[])).push(p));if(!a)continue;o==this.children&&(o=this.children.slice());let d=o[i+2].removeInner(a,l+1);d!=xt?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 dt(r,o):xt}forChild(e,t){if(this==xt)return this;if(t.isLeaf)return dt.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 ro){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 dt(r.sort(Mo),Qo);return o?new io([l,o]):l}return o||xt}eq(e){if(this==e)return!0;if(!(e instanceof dt)||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 Sl(this.localsInner(e))}localsInner(e){if(this==xt)return Qo;if(e.inlineContent||!this.local.some(ro.is))return this.local;let t=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof ro||t.push(this.local[o]);return t}forEachSet(e){e(this)}}dt.empty=new dt([],[]),dt.removeOverlap=Sl;const xt=dt.empty;class io{constructor(e){this.members=e}map(e,t){const o=this.members.map(r=>r.map(e,t,To));return io.from(o)}forChild(e,t){if(t.isLeaf)return dt.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=xt&&(i instanceof io?o=o.concat(i.members):o.push(i))}return io.from(o)}eq(e){if(!(e instanceof io)||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?Sl(o?t:t.sort(Mo)):Qo}static from(e){switch(e.length){case 0:return xt;case 1:return e[0];default:return new io(e.every(t=>t instanceof dt)?e:e.reduce((t,o)=>t.concat(o instanceof dt?o:o.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Vx(n,e,t,o,r,i,a){let l=n.slice();for(let d=0,u=i;d<t.maps.length;d++){let p=0;t.maps[d].forEach((f,h,m,g)=>{let y=g-m-(h-f);for(let x=0;x<l.length;x+=3){let T=l[x+1];if(T<0||f>T+u-p)continue;let S=l[x]+u-p;h>=S?l[x+1]=f<=S?-2:-1:f>=u&&y&&(l[x]+=y,l[x+1]+=y)}p+=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),p=u-r;if(p<0||p>=o.content.size){c=!0;continue}let f=t.map(n[d+1]+i,-1),h=f-r,{index:m,offset:g}=o.content.findIndex(p),y=o.maybeChild(m);if(y&&g==p&&g+y.nodeSize==h){let x=l[d+2].mapInner(t,y,u+1,n[d]+i+1,a);x!=xt?(l[d]=p,l[d+1]=h,l[d+2]=x):(l[d+1]=-2,c=!0)}else c=!0}if(c){let d=Bx(l,n,e,t,r,i,a),u=Qi(d,o,0,a);e=u.local;for(let p=0;p<l.length;p+=3)l[p+1]<0&&(l.splice(p,3),p-=3);for(let p=0,f=0;p<u.children.length;p+=3){let h=u.children[p];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[p],u.children[p+1],u.children[p+2])}}return new dt(e.sort(Mo),l)}function vf(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 un(r.from+e,r.to+e,r.type))}return t}function Bx(n,e,t,o,r,i,a){function l(c,d){for(let u=0;u<c.local.length;u++){let p=c.local[u].map(o,r,d);p?t.push(p):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 Nf(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 zf(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Qi(n,e,t,o){let r=[],i=!1;e.forEach((l,c)=>{let d=Nf(n,l,c+t);if(d){i=!0;let u=Qi(d,l,t+c+1,o);u!=xt&&r.push(c,c+l.nodeSize,u)}});let a=vf(i?zf(n):n,-t).sort(Mo);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 dt(a,r):xt}function Mo(n,e){return n.from-e.from||n.to-e.to}function Sl(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),Tf(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),Tf(e,r,o.copy(i.from,o.to)));break}}}return e}function Tf(n,e,t){for(;e<n.length&&Mo(t,n[e])>0;)e++;n.splice(e,0,t)}function Cl(n){let e=[];return n.someProp("decorations",t=>{let o=t(n.state);o&&o!=xt&&e.push(o)}),n.cursorWrapper&&e.push(dt.create(n.state.doc,[n.cursorWrapper.deco])),io.from(e)}const Fx={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},jx=Ot&&Zn<=11;class Hx{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 Ux{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Hx,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]);Ot&&Zn<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():ft&&e.composing&&o.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),jx&&(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,Fx)),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(tf(this.view)){if(this.suppressingSelectionUpdates)return In(this.view);if(Ot&&Zn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&So(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=Go(i))t.add(i);for(let i=e.anchorNode;i;i=Go(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)&&tf(e)&&!this.ignoreSelectionChange(o),i=-1,a=-1,l=!1,c=[];if(e.editable)for(let u=0;u<t.length;u++){let p=this.registerMutation(t[u],c);p&&(i=i<0?p.from:Math.min(p.from,i),a=a<0?p.to:Math.max(p.to,a),p.typeOver&&(l=!0))}if(qt&&c.length){let u=c.filter(p=>p.nodeName=="BR");if(u.length==2){let[p,f]=u;p.parentNode&&p.parentNode.parentNode==f.parentNode?f.remove():p.remove()}else{let{focusNode:p}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!p||Gx(e,p)!=h)&&f.remove()}}}else if((ct||ft)&&c.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of c)if(u.nodeName=="BR"&&u.parentNode){let p=u.nextSibling;p&&p.nodeType==1&&p.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&&Wi(o)&&(d=dl(e))&&d.eq($e.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,In(e),this.currentSelection.set(o),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),Wx(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Kx(e,c)),this.handleDOMChange(i,a,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||In(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 p=e.addedNodes[u];t.push(p),p.nodeType==3&&(this.lastChangedTextNode=p)}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(Ot&&Zn<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:p,nextSibling:f}=e.addedNodes[u];(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(r=p),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let a=r&&r.parentNode==e.target?pt(r)+1:0,l=o.localPosFromDOM(e.target,a,-1),c=i&&i.parentNode==e.target?pt(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 Mf=new WeakMap,Af=!1;function Wx(n){if(!Mf.has(n)&&(Mf.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=qt,Af)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."),Af=!0}}function If(n,e){let t=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,a=n.domAtPos(n.state.selection.anchor);return So(a.node,a.offset,r,i)&&([t,o,r,i]=[r,i,t,o]),{anchorNode:t,anchorOffset:o,focusNode:r,focusOffset:i}}function qx(n,e){if(e.getComposedRanges){let r=e.getComposedRanges(n.root)[0];if(r)return If(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?If(n,t):null}function Gx(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 Kx(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 Jx(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}],Wi(c)||d.push({node:c.focusNode,offset:c.focusOffset})),ct&&n.input.lastKeyCode===8)for(let y=i;y>r;y--){let x=o.childNodes[y-1],T=x.pmViewDesc;if(x.nodeName=="BR"&&!T){i=y;break}if(!T||T.size)break}let p=n.state.doc,f=n.someProp("domParser")||Er.fromSchema(n.state.schema),h=p.resolve(a),m=null,g=f.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:Xx,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 Xx(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(ft&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||ft&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Yx=/^(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 Qx(n,e,t,o,r){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let E=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,C=dl(n,E);if(C&&!n.state.selection.eq(C)){if(ct&&Mn&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",D=>D(n,Co(13,"Enter"))))return;let M=n.state.tr.setSelection(C);E=="pointer"?M.setMeta("pointer",!0):E=="key"&&M.scrollIntoView(),i&&M.setMeta("composition",i),n.dispatch(M)}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=Jx(n,e,t),u=n.state.doc,p=u.slice(d.from,d.to),f,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(f=n.state.selection.to,h="end"):(f=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let m=tk(p.content,d.doc.content,d.from,f,h);if(m&&n.input.domChangeCount++,(Ko&&n.input.lastIOSEnter>Date.now()-225||Mn)&&r.some(E=>E.nodeType==1&&!Yx.test(E.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",E=>E(n,Co(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof _e&&!c.empty&&c.$head.sameParent(c.$anchor)&&!n.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let E=_f(n,n.state.doc,d.sel);if(E&&!E.eq(n.state.selection)){let C=n.state.tr.setSelection(E);i&&C.setMeta("composition",i),n.dispatch(C)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof _e&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=d.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),Ot&&Zn<=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),T=g.sameParent(y)&&g.parent.inlineContent&&x.end()>=m.endA;if((Ko&&n.input.lastIOSEnter>Date.now()-225&&(!T||r.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!T&&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",E=>E(n,Co(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&ek(u,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",E=>E(n,Co(8,"Backspace")))){Mn&&ct&&n.domObserver.suppressSelectionUpdates();return}ct&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),Mn&&!T&&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(E){return E(n,Co(13,"Enter"))})},20));let S=m.start,z=m.endA,b=E=>{let C=E||n.state.tr.replace(S,z,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let M=_f(n,C.doc,d.sel);M&&!(ct&&n.composing&&M.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(M.head==S||M.head==C.mapping.map(z)-1)||Ot&&M.empty&&M.head==S)&&C.setSelection(M)}return i&&C.setMeta("composition",i),C.scrollIntoView()},v;if(T)if(g.pos==y.pos){Ot&&Zn<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>In(n),20));let E=b(n.state.tr.delete(S,z)),C=u.resolve(m.start).marksAcross(u.resolve(m.endA));C&&E.ensureMarks(C),n.dispatch(E)}else if(m.endA==m.endB&&(v=Zx(g.parent.content.cut(g.parentOffset,y.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start())))){let E=b(n.state.tr);v.type=="add"?E.addMark(S,z,v.mark):E.removeMark(S,z,v.mark),n.dispatch(E)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let E=g.parent.textBetween(g.parentOffset,y.parentOffset),C=()=>b(n.state.tr.insertText(E,S,z));n.someProp("handleTextInput",M=>M(n,S,z,E,C))||n.dispatch(C())}else n.dispatch(b());else n.dispatch(b())}function _f(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:pl(n,e.resolve(t.anchor),e.resolve(t.head))}function Zx(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 ek(n,e,t,o,r){if(t-e<=r.pos-o.pos||vl(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(vl(i,!0,!0));return!a.parent.isTextblock||a.pos>t||vl(a,!0,!1)<t?!1:o.parent.content.cut(o.parentOffset).eq(a.parent.content)}function vl(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 tk(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&&Of(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&&Of(n.textBetween(i-1,i+1))&&(i+=c?1:-1),a=i+(a-l),l=i}return{start:i,endA:a,endB:l}}function Of(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 Df{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 yx,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Vf),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=$f(this),Pf(this),this.nodeViews=Lf(this),this.docView=Hp(this.state.doc,Rf(this),Cl(this),this.dom,this),this.domObserver=new Ux(this,(o,r,i,a)=>Qx(this,o,r,i,a)),this.domObserver.start(),bx(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&&bl(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Vf),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&&(Ef(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=Lf(this);ok(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&bl(this),this.editable=$f(this),Pf(this);let c=Cl(this),d=Rf(this),u=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",p=i||!this.docView.matchesNode(e.doc,d,c);(p||!e.selection.eq(r.selection))&&(a=!0);let f=u=="preserve"&&a&&this.dom.style.overflowAnchor==null&&_0(this);if(a){this.domObserver.stop();let h=p&&(Ot||ct)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&nk(r.selection,e.selection);if(p){let m=ct?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=_x(this)),(i||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=Hp(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())&&nx(this))?In(this,h):(Zp(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():f&&O0(f)}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 ze){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Ap(this,t.getBoundingClientRect(),e)}else Ap(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 Sf(e.slice,e.move,r<0?void 0:ze.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(Ot){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),In(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 V0(this,e)}coordsAtPos(e,t=1){return Pp(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 U0(this,t||this.state,e)}pasteHTML(e,t){return Rr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Rr(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return ml(this,e)}destroy(){this.docView&&(xx(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Cl(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,w0())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Ex(this,e)}domSelectionRange(){let e=this.domSelection();return e?ft&&this.root.nodeType===11&&z0(this.dom.ownerDocument)==this.dom&&qx(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Df.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Rf(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"),[un.node(0,n.state.doc.content.size,e)]}function Pf(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:un.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function $f(n){return!n.someProp("editable",e=>e(n.state)===!1)}function nk(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 Lf(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 ok(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 Vf(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 so={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:"'"},Zi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},rk=typeof navigator<"u"&&/Mac/.test(navigator.platform),ik=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ht=0;ht<10;ht++)so[48+ht]=so[96+ht]=String(ht);for(var ht=1;ht<=24;ht++)so[ht+111]="F"+ht;for(var ht=65;ht<=90;ht++)so[ht]=String.fromCharCode(ht+32),Zi[ht]=String.fromCharCode(ht);for(var Nl in so)Zi.hasOwnProperty(Nl)||(Zi[Nl]=so[Nl]);function sk(n){var e=rk&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||ik&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Zi:so)[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 ak=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),lk=typeof navigator<"u"&&/Win/.test(navigator.platform);function ck(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))ak?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 dk(n){let e=Object.create(null);for(let t in n)e[ck(t)]=n[t];return e}function zl(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 uk(n){return new _t({props:{handleKeyDown:pk(n)}})}function pk(n){let e=dk(n);return function(t,o){let r=sk(o),i,a=e[zl(r,o)];if(a&&a(t.state,t.dispatch,t))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[zl(r,o,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(lk&&o.ctrlKey&&o.altKey)&&(i=so[o.keyCode])&&i!=r){let l=e[zl(i,o)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var fk=Object.defineProperty,Tl=(n,e)=>{for(var t in e)fk(n,t,{get:e[t],enumerable:!0})};function es(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 ts=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(p=>p===!0)),u={...Object.fromEntries(Object.entries(t).map(([p,f])=>[p,(...m)=>{const g=this.buildProps(c,e),y=f(...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:es({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}},Bf={};Tl(Bf,{blur:()=>hk,clearContent:()=>mk,clearNodes:()=>gk,command:()=>yk,createParagraphNear:()=>bk,cut:()=>xk,deleteCurrentNode:()=>kk,deleteNode:()=>Ek,deleteRange:()=>wk,deleteSelection:()=>Sk,enter:()=>Ck,exitCode:()=>vk,extendMarkRange:()=>Nk,first:()=>zk,focus:()=>Mk,forEach:()=>Ak,insertContent:()=>Ik,insertContentAt:()=>Dk,joinBackward:()=>$k,joinDown:()=>Pk,joinForward:()=>Lk,joinItemBackward:()=>Vk,joinItemForward:()=>Bk,joinTextblockBackward:()=>Fk,joinTextblockForward:()=>jk,joinUp:()=>Rk,keyboardShortcut:()=>Uk,lift:()=>Wk,liftEmptyBlock:()=>qk,liftListItem:()=>Gk,newlineInCode:()=>Kk,resetAttributes:()=>Jk,scrollIntoView:()=>Xk,selectAll:()=>Yk,selectNodeBackward:()=>Qk,selectNodeForward:()=>Zk,selectParentNode:()=>eE,selectTextblockEnd:()=>tE,selectTextblockStart:()=>nE,setContent:()=>oE,setMark:()=>SE,setMeta:()=>CE,setNode:()=>vE,setNodeSelection:()=>NE,setTextDirection:()=>zE,setTextSelection:()=>TE,sinkListItem:()=>ME,splitBlock:()=>AE,splitListItem:()=>IE,toggleList:()=>_E,toggleMark:()=>OE,toggleNode:()=>DE,toggleWrap:()=>RE,undoInputRule:()=>PE,unsetAllMarks:()=>$E,unsetMark:()=>LE,unsetTextDirection:()=>VE,updateAttributes:()=>BE,wrapIn:()=>FE,wrapInList:()=>jE});var hk=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),mk=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),gk=()=>({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,p=d.resolve(u.map(c)),f=d.resolve(u.map(c+l.nodeSize)),h=p.blockRange(f);if(!h)return;const m=Fo(h);if(l.type.isTextblock){const{defaultType:g}=p.parent.contentMatchAt(p.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},yk=n=>e=>n(e),bk=()=>({state:n,dispatch:e})=>kp(n,e),xk=(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 _e(o.doc.resolve(Math.max(a-1,0)))),!0},kk=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,o=t.$anchor.node();if(o.content.size>0)return!1;const r=n.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const l=r.before(i),c=r.after(i);n.delete(l,c).scrollIntoView()}return!0}return!1};function tt(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var Ek=n=>({tr:e,state:t,dispatch:o})=>{const r=tt(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},wk=n=>({tr:e,dispatch:t})=>{const{from:o,to:r}=n;return t&&e.delete(o,r),!0},Sk=()=>({state:n,dispatch:e})=>Ya(n,e),Ck=()=>({commands:n})=>n.keyboardShortcut("Enter"),vk=()=>({state:n,dispatch:e})=>a0(n,e);function Ml(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function ns(n,e,t={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>t.strict?e[r]===n[r]:Ml(e[r])?e[r].test(n[r]):e[r]===n[r]):!0}function Ff(n,e,t={}){return n.find(o=>o.type===e&&ns(Object.fromEntries(Object.keys(t).map(r=>[r,o.attrs[r]])),t))}function jf(n,e,t={}){return!!Ff(n,e,t)}function Al(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),!Ff([...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&&jf([...n.parent.child(a-1).marks],e,t);)a-=1,l-=n.parent.child(a).nodeSize;for(;c<n.parent.childCount&&jf([...n.parent.child(c).marks],e,t);)d+=n.parent.child(c).nodeSize,c+=1;return{from:l,to:d}}function _n(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=_n(n,o.schema),{doc:a,selection:l}=t,{$from:c,from:d,to:u}=l;if(r){const p=Al(c,i,e);if(p&&p.from<=d&&p.to>=u){const f=_e.create(a,p.from,p.to);t.setSelection(f)}}return!0},zk=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 Hf(n){return n instanceof _e}function Ao(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Uf(n,e=null){if(!e)return null;const t=$e.atStart(n),o=$e.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return o;const r=t.from,i=o.to;return e==="all"?_e.create(n,Ao(0,r,i),Ao(n.content.size,r,i)):_e.create(n,Ao(e,r,i),Ao(e,r,i))}function Wf(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function rs(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Tk(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var Mk=(n=null,e={})=>({editor:t,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const a=()=>{(rs()||Wf())&&o.dom.focus(),Tk()&&!rs()&&!Wf()&&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&&!Hf(t.state.selection))return a(),!0;const l=Uf(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},Ak=(n,e)=>t=>n.every((o,r)=>e(o,{...t,index:r})),Ik=(n,e)=>({tr:t,commands:o})=>o.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),qf=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&&qf(o)}return n};function is(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 qf(t)}function $r(n,e,t){if(n instanceof Kn||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),$r("",e,t)}if(r){if(t.errorOnInvalidContent){let a=!1,l="";const c=new Ou({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?Er.fromSchema(c).parseSlice(is(n),t.parseOptions):Er.fromSchema(c).parse(is(n),t.parseOptions),t.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=Er.fromSchema(e);return t.slice?i.parseSlice(is(n),t.parseOptions).content:i.parse(is(n),t.parseOptions)}return $r("",e,t)}function _k(n,e,t){const o=n.steps.length-1;if(o<e)return;const r=n.steps[o];if(!(r instanceof at||r instanceof lt))return;const i=n.mapping.maps[o];let a=0;i.forEach((l,c,d,u)=>{a===0&&(a=u)}),n.setSelection($e.near(n.doc.resolve(a),t))}var Ok=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{$r(e,i.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(y){c(y)}try{l=$r(e,i.schema,{parseOptions:d,errorOnInvalidContent:(a=t.errorOnInvalidContent)!=null?a:i.options.enableContentCheck})}catch(y){return c(y),!1}let{from:u,to:p}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},f=!0,h=!0;if((Ok(l)?l:[l]).forEach(y=>{y.check(),f=f?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),u===p&&h){const{parent:y}=o.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,p+=1)}let g;if(f){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,p)}else{g=l;const y=o.doc.resolve(u),x=y.node(),T=y.parentOffset===0,S=x.isText||x.isTextblock,z=x.content.size>0;T&&S&&z&&(u=Math.max(0,u-1)),o.replaceWith(u,p,g)}t.updateSelection&&_k(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},Rk=()=>({state:n,dispatch:e})=>r0(n,e),Pk=()=>({state:n,dispatch:e})=>i0(n,e),$k=()=>({state:n,dispatch:e})=>fp(n,e),Lk=()=>({state:n,dispatch:e})=>yp(n,e),Vk=()=>({state:n,dispatch:e,tr:t})=>{try{const o=Fi(n.doc,n.selection.$from.pos,-1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},Bk=()=>({state:n,dispatch:e,tr:t})=>{try{const o=Fi(n.doc,n.selection.$from.pos,1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},Fk=()=>({state:n,dispatch:e})=>n0(n,e),jk=()=>({state:n,dispatch:e})=>o0(n,e);function Gf(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Hk(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))rs()||Gf()?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 Uk=n=>({editor:e,view:t,tr:o,dispatch:r})=>{const i=Hk(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 ao(n,e,t={}){const{from:o,to:r,empty:i}=n.selection,a=e?tt(e,n.schema):null,l=[];n.doc.nodesBetween(o,r,(p,f)=>{if(p.isText)return;const h=Math.max(o,f),m=Math.min(r,f+p.nodeSize);l.push({node:p,from:h,to:m})});const c=r-o,d=l.filter(p=>a?a.name===p.node.type.name:!0).filter(p=>ns(p.node.attrs,t,{strict:!1}));return i?!!d.length:d.reduce((p,f)=>p+f.to-f.from,0)>=c}var Wk=(n,e={})=>({state:t,dispatch:o})=>{const r=tt(n,t.schema);return ao(t,r,e)?s0(t,o):!1},qk=()=>({state:n,dispatch:e})=>Ep(n,e),Gk=n=>({state:e,dispatch:t})=>{const o=tt(n,e.schema);return b0(o)(e,t)},Kk=()=>({state:n,dispatch:e})=>xp(n,e);function ss(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Kf(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 Jk=(n,e)=>({tr:t,state:o,dispatch:r})=>{let i=null,a=null;const l=ss(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=tt(n,o.schema)),l==="mark"&&(a=_n(n,o.schema));let c=!1;return t.selection.ranges.forEach(d=>{o.doc.nodesBetween(d.$from.pos,d.$to.pos,(u,p)=>{i&&i===u.type&&(c=!0,r&&t.setNodeMarkup(p,void 0,Kf(u.attrs,e))),a&&u.marks.length&&u.marks.forEach(f=>{a===f.type&&(c=!0,r&&t.addMark(p,p+u.nodeSize,a.create(Kf(f.attrs,e))))})})}),c},Xk=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Yk=()=>({tr:n,dispatch:e})=>{if(e){const t=new Bt(n.doc);n.setSelection(t)}return!0},Qk=()=>({state:n,dispatch:e})=>mp(n,e),Zk=()=>({state:n,dispatch:e})=>bp(n,e),eE=()=>({state:n,dispatch:e})=>d0(n,e),tE=()=>({state:n,dispatch:e})=>f0(n,e),nE=()=>({state:n,dispatch:e})=>p0(n,e);function Il(n,e,t={},o={}){return $r(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:o.errorOnInvalidContent})}var oE=(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=Il(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 Jf(n,e){const t=_n(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 Xf(n,e){const t=new op(n);return e.forEach(o=>{o.steps.forEach(r=>{t.step(r)})}),t}function rE(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 iE(n,e,t){const o=[];return n.nodesBetween(e.from,e.to,(r,i)=>{t(r)&&o.push({node:r,pos:i})}),o}function sE(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 as(n){return e=>sE(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 _l(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},o=Ee(e,"addExtensions",t);return o?[e,..._l(o())]:e}).flat(10)}function Ol(n,e){const t=Eo.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function Yf(n){return typeof n=="function"}function Ue(n,e=void 0,...t){return Yf(n)?e?n.bind(e)(...t):n(...t):n}function aE(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Zo(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 Qf(n){const e=[],{nodeExtensions:t,markExtensions:o}=Zo(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(p=>{Object.entries(u.attributes).forEach(([f,h])=>{e.push({type:p,name:f,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,p])=>{const f={...i,...p};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:a.name,name:u,attribute:f})})}),e}function Dt(...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[p,f]=u.split(":").map(h=>h.trim());d.set(p,f)}),l.forEach(u=>{const[p,f]=u.split(":").map(h=>h.trim());d.set(p,f)}),o[r]=Array.from(d.entries()).map(([u,p])=>`${u}: ${p}`).join("; ")}else o[r]=i}),o},{})}function Lr(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)=>Dt(t,o),{})}function lE(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Zf(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):lE(t.getAttribute(a.name));return l==null?i:{...i,[a.name]:l}},{});return{...o,...r}}}}function eh(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&aE(t)?!1:t!=null))}function th(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 cE(n,e){var t;const o=Qf(n),{nodeExtensions:r,markExtensions:i}=Zo(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),p={name:d.name,options:d.options,storage:d.storage,editor:e},f=n.reduce((x,T)=>{const S=Ee(T,"extendNodeSchema",p);return{...x,...S?S(d):{}}},{}),h=eh({...f,content:Ue(Ee(d,"content",p)),marks:Ue(Ee(d,"marks",p)),group:Ue(Ee(d,"group",p)),inline:Ue(Ee(d,"inline",p)),atom:Ue(Ee(d,"atom",p)),selectable:Ue(Ee(d,"selectable",p)),draggable:Ue(Ee(d,"draggable",p)),code:Ue(Ee(d,"code",p)),whitespace:Ue(Ee(d,"whitespace",p)),linebreakReplacement:Ue(Ee(d,"linebreakReplacement",p)),defining:Ue(Ee(d,"defining",p)),isolating:Ue(Ee(d,"isolating",p)),attrs:Object.fromEntries(u.map(th))}),m=Ue(Ee(d,"parseHTML",p));m&&(h.parseDOM=m.map(x=>Zf(x,u)));const g=Ee(d,"renderHTML",p);g&&(h.toDOM=x=>g({node:x,HTMLAttributes:Lr(x,u)}));const y=Ee(d,"renderText",p);return y&&(h.toText=y),[d.name,h]})),c=Object.fromEntries(i.map(d=>{const u=o.filter(y=>y.type===d.name),p={name:d.name,options:d.options,storage:d.storage,editor:e},f=n.reduce((y,x)=>{const T=Ee(x,"extendMarkSchema",p);return{...y,...T?T(d):{}}},{}),h=eh({...f,inclusive:Ue(Ee(d,"inclusive",p)),excludes:Ue(Ee(d,"excludes",p)),group:Ue(Ee(d,"group",p)),spanning:Ue(Ee(d,"spanning",p)),code:Ue(Ee(d,"code",p)),attrs:Object.fromEntries(u.map(th))}),m=Ue(Ee(d,"parseHTML",p));m&&(h.parseDOM=m.map(y=>Zf(y,u)));const g=Ee(d,"renderHTML",p);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:Lr(y,u)})),[d.name,h]}));return new Ou({topNode:a,nodes:l,marks:c})}function dE(n){const e=n.filter((t,o)=>n.indexOf(t)!==o);return Array.from(new Set(e))}function ls(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 nh(n){const e=ls(_l(n)),t=dE(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 oh(n,e,t){const{from:o,to:r}=e,{blockSeparator:i=`
|
|
355
|
+
|
|
356
|
+
`,textSerializers:a={}}=t||{};let l="";return n.nodesBetween(o,r,(c,d,u,p)=>{var f;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:p,range:e})),!1;c.isText&&(l+=(f=c?.text)==null?void 0:f.slice(Math.max(o,d)-d,r-d))}),l}function uE(n,e){const t={from:0,to:n.content.size};return oh(n,t,e)}function rh(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function pE(n,e){const t=tt(e,n.schema),{from:o,to:r}=n.selection,i=[];n.doc.nodesBetween(o,r,l=>{i.push(l)});const a=i.reverse().find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function ih(n,e){const t=ss(typeof e=="string"?e:e.name,n.schema);return t==="node"?pE(n,e):t==="mark"?Jf(n,e):{}}function fE(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 hE(n){const e=fE(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 sh(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),p=e.invert().map(d,-1),f=e.invert().map(u);o.push({oldRange:{from:p,to:f},newRange:{from:d,to:u}})})}),hE(o)}function Dl(n,e,t){const o=[];return n===e?t.resolve(n).marks().forEach(r=>{const i=t.resolve(n),a=Al(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 mE=(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 cs(n,e){return e.nodes[n]||e.marks[n]||null}function ds(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 gE=(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 Rl(n,e,t={}){const{empty:o,ranges:r}=n.selection,i=e?_n(e,n.schema):null;if(o)return!!(n.storedMarks||n.selection.$from.marks()).filter(p=>i?i.name===p.type.name:!0).find(p=>ns(p.attrs,t,{strict:!1}));let a=0;const l=[];if(r.forEach(({$from:p,$to:f})=>{const h=p.pos,m=f.pos;n.doc.nodesBetween(h,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const x=Math.max(h,y),T=Math.min(m,y+g.nodeSize),S=T-x;a+=S,l.push(...g.marks.map(z=>({mark:z,from:x,to:T})))})}),a===0)return!1;const c=l.filter(p=>i?i.name===p.mark.type.name:!0).filter(p=>ns(p.mark.attrs,t,{strict:!1})).reduce((p,f)=>p+f.to-f.from,0),d=l.filter(p=>i?p.mark.type!==i&&p.mark.type.excludes(i):!0).reduce((p,f)=>p+f.to-f.from,0);return(c>0?c+d:c)>=a}function yE(n,e,t={}){if(!e)return ao(n,null,t)||Rl(n,null,t);const o=ss(e,n.schema);return o==="node"?ao(n,e,t):o==="mark"?Rl(n,e,t):!1}var bE=(n,e)=>{const{$from:t,$to:o,$anchor:r}=n.selection;if(e){const i=as(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)},xE=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function ah(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function lh(n,e){const{nodeExtensions:t}=Zo(e),o=t.find(a=>a.name===n);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=Ue(Ee(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function Pl(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&&(Pl(i,{ignoreWhitespace:t,checkChildren:e})||(r=!1))}),r}return!1}var ch=class Sm{constructor(e){this.position=e}static fromJSON(e){return new Sm(e.position)}toJSON(){return{position:this.position}}};function kE(n,e){const t=e.mapping.mapResult(n.position);return{position:new ch(t.pos),mapResult:t}}function EE(n){return new ch(n)}function wE(n,e,t){var o;const{selection:r}=e;let i=null;if(Hf(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,p,f)=>{if(d)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(t),m=!!t.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(t));d=h&&m}return!d}),d})}var SE=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=t,{empty:a,ranges:l}=i,c=_n(n,o.schema);if(r)if(a){const d=Jf(o,c);t.addStoredMark(c.create({...d,...e}))}else l.forEach(d=>{const u=d.$from.pos,p=d.$to.pos;o.doc.nodesBetween(u,p,(f,h)=>{const m=Math.max(h,u),g=Math.min(h+f.nodeSize,p);f.marks.find(x=>x.type===c)?f.marks.forEach(x=>{c===x.type&&t.addMark(m,g,c.create({...x.attrs,...e}))}):t.addMark(m,g,c.create(e))})});return wE(o,t,c)},CE=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),vE=(n,e={})=>({state:t,dispatch:o,chain:r})=>{const i=tt(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})=>Cp(i,{...a,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Cp(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=Ao(n,0,o.content.size),i=ze.create(o,r);e.setSelection(i)}return!0},zE=(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},TE=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,{from:r,to:i}=typeof n=="number"?{from:n,to:n}:n,a=_e.atStart(o).from,l=_e.atEnd(o).to,c=Ao(r,a,l),d=Ao(i,a,l),u=_e.create(o,c,d);e.setSelection(u)}return!0},ME=n=>({state:e,dispatch:t})=>{const o=tt(n,e.schema);return E0(o)(e,t)};function dh(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 AE=({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=ds(d,l.node().type.name,l.node().attrs);if(i instanceof ze&&i.node.isBlock)return!l.parentOffset||!zn(a,l.pos)?!1:(o&&(n&&dh(t,r.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const p=c.parentOffset===c.parent.content.size,f=l.depth===0?void 0:rE(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=p&&f?[{type:f,attrs:u}]:void 0,m=zn(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&zn(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(m=!0,h=f?[{type:f,attrs:u}]:void 0),o){if(m&&(i instanceof _e&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!p&&!l.parentOffset&&l.parent.type!==f)){const g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}n&&dh(t,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},IE=(n,e={})=>({tr:t,state:o,dispatch:r,editor:i})=>{var a;const l=tt(n,o.schema),{$from:c,$to:d}=o.selection,u=o.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const p=c.node(-1);if(p.type!==l)return!1;const f=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 T=c.index(-1)?1:c.index(-2)?2:3;for(let C=c.depth-T;C>=c.depth-3;C-=1)x=re.from(c.node(C).copy(x));const S=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,z={...ds(f,c.node().type.name,c.node().attrs),...e},b=((a=l.contentMatch.defaultType)==null?void 0:a.createAndFill(z))||void 0;x=x.append(re.from(l.createAndFill(null,b)||void 0));const v=c.before(c.depth-(T-1));t.replace(v,c.after(-S),new me(x,4-T,0));let E=-1;t.doc.nodesBetween(v,t.doc.content.size,(C,M)=>{if(E>-1)return!1;C.isTextblock&&C.content.size===0&&(E=M+1)}),E>-1&&t.setSelection(_e.near(t.doc.resolve(E))),t.scrollIntoView()}return!0}const h=d.pos===c.end()?p.contentMatchAt(0).defaultType:null,m={...ds(f,p.type.name,p.attrs),...e},g={...ds(f,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(!zn(t.doc,c.pos,2))return!1;if(r){const{selection:x,storedMarks:T}=o,{splittableMarks:S}=i.extensionManager,z=T||x.$to.parentOffset&&x.$from.marks();if(t.split(c.pos,2,y).scrollIntoView(),!z||!r)return!0;const b=z.filter(v=>S.includes(v.type.name));t.ensureMarks(b)}return!0},$l=(n,e)=>{const t=as(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&&Yn(n.doc,t.pos)&&n.join(t.pos),!0},Ll=(n,e)=>{const t=as(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&&Yn(n.doc,o)&&n.join(o),!0},_E=(n,e,t,o={})=>({editor:r,tr:i,state:a,dispatch:l,chain:c,commands:d,can:u})=>{const{extensions:p,splittableMarks:f}=r.extensionManager,h=tt(n,a.schema),m=tt(e,a.schema),{selection:g,storedMarks:y}=a,{$from:x,$to:T}=g,S=x.blockRange(T),z=y||g.$to.parentOffset&&g.$from.marks();if(!S)return!1;const b=as(v=>lh(v.type.name,p))(g);if(S.depth>=1&&b&&S.depth-b.depth<=1){if(b.node.type===h)return d.liftListItem(m);if(lh(b.node.type.name,p)&&h.validContent(b.node.content)&&l)return c().command(()=>(i.setNodeMarkup(b.pos,h),!0)).command(()=>$l(i,h)).command(()=>Ll(i,h)).run()}return!t||!z||!l?c().command(()=>u().wrapInList(h,o)?!0:d.clearNodes()).wrapInList(h,o).command(()=>$l(i,h)).command(()=>Ll(i,h)).run():c().command(()=>{const v=u().wrapInList(h,o),E=z.filter(C=>f.includes(C.type.name));return i.ensureMarks(E),v?!0:d.clearNodes()}).wrapInList(h,o).command(()=>$l(i,h)).command(()=>Ll(i,h)).run()},OE=(n,e={},t={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=t,a=_n(n,o.schema);return Rl(o,a,e)?r.unsetMark(a,{extendEmptyMarkRange:i}):r.setMark(a,e)},DE=(n,e,t={})=>({state:o,commands:r})=>{const i=tt(n,o.schema),a=tt(e,o.schema),l=ao(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})},RE=(n,e={})=>({state:t,commands:o})=>{const r=tt(n,t.schema);return ao(t,r,e)?o.lift(r):o.wrapIn(r,e)},PE=()=>({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},$E=()=>({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},LE=(n,e={})=>({tr:t,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:a=!1}=e,{selection:l}=t,c=_n(n,o.schema),{$from:d,empty:u,ranges:p}=l;if(!r)return!0;if(u&&a){let{from:f,to:h}=l;const m=(i=d.marks().find(y=>y.type===c))==null?void 0:i.attrs,g=Al(d,c,m);g&&(f=g.from,h=g.to),t.removeMark(f,h,c)}else p.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,c)});return t.removeStoredMark(c),!0},VE=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},BE=(n,e={})=>({tr:t,state:o,dispatch:r})=>{let i=null,a=null;const l=ss(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=tt(n,o.schema)),l==="mark"&&(a=_n(n,o.schema));let c=!1;return t.selection.ranges.forEach(d=>{const u=d.$from.pos,p=d.$to.pos;let f,h,m,g;t.selection.empty?o.doc.nodesBetween(u,p,(y,x)=>{i&&i===y.type&&(c=!0,m=Math.max(x,u),g=Math.min(x+y.nodeSize,p),f=x,h=y)}):o.doc.nodesBetween(u,p,(y,x)=>{x<u&&i&&i===y.type&&(c=!0,m=Math.max(x,u),g=Math.min(x+y.nodeSize,p),f=x,h=y),x>=u&&x<=p&&(i&&i===y.type&&(c=!0,r&&t.setNodeMarkup(x,void 0,{...y.attrs,...e})),a&&y.marks.length&&y.marks.forEach(T=>{if(a===T.type&&(c=!0,r)){const S=Math.max(x,u),z=Math.min(x+y.nodeSize,p);t.addMark(S,z,a.create({...T.attrs,...e}))}}))}),h&&(f!==void 0&&r&&t.setNodeMarkup(f,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},FE=(n,e={})=>({state:t,dispatch:o})=>{const r=tt(n,t.schema);return h0(r,e)(t,o)},jE=(n,e={})=>({state:t,dispatch:o})=>{const r=tt(n,t.schema);return m0(r,e)(t,o)},HE=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={}}},uh=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},UE=(n,e)=>{if(Ml(e))return e.exec(n);const t=e(n);if(!t)return null;const o=[t.text];return o.index=t.index,o.input=n,o.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(t.replaceWith)),o};function us(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(f=>f.type.spec.code))return!1;let u=!1;const p=gE(d)+i;return a.forEach(f=>{if(u)return;const h=UE(p,f.find);if(!h)return;const m=c.state.tr,g=es({state:c.state,transaction:m}),y={from:o-(h[0].length-i.length),to:r},{commands:x,chain:T,can:S}=new ts({editor:t,state:g});f.handler({state:g,range:y,match:h,commands:x,chain:T,can:S})===null||!m.steps.length||(f.undoable&&m.setMeta(l,{transform:m,from:o,to:r,text:i}),c.dispatch(m),u=!0)}),u}function WE(n){const{editor:e,rules:t}=n,o=new _t({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=Ol(re.from(u),a.schema);const{from:p}=c,f=p+u.length;us({editor:e,from:p,to:f,text:u,rules:t,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,a,l){return us({editor:e,from:i,to:a,text:l,rules:t,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&us({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?us({editor:e,from:a.pos,to:a.pos,text:`
|
|
357
|
+
`,rules:t,plugin:o}):!1}},isInputRules:!0});return o}function qE(n){return Object.prototype.toString.call(n).slice(8,-1)}function ps(n){return qE(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function ph(n,e){const t={...n};return ps(n)&&ps(e)&&Object.keys(e).forEach(o=>{ps(e[o])&&ps(n[o])?t[o]=ph(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{...Ue(Ee(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Ue(Ee(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>ph(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}},Vr=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 GE(n){return typeof n=="number"}var KE=class{constructor(n){this.find=n.find,this.handler=n.handler}},JE=(n,e,t)=>{if(Ml(e))return[...n.matchAll(e)];const o=e(n,t);return o?o.map(r=>{const i=[r.text];return i.index=r.index,i.input=n,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function XE(n){const{editor:e,state:t,from:o,to:r,rule:i,pasteEvent:a,dropEvent:l}=n,{commands:c,chain:d,can:u}=new ts({editor:e,state:t}),p=[];return t.doc.nodesBetween(o,r,(h,m)=>{var g,y,x,T,S;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const z=(S=(T=(x=h.content)==null?void 0:x.size)!=null?T:h.nodeSize)!=null?S:0,b=Math.max(o,m),v=Math.min(r,m+z);if(b>=v)return;const E=h.isText?h.text||"":h.textBetween(b-m,v-m,void 0,"");JE(E,i.find,a).forEach(M=>{if(M.index===void 0)return;const D=b+M.index+1,$=D+M[0].length,P={from:t.tr.mapping.map(D),to:t.tr.mapping.map($)},L=i.handler({state:t,range:P,match:M,commands:c,chain:d,can:u,pasteEvent:a,dropEvent:l});p.push(L)})}),p.every(h=>h!==null)}var fs=null,YE=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function QE(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:p,to:f,rule:h,pasteEvt:m})=>{const g=u.tr,y=es({state:u,transaction:g});if(!(!XE({editor:e,state:y,from:Math.max(p-1,0),to:f.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 _t({view(p){const f=m=>{var g;o=(g=p.dom.parentElement)!=null&&g.contains(m.target)?p.dom.parentElement:null,o&&(fs=e)},h=()=>{fs&&(fs=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(p,f)=>{if(i=o===p.dom.parentElement,l=f,!i){const h=fs;h?.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(p,f)=>{var h;const m=(h=f.clipboardData)==null?void 0:h.getData("text/html");return a=f,r=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(p,f,h)=>{const m=p[0],g=m.getMeta("uiEvent")==="paste"&&!r,y=m.getMeta("uiEvent")==="drop"&&!i,x=m.getMeta("applyPasteRules"),T=!!x;if(!g&&!y&&!T)return;if(T){let{text:b}=x;typeof b=="string"?b=b:b=Ol(re.from(b),h.schema);const{from:v}=x,E=v+b.length,C=YE(b);return c({rule:u,state:h,from:v,to:{b:E},pasteEvt:C})}const S=f.doc.content.findDiffStart(h.doc.content),z=f.doc.content.findDiffEnd(h.doc.content);if(!(!GE(S)||!z||S===z.b))return c({rule:u,state:h,from:S,to:z,pasteEvt:a})}}))}var hs=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=nh(n),this.schema=cE(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:cs(e.name,this.schema)},o=Ee(e,"addCommands",t);return o?{...n,...o()}:n},{})}get plugins(){const{editor:n}=this;return ls([...this.extensions].reverse()).flatMap(o=>{const r={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:n,type:cs(o.name,this.schema)},i=[],a=Ee(o,"addKeyboardShortcuts",r);let l={};if(o.type==="mark"&&Ee(o,"exitable",r)&&(l.ArrowRight=()=>Vr.handleExit({editor:n,mark:o})),a){const f=Object.fromEntries(Object.entries(a()).map(([h,m])=>[h,()=>m({editor:n})]));l={...l,...f}}const c=uk(l);i.push(c);const d=Ee(o,"addInputRules",r);if(ah(o,n.options.enableInputRules)&&d){const f=d();if(f&&f.length){const h=WE({editor:n,rules:f}),m=Array.isArray(h)?h:[h];i.push(...m)}}const u=Ee(o,"addPasteRules",r);if(ah(o,n.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=QE({editor:n,rules:f});i.push(...h)}}const p=Ee(o,"addProseMirrorPlugins",r);if(p){const f=p();i.push(...f)}return i})}get attributes(){return Qf(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Zo(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:tt(t.name,this.schema)},i=Ee(t,"addNodeView",r);if(!i)return[];const a=i();if(!a)return[];const l=(c,d,u,p,f)=>{const h=Lr(c,o);return a({node:c,view:d,getPos:u,decorations:p,innerDecorations:f,editor:n,extension:t,HTMLAttributes:h})};return[t.name,l]}))}dispatchTransaction(n){const{editor:e}=this;return ls([...this.extensions].reverse()).reduceRight((o,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:cs(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}=Zo(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:_n(t.name,this.schema)},i=Ee(t,"addMarkView",r);if(!i)return[];const a=(l,c,d)=>{const u=Lr(l,o);return i()({mark:l,view:c,inline:d,editor:n,extension:t,HTMLAttributes:u,updateAttributes:p=>{dw(l,n,p)}})};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:cs(e.name,this.schema)};e.type==="mark"&&((t=Ue(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),p=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),p&&this.editor.on("destroy",p)})}};hs.resolve=nh,hs.sort=ls,hs.flatten=_l;var ZE={};Tl(ZE,{ClipboardTextSerializer:()=>fh,Commands:()=>hh,Delete:()=>mh,Drop:()=>gh,Editable:()=>yh,FocusEvents:()=>xh,Keymap:()=>kh,Paste:()=>Eh,Tabindex:()=>wh,TextDirection:()=>Sh,focusEventsPluginKey:()=>bh});var Jt=class vm extends Vl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new vm(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},fh=Jt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new _t({key:new dn("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=rh(t);return oh(o,{from:a,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),hh=Jt.create({name:"commands",addCommands(){return{...Bf}}}),mh=Jt.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=Xf(n.before,[n,...e]);sh(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 f=u.mapping;u.steps.forEach((h,m)=>{var g,y;if(h instanceof cn){const x=f.slice(m).map(h.from,-1),T=f.slice(m).map(h.to),S=f.invert().map(x,-1),z=f.invert().map(T),b=(g=u.doc.nodeAt(x-1))==null?void 0:g.marks.some(E=>E.eq(h.mark)),v=(y=u.doc.nodeAt(T))==null?void 0:y.marks.some(E=>E.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:S,to:z},newRange:{from:x,to:T},partial:!!(v||b),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()}}),gh=Jt.create({name:"drop",addProseMirrorPlugins(){return[new _t({key:new dn("tiptapDrop"),props:{handleDrop:(n,e,t,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:o})}}})]}}),yh=Jt.create({name:"editable",addProseMirrorPlugins(){return[new _t({key:new dn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),bh=new dn("focusEvents"),xh=Jt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new _t({key:bh,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}}}})]}}),kh=Jt.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:p}=c,{pos:f,parent:h}=p,m=p.parent.isTextblock&&f>0?l.doc.resolve(f-1):p,g=m.parent.type.spec.isolating,y=p.pos-p.parentOffset,x=g&&m.parent.childCount===1?y===p.pos:$e.atStart(d).from===f;return!u||!h.type.isTextblock||h.textContent.length||!x||x&&p.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 rs()||Gf()?i:r},addProseMirrorPlugins(){return[new _t({key:new dn("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=$e.atStart(e.doc).from,d=$e.atEnd(e.doc).to;if(i||!(a===c&&l===d)||!Pl(t.doc))return;const f=t.tr,h=es({state:t,transaction:f}),{commands:m}=new ts({editor:this.editor,state:h});if(m.clearNodes(),!!f.steps.length)return f}})]}}),Eh=Jt.create({name:"paste",addProseMirrorPlugins(){return[new _t({key:new dn("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),wh=Jt.create({name:"tabindex",addProseMirrorPlugins(){return[new _t({key:new dn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Sh=Jt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=Zo(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 _t({key:new dn("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),ew=class ar{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 ar(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 ar(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 ar(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 ar(l,this.editor,r,r?t:null);r&&(c.actualDepth=this.depth+1),e.push(new ar(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)}},tw=`.ProseMirror {
|
|
361
358
|
position: relative;
|
|
362
359
|
}
|
|
363
360
|
|
|
@@ -427,53 +424,53 @@ img.ProseMirror-separator {
|
|
|
427
424
|
|
|
428
425
|
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
429
426
|
display: block;
|
|
430
|
-
}`;function
|
|
431
|
-
|
|
432
|
-
`,textSerializers:o={}}=e||{};return
|
|
433
|
-
|
|
434
|
-
`);return`:::${d}${
|
|
435
|
-
|
|
436
|
-
${
|
|
437
|
-
|
|
438
|
-
:::`}}}function
|
|
439
|
-
`),c=[];let d="",u=0;const
|
|
440
|
-
`;continue}else return}const m=e.extractItemData(h),{indentLevel:
|
|
441
|
-
`;const x=[
|
|
442
|
-
`,u+=1;continue}else break}if((((
|
|
443
|
-
`,u+=1;else break}let
|
|
444
|
-
`);
|
|
445
|
-
`).map(
|
|
446
|
-
`);c.push(
|
|
447
|
-
`)}function
|
|
448
|
-
|
|
449
|
-
`):""}),
|
|
450
|
-
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:
|
|
451
|
-
`,
|
|
452
|
-
${h.slice(d+2)}`,
|
|
453
|
-
`)}),o=
|
|
454
|
-
`),c=((o=l[0])==null?void 0:o.trim())||"",d=[];c&&d.push({type:"paragraph",raw:c,tokens:
|
|
455
|
-
`).trim();if(u){const h=
|
|
456
|
-
`)})}r.push({type:"list_item",raw:
|
|
457
|
-
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:
|
|
458
|
-
`),[i,
|
|
459
|
-
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:
|
|
460
|
-
`):"",markdownTokenizer:{name:"taskList",level:"block",start(
|
|
427
|
+
}`;function nw(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 ow=class extends HE{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:kE,createMappablePosition:EE},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=Uf(t,this.options.autofocus);this.editorState=Wo.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=nw(tw,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=Yf(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?[yh,fh.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),hh,xh,kh,wh,gh,Eh,mh,Sh.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new hs(r,this)}createCommandManager(){this.commandManager=new ts({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Il(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=Il(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 Df(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 p;return(p=this.capturedTransaction)==null?void 0:p.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 ih(this.state,e)}isActive(e,t){const o=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return yE(this.state,o,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ol(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
|
|
428
|
+
|
|
429
|
+
`,textSerializers:o={}}=e||{};return uE(this.state.doc,{blockSeparator:t,textSerializers:{...rh(this.schema),...o}})}get isEmpty(){return Pl(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 ew(t,this)}get $doc(){return this.$pos(0)}};function Br(n){return new uh({find:n.find,handler:({state:e,range:t,match:o})=>{const r=Ue(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(Dl(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 f=t.from+c+a.length;i.addMark(t.from+c,f,n.type.create(r||{})),i.removeStoredMark(n.type)}},undoable:n.undoable})}function Fr(n){return new uh({find:n.find,handler:({state:e,range:t,match:o,chain:r})=>{const i=Ue(n.getAttributes,void 0,o)||{},a=e.tr.delete(t.from,t.to),c=a.doc.resolve(t.from).blockRange(),d=c&&Ua(c,n.type,i);if(!d)return null;if(a.wrap(c,d),n.keepMarks&&n.editor){const{selection:p,storedMarks:f}=e,{splittableMarks:h}=n.editor.extensionManager,m=f||p.$to.parentOffset&&p.$from.marks();if(m){const g=m.filter(y=>h.includes(y.type.name));a.ensureMarks(g)}}if(n.keepAttributes){const p=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(p,i).run()}const u=a.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Yn(a.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(o,u))&&a.join(t.from-1)},undoable:n.undoable})}var rw={};Tl(rw,{createAtomBlockMarkdownSpec:()=>iw,createBlockMarkdownSpec:()=>sw,createInlineMarkdownSpec:()=>cw,parseAttributes:()=>Bl,parseIndentedBlocks:()=>jl,renderNestedMarkdownContent:()=>Hl,serializeAttributes:()=>Fl});function Bl(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 p;const f=parseInt(((p=u.match(/__QUOTED_(\d+)__/))==null?void 0:p[1])||"0",10),h=t[f];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 Fl(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 iw(n){const{nodeName:e,name:t,parseAttributes:o=Bl,serializeAttributes:r=Fl,defaultAttributes:i={},requiredAttributes:a=[],allowedAttributes:l}=n,c=t||e,d=u=>{if(!l)return u;const p={};return l.forEach(f=>{f in u&&(p[f]=u[f])}),p};return{parseMarkdown:(u,p)=>{const f={...i,...u.attributes};return p.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(u){var p;const f=new RegExp(`^:::${c}(?:\\s|$)`,"m"),h=(p=u.match(f))==null?void 0:p.index;return h!==void 0?h:-1},tokenize(u,p,f){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(T=>!(T in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:u=>{const p=d(u.attrs||{}),f=r(p),h=f?` {${f}}`:"";return`:::${c}${h} :::`}}}function sw(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=Bl,serializeAttributes:i=Fl,defaultAttributes:a={},content:l="block",allowedAttributes:c}=n,d=t||e,u=p=>{if(!c)return p;const f={};return c.forEach(h=>{h in p&&(f[h]=p[h])}),f};return{parseMarkdown:(p,f)=>{let h;if(o){const g=o(p);h=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?h=f.parseChildren(p.tokens||[]):h=f.parseInline(p.tokens||[]);const m={...a,...p.attributes};return f.createNode(e,m,h)},markdownTokenizer:{name:e,level:"block",start(p){var f;const h=new RegExp(`^:::${d}`,"m"),m=(f=p.match(h))==null?void 0:f.index;return m!==void 0?m:-1},tokenize(p,f,h){var m;const g=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=p.match(g);if(!y)return;const[x,T=""]=y,S=r(T);let z=1;const b=x.length;let v="";const E=/^:::([\w-]*)(\s.*)?/gm,C=p.slice(b);for(E.lastIndex=0;;){const M=E.exec(C);if(M===null)break;const D=M.index,$=M[1];if(!((m=M[2])!=null&&m.endsWith(":::"))){if($)z+=1;else if(z-=1,z===0){const P=C.slice(0,D);v=P.trim();const L=p.slice(0,b+D+M[0].length);let V=[];if(v)if(l==="block")for(V=h.blockTokens(P),V.forEach(F=>{F.text&&(!F.tokens||F.tokens.length===0)&&(F.tokens=h.inlineTokens(F.text))});V.length>0;){const F=V[V.length-1];if(F.type==="paragraph"&&(!F.text||F.text.trim()===""))V.pop();else break}else V=h.inlineTokens(v);return{type:e,raw:L,attributes:S,content:v,tokens:V}}}}}},renderMarkdown:(p,f)=>{const h=u(p.attrs||{}),m=i(h),g=m?` {${m}}`:"",y=f.renderChildren(p.content||[],`
|
|
430
|
+
|
|
431
|
+
`);return`:::${d}${g}
|
|
432
|
+
|
|
433
|
+
${y}
|
|
434
|
+
|
|
435
|
+
:::`}}}function aw(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 lw(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function cw(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=aw,serializeAttributes:i=lw,defaultAttributes:a={},selfClosing:l=!1,allowedAttributes:c}=n,d=t||e,u=f=>{if(!c)return f;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 f){const x=f[g];if(y!==void 0&&x===y)return;h[g]=x}}),h},p=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{const m={...a,...f.attributes};if(l)return h.createNode(e,m);const g=o?o(f):f.content||"";return g?h.createNode(e,m,[h.createTextNode(g)]):h.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(f){const h=l?new RegExp(`\\[${p}\\s*[^\\]]*\\]`):new RegExp(`\\[${p}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${p}\\]`),m=f.match(h),g=m?.index;return g!==void 0?g:-1},tokenize(f,h,m){const g=l?new RegExp(`^\\[${p}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${p}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${p}\\]`),y=f.match(g);if(!y)return;let x="",T="";if(l){const[,z]=y;T=z}else{const[,z,b]=y;T=z,x=b||""}const S=r(T.trim());return{type:e,raw:y[0],content:x.trim(),attributes:S}}},renderMarkdown:f=>{let h="";o?h=o(f):f.content&&f.content.length>0&&(h=f.content.filter(x=>x.type==="text").map(x=>x.text).join(""));const m=u(f.attrs||{}),g=i(m),y=g?` ${g}`:"";return l?`[${d}${y}]`:`[${d}${y}]${h}[/${d}]`}}}function jl(n,e,t){var o,r,i,a;const l=n.split(`
|
|
436
|
+
`),c=[];let d="",u=0;const p=e.baseIndentSize||2;for(;u<l.length;){const f=l[u],h=f.match(e.itemPattern);if(!h){if(c.length>0)break;if(f.trim()===""){u+=1,d=`${d}${f}
|
|
437
|
+
`;continue}else return}const m=e.extractItemData(h),{indentLevel:g,mainContent:y}=m;d=`${d}${f}
|
|
438
|
+
`;const x=[y];for(u+=1;u<l.length;){const b=l[u];if(b.trim()===""){const E=l.slice(u+1).findIndex(D=>D.trim()!=="");if(E===-1)break;if((((r=(o=l[u+1+E].match(/^(\s*)/))==null?void 0:o[1])==null?void 0:r.length)||0)>g){x.push(b),d=`${d}${b}
|
|
439
|
+
`,u+=1;continue}else break}if((((a=(i=b.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:a.length)||0)>g)x.push(b),d=`${d}${b}
|
|
440
|
+
`,u+=1;else break}let T;const S=x.slice(1);if(S.length>0){const b=S.map(v=>v.slice(g+p)).join(`
|
|
441
|
+
`);b.trim()&&(e.customNestedParser?T=e.customNestedParser(b):T=t.blockTokens(b))}const z=e.createToken(m,T);c.push(z)}if(c.length!==0)return{items:c,raw:d}}function Hl(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 p=u.split(`
|
|
442
|
+
`).map(f=>f?e.indent(f):"").join(`
|
|
443
|
+
`);c.push(p)}}),c.join(`
|
|
444
|
+
`)}function dw(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 p=null;if(l.marks.forEach(h=>{if(h!==a)return!1;p=h}),!p)return;let f=!1;if(Object.keys(t).forEach(h=>{t[h]!==p.attrs[h]&&(f=!0)}),f){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 On=class Nm extends Vl{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Nm(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function er(n){return new KE({find:n.find,handler:({state:e,range:t,match:o,pasteEvent:r})=>{const i=Ue(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/),p=t.from+c.indexOf(l),f=p+l.length;if(Dl(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>p).length)return null;f<t.to&&a.delete(f,t.to),p>t.from&&a.delete(t.from+u,p),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 uw=class extends ow{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}},pw=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 fw=(n={})=>{const e=s.shallowRef();return s.onMounted(()=>{e.value=new uw(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 hw=On.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
445
|
+
|
|
446
|
+
`):""}),mw=hw,gw=On.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Dt(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),yw=gw,bw=On.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),xw=bw,vh=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...o}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,o,t]},kw=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Ew=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,ww=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Sw=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Cw=Vr.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return vh("strong",{...Dt(this.options.HTMLAttributes,n),children:vh("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Br({find:kw,type:this.type}),Br({find:ww,type:this.type})]},addPasteRules(){return[er({find:Ew,type:this.type}),er({find:Sw,type:this.type})]}}),vw=Cw,Nw=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,zw=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Tw=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Mw=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Aw=Vr.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",Dt(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Br({find:Nw,type:this.type}),Br({find:Tw,type:this.type})]},addPasteRules(){return[er({find:zw,type:this.type}),er({find:Mw,type:this.type})]}}),Iw=Aw,_w=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ow=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Dw=Vr.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",Dt(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Br({find:_w,type:this.type})]},addPasteRules(){return[er({find:Ow,type:this.type})]}}),Rw=Dw,Pw=Object.defineProperty,$w=(n,e)=>{for(var t in e)Pw(n,t,{get:e[t],enumerable:!0})},Lw="listItem",Nh="textStyle",zh=/^\s*([-+*])\s$/,Th=On.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",Dt(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
447
|
+
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Lw,this.editor.getAttributes(Nh)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Fr({find:zh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Fr({find:zh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Nh),editor:this.editor})),[n]}}),Mh=On.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Dt(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(r=>r.type==="paragraph"))t=e.parseChildren(n.tokens);else{const r=n.tokens[0];if(r&&r.type==="text"&&r.tokens&&r.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(r.tokens)}],n.tokens.length>1){const a=n.tokens.slice(1),l=e.parseChildren(a);t.push(...l)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>Hl(n,e,o=>o.parentType==="bulletList"?"- ":o.parentType==="orderedList"?`${o.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Vw={};$w(Vw,{findListItemPos:()=>jr,getNextListDepth:()=>Ul,handleBackspace:()=>Wl,handleDelete:()=>ql,hasListBefore:()=>Ah,hasListItemAfter:()=>Bw,hasListItemBefore:()=>Ih,listItemHasSubList:()=>_h,nextListIsDeeper:()=>Oh,nextListIsHigher:()=>Dh});var jr=(n,e)=>{const{$from:t}=e.selection,o=tt(n,e.schema);let r=null,i=t.depth,a=t.pos,l=null;for(;i>0&&l===null;)r=t.node(i),r.type===o?l=i:(i-=1,a-=1);return l===null?null:{$pos:e.doc.resolve(a),depth:l}},Ul=(n,e)=>{const t=jr(n,e);if(!t)return!1;const[,o]=mE(e,n,t.$pos.pos+4);return o},Ah=(n,e,t)=>{const{$anchor:o}=n.selection,r=Math.max(0,o.pos-2),i=n.doc.resolve(r).node();return!(!i||!t.includes(i.type.name))},Ih=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-2);return!(r.index()===0||((t=r.nodeBefore)==null?void 0:t.type.name)!==n)},_h=(n,e,t)=>{if(!t)return!1;const o=tt(n,e.schema);let r=!1;return t.descendants(i=>{i.type===o&&(r=!0)}),r},Wl=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!ao(n.state,e)&&Ah(n.state,e,t)){const{$anchor:l}=n.state.selection,c=n.state.doc.resolve(l.before()-1),d=[];c.node().descendants((f,h)=>{f.type.name===e&&d.push({node:f,pos:h})});const u=d.at(-1);if(!u)return!1;const p=n.state.doc.resolve(c.start()+u.pos+1);return n.chain().cut({from:l.start()-1,to:l.end()+1},p.end()).joinForward().run()}if(!ao(n.state,e)||!xE(n.state))return!1;const o=jr(e,n.state);if(!o)return!1;const i=n.state.doc.resolve(o.$pos.pos-2).node(o.depth),a=_h(e,n.state,i);return Ih(e,n.state)&&!a?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},Oh=(n,e)=>{const t=Ul(n,e),o=jr(n,e);return!o||!t?!1:t>o.depth},Dh=(n,e)=>{const t=Ul(n,e),o=jr(n,e);return!o||!t?!1:t<o.depth},ql=(n,e)=>{if(!ao(n.state,e)||!bE(n.state,e))return!1;const{selection:t}=n.state,{$from:o,$to:r}=t;return!t.empty&&o.sameParent(r)?!1:Oh(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Dh(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},Bw=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-o.parentOffset-2);return!(r.index()===r.parent.childCount-1||((t=r.nodeAfter)==null?void 0:t.type.name)!==n)},Fw=Jt.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&ql(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&ql(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&Wl(n,t,o)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&Wl(n,t,o)&&(e=!0)}),e}}}}),Rh=/^(\s*)(\d+)\.\s+(.*)$/,jw=/^\s/;function Hw(n){const e=[];let t=0,o=0;for(;t<n.length;){const r=n[t],i=r.match(Rh);if(!i)break;const[,a,l,c]=i,d=a.length;let u=c,p=t+1;const f=[r];for(;p<n.length;){const h=n[p];if(h.match(Rh))break;if(h.trim()==="")f.push(h),u+=`
|
|
448
|
+
`,p+=1;else if(h.match(jw))f.push(h),u+=`
|
|
449
|
+
${h.slice(d+2)}`,p+=1;else break}e.push({indent:d,number:parseInt(l,10),content:u.trim(),raw:f.join(`
|
|
450
|
+
`)}),o=p,t=p}return[e,o]}function Ph(n,e,t){var o;const r=[];let i=0;for(;i<n.length;){const a=n[i];if(a.indent===e){const l=a.content.split(`
|
|
451
|
+
`),c=((o=l[0])==null?void 0:o.trim())||"",d=[];c&&d.push({type:"paragraph",raw:c,tokens:t.inlineTokens(c)});const u=l.slice(1).join(`
|
|
452
|
+
`).trim();if(u){const h=t.blockTokens(u);d.push(...h)}let p=i+1;const f=[];for(;p<n.length&&n[p].indent>e;)f.push(n[p]),p+=1;if(f.length>0){const h=Math.min(...f.map(g=>g.indent)),m=Ph(f,h,t);d.push({type:"list",ordered:!0,start:f[0].number,items:m,raw:f.map(g=>g.raw).join(`
|
|
453
|
+
`)})}r.push({type:"list_item",raw:a.raw,tokens:d}),i=p}else i+=1}return r}function Uw(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const o=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(r=>{if(r.type==="paragraph"||r.type==="list"||r.type==="blockquote"||r.type==="code")o.push(...e.parseChildren([r]));else if(r.type==="text"&&r.tokens){const i=e.parseChildren([r]);o.push({type:"paragraph",content:i})}else{const i=e.parseChildren([r]);i.length>0&&o.push(...i)}}),{type:"listItem",content:o}})}var Ww="listItem",$h="textStyle",Lh=/^(\d+)\.\s$/,Vh=On.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",Dt(this.options.HTMLAttributes,t),0]:["ol",Dt(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,o=n.items?Uw(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:o}:{type:"orderedList",content:o}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
454
|
+
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e?.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var o;const r=n.split(`
|
|
455
|
+
`),[i,a]=Hw(r);if(i.length===0)return;const l=Ph(i,0,t);return l.length===0?void 0:{type:"list",ordered:!0,start:((o=i[0])==null?void 0:o.number)||1,items:l,raw:r.slice(0,a).join(`
|
|
456
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Ww,this.editor.getAttributes($h)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Fr({find:Lh,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Fr({find:Lh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes($h)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),qw=/^\s*(\[([( |x])?\])\s$/,Gw=On.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",Dt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const o=e.parseChildren(n.nestedTokens);t.push(...o)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const r=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Hl(n,e,r)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:o})=>{const r=document.createElement("li"),i=document.createElement("label"),a=document.createElement("span"),l=document.createElement("input"),c=document.createElement("div"),d=p=>{var f,h;l.ariaLabel=((h=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:h.call(f,p,l.checked))||`Task item checkbox for ${p.textContent||"empty task item"}`};d(n),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",p=>p.preventDefault()),l.addEventListener("change",p=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:f}=p.target;o.isEditable&&typeof t=="function"&&o.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const m=t();if(typeof m!="number")return!1;const g=h.doc.nodeAt(m);return h.setNodeMarkup(m,void 0,{...g?.attrs,checked:f}),!0}).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([p,f])=>{r.setAttribute(p,f)}),r.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,i.append(l,a),r.append(i,c),Object.entries(e).forEach(([p,f])=>{r.setAttribute(p,f)});let u=new Set(Object.keys(e));return{dom:r,contentDOM:c,update:p=>{if(p.type!==this.type)return!1;r.dataset.checked=p.attrs.checked,l.checked=p.attrs.checked,d(p);const f=o.extensionManager.attributes,h=Lr(p,f),m=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return u.forEach(y=>{m.has(y)||(y in g?r.setAttribute(y,g[y]):r.removeAttribute(y))}),Object.entries(h).forEach(([y,x])=>{x==null?y in g?r.setAttribute(y,g[y]):r.removeAttribute(y):r.setAttribute(y,x)}),u=m,!0}}}},addInputRules(){return[Fr({find:qw,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),Kw=On.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",Dt(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
457
|
+
`):"",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=jl(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=jl(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()}}});Jt.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Th.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Mh.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Fw.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Vh.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Gw.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Kw.configure(this.options.taskList)),n}});var Jw=Th,Xw=Vh,Yw=Mh,Qw=On.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",Dt(this.options.HTMLAttributes,n)]},renderText(){return`
|
|
461
458
|
`},renderMarkdown:()=>`
|
|
462
|
-
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:
|
|
463
|
-
`,
|
|
459
|
+
`,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 p=c.filter(f=>l.includes(f.type.name));d.ensureMarks(p)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Zw=Qw;const eS="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",tS="ελ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",Gl="numeric",Kl="ascii",Jl="alpha",Hr="asciinumeric",Ur="alphanumeric",Xl="domain",Bh="emoji",nS="scheme",oS="slashscheme",Yl="whitespace";function rS(n,e){return n in e||(e[n]=[]),e[n]}function Io(n,e,t){e[Gl]&&(e[Hr]=!0,e[Ur]=!0),e[Kl]&&(e[Hr]=!0,e[Jl]=!0),e[Hr]&&(e[Ur]=!0),e[Jl]&&(e[Ur]=!0),e[Ur]&&(e[Xl]=!0),e[Bh]&&(e[Xl]=!0);for(const o in e){const r=rS(o,t);r.indexOf(n)<0&&r.push(n)}}function iS(n,e){const t={};for(const o in e)e[o].indexOf(n)>=0&&(t[o]=!0);return t}function Rt(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Rt.groups={},Rt.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||Rt.groups;let r;return e&&e.j?r=e:(r=new Rt(e),t&&o&&Io(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||Rt.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 Rt,Object.assign(a.j,l.j),a.jr.push.apply(a.jr,l.jr),a.jd=l.jd,a.t=l.t):a=new Rt,i){if(o)if(a.t&&typeof a.t=="string"){const c=Object.assign(iS(a.t,o),t);Io(i,c,o)}else t&&Io(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),Ye=(n,e,t,o,r)=>n.tr(e,t,o,r),Fh=(n,e,t,o,r)=>n.ts(e,t,o,r),ie=(n,e,t,o,r)=>n.tt(e,t,o,r),Dn="WORD",Ql="UWORD",jh="ASCIINUMERICAL",Hh="ALPHANUMERICAL",Wr="LOCALHOST",Zl="TLD",ec="UTLD",ms="SCHEME",tr="SLASH_SCHEME",tc="NUM",nc="WS",oc="NL",qr="OPENBRACE",Gr="CLOSEBRACE",gs="OPENBRACKET",ys="CLOSEBRACKET",bs="OPENPAREN",xs="CLOSEPAREN",ks="OPENANGLEBRACKET",Es="CLOSEANGLEBRACKET",ws="FULLWIDTHLEFTPAREN",Ss="FULLWIDTHRIGHTPAREN",Cs="LEFTCORNERBRACKET",vs="RIGHTCORNERBRACKET",Ns="LEFTWHITECORNERBRACKET",zs="RIGHTWHITECORNERBRACKET",Ts="FULLWIDTHLESSTHAN",Ms="FULLWIDTHGREATERTHAN",As="AMPERSAND",Is="APOSTROPHE",_s="ASTERISK",lo="AT",Os="BACKSLASH",Ds="BACKTICK",Rs="CARET",co="COLON",rc="COMMA",Ps="DOLLAR",xn="DOT",$s="EQUALS",ic="EXCLAMATION",Xt="HYPHEN",Kr="PERCENT",Ls="PIPE",Vs="PLUS",Bs="POUND",Jr="QUERY",sc="QUOTE",Uh="FULLWIDTHMIDDLEDOT",ac="SEMI",kn="SLASH",Xr="TILDE",Fs="UNDERSCORE",Wh="EMOJI",js="SYM";var qh=Object.freeze({__proto__:null,ALPHANUMERICAL:Hh,AMPERSAND:As,APOSTROPHE:Is,ASCIINUMERICAL:jh,ASTERISK:_s,AT:lo,BACKSLASH:Os,BACKTICK:Ds,CARET:Rs,CLOSEANGLEBRACKET:Es,CLOSEBRACE:Gr,CLOSEBRACKET:ys,CLOSEPAREN:xs,COLON:co,COMMA:rc,DOLLAR:Ps,DOT:xn,EMOJI:Wh,EQUALS:$s,EXCLAMATION:ic,FULLWIDTHGREATERTHAN:Ms,FULLWIDTHLEFTPAREN:ws,FULLWIDTHLESSTHAN:Ts,FULLWIDTHMIDDLEDOT:Uh,FULLWIDTHRIGHTPAREN:Ss,HYPHEN:Xt,LEFTCORNERBRACKET:Cs,LEFTWHITECORNERBRACKET:Ns,LOCALHOST:Wr,NL:oc,NUM:tc,OPENANGLEBRACKET:ks,OPENBRACE:qr,OPENBRACKET:gs,OPENPAREN:bs,PERCENT:Kr,PIPE:Ls,PLUS:Vs,POUND:Bs,QUERY:Jr,QUOTE:sc,RIGHTCORNERBRACKET:vs,RIGHTWHITECORNERBRACKET:zs,SCHEME:ms,SEMI:ac,SLASH:kn,SLASH_SCHEME:tr,SYM:js,TILDE:Xr,TLD:Zl,UNDERSCORE:Fs,UTLD:ec,UWORD:Ql,WORD:Dn,WS:nc});const Rn=/[a-z]/,Yr=new RegExp("\\p{L}","u"),lc=new RegExp("\\p{Emoji}","u"),Pn=/\d/,cc=/\s/,Gh="\r",dc=`
|
|
460
|
+
`,sS="️",aS="",uc="";let Hs=null,Us=null;function lS(n=[]){const e={};Rt.groups=e;const t=new Rt;Hs==null&&(Hs=Jh(eS)),Us==null&&(Us=Jh(tS)),ie(t,"'",Is),ie(t,"{",qr),ie(t,"}",Gr),ie(t,"[",gs),ie(t,"]",ys),ie(t,"(",bs),ie(t,")",xs),ie(t,"<",ks),ie(t,">",Es),ie(t,"(",ws),ie(t,")",Ss),ie(t,"「",Cs),ie(t,"」",vs),ie(t,"『",Ns),ie(t,"』",zs),ie(t,"<",Ts),ie(t,">",Ms),ie(t,"&",As),ie(t,"*",_s),ie(t,"@",lo),ie(t,"`",Ds),ie(t,"^",Rs),ie(t,":",co),ie(t,",",rc),ie(t,"$",Ps),ie(t,".",xn),ie(t,"=",$s),ie(t,"!",ic),ie(t,"-",Xt),ie(t,"%",Kr),ie(t,"|",Ls),ie(t,"+",Vs),ie(t,"#",Bs),ie(t,"?",Jr),ie(t,'"',sc),ie(t,"/",kn),ie(t,";",ac),ie(t,"~",Xr),ie(t,"_",Fs),ie(t,"\\",Os),ie(t,"・",Uh);const o=Ye(t,Pn,tc,{[Gl]:!0});Ye(o,Pn,o);const r=Ye(o,Rn,jh,{[Hr]:!0}),i=Ye(o,Yr,Hh,{[Ur]:!0}),a=Ye(t,Rn,Dn,{[Kl]:!0});Ye(a,Pn,r),Ye(a,Rn,a),Ye(r,Pn,r),Ye(r,Rn,r);const l=Ye(t,Yr,Ql,{[Jl]:!0});Ye(l,Rn),Ye(l,Pn,i),Ye(l,Yr,l),Ye(i,Pn,i),Ye(i,Rn),Ye(i,Yr,i);const c=ie(t,dc,oc,{[Yl]:!0}),d=ie(t,Gh,nc,{[Yl]:!0}),u=Ye(t,cc,nc,{[Yl]:!0});ie(t,uc,u),ie(d,dc,c),ie(d,uc,u),Ye(d,cc,u),ie(u,Gh),ie(u,dc),Ye(u,cc,u),ie(u,uc,u);const p=Ye(t,lc,Wh,{[Bh]:!0});ie(p,"#"),Ye(p,lc,p),ie(p,sS,p);const f=ie(p,aS);ie(f,"#"),Ye(f,lc,p);const h=[[Rn,a],[Pn,r]],m=[[Rn,null],[Yr,l],[Pn,i]];for(let g=0;g<Hs.length;g++)uo(t,Hs[g],Zl,Dn,h);for(let g=0;g<Us.length;g++)uo(t,Us[g],ec,Ql,m);Io(Zl,{tld:!0,ascii:!0},e),Io(ec,{utld:!0,alpha:!0},e),uo(t,"file",ms,Dn,h),uo(t,"mailto",ms,Dn,h),uo(t,"http",tr,Dn,h),uo(t,"https",tr,Dn,h),uo(t,"ftp",tr,Dn,h),uo(t,"ftps",tr,Dn,h),Io(ms,{scheme:!0,ascii:!0},e),Io(tr,{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],T=n[g][1]?{[nS]:!0}:{[oS]:!0};y.indexOf("-")>=0?T[Xl]=!0:Rn.test(y)?Pn.test(y)?T[Hr]=!0:T[Kl]=!0:T[Gl]=!0,Fh(t,y,y,T)}return Fh(t,"localhost",Wr,{ascii:!0}),t.jd=new Rt(js),{start:t,tokens:Object.assign({groups:e},qh)}}function Kh(n,e){const t=cS(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,p=-1,f=-1;for(;a<o&&(c=l.go(t[a]));)l=c,l.accepts()?(p=0,f=0,u=l):p>=0&&(p+=t[a].length,f++),d+=t[a].length,i+=t[a].length,a++;i-=p,a-=f,d-=p,r.push({t:u.t,v:e.slice(i-d,i),s:i-d,e:i})}return r}function cS(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 uo(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 Rt(o),i.jr=r.slice(),n.j[c]=i),n=i}return i=new Rt(t),i.jr=r.slice(),n.j[e[a-1]]=i,i}function Jh(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 Qr={defaultProtocol:"http",events:null,format:Xh,formatHref:Xh,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function pc(n,e=null){let t=Object.assign({},Qr);n&&(t=Object.assign(t,n instanceof pc?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}pc.prototype={o:Qr,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]:Qr[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 Xh(n){return n}function Yh(n,e){this.t="token",this.v=n,this.tk=e}Yh.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=Qr.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),p=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:p}}};function Ws(n,e){class t extends Yh{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 Qh=Ws("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Zh=Ws("text"),dS=Ws("nl"),qs=Ws("url",{isLink:!0,toHref(n=Qr.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Wr&&n[1].t===co}}),Yt=n=>new Rt(n);function uS({groups:n}){const e=n.domain.concat([As,_s,lo,Os,Ds,Rs,Ps,$s,Xt,tc,Kr,Ls,Vs,Bs,kn,js,Xr,Fs]),t=[Is,co,rc,xn,ic,Kr,Jr,sc,ac,ks,Es,qr,Gr,ys,gs,bs,xs,ws,Ss,Cs,vs,Ns,zs,Ts,Ms],o=[As,Is,_s,Os,Ds,Rs,Ps,$s,Xt,qr,Gr,Kr,Ls,Vs,Bs,Jr,kn,js,Xr,Fs],r=Yt(),i=ie(r,Xr);Ie(i,o,i),Ie(i,n.domain,i);const a=Yt(),l=Yt(),c=Yt();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=ie(a,lo);ie(i,lo,d),ie(l,lo,d),ie(c,lo,d);const u=ie(i,xn);Ie(u,o,i),Ie(u,n.domain,i);const p=Yt();Ie(d,n.domain,p),Ie(p,n.domain,p);const f=ie(p,xn);Ie(f,n.domain,p);const h=Yt(Qh);Ie(f,n.tld,h),Ie(f,n.utld,h),ie(d,Wr,h);const m=ie(p,Xt);ie(m,Xt,m),Ie(m,n.domain,p),Ie(h,n.domain,p),ie(h,xn,f),ie(h,Xt,m);const g=ie(h,co);Ie(g,n.numeric,Qh);const y=ie(a,Xt),x=ie(a,xn);ie(y,Xt,y),Ie(y,n.domain,a),Ie(x,o,i),Ie(x,n.domain,a);const T=Yt(qs);Ie(x,n.tld,T),Ie(x,n.utld,T),Ie(T,n.domain,a),Ie(T,o,i),ie(T,xn,x),ie(T,Xt,y),ie(T,lo,d);const S=ie(T,co),z=Yt(qs);Ie(S,n.numeric,z);const b=Yt(qs),v=Yt();Ie(b,e,b),Ie(b,t,v),Ie(v,e,b),Ie(v,t,v),ie(T,kn,b),ie(z,kn,b);const E=ie(l,co),C=ie(c,co),M=ie(C,kn),D=ie(M,kn);Ie(l,n.domain,a),ie(l,xn,x),ie(l,Xt,y),Ie(c,n.domain,a),ie(c,xn,x),ie(c,Xt,y),Ie(E,n.domain,b),ie(E,kn,b),ie(E,Jr,b),Ie(D,n.domain,b),Ie(D,e,b),ie(D,kn,b);const $=[[qr,Gr],[gs,ys],[bs,xs],[ks,Es],[ws,Ss],[Cs,vs],[Ns,zs],[Ts,Ms]];for(let P=0;P<$.length;P++){const[L,V]=$[P],F=ie(b,L);ie(v,L,F),ie(F,V,b);const H=Yt(qs);Ie(F,e,H);const U=Yt();Ie(F,t),Ie(H,e,H),Ie(H,t,U),Ie(U,e,H),Ie(U,t,U),ie(H,V,b),ie(U,V,b)}return ie(r,Wr,T),ie(r,oc,dS),{start:r,tokens:qh}}function pS(n,e,t){let o=t.length,r=0,i=[],a=[];for(;r<o;){let l=n,c=null,d=null,u=0,p=null,f=-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()?(f=0,p=l):f>=0&&f++,r++,u++;if(f<0)r-=u,r<o&&(a.push(t[r]),r++);else{a.length>0&&(i.push(fc(Zh,e,a)),a=[]),r-=f,u-=f;const h=p.t,m=t.slice(r-u,r);i.push(fc(h,e,m))}}return a.length>0&&i.push(fc(Zh,e,a)),i}function fc(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 fS=typeof console<"u"&&console&&console.warn||(()=>{}),hS="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",We={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function mS(){return Rt.groups={},We.scanner=null,We.parser=null,We.tokenQueue=[],We.pluginQueue=[],We.customSchemes=[],We.initialized=!1,We}function em(n,e=!1){if(We.initialized&&fS(`linkifyjs: already initialized - will not register custom scheme "${n}" ${hS}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
|
|
464
461
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
465
462
|
2. Cannot start or end with "-"
|
|
466
|
-
3. "-" cannot repeat`);We.customSchemes.push([t,e])}function rN(){We.scanner=XS(We.customSchemes);for(let t=0;t<We.tokenQueue.length;t++)We.tokenQueue[t][1]({scanner:We.scanner});We.parser=ZS(We.scanner.tokens);for(let t=0;t<We.pluginQueue.length;t++)We.pluginQueue[t][1]({scanner:We.scanner,parser:We.parser});return We.initialized=!0,We}function Ec(t){return We.initialized||rN(),eN(We.parser.start,t,pm(We.scanner.start,t))}Ec.scan=pm;function Em(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const o=new yc(n),r=Ec(t),i=[];for(let s=0;s<r.length;s++){const l=r[s];l.isLink&&(!e||l.t===e)&&o.check(l)&&i.push(l.toFormattedObject(o))}return i}var kc="[\0- -\u2029 ]",iN=new RegExp(kc),sN=new RegExp(`${kc}$`),aN=new RegExp(kc,"g");function lN(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function cN(t){return new Ot({key:new an("autolink"),appendTransaction:(e,n,o)=>{const r=e.some(d=>d.docChanged)&&!n.doc.eq(o.doc),i=e.some(d=>d.getMeta("preventAutolink"));if(!r||i)return;const{tr:s}=o,l=mh(n.doc,[...e]);if(Ch(l).forEach(({newRange:d})=>{const u=qk(o.doc,d,h=>h.isTextblock);let f,p;if(u.length>1)f=u[0],p=o.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const h=o.doc.textBetween(d.from,d.to," "," ");if(!sN.test(h))return;f=u[0],p=o.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&p){const h=p.split(iN).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],b=f.pos+p.lastIndexOf(m);if(!m)return!1;const g=Ec(m).map(x=>x.toObject(t.defaultProtocol));if(!lN(g))return!1;g.filter(x=>x.isLink).map(x=>({...x,from:b+x.start+1,to:b+x.end+1})).filter(x=>o.schema.marks.code?!o.doc.rangeHasMark(x.from,x.to,o.schema.marks.code):!0).filter(x=>t.validate(x.value)).filter(x=>t.shouldAutoLink(x.value)).forEach(x=>{Bl(x.from,x.to,o.doc).some(v=>v.mark.type===t.type)||s.addMark(x.from,x.to,t.type.create({href:x.href}))})}}),!!s.steps.length)return s}})}function dN(t){return new Ot({key:new an("handleClickLink"),props:{handleClick:(e,n,o)=>{var r,i;if(o.button!==0||!e.editable)return!1;let s=!1;if(t.enableClickSelection&&(s=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){let l=null;if(o.target instanceof HTMLAnchorElement)l=o.target;else{let f=o.target;const p=[];for(;f.nodeName!=="DIV";)p.push(f),f=f.parentNode;l=p.find(h=>h.nodeName==="A")}if(!l)return s;const c=Nh(e.state,t.type.name),d=(r=l?.href)!=null?r:c.href,u=(i=l?.target)!=null?i:c.target;l&&d&&(window.open(d,u),s=!0)}return s}}})}function uN(t){return new Ot({key:new an("handlePasteLink"),props:{handlePaste:(e,n,o)=>{const{shouldAutoLink:r}=t,{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let c="";o.content.forEach(u=>{c+=u.textContent});const d=Em(c,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===c);return!c||!d||r!==void 0&&!r(d.value)?!1:t.editor.commands.setMark(t.type,{href:d.href})}}})}function Ao(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(o=>{const r=typeof o=="string"?o:o.scheme;r&&n.push(r)}),!t||t.replace(aN,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var fN=Vr.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){xm(t);return}xm(t.scheme,t.optionalSlashes)})},onDestroy(){oN()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Ao(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const r=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Ao(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Ao(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Rt(this.options.HTMLAttributes,t),0]:["a",Rt(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n;const o=((n=t.attrs)==null?void 0:n.href)||"";return`[${e.renderChildren(t)}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:o=>!!Ao(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:o=>!!Ao(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Yo({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:o}=this.options,r=Em(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Ao(s,n),protocols:n,defaultProtocol:o}));r.length&&r.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(cN({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!Ao(r,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(dN({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(uN({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),pN=fN;const hN={class:"zcode-rich-text-editor"},mN={key:0,class:"zcode-rich-text-toolbar"},gN=a.defineComponent({__name:"RichTextEditor",props:{modelValue:{type:String},placeholder:{type:String}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=e,r=tS({extensions:[oS,iS,aS,pS,xS,SS,LS,$S,VS,FS,pN.configure({openOnClick:!1,HTMLAttributes:{class:"zcode-link"}})],content:n.modelValue||"",editorProps:{attributes:{class:"zcode-tiptap-editor","data-placeholder":n.placeholder||"テキストを入力..."}},onUpdate:({editor:s})=>{const l=s.getHTML();o("update:modelValue",l)}});a.watch(()=>n.modelValue,s=>{r.value&&r.value.getHTML()!==s&&r.value.commands.setContent(s||"")});const i=()=>{if(!r.value)return;const s=r.value.getAttributes("link").href,l=window.prompt("URLを入力してください",s);if(l!==null){if(l===""){r.value.chain().focus().extendMarkRange("link").unsetLink().run();return}r.value.chain().focus().extendMarkRange("link").setLink({href:l}).run()}};return a.onUnmounted(()=>{r.value&&r.value.destroy()}),(s,l)=>(a.openBlock(),a.createElementBlock("div",hN,[a.unref(r)?(a.openBlock(),a.createElementBlock("div",mN,[a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("bold")},"zcode-toolbar-btn"]),title:"太字",onClick:l[0]||(l[0]=c=>a.unref(r).chain().focus().toggleBold().run())},[a.createVNode(a.unref(Jm),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("italic")},"zcode-toolbar-btn"]),title:"斜体",onClick:l[1]||(l[1]=c=>a.unref(r).chain().focus().toggleItalic().run())},[a.createVNode(a.unref(Zm),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("strike")},"zcode-toolbar-btn"]),title:"取り消し線",onClick:l[2]||(l[2]=c=>a.unref(r).chain().focus().toggleStrike().run())},[a.createVNode(a.unref(rg),{size:16})],2),l[5]||(l[5]=a.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("bulletList")},"zcode-toolbar-btn"]),title:"箇条書き",onClick:l[3]||(l[3]=c=>a.unref(r).chain().focus().toggleBulletList().run())},[a.createVNode(a.unref(ng),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("orderedList")},"zcode-toolbar-btn"]),title:"番号付きリスト",onClick:l[4]||(l[4]=c=>a.unref(r).chain().focus().toggleOrderedList().run())},[a.createVNode(a.unref(tg),{size:16})],2),l[6]||(l[6]=a.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("link")},"zcode-toolbar-btn"]),title:"リンク",onClick:i},[a.createVNode(a.unref(eg),{size:16})],2)])):a.createCommentVNode("",!0),a.createVNode(a.unref(eS),{editor:a.unref(r),class:"zcode-rich-text-editor-content"},null,8,["editor"])]))}}),bN={class:"zcode-image-modal-header"},yN={class:"zcode-image-modal-header-title",role:"heading","aria-level":"3"},xN=["aria-label"],EN={key:0,class:"zcode-image-current"},kN={class:"zcode-image-current-title",role:"heading","aria-level":"4"},wN={class:"zcode-image-current-item"},SN=["src","alt"],NN={class:"zcode-image-current-name"},CN={class:"zcode-image-tabs"},vN={class:"zcode-image-grid"},TN=["onClick"],zN=["src","alt"],_N={class:"zcode-image-name"},AN={class:"zcode-image-add"},MN={class:"zcode-image-modal-actions"},IN=a.defineComponent({__name:"ImageSelectModal",props:{isOpen:{type:Boolean},imagesCommon:{type:Array},imagesIndividual:{type:Array},imagesSpecial:{type:Array},currentValue:{type:String}},emits:["update:model-value","add-image","delete-image","close"],setup(t,{emit:e}){const{t:n}=rn(),o=t,r=e,i=a.ref("common"),s=a.ref(null),l=a.ref(o.currentValue||null),c=a.computed(()=>i.value==="common"?o.imagesCommon:i.value==="individual"?o.imagesIndividual:o.imagesSpecial),d=()=>o.currentValue&&[...o.imagesCommon,...o.imagesIndividual,...o.imagesSpecial].find(g=>g.id===o.currentValue)||null,u=b=>{l.value=b.id},f=()=>{l.value&&(r("update:model-value",l.value),m())},p=()=>{l.value&&confirm(n("imagesManager.deleteImageFromModalConfirm"))&&(r("delete-image",l.value),l.value=null)},h=b=>{const x=b.target.files?.[0];if(!x)return;const v=new FileReader;v.onload=w=>{const T=w.target?.result,M={id:`img-${Date.now()}`,name:x.name,url:T,mimeType:x.type,needsUpload:!0},A=i.value==="common"?"common":i.value==="individual"?"individual":"special";r("add-image",M,A),l.value=M.id},v.readAsDataURL(x)},m=()=>{r("close")};return(b,g)=>t.isOpen?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:a.withModifiers(m,["self"])},[a.createElementVNode("div",{class:"zcode-image-modal-content",onClick:g[4]||(g[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",bN,[a.createElementVNode("div",yN,a.toDisplayString(b.$t("imagesManager.selectImage")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":b.$t("common.close"),onClick:m},[a.createVNode(a.unref(Qe),{size:18})],8,xN)]),t.currentValue&&d()?(a.openBlock(),a.createElementBlock("div",EN,[a.createElementVNode("div",kN,a.toDisplayString(b.$t("imagesManager.currentlySelected")),1),a.createElementVNode("div",wN,[a.createElementVNode("img",{src:d()?.url,alt:d()?.name||"",class:"zcode-image-current-item-img"},null,8,SN),a.createElementVNode("div",NN,a.toDisplayString(d()?.name),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",CN,[a.createElementVNode("button",{class:a.normalizeClass([{active:i.value==="common"},"zcode-image-tab"]),onClick:g[0]||(g[0]=x=>i.value="common")},a.toDisplayString(b.$t("dataViewer.common")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:i.value==="individual"},"zcode-image-tab"]),onClick:g[1]||(g[1]=x=>i.value="individual")},a.toDisplayString(b.$t("dataViewer.individual")),3),t.imagesSpecial.length>0?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass([{active:i.value==="special"},"zcode-image-tab"]),onClick:g[2]||(g[2]=x=>i.value="special")},a.toDisplayString(b.$t("dataViewer.special")),3)):a.createCommentVNode("",!0)]),a.createElementVNode("div",vN,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(c.value,x=>(a.openBlock(),a.createElementBlock("div",{key:x.id,class:a.normalizeClass([{selected:l.value===x.id},"zcode-image-item"]),onClick:v=>u(x)},[a.createElementVNode("img",{src:x.url,alt:x.name,class:"zcode-image-item-img"},null,8,zN),a.createElementVNode("div",_N,a.toDisplayString(x.name),1)],10,TN))),128))]),a.createElementVNode("div",AN,[a.createElementVNode("input",{ref_key:"fileInput",ref:s,type:"file",accept:"image/*",style:{display:"none"},onChange:h},null,544),a.createElementVNode("button",{class:"zcode-image-add-btn",onClick:g[3]||(g[3]=x=>s.value?.click())},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(b.$t("imagesManager.addImage")),1)])]),a.createElementVNode("div",MN,[l.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-btn-primary zcode-image-modal-actions-btn",onClick:f},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(b.$t("imagesManager.select")),1)])):a.createCommentVNode("",!0),l.value?(a.openBlock(),a.createElementBlock("button",{key:1,class:"zcode-btn-danger zcode-image-modal-actions-btn",onClick:p},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(b.$t("common.delete")),1)])):a.createCommentVNode("",!0)])])])):a.createCommentVNode("",!0)}}),ON={class:"zcode-edit-panel-header"},DN={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},RN=["aria-label"],PN={key:0,class:"zcode-parent-selector"},LN={key:1,class:"zcode-group-tabs"},$N=["onClick"],VN={key:2,class:"zcode-field-editor"},BN={class:"zcode-field-item-title",role:"heading","aria-level":"4"},FN={key:0,class:"zcode-text-editor"},jN=["value","placeholder","maxlength","readonly","disabled","onInput"],UN={key:0,class:"zcode-field-error-message"},HN={key:1,class:"zcode-field-counter"},WN={key:1,class:"zcode-text-editor"},GN=["value","placeholder","maxlength","readonly","disabled","onInput"],qN={key:0,class:"zcode-field-error-message"},KN={key:1,class:"zcode-field-counter"},JN={key:2,class:"zcode-rich-text-editor-wrapper"},XN={key:0,class:"zcode-field-error-message"},YN={key:3,class:"zcode-radio-editor"},QN={class:"zcode-radio-group"},ZN=["onUpdate:modelValue","name","value","onChange"],eC={class:"zcode-radio-item-label"},tC={key:4,class:"zcode-checkbox-editor"},nC={class:"zcode-checkbox-group"},oC=["onUpdate:modelValue","value","onChange"],rC={class:"zcode-checkbox-item-label"},iC={key:5,class:"zcode-select-editor"},sC=["onUpdate:modelValue","onChange"],aC=["value"],lC={key:6,class:"zcode-select-editor"},cC=["onUpdate:modelValue","size","onChange"],dC=["value"],uC={key:7,class:"zcode-tag-editor"},fC=["onUpdate:modelValue","onChange"],pC=["value"],hC={class:"zcode-tag-preview"},mC={key:8,class:"zcode-boolean-editor"},gC={class:"zcode-checkbox-item"},bC=["onUpdate:modelValue","onChange"],yC={class:"zcode-checkbox-item-label"},xC={key:9,class:"zcode-image-editor"},EC={class:"zcode-image-editor-buttons"},kC=["onClick"],wC=["title","onClick"],SC={key:0,class:"zcode-image-preview"},NC=["src","alt"],CC={key:3,class:"zcode-edit-fields"},vC={class:"zcode-edit-fields-text"},TC={class:"zcode-edit-fields-text"},zC=a.defineComponent({__name:"EditPanel",props:{editingComponent:{type:[Object,null]},editingAvailableFields:{type:Array},fieldErrors:{type:Object},currentMode:{type:String},canSelectParent:{type:Boolean},imagesCommon:{type:Array},imagesIndividual:{type:Array},imagesSpecial:{type:Array}},emits:["close","select-parent","save-field","add-image","delete-image"],setup(t,{emit:e}){const n=t,o=a.ref("all"),r=a.computed(()=>{const y=new Map;return n.editingAvailableFields.forEach(E=>{const S=E.groupName||"other";y.set(S,(y.get(S)||0)+1)}),Array.from(y.entries()).map(([E,S])=>({name:E,count:S}))}),i=a.computed(()=>r.value.length>1),s=a.computed(()=>!i.value||o.value==="all"?n.editingAvailableFields:n.editingAvailableFields.filter(y=>(y.groupName||"other")===o.value));a.watch(()=>i.value,y=>{y?o.value="all":o.value=void 0},{immediate:!0}),a.watch(()=>n.editingAvailableFields,()=>{if(i.value){if(o.value==="all")return;r.value.some(E=>E.name===o.value)||(o.value="all")}},{deep:!0});const l=e,c=a.ref({});function d(y){const E=y.label||y.fieldName,S=y.currentValue,D=y.type==="rich"&&typeof S=="string"&&S.trim()==="<p></p>"?"":S??"";return y.required&&(D===""||D===void 0||D===null)?`${E}は必須です`:typeof y.maxLength=="number"&&y.maxLength>0&&String(D).length>y.maxLength?`${E}は${y.maxLength}文字以内で入力してください`:null}function u(y,E){E?c.value[y]=E:delete c.value[y]}function f(y){return c.value[y]||n.fieldErrors?.[y]||null}const p=a.ref(!1),h=a.ref(null),m=y=>{h.value=y,p.value=!0},b=()=>{p.value=!1,h.value=null},g=y=>{y.currentValue="",l("save-field",y)},x=y=>{h.value&&(h.value.currentValue=y||"",l("save-field",h.value))},v=(y,E)=>{l("add-image",y,E)},w=y=>{l("delete-image",y),h.value?.currentValue===y&&(h.value.currentValue="",l("save-field",h.value))},T=y=>y&&[...n.imagesCommon,...n.imagesIndividual,...n.imagesSpecial].find(D=>D.id===y)?.url||null,M=(y,E)=>{const S=E.target;y.currentValue=S.value,u(y.fieldName,d(y)),l("save-field",y)},A=(y,E)=>{y.optional&&E===""?y.currentValue=void 0:y.currentValue=E,u(y.fieldName,d(y)),l("save-field",y)};return(y,E)=>t.editingComponent&&t.currentMode==="edit"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-edit-panel",onClick:E[3]||(E[3]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",ON,[a.createElementVNode("div",DN,a.toDisplayString(y.$t("editPanel.editing",{type:t.editingComponent.type})),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":y.$t("common.close"),onClick:E[0]||(E[0]=S=>y.$emit("close"))},[a.createVNode(a.unref(Qe),{size:18})],8,RN)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",PN,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:E[1]||(E[1]=S=>y.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(y.$t("addPanel.selectParent")),1)])])):a.createCommentVNode("",!0),i.value?(a.openBlock(),a.createElementBlock("div",LN,[a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="all"},"zcode-group-tab"]),onClick:E[2]||(E[2]=S=>o.value="all")}," all ",2),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,S=>(a.openBlock(),a.createElementBlock("button",{key:S.name,class:a.normalizeClass([{active:o.value===S.name},"zcode-group-tab"]),onClick:D=>o.value=S.name},a.toDisplayString(S.name),11,$N))),128))])):a.createCommentVNode("",!0),s.value.length>0?(a.openBlock(),a.createElementBlock("div",VN,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.value,S=>(a.openBlock(),a.createElementBlock("div",{key:S.fieldName,class:"zcode-field-item"},[a.createElementVNode("div",BN,a.toDisplayString(S.label),1),S.type==="text"?(a.openBlock(),a.createElementBlock("div",FN,[a.createElementVNode("input",{type:"text",value:S.currentValue??"",placeholder:S.defaultValue,maxlength:S.maxLength,readonly:S.readonly,disabled:S.disabled,class:a.normalizeClass([{"zcode-field-error":f(S.fieldName)},"zcode-text-input"]),onInput:D=>M(S,D)},null,42,jN),f(S.fieldName)?(a.openBlock(),a.createElementBlock("div",UN,a.toDisplayString(f(S.fieldName)),1)):a.createCommentVNode("",!0),S.maxLength?(a.openBlock(),a.createElementBlock("div",HN,a.toDisplayString(String(S.currentValue??"").length)+" / "+a.toDisplayString(S.maxLength),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),S.type==="textarea"?(a.openBlock(),a.createElementBlock("div",WN,[a.createElementVNode("textarea",{value:S.currentValue??"",placeholder:S.defaultValue,maxlength:S.maxLength,readonly:S.readonly,disabled:S.disabled,class:a.normalizeClass([{"zcode-field-error":f(S.fieldName)},"zcode-textarea"]),rows:"4",onInput:D=>M(S,D)},null,42,GN),f(S.fieldName)?(a.openBlock(),a.createElementBlock("div",qN,a.toDisplayString(f(S.fieldName)),1)):a.createCommentVNode("",!0),S.maxLength?(a.openBlock(),a.createElementBlock("div",KN,a.toDisplayString(String(S.currentValue??"").length)+" / "+a.toDisplayString(S.maxLength),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),S.type==="rich"?(a.openBlock(),a.createElementBlock("div",JN,[a.createVNode(gN,{"model-value":S.currentValue??"",placeholder:S.defaultValue,"onUpdate:modelValue":D=>A(S,D)},null,8,["model-value","placeholder","onUpdate:modelValue"]),f(S.fieldName)?(a.openBlock(),a.createElementBlock("div",XN,a.toDisplayString(f(S.fieldName)),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),S.type==="radio"?(a.openBlock(),a.createElementBlock("div",YN,[a.createElementVNode("div",QN,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(S.options,D=>(a.openBlock(),a.createElementBlock("label",{key:D,class:"zcode-radio-item"},[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":W=>S.currentValue=W,type:"radio",name:S.fieldName,value:D,onChange:W=>y.$emit("save-field",S)},null,40,ZN),[[a.vModelRadio,S.currentValue]]),a.createElementVNode("span",eC,a.toDisplayString(D),1)]))),128))])])):a.createCommentVNode("",!0),S.type==="checkbox"?(a.openBlock(),a.createElementBlock("div",tC,[a.createElementVNode("div",nC,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(S.options,D=>(a.openBlock(),a.createElementBlock("label",{key:D,class:"zcode-checkbox-item"},[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":W=>S.currentValue=W,type:"checkbox",value:D,onChange:W=>y.$emit("save-field",S)},null,40,oC),[[a.vModelCheckbox,S.currentValue]]),a.createElementVNode("span",rC,a.toDisplayString(D),1)]))),128))])])):a.createCommentVNode("",!0),S.type==="select"?(a.openBlock(),a.createElementBlock("div",iC,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":D=>S.currentValue=D,class:"zcode-select",onChange:D=>y.$emit("save-field",S)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(S.options,D=>(a.openBlock(),a.createElementBlock("option",{key:D,value:D},a.toDisplayString(D),9,aC))),128))],40,sC),[[a.vModelSelect,S.currentValue]])])):a.createCommentVNode("",!0),S.type==="select-multiple"?(a.openBlock(),a.createElementBlock("div",lC,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":D=>S.currentValue=D,class:"zcode-select",multiple:"",size:Math.min(S.options?.length||3,5),onChange:D=>y.$emit("save-field",S)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(S.options,D=>(a.openBlock(),a.createElementBlock("option",{key:D,value:D},a.toDisplayString(D),9,dC))),128))],40,cC),[[a.vModelSelect,S.currentValue]])])):a.createCommentVNode("",!0),S.type==="tag"?(a.openBlock(),a.createElementBlock("div",uC,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":D=>S.currentValue=D,class:"zcode-select",onChange:D=>y.$emit("save-field",S)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(S.options,D=>(a.openBlock(),a.createElementBlock("option",{key:D,value:D},a.toDisplayString(D),9,pC))),128))],40,fC),[[a.vModelSelect,S.currentValue]]),a.createElementVNode("div",hC,[E[4]||(E[4]=a.createTextVNode(" 現在のタグ: ",-1)),a.createElementVNode("code",null,"<"+a.toDisplayString(S.currentValue)+">",1)])])):a.createCommentVNode("",!0),S.type==="boolean"?(a.openBlock(),a.createElementBlock("div",mC,[a.createElementVNode("label",gC,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":D=>S.currentValue=D,type:"checkbox",onChange:D=>y.$emit("save-field",S)},null,40,bC),[[a.vModelCheckbox,S.currentValue]]),a.createElementVNode("span",yC,a.toDisplayString(S.label)+"を表示",1)])])):a.createCommentVNode("",!0),S.type==="image"?(a.openBlock(),a.createElementBlock("div",xC,[a.createElementVNode("div",EC,[a.createElementVNode("button",{class:"zcode-image-select-btn",onClick:D=>m(S)},[a.createVNode(a.unref(Rc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(S.currentValue?y.$t("editPanel.replaceImage"):y.$t("editPanel.selectImage")),1)],8,kC),S.currentValue?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-image-clear-btn",title:y.$t("editPanel.clearImageTitle"),onClick:D=>g(S)},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(y.$t("editPanel.clearImage")),1)],8,wC)):a.createCommentVNode("",!0)]),T(S.currentValue)?(a.openBlock(),a.createElementBlock("div",SC,[a.createElementVNode("img",{src:T(S.currentValue)||"",alt:S.label,class:"zcode-image-preview-img"},null,8,NC)])):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)]))),128))])):!i.value||s.value.length===0?(a.openBlock(),a.createElementBlock("div",CC,[a.createElementVNode("div",vC,a.toDisplayString(y.$t("editPanel.id",{id:t.editingComponent.id})),1),a.createElementVNode("div",TC," Type: "+a.toDisplayString(t.editingComponent.type),1)])):a.createCommentVNode("",!0),a.createVNode(IN,{"is-open":p.value,"images-common":t.imagesCommon,"images-individual":t.imagesIndividual,"images-special":t.imagesSpecial,"current-value":h.value?.currentValue||void 0,"onUpdate:modelValue":x,onAddImage:v,onDeleteImage:w,onClose:b},null,8,["is-open","images-common","images-individual","images-special","current-value"])])):a.createCommentVNode("",!0)}}),_C={class:"zcode-delete-panel-header"},AC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},MC=["aria-label"],IC={key:0,class:"zcode-parent-selector"},OC={class:"zcode-delete-panel-content"},DC={class:"zcode-delete-warning"},RC={class:"zcode-delete-warning-text"},PC={class:"zcode-delete-actions"},LC=a.defineComponent({__name:"DeletePanel",props:{deleteConfirmComponent:{type:[Object,null]},currentMode:{type:String},canSelectParent:{type:Boolean}},emits:["confirm","cancel","select-parent"],setup(t){return(e,n)=>t.deleteConfirmComponent&&t.currentMode==="delete"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-delete-panel",onClick:n[4]||(n[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",_C,[a.createElementVNode("div",AC,a.toDisplayString(e.$t("deletePanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:n[0]||(n[0]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:18})],8,MC)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",IC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:n[1]||(n[1]=o=>e.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("deletePanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",OC,[a.createElementVNode("div",DC,[a.createVNode(a.unref(Vc),{size:20,class:"zcode-delete-warning-icon"}),a.createElementVNode("div",RC,a.toDisplayString(e.$t("deletePanel.confirmMessage")),1)]),a.createElementVNode("div",PC,[a.createElementVNode("button",{class:"zcode-btn-danger",onClick:n[2]||(n[2]=o=>e.$emit("confirm"))},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("common.delete")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel",onClick:n[3]||(n[3]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)}}),$C={class:"zcode-reorder-panel-header"},VC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},BC=["aria-label"],FC={key:0,class:"zcode-parent-selector"},jC={class:"zcode-reorder-panel-content"},UC={class:"zcode-reorder-panel-content-text"},HC={class:"zcode-reorder-source"},WC=a.defineComponent({__name:"ReorderPanel",props:{reorderSourcePath:{type:String},currentMode:{type:String},canSelectParent:{type:Boolean}},emits:["cancel","select-parent"],setup(t){return(e,n)=>t.reorderSourcePath&&t.currentMode==="reorder"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-reorder-panel",onClick:n[2]||(n[2]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",$C,[a.createElementVNode("div",VC,a.toDisplayString(e.$t("reorderPanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:n[0]||(n[0]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:18})],8,BC)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",FC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:n[1]||(n[1]=o=>e.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("reorderPanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",jC,[a.createElementVNode("div",UC,a.toDisplayString(e.$t("reorderPanel.instruction")),1),a.createElementVNode("div",HC,a.toDisplayString(e.$t("reorderPanel.source",{path:t.reorderSourcePath})),1)])])):a.createCommentVNode("",!0)}}),GC={class:"zcode-add-panel-header"},qC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},KC=["aria-label"],JC={key:0,class:"zcode-parent-selector"},XC={class:"zcode-part-category-tabs"},YC=["onClick"],QC={key:1,class:"zcode-type-tabs"},ZC=["onClick"],ev={class:"zcode-add-panel-content"},tv={class:"zcode-part-list"},nv={class:"zcode-part-type-section"},ov={class:"zcode-type-section-title",role:"heading","aria-level":"3"},rv={class:"zcode-type-section-description"},iv={key:0,class:"zcode-module-buttons"},sv={class:"zcode-module-preview-header"},av={class:"zcode-module-preview-label zcode-module-preview-label-header"},lv=["aria-label"],cv=["innerHTML"],dv={key:1,class:"zcode-empty-parts"},uv={class:"zcode-empty-parts-text"},fv={class:"zcode-type-section-title",role:"heading","aria-level":"3"},pv={key:0,class:"zcode-type-section-description"},hv={class:"zcode-module-buttons"},mv=["onClick"],gv={class:"zcode-module-preview-header"},bv={class:"zcode-module-preview-label zcode-module-preview-label-header"},yv=["aria-label","onClick"],xv=["innerHTML"],Ev={key:0,class:"zcode-empty-parts"},kv={class:"zcode-empty-parts-text"},wv={key:2,class:"zcode-insert-position"},Sv={class:"zcode-insert-header"},Nv={class:"zcode-keep-adding-label zcode-keep-adding-label-position"},Cv=["checked"],vv={class:"zcode-insert-buttons"},Tv={class:"zcode-preview-modal-header"},zv={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},_v=["innerHTML"],Av=a.defineComponent({__name:"AddPanel",props:{addTargetPath:{type:[String,null]},addPartCategory:{type:String},addTypeTab:{type:[String,null]},addSelectedPart:{type:[Object,null]},addSelectedType:{type:[Object,null]},clickedComponent:{type:[Object,null]},availablePartTypes:{type:Array},groupedPartsByType:{type:Array},canSelectParent:{type:Boolean},getPartPreviewHtml:{type:Function},getClickedComponentPreviewHtml:{type:Function},keepAdding:{type:Boolean},hasSpecialParts:{type:Boolean},config:{type:Object}},emits:["cancel","select-parent","category-tab-click","type-tab-click","select-part","confirm-add","update-keep-adding"],setup(t){const e=t,n=a.computed(()=>e.config?.categoryOrder||"common"),o=a.computed(()=>{const d=[];return n.value==="individual"?(d.push("individual","common"),e.hasSpecialParts&&d.push("special")):n.value==="special"?(e.hasSpecialParts&&d.push("special"),d.push("common","individual")):(d.push("common","individual"),e.hasSpecialParts&&d.push("special")),d}),r=a.ref(!1),i=a.ref(null);function s(d,u){i.value={type:d,part:u,isActiveParts:!1},r.value=!0}function l(){e.addSelectedType&&e.addSelectedPart&&(i.value={type:e.addSelectedType,part:e.addSelectedPart,isActiveParts:!0},r.value=!0)}function c(){r.value=!1,i.value=null}return(d,u)=>t.addTargetPath?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-add-panel",onClick:u[9]||(u[9]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",GC,[a.createElementVNode("div",qC,a.toDisplayString(d.$t("addPanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":d.$t("common.close"),onClick:u[0]||(u[0]=f=>d.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:18})],8,KC)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",JC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:u[1]||(u[1]=f=>d.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(d.$t("addPanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",XC,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.value,f=>(a.openBlock(),a.createElementBlock("button",{key:f,class:a.normalizeClass([{active:t.addPartCategory===f&&t.addTypeTab!=="selected"},"zcode-category-tab"]),onClick:p=>d.$emit("category-tab-click",f)},a.toDisplayString(f==="common"?d.$t("addPanel.category.common"):f==="individual"?d.$t("addPanel.category.individual"):d.$t("dataViewer.special")),11,YC))),128)),a.createElementVNode("button",{class:a.normalizeClass([{active:t.addTypeTab==="selected"},"zcode-category-tab"]),onClick:u[2]||(u[2]=f=>d.$emit("type-tab-click","selected"))},a.toDisplayString(d.$t("addPanel.category.selected")),3)]),t.availablePartTypes.length>0&&t.addTypeTab!=="selected"?(a.openBlock(),a.createElementBlock("div",QC,[a.createElementVNode("button",{class:a.normalizeClass([{active:t.addTypeTab==="all"},"zcode-type-tab"]),onClick:u[3]||(u[3]=f=>d.$emit("type-tab-click","all"))}," all ",2),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.availablePartTypes,f=>(a.openBlock(),a.createElementBlock("button",{key:f,class:a.normalizeClass([{active:t.addTypeTab===f},"zcode-type-tab"]),onClick:p=>d.$emit("type-tab-click",f)},a.toDisplayString(f),11,ZC))),128))])):a.createCommentVNode("",!0),a.createElementVNode("div",ev,[a.createElementVNode("div",tv,[a.withDirectives(a.createElementVNode("div",nv,[a.createElementVNode("div",ov,a.toDisplayString(d.$t("addPanel.activeParts")),1),a.createElementVNode("div",rv,a.toDisplayString(d.$t("addPanel.activePartsDescription")),1),t.clickedComponent&&t.addSelectedPart&&t.addSelectedType?(a.openBlock(),a.createElementBlock("div",iv,[a.createElementVNode("div",{class:a.normalizeClass([{active:!0},"zcode-module-preview"])},[a.createElementVNode("div",sv,[a.createElementVNode("div",av,a.toDisplayString(d.$t("addPanel.activeParts")),1),a.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:u[4]||(u[4]=a.withModifiers(f=>l(),["stop"]))},[a.createVNode(a.unref(Bc),{size:14})],8,lv)]),a.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:t.getClickedComponentPreviewHtml()},null,8,cv)])])):(a.openBlock(),a.createElementBlock("div",dv,[a.createElementVNode("div",uv,a.toDisplayString(d.$t("addPanel.clickPartInPreview")),1)]))],512),[[a.vShow,t.addTypeTab==="selected"]]),a.withDirectives(a.createElementVNode("div",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.groupedPartsByType,f=>(a.openBlock(),a.createElementBlock("div",{key:f.type,class:"zcode-part-type-section"},[a.createElementVNode("div",fv,a.toDisplayString(f.type),1),f.description?(a.openBlock(),a.createElementBlock("div",pv,a.toDisplayString(f.description),1)):a.createCommentVNode("",!0),a.createElementVNode("div",hv,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(f.parts,p=>(a.openBlock(),a.createElementBlock("div",{key:p.title,class:a.normalizeClass([{active:t.addTypeTab==="selected"&&t.clickedComponent?.part_id===p.id&&t.clickedComponent?.id?!0:t.addTypeTab!=="selected"&&t.addSelectedPart?.id===p.id},"zcode-module-preview"]),onClick:h=>d.$emit("select-part",f.typeData,p)},[a.createElementVNode("div",gv,[a.createElementVNode("div",bv,a.toDisplayString(p.title),1),a.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:a.withModifiers(h=>s(f.typeData,p),["stop"])},[a.createVNode(a.unref(Bc),{size:14})],8,yv)]),a.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:t.getPartPreviewHtml(f.typeData,p)},null,8,xv)],10,mv))),128))])]))),128)),t.groupedPartsByType.length===0&&!t.addSelectedPart?(a.openBlock(),a.createElementBlock("div",Ev,[a.createElementVNode("div",kv,a.toDisplayString(d.$t("addPanel.noPartsAvailable")),1)])):a.createCommentVNode("",!0)],512),[[a.vShow,t.addTypeTab!=="selected"]])])]),t.addSelectedPart?(a.openBlock(),a.createElementBlock("div",wv,[a.createElementVNode("div",Sv,[u[10]||(u[10]=a.createElementVNode("div",{class:"zcode-insert-position-title",role:"heading","aria-level":"4"}," 追加位置を選択 ",-1)),a.createElementVNode("label",Nv,[a.createElementVNode("input",{type:"checkbox",checked:t.keepAdding,class:"zcode-keep-adding-checkbox",onChange:u[5]||(u[5]=f=>d.$emit("update-keep-adding",f.target.checked))},null,40,Cv),a.createElementVNode("span",null,a.toDisplayString(d.$t("addPanel.continueAdding")),1)])]),a.createElementVNode("div",vv,[a.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-before",onClick:u[6]||(u[6]=f=>d.$emit("confirm-add","before"))},a.toDisplayString(d.$t("addPanel.addBefore")),1),a.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-after",onClick:u[7]||(u[7]=f=>d.$emit("confirm-add","after"))},a.toDisplayString(d.$t("addPanel.addAfter")),1)])])):a.createCommentVNode("",!0),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[r.value&&i.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:c},[a.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:u[8]||(u[8]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",Tv,[a.createElementVNode("div",zv,a.toDisplayString(d.$t("common.preview"))+": "+a.toDisplayString(i.value.isActiveParts?d.$t("addPanel.activeParts"):i.value.part.title),1),a.createElementVNode("button",{class:"zcode-close-btn",onClick:c},[a.createVNode(a.unref(Qe),{size:18})])]),a.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:i.value.isActiveParts?t.getClickedComponentPreviewHtml():t.getPartPreviewHtml(i.value.type,i.value.part)},null,8,_v)])])):a.createCommentVNode("",!0)]))])):a.createCommentVNode("",!0)}}),Mv=a.defineComponent({__name:"ContextMenu",props:{isVisible:{type:Boolean},position:{type:Object},currentMode:{type:String}},emits:["select-mode","close"],setup(t,{emit:e}){const n=e;function o(i){n("select-mode",i),n("close")}function r(){n("close")}return(i,s)=>t.isVisible?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-context-menu",style:a.normalizeStyle({left:`${t.position.x}px`,top:`${t.position.y}px`}),onClick:s[4]||(s[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="edit"}]),onClick:s[0]||(s[0]=l=>o("edit"))},[a.createVNode(a.unref(Pc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.edit")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="add"}]),onClick:s[1]||(s[1]=l=>o("add"))},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.add")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="reorder"}]),onClick:s[2]||(s[2]=l=>o("reorder"))},[a.createVNode(a.unref(ir),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.reorder")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="delete"}]),onClick:s[3]||(s[3]=l=>o("delete"))},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.delete")),1)],2),s[5]||(s[5]=a.createElementVNode("div",{class:"zcode-context-menu-divider"},null,-1)),a.createElementVNode("button",{class:"zcode-context-menu-item",onClick:r},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.close")),1)])],4)):a.createCommentVNode("",!0)}});function Iv(t){if(t.defaultValue!==void 0&&t.defaultValue!=="")switch(t.type){case"rich":return`<p>${t.defaultValue}</p>`;case"image":return t.defaultValue;default:return t.defaultValue}switch(t.type){case"text":case"textarea":return"";case"rich":return"<p></p>";case"radio":case"select":return t.options?.[0]||"";case"checkbox":case"select-multiple":return[];case"boolean":return!0;case"image":return"";default:return""}}function Ov(t,e){const n=ha(t.part_id,e);if(!n)return;Fn(n.body).forEach(r=>{r.optional||t[r.fieldName]===void 0&&(t[r.fieldName]=Iv(r))})}function Dv(t){function e(n){Ov(n,t.parts),n.slots&&Object.values(n.slots).forEach(o=>{(Array.isArray(o)?o:o?.children||[]).forEach(i=>{e(i)})})}t.page.forEach(n=>{e(n)})}function km(t){const e=a.reactive({page:[],css:{common:void 0,individual:void 0,special:void 0},parts:{common:[],individual:[],special:[]},images:{common:[],individual:[],special:[]},backendData:void 0});function n(){try{const i=t.page?JSON.parse(t.page):[],s=t.partsCommon?JSON.parse(t.partsCommon):[],l=t.partsIndividual?JSON.parse(t.partsIndividual):[],c=t.partsSpecial?JSON.parse(t.partsSpecial):[],d=t.imagesCommon?JSON.parse(t.imagesCommon):[],u=t.imagesIndividual?JSON.parse(t.imagesIndividual):[],f=t.imagesSpecial?JSON.parse(t.imagesSpecial):[],p=t.cssCommon!==void 0?t.cssCommon:void 0,h=t.cssIndividual!==void 0?t.cssIndividual:void 0,m=t.cssSpecial!==void 0?t.cssSpecial:void 0,b=t.backendData?JSON.parse(t.backendData):void 0;Object.assign(e,{page:i,css:{common:p,individual:h,special:m},parts:{common:s,individual:l,special:c},images:{common:d,individual:u,special:f},backendData:b}),Dv(e)}catch(i){console.error("Failed to parse props:",i)}}function o(i){if(!i)return e;const s=i.split(".");let l=e;for(const c of s)if(l==null||typeof l!="object"||(l=l[c],l===void 0))return;return l}function r(i,s){if(typeof i=="string"){const l=i.split(".");let c=e;for(let d=0;d<l.length-1;d++){const u=c[l[d]];if(u==null||typeof u!="object")return;c=u}c[l[l.length-1]]=s}else Object.assign(e,i)}return{cmsData:e,loadDataFromProps:n,getData:o,setData:r}}function Rv(){const t=a.ref("edit"),e=a.ref(!1);function n(o){t.value=o}return{currentMode:t,switchMode:n,allowDynamicContentInteraction:e}}function wm(t){const e=document.documentElement,o={edit:"--zcode-color-edit",add:"--zcode-color-add",reorder:"--zcode-color-reorder",delete:"--zcode-color-delete"}[t]||"--zcode-color-edit";return getComputedStyle(e).getPropertyValue(o).trim()||"#3b82f6"}function Yt(t,e){const n=wm(e);t.classList.remove("zcode-outline-active-edit","zcode-outline-active-add","zcode-outline-active-reorder","zcode-outline-active-delete"),t.classList.add(`zcode-outline-active-${e}`),t.style.outlineColor=n,t.style.outlineStyle="solid"}function Qt(t){t.style.outline="",t.style.outlineOffset="",t.classList.remove("zcode-outline-active-edit","zcode-outline-active-add","zcode-outline-active-reorder","zcode-outline-active-delete")}function wc(t,e){const n=wm(e);t.style.outline=`2px dashed ${n}`,t.style.outlineOffset="2px"}function yn(t){t.style.outline="",t.style.outlineOffset=""}function Pv(t,e){const n=a.ref(null),o=a.ref(-1),r=a.ref(""),i=a.ref([]);function s(u){const f=u.part_id,p=t.parts,h=[...p.common,...p.individual];let m=null;for(const g of h){const x=g.parts.find(v=>v.id===f);if(x){m=x;break}}return m?Fn(m.body).map(g=>{const x={fieldName:g.fieldName,groupName:g.groupName,label:Pg(g.fieldName),required:g.required,maxLength:g.maxLength,readonly:g.readonly,disabled:g.disabled};if(g.type==="text")return{...x,type:"text",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue};if(g.type==="textarea")return{...x,type:"textarea",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="rich")return{...x,type:"rich",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="radio")return{...x,type:"radio",options:g.options,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.options?.[0]};if(g.type==="boolean")return{...x,type:"boolean",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:!0};if(g.type==="image")return{...x,type:"image",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="select")return{...x,type:"select",options:g.options,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.options?.[0]};if(g.type==="select-multiple")return{...x,type:"select-multiple",options:g.options,optional:g.optional,currentValue:Array.isArray(u[g.fieldName])?u[g.fieldName]:[]};if(g.type==="tag"){const v=["h1","h2","h3","h4","h5","h6","div","p","span","li","ul","ol","section","article","aside","nav","header","footer","main","figure","figcaption","blockquote","pre","code","table","thead","tbody","tr","th","td"],w=g.options||v;return{...x,type:"tag",options:w,defaultValue:g.defaultValue||"div",currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.defaultValue||"div"}}else return{...x,type:"checkbox",options:g.options,optional:g.optional,currentValue:Array.isArray(u[g.fieldName])?u[g.fieldName]:[]}}):[]}function l(u,f){if(r.value===u){d();return}const p=u.split(".");let h=-1;if(p[0]==="page"&&p.length>=2&&(h=parseInt(p[1])),r.value&&e.value){const m=e.value.querySelector(`[data-zcode-path="${r.value}"]`);m&&Qt(m)}n.value=f,o.value=h,r.value=u,i.value=s(f),a.nextTick(()=>{if(e.value&&r.value===u){const m=e.value.querySelector(`[data-zcode-path="${u}"]`);m&&(Yt(m,"edit"),ar(m))}})}function c(u){if(n.value&&r.value){const f=dn(r.value,t);f&&(u.optional&&(u.currentValue===""||u.currentValue===null)?f[u.fieldName]=void 0:f[u.fieldName]=u.currentValue)}}function d(){if(r.value&&e.value){const u=e.value.querySelector(`[data-zcode-path="${r.value}"]`);u&&Qt(u)}n.value=null,r.value="",i.value=[]}return{editingComponent:n,editingComponentIndex:o,editingComponentPath:r,editingAvailableFields:i,handleEditClick:l,saveFieldEdit:c,closeEditPanel:d}}function Lv(t,e,n,o){const r=a.ref(null),i=a.ref(null),s=a.ref(null),l=a.ref(o?.categoryOrder==="individual"?"individual":o?.categoryOrder==="special"?"special":"common"),c=a.ref("all"),d=a.ref(null),u=a.ref(!1);function f(z){if(z.includes(".slots.")){const P=z.split(".");let V=-1;for(let j=P.length-1;j>=0;j--)if(P[j]==="slots"){V=j;break}if(V!==-1&&V+1<P.length)return P.slice(0,V+2).join(".")}return z}const p=a.computed(()=>{const z=t.parts,P=l.value==="common"?z.common:l.value==="individual"?z.individual:z.special;if(r.value&&r.value.includes(".slots.")){const j=[...z.common,...z.individual,...z.special],L=f(r.value);return b(L,j,P)}return[...new Set(P.map(j=>j.type))]});function h(z,P){const V=z.split(".");let j=-1;for(let J=V.length-1;J>=0;J--)if(V[J]==="slots"){j=J;break}if(j===-1)return null;const L=V.slice(0,j).join("."),H=V[j+1],Q=dn(L,t);if(!Q)return null;const G=Q.part_id;let se=null;for(const J of P)if(J.parts.some(K=>K.id===G)){se=J;break}if(!se)return null;const X=(se.parts.find(J=>J.id===G)||se.parts[0])?.slots?.[H];if(X){const J=X.allowedParts;if(J&&Array.isArray(J))return J}return null}const m=a.computed(()=>{const z=t.parts,P=l.value==="common"?z.common:l.value==="individual"?z.individual:z.special,V=p.value;let j=P.filter(G=>V.includes(G.type));c.value&&c.value!=="all"&&c.value!=="selected"&&(j=j.filter(G=>G.type===c.value));const L=[...z.common,...z.individual],H=r.value&&r.value.includes(".slots.")?h(f(r.value),L):null,Q=new Map;return j.forEach(G=>{Q.has(G.type)||Q.set(G.type,{type:G,parts:[]});const se=Q.get(G.type);H!==null?H.length>0&&G.parts.forEach(Z=>{H.includes(Z.id)&&se.parts.push(Z)}):G.parts.forEach(Z=>{Z.slotOnly||se.parts.push(Z)})}),Array.from(Q.values()).map(G=>({type:G.type.type,description:G.type.description,typeData:G.type,parts:G.parts}))});function b(z,P,V){const j=z.split(".");let L=-1;for(let K=j.length-1;K>=0;K--)if(j[K]==="slots"){L=K;break}if(L===-1)return[...new Set(V.map(K=>K.type))];const H=j.slice(0,L).join("."),Q=j[L+1],G=dn(H,t);if(!G)return[...new Set(V.map(K=>K.type))];const se=G.part_id;let Z=null,X=null;for(const K of P){const Y=K.parts.find(ce=>ce.id===se);if(Y){Z=K,X=Y;break}}if(!Z||!X)return[...new Set(V.map(K=>K.type))];const J=X?.slots?.[Q];if(J){const K=J.allowedParts;if(K&&Array.isArray(K)){const Y=new Set;P.forEach(Ee=>{Ee.parts.forEach(_e=>{K.includes(_e.id)&&Y.add(Ee.type)})});let ce=Array.from(Y);return ce=ce.filter(Ee=>V.some(_e=>_e.type===Ee)),ce}}return[...new Set(V.map(K=>K.type))]}function g(z,P=!1){if(r.value===z){D();return}if(r.value&&e.value){const ce=e.value.querySelector(`[data-zcode-path="${r.value}"]`);ce&&Qt(ce);const Ee=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);Ee&&Qt(Ee)}r.value=z,c.value="all",l.value="common",i.value=null,s.value=null;const V=dn(z,t);V&&V.part_id?d.value=V:d.value=null;const j=t.parts,L=j.common,H=j.individual,Q=j.special;let G=[],se=[];if(z.includes(".slots.")){const ce=[...L,...H,...Q],Ee=f(z);G=b(Ee,ce,L),se=b(Ee,ce,H)}else G=[...new Set(L.map(ce=>ce.type))],se=[...new Set(H.map(ce=>ce.type))];const Z=G.length>0,X=se.length>0,J=Q.length>0,K=o?.categoryOrder;let Y;K==="special"&&J?Y="special":K==="individual"&&X?Y="individual":K==="common"&&Z||Z?Y="common":X?Y="individual":J?Y="special":Y="common",l.value=Y,a.nextTick(()=>{if(e.value&&r.value===z){const ce=e.value.querySelector(`[data-zcode-path="${z}"]`);if(ce)Yt(ce,"add"),ar(ce);else{const Ee=f(z);if(Ee!==z){const _e=e.value.querySelector(`[data-zcode-slot-path="${Ee}"]`);_e&&(Yt(_e,"add"),ar(_e))}}}})}function x(z){l.value=z,c.value="all",i.value=null,s.value=null,u.value=!1}function v(z){if(c.value=z,z==="selected"&&d.value&&d.value.part_id){const P=t.parts,V=[...P.common,...P.individual,...P.special];for(const j of V){const L=j.parts.find(H=>H.id===d.value.part_id);if(L){i.value=j,s.value=L;break}}}else z!=="selected"&&(i.value=null,s.value=null);u.value=!1}function w(z,P){const V=M(z,P);return n(V,"")}function T(){return d.value?n(d.value,""):""}function M(z,P){const V=y(z,!1,new Set,P.id);return V.id="preview",V}function A(z,P){if(s.value?.id===P.id){i.value=null,s.value=null;return}i.value=z,s.value=P,c.value==="selected"&&(c.value="all"),u.value=!1}function y(z,P=!1,V=new Set,j){const L=j?z.parts.find(X=>X.id===j)||z.parts[0]:P&&s.value?s.value:z.parts[0];if(!L)throw new Error(`Part not found for type: ${z.type}`);const H=`${z.id}:${L.id}`;if(V.has(H)){const X=Fn(L.body),J={};return X.forEach(K=>{K.optional?J[K.fieldName]=void 0:K.type==="text"?J[K.fieldName]=K.defaultValue:K.type==="radio"?J[K.fieldName]=K.options?.[0]:K.type==="checkbox"?J[K.fieldName]=[]:K.type==="boolean"?J[K.fieldName]=!0:K.type==="rich"?J[K.fieldName]=K.defaultValue?`<p>${K.defaultValue}</p>`:"<p></p>":K.type==="image"&&(J[K.fieldName]=K.defaultValue||"")}),{id:jn(),part_id:L.id,...J}}V.add(H);const Q=Fn(L.body),G={};Q.forEach(X=>{X.optional?G[X.fieldName]=void 0:X.type==="text"?G[X.fieldName]=X.defaultValue:X.type==="radio"?G[X.fieldName]=X.options?.[0]:X.type==="checkbox"?G[X.fieldName]=[]:X.type==="boolean"?G[X.fieldName]=!0:X.type==="rich"?G[X.fieldName]=X.defaultValue?`<p>${X.defaultValue}</p>`:"<p></p>":X.type==="image"&&(G[X.fieldName]=X.defaultValue||"")});const se={id:jn(),part_id:L.id,...G},Z=L.slots;if(Z){const X={};Object.entries(Z).forEach(([J,K])=>{const Y=K.allowedParts;if(Y&&Y.length===1){const ce=Y[0],Ee=t.parts,_e=[...Ee.common,...Ee.individual,...Ee.special];let Le=null,C=null;for(const N of _e){const O=N.parts.find(k=>k.id===ce);if(O){Le=N,C=O;break}}if(Le&&C){const N=y(Le,!1,V,C.id);X[J]=[N]}else X[J]=[]}else X[J]=[]}),Object.keys(X).length>0&&(se.slots=X)}return se}function E(z){return y(z,!0)}function S(z){if(!i.value||!s.value||!r.value){console.error("Missing required values:",{addSelectedType:i.value,addSelectedPart:s.value,addTargetPath:r.value});return}let P;if(c.value==="selected"&&d.value){if(P=JSON.parse(JSON.stringify(d.value)),P.id=jn(),P.slots){const L=H=>{H.forEach(Q=>{Q.id=jn(),Q.slots&&Object.values(Q.slots).forEach(G=>{Array.isArray(G)?L(G):G&&typeof G=="object"&&G.children&&L(G.children||[])})})};Object.values(P.slots).forEach(H=>{Array.isArray(H)?L(H):H&&typeof H=="object"&&H.children&&L(H.children||[])})}}else P=E(i.value);const V=r.value,j=V.split(".");if(j[0]==="page"&&j.length===2){const L=parseInt(j[1]);z==="before"?(t.page.splice(L,0,P),u.value&&(r.value=`page.${L+1}`)):t.page.splice(L+1,0,P)}else if(j.includes("slots")){const L=f(V),H=L.split(".");let Q=-1;for(let Y=H.length-1;Y>=0;Y--)if(H[Y]==="slots"){Q=Y;break}if(Q===-1||Q>=H.length-1){console.error("Invalid slot path:",L);return}const G=H.slice(0,Q).join("."),se=H[Q+1],Z=V!==L?parseInt(j[j.length-1]):-1,X=dn(G,t);if(!X){console.error("Parent component not found:",G);return}X.slots||(X.slots={});const J=X.slots[se];let K=[];if(Array.isArray(J)?K=J:J&&typeof J=="object"&&J.children?(K=J.children||[],J.children||(J.children=[])):(X.slots[se]=[],K=X.slots[se]),Z===-1)K.push(P);else if(z==="before"){if(K.splice(Z,0,P),u.value){const Y=f(V);if(V!==Y){const ce=[...j];ce[ce.length-1]=String(Z+1),r.value=ce.join(".")}else{const Ee=[...Y.split(".")];Ee.push("0"),r.value=Ee.join(".")}}}else K.splice(Z+1,0,P);Array.isArray(X.slots[se])||(X.slots[se].children=K)}if(d.value||c.value==="selected"&&(c.value="all"),!u.value)D();else if(z==="before"&&e.value&&r.value){const L=e.value.querySelector(`[data-zcode-path="${V}"]`);L&&Qt(L),a.nextTick(()=>{if(e.value&&r.value){const H=e.value.querySelector(`[data-zcode-path="${r.value}"]`);H&&Yt(H,"add")}})}}function D(){if(r.value&&e.value){const z=e.value.querySelector(`[data-zcode-path="${r.value}"]`);z&&Qt(z);const P=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);P&&Qt(P)}r.value=null,i.value=null,s.value=null,d.value=null,l.value="common",c.value="all",u.value=!1}const W=a.computed(()=>t.parts.special.length>0);return{addTargetPath:r,addSelectedType:i,addSelectedPart:s,clickedComponent:d,addPartCategory:l,addTypeTab:c,keepAdding:u,availablePartTypes:p,groupedPartsByType:m,hasSpecialParts:W,handleAddClick:g,handleCategoryTabClick:x,handleTypeTabClick:v,selectPart:A,getPartPreviewHtml:w,getClickedComponentPreviewHtml:T,confirmAddPart:S,cancelAdd:D}}function $v(t,e,n,o){const r=a.ref(null),i=a.ref("");function s(f,p){if(i.value===f){u();return}if(i.value&&e.value){const h=e.value.querySelector(`[data-zcode-path="${i.value}"]`);h&&Qt(h)}r.value=p,i.value=f,o(()=>{if(e.value&&i.value===f){const h=e.value.querySelector(`[data-zcode-path="${f}"]`);h&&(Yt(h,"delete"),ar(h))}})}function l(){if(!i.value)return;const f=i.value,p=f.split(".");let h=null,m=null;if(p.length===2&&p[0]==="page"){const b=parseInt(p[1]);!isNaN(b)&&b>=0&&b<t.page.length&&(t.page.splice(b,1),t.page.length===0&&o(()=>{n("add")}))}else if(p.length>2&&p[0]==="page"){const b=parseInt(p[1]);if(isNaN(b)||b<0||b>=t.page.length){console.error("Invalid top-level index:",b),u();return}let g=t.page[b];const x=p.slice(2);x.length>=3&&x[0]==="slots"&&(m=x[1],h=`page.${b}`);for(let w=0;w<x.length-1;w++){if(!g||typeof g!="object"){console.error("Invalid path:",f),u();return}g=g[x[w]]}const v=x[x.length-1];if(g&&typeof g=="object")if(Array.isArray(g)){const w=parseInt(v);!isNaN(w)&&w>=0&&w<g.length?g.splice(w,1):console.error("Invalid array index:",v)}else v in g?delete g[v]:console.error("Field not found:",f);else console.error("Invalid current object:",f)}h&&m&&o(()=>{c(h,m)}),u()}function c(f,p){const h=dn(f,t);if(!h)return;const m=h.slots;if(!m||!Array.isArray(m[p]))return;const b=m[p];if(b.length===0){const g=h.part_id,x=t.parts,v=[...x.common,...x.individual];let w=null,T=null;for(const A of v){const y=A.parts.find(E=>E.id===g);if(y){w=A,T=y;break}}if(!w||!T)return;const M=T?.slots?.[p];if(M){const A=M.allowedParts;if(A&&A.length===1){const y=A[0];let E=null,S=null;for(const D of v){const W=D.parts.find(z=>z.id===y);if(W){E=D,S=W;break}}if(E&&S){const D=d(E,S.id);b.push(D)}}}}}function d(f,p){const h=p&&f.parts.find(v=>v.id===p)||f.parts[0];if(!h)throw new Error(`Part not found for type: ${f.type}`);const m=Fn(h.body),b={};m.forEach(v=>{v.optional?b[v.fieldName]=void 0:v.type==="text"?b[v.fieldName]=v.defaultValue:v.type==="radio"?b[v.fieldName]=v.options?.[0]:v.type==="checkbox"?b[v.fieldName]=[]:v.type==="boolean"?b[v.fieldName]=!0:v.type==="rich"?b[v.fieldName]=v.defaultValue?`<p>${v.defaultValue}</p>`:"<p></p>":v.type==="image"&&(b[v.fieldName]=v.defaultValue||"")});const g={id:jn(),part_id:h.id,...b},x=h.slots;if(x){const v={};Object.entries(x).forEach(([w,T])=>{const M=T.allowedParts;if(M&&M.length===1){const A=M[0],y=t.parts,E=[...y.common,...y.individual];let S=null,D=null;for(const W of E){const z=W.parts.find(P=>P.id===A);if(z){S=W,D=z;break}}if(S&&D){const W=d(S,D.id);v[w]=[W]}else v[w]=[]}else v[w]=[]}),Object.keys(v).length>0&&(g.slots=v)}return g}function u(){if(i.value&&e.value){const f=e.value.querySelector(`[data-zcode-path="${i.value}"]`);f&&Qt(f)}r.value=null,i.value=""}return{deleteConfirmComponent:r,deleteConfirmPath:i,handleDeleteClick:s,confirmDelete:l,cancelDelete:u}}function Vv(t,e){const n=a.ref("");function o(l,c){if(!l||!c)return!1;const d=l.split("."),u=c.split(".");if(d.length!==u.length||l===c)return!1;if(d.includes("slots")&&u.includes("slots")){let f=-1,p=-1;for(let x=d.length-1;x>=0;x--)if(d[x]==="slots"){f=x;break}for(let x=u.length-1;x>=0;x--)if(u[x]==="slots"){p=x;break}if(f===-1||p===-1)return!1;const h=d.slice(0,f).join("."),m=u.slice(0,p).join(".");if(h!==m)return!1;const b=d[f+1],g=u[p+1];return b===g}if(d.length>2){const f=d.slice(0,-1).join("."),p=u.slice(0,-1).join(".");if(f!==p)return!1}return!0}function r(l){if(!l)return;if(!n.value){const d=od(l);if(d&&e.value){const u=e.value.querySelector(`[data-zcode-path="${d}"]`);u&&yn(u)}if(n.value=l,e.value){const u=e.value.querySelector(`[data-zcode-path="${l}"]`);u&&(Yt(u,"reorder"),ar(u))}return}if(n.value===l){i();return}if(!o(n.value,l)){alert("この要素とは並べ替えできません。同じ階層の要素を選択してください。"),i();return}s(n.value,l)||alert("並べ替えに失敗しました。同じ階層の要素を選択してください。"),i()}function i(){if(n.value&&e.value){const l=e.value.querySelector(`[data-zcode-path="${n.value}"]`);l&&Qt(l)}n.value=""}function s(l,c){const d=l.split("."),u=c.split(".");if(d.length===2&&u.length===2&&d[0]==="page"&&u[0]==="page"){const f=parseInt(d[1]),p=parseInt(u[1]);if(!isNaN(f)&&!isNaN(p)&&f!==p){const h=[...t.page],[m]=h.splice(f,1);return h.splice(p,0,m),t.page=h,!0}return!1}else if(d.includes("slots")&&u.includes("slots")){let f=-1,p=-1;for(let y=d.length-1;y>=0;y--)if(d[y]==="slots"){f=y;break}for(let y=u.length-1;y>=0;y--)if(u[y]==="slots"){p=y;break}if(f===-1||p===-1)return!1;const h=d.slice(0,f).join("."),m=u.slice(0,p).join(".");if(h!==m)return!1;const b=d[f+1],g=u[p+1];if(b!==g)return!1;const x=parseInt(d[d.length-1]),v=parseInt(u[u.length-1]);if(isNaN(x)||isNaN(v)||x===v)return!1;const w=dn(h,t);if(!w||!w.slots||!w.slots[b])return!1;const T=w.slots[b];let M=[];if(Array.isArray(T))M=T;else if(T&&typeof T=="object"&&T.children)M=T.children||[];else return!1;const[A]=M.splice(x,1);return M.splice(v,0,A),!Array.isArray(T)&&typeof T=="object"&&T.children&&(T.children=M),!0}else if(d.length>2&&u.length>2){const f=d.slice(0,-1).join("."),p=u.slice(0,-1).join(".");if(f===p){const h=parseInt(d[d.length-1]),m=parseInt(u[u.length-1]);if(!isNaN(h)&&!isNaN(m)&&h!==m){const b=parseInt(d[1]);let g=t.page[b];for(let x=2;x<d.length-1;x++)g=g[d[x]];if(Array.isArray(g)){const[x]=g.splice(h,1);return g.splice(m,0,x),!0}}}}return!1}return{reorderSourcePath:n,handleReorderClick:r,canReorderWith:o,cancelReorder:i}}function Bv(t,e,n,o,r,i,s,l,c){const d=a.computed(()=>o.value?od(o.value):null),u=a.computed(()=>{if(!d.value)return!1;const p=dn(d.value,t);return p!=null});function f(){if(!d.value)return;const p=d.value;if(!e.value||!e.value.querySelector(`[data-zcode-path="${p}"]`))return;const m=dn(p,t);if(m){if(o.value&&e.value){const b=e.value.querySelector(`[data-zcode-path="${o.value}"]`);b&&yn(b)}switch(n.value){case"edit":r(p,m);break;case"add":i(p,!0);break;case"reorder":if(c.value){const b=e.value.querySelector(`[data-zcode-path="${c.value}"]`);b&&Qt(b),c.value=""}s(p);break;case"delete":l(p,m);break}}}return{parentPath:d,canSelectParent:u,selectParentElement:f}}function Fv(t,e,n,o,r,i,s,l,c,d,u,f,p,h){const m=new Map;function b(){if(!e.value)return;g();const x=e.value.querySelectorAll("[data-zcode-id]"),v=y=>{const E=y.target;if(!E)return;const S=E.closest("[data-zcode-add-slot]");if(!S)return;const D=S.closest("[data-zcode-slot-path]"),W=D?.getAttribute("data-zcode-slot-path");if(!W)return;y.preventDefault(),y.stopPropagation(),y.stopImmediatePropagation();const z=()=>{const P=e.value?.querySelector(`[data-zcode-slot-path="${W}"]`);P&&(yn(P),Yt(P,"add"))};if(D&&yn(D),n.value!=="add"){p("add"),a.nextTick(()=>{c(W),a.nextTick(()=>{z()})});return}z(),a.nextTick(()=>{c(W),a.nextTick(()=>{z()})})};let w=null;const T=y=>o.value===y||r.value===y||i.value===y||s.value===y,M=y=>{const S=y.target;if(!S)return;const D=S.closest("[data-zcode-slot-path]");if(!D){if(w){const z=w.getAttribute("data-zcode-slot-path")||"";(!z||!T(z))&&yn(w),w=null}return}if(w===D)return;if(w){const z=w.getAttribute("data-zcode-slot-path")||"";(!z||!T(z))&&yn(w)}w=D;const W=D.getAttribute("data-zcode-slot-path")||"";W&&!T(W)&&wc(D,n.value)},A=y=>{const E=y,S=E.target;if(!S)return;const D=E.relatedTarget,W=S.closest("[data-zcode-slot-path]");if(!W||D&&W.contains(D))return;const z=W.getAttribute("data-zcode-slot-path")||"";(!z||!T(z))&&yn(W),w===W&&(w=null)};e.value.addEventListener("click",v,!0),e.value.addEventListener("mouseover",M,!0),e.value.addEventListener("mouseout",A,!0),m.set(e.value,[{type:"click",listener:v,options:!0},{type:"mouseover",listener:M,options:!0},{type:"mouseout",listener:A,options:!0}]),x.forEach(y=>{const E=y,S=E.getAttribute("data-zcode-path");if(!S)return;const D=V=>{const j=V.target,H=j?.closest("[data-zcode-path]")?.getAttribute("data-zcode-path");if(H&&H!==S)return;j?.closest("a[href]")&&(h.value||V.preventDefault()),h.value||(V.stopPropagation(),V.stopImmediatePropagation());const G=dn(S,t);if(G)switch(yn(E),n.value){case"edit":l(S,G);break;case"add":c(S);break;case"reorder":if(i.value){const se=i.value.split("."),Z=S.split(".");if(se.length!==Z.length&&se.indexOf("rows")!==-1){const J=Z.indexOf("cells");if(J!==-1){let K=-1;for(let Y=J-1;Y>=0;Y--)if(Z[Y]==="slots"){K=Y;break}if(K!==-1){const Y=Z.slice(0,K).join(".");if(Y&&f(i.value,Y)){d(Y);return}}}}}d(S);break;case"delete":u(S,G);break}},W=V=>{if(o.value===V||r.value===V||i.value===V||s.value===V)return!0;if(V.includes(".slots.")){const L=V.split(".");let H=-1;for(let Q=L.length-1;Q>=0;Q--)if(L[Q]==="slots"){H=Q;break}if(H!==-1&&H+1<L.length){const Q=L.slice(0,H+2).join(".");return r.value===Q||o.value===Q||i.value===Q||s.value===Q}}return!1},z=()=>{W(S)||(n.value==="reorder"&&i.value?f(i.value,S)&&wc(E,n.value):wc(E,n.value)),n.value==="reorder"?E.style.cursor=i.value&&f(i.value,S)?"move":i.value?"not-allowed":"move":E.style.cursor="pointer"},P=()=>{W(S)||yn(E),E.style.cursor=""};E.addEventListener("click",D,!0),E.addEventListener("mouseenter",z),E.addEventListener("mouseleave",P),m.set(E,[{type:"click",listener:D,options:!0},{type:"mouseenter",listener:z},{type:"mouseleave",listener:P}])}),a.nextTick(()=>{a.nextTick(()=>{if(n.value==="edit"&&o.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${o.value}"]`);y&&Yt(y,"edit")}if(n.value==="add"&&r.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${r.value}"]`);if(y)Yt(y,"add");else{const E=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);E&&Yt(E,"add")}}if(n.value==="reorder"&&i.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${i.value}"]`);y&&Yt(y,"reorder")}if(n.value==="delete"&&s.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${s.value}"]`);y&&Yt(y,"delete")}})})}function g(){m.forEach((x,v)=>{x.forEach(({type:w,listener:T,options:M})=>{v.removeEventListener(w,T,M)})}),m.clear()}return{setupClickHandlers:b,cleanupEventListeners:g}}function jv(t,e,n,o,r,i,s,l,c,d,u,f,p){function h(m){t.value&&t.value.querySelectorAll("[data-zcode-path], [data-zcode-slot-path]").forEach(g=>{Qt(g),yn(g)}),e.value==="edit"&&o.value?(l.value=null,o.value=""):e.value==="add"&&r.value?(r.value=null,c.value=null,d.value=null,u.value="common",f.value=null):e.value==="reorder"&&i.value?i.value="":e.value==="delete"&&s.value&&p(),n(m)}return{switchMode:h}}function Uv(t,e,n){const o=a.ref(!1),r=a.ref({x:0,y:0});function i(p){!e.value||!t.value||!p.target.closest("[data-zcode-path]")||(p.preventDefault(),p.stopPropagation(),r.value={x:p.clientX,y:p.clientY},o.value=!0)}function s(p){n(p),o.value=!1}function l(){o.value=!1}function c(p){p.target.closest(".zcode-context-menu")||l()}function d(p){p.target.closest(".zcode-context-menu")||l()}function u(){!t.value||!e.value||(t.value.addEventListener("contextmenu",i),document.addEventListener("click",c),document.addEventListener("contextmenu",d))}function f(){t.value&&(t.value.removeEventListener("contextmenu",i),document.removeEventListener("click",c),document.removeEventListener("contextmenu",d))}return{isVisible:o,position:r,handleModeSelect:s,closeMenu:l,setupContextMenu:u,cleanupContextMenu:f}}function Hv(t){const e=t;if(!e||!e.page||!Array.isArray(e.page))return!1;for(const n of e.page)if(!n.id||!n.part_id)return!1;return!0}function Sc(t,e){const n=[],o=(r,i)=>{Object.keys(r).forEach(s=>{s.includes("image")&&r[s]===t&&n.push({path:i,component:r,fieldName:s})}),r.slots&&Object.entries(r.slots).forEach(([s,l])=>{Array.isArray(l)&&l.forEach((c,d)=>{o(c,`${i}.slots.${s}.${d}`)})})};return e.forEach((r,i)=>{o(r,`page.${i}`)}),n}const Wv={key:0,class:"zcode-save-banner zcode-save-banner--error",role:"alert"},Gv={class:"zcode-save-banner-text"},qv=["aria-label"],Kv={key:1,class:"zcode-save-controls-fixed"},Jv={class:"zcode-save-confirm-dialog"},Xv={class:"zcode-save-confirm-dialog-header"},Yv={class:"zcode-save-confirm-dialog-title"},Qv={class:"zcode-save-confirm-dialog-body"},Zv={class:"zcode-save-confirm-dialog-footer"},Hs=a.defineComponent({__name:"ZeroCodeCMS",props:{locale:{type:String},page:{type:String},cssCommon:{type:String},cssIndividual:{type:String},cssSpecial:{type:String},partsCommon:{type:String},partsIndividual:{type:String},partsSpecial:{type:String},imagesCommon:{type:String},imagesIndividual:{type:String},imagesSpecial:{type:String},config:{type:String},endpoints:{type:String},backendData:{type:String}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.ref("manage"),i=a.ref(!1),l=(le=>{if(!le)return{};try{return JSON.parse(le)}catch(de){return console.warn("[ZeroCodeCMS] Failed to parse config:",de),{}}})(o.config),c=(le,de,be)=>{const Ge=Au();return Ge[le]!==void 0?Ge[le]:be!==void 0?be:de},d=a.ref(c("devRightPadding",!1,l.cms?.devRightPadding)),u=a.ref(c("enableContextMenu",!1,l.cms?.enableContextMenu)),f=a.ref(c("showSaveConfirm",!0,l.cms?.showSaveConfirm)),p=a.computed(()=>d.value),h=a.ref(!1),{cmsData:m,loadDataFromProps:b,getData:g,setData:x}=km(o),{fullPageHtml:v,renderComponentToHtml:w}=fi(m,!0);function T(le){if(le!=="css")return le?g(le):g()}const M=a.ref(null),A=a.ref(null),y=a.computed(()=>A.value?.previewArea||null),{currentMode:E,switchMode:S,allowDynamicContentInteraction:D}=Rv(),W=c("allowDynamicContentInteraction",!1,l.cms?.allowDynamicContentInteraction),z=a.ref(W);D.value=W;let P=!1;a.watch(r,(le,de)=>{le==="preview"?(P=z.value,z.value=!0,D.value=!0,a.nextTick(()=>{st()})):de==="preview"&&(z.value=P,D.value=P,a.nextTick(()=>{st()})),Ln("view-mode-changed",{mode:le,previousMode:de})});const{editingComponent:V,editingComponentPath:j,editingAvailableFields:L,handleEditClick:H,saveFieldEdit:Q,closeEditPanel:G}=Pv(m,y),se=a.ref({}),Z=a.ref([]),X=a.ref({visible:!1,message:""});function J(le){if(le?.fieldName&&se.value[le.fieldName]){const de={...se.value};delete de[le.fieldName],se.value=de}Q(le)}const{addTargetPath:K,addSelectedType:Y,addSelectedPart:ce,clickedComponent:Ee,addPartCategory:_e,addTypeTab:Le,keepAdding:C,availablePartTypes:N,groupedPartsByType:O,hasSpecialParts:k,handleAddClick:U,handleCategoryTabClick:te,handleTypeTabClick:me,selectPart:ve,getPartPreviewHtml:Ve,getClickedComponentPreviewHtml:Ce,confirmAddPart:_,cancelAdd:I}=Lv(m,y,w,l),{reorderSourcePath:q,handleReorderClick:fe,canReorderWith:Ae,cancelReorder:Te}=Vv(m,y),{deleteConfirmComponent:we,deleteConfirmPath:B,handleDeleteClick:ee,confirmDelete:Me,cancelDelete:$}=$v(m,y,S,a.nextTick),{switchMode:F}=jv(y,E,S,j,K,q,B,V,Y,ce,_e,Le,$),re=a.computed(()=>E.value==="edit"&&j.value?j.value:E.value==="add"&&K.value?K.value:E.value==="reorder"&&q.value?q.value:E.value==="delete"&&B.value?B.value:null),{canSelectParent:ae,selectParentElement:ke}=Bv(m,y,E,re,H,U,fe,ee,q),Fe=a.computed(()=>!!(V.value||K.value||q.value||we.value)),st=()=>{if(y.value){const le=y.value.getRootNode();if(le instanceof ShadowRoot){let Ge=0;const et=()=>{Ge++;const At=le;if(typeof At.__zcmsSetAllowDynamicContentInteraction=="function"){At.__zcmsSetAllowDynamicContentInteraction(z.value);return}Ge<30&&setTimeout(et,50)};et()}}},{setupClickHandlers:xn,cleanupEventListeners:oi}=Fv(m,y,E,j,K,q,B,H,U,fe,ee,Ae,F,z),{isVisible:Tc,position:Zo,handleModeSelect:er,closeMenu:zc,setupContextMenu:Pn,cleanupContextMenu:ri}=Uv(y,u,F);function Ln(le,de){const be=En();if(be){const et=new CustomEvent(le,{detail:de,bubbles:!0,composed:!0});be.dispatchEvent(et);return}const Ge=new CustomEvent(le,{detail:de,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(Ge)}function Ze(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function En(){if(M.value){const de=M.value.getRootNode();if(de instanceof ShadowRoot&&de.host)return de.host;const be=M.value.closest?.("zcode-cms")||M.value.closest?.("zcode-editor");if(be)return be}const le=a.getCurrentInstance();if(le){const de=le.vnode.el;if(de instanceof HTMLElement){const be=de.getRootNode();if(be instanceof ShadowRoot&&be.host)return be.host;const Ge=de.closest?.("zcode-cms")||de.closest?.("zcode-editor");return Ge||null}if(de instanceof Node){const be=de.getRootNode();if(be instanceof ShadowRoot&&be.host)return be.host}}return null}function Xs(le){return typeof le=="object"&&le!==null}function Ys(le){return Array.isArray(le)?le.filter(de=>Xs(de)).map(de=>({path:typeof de.path=="string"?de.path:void 0,field:typeof de.field=="string"?de.field:void 0,message:typeof de.message=="string"?de.message:void 0,code:typeof de.code=="string"?de.code:void 0})):[]}function tr(le){if(!le){se.value={};return}const de={};for(const be of Z.value){const Ge=typeof be?.path=="string"?be.path:null,et=typeof be?.field=="string"?be.field:null,At=typeof be?.message=="string"?be.message:null;!et||!At||Ge&&Ge!==le||(de[et]=At)}se.value=de}const Qs=(le,de)=>{de==="common"?m.images.common.push(le):de==="individual"?m.images.individual.push(le):m.images.special.push(le)},Zs=le=>{Sc(le,m.page).forEach(et=>{Object.keys(et.component).forEach(At=>{At.includes("image")&&et.component[At]===le&&(et.component[At]="")})});const be=m.images.common.findIndex(et=>et.id===le);be!==-1&&m.images.common.splice(be,1);const Ge=m.images.individual.findIndex(et=>et.id===le);Ge!==-1&&m.images.individual.splice(Ge,1)};function ea(le){const de=le.detail;if(!Xs(de))return;const be=de;if(be.ok===!0){X.value.visible=!1,X.value.message="",Z.value=[],se.value={};return}if(be.ok!==!1)return;const Ge=Ys(be.errors);Z.value=Ge;const et=Ge.length,At=typeof Ge[0]?.message=="string"&&Ge[0].message?Ge[0].message:null;X.value.visible=!0,X.value.requestId=typeof be.requestId=="string"?be.requestId:void 0,X.value.target=typeof be.target=="string"?be.target:void 0,X.value.message=At?n("editor.saveFailedWithMessage",{count:et,message:At}):n("editor.saveFailedWithCount",{count:et}),tr(j.value||null)}a.onMounted(()=>{b(),a.nextTick(()=>{xn(),u.value&&Pn(),st(),Ln("zcode-dom-updated",{})});const le=En();le&&le.addEventListener("save-result",ea)}),a.onUnmounted(()=>{oi(),ri();const le=En();le&&le.removeEventListener("save-result",ea)}),a.watch(()=>j.value,le=>{tr(le||null)}),a.watch([()=>o.page,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial],()=>{b()}),a.watch(m,()=>{a.nextTick(()=>{xn(),Ln("zcode-dom-updated",{})})},{deep:!0}),a.watch([r,y],([le,de])=>{le==="manage"&&de?a.nextTick(()=>{xn(),u.value&&Pn(),st(),Ln("zcode-dom-updated",{})}):ri()}),a.watch(E,()=>{a.nextTick(()=>{Ln("zcode-dom-updated",{})})}),a.watch(d,le=>{vi({devRightPadding:le})}),a.watch(z,le=>{r.value==="manage"&&vi({allowDynamicContentInteraction:le}),D.value=le,a.nextTick(()=>{xn(),st(),Ln("zcode-dom-updated",{})})}),a.watch(u,le=>{vi({enableContextMenu:le}),le?a.nextTick(()=>{Pn()}):ri()}),a.watch(f,le=>{vi({showSaveConfirm:le})});function Zt(){if(!f.value){kn();return}h.value=!0}function kn(){const le=Ze();Ln("save-request",{requestId:le,source:"cms",targets:["page","images-common","images-individual"],timestamp:Date.now()})}function ta(){h.value=!1,kn()}function ii(){h.value=!1}return e({getData:T,setData:x,validateData:Hv,cmsData:m,currentMode:E,switchMode:F,allowDynamicContentInteraction:z,devRightPadding:d,devRightPaddingValue:p,settingsPanelOpen:i}),(le,de)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"containerRef",ref:M,class:a.normalizeClass(["zcode-cms-container",{"zcode-dev-padding":d.value&&Fe.value}])},[a.createVNode(rd,{"current-mode":a.unref(E),"view-mode":r.value,"allow-dynamic-content-interaction":z.value,onSwitchMode:a.unref(F),onSwitchViewMode:de[0]||(de[0]=be=>r.value=be),onOpenSettings:de[1]||(de[1]=be=>i.value=!0)},null,8,["current-mode","view-mode","allow-dynamic-content-interaction","onSwitchMode"]),X.value.visible?(a.openBlock(),a.createElementBlock("div",Wv,[a.createElementVNode("div",Gv,a.toDisplayString(X.value.message),1),a.createElementVNode("button",{class:"zcode-save-banner-close","aria-label":le.$t("common.close"),onClick:de[2]||(de[2]=be=>X.value.visible=!1)}," × ",8,qv)])):a.createCommentVNode("",!0),r.value==="manage"?(a.openBlock(),a.createElementBlock("div",Kv,[a.createElementVNode("button",{class:"zcode-save-btn",onClick:Zt},[a.createVNode(a.unref(Lc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(le.$t("common.save")),1)])])):a.createCommentVNode("",!0),r.value==="preview"?(a.openBlock(),a.createBlock(ma,{key:2,"cms-data":a.unref(m),"allow-dynamic-content-interaction":!0},null,8,["cms-data"])):a.createCommentVNode("",!0),r.value==="manage"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:3},[a.createVNode(Fc,{ref_key:"previewAreaRef",ref:A,"cms-data":a.unref(m),"full-page-html":a.unref(v),"on-add-click":a.unref(U),"allow-dynamic-content-interaction":z.value},null,8,["cms-data","full-page-html","on-add-click","allow-dynamic-content-interaction"]),a.createVNode(zC,{"editing-component":a.unref(V),"editing-available-fields":a.unref(L),"field-errors":se.value,"current-mode":a.unref(E),"can-select-parent":a.unref(ae),"images-common":a.unref(m).images.common,"images-individual":a.unref(m).images.individual,"images-special":a.unref(m).images.special,onClose:a.unref(G),onSelectParent:a.unref(ke),onSaveField:J,onAddImage:Qs,onDeleteImage:Zs},null,8,["editing-component","editing-available-fields","field-errors","current-mode","can-select-parent","images-common","images-individual","images-special","onClose","onSelectParent"]),a.createVNode(LC,{"delete-confirm-component":a.unref(we),"current-mode":a.unref(E),"can-select-parent":a.unref(ae),onConfirm:a.unref(Me),onCancel:a.unref($),onSelectParent:a.unref(ke)},null,8,["delete-confirm-component","current-mode","can-select-parent","onConfirm","onCancel","onSelectParent"]),a.createVNode(WC,{"reorder-source-path":a.unref(q),"current-mode":a.unref(E),"can-select-parent":a.unref(ae),onCancel:a.unref(Te),onSelectParent:a.unref(ke)},null,8,["reorder-source-path","current-mode","can-select-parent","onCancel","onSelectParent"]),a.createVNode(Av,{"add-target-path":a.unref(K),"add-part-category":a.unref(_e),"add-type-tab":a.unref(Le),"add-selected-part":a.unref(ce),"add-selected-type":a.unref(Y),"has-special-parts":a.unref(k),"clicked-component":a.unref(Ee),"available-part-types":a.unref(N),config:a.unref(l),"grouped-parts-by-type":a.unref(O),"can-select-parent":a.unref(ae),"get-part-preview-html":a.unref(Ve),"get-clicked-component-preview-html":a.unref(Ce),"keep-adding":a.unref(C),onCancel:a.unref(I),onSelectParent:a.unref(ke),onCategoryTabClick:a.unref(te),onTypeTabClick:a.unref(me),onSelectPart:a.unref(ve),onConfirmAdd:a.unref(_),onUpdateKeepAdding:de[3]||(de[3]=be=>C.value=be)},null,8,["add-target-path","add-part-category","add-type-tab","add-selected-part","add-selected-type","has-special-parts","clicked-component","available-part-types","config","grouped-parts-by-type","can-select-parent","get-part-preview-html","get-clicked-component-preview-html","keep-adding","onCancel","onSelectParent","onCategoryTabClick","onTypeTabClick","onSelectPart","onConfirmAdd"])],64)):a.createCommentVNode("",!0),a.createVNode(Ou,{"is-open":i.value,"view-mode":r.value,mode:"toolbar","allow-dynamic-content-interaction":z.value,"dev-right-padding":p.value,"enable-context-menu":u.value,"show-save-confirm":f.value,onClose:de[4]||(de[4]=be=>i.value=!1),onToggleDynamicContent:de[5]||(de[5]=be=>z.value=be),onToggleDevPadding:de[6]||(de[6]=be=>d.value=be),onToggleContextMenu:de[7]||(de[7]=be=>u.value=be),onToggleSaveConfirm:de[8]||(de[8]=be=>f.value=be)},null,8,["is-open","view-mode","allow-dynamic-content-interaction","dev-right-padding","enable-context-menu","show-save-confirm"]),a.createVNode(Mv,{"is-visible":a.unref(Tc),position:a.unref(Zo),"current-mode":a.unref(E),onSelectMode:a.unref(er),onClose:a.unref(zc)},null,8,["is-visible","position","current-mode","onSelectMode","onClose"]),h.value?(a.openBlock(),a.createElementBlock("div",{key:4,class:"zcode-save-confirm-dialog-overlay",onClick:a.withModifiers(ii,["self"])},[a.createElementVNode("div",Jv,[a.createElementVNode("div",Xv,[a.createElementVNode("div",Yv,a.toDisplayString(le.$t("saveConfirm.title")),1)]),a.createElementVNode("div",Qv,[a.createElementVNode("p",null,a.toDisplayString(le.$t("saveConfirm.simpleMessage")),1)]),a.createElementVNode("div",Zv,[a.createElementVNode("button",{class:"zcode-btn-secondary",onClick:ii},a.toDisplayString(le.$t("common.cancel")),1),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:ta},a.toDisplayString(le.$t("saveConfirm.saveButton")),1)])])])):a.createCommentVNode("",!0)],2))}}),Sm=":root{--zcode-color-edit: #3b82f6;--zcode-color-add: #10b981;--zcode-color-reorder: #f59e0b;--zcode-color-delete: #ef4444;--zcode-color-edit-hover: #2563eb;--zcode-color-edit-bg: #eff6ff;--zcode-color-edit-bg-active: #dbeafe;--zcode-color-edit-border-hover: #93c5fd;--zcode-color-add-hover: #059669;--zcode-color-add-bg: #ecfdf5;--zcode-color-add-bg-active: #d1fae5;--zcode-color-add-border-hover: #6ee7b7;--zcode-color-reorder-bg: #fffbeb;--zcode-color-reorder-bg-active: #fef3c7;--zcode-color-reorder-border-hover: #fcd34d;--zcode-color-delete-hover: #dc2626;--zcode-color-delete-bg: #fef2f2;--zcode-color-delete-bg-active: #fee2e2;--zcode-color-delete-border-hover: #fca5a5}[class*=zcode-]{box-sizing:border-box}[class*=zcode-]:before,[class*=zcode-]:after{box-sizing:border-box}.zcode-empty-state{text-align:center;padding:60px 20px;color:#666}.zcode-empty-state-btn{margin-top:20px;padding:10px 20px;font-size:16px;background:#42b983;color:#fff;border:none;border-radius:4px;cursor:pointer;transition:background .2s}.zcode-empty-state-btn:hover{background:#359268}.zcode-edit-panel,.zcode-add-panel,.zcode-reorder-panel,.zcode-delete-panel{position:fixed;top:0;right:0;width:375px;height:100vh;background:#fff;box-shadow:-2px 0 8px #0000001a;overflow:hidden;display:flex;flex-direction:column;z-index:1002}.zcode-edit-panel-header,.zcode-add-panel-header,.zcode-reorder-panel-header,.zcode-delete-panel-header{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-shrink:0}.zcode-panel-header-title{margin:0;font-size:14px;font-weight:600;color:#1f2937}.zcode-edit-panel-header .zcode-panel-header-title{color:var(--zcode-color-edit)}.zcode-add-panel-header .zcode-panel-header-title{color:var(--zcode-color-add)}.zcode-reorder-panel-header .zcode-panel-header-title{color:var(--zcode-color-reorder)}.zcode-delete-panel-header .zcode-panel-header-title{color:var(--zcode-color-delete)}.zcode-close-btn{background:none;border:none;cursor:pointer;color:#6b7280;padding:4px 8px;line-height:1;display:flex;align-items:center;justify-content:center}.zcode-close-btn:hover{color:#1f2937}.zcode-edit-fields{padding:16px;font-size:14px;color:#6b7280;overflow-y:auto;flex:1}.zcode-add-panel-content{overflow-y:auto;flex:1}.zcode-edit-fields-text{margin:8px 0}.zcode-component-developer{border:1px dashed #ccc;padding:10px}.zcode-error-message{padding:20px;background:#fff3cd;border:1px solid #ffc107;border-radius:4px;color:#856404}.zcode-for-item{margin-bottom:10px}.zcode-field-editor{padding:16px;overflow-y:auto}.zcode-field-item-title{margin:0 0 15px;color:#2c3e50;font-size:16px;border-bottom:1px solid #eee;padding-bottom:8px}.zcode-field-editor-label{display:block;margin-bottom:8px;font-weight:500;color:#555}.zcode-text-editor{margin-bottom:20px}.zcode-text-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;transition:border-color .2s;box-sizing:border-box}.zcode-text-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-field-error{border-color:#ef4444!important;background-color:#fef2f2}.zcode-field-error-message{margin-top:6px;font-size:12px;color:#ef4444;line-height:1.4}.zcode-field-counter{margin-top:6px;font-size:12px;color:#6b7280;text-align:right}.zcode-text-input:disabled,.zcode-textarea:disabled{opacity:.7;cursor:not-allowed}.zcode-text-input[readonly],.zcode-textarea[readonly]{background-color:#f3f4f6;cursor:default}.zcode-radio-editor{margin-top:12px;margin-bottom:12px}.zcode-radio-group{display:flex;flex-direction:column;gap:6px}.zcode-radio-item{display:flex;align-items:center;gap:6px;cursor:pointer;margin-bottom:0;font-weight:400;color:inherit}.zcode-radio-item input[type=radio]{margin:0;cursor:pointer}.zcode-radio-item input[type=radio]:focus{outline:2px solid var(--zcode-color-edit);outline-offset:2px}.zcode-radio-item-label{font-size:14px;color:#4b5563}.zcode-checkbox-editor{margin-top:12px;margin-bottom:12px}.zcode-checkbox-item{display:flex;align-items:center;gap:6px;cursor:pointer;margin-bottom:0;font-weight:400;color:inherit}.zcode-checkbox-item input[type=checkbox]{margin:0;cursor:pointer}.zcode-checkbox-item input[type=checkbox]:focus{outline:2px solid var(--zcode-color-edit);outline-offset:2px}.zcode-checkbox-item-label{font-size:14px;color:#4b5563}.zcode-edit-actions{display:flex;gap:10px;margin-top:20px}.zcode-save-btn{flex:1;background:var(--zcode-color-edit);color:#fff;border:none;padding:10px 16px;border-radius:4px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-save-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-cancel-btn{flex:1;background:#f8f9fa;color:#6c757d;border:1px solid #dee2e6;padding:10px 16px;border-radius:4px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-cancel-btn:hover{background:#e9ecef}[data-zcode-id],[data-zcode-slot-path]{transition:outline .2s;cursor:pointer;position:relative}[data-zcode-id].zcode-outline-active-edit,[data-zcode-id].zcode-outline-active-add,[data-zcode-id].zcode-outline-active-reorder,[data-zcode-id].zcode-outline-active-delete,[data-zcode-slot-path].zcode-outline-active-edit,[data-zcode-slot-path].zcode-outline-active-add,[data-zcode-slot-path].zcode-outline-active-reorder,[data-zcode-slot-path].zcode-outline-active-delete{outline-style:solid;animation:zcode-outline-pulse-edit 1.5s ease-in-out infinite}[data-zcode-id].zcode-outline-active-edit{animation-name:zcode-outline-pulse-edit}[data-zcode-id].zcode-outline-active-add{animation-name:zcode-outline-pulse-add}[data-zcode-id].zcode-outline-active-reorder{animation-name:zcode-outline-pulse-reorder}[data-zcode-id].zcode-outline-active-delete{animation-name:zcode-outline-pulse-delete}[data-zcode-slot-path].zcode-outline-active-edit{animation-name:zcode-outline-pulse-edit}[data-zcode-slot-path].zcode-outline-active-add{animation-name:zcode-outline-pulse-add}[data-zcode-slot-path].zcode-outline-active-reorder{animation-name:zcode-outline-pulse-reorder}[data-zcode-slot-path].zcode-outline-active-delete{animation-name:zcode-outline-pulse-delete}@keyframes zcode-outline-pulse-edit{0%{outline-width:4px;outline-offset:2px;outline-color:#3cd7f6}25%{outline-width:4px;outline-offset:2px;outline-color:#3c83f6}50%{outline-width:4px;outline-offset:2px;outline-color:#493cf6}75%{outline-width:4px;outline-offset:2px;outline-color:#3c83f6}to{outline-width:4px;outline-offset:2px;outline-color:#3cd7f6}}@keyframes zcode-outline-pulse-add{0%{outline-width:4px;outline-offset:2px;outline-color:#0fb82b}25%{outline-width:4px;outline-offset:2px;outline-color:#0fb880}50%{outline-width:4px;outline-offset:2px;outline-color:#0f9cb8}75%{outline-width:4px;outline-offset:2px;outline-color:#0fb880}to{outline-width:4px;outline-offset:2px;outline-color:#0fb82b}}@keyframes zcode-outline-pulse-reorder{0%{outline-width:4px;outline-offset:2px;outline-color:#f5800a}25%{outline-width:4px;outline-offset:2px;outline-color:#f59f0a}50%{outline-width:4px;outline-offset:2px;outline-color:#f5be0a}75%{outline-width:4px;outline-offset:2px;outline-color:#f59f0a}to{outline-width:4px;outline-offset:2px;outline-color:#f5800a}}@keyframes zcode-outline-pulse-delete{0%{outline-width:4px;outline-offset:2px;outline-color:#ef437c}25%{outline-width:4px;outline-offset:2px;outline-color:#ef4343}50%{outline-width:4px;outline-offset:2px;outline-color:#ef7c43}75%{outline-width:4px;outline-offset:2px;outline-color:#ef4343}to{outline-width:4px;outline-offset:2px;outline-color:#ef437c}}.zcode-view-mode-toggle{display:flex;gap:8px}.zcode-view-mode-btn{display:flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid #e5e7eb;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s;font-size:14px;font-weight:500}.zcode-dev-header{display:flex;align-items:center;justify-content:flex-start;padding:8px 16px;background:#f9fafb;border-bottom:1px solid #e5e7eb}.zcode-toolbar{position:sticky;top:0;display:flex;align-items:center;gap:8px;width:fit-content;background:#fffc;margin-bottom:10px;padding:8px 16px;border-radius:8px;box-shadow:0 2px 8px #0000001a;z-index:1001}.zcode-save-banner{position:sticky;top:54px;display:flex;align-items:flex-start;justify-content:space-between;gap:12px;width:min(720px,calc(100% - 32px));margin:0 0 10px;padding:10px 12px;border-radius:10px;border:1px solid transparent;z-index:1001;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.zcode-save-banner--error{border-color:#fecaca;background:#fef2f2e6;color:#991b1b}.zcode-save-banner-text{font-size:13px;line-height:1.4;word-break:break-word}.zcode-save-banner-close{flex:0 0 auto;width:28px;height:28px;border-radius:8px;border:1px solid rgba(0,0,0,.06);background:#fffc;color:inherit;cursor:pointer}.zcode-save-banner-close:hover{background:#fff}.zcode-toolbar-separator{width:1px;height:24px;background-color:#e5e7eb;margin:0 4px}.zcode-dynamic-content-toggle-label{display:flex;align-items:center;gap:6px;padding:4px 8px;border-radius:4px;cursor:pointer;font-size:14px;color:#374151;-webkit-user-select:none;user-select:none}.zcode-dynamic-content-toggle-label:hover{background-color:#f3f4f6}.zcode-dynamic-content-toggle-checkbox{margin:0;cursor:pointer}.zcode-dev-container .zcode-cms-container .zcode-toolbar{display:none}.zcode-template-tabs{display:inline-flex;gap:6px;margin-right:8px}.zcode-template-tab{padding:6px 10px;border:1px solid #d1d5db;border-radius:6px;background:#fff;font-size:12px;color:#374151;cursor:pointer}.zcode-template-tab.active{background:#111827;border-color:#111827;color:#fff;font-weight:600}.zcode-css-inline-note{flex-shrink:0;margin:0 0 12px;padding:10px 12px;border:1px solid #fde68a;background:#fffbeb;border-radius:8px;color:#92400e;font-size:12px;line-height:1.6}.zcode-part-editor-preview-tab{border:1px solid #e5e7eb;border-radius:8px;background:#fff;padding:16px;min-height:240px;cursor:pointer}.zcode-part-editor-preview-hint{margin-top:10px;font-size:12px;color:#6b7280}.zcode-part-editor-pane{border:1px solid #e5e7eb;border-radius:8px;background:#fff;overflow:hidden;display:flex;flex-direction:column;min-height:0;min-width:0;flex:1}.zcode-part-editor-pane-header{padding:10px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;align-items:center;justify-content:space-between;gap:10px}.zcode-part-editor-pane-header-actions{display:flex;align-items:center;gap:8px;min-width:0}.zcode-css-warning-compact{display:flex;align-items:center;gap:6px;padding:6px 10px;background:#fffbeb;border:1px solid #fde68a;border-radius:6px;font-size:12px;color:#92400e}.zcode-css-warning-compact-icon{flex-shrink:0;color:#f59e0b}.zcode-css-warning-compact-text{white-space:nowrap;font-weight:500}.zcode-part-editor-pane-body{flex:1;min-height:0;overflow:hidden;padding:12px;display:flex;flex-direction:column}.zcode-part-editor-slots-toggle{width:100%;border:1px solid #e5e7eb;border-radius:8px;background:#f9fafb;padding:10px 12px;display:flex;align-items:center;justify-content:space-between;cursor:pointer;font-size:13px;font-weight:600;color:#374151}.zcode-part-editor-slots-toggle:hover{background:#f3f4f6}.zcode-part-editor-slots-toggle-icon{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;border-radius:999px;border:1px solid #d1d5db;background:#fff;color:#6b7280;font-size:16px;font-weight:400}.zcode-part-editor-slots-toggle-icon.open{transform:rotate(45deg)}.zcode-part-editor-slots-body{margin-top:10px}.zcode-part-editor-topbar{margin-bottom:16px}.zcode-part-editor-topfields{display:grid;grid-template-columns:1fr 1fr;gap:12px}.zcode-part-editor-slots-top{margin-top:12px}.zcode-part-editor-slots-bottom{margin-top:24px;padding-top:24px;border-top:1px solid #e5e7eb}.zcode-save-controls-fixed{position:fixed;bottom:20px;left:20px;display:flex;align-items:center;gap:8px;padding:12px 20px;background:#fffc;border-radius:8px;box-shadow:0 4px 12px #00000026;z-index:1000}.zcode-save-btn{display:flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid var(--zcode-color-edit);border-radius:6px;background:var(--zcode-color-edit);color:#fff;font-size:14px;cursor:pointer;transition:all .2s}.zcode-save-btn:hover{background:var(--zcode-color-edit-hover);border-color:var(--zcode-color-edit-hover)}.zcode-mode-btn{padding:8px 16px;border:2px solid #ddd;border-radius:6px;background:#fff;cursor:pointer;font-weight:500;transition:all .2s;font-size:14px;display:flex;align-items:center;gap:6px}.zcode-mode-btn:hover{background:#f3f4f6}.zcode-mode-edit:hover{color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg);border-color:var(--zcode-color-edit-border-hover)}.zcode-mode-reorder:hover{color:var(--zcode-color-reorder);background:var(--zcode-color-reorder-bg);border-color:var(--zcode-color-reorder-border-hover)}.zcode-mode-add:hover{color:var(--zcode-color-add);background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-border-hover)}.zcode-mode-delete:hover{color:var(--zcode-color-delete);background:var(--zcode-color-delete-bg);border-color:var(--zcode-color-delete-border-hover)}.zcode-mode-btn.active{border-color:currentColor;font-weight:600}.zcode-mode-edit.active{color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg-active);border-color:var(--zcode-color-edit)}.zcode-mode-reorder.active{color:var(--zcode-color-reorder);background:var(--zcode-color-reorder-bg-active);border-color:var(--zcode-color-reorder)}.zcode-mode-add.active{color:var(--zcode-color-add);background:var(--zcode-color-add-bg-active);border-color:var(--zcode-color-add)}.zcode-mode-delete.active{color:var(--zcode-color-delete);background:var(--zcode-color-delete-bg-active);border-color:var(--zcode-color-delete)}.zcode-view-mode-btn{padding:8px 16px;border:2px solid #ddd;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s;font-size:14px;font-weight:500;display:flex;align-items:center;gap:6px}.zcode-view-mode-btn:hover{background:#f9fafb;border-color:#d1d5db;color:#374151}.zcode-view-mode-btn.active{background:#3b82f6;color:#fff;border-color:#3b82f6}.zcode-view-mode-btn.active:hover{background:#2563eb;border-color:#2563eb}.zcode-settings-btn{display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:2px solid #ddd;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s}.zcode-settings-btn:hover{background:#f9fafb;border-color:#d1d5db;color:#374151}.zcode-settings-panel-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000}.zcode-settings-panel{background:#fff;border-radius:8px;box-shadow:0 10px 25px #0003;width:90%;max-width:500px;max-height:80vh;overflow-y:auto}.zcode-settings-panel-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid #e5e7eb;gap:12px}.zcode-settings-panel-header-title{margin:0;font-size:18px;font-weight:600;color:#111827;flex:1}.zcode-settings-panel-header-actions{display:flex;align-items:center;gap:12px}.zcode-language-select{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;color:#374151;cursor:pointer;transition:border-color .2s}.zcode-language-select:hover{border-color:#9ca3af}.zcode-language-select:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.zcode-settings-panel-content{padding:20px}.zcode-setting-item{margin-bottom:24px}.zcode-setting-item:last-child{margin-bottom:0}.zcode-setting-label{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:#374151;cursor:pointer;-webkit-user-select:none;user-select:none}.zcode-setting-checkbox{width:18px;height:18px;cursor:pointer}.zcode-info-btn{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;margin-left:auto;background:none;border:none;color:#6b7280;cursor:pointer;border-radius:4px;transition:color .2s}.zcode-info-btn:hover{color:#374151}.zcode-setting-description{margin:8px 0 0 26px;font-size:13px;color:#6b7280;line-height:1.5}.zcode-setting-info{margin:0;padding:12px;background:#f3f4f6;border-radius:6px;font-size:13px}.zcode-delete-panel-content{padding:16px;flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:16px}.zcode-delete-warning{display:flex;align-items:flex-start;gap:12px;padding:12px;background:var(--zcode-color-delete-bg);border:1px solid var(--zcode-color-delete-border-hover);border-radius:6px;color:var(--zcode-color-delete)}.zcode-delete-warning svg{flex-shrink:0;margin-top:2px}.zcode-delete-warning p{margin:0;font-size:14px;font-weight:500;line-height:1.5}.zcode-delete-actions{display:flex;gap:8px;margin-top:16px}.zcode-btn-danger{flex:1;padding:10px;background:var(--zcode-color-delete);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:600;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-danger:hover{background:var(--zcode-color-delete-hover)}.zcode-btn-cancel{flex:1;padding:10px;background:#e5e7eb;color:#374151;border:none;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-cancel:hover{background:#d1d5db}.zcode-parent-selector{padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-parent-select-btn{width:100%;padding:8px 12px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-parent-select-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-reorder-panel-content{padding:16px;flex:1;overflow-y:auto}.zcode-reorder-panel-content-text{margin:8px 0;color:#374151}.zcode-reorder-source{font-family:monospace;font-size:12px;color:#1f2937}.zcode-field-item{margin-bottom:20px}.zcode-field-item-title{margin:0 0 8px;font-size:14px;color:#374151;font-weight:600}.zcode-group-tabs{display:flex;gap:4px;padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;flex-shrink:0;-webkit-overflow-scrolling:touch}.zcode-group-tab{padding:6px 12px;font-size:13px;font-weight:500;color:#6b7280;background:#fff;border:1px solid #d1d5db;border-radius:4px;cursor:pointer;transition:all .2s;display:flex;align-items:center;gap:4px}.zcode-group-tab:hover{background:#f3f4f6;border-color:#9ca3af;color:#374151}.zcode-group-tab.active{background:var(--zcode-color-edit);border-color:var(--zcode-color-edit);color:#fff}.zcode-group-tab.active:hover{background:var(--zcode-color-edit-hover);border-color:var(--zcode-color-edit-hover)}@media(max-width:768px){.zcode-edit-panel,.zcode-add-panel,.zcode-reorder-panel,.zcode-delete-panel{width:100%;height:auto;position:fixed;inset:auto 0 0;border-radius:12px 12px 0 0;max-height:60vh;box-shadow:0 -4px 12px #00000026;z-index:1002;animation:zcode-slide-in-up .3s ease-out}@keyframes zcode-slide-in-up{0%{transform:translateY(100%)}to{transform:translateY(0)}}.zcode-insert-position{width:100%;right:0}.zcode-edit-actions{flex-direction:column;gap:12px}.zcode-edit-actions-btn{padding:10px 16px;font-size:14px}.zcode-toolbar{top:0;left:10px;right:10px;flex-wrap:nowrap;padding:6px 8px;gap:4px;overflow-x:auto;-webkit-overflow-scrolling:touch}.zcode-toolbar-btn{width:32px;height:32px;padding:0}.zcode-toolbar-btn-text{display:none}.zcode-view-mode-btn,.zcode-mode-btn{width:32px;height:32px;padding:0;justify-content:center}.zcode-view-mode-btn span,.zcode-mode-btn span{display:none}.zcode-settings-btn{width:36px;height:36px}.zcode-delete-dialog-content{width:95%;padding:16px}.zcode-save-controls-fixed{bottom:20px;left:20px;padding:0;background:transparent;box-shadow:none}.zcode-save-btn{width:48px;height:48px;padding:0;border-radius:50%;box-shadow:0 4px 12px #00000040;display:flex;align-items:center;justify-content:center;gap:0}.zcode-save-btn span{display:none}.zcode-save-btn svg{width:20px;height:20px}.zcode-edit-panel-header,.zcode-add-panel-header,.zcode-reorder-panel-header,.zcode-delete-panel-header{padding:10px 12px}.zcode-edit-fields{padding:12px}.zcode-field-item{margin-bottom:20px}.zcode-text-input,.zcode-textarea{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-category-tab-group,.zcode-images-category-tab-group{display:flex;gap:4px}.zcode-parts-manager-content{display:flex;flex-direction:column}.zcode-parts-list-header{padding:16px;border-bottom:1px solid #e5e7eb;display:flex;justify-content:space-between;align-items:center;background:#fff}.zcode-parts-list-header-title{margin:0;font-size:14px;font-weight:600;color:#1f2937}.zcode-parts-items{padding:16px}.zcode-part-item{padding:16px;border:1px solid #e5e7eb;border-radius:8px;cursor:pointer;transition:all .2s;background:#fff;height:100%;display:flex;flex-direction:column;position:relative}.zcode-part-item:hover{border-color:#d1d5db;box-shadow:0 2px 8px #0000001a}.zcode-part-item.zcode-reorder-source{border-color:var(--zcode-color-reorder);background:#f59e0b05;box-shadow:0 0 0 1px #f59e0b1a}.zcode-reorder-source-indicator{position:absolute;top:-10px;right:10px;background:var(--zcode-color-reorder);color:#fff;padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600;z-index:10}.zcode-part-item-add{border:2px dashed #d1d5db;background:#f9fafb;display:flex;align-items:center;justify-content:center;min-height:120px;cursor:pointer}.zcode-part-item-add:hover{border-color:var(--zcode-color-add);background:var(--zcode-color-add-bg);transform:translateY(-2px)}.zcode-part-item-add-content{display:flex;flex-direction:column;align-items:center;gap:8px;color:#6b7280;font-size:14px;font-weight:500}.zcode-part-item-add:hover .zcode-part-item-add-content{color:var(--zcode-color-add)}.zcode-part-item-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.zcode-part-item-actions{display:flex;gap:4px;align-items:center}.zcode-action-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-action-btn:hover{background:#e5e7eb;color:#374151}.zcode-action-btn.active{background:var(--zcode-color-reorder);color:#fff}.zcode-action-btn.zcode-delete-btn:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-part-duplicate-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-part-duplicate-btn:hover{background:var(--zcode-color-add-bg);color:var(--zcode-color-add)}.zcode-part-type{font-weight:600;font-size:14px;color:#1f2937}.zcode-part-actions{display:flex;gap:4px}.zcode-part-edit-btn,.zcode-part-delete-btn,.zcode-module-delete-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-part-edit-btn:hover{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit)}.zcode-part-delete-btn:hover,.zcode-module-delete-btn:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-part-description{font-size:13px;color:#6b7280;margin-bottom:4px}.zcode-description-empty{color:#9ca3af;font-style:italic}.zcode-part-modules{font-size:12px;color:#9ca3af}.zcode-part-type-group{margin-bottom:24px}.zcode-part-type-title{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:16px;font-weight:600;color:#1f2937;margin:0 0 12px;padding-bottom:8px;border-bottom:2px solid #e5e7eb}.zcode-part-type-actions{display:flex;align-items:center;gap:4px}.zcode-part-type-edit-btn{padding:4px 8px;border:1px solid #e5e7eb;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;transition:all .2s}.zcode-part-type-edit-btn:hover{background:var(--zcode-color-edit-bg);border-color:var(--zcode-color-edit-border-hover);color:var(--zcode-color-edit)}.zcode-part-type-items{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}.zcode-part-preview{margin-top:12px;padding:8px;border:1px solid #e5e7eb;border-radius:6px;background:#f9fafb;max-height:150px;overflow:hidden;flex:1;min-height:0}.zcode-part-preview-content{font-size:11px;line-height:1.4;pointer-events:none;transform:scale(.75);transform-origin:top left;width:133.33%}.zcode-required{color:#ef4444;margin-left:2px}.zcode-part-modal{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000;padding:20px}.zcode-part-modal-content{background:#fff;border-radius:8px;box-shadow:0 10px 40px #0003;width:100%;max-width:95vw;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-part-editor{display:flex;flex-direction:column;overflow:hidden;height:100%}.zcode-part-editor-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-part-editor-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-part-editor-form{flex:1;overflow-y:auto;padding:24px 24px 80px}.zcode-part-editor-main{display:grid;grid-template-columns:1fr 1fr;gap:24px;align-items:stretch;min-height:0}.zcode-part-editor-fields{display:flex;flex-direction:column;gap:16px}.zcode-part-editor-preview{border:1px solid #e5e7eb;border-radius:8px;padding:16px;background:#f9fafb;position:sticky;top:0;max-height:calc(90vh - 200px);display:flex;flex-direction:column}.zcode-part-editor-preview-title{margin:0 0 12px;font-size:14px;font-weight:600;color:#1f2937}.zcode-preview-module-selector{margin-bottom:12px}.zcode-select-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;cursor:pointer}.zcode-select-input:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-editing-preview-content{flex:1;overflow-y:auto;padding:12px;background:#fff;border-radius:6px;min-height:200px;transform:scale(.9);transform-origin:top left;width:111.11%}.zcode-preview-empty{flex:1;display:flex;align-items:center;justify-content:center;color:#9ca3af;font-size:14px}.zcode-preview-modal{position:fixed;inset:0;background:#000c;display:flex;align-items:center;justify-content:center;z-index:3000;padding:20px}.zcode-preview-modal-content{background:#fff;border-radius:8px;width:90%;max-width:1200px;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-preview-modal-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-preview-modal-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-preview-modal-body{padding:24px;overflow-y:auto;flex:1}.zcode-help-modal-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:10000;padding:20px}.zcode-help-modal{background:#fff;border-radius:8px;width:90%;max-width:800px;max-height:80vh;overflow:auto;box-shadow:0 20px 25px -5px #0000001a}.zcode-help-modal-header{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid #e5e7eb;background:#f9fafb;position:sticky;top:0;z-index:1}.zcode-help-modal-header-title{margin:0;font-size:18px;font-weight:600;color:#1f2937;display:flex;align-items:center;gap:8px}.zcode-css-warning-modal-title-icon{color:#f59e0b;flex-shrink:0}.zcode-help-modal-body{padding:24px}.zcode-help-table{width:100%;border-collapse:collapse;margin-bottom:24px}.zcode-help-table-cell{padding:14px 16px;text-align:left;border-bottom:1px solid #e5e7eb;border-right:1px solid #e5e7eb;vertical-align:top}.zcode-help-table-cell:last-child{border-right:none}.zcode-help-table-header{background:#f9fafb;font-weight:600;color:#374151;font-size:13px;text-transform:uppercase;letter-spacing:.5px}.zcode-help-table-data{font-size:14px;color:#4b5563;line-height:1.6}.zcode-help-table-data:first-child{width:35%}.zcode-help-table-data:nth-child(2){width:30%}.zcode-help-table-data:nth-child(3){width:35%}.zcode-help-table-code{background:#f3f4f6;padding:3px 8px;border-radius:4px;font-size:13px;color:#dc2626;font-family:Courier New,Courier,monospace;white-space:nowrap;border:1px solid #e5e7eb}.zcode-help-table-row:hover{background:#fafafa}.zcode-help-section{background:#f9fafb;padding:12px 16px;border-radius:6px;border:1px solid #e5e7eb;margin-bottom:16px}.zcode-help-section:last-child{margin-bottom:0}.zcode-help-section-title{margin:0 0 8px;color:#374151;font-size:14px;font-weight:600}.zcode-help-section-list{margin:0;padding-left:0;list-style-position:inside}.zcode-help-section-item{margin-bottom:6px;color:#6b7280;font-size:13px;line-height:1.6}.zcode-help-section-item:last-child{margin-bottom:0}.zcode-help-section-code{background:#f3f4f6;padding:2px 6px;border-radius:3px;font-size:12px;color:#dc2626;font-family:Courier New,Courier,monospace;border:1px solid #e5e7eb}.zcode-slots-config{display:flex;flex-direction:column;gap:16px}.zcode-slot-config-item{border:1px solid #e5e7eb;border-radius:6px;padding:12px;background:#f9fafb}.zcode-slot-config-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #e5e7eb}.zcode-slot-config-header-title{font-size:14px;color:#1f2937}.zcode-slot-config-body{display:flex;flex-direction:column;gap:8px}.zcode-slot-config-body-label{font-size:12px;font-weight:600;color:#6b7280;margin-bottom:4px}.zcode-checkbox-group{display:flex;flex-direction:column;gap:6px}.zcode-checkbox-item{display:flex;align-items:center;gap:6px;cursor:pointer}.zcode-checkbox-item:hover{background-color:transparent}.zcode-checkbox{width:16px;height:16px;cursor:pointer;accent-color:var(--zcode-color-edit);flex-shrink:0}.zcode-checkbox-item span{font-size:13px;color:#374151;-webkit-user-select:none;user-select:none}.zcode-module-slots-config{margin-top:16px;padding-top:16px;border-top:1px solid #e5e7eb}.zcode-slot-add-section{margin-top:16px;padding:12px;border:1px dashed #d1d5db;border-radius:6px;background:#f9fafb}.zcode-slot-add-section-label{display:block;font-size:13px;font-weight:600;color:#374151;margin-bottom:8px}.zcode-slot-add-controls{display:flex;gap:8px;align-items:center}.zcode-select-input{flex:1;padding:8px 12px;border:1px solid #d1d5db;border-radius:4px;background:#fff;font-size:14px;color:#1f2937;cursor:pointer;transition:border-color .2s}.zcode-select-input:hover{border-color:#9ca3af}.zcode-select-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-select{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;color:#1f2937;cursor:pointer;transition:border-color .2s}.zcode-select:hover{border-color:#9ca3af}.zcode-select:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-select[multiple]{padding:4px;cursor:default}.zcode-select-option{padding:6px 8px;border-radius:4px;margin:2px 0}.zcode-select-option:checked{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit)}.zcode-tag-editor{display:flex;flex-direction:column;gap:8px}.zcode-tag-preview{font-size:12px;color:#6b7280;padding:4px 8px;background-color:#f3f4f6;border-radius:4px;font-family:Courier New,monospace}.zcode-tag-preview code{background-color:transparent;padding:0;color:#374151;font-weight:600}.zcode-slot-add-empty{margin-top:16px;padding:12px;text-align:center;color:#6b7280;font-size:13px;font-style:italic}.zcode-module-slots-config-label{font-size:13px;font-weight:600;color:#374151;margin-bottom:8px;display:block}.zcode-form-hint{font-size:12px;color:#6b7280;margin-top:4px;margin-bottom:12px;font-style:italic}.zcode-btn-small{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s;font-size:12px}.zcode-btn-small:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-module-item.active{border-color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg)}.zcode-module-delete-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-module-delete-btn:hover:not(:disabled){background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-module-delete-btn:disabled{opacity:.4;cursor:not-allowed}.zcode-module-actions{display:flex;gap:4px;align-items:center}.zcode-module-duplicate-btn,.zcode-module-copy-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-module-duplicate-btn:hover:not(:disabled),.zcode-module-copy-btn:hover:not(:disabled){background:var(--zcode-color-add-bg);color:var(--zcode-color-add)}.zcode-module-copy-btn:disabled{opacity:.4;cursor:not-allowed}.zcode-form-field{margin-bottom:16px}.zcode-form-field-label{display:block;font-size:14px;font-weight:500;color:#374151;margin-bottom:6px}.zcode-form-field-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}.zcode-form-field-header>.zcode-form-field-label:first-child{margin-bottom:0}.zcode-form-field-actions{display:flex;align-items:center;gap:8px}.zcode-help-btn{display:flex;align-items:center;justify-content:center;padding:4px;background:transparent;border:none;color:#6b7280;cursor:pointer;border-radius:4px;transition:all .2s}.zcode-help-btn:hover{color:#374151;background:transparent}.zcode-checkbox-label{display:flex;align-items:center;gap:6px;cursor:pointer;-webkit-user-select:none;user-select:none;margin-bottom:0}.zcode-checkbox-label-inline{margin-bottom:0}.zcode-checkbox-input{width:16px;height:16px;cursor:pointer;margin:0}.zcode-checkbox-label span{font-size:13px;color:#6b7280;font-weight:400}.zcode-text-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;transition:border-color .2s}.zcode-text-input:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-monaco-editor{width:100%;flex:1;min-height:0;display:flex;flex-direction:column}.zcode-monaco-editor .monaco-editor-wrapper{flex:1;min-height:0;display:flex;flex-direction:column}.zcode-monaco-editor .monaco-editor-container{border:1px solid #d1d5db;border-radius:4px;flex:1;min-height:0;max-height:none!important}.zcode-textarea{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;font-family:monospace;resize:vertical;transition:border-color .2s}.zcode-textarea:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-modules-list{margin-bottom:12px}.zcode-module-item{padding:12px;border:1px solid #e5e7eb;border-radius:6px;margin-bottom:12px;background:#f9fafb;cursor:pointer;transition:all .2s}.zcode-module-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.zcode-module-title{font-weight:600;font-size:14px;color:#1f2937}.zcode-module-body{display:flex;flex-direction:column;gap:8px}.zcode-module-body-label{font-size:12px;font-weight:500;color:#6b7280}.zcode-part-editor-actions{display:flex;gap:8px;padding:16px 24px;border-top:1px solid #e5e7eb;background:#fff;flex-shrink:0}.zcode-part-editor-actions-btn{flex:1}.zcode-part-editor-actions-btn-primary,.zcode-btn-primary{padding:10px 20px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:600;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-parts-new-btn,.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%}}",eT={common:{close:"閉じる",save:"保存",cancel:"キャンセル",delete:"削除",edit:"編集",add:"追加",reorder:"並べ替え",preview:"プレビュー",settings:"設定",manage:"管理",view:"表示",confirm:"確定",clear:"クリア",select:"選択",replace:"差し替え",copy:"コピー",copied:"コピーしました"},toolbar:{editMode:"編集",addMode:"追加",reorderMode:"並べ替え",deleteMode:"削除",viewMode:"表示",settings:"設定"},settings:{title:"設定",language:{label:"言語",ja:"日本語",en:"English"},enableDynamicContent:"ページの動作を有効にする",enableDynamicContentDescription:"アコーディオン、タブ、モーダル、リンクなどの動的コンテンツの動作を有効にします。",devRightPadding:"編集パネル分の余白をつける",devRightPaddingDescription:"編集パネル表示時にコンテンツの右側に余白を追加します。",enableContextMenu:"右クリックメニューを有効にする",enableContextMenuDescription:"コンテンツ上で右クリックすると、編集・追加・並べ替え・削除のモードを切り替えるメニューが表示されます。",showSaveConfirm:"保存時の確認ダイアログを表示する",showSaveConfirmDescription:"保存ボタンをクリックした際に、保存対象を確認するダイアログを表示します。",previewModeInfo:"表示モードでは動的コンテンツ(アコーディオン、タブ、モーダル、リンクなど)は常に有効です。",noSettings:"設定項目はありません。"},addPanel:{title:"追加",selectParent:"親要素を選択",category:{common:"共通",individual:"個別",selected:"選択したパーツ"},typeAll:"all",activeParts:"active parts",activePartsDescription:"プレビューエリアでクリックしたパーツを、現在のデータを含む状態で追加できます。",clickPartInPreview:"プレビューエリアでパーツをクリックしてください",noPartsAvailable:"利用可能なパーツがありません",addBefore:"前に追加",addAfter:"後に追加",continueAdding:"パーツ追加を続ける"},editPanel:{title:"編集中",editing:"編集中: {type}",id:"ID: {id}",selectImage:"画像を選択",replaceImage:"差し替え",clearImage:"クリア",clearImageTitle:"画像をクリア",noFields:"編集可能なフィールドがありません"},deletePanel:{title:"削除確認",confirmMessage:"このパーツを削除しますか?",selectParent:"親要素を選択"},reorderPanel:{title:"並べ替え: 移動元を選択中",instruction:"移動先の要素をクリックしてください",source:"移動元: {path}",selectParent:"親要素を選択"},saveConfirm:{title:"保存の確認",message:"以下のデータを保存しますか?",simpleMessage:"保存しますか?",targets:{page:"ページデータ","parts-common":"パーツ(共通)","parts-individual":"パーツ(個別)","parts-special":"パーツ(特別)","parts-common-css":"CSS(共通)","parts-individual-css":"CSS(個別)","parts-special-css":"CSS(特別)","images-common":"画像(共通)","images-individual":"画像(個別)","images-special":"画像(特別)"},saveButton:"保存する"},partsManager:{createType:"新規タイプ作成",editType:"タイプ編集",typeName:"タイプ名",typeDescription:"説明",typeNamePlaceholder:"例: hero, features",typeDescriptionPlaceholder:"タイプの説明",editPart:"パーツ編集: {title}",partTitle:"タイトル",partDescription:"説明",partDescriptionPlaceholder:"パーツの説明",deletePartConfirm:`パーツ {number} を削除しますか?
|
|
467
|
-
(タイプには他のパーツが残ります)`,deleteTypeConfirm:"このタイプを削除しますか?",deleteTypeWithUsagesConfirm:"タイプ「{type}」は{count}箇所で使用されています。削除しますか?",deleteSlotConfirm:"スロット「{slotName}」を削除しますか?",selectImage:"画像選択",addPart:"パーツを追加",editTypeButton:"タイプ全体を編集",reorderType:"タイプを並べ替え",deleteTypeButton:"このタイプを削除(全パーツ含む)",editPartButton:"パーツを編集",reorderPart:"並べ替え",deletePartButton:"削除",source:"移動元",noDescription:"説明なし",partNumber:"パーツ {current} / {total}",allowedParts:"許可されるパーツ",searchParts:"パーツを検索...",addSlot:"スロットを追加",selectSlot:"スロットを選択...",defaultSlot:"デフォルトスロット",codeEdit:"コード編集",cssEditInfo:"CSS編集について",templateSuggestions:"予測変換",preview:"プレビュー:",cssEditWarning:"CSS編集について",cssEditWarningMessageCommon:"ここで編集したCSSは、すべてのページに適用される想定です。既存のCSSファイル(common.cssなど)がある場合、それらを上書きする可能性があります。",cssEditWarningMessageIndividual:"ここで編集したCSSは、ページタイプごとに適用される想定です。既存のCSSファイル(page.cssなど)がある場合、それらを上書きする可能性があります。",cssEditWarningMessageSpecial:"ここで編集したCSSは、動的ページごとに適用される想定です。既存のCSSファイル(shop111.cssなど)がある場合、それらを上書きする可能性があります。",understood:"了解しました",dontShowAgain:"次回から表示しない",templateHelp:{textField:"テキストフィールド",richText:"リッチテキスト",textarea:"複数行テキスト",image:"画像選択",radio:"ラジオボタン",checkbox:"チェックボックス",selectSingle:"セレクトボックス(単一選択)",selectMultiple:"セレクトボックス(複数選択)",conditional:"条件分岐(表示/非表示)",slot:"スロット(子要素挿入)",note:"補足",suggestionNote:"予測変換を有効にすると、<code>$</code>、<code>(</code>、<code>z</code>を入力時に自動補完が表示されます",fieldNameNote:"フィールド名は英数字とアンダースコアが使用できます",defaultValueNote:"デフォルト値は省略可能です(空文字になります)"},validationError:"エラー:",dangerousTagWarning:"<{tag}> タグが含まれています。",dangerousAttrWarning:"{attr} 属性が含まれています。",slotSettings:"スロット設定",slot:"スロット",templateHelpButton:"テンプレート記法のヘルプ",clickToEnlarge:"クリックで拡大"},imagesManager:{addImage:"画像追加",editImage:"画像編集",imageId:"画像ID",imageName:"画像名",altText:"Alt属性",deleteImageConfirm:"この画像を削除しますか?",deleteImageWithUsagesConfirm:"この画像は{count}箇所で使用されています。削除しますか?",
|
|
468
|
-
(Other parts in the type will remain)`,deleteTypeConfirm:"Do you want to delete this type?",deleteTypeWithUsagesConfirm:'Type "{type}" is used in {count} places. Do you want to delete it?',deleteSlotConfirm:'Do you want to delete slot "{slotName}"?',selectImage:"Select image",addPart:"Add part",editTypeButton:"Edit type",reorderType:"Reorder type",deleteTypeButton:"Delete this type (all parts included)",editPartButton:"Edit part",reorderPart:"Reorder",deletePartButton:"Delete",source:"Source",noDescription:"No description",partNumber:"Part {current} / {total}",allowedParts:"Allowed parts",searchParts:"Search parts...",addSlot:"Add slot",selectSlot:"Select slot...",defaultSlot:"Default slot",codeEdit:"Code editor",cssEditInfo:"About CSS editing",templateSuggestions:"Template suggestions",preview:"Preview:",cssEditWarning:"About CSS editing",cssEditWarningMessageCommon:"CSS edited here is intended to apply to all pages. If existing CSS files (e.g., common.css) exist, they may be overwritten.",cssEditWarningMessageIndividual:"CSS edited here is intended to apply per page type. If existing CSS files (e.g., page.css) exist, they may be overwritten.",cssEditWarningMessageSpecial:"CSS edited here is intended to apply per dynamic page. If existing CSS files (e.g., shop111.css) exist, they may be overwritten.",dontShowAgain:"Don't show again",templateHelp:{textField:"Text field",richText:"Rich text",textarea:"Multi-line text",image:"Image selection",radio:"Radio button",checkbox:"Checkbox",selectSingle:"Select box (single)",selectMultiple:"Select box (multiple)",conditional:"Conditional (show/hide)",slot:"Slot (child insertion)",note:"Note",suggestionNote:"When template suggestions are enabled, autocomplete will appear when typing <code>$</code>, <code>(</code>, or <code>z</code>",fieldNameNote:"Field names can use alphanumeric characters and underscores",defaultValueNote:"Default values are optional (will be empty string if omitted)"},validationError:"Error:",dangerousTagWarning:"<{tag}> tag is included.",dangerousAttrWarning:"{attr} attribute is included.",slotSettings:"Slot settings",slot:"Slot",templateHelpTitle:"Template Syntax Help",clickToEnlarge:"Click to enlarge",understood:"Understood",syntax:"Syntax",description:"Description",example:"Example",templateHelpButton:"Template syntax help"},imagesManager:{addImage:"Add image",editImage:"Edit image",imageId:"Image ID",imageName:"Image name",altText:"Alt attribute",deleteImageConfirm:"Do you want to delete this image?",deleteImageWithUsagesConfirm:"This image is used in {count} places. Do you want to delete it?",deleteImageFromModalConfirm:"Do you want to delete this image?",addImageFailed:"Failed to add image",selectImage:"Select image",currentlySelected:"Currently selected",select:"Select"},dataViewer:{page:"Page",parts:"Parts",images:"Images",common:"Common",individual:"Individual",special:"Special",json:"JSON",html:"HTML",categoryInfo:{title:"About Category Roles",common:{title:"Common",description:"Intended for parts and images shared across the entire site. Assumed to be usable on all pages."},individual:{title:"Individual",description:"Intended for parts and images shared per page type. Assumed to be usable on all pages of the same page type."},special:{title:"Special",description:"Intended for parts and images used for dynamic pages (e.g., per store, per product) or under specific conditions. Assumed to be usable on pages dynamically generated with route model binding, etc."}}},contextMenu:{edit:"Edit",add:"Add",reorder:"Reorder",delete:"Delete",close:"Close"},editor:{pageManagement:"Page Management",partsManagement:"Parts Management",imagesManagement:"Images Management",dataViewer:"Data Viewer",loading:"Loading data...",saveFailed:"Save failed",saveFailedWithCount:"Save failed ({count} items)",saveFailedWithMessage:"Save failed ({count} items): {message}",noSaveTargets:"No save targets"}};function nT(t="ja"){return o1({locale:t,fallbackLocale:"ja",messages:{ja:eT,en:tT},globalInjection:!0})}const Nm={UNDEFINED_PROPERTIES:"Cannot read properties of undefined",APP_REFERENCE:"app"};function Cm(){if(typeof window>"u")return;const t=window;t.__zcodeI18nErrorHandlerSetup||(window.addEventListener("unhandledrejection",e=>{if(e.reason&&typeof e.reason=="object"&&"message"in e.reason){const n=String(e.reason.message);if(n.includes(Nm.UNDEFINED_PROPERTIES)&&n.includes(Nm.APP_REFERENCE)){e.preventDefault();return}}}),t.__zcodeI18nErrorHandlerSetup=!0)}function oT(){if(typeof window>"u")return;const t=window;t.__VUE_I18N_FULL_INSTALL__=!1,t.__INTLIFY_PROD_DEVTOOLS__=!1,t.__VUE_I18N_PROD_DEVTOOLS__=!1}function Ws(t,e="ja"){const n=p1(null);if(n)return n;const o=t.getAttribute("locale");return o==="ja"||o==="en"?o:e}function Gs(t,e){oT();const n=nT(e);try{t.use(n)}catch(o){console.warn("[ZeroCode] Failed to setup i18n:",o)}}Cm();class rT extends HTMLElement{app=null;componentInstance=null;_shadowRoot=null;constructor(){super()}connectedCallback(){if(this.app)return;this.getAttribute("use-shadow-dom")!=="false"?(this.setupShadowDOM(),window.addEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this))):(this.setupLightDOM(),window.addEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this)))}setupLightDOM(){const e=this.getAttribute("page")||"[]",n=this.getAttribute("css-common"),o=this.getAttribute("css-individual"),r=this.getAttribute("css-special"),i=this.getAttribute("parts-common")||"[]",s=this.getAttribute("parts-individual")||"[]",l=this.getAttribute("parts-special")||"[]",c=this.getAttribute("images-common")||"[]",d=this.getAttribute("images-individual")||"[]",u=this.getAttribute("images-special")||"[]",f=Array.from(this.querySelectorAll('[slot="script"]'));f.length>0&&(this.__savedScriptSlots=f.map(h=>({src:h.src,type:h.type,async:h.async,defer:h.defer,integrity:h.integrity,crossOrigin:h.crossOrigin})));const p=Ws(this);this.app=a.createApp(Hs,{locale:p,page:e,cssCommon:n,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:s,partsSpecial:l,imagesCommon:c,imagesIndividual:d,imagesSpecial:u,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}),Gs(this.app,p),this.componentInstance=this.app.mount(this),this.injectLightDOMCSS()}setupShadowDOM(){const e=this.shadowRoot,n=!!e;e?(this._shadowRoot=e,this.clearScripts()):(this._shadowRoot=this.attachShadow({mode:"open"}),this.injectCSS());const o=this.getAttribute("page")||"[]",r=this.getAttribute("css-common"),i=this.getAttribute("css-individual"),s=this.getAttribute("css-special"),l=this.getAttribute("parts-common")||"[]",c=this.getAttribute("parts-individual")||"[]",d=this.getAttribute("parts-special")||"[]",u=this.getAttribute("images-common")||"[]",f=this.getAttribute("images-individual")||"[]",p=this.getAttribute("images-special")||"[]",h=Ws(this);this.app=a.createApp(Hs,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:s,partsCommon:l,partsIndividual:c,partsSpecial:d,imagesCommon:u,imagesIndividual:f,imagesSpecial:p,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}),Gs(this.app,h),this.componentInstance=this.app.mount(this._shadowRoot),requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{this.injectScript(n)},100)})})}injectCSS(){if(!this._shadowRoot)return;const e=document.createElement("style");e.textContent=Sm,this._shadowRoot.appendChild(e),this.querySelectorAll('[slot="css"]').forEach(o=>{const r=o.cloneNode(!0);r.removeAttribute("slot"),this._shadowRoot.appendChild(r),o.remove()})}injectLightDOMCSS(){this.querySelectorAll('[slot="css"]').forEach(n=>{const o=n.cloneNode(!0);o.removeAttribute("slot"),document.head.appendChild(o)})}clearScripts(){if(!this._shadowRoot)return;this._shadowRoot.querySelectorAll("script").forEach(n=>{n.remove()})}injectScript(e=!1){if(!this._shadowRoot)return;const n=this.querySelectorAll('[slot="script"]'),o=Array.from(n),r=[],i=[];o.forEach(c=>{const d=c;if(!d.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}d.src.includes("jquery")||d.src.includes("code.jquery.com")?r.push(d):i.push(d)});const s=c=>{let d=c.src;if(e)try{const f=new URL(c.src,window.location.href);f.searchParams.set("_t",Date.now().toString()),d=f.toString()}catch{d=c.src+(c.src.includes("?")?"&":"?")+"_t="+Date.now()}const u=document.createElement("script");return u.src=d,c.type&&(u.type=c.type),c.async&&(u.async=!0),c.defer&&(u.defer=!0),c.integrity&&(u.integrity=c.integrity),c.crossOrigin&&(u.crossOrigin=c.crossOrigin),u.onerror=f=>{console.error(`Failed to load script: ${c.src}`,f)},u},l=()=>{o.forEach(c=>{c.remove()})};if(r.length>0){let c=0;const d=r.length;r.forEach(u=>{const f=s(u);f.onload=()=>{c++,c===d&&(Mo(this._shadowRoot,e),setTimeout(()=>{i.forEach(p=>{this._shadowRoot.appendChild(s(p))}),l()},50))},this._shadowRoot.appendChild(f)})}else Mo(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(s(c))}),l()}injectLightDOMScripts(){let e=[];if(this.__savedScriptSlots&&this.__savedScriptSlots.length>0)e=this.__savedScriptSlots.map(i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s});else{const i=this.querySelectorAll('[slot="script"]');e=Array.from(i)}const n=[],o=[];e.forEach(i=>{const s=i;if(!s.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}s.src.includes("jquery")||s.src.includes("code.jquery.com")?n.push(s):o.push(s)});const r=i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},s};if(n.length>0){let i=0;const s=n.length;n.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===s&&requestAnimationFrame(()=>{o.forEach(d=>{document.body.appendChild(r(d))})})},document.body.appendChild(c)})}else o.forEach(i=>{document.body.appendChild(r(i))})}getData(e){return this.componentInstance&&this.componentInstance.getData?this.componentInstance.getData(e):null}setData(e,n){return this.componentInstance&&this.componentInstance.setData?this.componentInstance.setData(e,n):!1}get allowDynamicContentInteraction(){if(this.componentInstance){const e=this.componentInstance.allowDynamicContentInteraction;if(e!==void 0)return e&&typeof e=="object"&&"value"in e?e.value:e}return!0}set allowDynamicContentInteraction(e){if(this.componentInstance){const n=this.componentInstance.allowDynamicContentInteraction;n!==void 0&&(n&&typeof n=="object"&&"value"in n?n.value=e:this.componentInstance.allowDynamicContentInteraction=e)}}disconnectedCallback(){if(this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot){if(this._shadowRoot.__zecEventListeners){const e=this._shadowRoot.__zecEventListeners,n=this._shadowRoot;e.forEach(o=>{o.forEach(r=>{n.removeEventListener(r.eventName,r.handler,!0)})}),e.clear()}if(window.__zecShadowRoots){const e=window.__zecShadowRoots,n=this._shadowRoot;for(const[o,r]of e.entries())r===n&&e.delete(o)}}this._shadowRoot=null,window.removeEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this)),window.removeEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this))}handleDOMUpdated(){if(!this._shadowRoot||this.getAttribute("use-shadow-dom")!=="true")return;this._shadowRoot.__zecJQueryExtended&&delete this._shadowRoot.__zecJQueryExtended;const e=this._shadowRoot.querySelector("script[data-zec-shadow-extension]");e&&e.remove(),Mo(this._shadowRoot,!0)}handleLightDOMUpdated(){this.getAttribute("use-shadow-dom")!=="true"&&(this.__lightDOMScriptsLoaded||(this.injectLightDOMScripts(),this.__lightDOMScriptsLoaded=!0))}static get observedAttributes(){return["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data","use-shadow-dom"]}attributeChangedCallback(e,n,o){if(n!==o){if(e==="use-shadow-dom"){this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot&&(this._shadowRoot.innerHTML="",this._shadowRoot=null),this.connectedCallback();return}this.app&&(this.app.unmount(),this.app=null,this.componentInstance=null,this.connectedCallback())}}}customElements.get("zcode-cms")||customElements.define("zcode-cms",rT);function iT(t){const{t:e}=rn(),n=a.ref("common"),o=a.ref(null),r=a.ref(null),i=a.ref(null),s=a.ref(null),l=a.ref(!1),c=a.ref(null),d=a.ref(null),{renderComponentToHtml:u}=fi(t,!1),f=a.computed(()=>{const C=t.parts;return n.value==="common"?C.common:n.value==="individual"?C.individual:C.special}),p=a.computed(()=>{const C=f.value,N=new Map;return C.forEach(O=>{N.has(O.type)||N.set(O.type,[]),O.parts.forEach((k,U)=>{N.get(O.type).push({type:O,partIndex:U})})}),Array.from(N.entries()).map(([O,k])=>({type:O,parts:k.map(U=>({...U.type,_partIndex:U.partIndex,_displayPart:U.type.parts[U.partIndex]}))}))});function h(){const C=t.parts;return n.value==="common"?C.common:n.value==="individual"?C.individual:C.special}function m(C){return f.value.find(N=>N.type===C)||null}function b(C){return i.value&&i.value.partIndex===C&&i.value.part.slots||null}function g(C,N,O){if(i.value&&i.value.partIndex===C){const k=i.value.part;return k.slots||(k.slots={}),O(k.slots),!0}return!1}function x(C){const N={};return C.forEach(O=>{if(O.optional)N[O.fieldName]=void 0;else switch(O.type){case"text":N[O.fieldName]=O.defaultValue||"";break;case"radio":N[O.fieldName]=O.options?.[0]||"";break;case"checkbox":N[O.fieldName]=[];break;case"boolean":N[O.fieldName]=!0;break;case"rich":N[O.fieldName]=O.defaultValue?`<p>${O.defaultValue}</p>`:"<p></p>";break;case"image":N[O.fieldName]=O.defaultValue||"";break}}),N}function v(C){o.value=C,r.value=null,l.value=!1}function w(){r.value=a.reactive({id:jn(),type:"",description:"",parts:[{id:jn(),title:"part_1",description:"",body:"<div>{$content:コンテンツを入力}</div>"}]}),s.value="type",l.value=!0,o.value=null}function T(C){r.value=a.reactive(JSON.parse(JSON.stringify(C))),s.value="type",l.value=!1,o.value=C}function M(C,N){const O=C.parts[N];if(!O)return;const k=JSON.parse(JSON.stringify(O));k.slots||(k.slots={}),i.value={type:a.reactive(JSON.parse(JSON.stringify(C))),partIndex:N,part:a.reactive(k)},s.value="part"}async function A(C){const N=m(C.type);if(!N)return;const O=a.reactive(JSON.parse(JSON.stringify(N))),k={id:jn(),title:`part_${O.parts.length+1}`,description:"",body:"<div>{$content:コンテンツを入力}</div>"};O.parts.push(k);const U=O.parts.length-1;await a.nextTick(),i.value={type:O,partIndex:U,part:a.reactive(JSON.parse(JSON.stringify(k))),isNewPart:!0},s.value="part"}async function y(){if(!r.value)return;const C=Le(r.value);if(!C.valid){alert(e("partsManager.validationError")+`
|
|
469
|
-
`+
|
|
470
|
-
`));return}const
|
|
463
|
+
3. "-" cannot repeat`);We.customSchemes.push([n,e])}function gS(){We.scanner=lS(We.customSchemes);for(let n=0;n<We.tokenQueue.length;n++)We.tokenQueue[n][1]({scanner:We.scanner});We.parser=uS(We.scanner.tokens);for(let n=0;n<We.pluginQueue.length;n++)We.pluginQueue[n][1]({scanner:We.scanner,parser:We.parser});return We.initialized=!0,We}function hc(n){return We.initialized||gS(),pS(We.parser.start,n,Kh(We.scanner.start,n))}hc.scan=Kh;function tm(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 pc(t),r=hc(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 mc="[\0- -\u2029 ]",yS=new RegExp(mc),bS=new RegExp(`${mc}$`),xS=new RegExp(mc,"g");function kS(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function ES(n){return new _t({key:new dn("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=Xf(t.doc,[...e]);if(sh(l).forEach(({newRange:d})=>{const u=iE(o.doc,d,h=>h.isTextblock);let p,f;if(u.length>1)p=u[0],f=o.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ");else if(u.length){const h=o.doc.textBetween(d.from,d.to," "," ");if(!bS.test(h))return;p=u[0],f=o.doc.textBetween(p.pos,d.to,void 0," ")}if(p&&f){const h=f.split(yS).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],g=p.pos+f.lastIndexOf(m);if(!m)return!1;const y=hc(m).map(x=>x.toObject(n.defaultProtocol));if(!kS(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=>{Dl(x.from,x.to,o.doc).some(T=>T.mark.type===n.type)||a.addMark(x.from,x.to,n.type.create({href:x.href}))})}}),!!a.steps.length)return a}})}function wS(n){return new _t({key:new dn("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 p=o.target;const f=[];for(;p.nodeName!=="DIV";)f.push(p),p=p.parentNode;l=f.find(h=>h.nodeName==="A")}if(!l)return a;const c=ih(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 SS(n){return new _t({key:new dn("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=tm(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 _o(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(xS,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var CS=Vr.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){em(n);return}em(n.scheme,n.optionalSlashes)})},onDestroy(){mS()},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)=>!!_o(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=>!!_o(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=>!!_o(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Dt(this.options.HTMLAttributes,n),0]:["a",Dt(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=>!!_o(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=>!!_o(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[er({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:o}=this.options,r=tm(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:a=>!!_o(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(ES({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!_o(r,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(wS({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(SS({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),vS=CS;const NS={class:"zcode-rich-text-editor"},zS={key:0,class:"zcode-rich-text-toolbar"},TS=s.defineComponent({__name:"RichTextEditor",props:{modelValue:{type:String},placeholder:{type:String}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,r=fw({extensions:[mw,yw,xw,vw,Iw,Rw,Jw,Xw,Yw,Zw,vS.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",zS,[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(Im),{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(Dm),{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(Vm),{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($m),{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(Pm),{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(Rm),{size:16})],2)])):s.createCommentVNode("",!0),s.createVNode(s.unref(pw),{editor:s.unref(r),class:"zcode-rich-text-editor-content"},null,8,["editor"])]))}}),MS={class:"zcode-image-modal-header"},AS={class:"zcode-image-modal-header-title",role:"heading","aria-level":"3"},IS=["aria-label"],_S={key:0,class:"zcode-image-current"},OS={class:"zcode-image-current-title",role:"heading","aria-level":"4"},DS={class:"zcode-image-current-item"},RS=["src","alt"],PS={class:"zcode-image-current-name"},$S={class:"zcode-image-tabs"},LS={class:"zcode-image-grid"},VS=["onClick"],BS=["src","alt"],FS={class:"zcode-image-name"},jS={class:"zcode-image-modal-actions"},HS=s.defineComponent({__name:"ImageSelectModal",props:{isOpen:{type:Boolean},imagesCommon:{type:Array},imagesIndividual:{type:Array},imagesSpecial:{type:Array},currentValue:{type:String}},emits:["update:model-value","close"],setup(n,{emit:e}){const t=n,o=e,r=s.ref("common"),i=s.ref(t.currentValue||null),a=s.computed(()=>r.value==="common"?t.imagesCommon:r.value==="individual"?t.imagesIndividual:t.imagesSpecial),l=()=>t.currentValue&&[...t.imagesCommon,...t.imagesIndividual,...t.imagesSpecial].find(f=>f.id===t.currentValue)||null,c=p=>{i.value=p.id},d=()=>{i.value&&(o("update:model-value",i.value),u())},u=()=>{o("close")};return(p,f)=>n.isOpen?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:s.withModifiers(u,["self"])},[s.createElementVNode("div",{class:"zcode-image-modal-content",onClick:f[3]||(f[3]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",MS,[s.createElementVNode("div",AS,s.toDisplayString(p.$t("imagesManager.selectImage")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":p.$t("common.close"),onClick:u},[s.createVNode(s.unref(Ze),{size:18})],8,IS)]),n.currentValue&&l()?(s.openBlock(),s.createElementBlock("div",_S,[s.createElementVNode("div",OS,s.toDisplayString(p.$t("imagesManager.currentlySelected")),1),s.createElementVNode("div",DS,[s.createElementVNode("img",{src:l()?.url,alt:l()?.name||"",class:"zcode-image-current-item-img"},null,8,RS),s.createElementVNode("div",PS,s.toDisplayString(l()?.name),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",$S,[s.createElementVNode("button",{class:s.normalizeClass([{active:r.value==="common"},"zcode-image-tab"]),onClick:f[0]||(f[0]=h=>r.value="common")},s.toDisplayString(p.$t("dataViewer.common")),3),s.createElementVNode("button",{class:s.normalizeClass([{active:r.value==="individual"},"zcode-image-tab"]),onClick:f[1]||(f[1]=h=>r.value="individual")},s.toDisplayString(p.$t("dataViewer.individual")),3),n.imagesSpecial.length>0?(s.openBlock(),s.createElementBlock("button",{key:0,class:s.normalizeClass([{active:r.value==="special"},"zcode-image-tab"]),onClick:f[2]||(f[2]=h=>r.value="special")},s.toDisplayString(p.$t("dataViewer.special")),3)):s.createCommentVNode("",!0)]),s.createElementVNode("div",LS,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(a.value,h=>(s.openBlock(),s.createElementBlock("div",{key:h.id,class:s.normalizeClass([{selected:i.value===h.id},"zcode-image-item"]),onClick:m=>c(h)},[s.createElementVNode("img",{src:h.url,alt:h.name,class:"zcode-image-item-img"},null,8,BS),s.createElementVNode("div",FS,s.toDisplayString(h.name),1)],10,VS))),128))]),s.createElementVNode("div",jS,[i.value?(s.openBlock(),s.createElementBlock("button",{key:0,class:"zcode-btn-primary zcode-image-modal-actions-btn",onClick:d},[s.createVNode(s.unref(dr),{size:16}),s.createElementVNode("span",null,s.toDisplayString(p.$t("imagesManager.select")),1)])):s.createCommentVNode("",!0)])])])):s.createCommentVNode("",!0)}}),US={key:0,class:"zcode-edit-panel-header"},WS={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},qS=["aria-label"],GS={key:1,class:"zcode-parent-selector"},KS={key:2,class:"zcode-group-tabs"},JS=["onClick"],XS={key:3,class:"zcode-field-editor"},YS={class:"zcode-field-item-title",role:"heading","aria-level":"4"},QS={key:0,class:"zcode-text-editor"},ZS=["value","placeholder","maxlength","readonly","disabled","onInput"],eC={key:0,class:"zcode-field-error-message"},tC={key:1,class:"zcode-field-counter"},nC={key:1,class:"zcode-text-editor"},oC=["value","placeholder","maxlength","readonly","disabled","onInput"],rC={key:0,class:"zcode-field-error-message"},iC={key:1,class:"zcode-field-counter"},sC={key:2,class:"zcode-rich-text-editor-wrapper"},aC={key:0,class:"zcode-field-error-message"},lC={key:3,class:"zcode-radio-editor"},cC={class:"zcode-radio-group"},dC=["onUpdate:modelValue","name","value","onChange"],uC={class:"zcode-radio-item-label"},pC={key:4,class:"zcode-checkbox-editor"},fC={class:"zcode-checkbox-group"},hC=["onUpdate:modelValue","value","onChange"],mC={class:"zcode-checkbox-item-label"},gC={key:5,class:"zcode-select-editor"},yC=["onUpdate:modelValue","onChange"],bC=["value"],xC={key:6,class:"zcode-select-editor"},kC=["onUpdate:modelValue","size","onChange"],EC=["value"],wC={key:7,class:"zcode-tag-editor"},SC=["onUpdate:modelValue","onChange"],CC=["value"],vC={class:"zcode-tag-preview"},NC={key:8,class:"zcode-boolean-editor"},zC={class:"zcode-checkbox-item"},TC=["onUpdate:modelValue","onChange"],MC={class:"zcode-checkbox-item-label"},AC={key:9,class:"zcode-image-editor"},IC={class:"zcode-image-editor-buttons"},_C=["onClick"],OC=["title","onClick"],DC={key:0,class:"zcode-image-preview"},RC=["src","alt"],PC={key:4,class:"zcode-edit-fields"},$C={class:"zcode-edit-fields-text"},LC={class:"zcode-edit-fields-text"},nm=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}},emits:["close","select-parent","save-field"],setup(n,{emit:e}){const t=n,o=s.ref("all"),r=s.computed(()=>{const b=new Map;return t.editingAvailableFields.forEach(v=>{const E=v.groupName||"other";b.set(E,(b.get(E)||0)+1)}),Array.from(b.entries()).map(([v,E])=>({name:v,count:E}))}),i=s.computed(()=>r.value.length>1),a=s.computed(()=>!i.value||o.value==="all"?t.editingAvailableFields:t.editingAvailableFields.filter(b=>(b.groupName||"other")===o.value));s.watch(()=>i.value,b=>{b?o.value="all":o.value=void 0},{immediate:!0}),s.watch(()=>t.editingAvailableFields,()=>{if(i.value){if(o.value==="all")return;r.value.some(v=>v.name===o.value)||(o.value="all")}},{deep:!0});const l=e,c=s.ref({});function d(b){const v=b.label||b.fieldName,E=b.currentValue,C=b.type==="rich"&&typeof E=="string"&&E.trim()==="<p></p>"?"":E??"";return b.required&&(C===""||C===void 0||C===null)?`${v}は必須です`:typeof b.maxLength=="number"&&b.maxLength>0&&String(C).length>b.maxLength?`${v}は${b.maxLength}文字以内で入力してください`:null}function u(b,v){v?c.value[b]=v:delete c.value[b]}function p(b){return c.value[b]||t.fieldErrors?.[b]||null}const f=s.ref(!1),h=s.ref(null),m=b=>{h.value=b,f.value=!0},g=()=>{f.value=!1,h.value=null},y=b=>{b.currentValue="",l("save-field",b)},x=b=>{h.value&&(h.value.currentValue=b||"",l("save-field",h.value))},T=b=>b&&[...t.imagesCommon,...t.imagesIndividual,...t.imagesSpecial].find(C=>C.id===b)?.url||null,S=(b,v)=>{const E=v.target;b.currentValue=E.value,u(b.fieldName,d(b)),l("save-field",b)},z=(b,v)=>{b.optional&&v===""?b.currentValue=void 0:b.currentValue=v,u(b.fieldName,d(b)),l("save-field",b)};return(b,v)=>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:v[3]||(v[3]=s.withModifiers(()=>{},["stop"]))},[n.previewMode?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("div",US,[s.createElementVNode("div",WS,s.toDisplayString(b.$t("editPanel.editing",{type:n.editingComponent.type})),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":b.$t("common.close"),onClick:v[0]||(v[0]=E=>b.$emit("close"))},[s.createVNode(s.unref(Ze),{size:18})],8,qS)])),!n.previewMode&&n.canSelectParent?(s.openBlock(),s.createElementBlock("div",GS,[s.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:v[1]||(v[1]=E=>b.$emit("select-parent"))},[s.createVNode(s.unref(ai),{size:16}),s.createElementVNode("span",null,s.toDisplayString(b.$t("addPanel.selectParent")),1)])])):s.createCommentVNode("",!0),i.value?(s.openBlock(),s.createElementBlock("div",KS,[s.createElementVNode("button",{class:s.normalizeClass([{active:o.value==="all"},"zcode-group-tab"]),onClick:v[2]||(v[2]=E=>o.value="all")}," all ",2),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r.value,E=>(s.openBlock(),s.createElementBlock("button",{key:E.name,class:s.normalizeClass([{active:o.value===E.name},"zcode-group-tab"]),onClick:C=>o.value=E.name},s.toDisplayString(E.name),11,JS))),128))])):s.createCommentVNode("",!0),a.value.length>0?(s.openBlock(),s.createElementBlock("div",XS,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(a.value,E=>(s.openBlock(),s.createElementBlock("div",{key:E.fieldName,class:"zcode-field-item"},[s.createElementVNode("div",YS,s.toDisplayString(E.label),1),E.type==="text"?(s.openBlock(),s.createElementBlock("div",QS,[s.createElementVNode("input",{type:"text",value:E.currentValue??"",placeholder:E.defaultValue,maxlength:E.maxLength,readonly:E.readonly,disabled:E.disabled,class:s.normalizeClass([{"zcode-field-error":p(E.fieldName)},"zcode-text-input"]),onInput:C=>S(E,C)},null,42,ZS),p(E.fieldName)?(s.openBlock(),s.createElementBlock("div",eC,s.toDisplayString(p(E.fieldName)),1)):s.createCommentVNode("",!0),E.maxLength?(s.openBlock(),s.createElementBlock("div",tC,s.toDisplayString(String(E.currentValue??"").length)+" / "+s.toDisplayString(E.maxLength),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),E.type==="textarea"?(s.openBlock(),s.createElementBlock("div",nC,[s.createElementVNode("textarea",{value:E.currentValue??"",placeholder:E.defaultValue,maxlength:E.maxLength,readonly:E.readonly,disabled:E.disabled,class:s.normalizeClass([{"zcode-field-error":p(E.fieldName)},"zcode-textarea"]),rows:"4",onInput:C=>S(E,C)},null,42,oC),p(E.fieldName)?(s.openBlock(),s.createElementBlock("div",rC,s.toDisplayString(p(E.fieldName)),1)):s.createCommentVNode("",!0),E.maxLength?(s.openBlock(),s.createElementBlock("div",iC,s.toDisplayString(String(E.currentValue??"").length)+" / "+s.toDisplayString(E.maxLength),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),E.type==="rich"?(s.openBlock(),s.createElementBlock("div",sC,[s.createVNode(TS,{"model-value":E.currentValue??"",placeholder:E.defaultValue,"onUpdate:modelValue":C=>z(E,C)},null,8,["model-value","placeholder","onUpdate:modelValue"]),p(E.fieldName)?(s.openBlock(),s.createElementBlock("div",aC,s.toDisplayString(p(E.fieldName)),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),E.type==="radio"?(s.openBlock(),s.createElementBlock("div",lC,[s.createElementVNode("div",cC,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(E.options,C=>(s.openBlock(),s.createElementBlock("label",{key:C,class:"zcode-radio-item"},[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":M=>E.currentValue=M,type:"radio",name:E.fieldName,value:C,onChange:M=>b.$emit("save-field",E)},null,40,dC),[[s.vModelRadio,E.currentValue]]),s.createElementVNode("span",uC,s.toDisplayString(C),1)]))),128))])])):s.createCommentVNode("",!0),E.type==="checkbox"?(s.openBlock(),s.createElementBlock("div",pC,[s.createElementVNode("div",fC,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(E.options,C=>(s.openBlock(),s.createElementBlock("label",{key:C,class:"zcode-checkbox-item"},[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":M=>E.currentValue=M,type:"checkbox",value:C,onChange:M=>b.$emit("save-field",E)},null,40,hC),[[s.vModelCheckbox,E.currentValue]]),s.createElementVNode("span",mC,s.toDisplayString(C),1)]))),128))])])):s.createCommentVNode("",!0),E.type==="select"?(s.openBlock(),s.createElementBlock("div",gC,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":C=>E.currentValue=C,class:"zcode-select",onChange:C=>b.$emit("save-field",E)},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(E.options,C=>(s.openBlock(),s.createElementBlock("option",{key:C,value:C},s.toDisplayString(C),9,bC))),128))],40,yC),[[s.vModelSelect,E.currentValue]])])):s.createCommentVNode("",!0),E.type==="select-multiple"?(s.openBlock(),s.createElementBlock("div",xC,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":C=>E.currentValue=C,class:"zcode-select",multiple:"",size:Math.min(E.options?.length||3,5),onChange:C=>b.$emit("save-field",E)},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(E.options,C=>(s.openBlock(),s.createElementBlock("option",{key:C,value:C},s.toDisplayString(C),9,EC))),128))],40,kC),[[s.vModelSelect,E.currentValue]])])):s.createCommentVNode("",!0),E.type==="tag"?(s.openBlock(),s.createElementBlock("div",wC,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":C=>E.currentValue=C,class:"zcode-select",onChange:C=>b.$emit("save-field",E)},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(E.options,C=>(s.openBlock(),s.createElementBlock("option",{key:C,value:C},s.toDisplayString(C),9,CC))),128))],40,SC),[[s.vModelSelect,E.currentValue]]),s.createElementVNode("div",vC,[v[4]||(v[4]=s.createTextVNode(" 現在のタグ: ",-1)),s.createElementVNode("code",null,"<"+s.toDisplayString(E.currentValue)+">",1)])])):s.createCommentVNode("",!0),E.type==="boolean"?(s.openBlock(),s.createElementBlock("div",NC,[s.createElementVNode("label",zC,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":C=>E.currentValue=C,type:"checkbox",onChange:C=>b.$emit("save-field",E)},null,40,TC),[[s.vModelCheckbox,E.currentValue]]),s.createElementVNode("span",MC,s.toDisplayString(E.label)+"を表示",1)])])):s.createCommentVNode("",!0),E.type==="image"?(s.openBlock(),s.createElementBlock("div",AC,[s.createElementVNode("div",IC,[s.createElementVNode("button",{class:"zcode-image-select-btn",onClick:C=>m(E)},[s.createVNode(s.unref(li),{size:16}),s.createElementVNode("span",null,s.toDisplayString(E.currentValue?b.$t("editPanel.replaceImage"):b.$t("editPanel.selectImage")),1)],8,_C),E.currentValue?(s.openBlock(),s.createElementBlock("button",{key:0,class:"zcode-image-clear-btn",title:b.$t("editPanel.clearImageTitle"),onClick:C=>y(E)},[s.createVNode(s.unref(Ze),{size:16}),s.createElementVNode("span",null,s.toDisplayString(b.$t("editPanel.clearImage")),1)],8,OC)):s.createCommentVNode("",!0)]),T(E.currentValue)?(s.openBlock(),s.createElementBlock("div",DC,[s.createElementVNode("img",{src:T(E.currentValue)||"",alt:E.label,class:"zcode-image-preview-img"},null,8,RC)])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)]))),128))])):!i.value||a.value.length===0?(s.openBlock(),s.createElementBlock("div",PC,[s.createElementVNode("div",$C,s.toDisplayString(b.$t("editPanel.id",{id:n.editingComponent.id})),1),s.createElementVNode("div",LC,"Type: "+s.toDisplayString(n.editingComponent.type),1)])):s.createCommentVNode("",!0),s.createVNode(HS,{"is-open":f.value,"images-common":n.imagesCommon,"images-individual":n.imagesIndividual,"images-special":n.imagesSpecial,"current-value":h.value?.currentValue||void 0,"onUpdate:modelValue":x,onClose:g},null,8,["is-open","images-common","images-individual","images-special","current-value"])],2)):s.createCommentVNode("",!0)}}),VC={class:"zcode-delete-panel-header"},BC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},FC=["aria-label"],jC={key:0,class:"zcode-parent-selector"},HC={class:"zcode-delete-panel-content"},UC={class:"zcode-delete-warning"},WC={class:"zcode-delete-warning-text"},qC={class:"zcode-delete-actions"},GC=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",VC,[s.createElementVNode("div",BC,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(Ze),{size:18})],8,FC)]),n.canSelectParent?(s.openBlock(),s.createElementBlock("div",jC,[s.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:t[1]||(t[1]=o=>e.$emit("select-parent"))},[s.createVNode(s.unref(ai),{size:16}),s.createElementVNode("span",null,s.toDisplayString(e.$t("deletePanel.selectParent")),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",HC,[s.createElementVNode("div",UC,[s.createVNode(s.unref(Rc),{size:20,class:"zcode-delete-warning-icon"}),s.createElementVNode("div",WC,s.toDisplayString(e.$t("deletePanel.confirmMessage")),1)]),s.createElementVNode("div",qC,[s.createElementVNode("button",{class:"zcode-btn-danger",onClick:t[2]||(t[2]=o=>e.$emit("confirm"))},[s.createVNode(s.unref(mo),{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(Ze),{size:16}),s.createElementVNode("span",null,s.toDisplayString(e.$t("common.cancel")),1)])])])])):s.createCommentVNode("",!0)}}),KC={class:"zcode-reorder-panel-header"},JC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},XC=["aria-label"],YC={key:0,class:"zcode-parent-selector"},QC={class:"zcode-reorder-panel-content"},ZC={class:"zcode-reorder-panel-content-text"},ev={class:"zcode-reorder-source"},tv=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",KC,[s.createElementVNode("div",JC,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(Ze),{size:18})],8,XC)]),n.canSelectParent?(s.openBlock(),s.createElementBlock("div",YC,[s.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:t[1]||(t[1]=o=>e.$emit("select-parent"))},[s.createVNode(s.unref(ai),{size:16}),s.createElementVNode("span",null,s.toDisplayString(e.$t("reorderPanel.selectParent")),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",QC,[s.createElementVNode("div",ZC,s.toDisplayString(e.$t("reorderPanel.instruction")),1),s.createElementVNode("div",ev,s.toDisplayString(e.$t("reorderPanel.source",{path:n.reorderSourcePath})),1)])])):s.createCommentVNode("",!0)}}),nv={class:"zcode-add-panel-header"},ov={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},rv=["aria-label"],iv={key:0,class:"zcode-parent-selector"},sv={class:"zcode-part-category-tabs"},av=["onClick"],lv={key:1,class:"zcode-type-tabs"},cv=["onClick"],dv={class:"zcode-add-panel-content"},uv={class:"zcode-part-list"},pv={class:"zcode-part-type-section"},fv={class:"zcode-type-section-title",role:"heading","aria-level":"3"},hv={class:"zcode-type-section-description"},mv={key:0,class:"zcode-module-buttons"},gv={class:"zcode-module-preview-header"},yv={class:"zcode-module-preview-label zcode-module-preview-label-header"},bv=["aria-label"],xv=["innerHTML"],kv={key:1,class:"zcode-empty-parts"},Ev={class:"zcode-empty-parts-text"},wv={class:"zcode-type-section-title",role:"heading","aria-level":"3"},Sv={key:0,class:"zcode-type-section-description"},Cv={class:"zcode-module-buttons"},vv=["onClick"],Nv={class:"zcode-module-preview-header"},zv={class:"zcode-module-preview-label zcode-module-preview-label-header"},Tv=["aria-label","onClick"],Mv=["innerHTML"],Av={key:0,class:"zcode-empty-parts"},Iv={class:"zcode-empty-parts-text"},_v={key:2,class:"zcode-insert-position"},Ov={class:"zcode-insert-header"},Dv={class:"zcode-keep-adding-label zcode-keep-adding-label-position"},Rv=["checked"],Pv={class:"zcode-insert-buttons"},$v={class:"zcode-preview-modal-header"},Lv={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},Vv=["innerHTML"],Bv=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",nv,[s.createElementVNode("div",ov,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]=p=>d.$emit("cancel"))},[s.createVNode(s.unref(Ze),{size:18})],8,rv)]),n.canSelectParent?(s.openBlock(),s.createElementBlock("div",iv,[s.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:u[1]||(u[1]=p=>d.$emit("select-parent"))},[s.createVNode(s.unref(ai),{size:16}),s.createElementVNode("span",null,s.toDisplayString(d.$t("addPanel.selectParent")),1)])])):s.createCommentVNode("",!0),s.createElementVNode("div",sv,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(o.value,p=>(s.openBlock(),s.createElementBlock("button",{key:p,class:s.normalizeClass([{active:n.addPartCategory===p&&n.addTypeTab!=="selected"},"zcode-category-tab"]),onClick:f=>d.$emit("category-tab-click",p)},s.toDisplayString(p==="common"?d.$t("addPanel.category.common"):p==="individual"?d.$t("addPanel.category.individual"):d.$t("dataViewer.special")),11,av))),128)),s.createElementVNode("button",{class:s.normalizeClass([{active:n.addTypeTab==="selected"},"zcode-category-tab"]),onClick:u[2]||(u[2]=p=>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",lv,[s.createElementVNode("button",{class:s.normalizeClass([{active:n.addTypeTab==="all"},"zcode-type-tab"]),onClick:u[3]||(u[3]=p=>d.$emit("type-tab-click","all"))}," all ",2),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(n.availablePartTypes,p=>(s.openBlock(),s.createElementBlock("button",{key:p,class:s.normalizeClass([{active:n.addTypeTab===p},"zcode-type-tab"]),onClick:f=>d.$emit("type-tab-click",p)},s.toDisplayString(p),11,cv))),128))])):s.createCommentVNode("",!0),s.createElementVNode("div",dv,[s.createElementVNode("div",uv,[s.withDirectives(s.createElementVNode("div",pv,[s.createElementVNode("div",fv,s.toDisplayString(d.$t("addPanel.activeParts")),1),s.createElementVNode("div",hv,s.toDisplayString(d.$t("addPanel.activePartsDescription")),1),n.clickedComponent&&n.addSelectedPart&&n.addSelectedType?(s.openBlock(),s.createElementBlock("div",mv,[s.createElementVNode("div",{class:s.normalizeClass([{active:!0},"zcode-module-preview"])},[s.createElementVNode("div",gv,[s.createElementVNode("div",yv,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(p=>l(),["stop"]))},[s.createVNode(s.unref(Pc),{size:14})],8,bv)]),s.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:n.getClickedComponentPreviewHtml()},null,8,xv)])])):(s.openBlock(),s.createElementBlock("div",kv,[s.createElementVNode("div",Ev,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,p=>(s.openBlock(),s.createElementBlock("div",{key:p.type,class:"zcode-part-type-section"},[s.createElementVNode("div",wv,s.toDisplayString(p.type),1),p.description?(s.openBlock(),s.createElementBlock("div",Sv,s.toDisplayString(p.description),1)):s.createCommentVNode("",!0),s.createElementVNode("div",Cv,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(p.parts,f=>(s.openBlock(),s.createElementBlock("div",{key:f.title,class:s.normalizeClass([{active:n.addTypeTab==="selected"&&n.clickedComponent?.part_id===f.id&&n.clickedComponent?.id?!0:n.addTypeTab!=="selected"&&n.addSelectedPart?.id===f.id},"zcode-module-preview"]),onClick:h=>d.$emit("select-part",p.typeData,f)},[s.createElementVNode("div",Nv,[s.createElementVNode("div",zv,s.toDisplayString(f.title),1),s.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:s.withModifiers(h=>a(p.typeData,f),["stop"])},[s.createVNode(s.unref(Pc),{size:14})],8,Tv)]),s.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:n.getPartPreviewHtml(p.typeData,f)},null,8,Mv)],10,vv))),128))])]))),128)),n.groupedPartsByType.length===0&&!n.addSelectedPart?(s.openBlock(),s.createElementBlock("div",Av,[s.createElementVNode("div",Iv,s.toDisplayString(d.$t("addPanel.noPartsAvailable")),1)])):s.createCommentVNode("",!0)],512),[[s.vShow,n.addTypeTab!=="selected"]])])]),n.addSelectedPart?(s.openBlock(),s.createElementBlock("div",_v,[s.createElementVNode("div",Ov,[u[10]||(u[10]=s.createElementVNode("div",{class:"zcode-insert-position-title",role:"heading","aria-level":"4"},"追加位置を選択",-1)),s.createElementVNode("label",Dv,[s.createElementVNode("input",{type:"checkbox",checked:n.keepAdding,class:"zcode-keep-adding-checkbox",onChange:u[5]||(u[5]=p=>d.$emit("update-keep-adding",p.target.checked))},null,40,Rv),s.createElementVNode("span",null,s.toDisplayString(d.$t("addPanel.continueAdding")),1)])]),s.createElementVNode("div",Pv,[s.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-before",onClick:u[6]||(u[6]=p=>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]=p=>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",$v,[s.createElementVNode("div",Lv,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(Ze),{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,Vv)])])):s.createCommentVNode("",!0)]))])):s.createCommentVNode("",!0)}}),Fv=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(Dc),{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(Do),{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(cr),{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(mo),{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(Ze),{size:16}),s.createElementVNode("span",null,s.toDisplayString(i.$t("contextMenu.close")),1)])],4)):s.createCommentVNode("",!0)}});function jv(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 Hv(n,e){const t=Aa(n.part_id,e);if(!t)return;qn(t.body).forEach(r=>{r.optional||n[r.fieldName]===void 0&&(n[r.fieldName]=jv(r))})}function Uv(n){function e(t){Hv(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 gc(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):[],p=n.imagesSpecial?JSON.parse(n.imagesSpecial):[],f=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:f,individual:h,special:m},parts:{common:a,individual:l,special:c},images:{common:d,individual:u,special:p},backendData:g}),Uv(e)}catch(i){ge.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 Wv(){const n=s.ref("edit"),e=s.ref(!1);function t(o){n.value=o}return{currentMode:n,switchMode:t,allowDynamicContentInteraction:e}}function om(n,e){return qn(n.body).map(o=>{const r={fieldName:o.fieldName,groupName:o.groupName,label:yb(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:[]}})}const yc="zcode-outline-active-",bc="zcode-outline-hover-";function Gs(n,e){Array.from(n.classList).filter(o=>o.startsWith(e)).forEach(o=>n.classList.remove(o))}function Qt(n,e){Gs(n,yc),n.classList.add("zcode-outline-active"),n.classList.add(`${yc}${e}`)}function Zt(n){n.classList.remove("zcode-outline-active"),Gs(n,yc)}function xc(n,e){Gs(n,bc),n.classList.add("zcode-outline-hover"),n.classList.add(`${bc}${e}`)}function pn(n){n.classList.remove("zcode-outline-hover"),Gs(n,bc)}function qv(n,e){const t=s.ref(null),o=s.ref(-1),r=s.ref(""),i=s.ref([]);function a(u){const p=u.part_id,f=n.parts,h=[...f.common,...f.individual];let m=null;for(const g of h){const y=g.parts.find(x=>x.id===p);if(y){m=y;break}}return m?om(m,u):[]}function l(u,p){if(r.value===u){d();return}const f=u.split(".");let h=-1;if(f[0]==="page"&&f.length>=2&&(h=parseInt(f[1])),r.value&&e.value){const m=e.value.querySelector(`[data-zcode-path="${r.value}"]`);m&&Zt(m)}t.value=p,o.value=h,r.value=u,i.value=a(p),s.nextTick(()=>{if(e.value&&r.value===u){const m=e.value.querySelector(`[data-zcode-path="${u}"]`);m&&(Qt(m,"edit"),sn(m))}})}function c(u){if(t.value&&r.value){const p=ln(r.value,n);p&&(u.optional&&(u.currentValue===""||u.currentValue===null)?p[u.fieldName]=void 0:p[u.fieldName]=u.currentValue)}}function d(){if(r.value&&e.value){const u=e.value.querySelector(`[data-zcode-path="${r.value}"]`);u&&(Zt(u),sn(u))}t.value=null,r.value="",i.value=[]}return{editingComponent:t,editingComponentIndex:o,editingComponentPath:r,editingAvailableFields:i,handleEditClick:l,saveFieldEdit:c,closeEditPanel:d}}function Gv(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 p(P){if(P.includes(".slots.")){const L=P.split(".");let V=-1;for(let F=L.length-1;F>=0;F--)if(L[F]==="slots"){V=F;break}if(V!==-1&&V+1<L.length)return L.slice(0,V+2).join(".")}return P}const f=s.computed(()=>{const P=n.parts,L=l.value==="common"?P.common:l.value==="individual"?P.individual:P.special;if(r.value&&r.value.includes(".slots.")){const F=[...P.common,...P.individual,...P.special],H=p(r.value);return g(H,F,L)}return[...new Set(L.map(F=>F.type))]});function h(P,L){const V=P.split(".");let F=-1;for(let Y=V.length-1;Y>=0;Y--)if(V[Y]==="slots"){F=Y;break}if(F===-1)return null;const H=V.slice(0,F).join("."),U=V[F+1],G=ln(H,n);if(!G)return null;const K=G.part_id;let J=null;for(const Y of L)if(Y.parts.some(te=>te.id===K)){J=Y;break}if(!J)return null;const ee=(J.parts.find(Y=>Y.id===K)||J.parts[0])?.slots?.[U];if(ee){const Y=ee.allowedParts;if(Y&&Array.isArray(Y))return Y}return null}const m=s.computed(()=>{const P=n.parts,L=l.value==="common"?P.common:l.value==="individual"?P.individual:P.special,V=f.value;let F=L.filter(K=>V.includes(K.type));c.value&&c.value!=="all"&&c.value!=="selected"&&(F=F.filter(K=>K.type===c.value));const H=[...P.common,...P.individual],U=r.value&&r.value.includes(".slots.")?h(p(r.value),H):null,G=new Map;return F.forEach(K=>{G.has(K.type)||G.set(K.type,{type:K,parts:[]});const J=G.get(K.type);U!==null?U.length>0&&K.parts.forEach(ne=>{U.includes(ne.id)&&J.parts.push(ne)}):K.parts.forEach(ne=>{ne.slotOnly||J.parts.push(ne)})}),Array.from(G.values()).map(K=>({type:K.type.type,description:K.type.description,typeData:K.type,parts:K.parts}))});function g(P,L,V){const F=P.split(".");let H=-1;for(let te=F.length-1;te>=0;te--)if(F[te]==="slots"){H=te;break}if(H===-1)return[...new Set(V.map(te=>te.type))];const U=F.slice(0,H).join("."),G=F[H+1],K=ln(U,n);if(!K)return[...new Set(V.map(te=>te.type))];const J=K.part_id;let ne=null,ee=null;for(const te of L){const se=te.parts.find(ce=>ce.id===J);if(se){ne=te,ee=se;break}}if(!ne||!ee)return[...new Set(V.map(te=>te.type))];const Y=ee?.slots?.[G];if(Y){const te=Y.allowedParts;if(te&&Array.isArray(te)){const se=new Set;L.forEach(ke=>{ke.parts.forEach(Se=>{te.includes(Se.id)&&se.add(ke.type)})});let ce=Array.from(se);return ce=ce.filter(ke=>V.some(Se=>Se.type===ke)),ce}}return[...new Set(V.map(te=>te.type))]}function y(P,L=!1){if(r.value===P){D();return}if(r.value&&e.value){const ce=e.value.querySelector(`[data-zcode-path="${r.value}"]`);ce&&Zt(ce);const ke=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);ke&&Zt(ke)}r.value=P,c.value="all",l.value="common",i.value=null,a.value=null;const V=ln(P,n);V&&V.part_id?d.value=V:d.value=null;const F=n.parts,H=F.common,U=F.individual,G=F.special;let K=[],J=[];if(P.includes(".slots.")){const ce=[...H,...U,...G],ke=p(P);K=g(ke,ce,H),J=g(ke,ce,U)}else K=[...new Set(H.map(ce=>ce.type))],J=[...new Set(U.map(ce=>ce.type))];const ne=K.length>0,ee=J.length>0,Y=G.length>0,te=o?.categoryOrder;let se;te==="special"&&Y?se="special":te==="individual"&&ee?se="individual":te==="common"&&ne||ne?se="common":ee?se="individual":Y?se="special":se="common",l.value=se,s.nextTick(()=>{if(e.value&&r.value===P){const ce=e.value.querySelector(`[data-zcode-path="${P}"]`);if(ce)Qt(ce,"add"),sn(ce);else{const ke=p(P);if(ke!==P){const Se=e.value.querySelector(`[data-zcode-slot-path="${ke}"]`);Se&&(Qt(Se,"add"),sn(Se))}}}})}function x(P){l.value=P,c.value="all",i.value=null,a.value=null,u.value=!1}function T(P){if(c.value=P,P==="selected"&&d.value&&d.value.part_id){const L=n.parts,V=[...L.common,...L.individual,...L.special];for(const F of V){const H=F.parts.find(U=>U.id===d.value.part_id);if(H){i.value=F,a.value=H;break}}}else P!=="selected"&&(i.value=null,a.value=null);u.value=!1}function S(P,L){const V=b(P,L);return t(V,"")}function z(){return d.value?t(d.value,""):""}function b(P,L){const V=E(P,!1,new Set,L.id);return V.id="preview",V}function v(P,L){if(a.value?.id===L.id){i.value=null,a.value=null;return}i.value=P,a.value=L,c.value==="selected"&&(c.value="all"),u.value=!1}function E(P,L=!1,V=new Set,F){const H=F?P.parts.find(ee=>ee.id===F)||P.parts[0]:L&&a.value?a.value:P.parts[0];if(!H)throw new Error(`Part not found for type: ${P.type}`);const U=`${P.id}:${H.id}`;if(V.has(U)){const ee=qn(H.body),Y={};return ee.forEach(te=>{te.optional?Y[te.fieldName]=void 0:te.type==="text"?Y[te.fieldName]=te.defaultValue:te.type==="radio"?Y[te.fieldName]=te.options?.[0]:te.type==="checkbox"?Y[te.fieldName]=[]:te.type==="boolean"?Y[te.fieldName]=!0:te.type==="rich"?Y[te.fieldName]=te.defaultValue?`<p>${te.defaultValue}</p>`:"<p></p>":te.type==="image"&&(Y[te.fieldName]=te.defaultValue||"")}),{id:Gn(),part_id:H.id,...Y}}V.add(U);const G=qn(H.body),K={};G.forEach(ee=>{ee.optional?K[ee.fieldName]=void 0:ee.type==="text"?K[ee.fieldName]=ee.defaultValue:ee.type==="radio"?K[ee.fieldName]=ee.options?.[0]:ee.type==="checkbox"?K[ee.fieldName]=[]:ee.type==="boolean"?K[ee.fieldName]=!0:ee.type==="rich"?K[ee.fieldName]=ee.defaultValue?`<p>${ee.defaultValue}</p>`:"<p></p>":ee.type==="image"&&(K[ee.fieldName]=ee.defaultValue||"")});const J={id:Gn(),part_id:H.id,...K},ne=H.slots;if(ne){const ee={};Object.entries(ne).forEach(([Y,te])=>{const se=te.allowedParts;if(se&&se.length===1){const ce=se[0],ke=n.parts,Se=[...ke.common,...ke.individual,...ke.special];let Oe=null,N=null;for(const X of Se){const oe=X.parts.find(k=>k.id===ce);if(oe){Oe=X,N=oe;break}}if(Oe&&N){const X=E(Oe,!1,V,N.id);ee[Y]=[X]}else ee[Y]=[]}else ee[Y]=[]}),Object.keys(ee).length>0&&(J.slots=ee)}return J}function C(P){return E(P,!0)}function M(P){if(!i.value||!a.value||!r.value){ge.error("Missing required values:",{addSelectedType:i.value,addSelectedPart:a.value,addTargetPath:r.value});return}let L;if(c.value==="selected"&&d.value){if(L=JSON.parse(JSON.stringify(d.value)),L.id=Gn(),L.slots){const U=G=>{G.forEach(K=>{K.id=Gn(),K.slots&&Object.values(K.slots).forEach(J=>{Array.isArray(J)?U(J):J&&typeof J=="object"&&J.children&&U(J.children||[])})})};Object.values(L.slots).forEach(G=>{Array.isArray(G)?U(G):G&&typeof G=="object"&&G.children&&U(G.children||[])})}}else L=C(i.value);const V=r.value,F=V.split(".");let H=null;if(F[0]==="page"&&F.length===2){const U=parseInt(F[1]);P==="before"?(n.page.splice(U,0,L),H=`page.${U}`,u.value&&(r.value=`page.${U+1}`)):(n.page.splice(U+1,0,L),H=`page.${U+1}`)}else if(F.includes("slots")){const U=p(V),G=U.split(".");let K=-1;for(let ce=G.length-1;ce>=0;ce--)if(G[ce]==="slots"){K=ce;break}if(K===-1||K>=G.length-1){ge.error("Invalid slot path:",U);return}const J=G.slice(0,K).join("."),ne=G[K+1],ee=V!==U?parseInt(F[F.length-1]):-1,Y=ln(J,n);if(!Y){ge.error("Parent component not found:",J);return}Y.slots||(Y.slots={});const te=Y.slots[ne];let se=[];if(Array.isArray(te)?se=te:te&&typeof te=="object"&&te.children?(se=te.children||[],te.children||(te.children=[])):(Y.slots[ne]=[],se=Y.slots[ne]),ee===-1)se.push(L),H=`${U}.${se.length-1}`;else{const ce=P==="before"?ee:ee+1;if(P==="before"){if(se.splice(ee,0,L),H=`${U}.${ee}`,u.value){const ke=p(V);if(V!==ke){const Se=[...F];Se[Se.length-1]=String(ee+1),r.value=Se.join(".")}else{const Oe=[...ke.split(".")];Oe.push("0"),r.value=Oe.join(".")}}}else se.splice(ce,0,L),H=`${U}.${ce}`}Array.isArray(Y.slots[ne])||(Y.slots[ne].children=se)}if(d.value||c.value==="selected"&&(c.value="all"),!u.value)D({scrollBack:!1});else if(P==="before"&&e.value&&r.value){const U=e.value.querySelector(`[data-zcode-path="${V}"]`);U&&Zt(U),s.nextTick(()=>{if(e.value&&r.value){const G=e.value.querySelector(`[data-zcode-path="${r.value}"]`);G&&Qt(G,"add")}})}H&&s.nextTick(()=>{if(!e.value)return;const U=e.value.querySelector(`[data-zcode-path="${H}"]`);U&&sn(U)})}function D(P={}){const{scrollBack:L=!0}=P;if(r.value&&e.value){const V=e.value.querySelector(`[data-zcode-path="${r.value}"]`);V&&(Zt(V),L&&sn(V));const F=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);F&&(Zt(F),L&&sn(F))}r.value=null,i.value=null,a.value=null,d.value=null,l.value="common",c.value="all",u.value=!1}const $=s.computed(()=>n.parts.special.length>0);return{addTargetPath:r,addSelectedType:i,addSelectedPart:a,clickedComponent:d,addPartCategory:l,addTypeTab:c,keepAdding:u,availablePartTypes:f,groupedPartsByType:m,hasSpecialParts:$,handleAddClick:y,handleCategoryTabClick:x,handleTypeTabClick:T,selectPart:v,getPartPreviewHtml:S,getClickedComponentPreviewHtml:z,confirmAddPart:M,cancelAdd:D}}function Kv(n,e,t,o){const r=s.ref(null),i=s.ref("");function a(p,f){if(i.value===p){u();return}if(i.value&&e.value){const h=e.value.querySelector(`[data-zcode-path="${i.value}"]`);h&&Zt(h)}r.value=f,i.value=p,o(()=>{if(e.value&&i.value===p){const h=e.value.querySelector(`[data-zcode-path="${p}"]`);h&&(Qt(h,"delete"),sn(h))}})}function l(){if(!i.value)return;const p=i.value,f=p.split(".");let h=null,m=null;if(f.length===2&&f[0]==="page"){const g=parseInt(f[1]);!isNaN(g)&&g>=0&&g<n.page.length&&(n.page.splice(g,1),n.page.length===0&&o(()=>{t("add")}))}else if(f.length>2&&f[0]==="page"){const g=parseInt(f[1]);if(isNaN(g)||g<0||g>=n.page.length){ge.error("Invalid top-level index:",g),u();return}let y=n.page[g];const x=f.slice(2);x.length>=3&&x[0]==="slots"&&(m=x[1],h=`page.${g}`);for(let S=0;S<x.length-1;S++){if(!y||typeof y!="object"){ge.error("Invalid path:",p),u();return}y=y[x[S]]}const T=x[x.length-1];if(y&&typeof y=="object")if(Array.isArray(y)){const S=parseInt(T);!isNaN(S)&&S>=0&&S<y.length?y.splice(S,1):ge.error("Invalid array index:",T)}else T in y?delete y[T]:ge.error("Field not found:",p);else ge.error("Invalid current object:",p)}h&&m&&o(()=>{c(h,m)}),u()}function c(p,f){const h=ln(p,n);if(!h)return;const m=h.slots;if(!m||!Array.isArray(m[f]))return;const g=m[f];if(g.length===0){const y=h.part_id,x=n.parts,T=[...x.common,...x.individual];let S=null,z=null;for(const v of T){const E=v.parts.find(C=>C.id===y);if(E){S=v,z=E;break}}if(!S||!z)return;const b=z?.slots?.[f];if(b){const v=b.allowedParts;if(v&&v.length===1){const E=v[0];let C=null,M=null;for(const D of T){const $=D.parts.find(P=>P.id===E);if($){C=D,M=$;break}}if(C&&M){const D=d(C,M.id);g.push(D)}}}}}function d(p,f){const h=f&&p.parts.find(T=>T.id===f)||p.parts[0];if(!h)throw new Error(`Part not found for type: ${p.type}`);const m=qn(h.body),g={};m.forEach(T=>{T.optional?g[T.fieldName]=void 0:T.type==="text"?g[T.fieldName]=T.defaultValue:T.type==="radio"?g[T.fieldName]=T.options?.[0]:T.type==="checkbox"?g[T.fieldName]=[]:T.type==="boolean"?g[T.fieldName]=!0:T.type==="rich"?g[T.fieldName]=T.defaultValue?`<p>${T.defaultValue}</p>`:"<p></p>":T.type==="image"&&(g[T.fieldName]=T.defaultValue||"")});const y={id:Gn(),part_id:h.id,...g},x=h.slots;if(x){const T={};Object.entries(x).forEach(([S,z])=>{const b=z.allowedParts;if(b&&b.length===1){const v=b[0],E=n.parts,C=[...E.common,...E.individual];let M=null,D=null;for(const $ of C){const P=$.parts.find(L=>L.id===v);if(P){M=$,D=P;break}}if(M&&D){const $=d(M,D.id);T[S]=[$]}else T[S]=[]}else T[S]=[]}),Object.keys(T).length>0&&(y.slots=T)}return y}function u(){if(i.value&&e.value){const p=e.value.querySelector(`[data-zcode-path="${i.value}"]`);p&&(Zt(p),sn(p))}r.value=null,i.value=""}return{deleteConfirmComponent:r,deleteConfirmPath:i,handleDeleteClick:a,confirmDelete:l,cancelDelete:u}}function Jv(n,e){const t=s.ref(""),o=s.ref(null);let r=null;function i(d,u){if(!d||!u)return!1;const p=d.split("."),f=u.split(".");if(p.length!==f.length||d===u)return!1;if(p.includes("slots")&&f.includes("slots")){let h=-1,m=-1;for(let S=p.length-1;S>=0;S--)if(p[S]==="slots"){h=S;break}for(let S=f.length-1;S>=0;S--)if(f[S]==="slots"){m=S;break}if(h===-1||m===-1)return!1;const g=p.slice(0,h).join("."),y=f.slice(0,m).join(".");if(g!==y)return!1;const x=p[h+1],T=f[m+1];return x===T}if(p.length>2){const h=p.slice(0,-1).join("."),m=f.slice(0,-1).join(".");if(h!==m)return!1}return!0}function a(d){if(!d)return;if(!t.value){typeof window<"u"&&(r=window.scrollY);const h=lu(d);if(h&&e.value){const g=e.value.querySelector(`[data-zcode-path="${h}"]`);g&&pn(g)}t.value=d;const m=ln(d,n);if(o.value=m?.id??null,e.value){const g=e.value.querySelector(`[data-zcode-path="${d}"]`);g&&(Qt(g,"reorder"),sn(g))}return}if(t.value===d){l();return}if(!i(t.value,d)){alert("この要素とは並べ替えできません。同じ階層の要素を選択してください。"),l();return}c(t.value,d)||alert("並べ替えに失敗しました。同じ階層の要素を選択してください。");let p=null;const f=o.value;if(f){const h=Ni(n.page,"page",(m,g)=>{if(m.id===f)return g});typeof h=="string"&&(p=h)}l({restoreScroll:!1}),p&&s.nextTick(()=>{if(!e.value)return;const h=e.value.querySelector(`[data-zcode-path="${p}"]`);h&&sn(h)})}function l(d={}){const{restoreScroll:u=!0}=d;if(t.value&&e.value){const p=e.value.querySelector(`[data-zcode-path="${t.value}"]`);p&&Zt(p)}if(u&&typeof window<"u"&&r!==null){const p=Math.max(0,r);window.requestAnimationFrame(()=>{window.scrollTo({top:p,behavior:"smooth"})})}t.value="",o.value=null,r=null}function c(d,u){const p=d.split("."),f=u.split(".");if(p.length===2&&f.length===2&&p[0]==="page"&&f[0]==="page"){const h=parseInt(p[1]),m=parseInt(f[1]);if(!isNaN(h)&&!isNaN(m)&&h!==m&&h>=0&&m>=0&&h<n.page.length&&m<n.page.length){const g=[...n.page],y=g[h];return g[h]=g[m],g[m]=y,n.page=g,!0}return!1}else if(p.includes("slots")&&f.includes("slots")){let h=-1,m=-1;for(let M=p.length-1;M>=0;M--)if(p[M]==="slots"){h=M;break}for(let M=f.length-1;M>=0;M--)if(f[M]==="slots"){m=M;break}if(h===-1||m===-1)return!1;const g=p.slice(0,h).join("."),y=f.slice(0,m).join(".");if(g!==y)return!1;const x=p[h+1],T=f[m+1];if(x!==T)return!1;const S=parseInt(p[p.length-1]),z=parseInt(f[f.length-1]);if(isNaN(S)||isNaN(z)||S===z)return!1;const b=ln(g,n);if(!b||!b.slots||!b.slots[x])return!1;const v=b.slots[x];let E=[];if(Array.isArray(v))E=v;else if(v&&typeof v=="object"&&v.children)E=v.children||[];else return!1;if(S<0||S>=E.length||z<0||z>=E.length)return!1;const C=E[S];return E[S]=E[z],E[z]=C,!Array.isArray(v)&&typeof v=="object"&&v.children&&(v.children=E),!0}else if(p.length>2&&f.length>2){const h=p.slice(0,-1).join("."),m=f.slice(0,-1).join(".");if(h===m){const g=parseInt(p[p.length-1]),y=parseInt(f[f.length-1]);if(!isNaN(g)&&!isNaN(y)&&g!==y){const x=parseInt(p[1]);let T=n.page[x];for(let S=2;S<p.length-1;S++)T=T[p[S]];if(Array.isArray(T)){if(g<0||g>=T.length||y<0||y>=T.length)return!1;const S=T[g];return T[g]=T[y],T[y]=S,!0}}}}return!1}return{reorderSourcePath:t,handleReorderClick:a,canReorderWith:i,cancelReorder:l}}function Xv(n,e,t,o,r,i,a,l,c){const d=s.computed(()=>o.value?lu(o.value):null),u=s.computed(()=>{if(!d.value)return!1;const f=ln(d.value,n);return f!=null});function p(){if(!d.value)return;const f=d.value;if(!e.value||!e.value.querySelector(`[data-zcode-path="${f}"]`))return;const m=ln(f,n);if(m){if(o.value&&e.value){const g=e.value.querySelector(`[data-zcode-path="${o.value}"]`);g&&pn(g)}switch(t.value){case"edit":r(f,m);break;case"add":i(f,!0);break;case"reorder":if(c.value){const g=e.value.querySelector(`[data-zcode-path="${c.value}"]`);g&&Zt(g),c.value=""}a(f);break;case"delete":l(f,m);break}}}return{parentPath:d,canSelectParent:u,selectParentElement:p}}function Yv(n,e,t,o,r,i,a,l,c,d,u,p,f,h){const m=new Map;function g(){if(!e.value)return;const x=()=>{const C=e.value?.querySelectorAll("[data-zcode-id], [data-zcode-slot-path]");C&&C.forEach(M=>{pn(M)})};y();const T=e.value.querySelectorAll("[data-zcode-id]"),S=C=>{const M=C.target;if(!M)return;const D=M.closest("[data-zcode-add-slot]");if(!D)return;const $=D.closest("[data-zcode-slot-path]"),P=$?.getAttribute("data-zcode-slot-path");if(!P)return;C.preventDefault(),C.stopPropagation(),C.stopImmediatePropagation();const L=()=>{const V=e.value?.querySelector(`[data-zcode-slot-path="${P}"]`);V&&(pn(V),Qt(V,"add"))};if($&&pn($),t.value!=="add"){f("add"),s.nextTick(()=>{c(P),s.nextTick(()=>{L()})});return}L(),s.nextTick(()=>{c(P),s.nextTick(()=>{L()})})};let z=null;const b=C=>o.value===C||r.value===C||i.value===C||a.value===C,v=C=>{const M=C;if(M.pointerType!=="mouse")return;const D=M.target;if(!D)return;const $=D.closest("[data-zcode-slot-path]");if(!$){if(z){const L=z.getAttribute("data-zcode-slot-path")||"";(!L||!b(L))&&pn(z),z=null}return}if(z===$)return;if(z){const L=z.getAttribute("data-zcode-slot-path")||"";(!L||!b(L))&&pn(z)}z=$;const P=$.getAttribute("data-zcode-slot-path")||"";P&&!b(P)&&xc($,t.value)},E=C=>{const M=C;if(M.pointerType!=="mouse")return;const D=M.target;if(!D)return;const $=M.relatedTarget,P=D.closest("[data-zcode-slot-path]");if(!P||$&&P.contains($))return;const L=P.getAttribute("data-zcode-slot-path")||"";(!L||!b(L))&&pn(P),z===P&&(z=null)};e.value.addEventListener("click",S,!0),e.value.addEventListener("pointerdown",x,!0),e.value.addEventListener("pointerover",v,!0),e.value.addEventListener("pointerout",E,!0),m.set(e.value,[{type:"click",listener:S,options:!0},{type:"pointerover",listener:v,options:!0},{type:"pointerout",listener:E,options:!0},{type:"pointerdown",listener:x,options:!0}]),T.forEach(C=>{const M=C,D=M.getAttribute("data-zcode-path");if(!D)return;const $=F=>{const H=F.target,G=H?.closest("[data-zcode-path]")?.getAttribute("data-zcode-path");if(G&&G!==D)return;H?.closest("a[href]")&&(h.value||F.preventDefault()),h.value||(F.stopPropagation(),F.stopImmediatePropagation());const J=ln(D,n);if(J)switch(pn(M),t.value){case"edit":l(D,J);break;case"add":c(D);break;case"reorder":if(i.value){const ne=i.value.split("."),ee=D.split(".");if(ne.length!==ee.length&&ne.indexOf("rows")!==-1){const te=ee.indexOf("cells");if(te!==-1){let se=-1;for(let ce=te-1;ce>=0;ce--)if(ee[ce]==="slots"){se=ce;break}if(se!==-1){const ce=ee.slice(0,se).join(".");if(ce&&p(i.value,ce)){d(ce);return}}}}}d(D);break;case"delete":u(D,J);break}},P=F=>{if(o.value===F||r.value===F||i.value===F||a.value===F)return!0;if(F.includes(".slots.")){const U=F.split(".");let G=-1;for(let K=U.length-1;K>=0;K--)if(U[K]==="slots"){G=K;break}if(G!==-1&&G+1<U.length){const K=U.slice(0,G+2).join(".");return r.value===K||o.value===K||i.value===K||a.value===K}}return!1},L=F=>{const H=F;"pointerType"in H&&H.pointerType!=="mouse"||(P(D)||(t.value==="reorder"&&i.value?p(i.value,D)&&xc(M,t.value):xc(M,t.value)),t.value==="reorder"?M.style.cursor=i.value&&p(i.value,D)?"move":i.value?"not-allowed":"move":M.style.cursor="pointer")},V=F=>{const H=F;"pointerType"in H&&H.pointerType!=="mouse"||(P(D)||pn(M),M.style.cursor="")};M.addEventListener("click",$,!0),M.addEventListener("pointerenter",L),M.addEventListener("pointerleave",V),m.set(M,[{type:"click",listener:$,options:!0},{type:"pointerenter",listener:L},{type:"pointerleave",listener:V}])}),s.nextTick(()=>{s.nextTick(()=>{if(t.value==="edit"&&o.value&&e.value){const C=e.value.querySelector(`[data-zcode-path="${o.value}"]`);C&&Qt(C,"edit")}if(t.value==="add"&&r.value&&e.value){const C=e.value.querySelector(`[data-zcode-path="${r.value}"]`);if(C)Qt(C,"add");else{const M=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);M&&Qt(M,"add")}}if(t.value==="reorder"&&i.value&&e.value){const C=e.value.querySelector(`[data-zcode-path="${i.value}"]`);C&&Qt(C,"reorder")}if(t.value==="delete"&&a.value&&e.value){const C=e.value.querySelector(`[data-zcode-path="${a.value}"]`);C&&Qt(C,"delete")}})})}function y(){m.forEach((x,T)=>{x.forEach(({type:S,listener:z,options:b})=>{T.removeEventListener(S,z,b)})}),m.clear()}return{setupClickHandlers:g,cleanupEventListeners:y}}function Qv(n,e,t,o,r,i,a,l,c,d,u,p,f){function h(m){n.value&&n.value.querySelectorAll("[data-zcode-path], [data-zcode-slot-path]").forEach(y=>{Zt(y),pn(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",p.value=null):e.value==="reorder"&&i.value?i.value="":e.value==="delete"&&a.value&&f(),t(m)}return{switchMode:h}}function Zv(n,e,t){const o=s.ref(!1),r=s.ref({x:0,y:0});function i(f){!e.value||!n.value||!f.target.closest("[data-zcode-path]")||(f.preventDefault(),f.stopPropagation(),r.value={x:f.clientX,y:f.clientY},o.value=!0)}function a(f){t(f),o.value=!1}function l(){o.value=!1}function c(f){f.target.closest(".zcode-context-menu")||l()}function d(f){f.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 p(){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:p}}function eN(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}const tN={key:0,class:"zcode-save-banner zcode-save-banner--error",role:"alert"},nN={class:"zcode-save-banner-text"},oN=["aria-label"],rN={key:1,class:"zcode-save-controls-fixed"},iN={class:"zcode-save-confirm-dialog"},sN={class:"zcode-save-confirm-dialog-header"},aN={class:"zcode-save-confirm-dialog-title"},lN={class:"zcode-save-confirm-dialog-body"},cN={class:"zcode-save-confirm-dialog-footer"},Zr=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},hideFixedSaveButton:{type:Boolean},saveRequestSource:{type:String}},setup(n,{expose:e}){const{t}=rn(),o=n,r=s.ref("manage"),i=s.ref(!1),l=(he=>{if(!he)return{};try{return JSON.parse(he)}catch(fe){return ge.warn("ZeroCodeCMS: Failed to parse config:",fe),{}}})(o.config),c=["page"],d=s.computed(()=>o.hideFixedSaveButton===!0),u=s.computed(()=>o.saveRequestSource??"cms"),p=(he,fe,ve)=>{const Qe=uu();return Qe[he]!==void 0?Qe[he]:ve!==void 0?ve:fe},f=s.ref(p("devRightPadding",!1,l.cms?.devRightPadding)),h=s.ref(p("enableContextMenu",!1,l.cms?.enableContextMenu)),m=s.ref(p("showSaveConfirm",!0,l.cms?.showSaveConfirm)),g=s.computed(()=>f.value),y=s.ref(!1),{cmsData:x,loadDataFromProps:T,getData:S,setData:z}=gc(o),{fullPageHtml:b,renderComponentToHtml:v}=zi(x,!0);function E(he){if(he!=="css")return he?S(he):S()}const C=s.ref(null),M=s.ref(null),D=s.computed(()=>M.value?.previewArea||null),{currentMode:$,switchMode:P,allowDynamicContentInteraction:L}=Wv(),V=p("allowDynamicContentInteraction",!1,l.cms?.allowDynamicContentInteraction),F=s.ref(V);L.value=V;let H=!1;s.watch(r,(he,fe)=>{he==="preview"?(H=F.value,F.value=!0,L.value=!0,s.nextTick(()=>{En()})):fe==="preview"&&(F.value=H,L.value=H,s.nextTick(()=>{En()})),Z("view-mode-changed",{mode:he,previousMode:fe})});const{editingComponent:U,editingComponentPath:G,editingAvailableFields:K,handleEditClick:J,saveFieldEdit:ne,closeEditPanel:ee}=qv(x,D),Y=s.ref({}),te=s.ref([]),se=s.ref({visible:!1,message:""});function ce(he){if(he?.fieldName&&Y.value[he.fieldName]){const fe={...Y.value};delete fe[he.fieldName],Y.value=fe}ne(he)}const{addTargetPath:ke,addSelectedType:Se,addSelectedPart:Oe,clickedComponent:N,addPartCategory:X,addTypeTab:oe,keepAdding:k,availablePartTypes:w,groupedPartsByType:I,hasSpecialParts:j,handleAddClick:le,handleCategoryTabClick:Ce,handleTypeTabClick:Be,selectPart:A,getPartPreviewHtml:_,getClickedComponentPreviewHtml:W,confirmAddPart:de,cancelAdd:Pe}=Gv(x,D,v,l),{reorderSourcePath:ue,handleReorderClick:q,canReorderWith:Q,cancelReorder:Te}=Jv(x,D),{deleteConfirmComponent:De,deleteConfirmPath:qe,handleDeleteClick:Je,confirmDelete:kt,cancelDelete:At}=Kv(x,D,P,s.nextTick),{switchMode:en}=Qv(D,$,P,G,ke,ue,qe,U,Se,Oe,X,oe,At),Pt=s.computed(()=>$.value==="edit"&&G.value?G.value:$.value==="add"&&ke.value?ke.value:$.value==="reorder"&&ue.value?ue.value:$.value==="delete"&&qe.value?qe.value:null),{canSelectParent:$t,selectParentElement:Et}=Xv(x,D,$,Pt,J,le,q,Je,ue),Oo=s.computed(()=>!!(U.value||ke.value||ue.value||De.value)),En=()=>{if(D.value){const he=D.value.getRootNode();if(he instanceof ShadowRoot){let Qe=0;const Ht=()=>{Qe++;const fn=he;if(typeof fn.__zcmsSetAllowDynamicContentInteraction=="function"){fn.__zcmsSetAllowDynamicContentInteraction(F.value);return}Qe<30&&setTimeout(Ht,50)};Ht()}}},{setupClickHandlers:Ft,cleanupEventListeners:fo}=Yv(x,D,$,G,ke,ue,qe,J,le,q,Je,Q,en,F),{isVisible:oi,position:$n,handleModeSelect:ri,closeMenu:ii,setupContextMenu:R,cleanupContextMenu:B}=Zv(D,h,en);function Z(he,fe){const ve=Ae();if(ve){const Ht=new CustomEvent(he,{detail:fe,bubbles:!0,composed:!0});ve.dispatchEvent(Ht);return}const Qe=new CustomEvent(he,{detail:fe,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(Qe)}function pe(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Ae(){if(C.value){const fe=C.value.getRootNode();if(fe instanceof ShadowRoot&&fe.host)return fe.host;const ve=C.value.closest?.("zcode-cms")||C.value.closest?.("zcode-editor")||C.value.closest?.("zcode-studio");if(ve)return ve}const he=s.getCurrentInstance();if(he){const fe=he.vnode.el;if(fe instanceof HTMLElement){const ve=fe.getRootNode();if(ve instanceof ShadowRoot&&ve.host)return ve.host;const Qe=fe.closest?.("zcode-cms")||fe.closest?.("zcode-editor")||fe.closest?.("zcode-studio");return Qe||null}if(fe instanceof Node){const ve=fe.getRootNode();if(ve instanceof ShadowRoot&&ve.host)return ve.host}}return null}function nt(he){return typeof he=="object"&&he!==null}function ho(he){return Array.isArray(he)?he.filter(fe=>nt(fe)).map(fe=>({path:typeof fe.path=="string"?fe.path:void 0,field:typeof fe.field=="string"?fe.field:void 0,message:typeof fe.message=="string"?fe.message:void 0,code:typeof fe.code=="string"?fe.code:void 0})):[]}function rr(he){if(!he){Y.value={};return}const fe={};for(const ve of te.value){const Qe=typeof ve?.path=="string"?ve.path:null,Ht=typeof ve?.field=="string"?ve.field:null,fn=typeof ve?.message=="string"?ve.message:null;!Ht||!fn||Qe&&Qe!==he||(fe[Ht]=fn)}Y.value=fe}function jt(he){const fe=he.detail;if(!nt(fe))return;const ve=fe;if(ve.ok===!0){se.value.visible=!1,se.value.message="",te.value=[],Y.value={};return}if(ve.ok!==!1)return;const Qe=ho(ve.errors);te.value=Qe;const Ht=Qe.length,fn=typeof Qe[0]?.message=="string"&&Qe[0].message?Qe[0].message:null;se.value.visible=!0,se.value.requestId=typeof ve.requestId=="string"?ve.requestId:void 0,se.value.target=typeof ve.target=="string"?ve.target:void 0,se.value.message=fn?t("editor.saveFailedWithMessage",{count:Ht,message:fn}):t("editor.saveFailedWithCount",{count:Ht}),rr(G.value||null)}s.onMounted(()=>{T(),s.nextTick(()=>{Ft(),h.value&&R(),En(),Z("zcode-dom-updated",{})});const he=Ae();he&&he.addEventListener("save-result",jt)}),s.onUnmounted(()=>{fo(),B();const he=Ae();he&&he.removeEventListener("save-result",jt)}),s.watch(()=>G.value,he=>{rr(he||null)}),s.watch([()=>o.page,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial],()=>{T()}),s.watch(x,()=>{s.nextTick(()=>{Ft(),Z("zcode-dom-updated",{})})},{deep:!0}),s.watch([r,D],([he,fe])=>{he==="manage"&&fe?s.nextTick(()=>{Ft(),h.value&&R(),En(),Z("zcode-dom-updated",{})}):B()}),s.watch($,()=>{s.nextTick(()=>{Z("zcode-dom-updated",{})})}),s.watch(f,he=>{Mi({devRightPadding:he})}),s.watch(F,he=>{r.value==="manage"&&Mi({allowDynamicContentInteraction:he}),L.value=he,s.nextTick(()=>{Ft(),En(),Z("zcode-dom-updated",{})})}),s.watch(h,he=>{Mi({enableContextMenu:he}),he?s.nextTick(()=>{R()}):B()}),s.watch(m,he=>{Mi({showSaveConfirm:he})});function Ln(){if(!m.value){si();return}y.value=!0}function si(){const he=pe();Z("save-request",{requestId:he,source:u.value,targets:c,timestamp:Date.now()})}function Ys(){y.value=!1,si()}function ir(){y.value=!1}return e({getData:E,setData:z,validateData:eN,cmsData:x,currentMode:$,switchMode:en,allowDynamicContentInteraction:F,devRightPadding:f,devRightPaddingValue:g,settingsPanelOpen:i}),(he,fe)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"containerRef",ref:C,class:s.normalizeClass(["zcode-cms-container",{"zcode-dev-padding":f.value&&Oo.value}])},[s.createVNode(Ia,{"current-mode":s.unref($),"view-mode":r.value,"allow-dynamic-content-interaction":F.value,onSwitchMode:s.unref(en),onSwitchViewMode:fe[0]||(fe[0]=ve=>r.value=ve),onOpenSettings:fe[1]||(fe[1]=ve=>i.value=!0)},null,8,["current-mode","view-mode","allow-dynamic-content-interaction","onSwitchMode"]),se.value.visible?(s.openBlock(),s.createElementBlock("div",tN,[s.createElementVNode("div",nN,s.toDisplayString(se.value.message),1),s.createElementVNode("button",{class:"zcode-save-banner-close","aria-label":he.$t("common.close"),onClick:fe[2]||(fe[2]=ve=>se.value.visible=!1)}," × ",8,oN)])):s.createCommentVNode("",!0),r.value==="manage"&&!d.value?(s.openBlock(),s.createElementBlock("div",rN,[s.createElementVNode("button",{class:"zcode-save-btn",onClick:Ln},[s.createVNode(s.unref(Zs),{size:16}),s.createElementVNode("span",null,s.toDisplayString(he.$t("common.save")),1)])])):s.createCommentVNode("",!0),r.value==="preview"?(s.openBlock(),s.createBlock(Ti,{key:2,"cms-data":s.unref(x),"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(Lc,{ref_key:"previewAreaRef",ref:M,"cms-data":s.unref(x),"full-page-html":s.unref(b),"on-add-click":s.unref(le),"allow-dynamic-content-interaction":F.value},null,8,["cms-data","full-page-html","on-add-click","allow-dynamic-content-interaction"]),s.createVNode(nm,{"editing-component":s.unref(U),"editing-available-fields":s.unref(K),"field-errors":Y.value,"current-mode":s.unref($),"can-select-parent":s.unref($t),"images-common":s.unref(x).images.common,"images-individual":s.unref(x).images.individual,"images-special":s.unref(x).images.special,onClose:s.unref(ee),onSelectParent:s.unref(Et),onSaveField:ce},null,8,["editing-component","editing-available-fields","field-errors","current-mode","can-select-parent","images-common","images-individual","images-special","onClose","onSelectParent"]),s.createVNode(GC,{"delete-confirm-component":s.unref(De),"current-mode":s.unref($),"can-select-parent":s.unref($t),onConfirm:s.unref(kt),onCancel:s.unref(At),onSelectParent:s.unref(Et)},null,8,["delete-confirm-component","current-mode","can-select-parent","onConfirm","onCancel","onSelectParent"]),s.createVNode(tv,{"reorder-source-path":s.unref(ue),"current-mode":s.unref($),"can-select-parent":s.unref($t),onCancel:s.unref(Te),onSelectParent:s.unref(Et)},null,8,["reorder-source-path","current-mode","can-select-parent","onCancel","onSelectParent"]),s.createVNode(Bv,{"add-target-path":s.unref(ke),"add-part-category":s.unref(X),"add-type-tab":s.unref(oe),"add-selected-part":s.unref(Oe),"add-selected-type":s.unref(Se),"has-special-parts":s.unref(j),"clicked-component":s.unref(N),"available-part-types":s.unref(w),config:s.unref(l),"grouped-parts-by-type":s.unref(I),"can-select-parent":s.unref($t),"get-part-preview-html":s.unref(_),"get-clicked-component-preview-html":s.unref(W),"keep-adding":s.unref(k),onCancel:s.unref(Pe),onSelectParent:s.unref(Et),onCategoryTabClick:s.unref(Ce),onTypeTabClick:s.unref(Be),onSelectPart:s.unref(A),onConfirmAdd:s.unref(de),onUpdateKeepAdding:fe[3]||(fe[3]=ve=>k.value=ve)},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(Da,{"is-open":i.value,"view-mode":r.value,mode:"toolbar","allow-dynamic-content-interaction":F.value,"dev-right-padding":g.value,"enable-context-menu":h.value,"show-save-confirm":m.value,onClose:fe[4]||(fe[4]=ve=>i.value=!1),onToggleDynamicContent:fe[5]||(fe[5]=ve=>F.value=ve),onToggleDevPadding:fe[6]||(fe[6]=ve=>f.value=ve),onToggleContextMenu:fe[7]||(fe[7]=ve=>h.value=ve),onToggleSaveConfirm:fe[8]||(fe[8]=ve=>m.value=ve)},null,8,["is-open","view-mode","allow-dynamic-content-interaction","dev-right-padding","enable-context-menu","show-save-confirm"]),s.createVNode(Fv,{"is-visible":s.unref(oi),position:s.unref($n),"current-mode":s.unref($),onSelectMode:s.unref(ri),onClose:s.unref(ii)},null,8,["is-visible","position","current-mode","onSelectMode","onClose"]),y.value?(s.openBlock(),s.createElementBlock("div",{key:4,class:"zcode-save-confirm-dialog-overlay",onClick:s.withModifiers(ir,["self"])},[s.createElementVNode("div",iN,[s.createElementVNode("div",sN,[s.createElementVNode("div",aN,s.toDisplayString(he.$t("saveConfirm.title")),1)]),s.createElementVNode("div",lN,[s.createElementVNode("p",null,s.toDisplayString(he.$t("saveConfirm.simpleMessage")),1)]),s.createElementVNode("div",cN,[s.createElementVNode("button",{class:"zcode-btn-secondary",onClick:ir},s.toDisplayString(he.$t("common.cancel")),1),s.createElementVNode("button",{class:"zcode-btn-primary",onClick:Ys},s.toDisplayString(he.$t("saveConfirm.saveButton")),1)])])])):s.createCommentVNode("",!0)],2))}}),kc=":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-item input[type=radio],.zcode-checkbox-item input[type=checkbox],.zcode-setting-checkbox,.zcode-keep-adding-checkbox,.zcode-dynamic-content-toggle-checkbox,.zcode-checkbox,.zcode-checkbox-input,.zcode-language-select,.zcode-select,.zcode-select[multiple],.zcode-part-editor-options-select,.zcode-select-input{-webkit-appearance:auto;-moz-appearance:auto;appearance:auto;opacity:1;visibility:visible}.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,[data-zcode-slot-path].zcode-outline-active{outline-width:4px;outline-style:solid;outline-offset:2px}[data-zcode-id].zcode-outline-inner.zcode-outline-active,[data-zcode-slot-path].zcode-outline-inner.zcode-outline-active{outline-offset:-4px}[data-zcode-id].zcode-outline-active-edit,[data-zcode-slot-path].zcode-outline-active-edit{outline-color:var(--zcode-color-edit)}[data-zcode-id].zcode-outline-active-add,[data-zcode-slot-path].zcode-outline-active-add{outline-color:var(--zcode-color-add)}[data-zcode-id].zcode-outline-active-reorder,[data-zcode-slot-path].zcode-outline-active-reorder{outline-color:var(--zcode-color-reorder)}[data-zcode-id].zcode-outline-active-delete,[data-zcode-slot-path].zcode-outline-active-delete{outline-color:var(--zcode-color-delete)}@media(hover:hover){[data-zcode-id].zcode-outline-hover,[data-zcode-slot-path].zcode-outline-hover{outline-width:2px;outline-style:dashed;outline-offset:1px}[data-zcode-id].zcode-outline-inner.zcode-outline-hover,[data-zcode-slot-path].zcode-outline-inner.zcode-outline-hover{outline-offset:-2px}[data-zcode-id].zcode-outline-hover-edit,[data-zcode-slot-path].zcode-outline-hover-edit{outline-color:var(--zcode-color-edit)}[data-zcode-id].zcode-outline-hover-add,[data-zcode-slot-path].zcode-outline-hover-add{outline-color:var(--zcode-color-add)}[data-zcode-id].zcode-outline-hover-reorder,[data-zcode-slot-path].zcode-outline-hover-reorder{outline-color:var(--zcode-color-reorder)}[data-zcode-id].zcode-outline-hover-delete,[data-zcode-slot-path].zcode-outline-hover-delete{outline-color:var(--zcode-color-delete)}}.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-image-id-reference{padding:12px;overflow-y:auto}.zcode-image-id-reference-header{font-size:12px;color:#6b7280;line-height:1.5;margin-bottom:12px}.zcode-image-id-reference-list{display:flex;flex-direction:column;gap:8px}.zcode-image-id-item{display:flex;align-items:center;gap:8px;padding:8px;border:1px solid #e5e7eb;border-radius:6px;background:#fff}.zcode-image-id-thumb{width:40px;height:40px;object-fit:cover;border-radius:4px;flex-shrink:0}.zcode-image-id-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.zcode-image-id-code{font-size:12px;font-family:ui-monospace,monospace;background:#f3f4f6;padding:2px 6px;border-radius:4px;display:inline-block;width:fit-content}.zcode-image-id-name{font-size:11px;color:#6b7280;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.zcode-image-id-actions{display:flex;gap:4px;flex-shrink:0}.zcode-image-id-empty{padding:24px 12px;text-align:center;font-size:13px;color:#6b7280;background:#f9fafb;border-radius:6px;border:1px dashed #e5e7eb}.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;color:#374151}.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;min-width:0;overflow:hidden;overflow-y:hidden}.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:3000;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:3000;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:4000;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:9000;padding:20px}.zcode-help-modal{background:#fff;border-radius:8px;width:100%;max-width:960px;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}@media(max-width:768px){.zcode-monaco-editor .monaco-editor-wrapper,.zcode-monaco-editor .monaco-editor-container{min-height:200px}}.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-header-actions{position:relative;display:flex;align-items:center;gap:4px}.zcode-part-editor-options-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:none;border-radius:6px;background:transparent;color:#6b7280;cursor:pointer;transition:background .2s,color .2s}.zcode-part-editor-options-btn:hover,.zcode-part-editor-options-btn[aria-expanded=true]{background:#e5e7eb;color:#374151}.zcode-part-editor-options-popover{position:absolute;top:100%;right:0;margin-top:6px;min-width:220px;padding:0;background:#fff;border:1px solid #e5e7eb;border-radius:8px;box-shadow:0 4px 12px #00000026;z-index:100}.zcode-part-editor-options-popover-title{padding:10px 12px;font-size:12px;font-weight:600;color:#374151;border-bottom:1px solid #f3f4f6}.zcode-part-editor-options-popover-body{padding:12px}.zcode-part-editor-options-row{display:flex;align-items:center;gap:8px;font-size:12px;color:#6b7280}.zcode-part-editor-options-label{margin:0;font-weight:400;flex-shrink:0}.zcode-part-editor-options-select{padding:4px 8px;font-size:12px;border:1px solid #e5e7eb;border-radius:4px;background:#fff;color:#374151;min-width:0;flex:1}.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,.zcode-images-add-btn{font-size:13px;border-radius:6px;white-space:nowrap;flex-shrink:0}.zcode-btn-primary:hover{background:var(--zcode-color-edit-hover)}.zcode-btn-primary.zcode-parts-new-btn,.zcode-btn-primary.zcode-images-add-btn{padding:6px 12px;font-size:13px;border:1px solid #d1d5db}.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-replace{margin-bottom:16px}.zcode-image-editor-replace .zcode-image-select-btn{width:100%}.zcode-image-replace-input{display:none}.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-parts-category-tabs,.zcode-images-category-tabs{justify-content:flex-start;flex-wrap:wrap;gap:8px}.zcode-parts-category-tab-group,.zcode-images-category-tab-group{flex:1 1 220px;flex-wrap:wrap;gap:4px}.zcode-parts-add-wrapper,.zcode-images-add-wrapper{flex:0 0 auto}.zcode-part-editor-header{padding:12px 14px}.zcode-part-editor-form{padding:16px 12px}.zcode-part-editor-options-popover{right:0;left:auto}.zcode-part-editor-main{grid-template-columns:1fr;gap:16px}.zcode-part-editor-topfields{grid-template-columns:1fr}.zcode-part-editor-preview{position:relative;max-height:400px;padding:12px}.zcode-part-editor-actions{padding:12px 16px}.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:9000;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:9000}.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}}",dN={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:"パーツの説明",options:"オプション",outlinePosition:"アウトラインの位置",outlinePositionOuter:"外側",outlinePositionInner:"内側",deletePartConfirm:`パーツ {number} を削除しますか?
|
|
464
|
+
(タイプには他のパーツが残ります)`,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:"ページ編集時に表示される編集パネルの項目一覧です。",imageIdReference:"画像ID参照",imageIdReferenceDesc:"テンプレートの '{'$field:default:image'}' の default には画像IDを指定します。",insert:"挿入",noImagesRegistered:"画像が登録されていません。画像管理で追加してください。"},imagesManager:{addImage:"画像追加",editImage:"画像編集",imageId:"画像ID",imageName:"画像名",altText:"Alt属性",deleteImageConfirm:"この画像を削除しますか?",deleteImageWithUsagesConfirm:"この画像は{count}箇所で使用されています。削除しますか?",addImageFailed:"画像の追加に失敗しました",replaceImage:"差し替え",selectImage:"画像を選択",currentlySelected:"現在選択中",select:"選択"},dataViewer:{page:"ページ",parts:"パーツ",images:"画像",common:"共通",individual:"個別",special:"特別",json:"JSON",html:"HTML",categoryInfo:{title:"カテゴリの役割について",common:{title:"共通",description:"サイト全体で共有されるパーツ・画像を想定しています。すべてのページで使用できる想定です。"},individual:{title:"個別",description:"ページタイプごとに共有されるパーツ・画像を想定しています。同じページタイプのすべてのページで使用できる想定です。"},special:{title:"特別",description:"ここで編集するパーツ・画像は、公開したあとのサイトで、条件によって表示が変わるページ向けを想定しています。例:まとまりごとに、専用のページを用意する場合など。"}}},contextMenu:{edit:"編集",add:"追加",reorder:"並べ替え",delete:"削除",close:"閉じる"},editor:{pageManagement:"ページ管理",partsManagement:"パーツ管理",imagesManagement:"画像管理",dataViewer:"データビューアー",loading:"データを読み込み中..."}},uN={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",options:"Options",outlinePosition:"Outline position",outlinePositionOuter:"Outer",outlinePositionInner:"Inner",deletePartConfirm:`Do you want to delete part {number}?
|
|
465
|
+
(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.",imageIdReference:"Image ID reference",imageIdReferenceDesc:"Specify the image ID for the default value in '{'$field:default:image'}'.",insert:"Insert",noImagesRegistered:"No images registered. Add images in Image Manager.",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?",addImageFailed:"Failed to add image",replaceImage:"Replace",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:"The parts and images you edit here are intended for pages on your published site whose content changes depending on the conditions. Example: Such as creating a dedicated page for each content grouping, among other cases."}}},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 pN(n="ja"){return Ty({locale:n,fallbackLocale:"ja",messages:{ja:dN,en:uN},globalInjection:!0})}const rm={UNDEFINED_PROPERTIES:"Cannot read properties of undefined",APP_REFERENCE:"app"};function Ec(){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(rm.UNDEFINED_PROPERTIES)&&t.includes(rm.APP_REFERENCE)){e.preventDefault();return}}}),n.__zcodeI18nErrorHandlerSetup=!0)}function fN(){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 nr(n,e="ja"){const t=Nb(null);if(t)return t;const o=n.getAttribute("locale");return o==="ja"||o==="en"?o:e}function or(n,e){fN();const t=pN(e);try{n.use(t)}catch(o){ge.warn("Failed to setup i18n:",o)}}Ec();class hN extends HTMLElement{app=null;componentInstance=null;_shadowRoot=null;constructor(){super()}connectedCallback(){if(this.app)return;this.getAttribute("use-shadow-dom")!=="false"?(this.setupShadowDOM(),window.addEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this))):(this.setupLightDOM(),window.addEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this)))}setupLightDOM(){const e=this.getAttribute("page")||"[]",t=this.getAttribute("css-common"),o=this.getAttribute("css-individual"),r=this.getAttribute("css-special"),i=this.getAttribute("parts-common")||"[]",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")||"[]",p=Array.from(this.querySelectorAll('[slot="script"]'));p.length>0&&(this.__savedScriptSlots=p.map(h=>({src:h.src,type:h.type,async:h.async,defer:h.defer,integrity:h.integrity,crossOrigin:h.crossOrigin})));const f=nr(this);this.app=s.createApp(Zr,{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")||""}),or(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")||"[]",p=this.getAttribute("images-individual")||"[]",f=this.getAttribute("images-special")||"[]",h=nr(this);this.app=s.createApp(Zr,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:a,partsCommon:l,partsIndividual:c,partsSpecial:d,imagesCommon:u,imagesIndividual:p,imagesSpecial:f,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}),or(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=kc,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){ge.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 p=new URL(c.src,window.location.href);p.searchParams.set("_t",Date.now().toString()),d=p.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=p=>{ge.error(`Failed to load script: ${c.src}`,p)},u},l=()=>{o.forEach(c=>{c.remove()})};if(r.length>0){let c=0;const d=r.length;r.forEach(u=>{const p=a(u);p.onload=()=>{c++,c===d&&(Nn(this._shadowRoot,e),setTimeout(()=>{i.forEach(f=>{this._shadowRoot.appendChild(a(f))}),l()},50))},this._shadowRoot.appendChild(p)})}else Nn(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){ge.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=>{ge.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(),Nn(this._shadowRoot,!0)}handleLightDOMUpdated(){this.getAttribute("use-shadow-dom")!=="true"&&(this.__lightDOMScriptsLoaded||(this.injectLightDOMScripts(),this.__lightDOMScriptsLoaded=!0))}static get observedAttributes(){return["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data","use-shadow-dom"]}attributeChangedCallback(e,t,o){if(t!==o){if(e==="use-shadow-dom"){this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot&&(this._shadowRoot.innerHTML="",this._shadowRoot=null),this.connectedCallback();return}this.app&&(this.app.unmount(),this.app=null,this.componentInstance=null,this.connectedCallback())}}}customElements.get("zcode-cms")||customElements.define("zcode-cms",hN);function mN(n,e){const{t}=rn(),o=s.ref("common"),r=s.ref(null),i=s.ref(null),a=s.ref(null),l=s.ref(null),c=s.ref(!1),d=s.ref(null),u=s.ref(null),{renderComponentToHtml:p}=zi(n,!1),f=s.computed(()=>{const k=n.parts;return o.value==="common"?k.common:o.value==="individual"?k.individual:k.special}),h=s.computed(()=>{const k=f.value,w=new Map;return k.forEach(I=>{w.has(I.type)||w.set(I.type,[]),I.parts.forEach((j,le)=>{w.get(I.type).push({type:I,partIndex:le})})}),Array.from(w.entries()).map(([I,j])=>({type:I,parts:j.map(le=>({...le.type,_partIndex:le.partIndex,_displayPart:le.type.parts[le.partIndex]}))}))});function m(){const k=n.parts;return o.value==="common"?k.common:o.value==="individual"?k.individual:k.special}function g(k){return f.value.find(w=>w.type===k)||null}function y(k){return a.value&&a.value.partIndex===k&&a.value.part.slots||null}function x(k,w,I){if(a.value&&a.value.partIndex===k){const j=a.value.part;return j.slots||(j.slots={}),I(j.slots),!0}return!1}function T(k){const w={};return k.forEach(I=>{if(I.optional)w[I.fieldName]=void 0;else switch(I.type){case"text":w[I.fieldName]=I.defaultValue||"";break;case"radio":w[I.fieldName]=I.options?.[0]||"";break;case"checkbox":w[I.fieldName]=[];break;case"boolean":w[I.fieldName]=!0;break;case"rich":w[I.fieldName]=I.defaultValue?`<p>${I.defaultValue}</p>`:"<p></p>";break;case"image":w[I.fieldName]=I.defaultValue||"";break}}),w}function S(k){r.value=k,i.value=null,c.value=!1}function z(){i.value=s.reactive({id:Gn(),type:"",description:"",parts:[{id:Gn(),title:"part_1",description:"",body:"<div>{$content:コンテンツを入力}</div>"}]}),l.value="type",c.value=!0,r.value=null}function b(k){i.value=s.reactive(JSON.parse(JSON.stringify(k))),l.value="type",c.value=!1,r.value=k}function v(k,w){const I=k.parts[w];if(!I)return;const j=JSON.parse(JSON.stringify(I));j.slots||(j.slots={}),a.value={type:s.reactive(JSON.parse(JSON.stringify(k))),partIndex:w,part:s.reactive(j)},l.value="part"}async function E(k){const w=g(k.type);if(!w)return;const I=s.reactive(JSON.parse(JSON.stringify(w))),j={id:Gn(),title:`part_${I.parts.length+1}`,description:"",body:"<div>{$content:コンテンツを入力}</div>"};I.parts.push(j);const le=I.parts.length-1;await s.nextTick(),a.value={type:I,partIndex:le,part:s.reactive(JSON.parse(JSON.stringify(j))),isNewPart:!0},l.value="part"}async function C(){if(!i.value)return;const k=oe(i.value);if(!k.valid){alert(t("partsManager.validationError")+`
|
|
466
|
+
`+k.errors.join(`
|
|
467
|
+
`));return}const w=JSON.parse(JSON.stringify(s.toRaw(i.value))),I=m();if(c.value)I.push(w);else{const j=I.findIndex(le=>le.id===i.value.id);j!==-1&&(I[j]=w)}await s.nextTick(),f.value,h.value,i.value=null,l.value=null,c.value=!1}function M(k){const w=[],I=k.toLowerCase(),j=["script","iframe","object","embed"],le=["onclick","onerror","onload","onmouseover","onfocus","onblur"];return j.forEach(Ce=>{I.includes(`<${Ce}`)&&w.push(t("partsManager.dangerousTagWarning",{tag:Ce}))}),le.forEach(Ce=>{I.includes(`${Ce}=`)&&w.push(t("partsManager.dangerousAttrWarning",{attr:Ce}))}),{hasWarning:w.length>0,messages:w}}async function D(){if(!a.value)return;let k=a.value.part.body||"";const w=M(k);if(w.hasWarning&&!confirm(`テンプレートにセキュリティ上注意が必要な記述が含まれています。
|
|
471
468
|
|
|
472
|
-
${
|
|
469
|
+
${w.messages.join(`
|
|
473
470
|
`)}
|
|
474
471
|
|
|
475
|
-
このまま保存しますか?`))return;const
|
|
476
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
472
|
+
このまま保存しますか?`))return;if(e?.sanitize&&(k=su(k),a.value.part.body=k),e?.beforeSavePart)try{k=await e.beforeSavePart(k),a.value.part.body=k}catch(Be){ge.error("beforeSavePart hook failed:",Be);return}const I=m(),j=I.findIndex(Be=>Be.id===a.value.type.id);if(j===-1)return;const le=I[j],Ce=JSON.parse(JSON.stringify(s.toRaw(a.value.part)));a.value.isNewPart?le.parts.push(Ce):le.parts[a.value.partIndex]=Ce,await s.nextTick(),f.value,h.value,a.value=null,l.value=null}function $(k){const w=f.value.find(I=>I.id===k.id);if(w){if(k._partIndex!==void 0&&k._partIndex!==null)if(w.parts.length>1)w.parts.splice(k._partIndex,1);else{const I=f.value.findIndex(j=>j.id===k.id);I!==-1&&f.value.splice(I,1)}else{const I=f.value.findIndex(j=>j.id===k.id);I!==-1&&f.value.splice(I,1)}r.value=null,i.value=null}}function P(k){const w=[],I=(j,le)=>{const Ce=j.part_id,Be=n.parts,A=[...Be.common,...Be.individual];for(const _ of A)if(_.parts.find(de=>de.id===Ce)&&_.type===k){w.push({path:le,component:j});break}j.slots&&Object.entries(j.slots).forEach(([_,W])=>{Array.isArray(W)&&W.forEach((de,Pe)=>{I(de,`${le}.slots.${_}.${Pe}`)})})};return n.page.forEach((j,le)=>{I(j,`page.${le}`)}),w}function L(k,w){const I=qn(w.body),j=T(I),le={id:"preview",part_id:w.id,...j},Ce=new Set;Ce.add(`${k.id}:${w.id}`);const Be=w.slots;if(Be){const A={};Object.entries(Be).forEach(([_,W])=>{const de=W.allowedParts;if(de&&de.length>0){const Pe=de[de.length-1],ue=n.parts,q=[...ue.common,...ue.individual];let Q=null,Te=null;for(const De of q){const qe=De.parts.find(Je=>Je.id===Pe);if(qe){Q=De,Te=qe;break}}if(Q&&Te){const De=V(Q,Te.id,Ce);A[_]=[De]}else A[_]=[]}else A[_]=[]}),Object.keys(A).length>0&&(le.slots=A)}return le}function V(k,w,I=new Set){const j=w&&k.parts.find(W=>W.id===w)||k.parts[0];if(!j)throw new Error(`Part not found for type: ${k.type}`);const le=`${k.id}:${j.id}`;if(I.has(le)){const W=qn(j.body),de=T(W);return{id:"preview",part_id:j.id,...de}}I.add(le);const Ce=qn(j.body),Be=T(Ce),A={id:"preview",part_id:j.id,...Be},_=j.slots;if(_){const W={};Object.entries(_).forEach(([de,Pe])=>{const ue=Pe.allowedParts;if(ue&&ue.length>0){const q=ue[ue.length-1],Q=n.parts,Te=[...Q.common,...Q.individual];let De=null,qe=null;for(const Je of Te){const kt=Je.parts.find(At=>At.id===q);if(kt){De=Je,qe=kt;break}}if(De&&qe){const Je=V(De,qe.id,I);W[de]=[Je]}else W[de]=[]}else W[de]=[]}),Object.keys(W).length>0&&(A.slots=W)}return A}function F(k){const w=n.parts,I=[...w.common,...w.individual,...w.special];for(const j of I){const le=j.parts.find(Ce=>Ce.id===k);if(le)return le}return null}function H(k,w){if(!w)return"";const I=L(k,w);return U(w,I)}function U(k,w){return k?Ma(k.body,w,"",F,(I,j)=>p(I,j),!1,n.images.common,n.images.individual,n.images.special):""}function G(k){const w=[];try{const le=new DOMParser().parseFromString(`<template>${k}</template>`,"text/html").querySelector("template");if(!le)return w;le.content.querySelectorAll("[z-slot]").forEach(Be=>{const A=Be.getAttribute("z-slot")||"default";w.includes(A)||w.push(A)})}catch(I){ge.error("Failed to parse template:",I)}return w}function K(k){if(a.value&&a.value.partIndex===k){const w=a.value.part.body,I=G(w),j=Object.keys(a.value.part.slots||{});return I.filter(le=>!j.includes(le))}return[]}function J(k,w){let I=w||null;if(!I&&(I=prompt("スロット名を入力してください:"),!I?.trim()))return;x(k,I.trim(),le=>{if(le[I.trim()]){alert("このスロット名は既に存在します");return}le[I.trim()]={}})||alert("パーツが見つかりません")}function ne(k,w){y(k)?.[w]&&confirm(`スロット「${w}」を削除しますか?`)&&x(k,w,j=>{delete j[w]})}function ee(k,w,I){x(k,w,le=>{le[w]&&(le[w].allowedParts=I)})||ge.warn(`Failed to update allowed parts for slot ${w}`)}function Y(k,w){if(!d.value){d.value={type:k.type,partIndex:w};return}if(d.value.type===k.type&&d.value.partIndex===w){ce();return}const I=d.value,j={type:k.type,partIndex:w};if(!te(I,j)){alert("同じタイプ内のパーツのみ並べ替えできます"),ce();return}se(I,j),ce()}function te(k,w){return!(k.type!==w.type||k.partIndex===w.partIndex)}function se(k,w){const I=m(),j=I.findIndex(A=>A.type===k.type);if(j===-1)return;const Ce=I[j].parts,[Be]=Ce.splice(k.partIndex,1);Ce.splice(w.partIndex,0,Be)}function ce(){d.value=null}function ke(k){const w=m(),I=P(k);if(I.length>0){if(!confirm(`タイプ「${k}」は${I.length}箇所で使用されています。削除しますか?`))return}else if(!confirm(`タイプ「${k}」を削除しますか?`))return;for(let j=w.length-1;j>=0;j--)w[j].type===k&&w.splice(j,1)}function Se(k,w){if(k===w)return;const I=m(),j=new Map,le=[];I.forEach(W=>{j.has(W.type)||(j.set(W.type,[]),le.push(W.type)),j.get(W.type).push(W)});const Ce=le.map(W=>({type:W,types:j.get(W)})),Be=Ce.findIndex(W=>W.type===k),A=Ce.findIndex(W=>W.type===w);if(Be===-1||A===-1)return;const[_]=Ce.splice(Be,1);Ce.splice(A,0,_),I.splice(0,I.length),Ce.forEach(W=>{W.types.forEach(de=>I.push(de))})}function Oe(k){if(!u.value){u.value=k;return}if(u.value===k){u.value=null;return}Se(u.value,k),u.value=null}function N(){i.value=null,l.value=null,c.value=!1}function X(){a.value=null,l.value=null}function oe(k){const w=[];if(!k.type||k.type.trim()==="")w.push("タイプ名は必須です");else if(c.value){const I=n.parts;[...I.common,...I.individual].some(Ce=>Ce.type===k.type.trim())&&w.push(`タイプ「${k.type}」は既に存在します`)}return!k.parts||k.parts.length===0?w.push("最低1つのパーツが必要です"):k.parts.forEach((I,j)=>{(!I.title||I.title.trim()==="")&&w.push(`パーツ ${j+1} のタイトルは必須です`),(!I.body||I.body.trim()==="")&&w.push(`パーツ ${j+1} のテンプレートは必須です`)}),{valid:w.length===0,errors:w}}return{reorderSourcePart:d,handleReorderClick:Y,canReorderParts:te,cancelReorder:ce,activeCategory:o,selectedType:r,editingType:i,editingPart:a,editingLevel:l,isCreatingNew:c,currentTypes:f,groupedPartsByType:h,selectType:S,startCreating:z,startEditingType:b,startEditingPart:v,addPartToType:E,saveType:C,savePart:D,deletePart:$,checkTypeUsage:P,cancelEditingType:N,cancelEditingPart:X,getPartPreviewHtml:H,getPartPreviewHtmlWithComponent:U,createTempComponentFromType:L,validateType:oe,addPartSlot:J,removePartSlot:ne,updatePartSlotAllowedParts:ee,getAvailableSlotsForPart:K,extractSlotsFromTemplate:G,reorderSourceType:u,startReorderType:Oe,deletePartType:ke}}function im(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 yN(n,e,t){return(e=CN(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bN(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.
|
|
473
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sm(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 am(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?sm(Object(t),!0).forEach(function(o){yN(n,o,t[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):sm(Object(t)).forEach(function(o){Object.defineProperty(n,o,Object.getOwnPropertyDescriptor(t,o))})}return n}function kN(n,e){if(n==null)return{};var t,o,r=EN(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 EN(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 wN(n,e){return gN(n)||bN(n,e)||vN(n,e)||xN()}function SN(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 CN(n){var e=SN(n,"string");return typeof e=="symbol"?e:e+""}function vN(n,e){if(n){if(typeof n=="string")return im(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)?im(n,e):void 0}}function NN(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lm(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 cm(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?lm(Object(t),!0).forEach(function(o){NN(n,o,t[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):lm(Object(t)).forEach(function(o){Object.defineProperty(n,o,Object.getOwnPropertyDescriptor(t,o))})}return n}function zN(){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 ei(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 Ks(n){return{}.toString.call(n).includes("Object")}function TN(n){return!Object.keys(n).length}function ti(n){return typeof n=="function"}function MN(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function AN(n,e){return Ks(e)||po("changeType"),Object.keys(e).some(function(t){return!MN(n,t)})&&po("changeField"),e}function IN(n){ti(n)||po("selectorType")}function _N(n){ti(n)||Ks(n)||po("handlerType"),Ks(n)&&Object.values(n).some(function(e){return!ti(e)})&&po("handlersType")}function ON(n){n||po("initialIsRequired"),Ks(n)||po("initialType"),TN(n)&&po("initialContent")}function DN(n,e){throw new Error(n[e]||n.default)}var RN={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"},po=ei(DN)(RN),Js={changes:AN,selector:IN,handler:_N,initial:ON};function PN(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Js.initial(n),Js.handler(e);var t={current:n},o=ei(VN)(t,e),r=ei(LN)(t),i=ei(Js.changes)(n),a=ei($N)(t);function l(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(u){return u};return Js.selector(d),d(t.current)}function c(d){zN(o,r,i,a)(d)}return[l,c]}function $N(n,e){return ti(e)?e(n.current):e}function LN(n,e){return n.current=cm(cm({},n.current),e),e}function VN(n,e,t){return ti(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 BN={create:PN},FN={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function jN(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 HN(n){return{}.toString.call(n).includes("Object")}function UN(n){return n||um("configIsRequired"),HN(n)||um("configType"),n.urls?(WN(),{paths:{vs:n.urls.monacoBase}}):n}function WN(){console.warn(dm.deprecation)}function qN(n,e){throw new Error(n[e]||n.default)}var dm={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
477
474
|
You are using deprecated way of configuration.
|
|
478
475
|
|
|
479
476
|
Instead of using
|
|
@@ -482,9 +479,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
482
479
|
monaco.config({ paths: { vs: '...' } })
|
|
483
480
|
|
|
484
481
|
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
485
|
-
`},Im=IT(PT)(Mm),LT={config:DT},$T=function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return function(r){return n.reduceRight(function(i,s){return s(i)},r)}};function Om(t,e){return Object.keys(e).forEach(function(n){e[n]instanceof Object&&t[n]&&Object.assign(e[n],Om(t[n],e[n]))}),zm(zm({},t),e)}var VT={type:"cancelation",msg:"operation is manually canceled"};function Nc(t){var e=!1,n=new Promise(function(o,r){t.then(function(i){return e?r(VT):o(i)}),t.catch(r)});return n.cancel=function(){return e=!0},n}var BT=["monaco"],FT=AT.create({config:MT,isInitialized:!1,resolve:null,reject:null,monaco:null}),Dm=fT(FT,2),ti=Dm[0],Js=Dm[1];function jT(t){var e=LT.config(t),n=e.monaco,o=dT(e,BT);Js(function(r){return{config:Om(r.config,o),monaco:n}})}function UT(){var t=ti(function(e){var n=e.monaco,o=e.isInitialized,r=e.resolve;return{monaco:n,isInitialized:o,resolve:r}});if(!t.isInitialized){if(Js({isInitialized:!0}),t.monaco)return t.resolve(t.monaco),Nc(Cc);if(window.monaco&&window.monaco.editor)return Rm(window.monaco),t.resolve(window.monaco),Nc(Cc);$T(HT,GT)(qT)}return Nc(Cc)}function HT(t){return document.body.appendChild(t)}function WT(t){var e=document.createElement("script");return t&&(e.src=t),e}function GT(t){var e=ti(function(o){var r=o.config,i=o.reject;return{config:r,reject:i}}),n=WT("".concat(e.config.paths.vs,"/loader.js"));return n.onload=function(){return t()},n.onerror=e.reject,n}function qT(){var t=ti(function(n){var o=n.config,r=n.resolve,i=n.reject;return{config:o,resolve:r,reject:i}}),e=window.require;e.config(t.config),e(["vs/editor/editor.main"],function(n){var o=n.m||n;Rm(o),t.resolve(o)},function(n){t.reject(n)})}function Rm(t){ti().monaco||Js({monaco:t})}function KT(){return ti(function(t){var e=t.monaco;return e})}var Cc=new Promise(function(t,e){return Js({resolve:t,reject:e})}),JT={config:jT,init:UT,__getMonacoInstance:KT};const XT={class:"monaco-editor-wrapper"},YT={key:0,class:"monaco-editor-error"},Pm=((t,e)=>{const n=t.__vccOpts||t;for(const[o,r]of e)n[o]=r;return n})(a.defineComponent({__name:"MonacoEditor",props:{modelValue:{type:String},language:{type:String},theme:{type:String},readOnly:{type:Boolean},minimap:{type:Boolean},height:{type:String},autoHeight:{type:Boolean},maxHeight:{type:Number},enableSuggestions:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=e,r=a.ref(null),i=a.ref(null);let s=null,l=null,c=!1,d=[];function u(){const p=r.value;if(!p)return;const h=p.getRootNode();if(!(h instanceof ShadowRoot))return;const m=h;Array.from(document.head.querySelectorAll('style, link[rel="stylesheet"]')).filter(x=>{if(x.tagName==="LINK"){const w=x.href||"";return w.includes("monaco")||w.includes("/vs/")||w.includes("vs/")}const v=x.textContent||"";return v.includes(".monaco-editor")||v.includes(".monaco-editor-background")}).forEach(x=>{if(x.tagName==="LINK"){const w=x.href;if(!!m.querySelector(`link[rel="stylesheet"][href="${w}"]`))return}else{const w=x.getAttribute("data-name")||"";if(w&&!!m.querySelector(`style[data-name="${w}"]`))return}const v=x.cloneNode(!0);v.setAttribute("data-zcode-monaco-style","true"),m.appendChild(v),d.push(v)})}function f(){if(!(!s||!r.value||!l)&&n.autoHeight!==!1)try{const p=s.getOption(l.editor.EditorOption.lineHeight)||19;let b=(s.getModel()?.getLineCount()||1)*p+20;n.maxHeight!==void 0&&(b=Math.min(b,n.maxHeight)),r.value.style.height=`${b}px`,s.layout()}catch{r.value.style.height="200px"}}return a.onMounted(async()=>{if(r.value)try{l=await JT.init(),u(),l.languages.registerCompletionItemProvider("html",{provideCompletionItems:(h,m)=>{const b=h.getWordUntilPosition(m),g={startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:b.startColumn,endColumn:b.endColumn},x=h.getValueInRange({startLineNumber:m.lineNumber,startColumn:Math.max(1,m.column-10),endLineNumber:m.lineNumber,endColumn:m.column}),v=[];return(x.endsWith("$")||x.endsWith("{$"))&&v.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:textarea}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:textarea}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストエリアフィールド: {$変数名:デフォルト値:textarea}",detail:"テンプレート記法 - テキストエリア",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:rich}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:image}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}}),(x.endsWith("(")||x.endsWith("$("))&&v.push({label:"($field:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"ラジオボタン: ($フィールド名:選択肢1|選択肢2)",detail:"テンプレート記法 - ラジオボタン",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"チェックボックス: ($フィールド名:選択肢1,選択肢2)",detail:"テンプレート記法 - チェックボックス",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field@:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(単一選択): ($フィールド名@:選択肢1|選択肢2)",detail:"テンプレート記法 - セレクトボックス",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field@:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(複数選択): ($フィールド名@:選択肢1,選択肢2)",detail:"テンプレート記法 - セレクトボックス(複数)",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}}),(x.endsWith("z-")||x.endsWith(" z-"))&&v.push({label:'z-if="show_xxx"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-if="show_${1:field}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"条件分岐: z-if属性(フィールドがtrueの場合に表示)",detail:"テンプレート記法 - 条件分岐",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-2,endColumn:m.column}},{label:'z-slot="slotName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-2,endColumn:m.column}}),v.length===0&&v.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:g},{label:"{$field:default:rich}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:g},{label:"{$field:default:image}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:g},{label:"($field:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"ラジオボタン: ($フィールド名:選択肢1|選択肢2)",detail:"テンプレート記法 - ラジオボタン",range:g},{label:"($field:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"チェックボックス: ($フィールド名:選択肢1,選択肢2)",detail:"テンプレート記法 - チェックボックス",range:g},{label:"($field@:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(単一選択): ($フィールド名@:選択肢1|選択肢2)",detail:"テンプレート記法 - セレクトボックス",range:g},{label:"($field@:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(複数選択): ($フィールド名@:選択肢1,選択肢2)",detail:"テンプレート記法 - セレクトボックス(複数)",range:g},{label:'z-if="show_xxx"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-if="show_${1:field}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"条件分岐: z-if属性(フィールドがtrueの場合に表示)",detail:"テンプレート記法 - 条件分岐",range:g},{label:'z-tag="$tagName:h1|h2|h3"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-tag="$${1:tagName}:${2:h1|h2|h3}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"タグ名を動的に変更(選択肢を指定可能)",detail:"テンプレート記法 - タグ名の動的変更",range:g},{label:'z-empty="$fieldName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-empty="$${1:fieldName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"オプショナルフィールドが空の場合、親要素を削除",detail:"テンプレート記法 - 条件分岐(空の場合削除)",range:g},{label:'z-slot="slotName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:g}),{suggestions:v}},triggerCharacters:["$","(","z"]});const p=n.enableSuggestions!==!1;s=l.editor.create(r.value,{value:n.modelValue||"",language:n.language||"html",theme:n.theme||"vs-dark",readOnly:n.readOnly||!1,minimap:{enabled:n.minimap===!0},automaticLayout:!0,fontSize:14,tabSize:2,wordWrap:"off",scrollBeyondLastLine:!1,formatOnPaste:!0,formatOnType:!0,lineNumbers:"on",folding:!0,suggestOnTriggerCharacters:p,quickSuggestions:p?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:p,acceptSuggestionOnEnter:p?"on":"off",suggestSelection:"first",mouseWheelScrollSensitivity:1,fastScrollSensitivity:5,scrollbar:{alwaysConsumeMouseWheel:!1}}),s.onDidChangeModelContent(()=>{if(!c){const h=s.getValue();o("update:modelValue",h),f()}}),f()}catch(p){i.value=`Monaco Editorの読み込みに失敗しました: ${p}`,console.error("Monaco Editor error:",p)}}),a.watch(()=>n.modelValue,async p=>{s&&s.getValue()!==p&&(c=!0,await a.nextTick(),s.setValue(p||""),c=!1,f())}),a.watch(()=>n.enableSuggestions,p=>{if(s&&l){const h=p!==!1;s.updateOptions({suggestOnTriggerCharacters:h,quickSuggestions:h?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:h,acceptSuggestionOnEnter:h?"on":"off"})}}),a.onUnmounted(()=>{s&&(s.dispose(),s=null),d.forEach(p=>p.remove()),d=[]}),(p,h)=>(a.openBlock(),a.createElementBlock("div",XT,[a.createElementVNode("div",{ref_key:"editorContainer",ref:r,class:"monaco-editor-container"},null,512),i.value?(a.openBlock(),a.createElementBlock("div",YT,a.toDisplayString(i.value),1)):a.createCommentVNode("",!0)]))}}),[["styles",[".monaco-editor-wrapper{width:100%}.monaco-editor-container{width:100%;min-height:100px;max-height:400px;border:1px solid #d1d5db;border-radius:4px;overflow:hidden}.monaco-editor-error{padding:8px;background:#fee;color:#c33;border-radius:4px;margin-top:8px;font-size:12px}"]]]),QT={class:"zcode-parts-manager"},ZT={class:"zcode-parts-category-tabs"},ez={class:"zcode-parts-category-tab-group"},tz=["onClick"],nz=["title"],oz={class:"zcode-parts-manager-content"},rz={class:"zcode-parts-items"},iz={class:"zcode-part-type-title",role:"heading","aria-level":"5"},sz={class:"zcode-part-type-actions"},az=["title","onClick"],lz=["title","onClick"],cz=["title","onClick"],dz={class:"zcode-part-type-items"},uz=["onClick"],fz={key:0,class:"zcode-reorder-source-indicator"},pz={class:"zcode-part-item-header"},hz={class:"zcode-part-type"},mz={class:"zcode-part-item-actions"},gz=["title","onClick"],bz=["title","onClick"],yz=["title","onClick"],xz={class:"zcode-part-item-content"},Ez={class:"zcode-part-modules"},kz={key:0,class:"zcode-part-preview"},wz=["innerHTML"],Sz=["onClick"],Nz={class:"zcode-part-item-add-content"},Cz={class:"zcode-part-editor-header"},vz={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},Tz=["aria-label"],zz={class:"zcode-part-editor-form"},_z={class:"zcode-form-field"},Az=["placeholder"],Mz={class:"zcode-form-field"},Iz=["placeholder"],Oz={class:"zcode-part-editor-actions"},Dz={class:"zcode-part-editor-header"},Rz={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},Pz=["aria-label"],Lz={class:"zcode-part-editor-form"},$z={class:"zcode-part-editor-topbar"},Vz={class:"zcode-part-editor-topfields"},Bz={class:"zcode-form-field"},Fz={class:"zcode-form-field"},jz=["placeholder"],Uz={class:"zcode-part-editor-main"},Hz={class:"zcode-part-editor-pane zcode-part-editor-pane--code"},Wz={class:"zcode-part-editor-pane-header"},Gz=["aria-label"],qz=["aria-selected"],Kz=["aria-selected"],Jz={class:"zcode-part-editor-pane-header-actions"},Xz={key:0,class:"zcode-css-warning-compact"},Yz={class:"zcode-css-warning-compact-text"},Qz=["title"],Zz={key:1,class:"zcode-checkbox-label zcode-checkbox-label-inline"},e_=["title"],t_={class:"zcode-part-editor-pane-body"},n_={class:"zcode-part-editor-pane zcode-part-editor-pane--side"},o_={class:"zcode-part-editor-pane-body"},r_=["innerHTML"],i_={class:"zcode-part-editor-preview-hint"},s_={key:0,class:"zcode-part-editor-slots-bottom"},a_={class:"zcode-slots-config"},l_={class:"zcode-slot-config-header"},c_={class:"zcode-slot-config-title"},d_=["onClick"],u_={class:"zcode-slot-config-body"},f_={class:"zcode-checkbox-group"},p_=["onUpdate:modelValue","placeholder"],h_=["checked","onChange"],m_={key:0,class:"zcode-slot-add-section"},g_={class:"zcode-slot-add-controls"},b_={value:""},y_=["value"],x_=["disabled"],E_={class:"zcode-part-editor-actions"},k_={class:"zcode-preview-modal-header"},w_={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},S_=["innerHTML"],N_={class:"zcode-help-modal-header"},C_={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},v_=["aria-label"],T_={class:"zcode-help-modal-body"},z_={class:"zcode-warning-content"},__={class:"zcode-warning-text"},A_={class:"zcode-warning-list"},M_={class:"zcode-css-warning-modal-footer"},I_={class:"zcode-checkbox-label",style:{"margin-bottom":"12px"}},O_={class:"zcode-help-modal-header"},D_={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},R_=["aria-label"],P_={class:"zcode-help-modal-body"},L_={class:"zcode-help-section"},$_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},V_={class:"zcode-help-section-item"},B_={class:"zcode-help-section"},F_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},j_={class:"zcode-help-section-item"},U_={class:"zcode-help-section"},H_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},W_={class:"zcode-help-section-item"},G_={class:"zcode-help-modal-header"},q_={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},K_=["aria-label"],J_={class:"zcode-help-modal-body"},X_={class:"zcode-help-table"},Y_={class:"zcode-help-section"},Q_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Z_={role:"list",class:"zcode-help-section-list"},eA=["innerHTML"],tA={role:"listitem",class:"zcode-help-section-item"},nA={role:"listitem",class:"zcode-help-section-item"},oA=a.defineComponent({__name:"PartsManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.ref(!1),i=a.ref(m1("enableTemplateSuggestions",!1)),s=a.ref(!1),l=a.ref(!1),c=a.ref(!1),d=a.ref(g1()),u=a.ref("html"),f=a.ref(""),p=a.ref(""),h={common:"zcode-css-style-parts-manager-preview-common",individual:"zcode-css-style-parts-manager-preview-individual",special:"zcode-css-style-parts-manager-preview-special"},m=new Map,b=a.computed(()=>D.value==="common"?o.cmsData.css?.common??"":D.value==="individual"?o.cmsData.css?.individual??"":o.cmsData.css?.special??"");function g($){["common","individual","special"].forEach(re=>{const ae=$[re];if(!ae||!ae.trim()){const Fe=m.get(re);Fe&&(Fe.remove(),m.delete(re));return}let ke=m.get(re);ke||(ke=document.createElement("style"),ke.id=h[re],ke.setAttribute("data-zcode-css","true"),ke.setAttribute("data-zcode-css-parts-preview","true"),ke.setAttribute("data-zcode-css-category",re),ke.parentNode||document.head.appendChild(ke),m.set(re,ke)),ke.textContent=ae})}function x(){m.forEach($=>{$.remove()}),m.clear()}function v(){s.value=!0}function w(){s.value=!1}function T(){(D.value==="common"||D.value==="individual"||D.value==="special")&&(l.value=!0)}function M(){l.value=!1,b1(d.value)}a.watch(i,$=>{Ba({enableTemplateSuggestions:$})});const A=a.computed(()=>o.config?.categoryOrder||"common"),y=a.computed(()=>{const $=[],F=o.cmsData.parts.special.length>0;return A.value==="individual"?($.push("individual","common"),F&&$.push("special")):A.value==="special"?(F&&$.push("special"),$.push("common","individual")):($.push("common","individual"),F&&$.push("special")),$}),{reorderSourcePart:E,handleReorderClick:S,activeCategory:D,editingType:W,editingPart:z,editingLevel:P,isCreatingNew:V,groupedPartsByType:j,startCreating:L,startEditingType:H,startEditingPart:Q,addPartToType:G,saveType:se,savePart:Z,deletePart:X,checkTypeUsage:J,cancelEditingType:K,cancelEditingPart:Y,getPartPreviewHtml:ce,addPartSlot:Ee,removePartSlot:_e,updatePartSlotAllowedParts:Le,getAvailableSlotsForPart:C,extractSlotsFromTemplate:N,reorderSourceType:O,startReorderType:k,deletePartType:U}=iT(o.cmsData);o.config?.categoryOrder==="individual"&&(D.value="individual");const te=a.computed(()=>(P?.value??P)==="part"&&!!z.value);a.watch(()=>te.value,$=>{if(!$){x();return}a.nextTick(()=>{const F=b.value;p.value=F,f.value=F,g({common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special})})},{immediate:!0}),a.watch(()=>D.value,()=>{te.value&&a.nextTick(()=>{const $=b.value;p.value=$,f.value=$})}),a.watch([()=>f.value,()=>te.value,()=>D.value],([$,F,re])=>{F&&a.nextTick(()=>{const ae={common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special};re==="common"?ae.common=$??"":re==="individual"?ae.individual=$??"":ae.special=$??"",g(ae)})});async function me(){await Z(),!z.value&&o.cmsData.css&&(D.value==="common"?o.cmsData.css.common=f.value:D.value==="individual"?o.cmsData.css.individual=f.value:o.cmsData.css.special=f.value,p.value=f.value)}function ve(){f.value=p.value,x(),r.value=!1,Y()}a.onBeforeUnmount(()=>{x()}),a.watch(()=>z.value,$=>{$&&(u.value="html")}),a.watch(()=>u.value,$=>{$==="css"&&te.value&&(D.value==="common"||D.value==="individual"||D.value==="special")&&!d.value&&a.nextTick(()=>{T()})}),e({activeCategory:D});async function Ve(){await se()}const Ce=a.computed(()=>z.value?C(z.value.partIndex):[]),_=a.computed(()=>{if(!z.value)return!1;const $=z.value.part.body,F=$?N($).length>0:!1,re=z.value.part.slots&&Object.keys(z.value.part.slots).length>0;return F||re}),I=a.ref(""),q=()=>{!I.value||!z.value||(Ee(z.value.partIndex,I.value),I.value="")};a.watch(()=>z.value?.part.body,()=>{I.value=""});const fe=a.computed(()=>{const $=[],F=o.cmsData.parts;return[...F.common,...F.individual,...F.special||[]].forEach(ae=>{ae.parts.forEach(ke=>{$.push({id:ke.id,title:ke.title,typeName:ae.type,description:ke.description})})}),$.sort((ae,ke)=>ae.typeName!==ke.typeName?ae.typeName.localeCompare(ke.typeName):ae.title.localeCompare(ke.title))}),Ae=a.ref({}),Te=$=>{const F=Ae.value[$]||"";if(!F)return fe.value;const re=F.toLowerCase();return fe.value.filter(ae=>ae.title.toLowerCase().includes(re)||ae.typeName.toLowerCase().includes(re))},we=$=>{if(!z.value)return[];const F=z.value.part.slots?.[$];return F?F.allowedParts||[]:[]},B=($,F,re)=>{if(!z.value)return;const ae=re.target.checked,Fe=z.value.part.slots?.[$]?.allowedParts||[];let st;ae?st=[...Fe,F]:st=Fe.filter(xn=>xn!==F),Le(z.value.partIndex,$,st)};function ee($,F){const re=["zcode-part-item"];return E.value&&E.value.type===$.type&&E.value.partIndex===F&&re.push("zcode-reorder-source"),re.join(" ")}function Me($){const F=$._partIndex,re=F!=null,ae=re&&F!==void 0?F+1:0,ke=$.parts.length;if(re&&ke>1){if(!confirm(n("partsManager.deletePartConfirm",{number:ae})))return}else{const Fe=J($.type);if(Fe.length>0){if(!confirm(n("partsManager.deleteTypeWithUsagesConfirm",{type:$.type,count:Fe.length})))return}else if(!confirm(n("partsManager.deleteTypeConfirm")))return}X($)}return($,F)=>(a.openBlock(),a.createElementBlock("div",QT,[a.createElementVNode("div",ZT,[a.createElementVNode("div",ez,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(y.value,re=>(a.openBlock(),a.createElementBlock("button",{key:re,class:a.normalizeClass([{active:a.unref(D)===re},"zcode-category-tab"]),onClick:ae=>D.value=re},a.toDisplayString(re==="common"?$.$t("dataViewer.common"):re==="individual"?$.$t("dataViewer.individual"):$.$t("dataViewer.special")),11,tz))),128)),a.createElementVNode("button",{class:"zcode-help-btn",title:$.$t("dataViewer.categoryInfo.title"),onClick:F[0]||(F[0]=re=>c.value=!0)},[a.createVNode(a.unref(Vn),{size:14})],8,nz)]),a.createElementVNode("button",{class:"zcode-btn-primary zcode-parts-new-btn",onClick:F[1]||(F[1]=(...re)=>a.unref(L)&&a.unref(L)(...re))},[a.createVNode(a.unref(uo),{size:14}),a.createElementVNode("span",null,a.toDisplayString($.$t("partsManager.createType")),1)])]),a.createElementVNode("div",oz,[a.createElementVNode("div",rz,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(j),re=>(a.openBlock(),a.createElementBlock("div",{key:re.type,class:"zcode-part-type-group"},[a.createElementVNode("div",iz,[a.createTextVNode(a.toDisplayString(re.type)+" ",1),a.createElementVNode("div",sz,[re.parts.length>0?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-part-type-edit-btn",title:$.$t("partsManager.editTypeButton"),onClick:a.withModifiers(ae=>a.unref(H)(re.parts[0]),["stop"])},[a.createVNode(a.unref(oa),{size:14})],8,az)):a.createCommentVNode("",!0),a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(O)===re.type}]),title:$.$t("partsManager.reorderType"),onClick:a.withModifiers(ae=>a.unref(k)(re.type),["stop"])},[a.createVNode(a.unref(ir),{size:14})],10,lz),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:$.$t("partsManager.deleteTypeButton"),onClick:a.withModifiers(ae=>a.unref(U)(re.type),["stop"])},[a.createVNode(a.unref(Bn),{size:14})],8,cz)])]),a.createElementVNode("div",dz,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(re.parts,(ae,ke)=>(a.openBlock(),a.createElementBlock("div",{key:`${re.type}-${ke}`,class:a.normalizeClass(ee(ae,ae._partIndex??0)),onClick:Fe=>a.unref(Q)(ae,ae._partIndex??0)},[a.unref(E)&&a.unref(E).type===ae.type&&a.unref(E).partIndex===(ae._partIndex??0)?(a.openBlock(),a.createElementBlock("div",fz,a.toDisplayString($.$t("partsManager.source")),1)):a.createCommentVNode("",!0),a.createElementVNode("div",pz,[a.createElementVNode("span",hz,a.toDisplayString(ae._displayPart?.title||ae.type),1),a.createElementVNode("div",mz,[a.createElementVNode("button",{class:"zcode-action-btn",title:$.$t("partsManager.editPartButton"),onClick:a.withModifiers(Fe=>a.unref(Q)(ae,ae._partIndex??0),["stop"])},[a.createVNode(a.unref(oa),{size:14})],8,gz),a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(E)?.type===ae.type&&a.unref(E)?.partIndex===(ae._partIndex??0)}]),title:$.$t("partsManager.reorderPart"),onClick:a.withModifiers(Fe=>a.unref(S)(ae,ae._partIndex??0),["stop"])},[a.createVNode(a.unref(ir),{size:14})],10,bz),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:$.$t("partsManager.deletePartButton"),onClick:a.withModifiers(Fe=>Me({...ae,_partIndex:ae._partIndex??0}),["stop"])},[a.createVNode(a.unref(Bn),{size:14})],8,yz)])]),a.createElementVNode("div",xz,[a.createElementVNode("div",{class:a.normalizeClass(["zcode-part-description",{"zcode-description-empty":!ae._displayPart?.description&&!ae.description}])},a.toDisplayString(ae._displayPart?.description||ae.description||$.$t("partsManager.noDescription")),3),a.createElementVNode("div",Ez,a.toDisplayString($.$t("partsManager.partNumber",{current:(ae._partIndex??0)+1,total:ae.parts.length})),1),ae._displayPart?(a.openBlock(),a.createElementBlock("div",kz,[a.createElementVNode("div",{class:"zcode-part-preview-content",innerHTML:a.unref(ce)(ae,ae._displayPart)},null,8,wz)])):a.createCommentVNode("",!0)])],10,uz))),128)),re.parts.length>0?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-item zcode-part-item-add",onClick:a.withModifiers(ae=>a.unref(G)(re.parts[0]),["stop"])},[a.createElementVNode("div",Nz,[a.createVNode(a.unref(uo),{size:20}),a.createElementVNode("span",null,a.toDisplayString($.$t("partsManager.addPart")),1)])],8,Sz)):a.createCommentVNode("",!0)])]))),128))]),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(W)&&(a.unref(P)==="type"||a.unref(V))?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:F[7]||(F[7]=a.withModifiers((...re)=>a.unref(K)&&a.unref(K)(...re),["self"]))},[a.createElementVNode("div",{class:"zcode-part-modal-content",onClick:F[6]||(F[6]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",Cz,[a.createElementVNode("div",vz,a.toDisplayString(a.unref(V)?$.$t("partsManager.createType"):$.$t("partsManager.editType")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":$.$t("common.close"),onClick:F[2]||(F[2]=(...re)=>a.unref(K)&&a.unref(K)(...re))},[a.createVNode(a.unref(Qe),{size:18})],8,Tz)]),a.createElementVNode("div",zz,[a.createElementVNode("div",_z,[a.createElementVNode("label",null,[a.createTextVNode(a.toDisplayString($.$t("partsManager.typeName"))+" ",1),F[27]||(F[27]=a.createElementVNode("span",{class:"zcode-required"},"*",-1))]),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[3]||(F[3]=re=>a.unref(W).type=re),type:"text",placeholder:$.$t("partsManager.typeNamePlaceholder"),class:"zcode-text-input",required:""},null,8,Az),[[a.vModelText,a.unref(W).type]])]),a.createElementVNode("div",Mz,[a.createElementVNode("label",null,a.toDisplayString($.$t("partsManager.typeDescription")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[4]||(F[4]=re=>a.unref(W).description=re),type:"text",placeholder:$.$t("partsManager.typeDescriptionPlaceholder"),class:"zcode-text-input"},null,8,Iz),[[a.vModelText,a.unref(W).description]])])]),a.createElementVNode("div",Oz,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:Ve},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString($.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:F[5]||(F[5]=(...re)=>a.unref(K)&&a.unref(K)(...re))},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString($.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(z)&&a.unref(P)==="part"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:a.withModifiers(ve,["self"])},[a.createElementVNode("div",{class:"zcode-part-modal-content",onClick:F[17]||(F[17]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",Dz,[a.createElementVNode("div",Rz,a.toDisplayString($.$t("partsManager.editPart",{title:a.unref(z).part.title})),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":$.$t("common.close"),onClick:ve},[a.createVNode(a.unref(Qe),{size:18})],8,Pz)]),a.createElementVNode("div",Lz,[a.createElementVNode("div",$z,[a.createElementVNode("div",Vz,[a.createElementVNode("div",Bz,[a.createElementVNode("label",null,[a.createTextVNode(a.toDisplayString($.$t("partsManager.partTitle"))+" ",1),F[28]||(F[28]=a.createElementVNode("span",{class:"zcode-required"},"*",-1))]),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[8]||(F[8]=re=>a.unref(z).part.title=re),type:"text",class:"zcode-text-input",required:""},null,512),[[a.vModelText,a.unref(z).part.title]])]),a.createElementVNode("div",Fz,[a.createElementVNode("label",null,a.toDisplayString($.$t("partsManager.partDescription")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[9]||(F[9]=re=>a.unref(z).part.description=re),type:"text",class:"zcode-text-input",placeholder:$.$t("partsManager.partDescriptionPlaceholder")},null,8,jz),[[a.vModelText,a.unref(z).part.description]])])])]),a.createElementVNode("div",Uz,[a.createElementVNode("div",Hz,[a.createElementVNode("div",Wz,[a.createElementVNode("div",{class:"zcode-template-tabs",role:"tablist","aria-label":$.$t("partsManager.codeEdit")},[a.createElementVNode("button",{type:"button",class:a.normalizeClass(["zcode-template-tab",{active:u.value==="html"}]),role:"tab","aria-selected":u.value==="html",onClick:F[10]||(F[10]=re=>u.value="html")}," HTML ",10,qz),a.createElementVNode("button",{type:"button",class:a.normalizeClass(["zcode-template-tab",{active:u.value==="css"}]),role:"tab","aria-selected":u.value==="css",onClick:F[11]||(F[11]=re=>u.value="css")}," CSS ",10,Kz)],8,Gz),a.createElementVNode("div",Jz,[u.value==="css"?(a.openBlock(),a.createElementBlock("div",Xz,[a.createVNode(a.unref(na),{size:14,class:"zcode-css-warning-compact-icon"}),a.createElementVNode("span",Yz,a.toDisplayString($.$t("partsManager.cssEditInfo")),1),a.createElementVNode("button",{class:"zcode-help-btn",type:"button",title:$.$t("partsManager.cssEditWarning"),onClick:T},[a.createVNode(a.unref(Vn),{size:14})],8,Qz)])):a.createCommentVNode("",!0),u.value==="html"?(a.openBlock(),a.createElementBlock("label",Zz,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[12]||(F[12]=re=>i.value=re),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[a.vModelCheckbox,i.value]]),a.createElementVNode("span",null,a.toDisplayString($.$t("partsManager.templateSuggestions")),1)])):a.createCommentVNode("",!0),u.value==="html"?(a.openBlock(),a.createElementBlock("button",{key:2,class:"zcode-help-btn",type:"button",title:$.$t("partsManager.templateHelpButton"),onClick:v},[a.createVNode(a.unref(Vn),{size:16})],8,e_)):a.createCommentVNode("",!0)])]),a.createElementVNode("div",t_,[u.value==="html"?(a.openBlock(),a.createBlock(Pm,{key:0,modelValue:a.unref(z).part.body,"onUpdate:modelValue":F[13]||(F[13]=re=>a.unref(z).part.body=re),language:"html",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":i.value,class:"zcode-monaco-editor"},null,8,["modelValue","enable-suggestions"])):(a.openBlock(),a.createBlock(Pm,{key:1,modelValue:f.value,"onUpdate:modelValue":F[14]||(F[14]=re=>f.value=re),language:"css",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":!0,class:"zcode-monaco-editor"},null,8,["modelValue"]))])]),a.createElementVNode("div",n_,[a.createElementVNode("div",o_,[a.createElementVNode("div",{class:"zcode-part-editor-preview-tab",onClick:F[15]||(F[15]=re=>r.value=!0),innerHTML:a.unref(ce)(a.unref(z).type,a.unref(z).part)},null,8,r_),a.createElementVNode("div",i_,a.toDisplayString($.$t("partsManager.clickToEnlarge")),1)])])]),_.value?(a.openBlock(),a.createElementBlock("div",s_,[a.createElementVNode("div",a_,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(z).part.slots||{},(re,ae)=>(a.openBlock(),a.createElementBlock("div",{key:`part-${a.unref(z).partIndex}-${ae}`,class:"zcode-slot-config-item"},[a.createElementVNode("div",l_,[a.createElementVNode("div",c_,a.toDisplayString($.$t("partsManager.slot"))+": "+a.toDisplayString(ae),1),a.createElementVNode("button",{class:"zcode-btn-small",onClick:ke=>a.unref(_e)(a.unref(z).partIndex,ae)},[a.createVNode(a.unref(Bn),{size:12})],8,d_)]),a.createElementVNode("div",u_,[a.createElementVNode("label",null,a.toDisplayString($.$t("partsManager.allowedParts")),1),a.createElementVNode("div",f_,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":ke=>Ae.value[ae]=ke,type:"text",placeholder:$.$t("partsManager.searchParts"),class:"zcode-text-input",style:{"margin-bottom":"8px"}},null,8,p_),[[a.vModelText,Ae.value[ae]]]),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(Te(ae),ke=>(a.openBlock(),a.createElementBlock("label",{key:`allowed-${ae}-${ke.typeName}-${ke.id}`,class:"zcode-checkbox-item"},[a.createElementVNode("input",{type:"checkbox",checked:we(ae).includes(ke.id),class:"zcode-checkbox",onChange:Fe=>B(ae,ke.id,Fe)},null,40,h_),a.createElementVNode("span",null,a.toDisplayString(ke.title)+" ("+a.toDisplayString(ke.typeName)+")",1)]))),128))])])]))),128)),Ce.value.length>0?(a.openBlock(),a.createElementBlock("div",m_,[a.createElementVNode("label",null,a.toDisplayString($.$t("partsManager.addSlot")),1),a.createElementVNode("div",g_,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":F[16]||(F[16]=re=>I.value=re),class:"zcode-select-input"},[a.createElementVNode("option",b_,a.toDisplayString($.$t("partsManager.selectSlot")),1),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(Ce.value,re=>(a.openBlock(),a.createElementBlock("option",{key:re,value:re},a.toDisplayString(re==="default"?$.$t("partsManager.defaultSlot"):re),9,y_))),128))],512),[[a.vModelSelect,I.value]]),a.createElementVNode("button",{disabled:!I.value,class:"zcode-btn-secondary",onClick:q},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString($.$t("common.add")),1)],8,x_)])])):a.createCommentVNode("",!0)])])):a.createCommentVNode("",!0)]),a.createElementVNode("div",E_,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:me},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString($.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:ve},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString($.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[r.value&&a.unref(z)?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:F[20]||(F[20]=re=>r.value=!1)},[a.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:F[19]||(F[19]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",k_,[a.createElementVNode("div",w_,a.toDisplayString($.$t("partsManager.preview"))+" "+a.toDisplayString(a.unref(z).part.title),1),a.createElementVNode("button",{class:"zcode-close-btn",onClick:F[18]||(F[18]=re=>r.value=!1)},[a.createVNode(a.unref(Qe),{size:18})])]),a.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:a.unref(ce)(a.unref(z).type,a.unref(z).part)},null,8,S_)])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[l.value&&(a.unref(D)==="common"||a.unref(D)==="individual"||a.unref(D)==="special")?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:a.withModifiers(M,["self"])},[a.createElementVNode("div",{class:"zcode-help-modal zcode-css-warning-modal",onClick:F[22]||(F[22]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",N_,[a.createElementVNode("div",C_,[a.createVNode(a.unref(Vc),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString($.$t("partsManager.cssEditWarning")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":$.$t("common.close"),onClick:M},[a.createVNode(a.unref(Qe),{size:20})],8,v_)]),a.createElementVNode("div",T_,[a.createElementVNode("div",z_,[a.createElementVNode("div",__,[a.createElementVNode("ul",A_,[a.createElementVNode("li",null,[a.unref(D)==="common"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createTextVNode(a.toDisplayString($.$t("partsManager.cssEditWarningMessageCommon")),1)],64)):a.unref(D)==="individual"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createTextVNode(a.toDisplayString($.$t("partsManager.cssEditWarningMessageIndividual")),1)],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:2},[a.createTextVNode(a.toDisplayString($.$t("partsManager.cssEditWarningMessageSpecial")),1)],64))])])])])]),a.createElementVNode("div",M_,[a.createElementVNode("label",I_,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[21]||(F[21]=re=>d.value=re),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[a.vModelCheckbox,d.value]]),a.createElementVNode("span",null,a.toDisplayString($.$t("partsManager.dontShowAgain")),1)]),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:M},a.toDisplayString($.$t("partsManager.understood")),1)])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[c.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:F[25]||(F[25]=a.withModifiers(re=>c.value=!1,["self"]))},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:F[24]||(F[24]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",O_,[a.createElementVNode("div",D_,[a.createVNode(a.unref(na),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString($.$t("dataViewer.categoryInfo.title")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":$.$t("common.close"),onClick:F[23]||(F[23]=re=>c.value=!1)},[a.createVNode(a.unref(Qe),{size:18})],8,R_)]),a.createElementVNode("div",P_,[a.createElementVNode("div",L_,[a.createElementVNode("div",$_,a.toDisplayString($.$t("dataViewer.categoryInfo.common.title")),1),a.createElementVNode("div",V_,a.toDisplayString($.$t("dataViewer.categoryInfo.common.description")),1)]),a.createElementVNode("div",B_,[a.createElementVNode("div",F_,a.toDisplayString($.$t("dataViewer.categoryInfo.individual.title")),1),a.createElementVNode("div",j_,a.toDisplayString($.$t("dataViewer.categoryInfo.individual.description")),1)]),a.createElementVNode("div",U_,[a.createElementVNode("div",H_,a.toDisplayString($.$t("dataViewer.categoryInfo.special.title")),1),a.createElementVNode("div",W_,a.toDisplayString($.$t("dataViewer.categoryInfo.special.description")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[s.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:w},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:F[26]||(F[26]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",G_,[a.createElementVNode("div",q_,a.toDisplayString($.$t("partsManager.templateHelpTitle")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":$.$t("common.close"),onClick:w},[a.createVNode(a.unref(Qe),{size:20})],8,K_)]),a.createElementVNode("div",J_,[a.createElementVNode("table",X_,[a.createElementVNode("thead",null,[a.createElementVNode("tr",null,[a.createElementVNode("th",null,a.toDisplayString($.$t("partsManager.syntax")),1),a.createElementVNode("th",null,a.toDisplayString($.$t("partsManager.description")),1),a.createElementVNode("th",null,a.toDisplayString($.$t("partsManager.example")),1)])]),a.createElementVNode("tbody",null,[a.createElementVNode("tr",null,[F[29]||(F[29]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default}")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.textField")),1),F[30]||(F[30]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$title:タイトル}")],-1))]),a.createElementVNode("tr",null,[F[31]||(F[31]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:rich}")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.richText")),1),F[32]||(F[32]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$content:本文:rich}")],-1))]),a.createElementVNode("tr",null,[F[33]||(F[33]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:textarea}")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.textarea")),1),F[34]||(F[34]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$description:説明:textarea}")],-1))]),a.createElementVNode("tr",null,[F[35]||(F[35]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:image}")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.image")),1),F[36]||(F[36]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$hero:default.jpg:image}")],-1))]),a.createElementVNode("tr",null,[F[37]||(F[37]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field:option1|option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.radio")),1),F[38]||(F[38]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($color:red|blue|green)")],-1))]),a.createElementVNode("tr",null,[F[39]||(F[39]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field:option1,option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.checkbox")),1),F[40]||(F[40]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($features:fast,secure)")],-1))]),a.createElementVNode("tr",null,[F[41]||(F[41]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field@:option1|option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.selectSingle")),1),F[42]||(F[42]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($size@:S|M|L)")],-1))]),a.createElementVNode("tr",null,[F[43]||(F[43]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field@:option1,option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.selectMultiple")),1),F[44]||(F[44]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($tags@:tag1,tag2,tag3)")],-1))]),a.createElementVNode("tr",null,[F[45]||(F[45]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'z-if="show_field"')],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.conditional")),1),F[46]||(F[46]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'<div z-if="show_content">...</div>')],-1))]),a.createElementVNode("tr",null,[F[47]||(F[47]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'z-slot="name"')],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.slot")),1),F[48]||(F[48]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'<div z-slot="content"></div>')],-1))])])]),a.createElementVNode("div",Y_,[a.createElementVNode("div",Q_,a.toDisplayString($.$t("partsManager.templateHelp.note")),1),a.createElementVNode("div",Z_,[a.createElementVNode("div",{role:"listitem",class:"zcode-help-section-item",innerHTML:$.$t("partsManager.templateHelp.suggestionNote")},null,8,eA),a.createElementVNode("div",tA,a.toDisplayString($.$t("partsManager.templateHelp.fieldNameNote")),1),a.createElementVNode("div",nA,a.toDisplayString($.$t("partsManager.templateHelp.defaultValueNote")),1)])])])])])):a.createCommentVNode("",!0)]))])]))}});function rA(t){const e=a.ref("common"),n=a.ref(null),o=a.ref(null),r=a.ref(!1),i=a.ref(null),s=a.computed(()=>e.value==="common"?t.images.common:e.value==="individual"?t.images.individual:t.images.special);function l(x){n.value=x,o.value=null,r.value=!1}function c(x){return new Promise((v,w)=>{const T=new FileReader;T.onload=M=>{const A=M.target?.result,y={id:`img-${Date.now()}`,name:x.name,url:A,mimeType:x.type,needsUpload:!0};e.value==="common"?t.images.common.push(y):e.value==="individual"?t.images.individual.push(y):t.images.special.push(y),v(y)},T.onerror=w,T.readAsDataURL(x)})}function d(x){Sc(x,t.page).forEach(A=>{Object.keys(A.component).forEach(y=>{y.includes("image")&&A.component[y]===x&&(A.component[y]="")})});const w=t.images.common.findIndex(A=>A.id===x);w!==-1&&t.images.common.splice(w,1);const T=t.images.individual.findIndex(A=>A.id===x);T!==-1&&t.images.individual.splice(T,1);const M=t.images.special.findIndex(A=>A.id===x);M!==-1&&t.images.special.splice(M,1),n.value?.id===x&&(n.value=null)}function u(x){o.value={...x},r.value=!1,n.value=x}function f(){if(!o.value)return;let x;e.value==="common"?x=t.images.common:e.value==="individual"?x=t.images.individual:x=t.images.special;const v=x.findIndex(w=>w.id===o.value.id);v!==-1&&(x[v]=o.value),o.value=null,r.value=!1}function p(){o.value=null,r.value=!1}function h(x){return Sc(x,t.page)}function m(x){if(!i.value){i.value=x;return}if(i.value===x){g();return}b(i.value,x),g()}function b(x,v){let w;e.value==="common"?w=t.images.common:e.value==="individual"?w=t.images.individual:w=t.images.special;const T=w.findIndex(y=>y.id===x),M=w.findIndex(y=>y.id===v);if(T===-1||M===-1)return;const[A]=w.splice(T,1);w.splice(M,0,A)}function g(){i.value=null}return{reorderSourceImage:i,handleReorderClick:m,cancelReorder:g,activeCategory:e,selectedImage:n,editingImage:o,isCreatingNew:r,currentImages:s,selectImage:l,addImage:c,deleteImage:d,startEditing:u,saveImage:f,cancelEditing:p,checkImageUsage:h}}const iA={class:"zcode-images-manager"},sA={class:"zcode-images-category-tabs"},aA={class:"zcode-images-category-tab-group"},lA=["onClick"],cA=["title"],dA={class:"zcode-images-add-wrapper"},uA={class:"zcode-images-manager-content"},fA={class:"zcode-images-grid"},pA=["onClick"],hA={key:0,class:"zcode-reorder-source-indicator"},mA=["src","alt"],gA={class:"zcode-image-item-overlay"},bA={class:"zcode-image-item-actions"},yA=["title","onClick"],xA=["title","onClick"],EA={class:"zcode-image-item-name"},kA={class:"zcode-image-editor-header"},wA={class:"zcode-image-editor-header-title",role:"heading","aria-level":"4"},SA=["aria-label"],NA={class:"zcode-image-editor-form"},CA={class:"zcode-image-preview-large"},vA=["src","alt"],TA={class:"zcode-form-field"},zA={class:"zcode-form-field"},_A={class:"zcode-image-editor-actions"},AA={class:"zcode-help-modal-header"},MA={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},IA=["aria-label"],OA={class:"zcode-help-modal-body"},DA={class:"zcode-help-section"},RA={class:"zcode-help-section-title",role:"heading","aria-level":"4"},PA={class:"zcode-help-section-item"},LA={class:"zcode-help-section"},$A={class:"zcode-help-section-title",role:"heading","aria-level":"4"},VA={class:"zcode-help-section-item"},BA={class:"zcode-help-section"},FA={class:"zcode-help-section-title",role:"heading","aria-level":"4"},jA={class:"zcode-help-section-item"},UA=a.defineComponent({__name:"ImagesManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.ref(null),i=a.ref(!1),s=a.computed(()=>o.config?.categoryOrder||"common"),l=a.computed(()=>{const A=[],y=o.cmsData.images.special.length>0;return s.value==="individual"?(A.push("individual","common"),y&&A.push("special")):s.value==="special"?(y&&A.push("special"),A.push("common","individual")):(A.push("common","individual"),y&&A.push("special")),A}),{reorderSourceImage:c,handleReorderClick:d,activeCategory:u,editingImage:f,currentImages:p,addImage:h,deleteImage:m,startEditing:b,saveImage:g,cancelEditing:x,checkImageUsage:v}=rA(o.cmsData);o.config?.categoryOrder==="individual"?u.value="individual":o.config?.categoryOrder==="special"&&(u.value="special"),e({activeCategory:u});async function w(A){const y=A.target,E=y.files?.[0];if(E)try{await h(E),y&&(y.value="")}catch(S){console.error("画像追加エラー:",S),alert(n("imagesManager.addImageFailed"))}}function T(A){const y=["zcode-image-item"];return c.value===A.id&&y.push("zcode-reorder-source"),y.join(" ")}function M(A){const y=v(A.id);if(y.length>0){if(!confirm(n("imagesManager.deleteImageWithUsagesConfirm",{count:y.length})))return}else if(!confirm(n("imagesManager.deleteImageConfirm")))return;m(A.id)}return(A,y)=>(a.openBlock(),a.createElementBlock("div",iA,[a.createElementVNode("div",sA,[a.createElementVNode("div",aA,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(l.value,E=>(a.openBlock(),a.createElementBlock("button",{key:E,class:a.normalizeClass([{active:a.unref(u)===E},"zcode-category-tab"]),onClick:S=>u.value=E},a.toDisplayString(E==="common"?A.$t("dataViewer.common"):E==="individual"?A.$t("dataViewer.individual"):A.$t("dataViewer.special")),11,lA))),128)),a.createElementVNode("button",{class:"zcode-help-btn",title:A.$t("dataViewer.categoryInfo.title"),onClick:y[0]||(y[0]=E=>i.value=!0)},[a.createVNode(a.unref(Vn),{size:14})],8,cA)]),a.createElementVNode("div",dA,[a.createElementVNode("input",{ref_key:"fileInput",ref:r,type:"file",accept:"image/*",style:{display:"none"},onChange:w},null,544),a.createElementVNode("button",{class:"zcode-btn-primary zcode-images-add-btn",onClick:y[1]||(y[1]=E=>r.value?.click())},[a.createVNode(a.unref(uo),{size:14}),a.createElementVNode("span",null,a.toDisplayString(A.$t("imagesManager.addImage")),1)])])]),a.createElementVNode("div",uA,[a.createElementVNode("div",fA,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(p),E=>(a.openBlock(),a.createElementBlock("div",{key:E.id,class:a.normalizeClass(T(E)),onClick:S=>a.unref(b)(E)},[a.unref(c)===E.id?(a.openBlock(),a.createElementBlock("div",hA,a.toDisplayString(A.$t("partsManager.source")),1)):a.createCommentVNode("",!0),a.createElementVNode("img",{src:E.url,alt:E.name},null,8,mA),a.createElementVNode("div",gA,[a.createElementVNode("div",bA,[a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(c)===E.id}]),title:A.$t("partsManager.reorderPart"),onClick:a.withModifiers(S=>a.unref(d)(E.id),["stop"])},[a.createVNode(a.unref(ir),{size:16})],10,yA),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:A.$t("partsManager.deletePartButton"),onClick:a.withModifiers(S=>M(E),["stop"])},[a.createVNode(a.unref(Bn),{size:16})],8,xA)])]),a.createElementVNode("div",EA,a.toDisplayString(E.name),1)],10,pA))),128))])]),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(f)?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:y[8]||(y[8]=a.withModifiers((...E)=>a.unref(x)&&a.unref(x)(...E),["self"]))},[a.createElementVNode("div",{class:"zcode-image-modal-content","data-edit-mode":"",onClick:y[7]||(y[7]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",kA,[a.createElementVNode("div",wA,a.toDisplayString(A.$t("imagesManager.editImage")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":A.$t("common.close"),onClick:y[2]||(y[2]=(...E)=>a.unref(x)&&a.unref(x)(...E))},[a.createVNode(a.unref(Qe),{size:18})],8,SA)]),a.createElementVNode("div",NA,[a.createElementVNode("div",CA,[a.createElementVNode("img",{src:a.unref(f).url,alt:a.unref(f).name,class:"zcode-image-preview-large-img"},null,8,vA)]),a.createElementVNode("div",TA,[a.createElementVNode("label",null,a.toDisplayString(A.$t("imagesManager.imageId")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":y[3]||(y[3]=E=>a.unref(f).id=E),type:"text",class:"zcode-text-input",disabled:""},null,512),[[a.vModelText,a.unref(f).id]])]),a.createElementVNode("div",zA,[a.createElementVNode("label",null,a.toDisplayString(A.$t("imagesManager.imageName")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":y[4]||(y[4]=E=>a.unref(f).name=E),type:"text",class:"zcode-text-input"},null,512),[[a.vModelText,a.unref(f).name]])]),a.createElementVNode("div",_A,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-image-editor-actions-btn",onClick:y[5]||(y[5]=(...E)=>a.unref(g)&&a.unref(g)(...E))},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(A.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-image-editor-actions-btn",onClick:y[6]||(y[6]=(...E)=>a.unref(x)&&a.unref(x)(...E))},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(A.$t("common.cancel")),1)])])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[i.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:y[11]||(y[11]=a.withModifiers(E=>i.value=!1,["self"]))},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:y[10]||(y[10]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",AA,[a.createElementVNode("div",MA,[a.createVNode(a.unref(na),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString(A.$t("dataViewer.categoryInfo.title")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":A.$t("common.close"),onClick:y[9]||(y[9]=E=>i.value=!1)},[a.createVNode(a.unref(Qe),{size:18})],8,IA)]),a.createElementVNode("div",OA,[a.createElementVNode("div",DA,[a.createElementVNode("div",RA,a.toDisplayString(A.$t("dataViewer.categoryInfo.common.title")),1),a.createElementVNode("div",PA,a.toDisplayString(A.$t("dataViewer.categoryInfo.common.description")),1)]),a.createElementVNode("div",LA,[a.createElementVNode("div",$A,a.toDisplayString(A.$t("dataViewer.categoryInfo.individual.title")),1),a.createElementVNode("div",VA,a.toDisplayString(A.$t("dataViewer.categoryInfo.individual.description")),1)]),a.createElementVNode("div",BA,[a.createElementVNode("div",FA,a.toDisplayString(A.$t("dataViewer.categoryInfo.special.title")),1),a.createElementVNode("div",jA,a.toDisplayString(A.$t("dataViewer.categoryInfo.special.description")),1)])])])])):a.createCommentVNode("",!0)]))]))}}),HA={class:"zcode-data-viewer"},WA={class:"zcode-data-viewer-header"},GA={class:"zcode-data-viewer-content-tabs"},qA={class:"zcode-data-viewer-tabs"},KA=["onClick"],JA={class:"zcode-data-viewer-content"},XA={class:"zcode-data-viewer-display-wrapper"},YA={class:"zcode-data-viewer-display"},QA=["title"],ZA=a.defineComponent({__name:"DataViewer",props:{cmsData:{type:Object},config:{type:Object}},setup(t,{expose:e}){const n=t,o=a.ref("page"),r=a.ref("json"),i=a.ref(!1),s=a.computed(()=>n.config?.categoryOrder||"common"),l=a.computed(()=>{const v=[],w=o.value==="parts"?n.cmsData.parts.special.length>0:n.cmsData.images.special.length>0;return s.value==="individual"?(v.push("individual","common"),w&&v.push("special")):s.value==="special"?(w&&v.push("special"),v.push("common","individual")):(v.push("common","individual"),w&&v.push("special")),v}),c=a.ref(n.config?.categoryOrder==="individual"?"individual":n.config?.categoryOrder==="special"?"special":"common"),{fullPageHtml:d}=fi(n.cmsData,!1),u=a.computed(()=>{switch(o.value){case"page":return n.cmsData.page;case"parts":return c.value==="common"?n.cmsData.parts.common:c.value==="individual"?n.cmsData.parts.individual:n.cmsData.parts.special;case"images":return c.value==="common"?n.cmsData.images.common:c.value==="individual"?n.cmsData.images.individual:n.cmsData.images.special;default:return null}}),f=a.ref("");let p="";function h(){try{const v=u.value,w=JSON.stringify(v,null,2);if(w===p)return;f.value=w,p=w}catch{f.value=String(u.value),p=f.value}}function m(v){let w=v.replace(/\\\\/g,"\0").replace(/\\u([0-9a-fA-F]{4})/g,(T,M)=>String.fromCharCode(parseInt(M,16))).replace(/\\n/g,`
|
|
486
|
-
`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\\//g,"/").replace(/\u0000/g,"\\");return
|
|
482
|
+
`},um=jN(qN)(dm),GN={config:UN},KN=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 pm(n,e){return Object.keys(e).forEach(function(t){e[t]instanceof Object&&n[t]&&Object.assign(e[t],pm(n[t],e[t]))}),am(am({},n),e)}var JN={type:"cancelation",msg:"operation is manually canceled"};function wc(n){var e=!1,t=new Promise(function(o,r){n.then(function(i){return e?r(JN):o(i)}),n.catch(r)});return t.cancel=function(){return e=!0},t}var XN=["monaco"],YN=BN.create({config:FN,isInitialized:!1,resolve:null,reject:null,monaco:null}),fm=wN(YN,2),ni=fm[0],Xs=fm[1];function QN(n){var e=GN.config(n),t=e.monaco,o=kN(e,XN);Xs(function(r){return{config:pm(r.config,o),monaco:t}})}function ZN(){var n=ni(function(e){var t=e.monaco,o=e.isInitialized,r=e.resolve;return{monaco:t,isInitialized:o,resolve:r}});if(!n.isInitialized){if(Xs({isInitialized:!0}),n.monaco)return n.resolve(n.monaco),wc(Sc);if(window.monaco&&window.monaco.editor)return hm(window.monaco),n.resolve(window.monaco),wc(Sc);KN(ez,nz)(oz)}return wc(Sc)}function ez(n){return document.body.appendChild(n)}function tz(n){var e=document.createElement("script");return n&&(e.src=n),e}function nz(n){var e=ni(function(o){var r=o.config,i=o.reject;return{config:r,reject:i}}),t=tz("".concat(e.config.paths.vs,"/loader.js"));return t.onload=function(){return n()},t.onerror=e.reject,t}function oz(){var n=ni(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;hm(o),n.resolve(o)},function(t){n.reject(t)})}function hm(n){ni().monaco||Xs({monaco:n})}function rz(){return ni(function(n){var e=n.monaco;return e})}var Sc=new Promise(function(n,e){return Xs({resolve:n,reject:e})}),iz={config:QN,init:ZN,__getMonacoInstance:rz};const sz={class:"monaco-editor-wrapper"},az={key:0,class:"monaco-editor-error"},mm=((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,{expose:e,emit:t}){const o=n,r=t,i=s.ref(null),a=s.ref(null);let l=null,c=null,d=null,u=!1,p=[];function f(){const m=i.value;if(!m)return;const g=m.getRootNode();if(!(g instanceof ShadowRoot))return;const y=g;Array.from(document.head.querySelectorAll('style, link[rel="stylesheet"]')).filter(S=>{if(S.tagName==="LINK"){const b=S.href||"";return b.includes("monaco")||b.includes("/vs/")||b.includes("vs/")}const z=S.textContent||"";return z.includes(".monaco-editor")||z.includes(".monaco-editor-background")}).forEach(S=>{if(S.tagName==="LINK"){const b=S.href;if(!!y.querySelector(`link[rel="stylesheet"][href="${b}"]`))return}else{const b=S.getAttribute("data-name")||"";if(b&&!!y.querySelector(`style[data-name="${b}"]`))return}const z=S.cloneNode(!0);z.setAttribute("data-zcode-monaco-style","true"),y.appendChild(z),p.push(z)})}function h(){if(!(!l||!i.value||!c)&&o.autoHeight!==!1)try{const m=l.getOption(c.editor.EditorOption.lineHeight)||19;let x=(l.getModel()?.getLineCount()||1)*m+20;o.maxHeight!==void 0&&(x=Math.min(x,o.maxHeight)),i.value.style.height=`${x}px`,l.layout()}catch{i.value.style.height="200px"}}return s.onMounted(async()=>{if(i.value)try{c=await iz.init(),f(),d=c.languages.registerCompletionItemProvider("html",{provideCompletionItems:(g,y)=>{const x=g.getWordUntilPosition(y),T={startLineNumber:y.lineNumber,endLineNumber:y.lineNumber,startColumn:x.startColumn,endColumn:x.endColumn},S=g.getValueInRange({startLineNumber:y.lineNumber,startColumn:Math.max(1,y.column-10),endLineNumber:y.lineNumber,endColumn:y.column}),z=[];return(S.endsWith("$")||S.endsWith("{$"))&&z.push({label:"{$field:default}",kind:c.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:{startLineNumber:y.lineNumber,endLineNumber:y.lineNumber,startColumn:y.column-(S.endsWith("{$")?2:1),endColumn:y.column}},{label:"{$field:default:textarea}",kind:c.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:textarea}",insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストエリアフィールド: {$変数名:デフォルト値:textarea}",detail:"テンプレート記法 - テキストエリア",range:{startLineNumber:y.lineNumber,endLineNumber:y.lineNumber,startColumn:y.column-(S.endsWith("{$")?2:1),endColumn:y.column}},{label:"{$field:default:rich}",kind:c.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:{startLineNumber:y.lineNumber,endLineNumber:y.lineNumber,startColumn:y.column-(S.endsWith("{$")?2:1),endColumn:y.column}},{label:"{$field:default:image}",kind:c.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:{startLineNumber:y.lineNumber,endLineNumber:y.lineNumber,startColumn:y.column-(S.endsWith("{$")?2:1),endColumn:y.column}}),(S.endsWith("(")||S.endsWith("$("))&&z.push({label:"($field:option1|option2)",kind:c.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1}|${3:option2})",insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"ラジオボタン: ($フィールド名:選択肢1|選択肢2)",detail:"テンプレート記法 - ラジオボタン",range:{startLineNumber:y.lineNumber,endLineNumber:y.lineNumber,startColumn:y.column-(S.endsWith("$(")?2:1),endColumn:y.column}},{label:"($field:option1,option2)",kind:c.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1},${3:option2})",insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"チェックボックス: ($フィールド名:選択肢1,選択肢2)",detail:"テンプレート記法 - チェックボックス",range:{startLineNumber:y.lineNumber,endLineNumber:y.lineNumber,startColumn:y.column-(S.endsWith("$(")?2:1),endColumn:y.column}},{label:"($field@:option1|option2)",kind:c.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1}|${3:option2})",insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(単一選択): ($フィールド名@:選択肢1|選択肢2)",detail:"テンプレート記法 - セレクトボックス",range:{startLineNumber:y.lineNumber,endLineNumber:y.lineNumber,startColumn:y.column-(S.endsWith("$(")?2:1),endColumn:y.column}},{label:"($field@:option1,option2)",kind:c.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1},${3:option2})",insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(複数選択): ($フィールド名@:選択肢1,選択肢2)",detail:"テンプレート記法 - セレクトボックス(複数)",range:{startLineNumber:y.lineNumber,endLineNumber:y.lineNumber,startColumn:y.column-(S.endsWith("$(")?2:1),endColumn:y.column}}),(S.endsWith("z-")||S.endsWith(" z-"))&&z.push({label:'z-if="show_xxx"',kind:c.languages.CompletionItemKind.Snippet,insertText:'z-if="show_${1:field}"',insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"条件分岐: z-if属性(フィールドがtrueの場合に表示)",detail:"テンプレート記法 - 条件分岐",range:{startLineNumber:y.lineNumber,endLineNumber:y.lineNumber,startColumn:y.column-2,endColumn:y.column}},{label:'z-slot="slotName"',kind:c.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:{startLineNumber:y.lineNumber,endLineNumber:y.lineNumber,startColumn:y.column-2,endColumn:y.column}}),z.length===0&&z.push({label:"{$field:default}",kind:c.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:T},{label:"{$field:default:rich}",kind:c.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:T},{label:"{$field:default:image}",kind:c.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:T},{label:"($field:option1|option2)",kind:c.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1}|${3:option2})",insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"ラジオボタン: ($フィールド名:選択肢1|選択肢2)",detail:"テンプレート記法 - ラジオボタン",range:T},{label:"($field:option1,option2)",kind:c.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1},${3:option2})",insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"チェックボックス: ($フィールド名:選択肢1,選択肢2)",detail:"テンプレート記法 - チェックボックス",range:T},{label:"($field@:option1|option2)",kind:c.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1}|${3:option2})",insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(単一選択): ($フィールド名@:選択肢1|選択肢2)",detail:"テンプレート記法 - セレクトボックス",range:T},{label:"($field@:option1,option2)",kind:c.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1},${3:option2})",insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(複数選択): ($フィールド名@:選択肢1,選択肢2)",detail:"テンプレート記法 - セレクトボックス(複数)",range:T},{label:'z-if="show_xxx"',kind:c.languages.CompletionItemKind.Snippet,insertText:'z-if="show_${1:field}"',insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"条件分岐: z-if属性(フィールドがtrueの場合に表示)",detail:"テンプレート記法 - 条件分岐",range:T},{label:'z-tag="$tagName:h1|h2|h3"',kind:c.languages.CompletionItemKind.Snippet,insertText:'z-tag="$${1:tagName}:${2:h1|h2|h3}"',insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"タグ名を動的に変更(選択肢を指定可能)",detail:"テンプレート記法 - タグ名の動的変更",range:T},{label:'z-empty="$fieldName"',kind:c.languages.CompletionItemKind.Snippet,insertText:'z-empty="$${1:fieldName}"',insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"オプショナルフィールドが空の場合、親要素を削除",detail:"テンプレート記法 - 条件分岐(空の場合削除)",range:T},{label:'z-slot="slotName"',kind:c.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:T}),{suggestions:z}},triggerCharacters:["$","(","z"]});const m=o.enableSuggestions!==!1;l=c.editor.create(i.value,{value:o.modelValue||"",language:o.language||"html",theme:o.theme||"vs-dark",readOnly:o.readOnly||!1,minimap:{enabled:o.minimap===!0},automaticLayout:!0,fontSize:14,tabSize:2,wordWrap:"off",scrollBeyondLastLine:!1,formatOnPaste:!0,formatOnType:!0,lineNumbers:"on",folding:!0,suggestOnTriggerCharacters:m,quickSuggestions:m?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:m,acceptSuggestionOnEnter:m?"on":"off",suggestSelection:"first",mouseWheelScrollSensitivity:1,fastScrollSensitivity:5,scrollbar:{alwaysConsumeMouseWheel:!1}}),l.onDidChangeModelContent(()=>{if(!u){const g=l.getValue();r("update:modelValue",g),h()}}),h()}catch(m){a.value=`Monaco Editorの読み込みに失敗しました: ${m}`,ge.error("Monaco Editor error:",m)}}),s.watch(()=>o.modelValue,async m=>{l&&l.getValue()!==m&&(u=!0,await s.nextTick(),l.setValue(m||""),u=!1,h())}),s.watch(()=>o.enableSuggestions,m=>{if(l&&c){const g=m!==!1;l.updateOptions({suggestOnTriggerCharacters:g,quickSuggestions:g?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:g,acceptSuggestionOnEnter:g?"on":"off"})}}),s.onUnmounted(()=>{d?.dispose(),d=null,l&&(l.dispose(),l=null),p.forEach(m=>m.remove()),p=[]}),e({insertTextAtCursor(m){if(!l)return;const g=l.getSelection();g&&l.executeEdits("insert-image-id",[{range:g,text:m,forceMoveMarkers:!0}])}}),(m,g)=>(s.openBlock(),s.createElementBlock("div",sz,[s.createElementVNode("div",{ref_key:"editorContainer",ref:i,class:"monaco-editor-container"},null,512),a.value?(s.openBlock(),s.createElementBlock("div",az,s.toDisplayString(a.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}"]]]),lz={class:"zcode-parts-manager"},cz={class:"zcode-parts-category-tabs"},dz={key:0,class:"zcode-parts-category-tab-group"},uz=["onClick"],pz=["title"],fz={class:"zcode-parts-add-wrapper"},hz={class:"zcode-parts-manager-content"},mz={class:"zcode-parts-items"},gz={class:"zcode-part-type-title",role:"heading","aria-level":"5"},yz={class:"zcode-part-type-actions"},bz=["title","onClick"],xz=["title","onClick"],kz=["title","onClick"],Ez={class:"zcode-part-type-items"},wz=["onClick"],Sz={key:0,class:"zcode-reorder-source-indicator"},Cz={class:"zcode-part-item-header"},vz={class:"zcode-part-type"},Nz={class:"zcode-part-item-actions"},zz=["title","onClick"],Tz=["title","onClick"],Mz=["title","onClick"],Az={class:"zcode-part-item-content"},Iz={class:"zcode-part-modules"},_z={key:0,class:"zcode-part-preview"},Oz=["innerHTML"],Dz=["onClick"],Rz={class:"zcode-part-item-add-content"},Pz={class:"zcode-part-editor-header"},$z={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},Lz=["aria-label"],Vz={class:"zcode-part-editor-form"},Bz={class:"zcode-form-field"},Fz=["placeholder"],jz={class:"zcode-form-field"},Hz=["placeholder"],Uz={class:"zcode-part-editor-actions"},Wz={class:"zcode-part-editor-header"},qz={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},Gz=["title","aria-expanded"],Kz=["aria-label"],Jz={class:"zcode-part-editor-options-popover-title"},Xz={class:"zcode-part-editor-options-popover-body"},Yz={class:"zcode-part-editor-options-row"},Qz={class:"zcode-part-editor-options-label"},Zz=["value"],eT={value:"outer"},tT={value:"inner"},nT=["aria-label"],oT={class:"zcode-part-editor-form"},rT={class:"zcode-part-editor-topbar"},iT={class:"zcode-part-editor-topfields"},sT={class:"zcode-form-field"},aT={class:"zcode-form-field"},lT=["placeholder"],cT={class:"zcode-part-editor-main"},dT={class:"zcode-part-editor-pane zcode-part-editor-pane--code"},uT={class:"zcode-part-editor-pane-header"},pT=["aria-label"],fT=["aria-selected"],hT=["aria-selected"],mT=["aria-selected"],gT={class:"zcode-part-editor-pane-header-actions"},yT={key:0,class:"zcode-css-warning-compact"},bT={class:"zcode-css-warning-compact-text"},xT=["title"],kT={key:1,class:"zcode-checkbox-label zcode-checkbox-label-inline"},ET=["title"],wT={class:"zcode-part-editor-pane-body"},ST={key:0,class:"zcode-slots-config zcode-slots-config-in-pane"},CT={class:"zcode-slot-config-header"},vT={class:"zcode-slot-config-title"},NT=["onClick"],zT={class:"zcode-slot-config-body"},TT={class:"zcode-checkbox-group"},MT=["onUpdate:modelValue","placeholder"],AT=["checked","onChange"],IT={key:0,class:"zcode-slot-add-section"},_T={class:"zcode-slot-add-controls"},OT={value:""},DT=["value"],RT=["disabled"],PT={class:"zcode-part-editor-pane zcode-part-editor-pane--side"},$T=["aria-label"],LT=["aria-selected"],VT=["aria-selected"],BT=["aria-selected"],FT={class:"zcode-part-editor-pane-body"},jT=["innerHTML"],HT={class:"zcode-part-editor-preview-hint"},UT={key:1,class:"zcode-image-id-reference"},WT={class:"zcode-image-id-reference-header"},qT={key:0,class:"zcode-image-id-reference-list"},GT=["src","alt"],KT={class:"zcode-image-id-info"},JT={class:"zcode-image-id-code"},XT={class:"zcode-image-id-name"},YT={class:"zcode-image-id-actions"},QT=["onClick"],ZT=["onClick"],eM={key:1,class:"zcode-image-id-empty"},tM={class:"zcode-edit-panel-preview-heading"},nM={class:"zcode-edit-panel-preview-desc"},oM={class:"zcode-edit-panel-preview-wrap"},rM={key:1,class:"zcode-edit-panel-preview-empty"},iM={class:"zcode-part-editor-actions"},sM={class:"zcode-preview-modal-header"},aM={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},lM=["innerHTML"],cM={class:"zcode-help-modal-header"},dM={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},uM=["aria-label"],pM={class:"zcode-help-modal-body"},fM={class:"zcode-warning-content"},hM={class:"zcode-warning-text"},mM={class:"zcode-warning-list"},gM={class:"zcode-css-warning-modal-footer"},yM={class:"zcode-checkbox-label",style:{"margin-bottom":"12px"}},bM={class:"zcode-help-modal-header"},xM={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},kM=["aria-label"],EM={class:"zcode-help-modal-body"},wM={class:"zcode-help-section"},SM={class:"zcode-help-section-title",role:"heading","aria-level":"4"},CM={class:"zcode-help-section-item"},vM={class:"zcode-help-section"},NM={class:"zcode-help-section-title",role:"heading","aria-level":"4"},zM={class:"zcode-help-section-item"},TM={class:"zcode-help-section"},MM={class:"zcode-help-section-title",role:"heading","aria-level":"4"},AM={class:"zcode-help-section-item"},IM={class:"zcode-help-modal-header"},_M={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},OM=["aria-label"],DM={class:"zcode-help-modal-body"},RM={class:"zcode-help-table"},PM={class:"zcode-help-section"},$M={class:"zcode-help-section-title",role:"heading","aria-level":"4"},LM={role:"list",class:"zcode-help-section-list"},VM=["innerHTML"],BM={role:"listitem",class:"zcode-help-section-item"},FM={role:"listitem",class:"zcode-help-section-item"},gm=s.defineComponent({__name:"PartsManagerPanel",props:{cmsData:{type:Object},config:{type:Object},fixedCategory:{type:String}},setup(n,{expose:e}){const{t}=rn(),o=n,r=s.ref(!1),i=s.ref(!1),a=s.ref(null),l=s.ref(zb("enableTemplateSuggestions",!1)),c=s.ref(!1),d=s.ref(!1),u=s.ref(!1),p=s.ref(Tb()),f=s.ref("html"),h=s.ref("preview"),m=s.ref(null),g=s.ref(""),y=s.ref(""),x={common:"zcode-css-style-parts-manager-preview-common",individual:"zcode-css-style-parts-manager-preview-individual",special:"zcode-css-style-parts-manager-preview-special"},T=new Map,S=s.computed(()=>G.value==="common"?o.cmsData.css?.common??"":G.value==="individual"?o.cmsData.css?.individual??"":o.cmsData.css?.special??"");function z(R){["common","individual","special"].forEach(Z=>{const pe=R[Z];if(!pe||!pe.trim()){const nt=T.get(Z);nt&&(nt.remove(),T.delete(Z));return}let Ae=T.get(Z);Ae||(Ae=document.createElement("style"),Ae.id=x[Z],Ae.setAttribute("data-zcode-css","true"),Ae.setAttribute("data-zcode-css-parts-preview","true"),Ae.setAttribute("data-zcode-css-category",Z),Ae.parentNode||document.head.appendChild(Ae),T.set(Z,Ae)),Ae.textContent=pe})}function b(){T.forEach(R=>{R.remove()}),T.clear()}function v(){c.value=!0}function E(){c.value=!1}const C=s.computed(()=>{const R=o.cmsData.images?.common??[],B=o.cmsData.images?.individual??[],Z=o.cmsData.images?.special??[];return[...R,...B,...Z]});async function M(R){try{await navigator.clipboard.writeText(R)}catch{const B=document.createElement("textarea");B.value=R,B.style.position="fixed",B.style.opacity="0",document.body.appendChild(B),B.select(),document.execCommand("copy"),document.body.removeChild(B)}}function D(R){m.value?.insertTextAtCursor(R)}function $(){(G.value==="common"||G.value==="individual"||G.value==="special")&&(d.value=!0)}function P(){d.value=!1,Mb(p.value)}s.watch(f,R=>{R!=="html"&&h.value==="imageRef"&&(h.value="preview")}),s.watch(l,R=>{Oa({enableTemplateSuggestions:R})});function L(R){a.value&&!a.value.contains(R.target)&&(i.value=!1,document.removeEventListener("click",L))}s.watch(i,R=>{R?s.nextTick(()=>{document.addEventListener("click",L)}):document.removeEventListener("click",L)});const V=s.computed(()=>o.config?.categoryOrder||"common"),F=s.computed(()=>{const R=[];return V.value==="individual"?R.push("individual","common","special"):V.value==="special"?R.push("special","common","individual"):R.push("common","individual","special"),R}),{reorderSourcePart:H,handleReorderClick:U,activeCategory:G,editingType:K,editingPart:J,editingLevel:ne,isCreatingNew:ee,groupedPartsByType:Y,startCreating:te,startEditingType:se,startEditingPart:ce,addPartToType:ke,saveType:Se,savePart:Oe,deletePart:N,checkTypeUsage:X,cancelEditingType:oe,cancelEditingPart:k,getPartPreviewHtml:w,getPartPreviewHtmlWithComponent:I,createTempComponentFromType:j,addPartSlot:le,removePartSlot:Ce,updatePartSlotAllowedParts:Be,getAvailableSlotsForPart:A,extractSlotsFromTemplate:_,reorderSourceType:W,startReorderType:de,deletePartType:Pe}=mN(o.cmsData,{beforeSavePart:o.config?.studio?.beforeSavePart,sanitize:o.config?.studio?.sanitizePartTemplate}),ue=s.ref(null);s.watch(()=>J.value,R=>{if(!R){ue.value=null,i.value=!1;return}const B=j(R.type,R.part);ue.value=s.reactive({...B,type:R.type.type})},{deep:!0});const q=s.computed(()=>{const R=J.value,B=ue.value;return!R||!B?[]:om(R.part,B)}),Q=s.ref("");let Te=null;function De(){const R=J.value;if(!R){Q.value="";return}const B=ue.value;B?Q.value=I(R.part,B):Q.value=w(R.type,R.part)}s.watch(()=>[J.value?.part.body,J.value?.part.id,ue.value],()=>{Te&&clearTimeout(Te),Te=setTimeout(()=>{De(),Te=null},300)},{immediate:!0});function qe(R){const B=ue.value;B&&(B[R.fieldName]=R.currentValue);const Z=J.value?.part.id;if(Z&&o.cmsData?.page?.length){const pe=xb(o.cmsData.page,Z);pe&&(pe[R.fieldName]=R.currentValue)}De()}o.fixedCategory?G.value=o.fixedCategory:o.config?.categoryOrder==="individual"?G.value="individual":o.config?.categoryOrder==="special"&&(G.value="special");const Je=s.computed(()=>(ne?.value??ne)==="part"&&!!J.value);s.watch(()=>Je.value,R=>{if(!R){b();return}s.nextTick(()=>{const B=S.value;y.value=B,g.value=B,z({common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special})})},{immediate:!0}),s.watch(()=>G.value,()=>{Je.value&&s.nextTick(()=>{const R=S.value;y.value=R,g.value=R})}),s.watch([()=>g.value,()=>Je.value,()=>G.value],([R,B,Z])=>{B&&s.nextTick(()=>{const pe={common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special};Z==="common"?pe.common=R??"":Z==="individual"?pe.individual=R??"":pe.special=R??"",z(pe)})});async function kt(){await Oe(),!J.value&&o.cmsData.css&&(G.value==="common"?o.cmsData.css.common=g.value:G.value==="individual"?o.cmsData.css.individual=g.value:o.cmsData.css.special=g.value,y.value=g.value)}function At(){g.value=y.value,b(),r.value=!1,k()}s.onBeforeUnmount(()=>{Te&&(clearTimeout(Te),Te=null),b()}),s.watch(()=>J.value,R=>{R&&(f.value="html")}),s.watch(()=>f.value,R=>{R==="css"&&Je.value&&(G.value==="common"||G.value==="individual"||G.value==="special")&&!p.value&&s.nextTick(()=>{$()})}),e({activeCategory:G});async function en(){await Se()}const Pt=s.computed(()=>J.value?A(J.value.partIndex):[]),$t=s.computed(()=>{if(!J.value)return!1;const R=J.value.part.body,B=R?_(R).length>0:!1,Z=J.value.part.slots&&Object.keys(J.value.part.slots).length>0;return B||Z});s.watch([()=>$t.value,()=>f.value],([R,B])=>{!R&&B==="slots"&&(f.value="html")});const Et=s.ref(""),Oo=()=>{!Et.value||!J.value||(le(J.value.partIndex,Et.value),Et.value="")};s.watch(()=>J.value?.part.body,()=>{Et.value=""});const En=s.computed(()=>{const R=[],B=o.cmsData.parts;return[...B.common,...B.individual,...B.special||[]].forEach(pe=>{pe.parts.forEach(Ae=>{R.push({id:Ae.id,title:Ae.title,typeName:pe.type,description:Ae.description})})}),R.sort((pe,Ae)=>pe.typeName!==Ae.typeName?pe.typeName.localeCompare(Ae.typeName):pe.title.localeCompare(Ae.title))}),Ft=s.ref({}),fo=R=>{const B=Ft.value[R]||"";if(!B)return En.value;const Z=B.toLowerCase();return En.value.filter(pe=>pe.title.toLowerCase().includes(Z)||pe.typeName.toLowerCase().includes(Z))},oi=R=>{if(!J.value)return[];const B=J.value.part.slots?.[R];return B?B.allowedParts||[]:[]},$n=(R,B,Z)=>{if(!J.value)return;const pe=Z.target.checked,nt=J.value.part.slots?.[R]?.allowedParts||[];let ho;pe?ho=[...nt,B]:ho=nt.filter(rr=>rr!==B),Be(J.value.partIndex,R,ho)};function ri(R,B){const Z=["zcode-part-item"];return H.value&&H.value.type===R.type&&H.value.partIndex===B&&Z.push("zcode-reorder-source"),Z.join(" ")}function ii(R){const B=R._partIndex,Z=B!=null,pe=Z&&B!==void 0?B+1:0,Ae=R.parts.length;if(Z&&Ae>1){if(!confirm(t("partsManager.deletePartConfirm",{number:pe})))return}else{const nt=X(R.type);if(nt.length>0){if(!confirm(t("partsManager.deleteTypeWithUsagesConfirm",{type:R.type,count:nt.length})))return}else if(!confirm(t("partsManager.deleteTypeConfirm")))return}N(R)}return(R,B)=>(s.openBlock(),s.createElementBlock("div",lz,[s.createElementVNode("div",cz,[n.fixedCategory?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("div",dz,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(F.value,Z=>(s.openBlock(),s.createElementBlock("button",{key:Z,class:s.normalizeClass([{active:s.unref(G)===Z},"zcode-category-tab"]),onClick:pe=>G.value=Z},s.toDisplayString(Z==="common"?R.$t("dataViewer.common"):Z==="individual"?R.$t("dataViewer.individual"):R.$t("dataViewer.special")),11,uz))),128)),s.createElementVNode("button",{class:"zcode-help-btn",title:R.$t("dataViewer.categoryInfo.title"),onClick:B[0]||(B[0]=Z=>u.value=!0)},[s.createVNode(s.unref(Bn),{size:14})],8,pz)])),s.createElementVNode("div",fz,[s.createElementVNode("button",{class:"zcode-btn-primary zcode-parts-new-btn",onClick:B[1]||(B[1]=(...Z)=>s.unref(te)&&s.unref(te)(...Z))},[s.createVNode(s.unref(Do),{size:14}),s.createElementVNode("span",null,s.toDisplayString(R.$t("partsManager.createType")),1)])])]),s.createElementVNode("div",hz,[s.createElementVNode("div",mz,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(Y),Z=>(s.openBlock(),s.createElementBlock("div",{key:Z.type,class:"zcode-part-type-group"},[s.createElementVNode("div",gz,[s.createTextVNode(s.toDisplayString(Z.type)+" ",1),s.createElementVNode("div",yz,[Z.parts.length>0?(s.openBlock(),s.createElementBlock("button",{key:0,class:"zcode-part-type-edit-btn",title:R.$t("partsManager.editTypeButton"),onClick:s.withModifiers(pe=>s.unref(se)(Z.parts[0]),["stop"])},[s.createVNode(s.unref(ci),{size:14})],8,bz)):s.createCommentVNode("",!0),s.createElementVNode("button",{class:s.normalizeClass(["zcode-action-btn",{active:s.unref(W)===Z.type}]),title:R.$t("partsManager.reorderType"),onClick:s.withModifiers(pe=>s.unref(de)(Z.type),["stop"])},[s.createVNode(s.unref(cr),{size:14})],10,xz),s.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:R.$t("partsManager.deleteTypeButton"),onClick:s.withModifiers(pe=>s.unref(Pe)(Z.type),["stop"])},[s.createVNode(s.unref(mo),{size:14})],8,kz)])]),s.createElementVNode("div",Ez,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(Z.parts,(pe,Ae)=>(s.openBlock(),s.createElementBlock("div",{key:`${Z.type}-${Ae}`,class:s.normalizeClass(ri(pe,pe._partIndex??0)),onClick:nt=>s.unref(ce)(pe,pe._partIndex??0)},[s.unref(H)&&s.unref(H).type===pe.type&&s.unref(H).partIndex===(pe._partIndex??0)?(s.openBlock(),s.createElementBlock("div",Sz,s.toDisplayString(R.$t("partsManager.source")),1)):s.createCommentVNode("",!0),s.createElementVNode("div",Cz,[s.createElementVNode("span",vz,s.toDisplayString(pe._displayPart?.title||pe.type),1),s.createElementVNode("div",Nz,[s.createElementVNode("button",{class:"zcode-action-btn",title:R.$t("partsManager.editPartButton"),onClick:s.withModifiers(nt=>s.unref(ce)(pe,pe._partIndex??0),["stop"])},[s.createVNode(s.unref(ci),{size:14})],8,zz),s.createElementVNode("button",{class:s.normalizeClass(["zcode-action-btn",{active:s.unref(H)?.type===pe.type&&s.unref(H)?.partIndex===(pe._partIndex??0)}]),title:R.$t("partsManager.reorderPart"),onClick:s.withModifiers(nt=>s.unref(U)(pe,pe._partIndex??0),["stop"])},[s.createVNode(s.unref(cr),{size:14})],10,Tz),s.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:R.$t("partsManager.deletePartButton"),onClick:s.withModifiers(nt=>ii({...pe,_partIndex:pe._partIndex??0}),["stop"])},[s.createVNode(s.unref(mo),{size:14})],8,Mz)])]),s.createElementVNode("div",Az,[s.createElementVNode("div",{class:s.normalizeClass(["zcode-part-description",{"zcode-description-empty":!pe._displayPart?.description&&!pe.description}])},s.toDisplayString(pe._displayPart?.description||pe.description||R.$t("partsManager.noDescription")),3),s.createElementVNode("div",Iz,s.toDisplayString(R.$t("partsManager.partNumber",{current:(pe._partIndex??0)+1,total:pe.parts.length})),1),pe._displayPart?(s.openBlock(),s.createElementBlock("div",_z,[s.createElementVNode("div",{class:"zcode-part-preview-content",innerHTML:s.unref(w)(pe,pe._displayPart)},null,8,Oz)])):s.createCommentVNode("",!0)])],10,wz))),128)),Z.parts.length>0?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-part-item zcode-part-item-add",onClick:s.withModifiers(pe=>s.unref(ke)(Z.parts[0]),["stop"])},[s.createElementVNode("div",Rz,[s.createVNode(s.unref(Do),{size:20}),s.createElementVNode("span",null,s.toDisplayString(R.$t("partsManager.addPart")),1)])],8,Dz)):s.createCommentVNode("",!0)])]))),128))]),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[s.unref(K)&&(s.unref(ne)==="type"||s.unref(ee))?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:B[7]||(B[7]=s.withModifiers((...Z)=>s.unref(oe)&&s.unref(oe)(...Z),["self"]))},[s.createElementVNode("div",{class:"zcode-part-modal-content",onClick:B[6]||(B[6]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",Pz,[s.createElementVNode("div",$z,s.toDisplayString(s.unref(ee)?R.$t("partsManager.createType"):R.$t("partsManager.editType")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":R.$t("common.close"),onClick:B[2]||(B[2]=(...Z)=>s.unref(oe)&&s.unref(oe)(...Z))},[s.createVNode(s.unref(Ze),{size:18})],8,Lz)]),s.createElementVNode("div",Vz,[s.createElementVNode("div",Bz,[s.createElementVNode("label",null,[s.createTextVNode(s.toDisplayString(R.$t("partsManager.typeName"))+" ",1),B[34]||(B[34]=s.createElementVNode("span",{class:"zcode-required"},"*",-1))]),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":B[3]||(B[3]=Z=>s.unref(K).type=Z),type:"text",placeholder:R.$t("partsManager.typeNamePlaceholder"),class:"zcode-text-input",required:""},null,8,Fz),[[s.vModelText,s.unref(K).type]])]),s.createElementVNode("div",jz,[s.createElementVNode("label",null,s.toDisplayString(R.$t("partsManager.typeDescription")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":B[4]||(B[4]=Z=>s.unref(K).description=Z),type:"text",placeholder:R.$t("partsManager.typeDescriptionPlaceholder"),class:"zcode-text-input"},null,8,Hz),[[s.vModelText,s.unref(K).description]])])]),s.createElementVNode("div",Uz,[s.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:en},[s.createVNode(s.unref(dr),{size:16}),s.createElementVNode("span",null,s.toDisplayString(R.$t("common.confirm")),1)]),s.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:B[5]||(B[5]=(...Z)=>s.unref(oe)&&s.unref(oe)(...Z))},[s.createVNode(s.unref(Ze),{size:16}),s.createElementVNode("span",null,s.toDisplayString(R.$t("common.cancel")),1)])])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[s.unref(J)&&s.unref(ne)==="part"?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:s.withModifiers(At,["self"])},[s.createElementVNode("div",{class:"zcode-part-modal-content",onClick:B[24]||(B[24]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",Wz,[s.createElementVNode("div",qz,s.toDisplayString(R.$t("partsManager.editPart",{title:s.unref(J).part.title})),1),s.createElementVNode("div",{ref_key:"partOptionsRef",ref:a,class:"zcode-part-editor-header-actions"},[s.createElementVNode("button",{type:"button",class:"zcode-part-editor-options-btn",title:R.$t("partsManager.options"),"aria-expanded":i.value,"aria-haspopup":"dialog",onClick:B[8]||(B[8]=Z=>i.value=!i.value)},[s.createVNode(s.unref(Lm),{size:18})],8,Gz),i.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-part-editor-options-popover",role:"dialog","aria-label":R.$t("partsManager.options"),onClick:B[10]||(B[10]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",Jz,s.toDisplayString(R.$t("partsManager.options")),1),s.createElementVNode("div",Xz,[s.createElementVNode("div",Yz,[s.createElementVNode("label",Qz,s.toDisplayString(R.$t("partsManager.outlinePosition")),1),s.createElementVNode("select",{value:s.unref(J).part.outlinePosition==="inner"?"inner":"outer",class:"zcode-part-editor-options-select",onChange:B[9]||(B[9]=Z=>s.unref(J).part.outlinePosition=Z.target.value==="inner"?"inner":void 0)},[s.createElementVNode("option",eT,s.toDisplayString(R.$t("partsManager.outlinePositionOuter")),1),s.createElementVNode("option",tT,s.toDisplayString(R.$t("partsManager.outlinePositionInner")),1)],40,Zz)])])],8,Kz)):s.createCommentVNode("",!0),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":R.$t("common.close"),onClick:At},[s.createVNode(s.unref(Ze),{size:18})],8,nT)],512)]),s.createElementVNode("div",oT,[s.createElementVNode("div",rT,[s.createElementVNode("div",iT,[s.createElementVNode("div",sT,[s.createElementVNode("label",null,[s.createTextVNode(s.toDisplayString(R.$t("partsManager.partTitle"))+" ",1),B[35]||(B[35]=s.createElementVNode("span",{class:"zcode-required"},"*",-1))]),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":B[11]||(B[11]=Z=>s.unref(J).part.title=Z),type:"text",class:"zcode-text-input",required:""},null,512),[[s.vModelText,s.unref(J).part.title]])]),s.createElementVNode("div",aT,[s.createElementVNode("label",null,s.toDisplayString(R.$t("partsManager.partDescription")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":B[12]||(B[12]=Z=>s.unref(J).part.description=Z),type:"text",class:"zcode-text-input",placeholder:R.$t("partsManager.partDescriptionPlaceholder")},null,8,lT),[[s.vModelText,s.unref(J).part.description]])])])]),s.createElementVNode("div",cT,[s.createElementVNode("div",dT,[s.createElementVNode("div",uT,[s.createElementVNode("div",{class:"zcode-template-tabs",role:"tablist","aria-label":R.$t("partsManager.codeEdit")},[s.createElementVNode("button",{type:"button",class:s.normalizeClass(["zcode-template-tab",{active:f.value==="html"}]),role:"tab","aria-selected":f.value==="html",onClick:B[13]||(B[13]=Z=>f.value="html")}," HTML ",10,fT),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["zcode-template-tab",{active:f.value==="css"}]),role:"tab","aria-selected":f.value==="css",onClick:B[14]||(B[14]=Z=>f.value="css")}," CSS ",10,hT),$t.value?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:s.normalizeClass(["zcode-template-tab",{active:f.value==="slots"}]),role:"tab","aria-selected":f.value==="slots",onClick:B[15]||(B[15]=Z=>f.value="slots")},s.toDisplayString(R.$t("partsManager.slotSettings")),11,mT)):s.createCommentVNode("",!0)],8,pT),s.createElementVNode("div",gT,[f.value==="css"?(s.openBlock(),s.createElementBlock("div",yT,[s.createVNode(s.unref(Qs),{size:14,class:"zcode-css-warning-compact-icon"}),s.createElementVNode("span",bT,s.toDisplayString(R.$t("partsManager.cssEditInfo")),1),s.createElementVNode("button",{class:"zcode-help-btn",type:"button",title:R.$t("partsManager.cssEditWarning"),onClick:$},[s.createVNode(s.unref(Bn),{size:14})],8,xT)])):s.createCommentVNode("",!0),f.value==="html"?(s.openBlock(),s.createElementBlock("label",kT,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":B[16]||(B[16]=Z=>l.value=Z),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[s.vModelCheckbox,l.value]]),s.createElementVNode("span",null,s.toDisplayString(R.$t("partsManager.templateSuggestions")),1)])):s.createCommentVNode("",!0),f.value==="html"?(s.openBlock(),s.createElementBlock("button",{key:2,class:"zcode-help-btn",type:"button",title:R.$t("partsManager.templateHelpButton"),onClick:v},[s.createVNode(s.unref(Bn),{size:16})],8,ET)):s.createCommentVNode("",!0)])]),s.createElementVNode("div",wT,[f.value==="slots"?(s.openBlock(),s.createElementBlock("div",ST,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(J).part.slots||{},(Z,pe)=>(s.openBlock(),s.createElementBlock("div",{key:`part-${s.unref(J).partIndex}-${pe}`,class:"zcode-slot-config-item"},[s.createElementVNode("div",CT,[s.createElementVNode("div",vT,s.toDisplayString(R.$t("partsManager.slot"))+": "+s.toDisplayString(pe),1),s.createElementVNode("button",{class:"zcode-btn-small",onClick:Ae=>s.unref(Ce)(s.unref(J).partIndex,pe)},[s.createVNode(s.unref(mo),{size:12})],8,NT)]),s.createElementVNode("div",zT,[s.createElementVNode("label",null,s.toDisplayString(R.$t("partsManager.allowedParts")),1),s.createElementVNode("div",TT,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":Ae=>Ft.value[pe]=Ae,type:"text",placeholder:R.$t("partsManager.searchParts"),class:"zcode-text-input",style:{"margin-bottom":"8px"}},null,8,MT),[[s.vModelText,Ft.value[pe]]]),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(fo(pe),Ae=>(s.openBlock(),s.createElementBlock("label",{key:`allowed-${pe}-${Ae.typeName}-${Ae.id}`,class:"zcode-checkbox-item"},[s.createElementVNode("input",{type:"checkbox",checked:oi(pe).includes(Ae.id),class:"zcode-checkbox",onChange:nt=>$n(pe,Ae.id,nt)},null,40,AT),s.createElementVNode("span",null,s.toDisplayString(Ae.title)+" ("+s.toDisplayString(Ae.typeName)+")",1)]))),128))])])]))),128)),Pt.value.length>0?(s.openBlock(),s.createElementBlock("div",IT,[s.createElementVNode("label",null,s.toDisplayString(R.$t("partsManager.addSlot")),1),s.createElementVNode("div",_T,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":B[17]||(B[17]=Z=>Et.value=Z),class:"zcode-select-input"},[s.createElementVNode("option",OT,s.toDisplayString(R.$t("partsManager.selectSlot")),1),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(Pt.value,Z=>(s.openBlock(),s.createElementBlock("option",{key:Z,value:Z},s.toDisplayString(Z==="default"?R.$t("partsManager.defaultSlot"):Z),9,DT))),128))],512),[[s.vModelSelect,Et.value]]),s.createElementVNode("button",{disabled:!Et.value,class:"zcode-btn-secondary",onClick:Oo},[s.createVNode(s.unref(Do),{size:16}),s.createElementVNode("span",null,s.toDisplayString(R.$t("common.add")),1)],8,RT)])])):s.createCommentVNode("",!0)])):f.value==="html"?(s.openBlock(),s.createBlock(mm,{key:1,ref_key:"monacoEditorRef",ref:m,modelValue:s.unref(J).part.body,"onUpdate:modelValue":B[18]||(B[18]=Z=>s.unref(J).part.body=Z),language:"html",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":l.value,class:"zcode-monaco-editor"},null,8,["modelValue","enable-suggestions"])):(s.openBlock(),s.createBlock(mm,{key:2,modelValue:g.value,"onUpdate:modelValue":B[19]||(B[19]=Z=>g.value=Z),language:"css",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":!0,class:"zcode-monaco-editor"},null,8,["modelValue"]))])]),s.createElementVNode("div",PT,[s.createElementVNode("div",{class:"zcode-part-editor-side-tabs",role:"tablist","aria-label":R.$t("partsManager.preview")},[s.createElementVNode("button",{type:"button",class:s.normalizeClass(["zcode-part-editor-side-tab",{active:h.value==="preview"}]),role:"tab","aria-selected":h.value==="preview",onClick:B[20]||(B[20]=Z=>h.value="preview")},s.toDisplayString(R.$t("partsManager.displayPreview")),11,LT),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["zcode-part-editor-side-tab",{active:h.value==="editPanel"}]),role:"tab","aria-selected":h.value==="editPanel",onClick:B[21]||(B[21]=Z=>h.value="editPanel")},s.toDisplayString(R.$t("partsManager.editPanelPreview")),11,VT),f.value==="html"?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:s.normalizeClass(["zcode-part-editor-side-tab",{active:h.value==="imageRef"}]),role:"tab","aria-selected":h.value==="imageRef",onClick:B[22]||(B[22]=Z=>h.value="imageRef")},s.toDisplayString(R.$t("partsManager.imageIdReference")),11,BT)):s.createCommentVNode("",!0)],8,$T),s.createElementVNode("div",FT,[h.value==="preview"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createElementVNode("div",{class:"zcode-part-editor-preview-tab",onClick:B[23]||(B[23]=Z=>r.value=!0),innerHTML:Q.value},null,8,jT),s.createElementVNode("div",HT,s.toDisplayString(R.$t("partsManager.clickToEnlarge")),1)],64)):h.value==="imageRef"?(s.openBlock(),s.createElementBlock("div",UT,[s.createElementVNode("div",WT,s.toDisplayString(R.$t("partsManager.imageIdReferenceDesc")),1),C.value.length>0?(s.openBlock(),s.createElementBlock("div",qT,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(C.value,Z=>(s.openBlock(),s.createElementBlock("div",{key:Z.id,class:"zcode-image-id-item"},[s.createElementVNode("img",{src:Z.url,alt:Z.name,class:"zcode-image-id-thumb"},null,8,GT),s.createElementVNode("div",KT,[s.createElementVNode("code",JT,s.toDisplayString(Z.id),1),s.createElementVNode("span",XT,s.toDisplayString(Z.name),1)]),s.createElementVNode("div",YT,[s.createElementVNode("button",{type:"button",class:"zcode-btn-small",onClick:pe=>M(Z.id)},s.toDisplayString(R.$t("common.copy")),9,QT),s.createElementVNode("button",{type:"button",class:"zcode-btn-small",onClick:pe=>D(Z.id)},s.toDisplayString(R.$t("partsManager.insert")),9,ZT)])]))),128))])):(s.openBlock(),s.createElementBlock("div",eM,s.toDisplayString(R.$t("partsManager.noImagesRegistered")),1))])):(s.openBlock(),s.createElementBlock(s.Fragment,{key:2},[s.createElementVNode("div",tM,s.toDisplayString(R.$t("partsManager.editPanelPreview")),1),s.createElementVNode("div",nM,s.toDisplayString(R.$t("partsManager.editPanelPreviewDesc")),1),s.createElementVNode("div",oM,[ue.value?(s.openBlock(),s.createBlock(nm,{key:0,"editing-component":ue.value,"editing-available-fields":q.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:qe,onClose:()=>{},onAddImage:()=>{},onDeleteImage:()=>{}},null,8,["editing-component","editing-available-fields","images-common","images-individual","images-special"])):(s.openBlock(),s.createElementBlock("div",rM,s.toDisplayString(R.$t("partsManager.editPanelPreviewNoFields")),1))])],64))])])])]),s.createElementVNode("div",iM,[s.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:kt},[s.createVNode(s.unref(dr),{size:16}),s.createElementVNode("span",null,s.toDisplayString(R.$t("common.confirm")),1)]),s.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:At},[s.createVNode(s.unref(Ze),{size:16}),s.createElementVNode("span",null,s.toDisplayString(R.$t("common.cancel")),1)])])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[r.value&&s.unref(J)?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:B[27]||(B[27]=Z=>r.value=!1)},[s.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:B[26]||(B[26]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",sM,[s.createElementVNode("div",aM,s.toDisplayString(R.$t("partsManager.preview"))+" "+s.toDisplayString(s.unref(J).part.title),1),s.createElementVNode("button",{class:"zcode-close-btn",onClick:B[25]||(B[25]=Z=>r.value=!1)},[s.createVNode(s.unref(Ze),{size:18})])]),s.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:Q.value},null,8,lM)])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[d.value&&(s.unref(G)==="common"||s.unref(G)==="individual"||s.unref(G)==="special")?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:s.withModifiers(P,["self"])},[s.createElementVNode("div",{class:"zcode-help-modal zcode-css-warning-modal",onClick:B[29]||(B[29]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",cM,[s.createElementVNode("div",dM,[s.createVNode(s.unref(Rc),{size:20,class:"zcode-css-warning-modal-title-icon"}),s.createElementVNode("span",null,s.toDisplayString(R.$t("partsManager.cssEditWarning")),1)]),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":R.$t("common.close"),onClick:P},[s.createVNode(s.unref(Ze),{size:20})],8,uM)]),s.createElementVNode("div",pM,[s.createElementVNode("div",fM,[s.createElementVNode("div",hM,[s.createElementVNode("ul",mM,[s.createElementVNode("li",null,[s.unref(G)==="common"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createTextVNode(s.toDisplayString(R.$t("partsManager.cssEditWarningMessageCommon")),1)],64)):s.unref(G)==="individual"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createTextVNode(s.toDisplayString(R.$t("partsManager.cssEditWarningMessageIndividual")),1)],64)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:2},[s.createTextVNode(s.toDisplayString(R.$t("partsManager.cssEditWarningMessageSpecial")),1)],64))])])])])]),s.createElementVNode("div",gM,[s.createElementVNode("label",yM,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":B[28]||(B[28]=Z=>p.value=Z),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[s.vModelCheckbox,p.value]]),s.createElementVNode("span",null,s.toDisplayString(R.$t("partsManager.dontShowAgain")),1)]),s.createElementVNode("button",{class:"zcode-btn-primary",onClick:P},s.toDisplayString(R.$t("partsManager.understood")),1)])])])):s.createCommentVNode("",!0)])),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[u.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:B[32]||(B[32]=s.withModifiers(Z=>u.value=!1,["self"]))},[s.createElementVNode("div",{class:"zcode-help-modal",onClick:B[31]||(B[31]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",bM,[s.createElementVNode("div",xM,[s.createVNode(s.unref(Qs),{size:20,class:"zcode-css-warning-modal-title-icon"}),s.createElementVNode("span",null,s.toDisplayString(R.$t("dataViewer.categoryInfo.title")),1)]),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":R.$t("common.close"),onClick:B[30]||(B[30]=Z=>u.value=!1)},[s.createVNode(s.unref(Ze),{size:18})],8,kM)]),s.createElementVNode("div",EM,[s.createElementVNode("div",wM,[s.createElementVNode("div",SM,s.toDisplayString(R.$t("dataViewer.categoryInfo.common.title")),1),s.createElementVNode("div",CM,s.toDisplayString(R.$t("dataViewer.categoryInfo.common.description")),1)]),s.createElementVNode("div",vM,[s.createElementVNode("div",NM,s.toDisplayString(R.$t("dataViewer.categoryInfo.individual.title")),1),s.createElementVNode("div",zM,s.toDisplayString(R.$t("dataViewer.categoryInfo.individual.description")),1)]),s.createElementVNode("div",TM,[s.createElementVNode("div",MM,s.toDisplayString(R.$t("dataViewer.categoryInfo.special.title")),1),s.createElementVNode("div",AM,s.toDisplayString(R.$t("dataViewer.categoryInfo.special.description")),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:E},[s.createElementVNode("div",{class:"zcode-help-modal",onClick:B[33]||(B[33]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",IM,[s.createElementVNode("div",_M,s.toDisplayString(R.$t("partsManager.templateHelpTitle")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":R.$t("common.close"),onClick:E},[s.createVNode(s.unref(Ze),{size:20})],8,OM)]),s.createElementVNode("div",DM,[s.createElementVNode("table",RM,[s.createElementVNode("thead",null,[s.createElementVNode("tr",null,[s.createElementVNode("th",null,s.toDisplayString(R.$t("partsManager.syntax")),1),s.createElementVNode("th",null,s.toDisplayString(R.$t("partsManager.description")),1),s.createElementVNode("th",null,s.toDisplayString(R.$t("partsManager.example")),1)])]),s.createElementVNode("tbody",null,[s.createElementVNode("tr",null,[B[36]||(B[36]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$field:default}")],-1)),s.createElementVNode("td",null,s.toDisplayString(R.$t("partsManager.templateHelp.textField")),1),B[37]||(B[37]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$title:タイトル}")],-1))]),s.createElementVNode("tr",null,[B[38]||(B[38]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$field:default:rich}")],-1)),s.createElementVNode("td",null,s.toDisplayString(R.$t("partsManager.templateHelp.richText")),1),B[39]||(B[39]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$content:本文:rich}")],-1))]),s.createElementVNode("tr",null,[B[40]||(B[40]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$field:default:textarea}")],-1)),s.createElementVNode("td",null,s.toDisplayString(R.$t("partsManager.templateHelp.textarea")),1),B[41]||(B[41]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$description:説明:textarea}")],-1))]),s.createElementVNode("tr",null,[B[42]||(B[42]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$field:default:image}")],-1)),s.createElementVNode("td",null,s.toDisplayString(R.$t("partsManager.templateHelp.image")),1),B[43]||(B[43]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"{$hero:default.jpg:image}")],-1))]),s.createElementVNode("tr",null,[B[44]||(B[44]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($field:option1|option2)")],-1)),s.createElementVNode("td",null,s.toDisplayString(R.$t("partsManager.templateHelp.radio")),1),B[45]||(B[45]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($color:red|blue|green)")],-1))]),s.createElementVNode("tr",null,[B[46]||(B[46]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($field:option1,option2)")],-1)),s.createElementVNode("td",null,s.toDisplayString(R.$t("partsManager.templateHelp.checkbox")),1),B[47]||(B[47]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($features:fast,secure)")],-1))]),s.createElementVNode("tr",null,[B[48]||(B[48]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($field@:option1|option2)")],-1)),s.createElementVNode("td",null,s.toDisplayString(R.$t("partsManager.templateHelp.selectSingle")),1),B[49]||(B[49]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($size@:S|M|L)")],-1))]),s.createElementVNode("tr",null,[B[50]||(B[50]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($field@:option1,option2)")],-1)),s.createElementVNode("td",null,s.toDisplayString(R.$t("partsManager.templateHelp.selectMultiple")),1),B[51]||(B[51]=s.createElementVNode("td",null,[s.createElementVNode("code",null,"($tags@:tag1,tag2,tag3)")],-1))]),s.createElementVNode("tr",null,[B[52]||(B[52]=s.createElementVNode("td",null,[s.createElementVNode("code",null,'z-if="show_field"')],-1)),s.createElementVNode("td",null,s.toDisplayString(R.$t("partsManager.templateHelp.conditional")),1),B[53]||(B[53]=s.createElementVNode("td",null,[s.createElementVNode("code",null,'<div z-if="show_content">...</div>')],-1))]),s.createElementVNode("tr",null,[B[54]||(B[54]=s.createElementVNode("td",null,[s.createElementVNode("code",null,'z-slot="name"')],-1)),s.createElementVNode("td",null,s.toDisplayString(R.$t("partsManager.templateHelp.slot")),1),B[55]||(B[55]=s.createElementVNode("td",null,[s.createElementVNode("code",null,'<div z-slot="content"></div>')],-1))])])]),s.createElementVNode("div",PM,[s.createElementVNode("div",$M,s.toDisplayString(R.$t("partsManager.templateHelp.note")),1),s.createElementVNode("div",LM,[s.createElementVNode("div",{role:"listitem",class:"zcode-help-section-item",innerHTML:R.$t("partsManager.templateHelp.suggestionNote")},null,8,VM),s.createElementVNode("div",BM,s.toDisplayString(R.$t("partsManager.templateHelp.fieldNameNote")),1),s.createElementVNode("div",FM,s.toDisplayString(R.$t("partsManager.templateHelp.defaultValueNote")),1)])])])])])):s.createCommentVNode("",!0)]))])]))}});function ym(n,e){const t=[];return Ni(e,"page",(o,r)=>{Object.keys(o).forEach(i=>{i.includes("image")&&o[i]===n&&t.push({path:r,component:o,fieldName:i})})}),t}function jM(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((T,S)=>{const z=new FileReader;z.onload=b=>{const v=b.target?.result,E={id:`img-${Date.now()}`,name:x.name,url:v,mimeType:x.type,needsUpload:!0};e.value==="common"?n.images.common.push(E):e.value==="individual"?n.images.individual.push(E):n.images.special.push(E),T(E)},z.onerror=S,z.readAsDataURL(x)})}function d(x){ym(x,n.page).forEach(v=>{Object.keys(v.component).forEach(E=>{E.includes("image")&&v.component[E]===x&&(v.component[E]="")})});const S=n.images.common.findIndex(v=>v.id===x);S!==-1&&n.images.common.splice(S,1);const z=n.images.individual.findIndex(v=>v.id===x);z!==-1&&n.images.individual.splice(z,1);const b=n.images.special.findIndex(v=>v.id===x);b!==-1&&n.images.special.splice(b,1),t.value?.id===x&&(t.value=null)}function u(x){o.value={...x},r.value=!1,t.value=x}function p(){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 T=x.findIndex(S=>S.id===o.value.id);T!==-1&&(x[T]=o.value),o.value=null,r.value=!1}function f(){o.value=null,r.value=!1}function h(x){return ym(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,T){let S;e.value==="common"?S=n.images.common:e.value==="individual"?S=n.images.individual:S=n.images.special;const z=S.findIndex(E=>E.id===x),b=S.findIndex(E=>E.id===T);if(z===-1||b===-1)return;const[v]=S.splice(z,1);S.splice(b,0,v)}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:p,cancelEditing:f,checkImageUsage:h}}const HM={class:"zcode-images-manager"},UM={class:"zcode-images-category-tabs"},WM={key:0,class:"zcode-images-category-tab-group"},qM=["onClick"],GM=["title"],KM={class:"zcode-images-add-wrapper"},JM={class:"zcode-images-manager-content"},XM={class:"zcode-images-grid"},YM=["onClick"],QM={key:0,class:"zcode-reorder-source-indicator"},ZM=["src","alt"],eA={class:"zcode-image-item-overlay"},tA={class:"zcode-image-item-actions"},nA=["title","onClick"],oA=["title","onClick"],rA={class:"zcode-image-item-name"},iA={class:"zcode-image-editor-header"},sA={class:"zcode-image-editor-header-title",role:"heading","aria-level":"4"},aA=["aria-label"],lA={class:"zcode-image-editor-form"},cA={class:"zcode-image-preview-large"},dA=["src","alt"],uA={class:"zcode-image-editor-replace"},pA={class:"zcode-form-field"},fA={class:"zcode-form-field"},hA={class:"zcode-image-editor-actions"},mA={class:"zcode-help-modal-header"},gA={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},yA=["aria-label"],bA={class:"zcode-help-modal-body"},xA={class:"zcode-help-section"},kA={class:"zcode-help-section-title",role:"heading","aria-level":"4"},EA={class:"zcode-help-section-item"},wA={class:"zcode-help-section"},SA={class:"zcode-help-section-title",role:"heading","aria-level":"4"},CA={class:"zcode-help-section-item"},vA={class:"zcode-help-section"},NA={class:"zcode-help-section-title",role:"heading","aria-level":"4"},zA={class:"zcode-help-section-item"},bm=s.defineComponent({__name:"ImagesManagerPanel",props:{cmsData:{type:Object},config:{type:Object},fixedCategory:{type:String}},setup(n,{expose:e}){const{t}=rn(),o=n,r=s.ref(null),i=s.ref(null),a=s.ref(!1),l=s.computed(()=>o.config?.categoryOrder||"common"),c=s.computed(()=>{const C=[];return l.value==="individual"?C.push("individual","common","special"):l.value==="special"?C.push("special","common","individual"):C.push("common","individual","special"),C}),{reorderSourceImage:d,handleReorderClick:u,activeCategory:p,editingImage:f,currentImages:h,addImage:m,deleteImage:g,startEditing:y,saveImage:x,cancelEditing:T,checkImageUsage:S}=jM(o.cmsData);o.fixedCategory?p.value=o.fixedCategory:o.config?.categoryOrder==="individual"?p.value="individual":o.config?.categoryOrder==="special"&&(p.value="special"),e({activeCategory:p});async function z(C){const M=C.target,D=M.files?.[0];if(D)try{await m(D),M&&(M.value="")}catch($){ge.error("画像追加エラー:",$),alert(t("imagesManager.addImageFailed"))}}function b(C){const M=C.target,D=M.files?.[0];if(!D||!f.value)return;const $=new FileReader;$.onload=P=>{const L=P.target?.result;!L||!f.value||(f.value.url=L,f.value.mimeType=D.type,f.value.needsUpload=!0)},$.readAsDataURL(D),M&&(M.value="")}function v(C){const M=["zcode-image-item"];return d.value===C.id&&M.push("zcode-reorder-source"),M.join(" ")}function E(C){const M=S(C.id);if(M.length>0){if(!confirm(t("imagesManager.deleteImageWithUsagesConfirm",{count:M.length})))return}else if(!confirm(t("imagesManager.deleteImageConfirm")))return;g(C.id)}return(C,M)=>(s.openBlock(),s.createElementBlock("div",HM,[s.createElementVNode("div",UM,[n.fixedCategory?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("div",WM,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(c.value,D=>(s.openBlock(),s.createElementBlock("button",{key:D,class:s.normalizeClass([{active:s.unref(p)===D},"zcode-category-tab"]),onClick:$=>p.value=D},s.toDisplayString(D==="common"?C.$t("dataViewer.common"):D==="individual"?C.$t("dataViewer.individual"):C.$t("dataViewer.special")),11,qM))),128)),s.createElementVNode("button",{class:"zcode-help-btn",title:C.$t("dataViewer.categoryInfo.title"),onClick:M[0]||(M[0]=D=>a.value=!0)},[s.createVNode(s.unref(Bn),{size:14})],8,GM)])),s.createElementVNode("div",KM,[s.createElementVNode("input",{ref_key:"fileInput",ref:r,type:"file",accept:"image/*",style:{display:"none"},onChange:z},null,544),s.createElementVNode("button",{class:"zcode-btn-primary zcode-images-add-btn",onClick:M[1]||(M[1]=D=>r.value?.click())},[s.createVNode(s.unref(Do),{size:14}),s.createElementVNode("span",null,s.toDisplayString(C.$t("imagesManager.addImage")),1)])])]),s.createElementVNode("div",JM,[s.createElementVNode("div",XM,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(h),D=>(s.openBlock(),s.createElementBlock("div",{key:D.id,class:s.normalizeClass(v(D)),onClick:$=>s.unref(y)(D)},[s.unref(d)===D.id?(s.openBlock(),s.createElementBlock("div",QM,s.toDisplayString(C.$t("partsManager.source")),1)):s.createCommentVNode("",!0),s.createElementVNode("img",{src:D.url,alt:D.name},null,8,ZM),s.createElementVNode("div",eA,[s.createElementVNode("div",tA,[s.createElementVNode("button",{class:s.normalizeClass(["zcode-action-btn",{active:s.unref(d)===D.id}]),title:C.$t("partsManager.reorderPart"),onClick:s.withModifiers($=>s.unref(u)(D.id),["stop"])},[s.createVNode(s.unref(cr),{size:16})],10,nA),s.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:C.$t("partsManager.deletePartButton"),onClick:s.withModifiers($=>E(D),["stop"])},[s.createVNode(s.unref(mo),{size:16})],8,oA)])]),s.createElementVNode("div",rA,s.toDisplayString(D.name),1)],10,YM))),128))])]),(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[s.unref(f)?(s.openBlock(),s.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:M[9]||(M[9]=s.withModifiers((...D)=>s.unref(T)&&s.unref(T)(...D),["self"]))},[s.createElementVNode("div",{class:"zcode-image-modal-content","data-edit-mode":"",onClick:M[8]||(M[8]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",iA,[s.createElementVNode("div",sA,s.toDisplayString(C.$t("imagesManager.editImage")),1),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":C.$t("common.close"),onClick:M[2]||(M[2]=(...D)=>s.unref(T)&&s.unref(T)(...D))},[s.createVNode(s.unref(Ze),{size:18})],8,aA)]),s.createElementVNode("div",lA,[s.createElementVNode("div",cA,[s.createElementVNode("img",{src:s.unref(f).url,alt:s.unref(f).name,class:"zcode-image-preview-large-img"},null,8,dA)]),s.createElementVNode("div",uA,[s.createElementVNode("input",{ref_key:"replaceFileInputRef",ref:i,type:"file",accept:"image/*",class:"zcode-image-replace-input",onChange:b},null,544),s.createElementVNode("button",{type:"button",class:"zcode-image-select-btn",onClick:M[3]||(M[3]=D=>i.value?.click())},[s.createVNode(s.unref(li),{size:16}),s.createElementVNode("span",null,s.toDisplayString(C.$t("imagesManager.replaceImage")),1)])]),s.createElementVNode("div",pA,[s.createElementVNode("label",null,s.toDisplayString(C.$t("imagesManager.imageId")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":M[4]||(M[4]=D=>s.unref(f).id=D),type:"text",class:"zcode-text-input",disabled:""},null,512),[[s.vModelText,s.unref(f).id]])]),s.createElementVNode("div",fA,[s.createElementVNode("label",null,s.toDisplayString(C.$t("imagesManager.imageName")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":M[5]||(M[5]=D=>s.unref(f).name=D),type:"text",class:"zcode-text-input"},null,512),[[s.vModelText,s.unref(f).name]])]),s.createElementVNode("div",hA,[s.createElementVNode("button",{class:"zcode-btn-primary zcode-image-editor-actions-btn",onClick:M[6]||(M[6]=(...D)=>s.unref(x)&&s.unref(x)(...D))},[s.createVNode(s.unref(dr),{size:16}),s.createElementVNode("span",null,s.toDisplayString(C.$t("common.confirm")),1)]),s.createElementVNode("button",{class:"zcode-btn-cancel zcode-image-editor-actions-btn",onClick:M[7]||(M[7]=(...D)=>s.unref(T)&&s.unref(T)(...D))},[s.createVNode(s.unref(Ze),{size:16}),s.createElementVNode("span",null,s.toDisplayString(C.$t("common.cancel")),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:M[12]||(M[12]=s.withModifiers(D=>a.value=!1,["self"]))},[s.createElementVNode("div",{class:"zcode-help-modal",onClick:M[11]||(M[11]=s.withModifiers(()=>{},["stop"]))},[s.createElementVNode("div",mA,[s.createElementVNode("div",gA,[s.createVNode(s.unref(Qs),{size:20,class:"zcode-css-warning-modal-title-icon"}),s.createElementVNode("span",null,s.toDisplayString(C.$t("dataViewer.categoryInfo.title")),1)]),s.createElementVNode("button",{class:"zcode-close-btn","aria-label":C.$t("common.close"),onClick:M[10]||(M[10]=D=>a.value=!1)},[s.createVNode(s.unref(Ze),{size:18})],8,yA)]),s.createElementVNode("div",bA,[s.createElementVNode("div",xA,[s.createElementVNode("div",kA,s.toDisplayString(C.$t("dataViewer.categoryInfo.common.title")),1),s.createElementVNode("div",EA,s.toDisplayString(C.$t("dataViewer.categoryInfo.common.description")),1)]),s.createElementVNode("div",wA,[s.createElementVNode("div",SA,s.toDisplayString(C.$t("dataViewer.categoryInfo.individual.title")),1),s.createElementVNode("div",CA,s.toDisplayString(C.$t("dataViewer.categoryInfo.individual.description")),1)]),s.createElementVNode("div",vA,[s.createElementVNode("div",NA,s.toDisplayString(C.$t("dataViewer.categoryInfo.special.title")),1),s.createElementVNode("div",zA,s.toDisplayString(C.$t("dataViewer.categoryInfo.special.description")),1)])])])])):s.createCommentVNode("",!0)]))]))}}),TA={class:"zcode-data-viewer"},MA={class:"zcode-data-viewer-header"},AA={class:"zcode-data-viewer-content-tabs"},IA={class:"zcode-data-viewer-tabs"},_A=["onClick"],OA={class:"zcode-data-viewer-content"},DA={class:"zcode-data-viewer-display-wrapper"},RA={class:"zcode-data-viewer-display"},PA=["title"],xm=s.defineComponent({__name:"DataViewer",props:{cmsData:{type:Object},config:{type:Object},fixedCategory:{type:String}},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 T=[];return a.value==="individual"?T.push("individual","common","special"):a.value==="special"?T.push("special","common","individual"):T.push("common","individual","special"),T}),c=s.ref(t.fixedCategory??(t.config?.categoryOrder==="individual"?"individual":t.config?.categoryOrder==="special"?"special":"common")),{fullPageHtml:d}=zi(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}}),p=s.ref("");let f="";function h(){try{const T=u.value,S=JSON.stringify(T,null,2);if(S===f)return;p.value=S,f=S}catch{p.value=String(u.value),f=p.value}}function m(T){let S=T.replace(/\\\\/g,"\0").replace(/\\u([0-9a-fA-F]{4})/g,(z,b)=>String.fromCharCode(parseInt(b,16))).replace(/\\n/g,`
|
|
483
|
+
`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\\//g,"/").replace(/\u0000/g,"\\");return S=S.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&"),S}function g(T){if(!T)return"";const z=T.replace(/>\s+</g,"><").replace(/></g,`>
|
|
487
484
|
<`).split(`
|
|
488
|
-
`),
|
|
489
|
-
`)}const g=a.computed(()=>o.value==="page"&&r.value==="html"?b(d.value):m(f.value));a.watch(u,()=>{h()},{deep:!0,immediate:!1}),a.watch(()=>n.cmsData,()=>{h()},{deep:!0}),a.watch(()=>{switch(o.value){case"page":return n.cmsData.page;case"parts":return c.value==="common"?n.cmsData.parts.common:n.cmsData.parts.individual;case"images":return c.value==="common"?n.cmsData.images.common:n.cmsData.images.individual;default:return null}},()=>{h()},{deep:!0}),a.watch(c,()=>{h()}),a.watch(o,()=>{c.value=n.config?.categoryOrder==="individual"?"individual":"common",h()});const x=async()=>{const v=g.value;try{await navigator.clipboard.writeText(v),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(w){console.error("コピーに失敗しました:",w);const T=document.createElement("textarea");T.value=v,T.style.position="fixed",T.style.opacity="0",document.body.appendChild(T),T.select();try{document.execCommand("copy"),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(M){console.error("コピーに失敗しました:",M)}document.body.removeChild(T)}};return h(),e({internalActiveTab:o,activeCategory:c}),(v,w)=>(a.openBlock(),a.createElementBlock("div",HA,[a.createElementVNode("div",WA,[a.createElementVNode("div",GA,[a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="page"},"zcode-data-viewer-content-tab"]),onClick:w[0]||(w[0]=T=>o.value="page")},a.toDisplayString(v.$t("dataViewer.page")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="parts"},"zcode-data-viewer-content-tab"]),onClick:w[1]||(w[1]=T=>o.value="parts")},a.toDisplayString(v.$t("dataViewer.parts")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="images"},"zcode-data-viewer-content-tab"]),onClick:w[2]||(w[2]=T=>o.value="images")},a.toDisplayString(v.$t("dataViewer.images")),3)]),a.createElementVNode("div",qA,[o.value==="page"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createElementVNode("button",{class:a.normalizeClass([{active:r.value==="json"},"zcode-data-viewer-tab"]),onClick:w[3]||(w[3]=T=>r.value="json")},a.toDisplayString(v.$t("dataViewer.json")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:r.value==="html"},"zcode-data-viewer-tab"]),onClick:w[4]||(w[4]=T=>r.value="html")},a.toDisplayString(v.$t("dataViewer.html")),3)],64)):(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:1},a.renderList(l.value,T=>(a.openBlock(),a.createElementBlock("button",{key:T,class:a.normalizeClass([{active:c.value===T},"zcode-data-viewer-tab"]),onClick:M=>c.value=T},a.toDisplayString(T==="common"?v.$t("dataViewer.common"):T==="individual"?v.$t("dataViewer.individual"):v.$t("dataViewer.special")),11,KA))),128))])]),a.createElementVNode("div",JA,[a.createElementVNode("div",XA,[a.createElementVNode("pre",YA,a.toDisplayString(g.value),1),a.createElementVNode("button",{class:"zcode-data-viewer-copy-btn",title:i.value?v.$t("common.copied"):v.$t("common.copy"),onClick:x},[i.value?(a.openBlock(),a.createBlock(a.unref(sr),{key:0,size:18})):(a.openBlock(),a.createBlock(a.unref(Xm),{key:1,size:18}))],8,QA)])])]))}}),eM={class:"zcode-dev-container"},tM={class:"zcode-dev-header"},nM={class:"zcode-dev-tabs"},oM=["title"],rM={key:1,class:"zcode-loading-message"},iM={class:"zcode-loading-message-text"},sM={key:3,class:"zcode-loading-message"},aM={class:"zcode-loading-message-text"},lM={key:3,class:"zcode-save-controls-fixed"},cM={class:"zcode-save-confirm-dialog"},dM={class:"zcode-save-confirm-dialog-header"},uM={class:"zcode-save-confirm-dialog-title"},fM={class:"zcode-save-confirm-dialog-body"},pM={class:"zcode-save-confirm-targets"},hM={class:"zcode-save-confirm-dialog-footer"},vc=a.defineComponent({__name:"ZeroCodeEditor",props:{locale:{type:String},page:{type:String},cssCommon:{type:String},cssIndividual:{type:String},cssSpecial:{type:String},partsCommon:{type:String},partsIndividual:{type:String},partsSpecial:{type:String},imagesCommon:{type:String},imagesIndividual:{type:String},imagesSpecial:{type:String},config:{type:String},endpoints:{type:String},backendData:{type:String},enablePartsManager:{type:Boolean},enableImagesManager:{type:Boolean}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.computed(()=>o.enablePartsManager!==!1),i=a.computed(()=>o.enableImagesManager!==!1),s=a.ref("manage"),l=a.ref("edit"),c=a.ref(null),d=a.ref(null),u=a.ref(null),f=a.ref(null),p=a.ref(!1),h=a.ref(!1),m=a.ref([]),g=(N=>{if(!N)return{};try{return JSON.parse(N)}catch(O){return console.warn("[ZeroCodeEditor] Failed to parse config:",O),{}}})(o.config);function x(N){return typeof N=="object"&&N!==null}function v(N){return N==="common"||N==="individual"||N==="special"}function w(N){return N==="page"||N==="parts"||N==="images"}function T(N){if(x(N)&&"value"in N)return N.value}function M(N,O){if(x(N))return N[O]}function A(N){const O=M(N,"activeCategory");if(v(O))return O;const k=T(O);return v(k)?k:void 0}function y(N){const O=M(N,"internalActiveTab");if(w(O))return O;const k=T(O);return w(k)?k:void 0}function E(){const N=c.value;return!x(N)||!("cmsData"in N)||!("currentMode"in N)||!("switchMode"in N)||!("allowDynamicContentInteraction"in N)||!("settingsPanelOpen"in N)||!("setData"in N)?null:N}const S=(N,O,k)=>{const U=Mu();return U[N]!==void 0?U[N]:k!==void 0?k:O},D=a.ref(S("showDataViewer",!1,g.dev?.showDataViewer)),W=a.ref(S("showSaveConfirm",!0,g.dev?.showSaveConfirm)),{cmsData:z,loadDataFromProps:P}=km(o),V=a.computed(()=>{const N=s.value==="manage"?E():null;return N?N.cmsData:z}),j=a.computed(()=>E()?.currentMode?.value??"edit"),L=N=>{c.value?.switchMode&&c.value.switchMode(N)};function H(N){l.value=N,(N==="parts"||N==="images"||N==="data")&&(s.value="manage")}function Q(){const N=E();N&&(N.settingsPanelOpen.value=!0)}const G=a.computed(()=>{if(s.value==="preview")return!0;const N=E();return N?N.allowDynamicContentInteraction.value:h1("allowDynamicContentInteraction",!1)});function se(N){const O=V.value;if(!N)return O;const k=N.split(".");let U=O;for(const te of k)if(!x(U)||(U=U[te],U===void 0))return;return U}function Z(N,O){const k=E();return k?k.setData(N,O):!1}a.onMounted(()=>{P()}),a.watch([()=>o.page,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial],()=>{P()}),a.watch(D,N=>{Ba({showDataViewer:N})}),a.watch(W,N=>{Ba({showSaveConfirm:N})}),a.watch(s,(N,O)=>{J("view-mode-changed",{mode:N,previousMode:O})});function X(N){W.value=N}function J(N,O){const k=document.querySelector("zcode-editor");if(k){const te=new CustomEvent(N,{detail:O,bubbles:!0,composed:!0});k.dispatchEvent(te);return}const U=new CustomEvent(N,{detail:O,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(U)}function K(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Y(){if(!V.value)return[];let N;if(l.value==="edit")N="page";else if(l.value==="parts")if(!d.value)console.warn('[ZeroCode] partsManagerRefが設定されていません。デフォルトで"common"を使用します。'),N="parts-common";else{const k=A(d.value);k==null?(console.warn('[ZeroCode] parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="parts-common"):k==="common"?N="parts-common":k==="individual"?N="parts-individual":N="parts-special"}else if(l.value==="images")if(!u.value)console.warn('[ZeroCode] imagesManagerRefが設定されていません。デフォルトで"common"を使用します。'),N="images-common";else{const k=A(u.value);k==null?(console.warn('[ZeroCode] images activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="images-common"):k==="common"?N="images-common":k==="individual"?N="images-individual":N="images-special"}else if(l.value==="data")if(!f.value)console.warn('[ZeroCode] dataViewerRefが設定されていません。デフォルトで"page"を使用します。'),N="page";else{const k=y(f.value),U=A(f.value);if(k==null)console.warn('[ZeroCode] dataViewer internalActiveTabが取得できません。デフォルトで"page"を使用します。'),N="page";else if(k==="page")N="page";else if(k==="parts")U==null?(console.warn('[ZeroCode] dataViewer parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="parts-common"):U==="common"?N="parts-common":U==="individual"?N="parts-individual":N="parts-special";else if(k==="images")U==null?(console.warn('[ZeroCode] dataViewer images activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="images-common"):U==="common"?N="images-common":U==="individual"?N="images-individual":N="images-special";else return console.warn(`[ZeroCode] dataViewer 不明なinternalActiveTab: ${k}`),[]}else return[];let O;return N==="page"?O=["page","images-common","images-individual"]:N==="parts-common"?O=[N,"parts-common-css"]:N==="parts-individual"?O=[N,"parts-individual-css"]:N==="parts-special"?O=[N,"parts-special-css"]:O=[N],O}function ce(){if(!W.value){Ee();return}const N=Y();if(N.length===0){console.warn(`[ZeroCode] ${n("editor.noSaveTargets")}`);return}m.value=N,h.value=!0}function Ee(){const N=Y();if(N.length===0){console.warn(`[ZeroCode] ${n("editor.noSaveTargets")}`);return}J("save-request",{requestId:K(),source:"editor",targets:N,timestamp:Date.now()})}function _e(){h.value=!1,Ee()}function Le(){h.value=!1,m.value=[]}function C(N){const{t:O}=rn();return{page:O("saveConfirm.targets.page"),"parts-common":O("saveConfirm.targets.parts-common"),"parts-individual":O("saveConfirm.targets.parts-individual"),"parts-special":O("saveConfirm.targets.parts-special"),"images-common":O("saveConfirm.targets.images-common"),"images-individual":O("saveConfirm.targets.images-individual"),"images-special":O("saveConfirm.targets.images-special"),"parts-common-css":O("saveConfirm.targets.parts-common-css"),"parts-individual-css":O("saveConfirm.targets.parts-individual-css"),"parts-special-css":O("saveConfirm.targets.parts-special-css")}[N]||N}return e({getData:se,setData:Z,allowDynamicContentInteraction:G}),(N,O)=>(a.openBlock(),a.createElementBlock("div",eM,[a.createElementVNode("div",tM,[a.createElementVNode("div",nM,[a.createElementVNode("button",{class:a.normalizeClass([{active:l.value==="edit"},"zcode-dev-tab"]),onClick:O[0]||(O[0]=k=>H("edit"))},[a.createVNode(a.unref(oa),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("editor.pageManagement")),1)],2),r.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass([{active:l.value==="parts"},"zcode-dev-tab"]),onClick:O[1]||(O[1]=k=>H("parts"))},[a.createVNode(a.unref(og),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("editor.partsManagement")),1)],2)):a.createCommentVNode("",!0),i.value?(a.openBlock(),a.createElementBlock("button",{key:1,class:a.normalizeClass([{active:l.value==="images"},"zcode-dev-tab"]),onClick:O[2]||(O[2]=k=>H("images"))},[a.createVNode(a.unref(Rc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("editor.imagesManagement")),1)],2)):a.createCommentVNode("",!0),a.createElementVNode("button",{class:a.normalizeClass([{active:l.value==="data"},"zcode-dev-tab"]),onClick:O[3]||(O[3]=k=>H("data"))},[a.createVNode(a.unref(Ym),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("editor.dataViewer")),1)],2),a.createElementVNode("button",{class:"zcode-dev-tab zcode-dev-settings-btn",title:N.$t("toolbar.settings"),onClick:O[4]||(O[4]=k=>p.value=!0)},[a.createVNode(a.unref($c),{size:16})],8,oM)])]),l.value==="edit"?(a.openBlock(),a.createBlock(rd,{key:0,"current-mode":j.value,"view-mode":s.value,"allow-dynamic-content-interaction":G.value,onSwitchMode:L,onSwitchViewMode:O[5]||(O[5]=k=>s.value=k),onOpenSettings:Q},null,8,["current-mode","view-mode","allow-dynamic-content-interaction"])):a.createCommentVNode("",!0),s.value==="preview"&&V.value?(a.openBlock(),a.createBlock(ma,{key:1,"cms-data":V.value,"allow-dynamic-content-interaction":G.value},null,8,["cms-data","allow-dynamic-content-interaction"])):a.createCommentVNode("",!0),s.value==="manage"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:2},[a.withDirectives(a.createVNode(Hs,{ref_key:"cmsRef",ref:c,locale:o.locale,page:o.page,"css-common":o.cssCommon,"css-individual":o.cssIndividual,"css-special":o.cssSpecial,"parts-common":o.partsCommon,"parts-individual":o.partsIndividual,"parts-special":o.partsSpecial,"images-common":o.imagesCommon,"images-individual":o.imagesIndividual,"images-special":o.imagesSpecial,config:o.config,endpoints:o.endpoints,"backend-data":o.backendData},null,8,["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data"]),[[a.vShow,l.value==="edit"]]),r.value&&l.value==="parts"&&V.value?(a.openBlock(),a.createBlock(oA,{key:0,ref_key:"partsManagerRef",ref:d,"cms-data":V.value,config:a.unref(g)},null,8,["cms-data","config"])):a.createCommentVNode("",!0),r.value&&l.value==="parts"&&!V.value?(a.openBlock(),a.createElementBlock("div",rM,[a.createElementVNode("div",iM,a.toDisplayString(N.$t("editor.loading")),1)])):a.createCommentVNode("",!0),i.value&&l.value==="images"&&V.value?(a.openBlock(),a.createBlock(UA,{key:2,ref_key:"imagesManagerRef",ref:u,"cms-data":V.value,config:a.unref(g)},null,8,["cms-data","config"])):a.createCommentVNode("",!0),i.value&&l.value==="images"&&!V.value?(a.openBlock(),a.createElementBlock("div",sM,[a.createElementVNode("div",aM,a.toDisplayString(N.$t("editor.loading")),1)])):a.createCommentVNode("",!0),a.withDirectives(a.createVNode(ZA,{ref_key:"dataViewerRef",ref:f,"cms-data":V.value,config:a.unref(g)},null,8,["cms-data","config"]),[[a.vShow,l.value==="data"&&V.value]])],64)):a.createCommentVNode("",!0),a.withDirectives(a.createVNode(Ou,{"is-open":p.value,"view-mode":s.value,mode:"dev-tabs","show-save-confirm":W.value,onClose:O[6]||(O[6]=k=>p.value=!1),onToggleSaveConfirm:X},null,8,["is-open","view-mode","show-save-confirm"]),[[a.vShow,p.value]]),s.value==="manage"?(a.openBlock(),a.createElementBlock("div",lM,[a.createElementVNode("button",{class:"zcode-save-btn",onClick:ce},[a.createVNode(a.unref(Lc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("common.save")),1)])])):a.createCommentVNode("",!0),h.value?(a.openBlock(),a.createElementBlock("div",{key:4,class:"zcode-save-confirm-dialog-overlay",onClick:a.withModifiers(Le,["self"])},[a.createElementVNode("div",cM,[a.createElementVNode("div",dM,[a.createElementVNode("div",uM,a.toDisplayString(N.$t("saveConfirm.title")),1)]),a.createElementVNode("div",fM,[a.createElementVNode("p",null,a.toDisplayString(N.$t("saveConfirm.message")),1),a.createElementVNode("ul",pM,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(m.value,k=>(a.openBlock(),a.createElementBlock("li",{key:k},a.toDisplayString(C(k)),1))),128))])]),a.createElementVNode("div",hM,[a.createElementVNode("button",{class:"zcode-btn-secondary",onClick:Le},a.toDisplayString(N.$t("common.cancel")),1),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:_e},a.toDisplayString(N.$t("saveConfirm.saveButton")),1)])])])):a.createCommentVNode("",!0)]))}});Cm();class mM extends HTMLElement{app=null;componentInstance=null;_shadowRoot=null;constructor(){super()}connectedCallback(){if(this.app)return;this.getAttribute("use-shadow-dom")!=="false"?(this.setupShadowDOM(),window.addEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this))):(this.setupLightDOM(),window.addEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this)))}setupLightDOM(){const e=this.getAttribute("page")||"[]",n=this.getAttribute("css-common"),o=this.getAttribute("css-individual"),r=this.getAttribute("css-special"),i=this.getAttribute("parts-common")||"[]",s=this.getAttribute("parts-individual")||"[]",l=this.getAttribute("parts-special")||"[]",c=this.getAttribute("images-common")||"[]",d=this.getAttribute("images-individual")||"[]",u=this.getAttribute("images-special")||"[]",f=Ws(this);this.app=a.createApp(vc,{locale:f,page:e,cssCommon:n,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:s,partsSpecial:l,imagesCommon:c,imagesIndividual:d,imagesSpecial:u,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||"",enablePartsManager:this.getAttribute("enable-parts-manager")!=="false",enableImagesManager:this.getAttribute("enable-images-manager")!=="false"}),Gs(this.app,f),this.componentInstance=this.app.mount(this),this.injectLightDOMCSS()}setupShadowDOM(){const e=this.shadowRoot,n=!!e;e?(this._shadowRoot=e,this.clearScripts()):(this._shadowRoot=this.attachShadow({mode:"open"}),this.injectCSS());const o=this.getAttribute("page")||"[]",r=this.getAttribute("css-common"),i=this.getAttribute("css-individual"),s=this.getAttribute("css-special"),l=this.getAttribute("parts-common")||"[]",c=this.getAttribute("parts-individual")||"[]",d=this.getAttribute("parts-special")||"[]",u=this.getAttribute("images-common")||"[]",f=this.getAttribute("images-individual")||"[]",p=this.getAttribute("images-special")||"[]",h=Ws(this);this.app=a.createApp(vc,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:s,partsCommon:l,partsIndividual:c,partsSpecial:d,imagesCommon:u,imagesIndividual:f,imagesSpecial:p,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||"",enablePartsManager:this.getAttribute("enable-parts-manager")!=="false",enableImagesManager:this.getAttribute("enable-images-manager")!=="false"}),Gs(this.app,h),this.componentInstance=this.app.mount(this._shadowRoot),requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{this.injectScript(n)},100)})})}injectCSS(){if(!this._shadowRoot)return;const e=document.createElement("style");e.textContent=Sm,this._shadowRoot.appendChild(e),this.querySelectorAll('[slot="css"]').forEach(o=>{const r=o.cloneNode(!0);r.removeAttribute("slot"),this._shadowRoot.appendChild(r),o.remove()})}injectLightDOMCSS(){this.querySelectorAll('[slot="css"]').forEach(n=>{const o=n.cloneNode(!0);o.removeAttribute("slot"),document.head.appendChild(o)})}clearScripts(){if(!this._shadowRoot)return;this._shadowRoot.querySelectorAll("script").forEach(n=>{n.remove()})}injectScript(e=!1){if(!this._shadowRoot)return;const n=this.querySelectorAll('[slot="script"]'),o=Array.from(n),r=[],i=[];o.forEach(c=>{const d=c;if(!d.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}d.src.includes("jquery")||d.src.includes("code.jquery.com")?r.push(d):i.push(d)});const s=c=>{let d=c.src;if(e)try{const f=new URL(c.src,window.location.href);f.searchParams.set("_t",Date.now().toString()),d=f.toString()}catch{d=c.src+(c.src.includes("?")?"&":"?")+"_t="+Date.now()}const u=document.createElement("script");return u.src=d,c.type&&(u.type=c.type),c.async&&(u.async=!0),c.defer&&(u.defer=!0),c.integrity&&(u.integrity=c.integrity),c.crossOrigin&&(u.crossOrigin=c.crossOrigin),u.onerror=f=>{console.error(`Failed to load script: ${c.src}`,f)},u},l=()=>{o.forEach(c=>{c.remove()})};if(r.length>0){let c=0;const d=r.length;r.forEach(u=>{const f=s(u);f.onload=()=>{c++,c===d&&(Mo(this._shadowRoot,e),requestAnimationFrame(()=>{i.forEach(p=>{this._shadowRoot.appendChild(s(p))}),l()}))},this._shadowRoot.appendChild(f)})}else Mo(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(s(c))}),l()}injectLightDOMScripts(){const e=this.querySelectorAll('[slot="script"]'),n=[],o=[];e.forEach(i=>{const s=i;if(!s.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}s.src.includes("jquery")||s.src.includes("code.jquery.com")?n.push(s):o.push(s)});const r=i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},s};if(n.length>0){let i=0;const s=n.length;n.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===s&&requestAnimationFrame(()=>{o.forEach(d=>{document.body.appendChild(r(d))})})},document.body.appendChild(c)})}else o.forEach(i=>{document.body.appendChild(r(i))})}getData(e){return this.componentInstance&&this.componentInstance.getData?this.componentInstance.getData(e):null}setData(e,n){return this.componentInstance&&this.componentInstance.setData?this.componentInstance.setData(e,n):!1}get allowDynamicContentInteraction(){if(this.componentInstance){const e=this.componentInstance.allowDynamicContentInteraction;if(e!==void 0)return e&&typeof e=="object"&&"value"in e?e.value:e}return!0}set allowDynamicContentInteraction(e){if(this.componentInstance){const n=this.componentInstance.allowDynamicContentInteraction;n!==void 0&&(n&&typeof n=="object"&&"value"in n?n.value=e:this.componentInstance.allowDynamicContentInteraction=e)}}disconnectedCallback(){if(this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot){if(this._shadowRoot.__zecEventListeners){const e=this._shadowRoot.__zecEventListeners,n=this._shadowRoot;e.forEach(o=>{o.forEach(r=>{n.removeEventListener(r.eventName,r.handler,!0)})}),e.clear()}if(window.__zecShadowRoots){const e=window.__zecShadowRoots,n=this._shadowRoot;for(const[o,r]of e.entries())r===n&&e.delete(o)}}this._shadowRoot=null,window.removeEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this)),window.removeEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this))}handleDOMUpdated(){if(!this._shadowRoot||this.getAttribute("use-shadow-dom")!=="true")return;this._shadowRoot.__zecJQueryExtended&&delete this._shadowRoot.__zecJQueryExtended;const e=this._shadowRoot.querySelector("script[data-zec-shadow-extension]");e&&e.remove(),Mo(this._shadowRoot,!0)}handleLightDOMUpdated(){this.getAttribute("use-shadow-dom")!=="true"&&(this.__lightDOMScriptsLoaded||(this.injectLightDOMScripts(),this.__lightDOMScriptsLoaded=!0))}static get observedAttributes(){return["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data","enable-parts-manager","enable-images-manager","use-shadow-dom"]}attributeChangedCallback(e,n,o){if(n!==o){if(e==="use-shadow-dom"){this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot&&(this._shadowRoot.innerHTML="",this._shadowRoot=null),this.connectedCallback();return}this.app&&(this.app.unmount(),this.app=null,this.componentInstance=null,this.connectedCallback())}}}customElements.get("zcode-editor")||customElements.define("zcode-editor",mM);class ni extends Error{constructor(e,n,o){super(o),this.code=e,this.path=n,this.name="RenderError"}}function gM(t,e={}){const{enableEditorAttributes:n=!1}=e,o=t.backendData;if(!t)throw new ni("PARSE_ERROR","","データが提供されていません");const r=t.parts||{common:[],individual:[],special:[]},i=t.images||{common:[],individual:[],special:[]},s=t.page||[];function l(d){return ha(d,r)}function c(d,u="",f=new Set){if(f.has(u))throw new ni("CIRCULAR_REFERENCE",u,`循環参照が検出されました: ${u}`);f.add(u);const p=d.part_id,h=l(p);if(!h)throw new ni("PART_NOT_FOUND",u,`パーツが見つかりません: ${p}`);const m=ui(h.body,d,u,l,(b,g)=>c(b,g,f),n,i.common,i.individual,i.special,o);return n?td(m,{"data-zcode-id":d.id,"data-zcode-path":u,"data-zcode-part":p}):m}return s.map((d,u)=>{try{return c(d,`page.${u}`)}catch(f){if(f instanceof ni)return`<div class="zcode-error-message" data-error-code="${f.code}">${f.message}</div>`;throw f}}).join("")}en.RenderError=ni,en.ZeroCodeCMS=Hs,en.ZeroCodeEditor=vc,en.ZeroCodePreview=ma,en.renderToHtml=gM,Object.defineProperty(en,Symbol.toStringTag,{value:"Module"})}));
|
|
490
|
-
//# sourceMappingURL=zerocode.umd.js.map
|
|
485
|
+
`),b=[];let v=0;for(const E of z){const C=E.trim();if(!C)continue;const M=/^<\/[^>]+>/.test(C),D=/\/>$/.test(C)||/^<!/.test(C),$=/^<[^/!][^>]*>$/.test(C)&&!D;M&&(v=Math.max(v-1,0)),b.push(" ".repeat(v)+C),$&&v++}return b.join(`
|
|
486
|
+
`)}const y=s.computed(()=>o.value==="page"&&r.value==="html"?g(d.value):m(p.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: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}},()=>{h()},{deep:!0}),s.watch(c,()=>{h()}),s.watch(o,()=>{t.fixedCategory?c.value=t.fixedCategory:c.value=t.config?.categoryOrder==="individual"?"individual":"common",h()});const x=async()=>{const T=y.value;try{await navigator.clipboard.writeText(T),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(S){ge.error("コピーに失敗しました:",S);const z=document.createElement("textarea");z.value=T,z.style.position="fixed",z.style.opacity="0",document.body.appendChild(z),z.select();try{document.execCommand("copy"),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(b){ge.error("コピーに失敗しました:",b)}document.body.removeChild(z)}};return h(),e({internalActiveTab:o,activeCategory:c}),(T,S)=>(s.openBlock(),s.createElementBlock("div",TA,[s.createElementVNode("div",MA,[s.createElementVNode("div",AA,[s.createElementVNode("button",{class:s.normalizeClass([{active:o.value==="page"},"zcode-data-viewer-content-tab"]),onClick:S[0]||(S[0]=z=>o.value="page")},s.toDisplayString(T.$t("dataViewer.page")),3),s.createElementVNode("button",{class:s.normalizeClass([{active:o.value==="parts"},"zcode-data-viewer-content-tab"]),onClick:S[1]||(S[1]=z=>o.value="parts")},s.toDisplayString(T.$t("dataViewer.parts")),3),s.createElementVNode("button",{class:s.normalizeClass([{active:o.value==="images"},"zcode-data-viewer-content-tab"]),onClick:S[2]||(S[2]=z=>o.value="images")},s.toDisplayString(T.$t("dataViewer.images")),3)]),s.createElementVNode("div",IA,[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:S[3]||(S[3]=z=>r.value="json")},s.toDisplayString(T.$t("dataViewer.json")),3),s.createElementVNode("button",{class:s.normalizeClass([{active:r.value==="html"},"zcode-data-viewer-tab"]),onClick:S[4]||(S[4]=z=>r.value="html")},s.toDisplayString(T.$t("dataViewer.html")),3)],64)):n.fixedCategory?s.createCommentVNode("",!0):(s.openBlock(!0),s.createElementBlock(s.Fragment,{key:1},s.renderList(l.value,z=>(s.openBlock(),s.createElementBlock("button",{key:z,class:s.normalizeClass([{active:c.value===z},"zcode-data-viewer-tab"]),onClick:b=>c.value=z},s.toDisplayString(z==="common"?T.$t("dataViewer.common"):z==="individual"?T.$t("dataViewer.individual"):T.$t("dataViewer.special")),11,_A))),128))])]),s.createElementVNode("div",OA,[s.createElementVNode("div",DA,[s.createElementVNode("pre",RA,s.toDisplayString(y.value),1),s.createElementVNode("button",{class:"zcode-data-viewer-copy-btn",title:i.value?T.$t("common.copied"):T.$t("common.copy"),onClick:x},[i.value?(s.openBlock(),s.createBlock(s.unref(dr),{key:0,size:18})):(s.openBlock(),s.createBlock(s.unref(_m),{key:1,size:18}))],8,PA)])])]))}}),$A={class:"zcode-dev-container"},LA={class:"zcode-dev-header"},VA={class:"zcode-dev-tabs"},BA=["title"],FA={key:3,class:"zcode-loading-message"},jA={class:"zcode-loading-message-text"},HA={key:5,class:"zcode-loading-message"},UA={class:"zcode-loading-message-text"},WA={key:6,class:"zcode-save-controls-fixed"},qA={class:"zcode-save-confirm-dialog"},GA={class:"zcode-save-confirm-dialog-header"},KA={class:"zcode-save-confirm-dialog-title"},JA={class:"zcode-save-confirm-dialog-body"},XA={class:"zcode-save-confirm-targets"},YA={class:"zcode-save-confirm-dialog-footer"},Cc=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}=rn(),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),p=s.ref(null),f=s.ref(!1),h=s.ref(!1),m=s.ref([]),y=(w=>{if(!w)return{};try{return JSON.parse(w)}catch(I){return ge.warn("ZeroCodeEditor: Failed to parse config:",I),{}}})(o.config);function x(w){return typeof w=="object"&&w!==null}function T(w){return w==="common"||w==="individual"||w==="special"}function S(w){return w==="page"||w==="parts"||w==="images"}function z(w){if(x(w)&&"value"in w)return w.value}function b(w){const I=z(w);if(typeof I=="boolean")return I;if(typeof w=="boolean")return w}function v(w){const I=z(w);if(typeof I=="string")return I;if(typeof w=="string")return w}function E(w,I){return x(w)&&"value"in w?(w.value=I,!0):!1}function C(w,I){if(x(w))return w[I]}function M(w){const I=C(w,"activeCategory");if(T(I))return I;const j=z(I);return T(j)?j:void 0}function D(w){const I=C(w,"internalActiveTab");if(S(I))return I;const j=z(I);return S(j)?j:void 0}function $(){const w=c.value;return!x(w)||!("cmsData"in w)||!("currentMode"in w)||!("switchMode"in w)||!("allowDynamicContentInteraction"in w)||!("settingsPanelOpen"in w)||!("setData"in w)?null:w}const P=(w,I,j)=>{const le=fu();return le[w]!==void 0?le[w]:j!==void 0?j:I},L=s.ref(P("showDataViewer",!1,y.dev?.showDataViewer)),V=s.ref(P("showSaveConfirm",!0,y.dev?.showSaveConfirm)),{cmsData:F,loadDataFromProps:H}=gc(o),U=s.computed(()=>{const w=$();return w?w.cmsData:F}),G=s.computed(()=>{const w=$();return(w?v(w.currentMode):void 0)??"edit"}),K=w=>{c.value?.switchMode&&c.value.switchMode(w)};function J(w){l.value=w,(w==="parts"||w==="images"||w==="data")&&(a.value="manage")}function ne(){const w=$();w&&!E(w.settingsPanelOpen,!0)&&(w.settingsPanelOpen=!0)}const ee=s.computed(()=>{if(a.value==="preview")return!0;const w=$();if(w){const I=b(w.allowDynamicContentInteraction);if(I!==void 0)return I}return pu("allowDynamicContentInteraction",!1)});function Y(w){const I=U.value;if(!w)return I;const j=w.split(".");let le=I;for(const Ce of j)if(!x(le)||(le=le[Ce],le===void 0))return;return le}function te(w,I){const j=$();return j?j.setData(w,I):!1}s.onMounted(()=>{H()}),s.watch([()=>o.page,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial],()=>{H()}),s.watch(L,w=>{Oa({showDataViewer:w})}),s.watch(V,w=>{Oa({showSaveConfirm:w})}),s.watch(a,(w,I)=>{ce("view-mode-changed",{mode:w,previousMode:I})});function se(w){V.value=w}function ce(w,I){const j=document.querySelector("zcode-editor");if(j){const Ce=new CustomEvent(w,{detail:I,bubbles:!0,composed:!0});j.dispatchEvent(Ce);return}const le=new CustomEvent(w,{detail:I,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(le)}function ke(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Se(){if(!U.value)return[];let w;if(l.value==="edit")w="page";else if(l.value==="parts")if(!d.value)ge.warn('partsManagerRefが設定されていません。デフォルトで"common"を使用します。'),w="parts-common";else{const j=M(d.value);j==null?(ge.warn('parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),w="parts-common"):j==="common"?w="parts-common":j==="individual"?w="parts-individual":w="parts-special"}else if(l.value==="images")if(!u.value)ge.warn('imagesManagerRefが設定されていません。デフォルトで"common"を使用します。'),w="images-common";else{const j=M(u.value);j==null?(ge.warn('images activeCategoryが取得できません。デフォルトで"common"を使用します。'),w="images-common"):j==="common"?w="images-common":j==="individual"?w="images-individual":w="images-special"}else if(l.value==="data")if(!p.value)ge.warn('dataViewerRefが設定されていません。デフォルトで"page"を使用します。'),w="page";else{const j=D(p.value),le=M(p.value);if(j==null)ge.warn('dataViewer internalActiveTabが取得できません。デフォルトで"page"を使用します。'),w="page";else if(j==="page")w="page";else if(j==="parts")le==null?(ge.warn('dataViewer parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),w="parts-common"):le==="common"?w="parts-common":le==="individual"?w="parts-individual":w="parts-special";else if(j==="images")le==null?(ge.warn('dataViewer images activeCategoryが取得できません。デフォルトで"common"を使用します。'),w="images-common"):le==="common"?w="images-common":le==="individual"?w="images-individual":w="images-special";else return ge.warn(`dataViewer 不明なinternalActiveTab: ${j}`),[]}else return[];let I;return w==="page"?I=["page"]:w==="parts-common"?I=[w,"parts-common-css"]:w==="parts-individual"?I=[w,"parts-individual-css"]:w==="parts-special"?I=[w,"parts-special-css"]:I=[w],I}function Oe(){if(!V.value){N();return}const w=Se();if(w.length===0){ge.warn(String(t("editor.noSaveTargets")));return}m.value=w,h.value=!0}function N(){const w=Se();if(w.length===0){ge.warn(String(t("editor.noSaveTargets")));return}ce("save-request",{requestId:ke(),source:"editor",targets:w,timestamp:Date.now()})}function X(){h.value=!1,N()}function oe(){h.value=!1,m.value=[]}function k(w){return{page:t("saveConfirm.targets.page"),"parts-common":t("saveConfirm.targets.parts-common"),"parts-individual":t("saveConfirm.targets.parts-individual"),"parts-special":t("saveConfirm.targets.parts-special"),"images-common":t("saveConfirm.targets.images-common"),"images-individual":t("saveConfirm.targets.images-individual"),"images-special":t("saveConfirm.targets.images-special"),"parts-common-css":t("saveConfirm.targets.parts-common-css"),"parts-individual-css":t("saveConfirm.targets.parts-individual-css"),"parts-special-css":t("saveConfirm.targets.parts-special-css")}[w]||w}return e({getData:Y,setData:te,allowDynamicContentInteraction:ee}),(w,I)=>(s.openBlock(),s.createElementBlock("div",$A,[s.createElementVNode("div",LA,[s.createElementVNode("div",VA,[s.createElementVNode("button",{class:s.normalizeClass([{active:l.value==="edit"},"zcode-dev-tab"]),onClick:I[0]||(I[0]=j=>J("edit"))},[s.createVNode(s.unref(ci),{size:16}),s.createElementVNode("span",null,s.toDisplayString(w.$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:I[1]||(I[1]=j=>J("parts"))},[s.createVNode(s.unref(Oc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(w.$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:I[2]||(I[2]=j=>J("images"))},[s.createVNode(s.unref(li),{size:16}),s.createElementVNode("span",null,s.toDisplayString(w.$t("editor.imagesManagement")),1)],2)):s.createCommentVNode("",!0),s.createElementVNode("button",{class:s.normalizeClass([{active:l.value==="data"},"zcode-dev-tab"]),onClick:I[3]||(I[3]=j=>J("data"))},[s.createVNode(s.unref(_c),{size:16}),s.createElementVNode("span",null,s.toDisplayString(w.$t("editor.dataViewer")),1)],2),s.createElementVNode("button",{class:"zcode-dev-tab zcode-dev-settings-btn",title:w.$t("toolbar.settings"),onClick:I[4]||(I[4]=j=>f.value=!0)},[s.createVNode(s.unref(ea),{size:16})],8,BA)])]),l.value==="edit"?(s.openBlock(),s.createBlock(Ia,{key:0,"current-mode":G.value,"view-mode":a.value,"allow-dynamic-content-interaction":ee.value,onSwitchMode:K,onSwitchViewMode:I[5]||(I[5]=j=>a.value=j),onOpenSettings:ne},null,8,["current-mode","view-mode","allow-dynamic-content-interaction"])):s.createCommentVNode("",!0),a.value==="preview"&&U.value?(s.openBlock(),s.createBlock(Ti,{key:1,"cms-data":U.value,"allow-dynamic-content-interaction":ee.value},null,8,["cms-data","allow-dynamic-content-interaction"])):s.createCommentVNode("",!0),s.withDirectives(s.createVNode(Zr,{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"&&U.value?(s.openBlock(),s.createBlock(gm,{key:2,ref_key:"partsManagerRef",ref:d,"cms-data":U.value,config:s.unref(y)},null,8,["cms-data","config"])):s.createCommentVNode("",!0),a.value==="manage"&&r.value&&l.value==="parts"&&!U.value?(s.openBlock(),s.createElementBlock("div",FA,[s.createElementVNode("div",jA,s.toDisplayString(w.$t("editor.loading")),1)])):s.createCommentVNode("",!0),a.value==="manage"&&i.value&&l.value==="images"&&U.value?(s.openBlock(),s.createBlock(bm,{key:4,ref_key:"imagesManagerRef",ref:u,"cms-data":U.value,config:s.unref(y)},null,8,["cms-data","config"])):s.createCommentVNode("",!0),a.value==="manage"&&i.value&&l.value==="images"&&!U.value?(s.openBlock(),s.createElementBlock("div",HA,[s.createElementVNode("div",UA,s.toDisplayString(w.$t("editor.loading")),1)])):s.createCommentVNode("",!0),s.withDirectives(s.createVNode(xm,{ref_key:"dataViewerRef",ref:p,"cms-data":U.value,config:s.unref(y)},null,8,["cms-data","config"]),[[s.vShow,a.value==="manage"&&l.value==="data"&&U.value]]),s.withDirectives(s.createVNode(Da,{"is-open":f.value,"view-mode":a.value,mode:"dev-tabs","show-save-confirm":V.value,onClose:I[6]||(I[6]=j=>f.value=!1),onToggleSaveConfirm:se},null,8,["is-open","view-mode","show-save-confirm"]),[[s.vShow,f.value]]),a.value==="manage"?(s.openBlock(),s.createElementBlock("div",WA,[s.createElementVNode("button",{class:"zcode-save-btn",onClick:Oe},[s.createVNode(s.unref(Zs),{size:16}),s.createElementVNode("span",null,s.toDisplayString(w.$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(oe,["self"])},[s.createElementVNode("div",qA,[s.createElementVNode("div",GA,[s.createElementVNode("div",KA,s.toDisplayString(w.$t("saveConfirm.title")),1)]),s.createElementVNode("div",JA,[s.createElementVNode("p",null,s.toDisplayString(w.$t("saveConfirm.message")),1),s.createElementVNode("ul",XA,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(m.value,j=>(s.openBlock(),s.createElementBlock("li",{key:j},s.toDisplayString(k(j)),1))),128))])]),s.createElementVNode("div",YA,[s.createElementVNode("button",{class:"zcode-btn-secondary",onClick:oe},s.toDisplayString(w.$t("common.cancel")),1),s.createElementVNode("button",{class:"zcode-btn-primary",onClick:X},s.toDisplayString(w.$t("saveConfirm.saveButton")),1)])])])):s.createCommentVNode("",!0)]))}});Ec();class QA 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")||"[]",p=nr(this);this.app=s.createApp(Cc,{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")||"",enablePartsManager:this.getAttribute("enable-parts-manager")!=="false",enableImagesManager:this.getAttribute("enable-images-manager")!=="false"}),or(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")||"[]",p=this.getAttribute("images-individual")||"[]",f=this.getAttribute("images-special")||"[]",h=nr(this);this.app=s.createApp(Cc,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:a,partsCommon:l,partsIndividual:c,partsSpecial:d,imagesCommon:u,imagesIndividual:p,imagesSpecial:f,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"}),or(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=kc,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){ge.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 p=new URL(c.src,window.location.href);p.searchParams.set("_t",Date.now().toString()),d=p.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=p=>{ge.error(`Failed to load script: ${c.src}`,p)},u},l=()=>{o.forEach(c=>{c.remove()})};if(r.length>0){let c=0;const d=r.length;r.forEach(u=>{const p=a(u);p.onload=()=>{c++,c===d&&(Nn(this._shadowRoot,e),requestAnimationFrame(()=>{i.forEach(f=>{this._shadowRoot.appendChild(a(f))}),l()}))},this._shadowRoot.appendChild(p)})}else Nn(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){ge.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=>{ge.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(),Nn(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",QA);const ZA={class:"zcode-dev-container"},eI={class:"zcode-dev-header"},tI={class:"zcode-dev-tabs"},nI=["title"],oI={key:3,class:"zcode-loading-message"},rI={class:"zcode-loading-message-text"},iI={key:5,class:"zcode-loading-message"},sI={class:"zcode-loading-message-text"},aI={key:6,class:"zcode-save-controls-fixed"},lI={class:"zcode-save-confirm-dialog"},cI={class:"zcode-save-confirm-dialog-header"},dI={class:"zcode-save-confirm-dialog-title"},uI={class:"zcode-save-confirm-dialog-body"},pI={class:"zcode-save-confirm-targets"},fI={class:"zcode-save-confirm-dialog-footer"},vc=s.defineComponent({__name:"ZeroCodeStudio",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}=rn(),o=n,r=s.ref("manage"),i=s.ref("edit"),a=s.ref(null),l=s.ref(null),c=s.ref(null),d=s.ref(null),u=s.ref(!1),p=s.ref(!1),f=s.ref([]),m=(N=>{if(!N)return{};try{return JSON.parse(N)}catch(X){return ge.warn("ZeroCodeStudio: Failed to parse config:",X),{}}})(o.config),g=s.ref(m.studio?.showSaveConfirm!==!1);function y(N){return typeof N=="object"&&N!==null}function x(N){return N==="common"||N==="individual"||N==="special"}function T(N){return N==="page"||N==="parts"||N==="images"}function S(N){if(y(N)&&"value"in N)return N.value}function z(N){const X=S(N);if(typeof X=="boolean")return X;if(typeof N=="boolean")return N}function b(N){const X=S(N);if(typeof X=="string")return X;if(typeof N=="string")return N}function v(N,X){return y(N)&&"value"in N?(N.value=X,!0):!1}function E(N,X){if(y(N))return N[X]}function C(N){const X=E(N,"activeCategory");if(x(X))return X;const oe=S(X);return x(oe)?oe:void 0}function M(N){const X=E(N,"internalActiveTab");if(T(X))return X;const oe=S(X);return T(oe)?oe:void 0}function D(){const N=a.value;return!y(N)||!("cmsData"in N)||!("currentMode"in N)||!("switchMode"in N)||!("allowDynamicContentInteraction"in N)||!("settingsPanelOpen"in N)||!("setData"in N)?null:N}const{cmsData:$,loadDataFromProps:P}=gc(o),L=s.computed(()=>{const N=D();return N?N.cmsData:$}),V=s.computed(()=>{const N=D();return(N?b(N.currentMode):void 0)??"edit"}),F=N=>{a.value?.switchMode&&a.value.switchMode(N)};function H(N){i.value=N,(N==="parts"||N==="images"||N==="data")&&(r.value="manage")}function U(){const N=D();N&&!v(N.settingsPanelOpen,!0)&&(N.settingsPanelOpen=!0)}const G=s.computed(()=>{if(r.value==="preview")return!0;const N=D();if(N){const X=z(N.allowDynamicContentInteraction);if(X!==void 0)return X}return pu("allowDynamicContentInteraction",!1)});function K(N){const X=L.value;if(!N)return X;const oe=N.split(".");let k=X;for(const w of oe)if(!y(k)||(k=k[w],k===void 0))return;return k}function J(N,X){const oe=D();return oe?oe.setData(N,X):!1}s.onMounted(()=>{P()}),s.watch([()=>o.page,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial],()=>{P()}),s.watch(r,(N,X)=>{ee("view-mode-changed",{mode:N,previousMode:X})});function ne(N){g.value=N}function ee(N,X){const oe=document.querySelector("zcode-studio");if(oe){const w=new CustomEvent(N,{detail:X,bubbles:!0,composed:!0});oe.dispatchEvent(w);return}const k=new CustomEvent(N,{detail:X,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(k)}function Y(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function te(){if(!L.value)return[];let N;if(i.value==="edit")N="page";else if(i.value==="parts")if(!l.value)ge.warn('partsManagerRefが設定されていません。デフォルトで"special"を使用します。'),N="parts-special";else{const oe=C(l.value);oe==="common"?N="parts-common":oe==="individual"?N="parts-individual":N="parts-special"}else if(i.value==="images")if(!c.value)ge.warn('imagesManagerRefが設定されていません。デフォルトで"special"を使用します。'),N="images-special";else{const oe=C(c.value);oe==="common"?N="images-common":oe==="individual"?N="images-individual":N="images-special"}else if(i.value==="data")if(!d.value)ge.warn('dataViewerRefが設定されていません。デフォルトで"page"を使用します。'),N="page";else{const oe=M(d.value),k=C(d.value);if(oe==null)ge.warn('dataViewer internalActiveTabが取得できません。デフォルトで"page"を使用します。'),N="page";else if(oe==="page")N="page";else if(oe==="parts")k==="common"?N="parts-common":k==="individual"?N="parts-individual":N="parts-special";else if(oe==="images")k==="common"?N="images-common":k==="individual"?N="images-individual":N="images-special";else return ge.warn(`dataViewer 不明なinternalActiveTab: ${oe}`),[]}else return[];let X;return N==="page"?X=["page"]:N==="parts-common"?X=[N,"parts-common-css"]:N==="parts-individual"?X=[N,"parts-individual-css"]:N==="parts-special"?X=[N,"parts-special-css"]:X=[N],X}function se(){if(!g.value){ce();return}const N=te();if(N.length===0){ge.warn(String(t("editor.noSaveTargets")));return}f.value=N,p.value=!0}function ce(){const N=te();if(N.length===0){ge.warn(String(t("editor.noSaveTargets")));return}ee("save-request",{requestId:Y(),source:"studio",targets:N,timestamp:Date.now()})}function ke(){p.value=!1,ce()}function Se(){p.value=!1,f.value=[]}function Oe(N){return{page:t("saveConfirm.targets.page"),"parts-common":t("saveConfirm.targets.parts-common"),"parts-individual":t("saveConfirm.targets.parts-individual"),"parts-special":t("saveConfirm.targets.parts-special"),"images-common":t("saveConfirm.targets.images-common"),"images-individual":t("saveConfirm.targets.images-individual"),"images-special":t("saveConfirm.targets.images-special"),"parts-common-css":t("saveConfirm.targets.parts-common-css"),"parts-individual-css":t("saveConfirm.targets.parts-individual-css"),"parts-special-css":t("saveConfirm.targets.parts-special-css")}[N]||N}return e({getData:K,setData:J,allowDynamicContentInteraction:G}),(N,X)=>(s.openBlock(),s.createElementBlock("div",ZA,[s.createElementVNode("div",eI,[s.createElementVNode("div",tI,[s.createElementVNode("button",{class:s.normalizeClass([{active:i.value==="edit"},"zcode-dev-tab"]),onClick:X[0]||(X[0]=oe=>H("edit"))},[s.createVNode(s.unref(ci),{size:16}),s.createElementVNode("span",null,s.toDisplayString(N.$t("editor.pageManagement")),1)],2),s.createElementVNode("button",{class:s.normalizeClass([{active:i.value==="parts"},"zcode-dev-tab"]),onClick:X[1]||(X[1]=oe=>H("parts"))},[s.createVNode(s.unref(Oc),{size:16}),s.createElementVNode("span",null,s.toDisplayString(N.$t("editor.partsManagement")),1)],2),s.createElementVNode("button",{class:s.normalizeClass([{active:i.value==="images"},"zcode-dev-tab"]),onClick:X[2]||(X[2]=oe=>H("images"))},[s.createVNode(s.unref(li),{size:16}),s.createElementVNode("span",null,s.toDisplayString(N.$t("editor.imagesManagement")),1)],2),s.createElementVNode("button",{class:s.normalizeClass([{active:i.value==="data"},"zcode-dev-tab"]),onClick:X[3]||(X[3]=oe=>H("data"))},[s.createVNode(s.unref(_c),{size:16}),s.createElementVNode("span",null,s.toDisplayString(N.$t("editor.dataViewer")),1)],2),s.createElementVNode("button",{class:"zcode-dev-tab zcode-dev-settings-btn",title:N.$t("toolbar.settings"),onClick:X[4]||(X[4]=oe=>u.value=!0)},[s.createVNode(s.unref(ea),{size:16})],8,nI)])]),i.value==="edit"?(s.openBlock(),s.createBlock(Ia,{key:0,"current-mode":V.value,"view-mode":r.value,"allow-dynamic-content-interaction":G.value,onSwitchMode:F,onSwitchViewMode:X[5]||(X[5]=oe=>r.value=oe),onOpenSettings:U},null,8,["current-mode","view-mode","allow-dynamic-content-interaction"])):s.createCommentVNode("",!0),r.value==="preview"&&L.value?(s.openBlock(),s.createBlock(Ti,{key:1,"cms-data":L.value,"allow-dynamic-content-interaction":G.value},null,8,["cms-data","allow-dynamic-content-interaction"])):s.createCommentVNode("",!0),s.withDirectives(s.createVNode(Zr,{ref_key:"cmsRef",ref:a,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,r.value==="manage"&&i.value==="edit"]]),r.value==="manage"&&i.value==="parts"&&L.value?(s.openBlock(),s.createBlock(gm,{key:2,ref_key:"partsManagerRef",ref:l,"cms-data":L.value,config:s.unref(m),"fixed-category":"special"},null,8,["cms-data","config"])):s.createCommentVNode("",!0),r.value==="manage"&&i.value==="parts"&&!L.value?(s.openBlock(),s.createElementBlock("div",oI,[s.createElementVNode("div",rI,s.toDisplayString(N.$t("editor.loading")),1)])):s.createCommentVNode("",!0),r.value==="manage"&&i.value==="images"&&L.value?(s.openBlock(),s.createBlock(bm,{key:4,ref_key:"imagesManagerRef",ref:c,"cms-data":L.value,config:s.unref(m),"fixed-category":"special"},null,8,["cms-data","config"])):s.createCommentVNode("",!0),r.value==="manage"&&i.value==="images"&&!L.value?(s.openBlock(),s.createElementBlock("div",iI,[s.createElementVNode("div",sI,s.toDisplayString(N.$t("editor.loading")),1)])):s.createCommentVNode("",!0),s.withDirectives(s.createVNode(xm,{ref_key:"dataViewerRef",ref:d,"cms-data":L.value,config:s.unref(m),"fixed-category":"special"},null,8,["cms-data","config"]),[[s.vShow,r.value==="manage"&&i.value==="data"&&L.value]]),s.withDirectives(s.createVNode(Da,{"is-open":u.value,"view-mode":r.value,mode:"dev-tabs","show-save-confirm":g.value,onClose:X[6]||(X[6]=oe=>u.value=!1),onToggleSaveConfirm:ne},null,8,["is-open","view-mode","show-save-confirm"]),[[s.vShow,u.value]]),r.value==="manage"?(s.openBlock(),s.createElementBlock("div",aI,[s.createElementVNode("button",{class:"zcode-save-btn",onClick:se},[s.createVNode(s.unref(Zs),{size:16}),s.createElementVNode("span",null,s.toDisplayString(N.$t("common.save")),1)])])):s.createCommentVNode("",!0),p.value?(s.openBlock(),s.createElementBlock("div",{key:7,class:"zcode-save-confirm-dialog-overlay",onClick:s.withModifiers(Se,["self"])},[s.createElementVNode("div",lI,[s.createElementVNode("div",cI,[s.createElementVNode("div",dI,s.toDisplayString(N.$t("saveConfirm.title")),1)]),s.createElementVNode("div",uI,[s.createElementVNode("p",null,s.toDisplayString(N.$t("saveConfirm.message")),1),s.createElementVNode("ul",pI,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(f.value,oe=>(s.openBlock(),s.createElementBlock("li",{key:oe},s.toDisplayString(Oe(oe)),1))),128))])]),s.createElementVNode("div",fI,[s.createElementVNode("button",{class:"zcode-btn-secondary",onClick:Se},s.toDisplayString(N.$t("common.cancel")),1),s.createElementVNode("button",{class:"zcode-btn-primary",onClick:ke},s.toDisplayString(N.$t("saveConfirm.saveButton")),1)])])])):s.createCommentVNode("",!0)]))}});Ec();class hI 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)))}getCommonProps(){return{page:this.getAttribute("page")||"[]",cssCommon:this.getAttribute("css-common"),cssIndividual:this.getAttribute("css-individual"),cssSpecial:this.getAttribute("css-special"),partsCommon:this.getAttribute("parts-common")||"[]",partsIndividual:this.getAttribute("parts-individual")||"[]",partsSpecial:this.getAttribute("parts-special")||"[]",imagesCommon:this.getAttribute("images-common")||"[]",imagesIndividual:this.getAttribute("images-individual")||"[]",imagesSpecial:this.getAttribute("images-special")||"[]",config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}}setupLightDOM(){const e=nr(this),t=this.getCommonProps(),o=Array.from(this.querySelectorAll('[slot="script"]'));o.length>0&&(this.__savedScriptSlots=o.map(r=>({src:r.src,type:r.type,async:r.async,defer:r.defer,integrity:r.integrity,crossOrigin:r.crossOrigin}))),this.app=s.createApp(vc,{locale:e,...t}),or(this.app,e),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=nr(this),r=this.getCommonProps();this.app=s.createApp(vc,{locale:o,...r}),or(this.app,o),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=kc,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){ge.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 p=new URL(c.src,window.location.href);p.searchParams.set("_t",Date.now().toString()),d=p.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=p=>{ge.error(`Failed to load script: ${c.src}`,p)},u},l=()=>{o.forEach(c=>c.remove())};if(r.length>0){let c=0;const d=r.length;r.forEach(u=>{const p=a(u);p.onload=()=>{c++,c===d&&(Nn(this._shadowRoot,e),setTimeout(()=>{i.forEach(f=>{this._shadowRoot.appendChild(a(f))}),l()},50))},this._shadowRoot.appendChild(p)})}else Nn(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){ge.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=>{ge.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}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(),Nn(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-studio")||customElements.define("zcode-studio",hI),gt.RenderError=Vo,gt.ZeroCodeCMS=Zr,gt.ZeroCodeEditor=Cc,gt.ZeroCodePreview=Ti,gt.ZeroCodeStudio=vc,gt.renderCssToHtml=Eb,gt.renderToHtml=wb,gt.sanitizePartTemplate=su,gt.sanitizeRichText=Ta,gt.sanitizeUrl=yt,Object.defineProperty(gt,Symbol.toStringTag,{value:"Module"})}));
|