diff --git a/docs/assets/display.08a50fb3.css b/docs/assets/display.08a50fb3.css deleted file mode 100644 index 650f0e1..0000000 --- a/docs/assets/display.08a50fb3.css +++ /dev/null @@ -1 +0,0 @@ -.sb-missing-block{flex-basis:100%} \ No newline at end of file diff --git a/docs/assets/display.54a23f84.js b/docs/assets/display.54a23f84.js deleted file mode 100644 index 7a336ac..0000000 --- a/docs/assets/display.54a23f84.js +++ /dev/null @@ -1,2 +0,0 @@ -import{y as a,m as s,z as e,D as t,e as l}from"./index.a48301fd.js";/* empty css */import"./vendor.a029424f.js";var d=a({name:"sb-image-display",model:s,props:{data:{type:null,default:e}},setup:a=>()=>t("figure",{class:"sb-image"},[t("img",{class:"sb-image__content",src:a.data.src,alt:a.data.alt},null),t(l,{block:a.data.description},null)])});export default d; -//# sourceMappingURL=display.54a23f84.js.map diff --git a/docs/assets/display.54a23f84.js.map b/docs/assets/display.54a23f84.js.map deleted file mode 100644 index 765d596..0000000 --- a/docs/assets/display.54a23f84.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"display.54a23f84.js","sources":["../../packages/image/lib/display.tsx"],"sourcesContent":["import { defineComponent, PropType } from 'vue';\nimport {\n model,\n SbBlock,\n} from '@schlechtenburg/core';\nimport {\n getDefaultData,\n ImageData,\n} from './util';\n\nimport './style.scss';\n\nexport default defineComponent({\n name: 'sb-image-display',\n\n model,\n\n props: {\n data: {\n type: (null as unknown) as PropType,\n default: getDefaultData,\n },\n },\n\n setup(props) {\n return () =>
\n \n \n
;\n },\n});\n"],"names":["defineComponent","name","model","props","data","type","default","getDefaultData","setup","src","alt","description"],"mappings":"6HAYA,MAAeA,EAAgB,CAC7BC,KAAM,mBAENC,MAAAA,EAEAC,MAAO,CACLC,KAAM,CACJC,KAAO,KACPC,QAASC,IAIbC,MAAML,GACG,sBAAoB,4BAEf,wBACDA,EAAMC,KAAKK,QACXN,EAAMC,KAAKM,sBAEFP,EAAMC,KAAKO"} \ No newline at end of file diff --git a/docs/assets/display.82dfc9cb.js b/docs/assets/display.82dfc9cb.js deleted file mode 100644 index 9ac8443..0000000 --- a/docs/assets/display.82dfc9cb.js +++ /dev/null @@ -1,2 +0,0 @@ -var e=Object.assign;import{G as t,m as a,H as n,I as s,J as l}from"./index.a48301fd.js";import"./vendor.a029424f.js";var o=t({name:"sb-missing-block",model:a,props:e(e({},n),{name:String,data:{type:null,default:null},eventUpdate:{type:Function,default:()=>{}},eventAppendBlock:{type:Function,default:()=>{}},eventRemoveBlock:{type:Function,default:()=>{}}}),setup:e=>()=>s("div",{class:"sb-missing-block"},[l("Missing block: "),e.name])});export default o; -//# sourceMappingURL=display.82dfc9cb.js.map diff --git a/docs/assets/display.82dfc9cb.js.map b/docs/assets/display.82dfc9cb.js.map deleted file mode 100644 index 2172823..0000000 --- a/docs/assets/display.82dfc9cb.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"display.82dfc9cb.js","sources":["../../packages/core/lib/components/MissingBlock/display.tsx"],"sourcesContent":["import { defineComponent, PropType } from 'vue';\nimport {\n model,\n blockProps,\n} from '../../block-helpers';\n\nimport './style.scss';\n\nexport default defineComponent({\n name: 'sb-missing-block',\n\n model,\n\n props: {\n ...blockProps,\n name: String,\n data: {\n type: (null as unknown) as PropType,\n default: null,\n },\n eventUpdate: { type: Function, default: () => {} },\n eventAppendBlock: { type: Function, default: () => {} },\n eventRemoveBlock: { type: Function, default: () => {} },\n },\n\n setup(props) {\n return () => (\n
Missing block: {props.name}
\n );\n },\n});\n"],"names":["defineComponent","name","model","props","__assign","blockProps","String","data","type","default","eventUpdate","Function","eventAppendBlock","eventRemoveBlock","setup"],"mappings":"2HAQeA,EAAgB,CAC7BC,KAAM,mBAENC,MAAAA,EAEAC,MAAOC,OACFC,GADE,CAELJ,KAAMK,OACNC,KAAM,CACJC,KAAO,KACPC,QAAS,MAEXC,YAAa,CAAEF,KAAMG,SAAUF,QAAS,QACxCG,iBAAkB,CAAEJ,KAAMG,SAAUF,QAAS,QAC7CI,iBAAkB,CAAEL,KAAMG,SAAUF,QAAS,UAG/CK,MAAMX,GACG,mBACM,0CAAmCA,EAAMF"} \ No newline at end of file diff --git a/docs/assets/display.a9bb8ea2.js b/docs/assets/display.a9bb8ea2.js deleted file mode 100644 index 8cc79e0..0000000 --- a/docs/assets/display.a9bb8ea2.js +++ /dev/null @@ -1,2 +0,0 @@ -import{d as a,m as s,g as t,c as e,a as l,e as o}from"./index.a48301fd.js";/* empty css */import"./vendor.a029424f.js";var d=a({name:"sb-layout-display",model:s,props:{data:{type:null,default:t}},setup(a){const s=e((()=>({"sb-layout":!0,[`sb-layout_${a.data.orientation}`]:!0})));return()=>l("div",{class:s.value},[...a.data.children.map((a=>l(o,{key:a.id,block:a},null)))])}});export default d; -//# sourceMappingURL=display.a9bb8ea2.js.map diff --git a/docs/assets/display.a9bb8ea2.js.map b/docs/assets/display.a9bb8ea2.js.map deleted file mode 100644 index 64e813a..0000000 --- a/docs/assets/display.a9bb8ea2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"display.a9bb8ea2.js","sources":["../../packages/layout/lib/display.tsx"],"sourcesContent":["import {\n defineComponent,\n computed,\n PropType,\n} from 'vue';\nimport {\n model,\n SbBlock,\n} from '@schlechtenburg/core';\nimport {\n LayoutData,\n getDefaultData,\n} from './util';\n\nimport './style.scss';\n\nexport default defineComponent({\n name: 'sb-layout-display',\n\n model,\n\n props: {\n data: {\n type: (null as unknown) as PropType,\n default: getDefaultData,\n },\n },\n\n setup(props) {\n const classes = computed(() => ({\n 'sb-layout': true,\n [`sb-layout_${props.data.orientation}`]: true,\n }));\n\n return () => (\n
\n {...props.data.children.map((child) => (\n \n ))}\n
\n );\n },\n});\n"],"names":["defineComponent","name","model","props","data","type","default","getDefaultData","setup","classes","computed","orientation","value","children","map","child","id"],"mappings":"oIAgBA,MAAeA,EAAgB,CAC7BC,KAAM,oBAENC,MAAAA,EAEAC,MAAO,CACLC,KAAM,CACJC,KAAO,KACPC,QAASC,IAIbC,MAAML,SACEM,EAAUC,GAAS,KAAO,cACjB,GACX,aAAYP,EAAMC,KAAKO,gBAAgB,YAGpC,mBACOF,EAAQG,WACdT,EAAMC,KAAKS,SAASC,iBAEfC,EAAMC,SACJD"} \ No newline at end of file diff --git a/docs/assets/display.cf8b58ad.js b/docs/assets/display.cf8b58ad.js deleted file mode 100644 index 06b5640..0000000 --- a/docs/assets/display.cf8b58ad.js +++ /dev/null @@ -1,2 +0,0 @@ -import{j as a,m as s,k as r,q as p,s as e,x as t}from"./index.a48301fd.js";/* empty css */import"./vendor.a029424f.js";var l=a({name:"sb-paragraph-display",model:s,props:{data:{type:Object,default:r}},setup(a){const s=p((()=>({"sb-paragraph":!0,[`sb-paragraph_align-${a.data.align}`]:!0})));return()=>e("p",t({class:s.value},{innerHTML:a.data.value}),null)}});export default l; -//# sourceMappingURL=display.cf8b58ad.js.map diff --git a/docs/assets/display.cf8b58ad.js.map b/docs/assets/display.cf8b58ad.js.map deleted file mode 100644 index 6f44306..0000000 --- a/docs/assets/display.cf8b58ad.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"display.cf8b58ad.js","sources":["../../packages/paragraph/lib/display.tsx"],"sourcesContent":["import {\n defineComponent,\n computed,\n PropType,\n} from 'vue';\nimport {\n model,\n} from '@schlechtenburg/core';\nimport {\n getDefaultData,\n ParagraphData,\n} from './util';\n\nimport './style.scss';\n\nexport default defineComponent({\n name: 'sb-paragraph-display',\n\n model,\n\n props: {\n data: {\n type: Object as PropType,\n default: getDefaultData,\n },\n },\n\n setup(props) {\n const classes = computed(() => ({\n 'sb-paragraph': true,\n [`sb-paragraph_align-${props.data.align}`]: true,\n }));\n\n return () =>

;\n },\n});\n"],"names":["defineComponent","name","model","props","data","type","Object","default","getDefaultData","setup","classes","computed","align","value","innerHTML"],"mappings":"oIAeA,MAAeA,EAAgB,CAC7BC,KAAM,uBAENC,MAAAA,EAEAC,MAAO,CACLC,KAAM,CACJC,KAAMC,OACNC,QAASC,IAIbC,MAAMN,SACEO,EAAUC,GAAS,KAAO,iBACd,GACd,sBAAqBR,EAAMC,KAAKQ,UAAU,YAGvC,mBACEF,EAAQG,QAEbC,UAAWX,EAAMC,KAAKS"} \ No newline at end of file diff --git a/docs/assets/edit.2536c400.js b/docs/assets/edit.2536c400.js new file mode 100644 index 0000000..6cad03c --- /dev/null +++ b/docs/assets/edit.2536c400.js @@ -0,0 +1,2 @@ +import{d as a,g as e,r,a as s,o as l,c as p,b as t}from"./index.863ba482.js";import"./vendor.41d82814.js";var n=a({name:"sb-paragraph-edit",model:{prop:"block",event:"update"},props:{blockId:{type:String,required:!0},data:{type:null,default:e}},setup(a){const e=r({value:a.data.value,align:a.data.align,focused:!1}),n=s(null);l((()=>{n.value&&(n.value.innerHTML=e.value)}));const d=p((()=>({"sb-paragraph":!0,"sb-paragraph_focused":e.focused,[`sb-paragraph_align-${e.align}`]:!0})));return()=>t("div",{class:d.value},[t("p",{class:"sb-paragraph__input",ref:n,contenteditable:!0},null)])}});export default n; +//# sourceMappingURL=edit.2536c400.js.map diff --git a/docs/assets/edit.2536c400.js.map b/docs/assets/edit.2536c400.js.map new file mode 100644 index 0000000..4e54cc5 --- /dev/null +++ b/docs/assets/edit.2536c400.js.map @@ -0,0 +1 @@ +{"version":3,"file":"edit.2536c400.js","sources":["../../packages/paragraph/lib/edit.tsx"],"sourcesContent":["import {\n defineComponent,\n reactive,\n computed,\n ref,\n Ref,\n onMounted,\n PropType,\n} from 'vue';\nimport {\n getDefaultData,\n ParagraphData,\n} from './util';\n\nimport './style.scss';\n\nexport default defineComponent({\n name: 'sb-paragraph-edit',\n\n model: {\n prop: 'block',\n event: 'update',\n },\n\n props: {\n blockId: { type: String, required: true },\n data: {\n type: (null as unknown) as PropType,\n default: getDefaultData,\n },\n },\n\n setup(props) {\n const localData = (reactive({\n value: props.data.value,\n align: props.data.align,\n focused: false,\n }) as unknown) as {\n value: string;\n align: string;\n focused: boolean;\n };\n\n const inputEl: Ref = ref(null);\n onMounted(() => {\n if (inputEl.value) {\n inputEl.value.innerHTML = localData.value;\n }\n });\n\n const classes = computed(() => ({\n 'sb-paragraph': true,\n 'sb-paragraph_focused': localData.focused,\n [`sb-paragraph_align-${localData.align}`]: true,\n }));\n\n return () => (\n
\n

\n
\n );\n },\n});\n"],"names":["defineComponent","name","model","prop","event","props","blockId","type","String","required","data","default","getDefaultData","setup","localData","reactive","value","align","focused","inputEl","ref","innerHTML","classes","computed"],"mappings":"gHAgBeA,EAAgB,CAC7BC,KAAM,oBAENC,MAAO,CACLC,KAAM,QACNC,MAAO,UAGTC,MAAO,CACLC,QAAS,CAAEC,KAAMC,OAAQC,UAAU,GACnCC,KAAM,CACJH,KAAO,KACPI,QAASC,IAIbC,MAAMR,SACES,EAAaC,EAAS,CAC1BC,MAAOX,EAAMK,KAAKM,MAClBC,MAAOZ,EAAMK,KAAKO,MAClBC,SAAS,IAOLC,EAAiCC,EAAI,SACjC,KACJD,EAAQH,UACFA,MAAMK,UAAYP,EAAUE,gBAIlCM,EAAUC,GAAS,KAAO,iBACd,yBACQT,EAAUI,SAChC,sBAAqBJ,EAAUG,UAAU,YAGtC,mBACOK,EAAQN,qBAEV,0BACDG"} \ No newline at end of file diff --git a/docs/assets/style.3e24e605.css b/docs/assets/edit.25b6af76.css similarity index 100% rename from docs/assets/style.3e24e605.css rename to docs/assets/edit.25b6af76.css diff --git a/docs/assets/edit.79e9c821.js b/docs/assets/edit.79e9c821.js deleted file mode 100644 index 7863b31..0000000 --- a/docs/assets/edit.79e9c821.js +++ /dev/null @@ -1,2 +0,0 @@ -var a=Object.assign;import{y as t,m as e,z as l,A as s,B as n,C as i,D as d,S as r,b as o,E as c,F as u,e as p}from"./index.a48301fd.js";/* empty css */import"./vendor.a029424f.js";var f=t({name:"sb-image-edit",model:e,props:{onUpdate:{type:Function,default:()=>{}},data:{type:null,default:l}},setup(t){const e=s({src:t.data.src,alt:t.data.alt,description:t.data.description}),l=n(null);i((()=>t.data),(()=>{e.src=t.data.src,e.alt=t.data.alt,e.description=t.data.description}));const f=()=>{l.value&&l.value.click()},v=()=>{if(l.value&&l.value.files&&l.value.files.length){const a=new FileReader;a.addEventListener("load",(()=>{var e;const l=null==(e=null==a?void 0:a.result)?void 0:e.toString();if(!l)throw new Error("Couldn't load image src");t.onUpdate({src:l,alt:t.data.alt,description:t.data.description})})),a.readAsDataURL(l.value.files[0])}};return()=>d("figure",{class:"sb-image"},[d(r,null,{default:()=>[e.src?d(o,{onClick:f},{default:()=>[c("Select Image")]}):null,d("input",{type:"file",ref:l,style:"display: none;",onInput:v},null)]}),e.src?d(u,null,[d("img",{src:e.src,alt:e.alt,class:"sb-image__content"},null),d(p,{block:e.description,onUpdate:e=>{return l=e,void t.onUpdate(a(a({},t.data),{description:l}));var l}},null)]):d(o,{onClick:f},{default:()=>[c("Select Image")]})])}});export default f; -//# sourceMappingURL=edit.79e9c821.js.map diff --git a/docs/assets/edit.79e9c821.js.map b/docs/assets/edit.79e9c821.js.map deleted file mode 100644 index 2e15a59..0000000 --- a/docs/assets/edit.79e9c821.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"edit.79e9c821.js","sources":["../../packages/image/lib/edit.tsx"],"sourcesContent":["import {\n defineComponent,\n reactive,\n ref,\n Ref,\n watch,\n PropType,\n} from 'vue';\nimport {\n model,\n SbToolbar,\n SbButton,\n SbBlock,\n BlockData,\n} from '@schlechtenburg/core';\nimport { ParagraphData } from '@schlechtenburg/paragraph';\nimport {\n getDefaultData,\n ImageData,\n} from './util';\n\nimport './style.scss';\n\nexport default defineComponent({\n name: 'sb-image-edit',\n\n model,\n\n props: {\n onUpdate: { type: Function, default: () => {} },\n data: {\n type: (null as unknown) as PropType,\n default: getDefaultData,\n },\n },\n\n setup(props) {\n const localData = reactive({\n src: props.data.src,\n alt: props.data.alt,\n description: props.data.description,\n });\n\n const fileInput: Ref = ref(null);\n\n watch(() => props.data, () => {\n localData.src = props.data.src;\n localData.alt = props.data.alt;\n localData.description = props.data.description;\n });\n\n const selectImage = () => {\n if (fileInput.value) {\n fileInput.value.click();\n }\n };\n\n const onImageSelect = () => {\n if (fileInput.value && fileInput.value.files && fileInput.value.files.length) {\n const reader = new FileReader();\n reader.addEventListener('load', () => {\n const src = reader?.result?.toString();\n if (!src) {\n throw new Error('Couldn\\'t load image src');\n }\n\n props.onUpdate({\n src,\n alt: props.data.alt,\n description: props.data.description,\n });\n });\n\n reader.readAsDataURL(fileInput.value.files[0]);\n }\n };\n\n const onDescriptionUpdate = (description: BlockData) => {\n props.onUpdate({\n ...props.data,\n description,\n });\n };\n\n return () => (\n
\n \n {localData.src\n ? Select Image\n : null}\n \n \n {localData.src\n ? <>\n \n ) => onDescriptionUpdate(updated)}\n />\n \n : Select Image\n }\n
\n );\n },\n});\n"],"names":["defineComponent","name","model","props","onUpdate","type","Function","default","data","getDefaultData","setup","localData","reactive","src","alt","description","fileInput","ref","selectImage","value","click","onImageSelect","files","length","reader","FileReader","addEventListener","result","toString","Error","readAsDataURL","onClick","onDescriptionUpdate","updated","__assign"],"mappings":"kMAuBA,MAAeA,EAAgB,CAC7BC,KAAM,gBAENC,MAAAA,EAEAC,MAAO,CACLC,SAAU,CAAEC,KAAMC,SAAUC,QAAS,QACrCC,KAAM,CACJH,KAAO,KACPE,QAASE,IAIbC,MAAMP,SACEQ,EAAYC,EAAS,CACzBC,IAAKV,EAAMK,KAAKK,IAChBC,IAAKX,EAAMK,KAAKM,IAChBC,YAAaZ,EAAMK,KAAKO,cAGpBC,EAAwCC,EAAI,SAE5C,IAAMd,EAAMK,OAAM,OACZK,IAAMV,EAAMK,KAAKK,MACjBC,IAAMX,EAAMK,KAAKM,MACjBC,YAAcZ,EAAMK,KAAKO,qBAG/BG,EAAc,KACdF,EAAUG,SACFA,MAAMC,SAIdC,EAAgB,QAChBL,EAAUG,OAASH,EAAUG,MAAMG,OAASN,EAAUG,MAAMG,MAAMC,OAAQ,OACtEC,EAAS,IAAIC,aACZC,iBAAiB,QAAQ,iBACxBb,EAAMW,0BAAQG,iBAAQC,eACvBf,QACG,IAAIgB,MAAM,6BAGZzB,SAAS,CACbS,IAAAA,EACAC,IAAKX,EAAMK,KAAKM,IAChBC,YAAaZ,EAAMK,KAAKO,mBAIrBe,cAAcd,EAAUG,MAAMG,MAAM,YAWxC,sBACS,oCAETX,EAAUE,SACSkB,QAASb,sCACzB,qBAEG,WACAF,QACC,yBACGK,YAGZV,EAAUE,2BAGEF,EAAUE,QACVF,EAAUG,UACT,sCAGCH,EAAUI,yBACgCiB,SAAoBC,SA5BzE7B,SAAS8B,OACV/B,EAAMK,MADI,CAEbO,YAAAA,KAHyBA,qBAgCLgB,QAASb"} \ No newline at end of file diff --git a/docs/assets/edit.85b1500c.js b/docs/assets/edit.85b1500c.js deleted file mode 100644 index 5aff244..0000000 --- a/docs/assets/edit.85b1500c.js +++ /dev/null @@ -1,2 +0,0 @@ -var e=Object.assign;import{d as n,m as i,g as t,u as l,r as a,w as d,c as r,a as o,S as c,b as h,e as s,f as p,h as u,i as v}from"./index.a48301fd.js";/* empty css */import"./vendor.a029424f.js";var f=n({name:"sb-layout-edit",model:i,props:{onUpdate:{type:Function,default:()=>{}},data:{type:null,default:t}},setup(n){const{activate:i}=l(),t=a({orientation:n.data.orientation,children:[...n.data.children]});d((()=>n.data),(()=>{t.orientation=n.data.orientation,t.children=[...n.data.children]}));const f=r((()=>({"sb-layout":!0,[`sb-layout_${t.orientation}`]:!0}))),m=()=>{n.onUpdate({orientation:"vertical"===t.orientation?"horizontal":"vertical"})},U=e=>{t.children=[...t.children,e],n.onUpdate({children:[...t.children]}),i(e.id)},b=(e,l)=>{t.children=[...t.children.slice(0,e+1),l,...t.children.slice(e+1)],n.onUpdate({children:[...t.children]}),i(l.id)},y=e=>{t.children=[...t.children.slice(0,e),...t.children.slice(e+1)],n.onUpdate({children:[...t.children]});const l=Math.max(e-1,0);i(t.children[l].id)},k=e=>{const n=Math.max(Math.min(t.children.length-1,e),0);i(t.children[n].id)};return()=>o("div",{class:f.value},[o(c,null,{default:()=>[o(h,{type:"button",onClick:m},{default:()=>[t.orientation]})]}),...t.children.map(((i,l)=>o(s,p({key:i.id},{"data-order":l,block:i,onUpdate:l=>((i,l)=>{const a=t.children.indexOf(i);-1!==a&&n.onUpdate({children:[...t.children.slice(0,a),e(e({},i),l),...t.children.slice(a+1)]})})(i,l),onRemoveSelf:()=>y(l),onPrependBlock:e=>b(l-1,e),onAppendBlock:e=>b(l,e),onActivatePrevious:()=>k(l-1),onActivateNext:()=>k(l+1)}),{"context-toolbar":()=>o(u,{onMoveBackward:()=>(e=>{if(0===e)return;const i=t.children[e],l=t.children[e-1];t.children=[...t.children.slice(0,e-1),i,l,...t.children.slice(e+1)],n.onUpdate({children:[...t.children]})})(l),onMoveForward:()=>(e=>{if(e===t.children.length-1)return;const i=t.children[e],l=t.children[e+1];t.children=[...t.children.slice(0,e),l,i,...t.children.slice(e+2)],n.onUpdate({children:[...t.children]})})(l),onRemove:()=>y(l),orientation:t.orientation},null)}))),o(v,{onInsertBlock:U},null)])}});export default f; -//# sourceMappingURL=edit.85b1500c.js.map diff --git a/docs/assets/edit.85b1500c.js.map b/docs/assets/edit.85b1500c.js.map deleted file mode 100644 index b94c181..0000000 --- a/docs/assets/edit.85b1500c.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"edit.85b1500c.js","sources":["../../packages/layout/lib/edit.tsx"],"sourcesContent":["import {\n defineComponent,\n reactive,\n computed,\n watch,\n PropType,\n} from 'vue';\nimport {\n model,\n BlockData,\n useActivation,\n\n SbBlock,\n SbButton,\n SbToolbar,\n SbBlockPlaceholder,\n SbBlockOrdering,\n} from '@schlechtenburg/core';\n\nimport {\n LayoutData,\n getDefaultData,\n} from './util';\n\nimport './style.scss';\n\nexport default defineComponent({\n name: 'sb-layout-edit',\n\n model,\n\n props: {\n onUpdate: { type: Function, default: () => {} },\n data: {\n type: (null as unknown) as PropType,\n default: getDefaultData,\n },\n },\n\n setup(props) {\n const { activate } = useActivation();\n\n const localData: LayoutData = reactive({\n orientation: props.data.orientation,\n children: [...props.data.children],\n });\n\n watch(() => props.data, () => {\n localData.orientation = props.data.orientation;\n localData.children = [...props.data.children];\n });\n\n const classes = computed(() => ({\n 'sb-layout': true,\n [`sb-layout_${localData.orientation}`]: true,\n }));\n\n const toggleOrientation = () => {\n props.onUpdate({\n orientation: localData.orientation === 'vertical' ? 'horizontal' : 'vertical',\n });\n };\n\n const onChildUpdate = (child: BlockData, updated: BlockData) => {\n const index = localData.children.indexOf(child);\n if (index === -1) {\n return;\n }\n props.onUpdate({\n children: [\n ...localData.children.slice(0, index),\n {\n ...child,\n ...updated,\n },\n ...localData.children.slice(index + 1),\n ],\n });\n };\n\n const appendBlock = (block: BlockData) => {\n localData.children = [\n ...localData.children,\n block,\n ];\n props.onUpdate({ children: [...localData.children] });\n activate(block.id);\n };\n\n const insertBlock = (index: number, block: BlockData) => {\n localData.children = [\n ...localData.children.slice(0, index + 1),\n block,\n ...localData.children.slice(index + 1),\n ];\n props.onUpdate({ children: [...localData.children] });\n activate(block.id);\n };\n\n const removeBlock = (index: number) => {\n localData.children = [\n ...localData.children.slice(0, index),\n ...localData.children.slice(index + 1),\n ];\n props.onUpdate({ children: [...localData.children] });\n\n const newActiveIndex = Math.max(index - 1, 0);\n activate(localData.children[newActiveIndex].id);\n };\n\n const activateBlock = (index: number) => {\n const safeIndex =\n Math.max(\n Math.min(\n localData.children.length - 1,\n index,\n ),\n 0,\n );\n activate(localData.children[safeIndex].id);\n };\n\n const moveBackward = (index: number) => {\n if (index === 0) {\n return;\n }\n\n const curr = localData.children[index];\n const prev = localData.children[index - 1];\n localData.children = [\n ...localData.children.slice(0, index - 1),\n curr,\n prev,\n ...localData.children.slice(index + 1),\n ];\n\n props.onUpdate({ children: [...localData.children] });\n };\n\n const moveForward = (index: number) => {\n if (index === localData.children.length - 1) {\n return;\n }\n\n const curr = localData.children[index];\n const next = localData.children[index + 1];\n localData.children = [\n ...localData.children.slice(0, index),\n next,\n curr,\n ...localData.children.slice(index + 2),\n ];\n\n props.onUpdate({ children: [...localData.children] });\n };\n\n return () => (\n
\n \n {localData.orientation}\n \n\n {...localData.children.map((child, index) => (\n ) => onChildUpdate(child, updated)}\n onRemoveSelf={() => removeBlock(index)}\n onPrependBlock={(block: BlockData) => insertBlock(index - 1, block)}\n onAppendBlock={(block: BlockData) => insertBlock(index, block)}\n onActivatePrevious={() => activateBlock(index - 1,)}\n onActivateNext={() => activateBlock(index + 1,)}\n >\n {{\n 'context-toolbar': () =>\n moveBackward(index)}\n onMoveForward={() => moveForward(index)}\n onRemove={() => removeBlock(index)}\n orientation={localData.orientation}\n />,\n }}\n \n ))}\n\n \n
\n );\n },\n});\n"],"names":["defineComponent","name","model","props","onUpdate","type","Function","default","data","getDefaultData","setup","activate","useActivation","localData","reactive","orientation","children","classes","computed","toggleOrientation","appendBlock","block","id","insertBlock","index","slice","removeBlock","newActiveIndex","Math","max","activateBlock","safeIndex","min","length","value","onClick","map","child","key","updated","indexOf","__assign","onChildUpdate","curr","prev","moveBackward","next","moveForward"],"mappings":"gNA0BA,MAAeA,EAAgB,CAC7BC,KAAM,iBAENC,MAAAA,EAEAC,MAAO,CACLC,SAAU,CAAEC,KAAMC,SAAUC,QAAS,QACrCC,KAAM,CACJH,KAAO,KACPE,QAASE,IAIbC,MAAMP,SACEQ,SAAEA,GAAaC,IAEfC,EAAwBC,EAAS,CACrCC,YAAaZ,EAAMK,KAAKO,YACxBC,SAAU,IAAIb,EAAMK,KAAKQ,eAGrB,IAAMb,EAAMK,OAAM,OACZO,YAAcZ,EAAMK,KAAKO,cACzBC,SAAW,IAAIb,EAAMK,KAAKQ,mBAGhCC,EAAUC,GAAS,KAAO,cACjB,GACX,aAAYL,EAAUE,gBAAgB,MAGpCI,EAAoB,OAClBf,SAAS,CACbW,YAAuC,aAA1BF,EAAUE,YAA6B,aAAe,cAqBjEK,QACMJ,SAAW,IAChBH,EAAUG,SACbK,KAEIjB,SAAS,CAAEY,SAAU,IAAIH,EAAUG,cAChCK,EAAMC,KAGXC,EAAc,CAACC,EAAeH,OACxBL,SAAW,IAChBH,EAAUG,SAASS,MAAM,EAAGD,EAAQ,GACvCH,KACGR,EAAUG,SAASS,MAAMD,EAAQ,MAEhCpB,SAAS,CAAEY,SAAU,IAAIH,EAAUG,cAChCK,EAAMC,KAGXI,QACMV,SAAW,IAChBH,EAAUG,SAASS,MAAM,EAAGD,MAC5BX,EAAUG,SAASS,MAAMD,EAAQ,MAEhCpB,SAAS,CAAEY,SAAU,IAAIH,EAAUG,kBAEnCW,EAAiBC,KAAKC,IAAIL,EAAQ,EAAG,KAClCX,EAAUG,SAASW,GAAgBL,KAGxCQ,YACEC,EACJH,KAAKC,IACFD,KAAKI,IACHnB,EAAUG,SAASiB,OAAS,EAC5BT,GAEH,KAEKX,EAAUG,SAASe,GAAWT,WAqClC,mBACOL,EAAQiB,oCAIZ7B,KAAM,SACN8B,QAAShB,iBAEXN,EAAUE,qBAGVF,EAAUG,SAASoB,KAAI,CAACC,EAAOb,WAEzBc,IAAKD,EAAMf,kBACLE,QACLa,cA5GO,EAACA,EAAuBE,WACtCf,EAAQX,EAAUG,SAASwB,QAAQH,QACrCb,KAGEpB,SAAS,CACbY,SAAU,IACLH,EAAUG,SAASS,MAAM,EAAGD,GAC/BiB,OACKJ,GACAE,MAEF1B,EAAUG,SAASS,MAAMD,EAAQ,OAiGKkB,CAAcL,EAAOE,gBAC9C,IAAMb,EAAYF,qBACWD,EAAYC,EAAQ,EAAGH,oBACxBE,EAAYC,EAAOH,sBACzC,IAAMS,EAAcN,EAAQ,kBAChC,IAAMM,EAAcN,EAAQ,wBAGvB,wBAEC,IA5DRA,QACN,IAAVA,eAIEmB,EAAO9B,EAAUG,SAASQ,GAC1BoB,EAAO/B,EAAUG,SAASQ,EAAQ,KAC9BR,SAAW,IAChBH,EAAUG,SAASS,MAAM,EAAGD,EAAQ,GACvCmB,EACAC,KACG/B,EAAUG,SAASS,MAAMD,EAAQ,MAGhCpB,SAAS,CAAEY,SAAU,IAAIH,EAAUG,aA8CP6B,CAAarB,iBACpB,IA5CRA,QACfA,IAAUX,EAAUG,SAASiB,OAAS,eAIpCU,EAAO9B,EAAUG,SAASQ,GAC1BsB,EAAOjC,EAAUG,SAASQ,EAAQ,KAC9BR,SAAW,IAChBH,EAAUG,SAASS,MAAM,EAAGD,GAC/BsB,EACAH,KACG9B,EAAUG,SAASS,MAAMD,EAAQ,MAGhCpB,SAAS,CAAEY,SAAU,IAAIH,EAAUG,aA8BR+B,CAAYvB,YACvB,IAAME,EAAYF,eACfX,EAAUE,0CAMEK"} \ No newline at end of file diff --git a/docs/assets/edit.b0a76e09.js b/docs/assets/edit.b0a76e09.js deleted file mode 100644 index 30965b1..0000000 --- a/docs/assets/edit.b0a76e09.js +++ /dev/null @@ -1,2 +0,0 @@ -import{j as a,m as e,k as n,l as t,n as l,u as o,o as u,p as i,q as s,s as r,S as d,t as p,v}from"./index.a48301fd.js";/* empty css */import"./vendor.a029424f.js";var c=a({name:"sb-paragraph-edit",model:e,props:{blockId:{type:String,required:!0},data:{type:null,default:n},onUpdate:{type:Function,default:()=>{}},onAppendBlock:{type:Function,default:()=>{}},onRemoveSelf:{type:Function,default:()=>{}},onActivateNext:{type:Function,default:()=>{}},onActivatePrevious:{type:Function,default:()=>{}}},setup(a){const e=t({value:a.data.value,align:a.data.align,focused:!1}),c=l(null),{isActive:f,activate:g}=o(a.blockId),y=()=>{c.value&&f.value&&c.value.focus()};u((()=>{y(),c.value&&(c.value.innerHTML=e.value)})),i(f,y),i((()=>a.data),(()=>{e.value=a.data.value,e.align=a.data.align,c.value&&(c.value.innerHTML=e.value)}));const h=a=>{e.value=a.target.innerHTML},b=s((()=>({"sb-paragraph":!0,"sb-paragraph_focused":e.focused,[`sb-paragraph_align-${e.align}`]:!0}))),m=n=>{a.onUpdate({value:e.value,align:n.target.value})},k=()=>{e.focused=!0,g()},A=()=>{e.focused=!1,a.onUpdate({value:e.value,align:e.align})},w=e=>{if("Enter"===e.key&&!e.shiftKey){const t=""+ +new Date;a.onAppendBlock({id:t,name:"sb-paragraph",data:n()}),g(t),e.preventDefault()}},F=n=>{var t;"Backspace"===n.key&&""===e.value&&a.onRemoveSelf();const l=window.getSelection(),o=null==l?void 0:l.focusNode,u=Array.from((null==(t=null==c?void 0:c.value)?void 0:t.childNodes)||[]),i=o?u.indexOf(o):-1;if(o===c.value||0===i||i===u.length-1)switch(n.key){case"ArrowDown":a.onActivateNext();break;case"ArrowUp":a.onActivatePrevious()}};return()=>r("div",{class:b.value},[r(d,null,{default:()=>[r(p,{value:e.align,onChange:m},{default:()=>[r("option",null,[v("left")]),r("option",null,[v("center")]),r("option",null,[v("right")])]})]}),r("p",{class:"sb-paragraph__input",ref:c,contenteditable:!0,onInput:h,onFocus:k,onBlur:A,onKeydown:w,onKeyup:F},null)])}});export default c; -//# sourceMappingURL=edit.b0a76e09.js.map diff --git a/docs/assets/edit.b0a76e09.js.map b/docs/assets/edit.b0a76e09.js.map deleted file mode 100644 index 559220b..0000000 --- a/docs/assets/edit.b0a76e09.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"edit.b0a76e09.js","sources":["../../packages/paragraph/lib/edit.tsx"],"sourcesContent":["import {\n defineComponent,\n reactive,\n computed,\n ref,\n Ref,\n onMounted,\n watch,\n PropType,\n} from 'vue';\nimport {\n model,\n useActivation,\n SbToolbar,\n SbSelect,\n} from '@schlechtenburg/core';\nimport {\n getDefaultData,\n ParagraphData,\n} from './util';\n\nimport './style.scss';\n\nexport default defineComponent({\n name: 'sb-paragraph-edit',\n\n model,\n\n props: {\n blockId: { type: String, required: true },\n data: {\n type: (null as unknown) as PropType,\n default: getDefaultData,\n },\n onUpdate: { type: Function, default: () => {} },\n onAppendBlock: { type: Function, default: () => {} },\n onRemoveSelf: { type: Function, default: () => {} },\n onActivateNext: { type: Function, default: () => {} },\n onActivatePrevious: { type: Function, default: () => {} },\n },\n\n setup(props) {\n const localData = (reactive({\n value: props.data.value,\n align: props.data.align,\n focused: false,\n }) as unknown) as {\n value: string;\n align: string;\n focused: boolean;\n };\n\n const inputEl: Ref = ref(null);\n\n const { isActive, activate } = useActivation(props.blockId);\n\n const focusInput = () => {\n if (inputEl.value && isActive.value) {\n inputEl.value.focus();\n }\n };\n\n onMounted(() => {\n focusInput();\n if (inputEl.value) {\n inputEl.value.innerHTML = localData.value;\n }\n });\n\n watch(isActive, focusInput);\n\n watch(() => props.data, () => {\n localData.value = props.data.value;\n localData.align = props.data.align;\n if (inputEl.value) {\n inputEl.value.innerHTML = localData.value;\n }\n });\n\n const onTextUpdate = ($event: Event) => {\n localData.value = ($event.target as HTMLElement).innerHTML;\n };\n\n const classes = computed(() => ({\n 'sb-paragraph': true,\n 'sb-paragraph_focused': localData.focused,\n [`sb-paragraph_align-${localData.align}`]: true,\n }));\n\n const setAlignment = ($event: Event) => {\n props.onUpdate({\n value: localData.value,\n align: ($event.target as HTMLSelectElement).value,\n });\n };\n\n const onFocus = () => {\n localData.focused = true;\n activate();\n };\n\n const onBlur = () => {\n localData.focused = false;\n props.onUpdate({\n value: localData.value,\n align: localData.align,\n });\n };\n\n const onKeydown = ($event: KeyboardEvent) => {\n if ($event.key === 'Enter' && !$event.shiftKey) {\n const id = `${+(new Date())}`;\n props.onAppendBlock({\n id,\n name: 'sb-paragraph',\n data: getDefaultData(),\n });\n\n activate(id);\n\n $event.preventDefault();\n }\n };\n\n const onKeyup = ($event: KeyboardEvent) => {\n if ($event.key === 'Backspace' && localData.value === '') {\n props.onRemoveSelf();\n }\n\n const selection = window.getSelection();\n const node = selection?.focusNode;\n const childNodes = Array.from(inputEl?.value?.childNodes || []);\n const index = node ? childNodes.indexOf(node as ChildNode) : -1;\n if (node === inputEl.value || index === 0 || index === childNodes.length -1) {\n switch ($event.key) {\n case 'ArrowDown':\n props.onActivateNext();\n break;\n case 'ArrowUp':\n props.onActivatePrevious();\n break;\n }\n }\n };\n\n return () => (\n
\n \n \n \n \n \n \n \n

\n
\n );\n },\n});\n"],"names":["defineComponent","name","model","props","blockId","type","String","required","data","default","getDefaultData","onUpdate","Function","onAppendBlock","onRemoveSelf","onActivateNext","onActivatePrevious","setup","localData","reactive","value","align","focused","inputEl","ref","isActive","activate","useActivation","focusInput","focus","innerHTML","onTextUpdate","$event","target","classes","computed","setAlignment","onFocus","onBlur","onKeydown","key","shiftKey","id","Date","preventDefault","onKeyup","selection","window","getSelection","node","focusNode","childNodes","Array","from","index","indexOf","length","onChange"],"mappings":"gLAuBA,MAAeA,EAAgB,CAC7BC,KAAM,oBAENC,MAAAA,EAEAC,MAAO,CACLC,QAAS,CAAEC,KAAMC,OAAQC,UAAU,GACnCC,KAAM,CACJH,KAAO,KACPI,QAASC,GAEXC,SAAU,CAAEN,KAAMO,SAAUH,QAAS,QACrCI,cAAe,CAAER,KAAMO,SAAUH,QAAS,QAC1CK,aAAc,CAAET,KAAMO,SAAUH,QAAS,QACzCM,eAAgB,CAAEV,KAAMO,SAAUH,QAAS,QAC3CO,mBAAoB,CAAEX,KAAMO,SAAUH,QAAS,SAGjDQ,MAAMd,SACEe,EAAaC,EAAS,CAC1BC,MAAOjB,EAAMK,KAAKY,MAClBC,MAAOlB,EAAMK,KAAKa,MAClBC,SAAS,IAOLC,EAAiCC,EAAI,OAErCC,SAAEA,WAAUC,GAAaC,EAAcxB,EAAMC,SAE7CwB,EAAa,KACbL,EAAQH,OAASK,EAASL,SACpBA,MAAMS,YAIR,SAEJN,EAAQH,UACFA,MAAMU,UAAYZ,EAAUE,YAIlCK,EAAUG,MAEV,IAAMzB,EAAMK,OAAM,OACZY,MAAQjB,EAAMK,KAAKY,QACnBC,MAAQlB,EAAMK,KAAKa,MACzBE,EAAQH,UACFA,MAAMU,UAAYZ,EAAUE,gBAIlCW,QACMX,MAASY,EAAOC,OAAuBH,WAG7CI,EAAUC,GAAS,KAAO,iBACd,yBACQjB,EAAUI,SAChC,sBAAqBJ,EAAUG,UAAU,MAGvCe,QACEzB,SAAS,CACbS,MAAOF,EAAUE,MACjBC,MAAQW,EAAOC,OAA6Bb,SAI1CiB,EAAU,OACJf,SAAU,OAIhBgB,EAAS,OACHhB,SAAU,IACdX,SAAS,CACbS,MAAOF,EAAUE,MACjBC,MAAOH,EAAUG,SAIfkB,SACe,UAAfP,EAAOQ,MAAoBR,EAAOS,SAAU,OACxCC,EAAM,KAAI,IAAIC,OACd9B,cAAc,CAClB6B,GAAAA,EACAzC,KAAM,eACNO,KAAME,QAGCgC,KAEFE,mBAILC,YACe,cAAfb,EAAOQ,KAA2C,KAApBtB,EAAUE,SACpCN,qBAGFgC,EAAYC,OAAOC,eACnBC,QAAOH,WAAWI,UAClBC,EAAaC,MAAMC,MAAK9B,0BAASH,gBAAO+B,aAAc,IACtDG,EAAQL,EAAOE,EAAWI,QAAQN,SACpCA,IAAS1B,EAAQH,OAAmB,IAAVkC,GAAeA,IAAUH,EAAWK,OAAQ,SAChExB,EAAOQ,SACR,cACGzB,2BAEH,YACGC,6BAMP,mBACOkB,EAAQd,oCAIZA,MAAOF,EAAUG,MACjBoC,SAAUrB,8HASR,0BACDb,6BAEIQ"} \ No newline at end of file diff --git a/docs/assets/edit.bd5075df.js b/docs/assets/edit.bd5075df.js deleted file mode 100644 index a5ba74e..0000000 --- a/docs/assets/edit.bd5075df.js +++ /dev/null @@ -1,2 +0,0 @@ -export default{}; -//# sourceMappingURL=edit.bd5075df.js.map diff --git a/docs/assets/edit.bd5075df.js.map b/docs/assets/edit.bd5075df.js.map deleted file mode 100644 index 13bf77d..0000000 --- a/docs/assets/edit.bd5075df.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"edit.bd5075df.js","sources":["../../packages/heading/lib/edit.tsx"],"sourcesContent":["export default {};\n"],"names":[],"mappings":"cAAe"} \ No newline at end of file diff --git a/docs/assets/index.62d1366f.css b/docs/assets/index.62d1366f.css deleted file mode 100644 index d43d7b3..0000000 --- a/docs/assets/index.62d1366f.css +++ /dev/null @@ -1 +0,0 @@ -@charset "UTF-8";.sb-button{border:0;padding:8px 12px;background-color:var(--grey-0);border:1px solid var(--grey-2)}.sb-button:hover{border:1px solid var(--interact)}.sb-context{position:relative}.sb-context-menu{display:none;flex-direction:column;background:var(--grey-0);border:1px solid var(--grey-3);top:100%;left:0;margin:0;z-index:var(--z-context-menu);max-height:70vh;max-width:100vw;overflow:auto}.sb-context-menu[open]{display:flex}.sb-tree-block-select__list{list-style:none;margin:0;padding:0}.sb-tree-block-select__list_base{padding-right:1rem}.sb-tree-block-select__block{padding:0;margin:0;padding-left:1rem}.sb-tree-block-select__block-name{display:block;background:0 0;border:0;font:inherit;color:inherit;padding:.5rem 1rem;width:100%;text-align:left}.sb-tree-block-select__block_active>.sb-tree-block-select__block-name{outline:1px solid var(--interact)}.sb-block{display:flex;align-items:stretch;justify-items:stretch;height:auto}.sb-block>*>.sb-toolbar{opacity:0;pointer-events:none}.sb-block>.sb-block-ordering{opacity:0;pointer-events:none}.sb-block_active{outline:4px solid var(--interact)}.sb-block_active>*>.sb-toolbar{opacity:1;pointer-events:all;outline:1px solid var(--grey-2)}.sb-block_active>.sb-block-ordering{opacity:1;pointer-events:all}.sb-block_highlighted{outline:2px solid var(--interact)}.sb-main{position:relative;background-color:var(--bg);padding:50px 40px}.sb-modal__overlay{background-color:var(--grey-3-t);position:fixed;z-index:10;top:0;left:0;bottom:0;right:0;padding:10vh 10vw;display:flex;justify-content:center;align-items:center;opacity:0;pointer-events:none}.sb-modal__content{width:900px;max-width:100%;height:auto;max-height:100%;background-color:var(--grey-0);padding:24px 32px}.sb-modal_open .sb-modal__overlay{opacity:1;pointer-events:all}.sb-block-picker{display:flex;justify-content:center;align-items:center;height:100%;width:100%}.sb-block-picker__add-button{padding:24px 32px}.sb-block-ordering{display:flex;position:absolute;flex-direction:column}.sb-block-placeholder{width:100%;position:relative;overflow:visible}.sb-block-placeholder__add{background-color:var(--grey-1);width:100%}.sb-toolbar{position:absolute;width:auto;height:auto}.sb-select{background-color:var(--grey-0);border:1px solid var(--grey-2);position:relative}.sb-select:hover{border:1px solid var(--interact)}.sb-select::after{position:absolute;content:"⯆";top:6px;height:100%;right:12px;pointer-events:none}.sb-select__input{background:0 0;appearance:none;border:0;padding:8px 32px 8px 12px}#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:#2c3e50}*,::after,::before{box-sizing:border-box}html{--grey-0:white;--grey-1-t:rgba(0, 0, 0, 0.05);--grey-1:rgb(242, 242, 242);--grey-2-t:rgba(0, 0, 0, 0.1);--grey-2:rgb(230, 230, 230);--grey-3-t:rgba(0, 0, 0, 0.2);--grey-3:rgb(205, 205, 205);--grey-4-t:rgba(0, 0, 0, 0.4);--grey-4:rgb(155, 155, 155);--grey-5-t:rgba(0, 0, 0, 0.7);--grey-5:rgb(75, 75, 75);--black:rgba(0, 0, 0, 0.9);--bg:var(--grey-1);--fg:var(--black);--interact:#3f9cff;--z-context-menu:3000}body{margin:0;min-height:100vh} \ No newline at end of file diff --git a/docs/assets/index.863ba482.js b/docs/assets/index.863ba482.js new file mode 100644 index 0000000..d1076f7 --- /dev/null +++ b/docs/assets/index.863ba482.js @@ -0,0 +1,2 @@ +var t=Object.assign;import{i as e,r as n,d as r,a as s,c as o,b as l,m as c,s as i,e as a,f as u,o as f,g as p,h as d}from"./vendor.41d82814.js";!function(t=".",e="__import__"){try{self[e]=new Function("u","return import(u)")}catch(n){const r=new URL(t,location),s=t=>{URL.revokeObjectURL(t.src),t.remove()};self[e]=t=>new Promise(((n,o)=>{const l=new URL(t,r);if(self[e].moduleMap[l])return n(self[e].moduleMap[l]);const c=new Blob([`import * as m from '${l}';`,`${e}.moduleMap['${l}']=m;`],{type:"text/javascript"}),i=Object.assign(document.createElement("script"),{type:"module",src:URL.createObjectURL(c),onerror(){o(new Error(`Failed to import: ${t}`)),s(i)},onload(){n(self[e].moduleMap[l]),s(i)}});document.head.appendChild(i)})),self[e].moduleMap={}}}("assets/");const h=Symbol("Schlechtenburg block library");const _=r({name:"sb-block",props:{block:{type:null,required:!0}},setup(t,r){const i=s(null),{getBlock:a}=function(){const t=e(h,n({}));return{customBlocks:t,getBlock:e=>t[e]}}(),u=o((()=>({"sb-block":!0})));return()=>{var e;const n=null==(e=a(t.block.name))?void 0:e.component;return l("div",{ref:i,class:u.value},[l(n,c({data:t.block.data,blockId:t.block.id},r.attrs),null)])}}});const g=r({name:"sb-main",model:{prop:"block",event:"update"},props:{customBlocks:{type:Array,default:()=>[]},block:{type:Object,required:!0},onUpdate:{type:Function,default:()=>{}}},setup:e=>(i(t({},e.customBlocks.reduce(((e,n)=>t(t({},e),{[n.name]:n})),{}))),()=>l("div",{class:"sb-main"},[l(_,{block:e.block,onUpdate:e.onUpdate},null)]))});let v;const m={};function y(t,e){const n=Object.create(null),r=t.split(",");for(let s=0;s!!n[t.toLowerCase()]:t=>!!n[t]}const b=y("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt");function w(t){if(P(t)){const e={};for(let n=0;n{if(t){const n=t.split(S);n.length>1&&(e[n[0].trim()]=n[1].trim())}})),e}function x(t){let e="";if(A(t))e=t;else if(P(t))for(let n=0;n{},O=/^on[^a-z]/,j=t=>O.test(t),$=Object.assign,F=Object.prototype.hasOwnProperty,M=(t,e)=>F.call(t,e),P=Array.isArray,I=t=>"[object Map]"===T(t),U=t=>"function"==typeof t,A=t=>"string"==typeof t,N=t=>"symbol"==typeof t,L=t=>null!==t&&"object"==typeof t,B=Object.prototype.toString,T=t=>B.call(t),z=t=>A(t)&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,V=(t,e)=>t!==e&&(t==t||e==e),W=new WeakMap,D=[];let q;const K=Symbol(""),H=Symbol("");function J(t,e=E){(function(t){return t&&!0===t._isEffect})(t)&&(t=t.raw);const n=function(t,e){const n=function(){if(!n.active)return e.scheduler?void 0:t();if(!D.includes(n)){Q(n);try{return Y.push(X),X=!0,D.push(n),q=n,t()}finally{D.pop(),tt(),q=D[D.length-1]}}};return n.id=G++,n.allowRecurse=!!e.allowRecurse,n._isEffect=!0,n.active=!0,n.raw=t,n.deps=[],n.options=e,n}(t,e);return e.lazy||n(),n}let G=0;function Q(t){const{deps:e}=t;if(e.length){for(let n=0;n{t&&t.forEach((t=>{(t!==q||t.allowRecurse)&&c.add(t)}))};if("clear"===e)l.forEach(i);else if("length"===n&&P(t))l.forEach(((t,e)=>{("length"===e||e>=r)&&i(t)}));else switch(void 0!==n&&i(l.get(n)),e){case"add":P(t)?z(n)&&i(l.get("length")):(i(l.get(K)),I(t)&&i(l.get(H)));break;case"delete":P(t)||(i(l.get(K)),I(t)&&i(l.get(H)));break;case"set":I(t)&&i(l.get(K))}c.forEach((t=>{t.options.scheduler?t.options.scheduler(t):t()}))}const rt=y("__proto__,__v_isRef,__isVue"),st=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(N)),ot=ut(),lt=ut(!1,!0),ct=ut(!0),it=ut(!0,!0),at={};function ut(t=!1,e=!1){return function(n,r,s){if("__v_isReactive"===r)return!t;if("__v_isReadonly"===r)return t;if("__v_raw"===r&&s===(t?Ut:It).get(n))return n;const o=P(n);if(!t&&o&&M(at,r))return Reflect.get(at,r,s);const l=Reflect.get(n,r,s);if(N(r)?st.has(r):rt(r))return l;if(t||et(n,0,r),e)return l;if(qt(l)){return!o||!z(r)?l.value:l}return L(l)?t?Lt(l):Nt(l):l}}["includes","indexOf","lastIndexOf"].forEach((t=>{const e=Array.prototype[t];at[t]=function(...t){const n=Wt(this);for(let e=0,s=this.length;e{const e=Array.prototype[t];at[t]=function(...t){Z();const n=e.apply(this,t);return tt(),n}}));function ft(t=!1){return function(e,n,r,s){const o=e[n];if(!t&&(r=Wt(r),!P(e)&&qt(o)&&!qt(r)))return o.value=r,!0;const l=P(e)&&z(n)?Number(n)!0,deleteProperty:(t,e)=>!0};$({},pt,{get:lt,set:ft(!0)}),$({},dt,{get:it});const ht=t=>L(t)?Nt(t):t,_t=t=>L(t)?Lt(t):t,gt=t=>t,vt=t=>Reflect.getPrototypeOf(t);function mt(t,e,n=!1,r=!1){const s=Wt(t=t.__v_raw),o=Wt(e);e!==o&&!n&&et(s,0,e),!n&&et(s,0,o);const{has:l}=vt(s),c=n?_t:r?gt:ht;return l.call(s,e)?c(t.get(e)):l.call(s,o)?c(t.get(o)):void 0}function yt(t,e=!1){const n=this.__v_raw,r=Wt(n),s=Wt(t);return t!==s&&!e&&et(r,0,t),!e&&et(r,0,s),t===s?n.has(t):n.has(t)||n.has(s)}function bt(t,e=!1){return t=t.__v_raw,!e&&et(Wt(t),0,K),Reflect.get(t,"size",t)}function wt(t){t=Wt(t);const e=Wt(this);return vt(e).has.call(e,t)||(e.add(t),nt(e,"add",t,t)),this}function kt(t,e){e=Wt(e);const n=Wt(this),{has:r,get:s}=vt(n);let o=r.call(n,t);o||(t=Wt(t),o=r.call(n,t));const l=s.call(n,t);return n.set(t,e),o?V(e,l)&&nt(n,"set",t,e):nt(n,"add",t,e),this}function St(t){const e=Wt(this),{has:n,get:r}=vt(e);let s=n.call(e,t);s||(t=Wt(t),s=n.call(e,t)),r&&r.call(e,t);const o=e.delete(t);return s&&nt(e,"delete",t,void 0),o}function Rt(){const t=Wt(this),e=0!==t.size,n=t.clear();return e&&nt(t,"clear",void 0,void 0),n}function xt(t,e){return function(n,r){const s=this,o=s.__v_raw,l=Wt(o),c=t?_t:e?gt:ht;return!t&&et(l,0,K),o.forEach(((t,e)=>n.call(r,c(t),c(e),s)))}}function Et(t,e,n){return function(...r){const s=this.__v_raw,o=Wt(s),l=I(o),c="entries"===t||t===Symbol.iterator&&l,i="keys"===t&&l,a=s[t](...r),u=e?_t:n?gt:ht;return!e&&et(o,0,i?H:K),{next(){const{value:t,done:e}=a.next();return e?{value:t,done:e}:{value:c?[u(t[0]),u(t[1])]:u(t),done:e}},[Symbol.iterator](){return this}}}}function Ct(t){return function(...e){return"delete"!==t&&this}}const Ot={get(t){return mt(this,t)},get size(){return bt(this)},has:yt,add:wt,set:kt,delete:St,clear:Rt,forEach:xt(!1,!1)},jt={get(t){return mt(this,t,!1,!0)},get size(){return bt(this)},has:yt,add:wt,set:kt,delete:St,clear:Rt,forEach:xt(!1,!0)},$t={get(t){return mt(this,t,!0)},get size(){return bt(this,!0)},has(t){return yt.call(this,t,!0)},add:Ct("add"),set:Ct("set"),delete:Ct("delete"),clear:Ct("clear"),forEach:xt(!0,!1)};function Ft(t,e){const n=e?jt:t?$t:Ot;return(e,r,s)=>"__v_isReactive"===r?!t:"__v_isReadonly"===r?t:"__v_raw"===r?e:Reflect.get(M(n,r)&&r in e?n:e,r,s)}["keys","values","entries",Symbol.iterator].forEach((t=>{Ot[t]=Et(t,!1,!1),$t[t]=Et(t,!0,!1),jt[t]=Et(t,!1,!0)}));const Mt={get:Ft(!1,!1)},Pt={get:Ft(!0,!1)},It=new WeakMap,Ut=new WeakMap;function At(t){return t.__v_skip||!Object.isExtensible(t)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((t=>T(t).slice(8,-1))(t))}function Nt(t){return t&&t.__v_isReadonly?t:Bt(t,!1,pt,Mt)}function Lt(t){return Bt(t,!0,dt,Pt)}function Bt(t,e,n,r){if(!L(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const s=e?Ut:It,o=s.get(t);if(o)return o;const l=At(t);if(0===l)return t;const c=new Proxy(t,2===l?r:n);return s.set(t,c),c}function Tt(t){return zt(t)?Tt(t.__v_raw):!(!t||!t.__v_isReactive)}function zt(t){return!(!t||!t.__v_isReadonly)}function Vt(t){return Tt(t)||zt(t)}function Wt(t){return t&&Wt(t.__v_raw)||t}const Dt=t=>L(t)?Nt(t):t;function qt(t){return Boolean(t&&!0===t.__v_isRef)}function Kt(t){return function(t,e=!1){if(qt(t))return t;return new Ht(t,e)}(t)}class Ht{constructor(t,e=!1){this._rawValue=t,this._shallow=e,this.__v_isRef=!0,this._value=e?t:Dt(t)}get value(){return et(Wt(this),0,"value"),this._value}set value(t){V(Wt(t),this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:Dt(t),nt(Wt(this),"set","value",t))}}class Jt{constructor(t,e,n){this._setter=e,this._dirty=!0,this.__v_isRef=!0,this.effect=J(t,{lazy:!0,scheduler:()=>{this._dirty||(this._dirty=!0,nt(Wt(this),"set","value"))}}),this.__v_isReadonly=n}get value(){return this._dirty&&(this._value=this.effect(),this._dirty=!1),et(Wt(this),0,"value"),this._value}set value(t){this._setter(t)}}function Gt(t,e,n,r){let s;try{s=r?t(...r):t()}catch(o){Xt(o,e,n)}return s}function Qt(t,e,n,r){if(U(t)){const o=Gt(t,e,n,r);return o&&(L(s=o)&&U(s.then)&&U(s.catch))&&o.catch((t=>{Xt(t,e,n)})),o}var s;const o=[];for(let l=0;l>>1;ge(te[t])-1?te.splice(e,0,t):te.push(t),de()}}function de(){Yt||Zt||(Zt=!0,ae=ie.then(ve))}function he(t,e,n,r){P(t)?n.push(...t):e&&e.includes(t,t.allowRecurse?r+1:r)||n.push(t),de()}function _e(t,e=null){if(ne.length){for(ue=e,re=[...new Set(ne)],ne.length=0,se=0;senull==t.id?1/0:t.id;function ve(t){Zt=!1,Yt=!0,_e(t),te.sort(((t,e)=>ge(t)-ge(e)));try{for(ee=0;eege(t)-ge(e))),ce=0;ceye+=t;const we=(ke="m",(t,e=Ke)=>function(t,e,n=Ke,r=!1){if(n){const s=n[t]||(n[t]=[]),o=e.__weh||(e.__weh=(...r)=>{if(n.isUnmounted)return;Z(),He(n);const s=Qt(e,n,t,r);return He(null),tt(),s});return r?s.unshift(o):s.push(o),o}}(ke,t,e));var ke;const Se={};function Re(t,e,{immediate:n,deep:r,flush:s,onTrack:o,onTrigger:l}=E,c=Ke){let i,a,u=!1;if(qt(t)?(i=()=>t.value,u=!!t._shallow):Tt(t)?(i=()=>t,r=!0):i=P(t)?()=>t.map((t=>qt(t)?t.value:Tt(t)?Ee(t):U(t)?Gt(t,c,2,[c&&c.proxy]):void 0)):U(t)?e?()=>Gt(t,c,2,[c&&c.proxy]):()=>{if(!c||!c.isUnmounted)return a&&a(),Gt(t,c,3,[f])}:C,e&&r){const t=i;i=()=>Ee(t())}const f=t=>{a=_.options.onStop=()=>{Gt(t,c,4)}};let p=P(t)?[]:Se;const d=()=>{if(_.active)if(e){const t=_();(r||u||V(t,p))&&(a&&a(),Qt(e,c,3,[t,p===Se?void 0:p,f]),p=t)}else _()};let h;d.allowRecurse=!!e,h="sync"===s?d:"post"===s?()=>je(d,c&&c.suspense):()=>{!c||c.isMounted?function(t){he(t,re,ne,se)}(d):d()};const _=J(i,{lazy:!0,onTrack:o,onTrigger:l,scheduler:h});return Je(_,c),e?n?d():p=_():"post"===s?je(_,c&&c.suspense):_(),()=>{var t;(t=_).active&&(Q(t),t.options.onStop&&t.options.onStop(),t.active=!1),c&&((t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)})(c.effects,_)}}function xe(t,e,n){const r=this.proxy;return Re(A(t)?()=>r[t]:t.bind(r),e.bind(r),n,this)}function Ee(t,e=new Set){if(!L(t)||e.has(t))return t;if(e.add(t),qt(t))Ee(t.value,e);else if(P(t))for(let n=0;n{Ee(t,e)}));else for(const n in t)Ee(t[n],e);return t}function Ce(t){return U(t)?{setup:t,name:t.name}:t}function Oe(t,{vnode:{ref:e,props:n,children:r}}){const s=Ne(t,n,r);return s.ref=e,s}const je=function(t,e){e&&e.pendingBranch?P(t)?e.effects.push(...t):e.effects.push(t):he(t,le,oe,ce)},$e=Symbol(),Fe=Symbol(void 0),Me=Symbol(void 0),Pe=Symbol(void 0);function Ie(t){return!!t&&!0===t.__v_isVNode}const Ue=({key:t})=>null!=t?t:null,Ae=({ref:t})=>null!=t?A(t)||qt(t)||U(t)?{i:null,r:t}:t:null,Ne=function(t,e=null,n=null,r=0,s=null,o=!1){t&&t!==$e||(t=Pe);if(Ie(t)){const r=Le(t,e,!0);return n&&ze(r,n),r}l=t,U(l)&&"__vccOpts"in l&&(t=t.__vccOpts);var l;if(e){(Vt(e)||"__vInternal"in e)&&(e=$({},e));let{class:t,style:n}=e;t&&!A(t)&&(e.class=x(t)),L(n)&&(Vt(n)&&!P(n)&&(n=$({},n)),e.style=w(n))}const c=A(t)?1:(t=>t.__isSuspense)(t)?128:(t=>t.__isTeleport)(t)?64:L(t)?4:U(t)?2:0,i={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Ue(e),ref:e&&Ae(e),scopeId:null,children:null,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:c,patchFlag:r,dynamicProps:s,dynamicChildren:null,appContext:null};if(ze(i,n),128&c){const{content:t,fallback:e}=function(t){const{shapeFlag:e,children:n}=t;let r,s;return 32&e?(r=me(n.default),s=me(n.fallback)):(r=me(n),s=Te(null)),{content:r,fallback:s}}(i);i.ssContent=t,i.ssFallback=e}0;return i};function Le(t,e,n=!1){const{props:r,ref:s,patchFlag:o,children:l}=t,c=e?function(...t){const e=$({},t[0]);for(let n=1;nVe(t,e,n)));for(const l in e)r&&M(r,l)?t[l]=r[l](t[l],e[l],n.proxy,l):t[l]=e[l]}const We=t=>t?4&t.vnode.shapeFlag?t.exposed?t.exposed:t.proxy:We(t.parent):null,De=$(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>We(t.parent),$root:t=>We(t.root),$emit:t=>t.emit,$options:t=>function(t){const e=t.type,{__merged:n,mixins:r,extends:s}=e;if(n)return n;const o=t.appContext.mixins;if(!o.length&&!r&&!s)return e;const l={};return o.forEach((e=>Ve(l,e,t))),Ve(l,e,t),e.__merged=l}(t),$forceUpdate:t=>()=>pe(t.update),$nextTick:t=>fe.bind(t.proxy),$watch:t=>xe.bind(t)}),qe={get({_:t},e){const{ctx:n,setupState:r,data:s,props:o,accessCache:l,type:c,appContext:i}=t;if("__v_skip"===e)return!0;let a;if("$"!==e[0]){const c=l[e];if(void 0!==c)switch(c){case 0:return r[e];case 1:return s[e];case 3:return n[e];case 2:return o[e]}else{if(r!==E&&M(r,e))return l[e]=0,r[e];if(s!==E&&M(s,e))return l[e]=1,s[e];if((a=t.propsOptions[0])&&M(a,e))return l[e]=2,o[e];if(n!==E&&M(n,e))return l[e]=3,n[e];l[e]=4}}const u=De[e];let f,p;return u?("$attrs"===e&&et(t,0,e),u(t)):(f=c.__cssModules)&&(f=f[e])?f:n!==E&&M(n,e)?(l[e]=3,n[e]):(p=i.config.globalProperties,M(p,e)?p[e]:void 0)},set({_:t},e,n){const{data:r,setupState:s,ctx:o}=t;if(s!==E&&M(s,e))s[e]=n;else if(r!==E&&M(r,e))r[e]=n;else if(M(t.props,e))return!1;return("$"!==e[0]||!(e.slice(1)in t))&&(o[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:r,appContext:s,propsOptions:o}},l){let c;return void 0!==n[l]||t!==E&&M(t,l)||e!==E&&M(e,l)||(c=o[0])&&M(c,l)||M(r,l)||M(De,l)||M(s.config.globalProperties,l)}};$({},qe,{get(t,e){if(e!==Symbol.unscopables)return qe.get(t,e,t)},has:(t,e)=>"_"!==e[0]&&!b(e)});let Ke=null;const He=t=>{Ke=t};function Je(t,e=Ke){e&&(e.effects||(e.effects=[])).push(t)}function Ge(t){const e=function(t){let e,n;return U(t)?(e=t,n=C):(e=t.get,n=t.set),new Jt(e,n,U(t)||!t.set)}(t);return Je(e.effect),e}const Qe=()=>({value:"",align:"left"});var Xe={name:"sb-paragraph",getDefaultData:Qe,component:function(t){U(t)&&(t={loader:t});const{loader:e,loadingComponent:n,errorComponent:r,delay:s=200,timeout:o,suspensible:l=!0,onError:c}=t;let i,a=null,u=0;const f=()=>{let t;return a||(t=a=e().catch((t=>{if(t=t instanceof Error?t:new Error(String(t)),c)return new Promise(((e,n)=>{c(t,(()=>e((u++,a=null,f()))),(()=>n(t)),u+1)}));throw t})).then((e=>t!==a&&a?a:(e&&(e.__esModule||"Module"===e[Symbol.toStringTag])&&(e=e.default),i=e,e))))};return Ce({__asyncLoader:f,name:"AsyncComponentWrapper",setup(){const t=Ke;if(i)return()=>Oe(i,t);const e=e=>{a=null,Xt(e,t,13,!r)};if(l&&t.suspense)return f().then((e=>()=>Oe(e,t))).catch((t=>(e(t),()=>r?Ne(r,{error:t}):null)));const c=Kt(!1),u=Kt(),p=Kt(!!s);return s&&setTimeout((()=>{p.value=!1}),s),null!=o&&setTimeout((()=>{if(!c.value&&!u.value){const t=new Error(`Async component timed out after ${o}ms.`);e(t),u.value=t}}),o),f().then((()=>{c.value=!0})).catch((t=>{e(t),u.value=t})),()=>c.value&&i?Oe(i,t):u.value&&r?Ne(r,{error:u.value}):n&&!p.value?Ne(n):void 0}})}((()=>function(t,e){if(!e)return t();if(void 0===v){const t=document.createElement("link").relList;v=t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}return Promise.all(e.map((t=>{if(t in m)return;m[t]=!0;const e=t.endsWith(".css"),n=e?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${t}"]${n}`))return;const r=document.createElement("link");return r.rel=e?"stylesheet":v,e||(r.as="script",r.crossOrigin=""),r.href=t,document.head.appendChild(r),e?new Promise(((t,e)=>{r.addEventListener("load",t),r.addEventListener("error",e)})):void 0}))).then((()=>t()))}((()=>__import__("./edit.2536c400.js")),["./assets/edit.2536c400.js","./assets/edit.25b6af76.css","./assets/vendor.41d82814.js"])))};d(a({name:"App",setup(){const t=u({name:"none",id:"0",data:null});return f((async()=>{const e=await fetch("./initial-data.json"),n=await e.json();t.name=n.name,t.id=n.id,t.data=n.data})),()=>p("div",{id:"app"},[p(g,{block:t,onUpdate:e=>{t.data=e.data},customBlocks:[Xe],key:"edit"},null)])}})).mount("#app");export{Kt as a,Ne as b,Ge as c,Ce as d,Qe as g,we as o,Nt as r}; +//# sourceMappingURL=index.863ba482.js.map diff --git a/docs/assets/index.863ba482.js.map b/docs/assets/index.863ba482.js.map new file mode 100644 index 0000000..3131953 --- /dev/null +++ b/docs/assets/index.863ba482.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.863ba482.js","sources":["../../vite/dynamic-import-polyfill","../../packages/core/lib/use-dynamic-blocks.ts","../../packages/core/lib/components/Block.tsx","../../packages/core/lib/components/Main.tsx","../../vite/preload-helper","../../packages/paragraph/node_modules/@vue/shared/dist/shared.esm-bundler.js","../../packages/paragraph/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js","../../packages/paragraph/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js","../../packages/paragraph/lib/util.ts","../../packages/paragraph/lib/index.ts","../../src/main.ts","../../src/App.tsx"],"sourcesContent":["const p = function polyfill(modulePath = '.', importFunctionName = '__import__') {\n try {\n self[importFunctionName] = new Function('u', `return import(u)`);\n }\n catch (error) {\n const baseURL = new URL(modulePath, location);\n const cleanup = (script) => {\n URL.revokeObjectURL(script.src);\n script.remove();\n };\n self[importFunctionName] = (url) => new Promise((resolve, reject) => {\n const absURL = new URL(url, baseURL);\n // If the module has already been imported, resolve immediately.\n if (self[importFunctionName].moduleMap[absURL]) {\n return resolve(self[importFunctionName].moduleMap[absURL]);\n }\n const moduleBlob = new Blob([\n `import * as m from '${absURL}';`,\n `${importFunctionName}.moduleMap['${absURL}']=m;`\n ], { type: 'text/javascript' });\n const script = Object.assign(document.createElement('script'), {\n type: 'module',\n src: URL.createObjectURL(moduleBlob),\n onerror() {\n reject(new Error(`Failed to import: ${url}`));\n cleanup(script);\n },\n onload() {\n resolve(self[importFunctionName].moduleMap[absURL]);\n cleanup(script);\n }\n });\n document.head.appendChild(script);\n });\n self[importFunctionName].moduleMap = {};\n }\n};__VITE_IS_MODERN__&&p(\"assets/\");","import {\n inject,\n reactive,\n} from 'vue';\nimport { BlockLibrary } from './types';\n\nexport const SymBlockLibrary = Symbol('Schlechtenburg block library');\nexport function useDynamicBlocks() {\n const customBlocks: BlockLibrary = inject(SymBlockLibrary, reactive({}));\n const getBlock = (name: string) => customBlocks[name];\n\n return {\n customBlocks,\n getBlock,\n };\n}\n","import {\n defineComponent,\n computed,\n PropType,\n ref,\n Ref,\n} from 'vue';\nimport { BlockData } from '../types';\nimport { useDynamicBlocks } from '../use-dynamic-blocks';\n\nimport './Block.scss';\n\nexport const SbBlock = defineComponent({\n name: 'sb-block',\n\n props: {\n block: {\n type: (null as unknown) as PropType>,\n required: true,\n },\n },\n\n setup(props, context) {\n const el: Ref = ref(null);\n const { getBlock } = useDynamicBlocks();\n const classes = computed(() => ({ 'sb-block': true }));\n\n return () => {\n const BlockComponent = getBlock(props.block.name)?.component as any;\n\n return \n \n ;\n };\n },\n});\n","import {\n defineComponent,\n provide,\n shallowReactive,\n ref,\n PropType,\n} from 'vue';\nimport {\n BlockData,\n BlockDefinition,\n BlockLibrary,\n} from '../types';\nimport { SymBlockLibrary} from '../use-dynamic-blocks';\n\nimport { SbBlock } from './Block';\n\nimport './Main.scss';\n\nexport const SbMain = defineComponent({\n name: 'sb-main',\n\n model: {\n prop: 'block',\n event: 'update',\n },\n\n props: {\n customBlocks: {\n type: Array as PropType[]>,\n default: () => [],\n },\n block: {\n type: Object as PropType>,\n required: true,\n },\n onUpdate: { type: Function, default: () => {} },\n },\n\n setup(props: any) { // TODO: why does the typing of props not work here?\n const blockLibrary: BlockLibrary = shallowReactive({\n ...props.customBlocks.reduce(\n (blocks: BlockLibrary, block: BlockDefinition) => ({ ...blocks, [block.name]: block }),\n {},\n ),\n });\n\n provide(SymBlockLibrary, blockLibrary);\n\n return () => (\n
\n \n
\n );\n },\n});\n","let scriptRel;const seen = {};export const __vitePreload = function preload(baseModule, deps) {\n // @ts-ignore\n if (!__VITE_IS_MODERN__ || !deps) {\n return baseModule();\n }\n // @ts-ignore\n if (scriptRel === undefined) {\n // @ts-ignore\n const relList = document.createElement('link').relList;\n // @ts-ignore\n scriptRel =\n relList && relList.supports && relList.supports('modulepreload')\n ? 'modulepreload'\n : 'preload';\n }\n return Promise.all(deps.map((dep) => {\n // @ts-ignore\n if (dep in seen)\n return;\n // @ts-ignore\n seen[dep] = true;\n const isCss = dep.endsWith('.css');\n const cssSelector = isCss ? '[rel=\"stylesheet\"]' : '';\n // @ts-ignore check if the file is already preloaded by SSR markup\n if (document.querySelector(`link[href=\"${dep}\"]${cssSelector}`)) {\n return;\n }\n // @ts-ignore\n const link = document.createElement('link');\n // @ts-ignore\n link.rel = isCss ? 'stylesheet' : scriptRel;\n if (!isCss) {\n link.as = 'script';\n link.crossOrigin = '';\n }\n link.href = dep;\n // @ts-ignore\n document.head.appendChild(link);\n if (isCss) {\n return new Promise((res, rej) => {\n link.addEventListener('load', res);\n link.addEventListener('error', rej);\n });\n }\n })).then(() => baseModule());\n}","/**\r\n * Make a map and return a function for checking if a key\r\n * is in that map.\r\n * IMPORTANT: all calls of this function must be prefixed with\r\n * \\/\\*#\\_\\_PURE\\_\\_\\*\\/\r\n * So that rollup can tree-shake them if necessary.\r\n */\r\nfunction makeMap(str, expectsLowerCase) {\r\n const map = Object.create(null);\r\n const list = str.split(',');\r\n for (let i = 0; i < list.length; i++) {\r\n map[list[i]] = true;\r\n }\r\n return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];\r\n}\n\n/**\r\n * dev only flag -> name mapping\r\n */\r\nconst PatchFlagNames = {\r\n [1 /* TEXT */]: `TEXT`,\r\n [2 /* CLASS */]: `CLASS`,\r\n [4 /* STYLE */]: `STYLE`,\r\n [8 /* PROPS */]: `PROPS`,\r\n [16 /* FULL_PROPS */]: `FULL_PROPS`,\r\n [32 /* HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,\r\n [64 /* STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,\r\n [128 /* KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,\r\n [256 /* UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,\r\n [512 /* NEED_PATCH */]: `NEED_PATCH`,\r\n [1024 /* DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,\r\n [2048 /* DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,\r\n [-1 /* HOISTED */]: `HOISTED`,\r\n [-2 /* BAIL */]: `BAIL`\r\n};\n\n/**\r\n * Dev only\r\n */\r\nconst slotFlagsText = {\r\n [1 /* STABLE */]: 'STABLE',\r\n [2 /* DYNAMIC */]: 'DYNAMIC',\r\n [3 /* FORWARDED */]: 'FORWARDED'\r\n};\n\nconst GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +\r\n 'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +\r\n 'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';\r\nconst isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);\n\nconst range = 2;\r\nfunction generateCodeFrame(source, start = 0, end = source.length) {\r\n const lines = source.split(/\\r?\\n/);\r\n let count = 0;\r\n const res = [];\r\n for (let i = 0; i < lines.length; i++) {\r\n count += lines[i].length + 1;\r\n if (count >= start) {\r\n for (let j = i - range; j <= i + range || end > count; j++) {\r\n if (j < 0 || j >= lines.length)\r\n continue;\r\n const line = j + 1;\r\n res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);\r\n const lineLength = lines[j].length;\r\n if (j === i) {\r\n // push underline\r\n const pad = start - (count - lineLength) + 1;\r\n const length = Math.max(1, end > count ? lineLength - pad : end - start);\r\n res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));\r\n }\r\n else if (j > i) {\r\n if (end > count) {\r\n const length = Math.max(Math.min(end - count, lineLength), 1);\r\n res.push(` | ` + '^'.repeat(length));\r\n }\r\n count += lineLength + 1;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n return res.join('\\n');\r\n}\n\n/**\r\n * On the client we only need to offer special cases for boolean attributes that\r\n * have different names from their corresponding dom properties:\r\n * - itemscope -> N/A\r\n * - allowfullscreen -> allowFullscreen\r\n * - formnovalidate -> formNoValidate\r\n * - ismap -> isMap\r\n * - nomodule -> noModule\r\n * - novalidate -> noValidate\r\n * - readonly -> readOnly\r\n */\r\nconst specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;\r\nconst isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);\r\n/**\r\n * The full list is needed during SSR to produce the correct initial markup.\r\n */\r\nconst isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs +\r\n `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +\r\n `loop,open,required,reversed,scoped,seamless,` +\r\n `checked,muted,multiple,selected`);\r\nconst unsafeAttrCharRE = /[>/=\"'\\u0009\\u000a\\u000c\\u0020]/;\r\nconst attrValidationCache = {};\r\nfunction isSSRSafeAttrName(name) {\r\n if (attrValidationCache.hasOwnProperty(name)) {\r\n return attrValidationCache[name];\r\n }\r\n const isUnsafe = unsafeAttrCharRE.test(name);\r\n if (isUnsafe) {\r\n console.error(`unsafe attribute name: ${name}`);\r\n }\r\n return (attrValidationCache[name] = !isUnsafe);\r\n}\r\nconst propsToAttrMap = {\r\n acceptCharset: 'accept-charset',\r\n className: 'class',\r\n htmlFor: 'for',\r\n httpEquiv: 'http-equiv'\r\n};\r\n/**\r\n * CSS properties that accept plain numbers\r\n */\r\nconst isNoUnitNumericStyleProp = /*#__PURE__*/ makeMap(`animation-iteration-count,border-image-outset,border-image-slice,` +\r\n `border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,` +\r\n `columns,flex,flex-grow,flex-positive,flex-shrink,flex-negative,flex-order,` +\r\n `grid-row,grid-row-end,grid-row-span,grid-row-start,grid-column,` +\r\n `grid-column-end,grid-column-span,grid-column-start,font-weight,line-clamp,` +\r\n `line-height,opacity,order,orphans,tab-size,widows,z-index,zoom,` +\r\n // SVG\r\n `fill-opacity,flood-opacity,stop-opacity,stroke-dasharray,stroke-dashoffset,` +\r\n `stroke-miterlimit,stroke-opacity,stroke-width`);\r\n/**\r\n * Known attributes, this is used for stringification of runtime static nodes\r\n * so that we don't stringify bindings that cannot be set from HTML.\r\n * Don't also forget to allow `data-*` and `aria-*`!\r\n * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes\r\n */\r\nconst isKnownAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +\r\n `autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +\r\n `border,buffered,capture,challenge,charset,checked,cite,class,code,` +\r\n `codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,` +\r\n `coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,` +\r\n `disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,` +\r\n `formaction,formenctype,formmethod,formnovalidate,formtarget,headers,` +\r\n `height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,` +\r\n `ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,` +\r\n `manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,` +\r\n `open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,` +\r\n `referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,` +\r\n `selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,` +\r\n `start,step,style,summary,tabindex,target,title,translate,type,usemap,` +\r\n `value,width,wrap`);\n\nfunction normalizeStyle(value) {\r\n if (isArray(value)) {\r\n const res = {};\r\n for (let i = 0; i < value.length; i++) {\r\n const item = value[i];\r\n const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item);\r\n if (normalized) {\r\n for (const key in normalized) {\r\n res[key] = normalized[key];\r\n }\r\n }\r\n }\r\n return res;\r\n }\r\n else if (isObject(value)) {\r\n return value;\r\n }\r\n}\r\nconst listDelimiterRE = /;(?![^(]*\\))/g;\r\nconst propertyDelimiterRE = /:(.+)/;\r\nfunction parseStringStyle(cssText) {\r\n const ret = {};\r\n cssText.split(listDelimiterRE).forEach(item => {\r\n if (item) {\r\n const tmp = item.split(propertyDelimiterRE);\r\n tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());\r\n }\r\n });\r\n return ret;\r\n}\r\nfunction stringifyStyle(styles) {\r\n let ret = '';\r\n if (!styles) {\r\n return ret;\r\n }\r\n for (const key in styles) {\r\n const value = styles[key];\r\n const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);\r\n if (isString(value) ||\r\n (typeof value === 'number' && isNoUnitNumericStyleProp(normalizedKey))) {\r\n // only render valid values\r\n ret += `${normalizedKey}:${value};`;\r\n }\r\n }\r\n return ret;\r\n}\r\nfunction normalizeClass(value) {\r\n let res = '';\r\n if (isString(value)) {\r\n res = value;\r\n }\r\n else if (isArray(value)) {\r\n for (let i = 0; i < value.length; i++) {\r\n const normalized = normalizeClass(value[i]);\r\n if (normalized) {\r\n res += normalized + ' ';\r\n }\r\n }\r\n }\r\n else if (isObject(value)) {\r\n for (const name in value) {\r\n if (value[name]) {\r\n res += name + ' ';\r\n }\r\n }\r\n }\r\n return res.trim();\r\n}\n\n// These tag configs are shared between compiler-dom and runtime-dom, so they\r\n// https://developer.mozilla.org/en-US/docs/Web/HTML/Element\r\nconst HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +\r\n 'header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,' +\r\n 'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +\r\n 'data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,' +\r\n 'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +\r\n 'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +\r\n 'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +\r\n 'option,output,progress,select,textarea,details,dialog,menu,' +\r\n 'summary,template,blockquote,iframe,tfoot';\r\n// https://developer.mozilla.org/en-US/docs/Web/SVG/Element\r\nconst SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +\r\n 'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +\r\n 'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +\r\n 'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +\r\n 'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +\r\n 'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +\r\n 'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +\r\n 'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +\r\n 'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +\r\n 'text,textPath,title,tspan,unknown,use,view';\r\nconst VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';\r\nconst isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);\r\nconst isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);\r\nconst isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);\n\nconst escapeRE = /[\"'&<>]/;\r\nfunction escapeHtml(string) {\r\n const str = '' + string;\r\n const match = escapeRE.exec(str);\r\n if (!match) {\r\n return str;\r\n }\r\n let html = '';\r\n let escaped;\r\n let index;\r\n let lastIndex = 0;\r\n for (index = match.index; index < str.length; index++) {\r\n switch (str.charCodeAt(index)) {\r\n case 34: // \"\r\n escaped = '"';\r\n break;\r\n case 38: // &\r\n escaped = '&';\r\n break;\r\n case 39: // '\r\n escaped = ''';\r\n break;\r\n case 60: // <\r\n escaped = '<';\r\n break;\r\n case 62: // >\r\n escaped = '>';\r\n break;\r\n default:\r\n continue;\r\n }\r\n if (lastIndex !== index) {\r\n html += str.substring(lastIndex, index);\r\n }\r\n lastIndex = index + 1;\r\n html += escaped;\r\n }\r\n return lastIndex !== index ? html + str.substring(lastIndex, index) : html;\r\n}\r\n// https://www.w3.org/TR/html52/syntax.html#comments\r\nconst commentStripRE = /^-?>||--!>| looseEqual(item, val));\r\n}\n\n/**\r\n * For converting {{ interpolation }} values to displayed strings.\r\n * @private\r\n */\r\nconst toDisplayString = (val) => {\r\n return val == null\r\n ? ''\r\n : isObject(val)\r\n ? JSON.stringify(val, replacer, 2)\r\n : String(val);\r\n};\r\nconst replacer = (_key, val) => {\r\n if (isMap(val)) {\r\n return {\r\n [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {\r\n entries[`${key} =>`] = val;\r\n return entries;\r\n }, {})\r\n };\r\n }\r\n else if (isSet(val)) {\r\n return {\r\n [`Set(${val.size})`]: [...val.values()]\r\n };\r\n }\r\n else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {\r\n return String(val);\r\n }\r\n return val;\r\n};\n\n/**\r\n * List of @babel/parser plugins that are used for template expression\r\n * transforms and SFC script transforms. By default we enable proposals slated\r\n * for ES2020. This will need to be updated as the spec moves forward.\r\n * Full list at https://babeljs.io/docs/en/next/babel-parser#plugins\r\n */\r\nconst babelParserDefaultPlugins = [\r\n 'bigInt',\r\n 'optionalChaining',\r\n 'nullishCoalescingOperator'\r\n];\r\nconst EMPTY_OBJ = (process.env.NODE_ENV !== 'production')\r\n ? Object.freeze({})\r\n : {};\r\nconst EMPTY_ARR = (process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];\r\nconst NOOP = () => { };\r\n/**\r\n * Always return false.\r\n */\r\nconst NO = () => false;\r\nconst onRE = /^on[^a-z]/;\r\nconst isOn = (key) => onRE.test(key);\r\nconst isModelListener = (key) => key.startsWith('onUpdate:');\r\nconst extend = Object.assign;\r\nconst remove = (arr, el) => {\r\n const i = arr.indexOf(el);\r\n if (i > -1) {\r\n arr.splice(i, 1);\r\n }\r\n};\r\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\r\nconst hasOwn = (val, key) => hasOwnProperty.call(val, key);\r\nconst isArray = Array.isArray;\r\nconst isMap = (val) => toTypeString(val) === '[object Map]';\r\nconst isSet = (val) => toTypeString(val) === '[object Set]';\r\nconst isDate = (val) => val instanceof Date;\r\nconst isFunction = (val) => typeof val === 'function';\r\nconst isString = (val) => typeof val === 'string';\r\nconst isSymbol = (val) => typeof val === 'symbol';\r\nconst isObject = (val) => val !== null && typeof val === 'object';\r\nconst isPromise = (val) => {\r\n return isObject(val) && isFunction(val.then) && isFunction(val.catch);\r\n};\r\nconst objectToString = Object.prototype.toString;\r\nconst toTypeString = (value) => objectToString.call(value);\r\nconst toRawType = (value) => {\r\n // extract \"RawType\" from strings like \"[object RawType]\"\r\n return toTypeString(value).slice(8, -1);\r\n};\r\nconst isPlainObject = (val) => toTypeString(val) === '[object Object]';\r\nconst isIntegerKey = (key) => isString(key) &&\r\n key !== 'NaN' &&\r\n key[0] !== '-' &&\r\n '' + parseInt(key, 10) === key;\r\nconst isReservedProp = /*#__PURE__*/ makeMap(\r\n// the leading comma is intentional so empty string \"\" is also included\r\n',key,ref,' +\r\n 'onVnodeBeforeMount,onVnodeMounted,' +\r\n 'onVnodeBeforeUpdate,onVnodeUpdated,' +\r\n 'onVnodeBeforeUnmount,onVnodeUnmounted');\r\nconst cacheStringFunction = (fn) => {\r\n const cache = Object.create(null);\r\n return ((str) => {\r\n const hit = cache[str];\r\n return hit || (cache[str] = fn(str));\r\n });\r\n};\r\nconst camelizeRE = /-(\\w)/g;\r\n/**\r\n * @private\r\n */\r\nconst camelize = cacheStringFunction((str) => {\r\n return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));\r\n});\r\nconst hyphenateRE = /\\B([A-Z])/g;\r\n/**\r\n * @private\r\n */\r\nconst hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase());\r\n/**\r\n * @private\r\n */\r\nconst capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));\r\n/**\r\n * @private\r\n */\r\nconst toHandlerKey = cacheStringFunction((str) => (str ? `on${capitalize(str)}` : ``));\r\n// compare whether a value has changed, accounting for NaN.\r\nconst hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);\r\nconst invokeArrayFns = (fns, arg) => {\r\n for (let i = 0; i < fns.length; i++) {\r\n fns[i](arg);\r\n }\r\n};\r\nconst def = (obj, key, value) => {\r\n Object.defineProperty(obj, key, {\r\n configurable: true,\r\n enumerable: false,\r\n value\r\n });\r\n};\r\nconst toNumber = (val) => {\r\n const n = parseFloat(val);\r\n return isNaN(n) ? val : n;\r\n};\r\nlet _globalThis;\r\nconst getGlobalThis = () => {\r\n return (_globalThis ||\r\n (_globalThis =\r\n typeof globalThis !== 'undefined'\r\n ? globalThis\r\n : typeof self !== 'undefined'\r\n ? self\r\n : typeof window !== 'undefined'\r\n ? window\r\n : typeof global !== 'undefined'\r\n ? global\r\n : {}));\r\n};\n\nexport { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, babelParserDefaultPlugins, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, invokeArrayFns, isArray, isBooleanAttr, isDate, isFunction, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownAttr, isMap, isModelListener, isNoUnitNumericStyleProp, isObject, isOn, isPlainObject, isPromise, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, makeMap, normalizeClass, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };\n","import { EMPTY_OBJ, isArray, isMap, isIntegerKey, isSymbol, extend, hasOwn, isObject, hasChanged, makeMap, capitalize, toRawType, def, isFunction, NOOP } from '@vue/shared';\n\nconst targetMap = new WeakMap();\r\nconst effectStack = [];\r\nlet activeEffect;\r\nconst ITERATE_KEY = Symbol((process.env.NODE_ENV !== 'production') ? 'iterate' : '');\r\nconst MAP_KEY_ITERATE_KEY = Symbol((process.env.NODE_ENV !== 'production') ? 'Map key iterate' : '');\r\nfunction isEffect(fn) {\r\n return fn && fn._isEffect === true;\r\n}\r\nfunction effect(fn, options = EMPTY_OBJ) {\r\n if (isEffect(fn)) {\r\n fn = fn.raw;\r\n }\r\n const effect = createReactiveEffect(fn, options);\r\n if (!options.lazy) {\r\n effect();\r\n }\r\n return effect;\r\n}\r\nfunction stop(effect) {\r\n if (effect.active) {\r\n cleanup(effect);\r\n if (effect.options.onStop) {\r\n effect.options.onStop();\r\n }\r\n effect.active = false;\r\n }\r\n}\r\nlet uid = 0;\r\nfunction createReactiveEffect(fn, options) {\r\n const effect = function reactiveEffect() {\r\n if (!effect.active) {\r\n return options.scheduler ? undefined : fn();\r\n }\r\n if (!effectStack.includes(effect)) {\r\n cleanup(effect);\r\n try {\r\n enableTracking();\r\n effectStack.push(effect);\r\n activeEffect = effect;\r\n return fn();\r\n }\r\n finally {\r\n effectStack.pop();\r\n resetTracking();\r\n activeEffect = effectStack[effectStack.length - 1];\r\n }\r\n }\r\n };\r\n effect.id = uid++;\r\n effect.allowRecurse = !!options.allowRecurse;\r\n effect._isEffect = true;\r\n effect.active = true;\r\n effect.raw = fn;\r\n effect.deps = [];\r\n effect.options = options;\r\n return effect;\r\n}\r\nfunction cleanup(effect) {\r\n const { deps } = effect;\r\n if (deps.length) {\r\n for (let i = 0; i < deps.length; i++) {\r\n deps[i].delete(effect);\r\n }\r\n deps.length = 0;\r\n }\r\n}\r\nlet shouldTrack = true;\r\nconst trackStack = [];\r\nfunction pauseTracking() {\r\n trackStack.push(shouldTrack);\r\n shouldTrack = false;\r\n}\r\nfunction enableTracking() {\r\n trackStack.push(shouldTrack);\r\n shouldTrack = true;\r\n}\r\nfunction resetTracking() {\r\n const last = trackStack.pop();\r\n shouldTrack = last === undefined ? true : last;\r\n}\r\nfunction track(target, type, key) {\r\n if (!shouldTrack || activeEffect === undefined) {\r\n return;\r\n }\r\n let depsMap = targetMap.get(target);\r\n if (!depsMap) {\r\n targetMap.set(target, (depsMap = new Map()));\r\n }\r\n let dep = depsMap.get(key);\r\n if (!dep) {\r\n depsMap.set(key, (dep = new Set()));\r\n }\r\n if (!dep.has(activeEffect)) {\r\n dep.add(activeEffect);\r\n activeEffect.deps.push(dep);\r\n if ((process.env.NODE_ENV !== 'production') && activeEffect.options.onTrack) {\r\n activeEffect.options.onTrack({\r\n effect: activeEffect,\r\n target,\r\n type,\r\n key\r\n });\r\n }\r\n }\r\n}\r\nfunction trigger(target, type, key, newValue, oldValue, oldTarget) {\r\n const depsMap = targetMap.get(target);\r\n if (!depsMap) {\r\n // never been tracked\r\n return;\r\n }\r\n const effects = new Set();\r\n const add = (effectsToAdd) => {\r\n if (effectsToAdd) {\r\n effectsToAdd.forEach(effect => {\r\n if (effect !== activeEffect || effect.allowRecurse) {\r\n effects.add(effect);\r\n }\r\n });\r\n }\r\n };\r\n if (type === \"clear\" /* CLEAR */) {\r\n // collection being cleared\r\n // trigger all effects for target\r\n depsMap.forEach(add);\r\n }\r\n else if (key === 'length' && isArray(target)) {\r\n depsMap.forEach((dep, key) => {\r\n if (key === 'length' || key >= newValue) {\r\n add(dep);\r\n }\r\n });\r\n }\r\n else {\r\n // schedule runs for SET | ADD | DELETE\r\n if (key !== void 0) {\r\n add(depsMap.get(key));\r\n }\r\n // also run for iteration key on ADD | DELETE | Map.SET\r\n switch (type) {\r\n case \"add\" /* ADD */:\r\n if (!isArray(target)) {\r\n add(depsMap.get(ITERATE_KEY));\r\n if (isMap(target)) {\r\n add(depsMap.get(MAP_KEY_ITERATE_KEY));\r\n }\r\n }\r\n else if (isIntegerKey(key)) {\r\n // new index added to array -> length changes\r\n add(depsMap.get('length'));\r\n }\r\n break;\r\n case \"delete\" /* DELETE */:\r\n if (!isArray(target)) {\r\n add(depsMap.get(ITERATE_KEY));\r\n if (isMap(target)) {\r\n add(depsMap.get(MAP_KEY_ITERATE_KEY));\r\n }\r\n }\r\n break;\r\n case \"set\" /* SET */:\r\n if (isMap(target)) {\r\n add(depsMap.get(ITERATE_KEY));\r\n }\r\n break;\r\n }\r\n }\r\n const run = (effect) => {\r\n if ((process.env.NODE_ENV !== 'production') && effect.options.onTrigger) {\r\n effect.options.onTrigger({\r\n effect,\r\n target,\r\n key,\r\n type,\r\n newValue,\r\n oldValue,\r\n oldTarget\r\n });\r\n }\r\n if (effect.options.scheduler) {\r\n effect.options.scheduler(effect);\r\n }\r\n else {\r\n effect();\r\n }\r\n };\r\n effects.forEach(run);\r\n}\n\nconst isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);\r\nconst builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)\r\n .map(key => Symbol[key])\r\n .filter(isSymbol));\r\nconst get = /*#__PURE__*/ createGetter();\r\nconst shallowGet = /*#__PURE__*/ createGetter(false, true);\r\nconst readonlyGet = /*#__PURE__*/ createGetter(true);\r\nconst shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);\r\nconst arrayInstrumentations = {};\r\n['includes', 'indexOf', 'lastIndexOf'].forEach(key => {\r\n const method = Array.prototype[key];\r\n arrayInstrumentations[key] = function (...args) {\r\n const arr = toRaw(this);\r\n for (let i = 0, l = this.length; i < l; i++) {\r\n track(arr, \"get\" /* GET */, i + '');\r\n }\r\n // we run the method using the original args first (which may be reactive)\r\n const res = method.apply(arr, args);\r\n if (res === -1 || res === false) {\r\n // if that didn't work, run it again using raw values.\r\n return method.apply(arr, args.map(toRaw));\r\n }\r\n else {\r\n return res;\r\n }\r\n };\r\n});\r\n['push', 'pop', 'shift', 'unshift', 'splice'].forEach(key => {\r\n const method = Array.prototype[key];\r\n arrayInstrumentations[key] = function (...args) {\r\n pauseTracking();\r\n const res = method.apply(this, args);\r\n resetTracking();\r\n return res;\r\n };\r\n});\r\nfunction createGetter(isReadonly = false, shallow = false) {\r\n return function get(target, key, receiver) {\r\n if (key === \"__v_isReactive\" /* IS_REACTIVE */) {\r\n return !isReadonly;\r\n }\r\n else if (key === \"__v_isReadonly\" /* IS_READONLY */) {\r\n return isReadonly;\r\n }\r\n else if (key === \"__v_raw\" /* RAW */ &&\r\n receiver === (isReadonly ? readonlyMap : reactiveMap).get(target)) {\r\n return target;\r\n }\r\n const targetIsArray = isArray(target);\r\n if (!isReadonly && targetIsArray && hasOwn(arrayInstrumentations, key)) {\r\n return Reflect.get(arrayInstrumentations, key, receiver);\r\n }\r\n const res = Reflect.get(target, key, receiver);\r\n if (isSymbol(key)\r\n ? builtInSymbols.has(key)\r\n : isNonTrackableKeys(key)) {\r\n return res;\r\n }\r\n if (!isReadonly) {\r\n track(target, \"get\" /* GET */, key);\r\n }\r\n if (shallow) {\r\n return res;\r\n }\r\n if (isRef(res)) {\r\n // ref unwrapping - does not apply for Array + integer key.\r\n const shouldUnwrap = !targetIsArray || !isIntegerKey(key);\r\n return shouldUnwrap ? res.value : res;\r\n }\r\n if (isObject(res)) {\r\n // Convert returned value into a proxy as well. we do the isObject check\r\n // here to avoid invalid value warning. Also need to lazy access readonly\r\n // and reactive here to avoid circular dependency.\r\n return isReadonly ? readonly(res) : reactive(res);\r\n }\r\n return res;\r\n };\r\n}\r\nconst set = /*#__PURE__*/ createSetter();\r\nconst shallowSet = /*#__PURE__*/ createSetter(true);\r\nfunction createSetter(shallow = false) {\r\n return function set(target, key, value, receiver) {\r\n const oldValue = target[key];\r\n if (!shallow) {\r\n value = toRaw(value);\r\n if (!isArray(target) && isRef(oldValue) && !isRef(value)) {\r\n oldValue.value = value;\r\n return true;\r\n }\r\n }\r\n const hadKey = isArray(target) && isIntegerKey(key)\r\n ? Number(key) < target.length\r\n : hasOwn(target, key);\r\n const result = Reflect.set(target, key, value, receiver);\r\n // don't trigger if target is something up in the prototype chain of original\r\n if (target === toRaw(receiver)) {\r\n if (!hadKey) {\r\n trigger(target, \"add\" /* ADD */, key, value);\r\n }\r\n else if (hasChanged(value, oldValue)) {\r\n trigger(target, \"set\" /* SET */, key, value, oldValue);\r\n }\r\n }\r\n return result;\r\n };\r\n}\r\nfunction deleteProperty(target, key) {\r\n const hadKey = hasOwn(target, key);\r\n const oldValue = target[key];\r\n const result = Reflect.deleteProperty(target, key);\r\n if (result && hadKey) {\r\n trigger(target, \"delete\" /* DELETE */, key, undefined, oldValue);\r\n }\r\n return result;\r\n}\r\nfunction has(target, key) {\r\n const result = Reflect.has(target, key);\r\n if (!isSymbol(key) || !builtInSymbols.has(key)) {\r\n track(target, \"has\" /* HAS */, key);\r\n }\r\n return result;\r\n}\r\nfunction ownKeys(target) {\r\n track(target, \"iterate\" /* ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);\r\n return Reflect.ownKeys(target);\r\n}\r\nconst mutableHandlers = {\r\n get,\r\n set,\r\n deleteProperty,\r\n has,\r\n ownKeys\r\n};\r\nconst readonlyHandlers = {\r\n get: readonlyGet,\r\n set(target, key) {\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n console.warn(`Set operation on key \"${String(key)}\" failed: target is readonly.`, target);\r\n }\r\n return true;\r\n },\r\n deleteProperty(target, key) {\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n console.warn(`Delete operation on key \"${String(key)}\" failed: target is readonly.`, target);\r\n }\r\n return true;\r\n }\r\n};\r\nconst shallowReactiveHandlers = extend({}, mutableHandlers, {\r\n get: shallowGet,\r\n set: shallowSet\r\n});\r\n// Props handlers are special in the sense that it should not unwrap top-level\r\n// refs (in order to allow refs to be explicitly passed down), but should\r\n// retain the reactivity of the normal readonly object.\r\nconst shallowReadonlyHandlers = extend({}, readonlyHandlers, {\r\n get: shallowReadonlyGet\r\n});\n\nconst toReactive = (value) => isObject(value) ? reactive(value) : value;\r\nconst toReadonly = (value) => isObject(value) ? readonly(value) : value;\r\nconst toShallow = (value) => value;\r\nconst getProto = (v) => Reflect.getPrototypeOf(v);\r\nfunction get$1(target, key, isReadonly = false, isShallow = false) {\r\n // #1772: readonly(reactive(Map)) should return readonly + reactive version\r\n // of the value\r\n target = target[\"__v_raw\" /* RAW */];\r\n const rawTarget = toRaw(target);\r\n const rawKey = toRaw(key);\r\n if (key !== rawKey) {\r\n !isReadonly && track(rawTarget, \"get\" /* GET */, key);\r\n }\r\n !isReadonly && track(rawTarget, \"get\" /* GET */, rawKey);\r\n const { has } = getProto(rawTarget);\r\n const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;\r\n if (has.call(rawTarget, key)) {\r\n return wrap(target.get(key));\r\n }\r\n else if (has.call(rawTarget, rawKey)) {\r\n return wrap(target.get(rawKey));\r\n }\r\n}\r\nfunction has$1(key, isReadonly = false) {\r\n const target = this[\"__v_raw\" /* RAW */];\r\n const rawTarget = toRaw(target);\r\n const rawKey = toRaw(key);\r\n if (key !== rawKey) {\r\n !isReadonly && track(rawTarget, \"has\" /* HAS */, key);\r\n }\r\n !isReadonly && track(rawTarget, \"has\" /* HAS */, rawKey);\r\n return key === rawKey\r\n ? target.has(key)\r\n : target.has(key) || target.has(rawKey);\r\n}\r\nfunction size(target, isReadonly = false) {\r\n target = target[\"__v_raw\" /* RAW */];\r\n !isReadonly && track(toRaw(target), \"iterate\" /* ITERATE */, ITERATE_KEY);\r\n return Reflect.get(target, 'size', target);\r\n}\r\nfunction add(value) {\r\n value = toRaw(value);\r\n const target = toRaw(this);\r\n const proto = getProto(target);\r\n const hadKey = proto.has.call(target, value);\r\n if (!hadKey) {\r\n target.add(value);\r\n trigger(target, \"add\" /* ADD */, value, value);\r\n }\r\n return this;\r\n}\r\nfunction set$1(key, value) {\r\n value = toRaw(value);\r\n const target = toRaw(this);\r\n const { has, get } = getProto(target);\r\n let hadKey = has.call(target, key);\r\n if (!hadKey) {\r\n key = toRaw(key);\r\n hadKey = has.call(target, key);\r\n }\r\n else if ((process.env.NODE_ENV !== 'production')) {\r\n checkIdentityKeys(target, has, key);\r\n }\r\n const oldValue = get.call(target, key);\r\n target.set(key, value);\r\n if (!hadKey) {\r\n trigger(target, \"add\" /* ADD */, key, value);\r\n }\r\n else if (hasChanged(value, oldValue)) {\r\n trigger(target, \"set\" /* SET */, key, value, oldValue);\r\n }\r\n return this;\r\n}\r\nfunction deleteEntry(key) {\r\n const target = toRaw(this);\r\n const { has, get } = getProto(target);\r\n let hadKey = has.call(target, key);\r\n if (!hadKey) {\r\n key = toRaw(key);\r\n hadKey = has.call(target, key);\r\n }\r\n else if ((process.env.NODE_ENV !== 'production')) {\r\n checkIdentityKeys(target, has, key);\r\n }\r\n const oldValue = get ? get.call(target, key) : undefined;\r\n // forward the operation before queueing reactions\r\n const result = target.delete(key);\r\n if (hadKey) {\r\n trigger(target, \"delete\" /* DELETE */, key, undefined, oldValue);\r\n }\r\n return result;\r\n}\r\nfunction clear() {\r\n const target = toRaw(this);\r\n const hadItems = target.size !== 0;\r\n const oldTarget = (process.env.NODE_ENV !== 'production')\r\n ? isMap(target)\r\n ? new Map(target)\r\n : new Set(target)\r\n : undefined;\r\n // forward the operation before queueing reactions\r\n const result = target.clear();\r\n if (hadItems) {\r\n trigger(target, \"clear\" /* CLEAR */, undefined, undefined, oldTarget);\r\n }\r\n return result;\r\n}\r\nfunction createForEach(isReadonly, isShallow) {\r\n return function forEach(callback, thisArg) {\r\n const observed = this;\r\n const target = observed[\"__v_raw\" /* RAW */];\r\n const rawTarget = toRaw(target);\r\n const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;\r\n !isReadonly && track(rawTarget, \"iterate\" /* ITERATE */, ITERATE_KEY);\r\n return target.forEach((value, key) => {\r\n // important: make sure the callback is\r\n // 1. invoked with the reactive map as `this` and 3rd arg\r\n // 2. the value received should be a corresponding reactive/readonly.\r\n return callback.call(thisArg, wrap(value), wrap(key), observed);\r\n });\r\n };\r\n}\r\nfunction createIterableMethod(method, isReadonly, isShallow) {\r\n return function (...args) {\r\n const target = this[\"__v_raw\" /* RAW */];\r\n const rawTarget = toRaw(target);\r\n const targetIsMap = isMap(rawTarget);\r\n const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);\r\n const isKeyOnly = method === 'keys' && targetIsMap;\r\n const innerIterator = target[method](...args);\r\n const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;\r\n !isReadonly &&\r\n track(rawTarget, \"iterate\" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);\r\n // return a wrapped iterator which returns observed versions of the\r\n // values emitted from the real iterator\r\n return {\r\n // iterator protocol\r\n next() {\r\n const { value, done } = innerIterator.next();\r\n return done\r\n ? { value, done }\r\n : {\r\n value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),\r\n done\r\n };\r\n },\r\n // iterable protocol\r\n [Symbol.iterator]() {\r\n return this;\r\n }\r\n };\r\n };\r\n}\r\nfunction createReadonlyMethod(type) {\r\n return function (...args) {\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n const key = args[0] ? `on key \"${args[0]}\" ` : ``;\r\n console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));\r\n }\r\n return type === \"delete\" /* DELETE */ ? false : this;\r\n };\r\n}\r\nconst mutableInstrumentations = {\r\n get(key) {\r\n return get$1(this, key);\r\n },\r\n get size() {\r\n return size(this);\r\n },\r\n has: has$1,\r\n add,\r\n set: set$1,\r\n delete: deleteEntry,\r\n clear,\r\n forEach: createForEach(false, false)\r\n};\r\nconst shallowInstrumentations = {\r\n get(key) {\r\n return get$1(this, key, false, true);\r\n },\r\n get size() {\r\n return size(this);\r\n },\r\n has: has$1,\r\n add,\r\n set: set$1,\r\n delete: deleteEntry,\r\n clear,\r\n forEach: createForEach(false, true)\r\n};\r\nconst readonlyInstrumentations = {\r\n get(key) {\r\n return get$1(this, key, true);\r\n },\r\n get size() {\r\n return size(this, true);\r\n },\r\n has(key) {\r\n return has$1.call(this, key, true);\r\n },\r\n add: createReadonlyMethod(\"add\" /* ADD */),\r\n set: createReadonlyMethod(\"set\" /* SET */),\r\n delete: createReadonlyMethod(\"delete\" /* DELETE */),\r\n clear: createReadonlyMethod(\"clear\" /* CLEAR */),\r\n forEach: createForEach(true, false)\r\n};\r\nconst iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];\r\niteratorMethods.forEach(method => {\r\n mutableInstrumentations[method] = createIterableMethod(method, false, false);\r\n readonlyInstrumentations[method] = createIterableMethod(method, true, false);\r\n shallowInstrumentations[method] = createIterableMethod(method, false, true);\r\n});\r\nfunction createInstrumentationGetter(isReadonly, shallow) {\r\n const instrumentations = shallow\r\n ? shallowInstrumentations\r\n : isReadonly\r\n ? readonlyInstrumentations\r\n : mutableInstrumentations;\r\n return (target, key, receiver) => {\r\n if (key === \"__v_isReactive\" /* IS_REACTIVE */) {\r\n return !isReadonly;\r\n }\r\n else if (key === \"__v_isReadonly\" /* IS_READONLY */) {\r\n return isReadonly;\r\n }\r\n else if (key === \"__v_raw\" /* RAW */) {\r\n return target;\r\n }\r\n return Reflect.get(hasOwn(instrumentations, key) && key in target\r\n ? instrumentations\r\n : target, key, receiver);\r\n };\r\n}\r\nconst mutableCollectionHandlers = {\r\n get: createInstrumentationGetter(false, false)\r\n};\r\nconst shallowCollectionHandlers = {\r\n get: createInstrumentationGetter(false, true)\r\n};\r\nconst readonlyCollectionHandlers = {\r\n get: createInstrumentationGetter(true, false)\r\n};\r\nfunction checkIdentityKeys(target, has, key) {\r\n const rawKey = toRaw(key);\r\n if (rawKey !== key && has.call(target, rawKey)) {\r\n const type = toRawType(target);\r\n console.warn(`Reactive ${type} contains both the raw and reactive ` +\r\n `versions of the same object${type === `Map` ? ` as keys` : ``}, ` +\r\n `which can lead to inconsistencies. ` +\r\n `Avoid differentiating between the raw and reactive versions ` +\r\n `of an object and only use the reactive version if possible.`);\r\n }\r\n}\n\nconst reactiveMap = new WeakMap();\r\nconst readonlyMap = new WeakMap();\r\nfunction targetTypeMap(rawType) {\r\n switch (rawType) {\r\n case 'Object':\r\n case 'Array':\r\n return 1 /* COMMON */;\r\n case 'Map':\r\n case 'Set':\r\n case 'WeakMap':\r\n case 'WeakSet':\r\n return 2 /* COLLECTION */;\r\n default:\r\n return 0 /* INVALID */;\r\n }\r\n}\r\nfunction getTargetType(value) {\r\n return value[\"__v_skip\" /* SKIP */] || !Object.isExtensible(value)\r\n ? 0 /* INVALID */\r\n : targetTypeMap(toRawType(value));\r\n}\r\nfunction reactive(target) {\r\n // if trying to observe a readonly proxy, return the readonly version.\r\n if (target && target[\"__v_isReadonly\" /* IS_READONLY */]) {\r\n return target;\r\n }\r\n return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers);\r\n}\r\n/**\r\n * Return a shallowly-reactive copy of the original object, where only the root\r\n * level properties are reactive. It also does not auto-unwrap refs (even at the\r\n * root level).\r\n */\r\nfunction shallowReactive(target) {\r\n return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers);\r\n}\r\n/**\r\n * Creates a readonly copy of the original object. Note the returned copy is not\r\n * made reactive, but `readonly` can be called on an already reactive object.\r\n */\r\nfunction readonly(target) {\r\n return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers);\r\n}\r\n/**\r\n * Returns a reactive-copy of the original object, where only the root level\r\n * properties are readonly, and does NOT unwrap refs nor recursively convert\r\n * returned properties.\r\n * This is used for creating the props proxy object for stateful components.\r\n */\r\nfunction shallowReadonly(target) {\r\n return createReactiveObject(target, true, shallowReadonlyHandlers, readonlyCollectionHandlers);\r\n}\r\nfunction createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers) {\r\n if (!isObject(target)) {\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n console.warn(`value cannot be made reactive: ${String(target)}`);\r\n }\r\n return target;\r\n }\r\n // target is already a Proxy, return it.\r\n // exception: calling readonly() on a reactive object\r\n if (target[\"__v_raw\" /* RAW */] &&\r\n !(isReadonly && target[\"__v_isReactive\" /* IS_REACTIVE */])) {\r\n return target;\r\n }\r\n // target already has corresponding Proxy\r\n const proxyMap = isReadonly ? readonlyMap : reactiveMap;\r\n const existingProxy = proxyMap.get(target);\r\n if (existingProxy) {\r\n return existingProxy;\r\n }\r\n // only a whitelist of value types can be observed.\r\n const targetType = getTargetType(target);\r\n if (targetType === 0 /* INVALID */) {\r\n return target;\r\n }\r\n const proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);\r\n proxyMap.set(target, proxy);\r\n return proxy;\r\n}\r\nfunction isReactive(value) {\r\n if (isReadonly(value)) {\r\n return isReactive(value[\"__v_raw\" /* RAW */]);\r\n }\r\n return !!(value && value[\"__v_isReactive\" /* IS_REACTIVE */]);\r\n}\r\nfunction isReadonly(value) {\r\n return !!(value && value[\"__v_isReadonly\" /* IS_READONLY */]);\r\n}\r\nfunction isProxy(value) {\r\n return isReactive(value) || isReadonly(value);\r\n}\r\nfunction toRaw(observed) {\r\n return ((observed && toRaw(observed[\"__v_raw\" /* RAW */])) || observed);\r\n}\r\nfunction markRaw(value) {\r\n def(value, \"__v_skip\" /* SKIP */, true);\r\n return value;\r\n}\n\nconst convert = (val) => isObject(val) ? reactive(val) : val;\r\nfunction isRef(r) {\r\n return Boolean(r && r.__v_isRef === true);\r\n}\r\nfunction ref(value) {\r\n return createRef(value);\r\n}\r\nfunction shallowRef(value) {\r\n return createRef(value, true);\r\n}\r\nclass RefImpl {\r\n constructor(_rawValue, _shallow = false) {\r\n this._rawValue = _rawValue;\r\n this._shallow = _shallow;\r\n this.__v_isRef = true;\r\n this._value = _shallow ? _rawValue : convert(_rawValue);\r\n }\r\n get value() {\r\n track(toRaw(this), \"get\" /* GET */, 'value');\r\n return this._value;\r\n }\r\n set value(newVal) {\r\n if (hasChanged(toRaw(newVal), this._rawValue)) {\r\n this._rawValue = newVal;\r\n this._value = this._shallow ? newVal : convert(newVal);\r\n trigger(toRaw(this), \"set\" /* SET */, 'value', newVal);\r\n }\r\n }\r\n}\r\nfunction createRef(rawValue, shallow = false) {\r\n if (isRef(rawValue)) {\r\n return rawValue;\r\n }\r\n return new RefImpl(rawValue, shallow);\r\n}\r\nfunction triggerRef(ref) {\r\n trigger(toRaw(ref), \"set\" /* SET */, 'value', (process.env.NODE_ENV !== 'production') ? ref.value : void 0);\r\n}\r\nfunction unref(ref) {\r\n return isRef(ref) ? ref.value : ref;\r\n}\r\nconst shallowUnwrapHandlers = {\r\n get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),\r\n set: (target, key, value, receiver) => {\r\n const oldValue = target[key];\r\n if (isRef(oldValue) && !isRef(value)) {\r\n oldValue.value = value;\r\n return true;\r\n }\r\n else {\r\n return Reflect.set(target, key, value, receiver);\r\n }\r\n }\r\n};\r\nfunction proxyRefs(objectWithRefs) {\r\n return isReactive(objectWithRefs)\r\n ? objectWithRefs\r\n : new Proxy(objectWithRefs, shallowUnwrapHandlers);\r\n}\r\nclass CustomRefImpl {\r\n constructor(factory) {\r\n this.__v_isRef = true;\r\n const { get, set } = factory(() => track(this, \"get\" /* GET */, 'value'), () => trigger(this, \"set\" /* SET */, 'value'));\r\n this._get = get;\r\n this._set = set;\r\n }\r\n get value() {\r\n return this._get();\r\n }\r\n set value(newVal) {\r\n this._set(newVal);\r\n }\r\n}\r\nfunction customRef(factory) {\r\n return new CustomRefImpl(factory);\r\n}\r\nfunction toRefs(object) {\r\n if ((process.env.NODE_ENV !== 'production') && !isProxy(object)) {\r\n console.warn(`toRefs() expects a reactive object but received a plain one.`);\r\n }\r\n const ret = isArray(object) ? new Array(object.length) : {};\r\n for (const key in object) {\r\n ret[key] = toRef(object, key);\r\n }\r\n return ret;\r\n}\r\nclass ObjectRefImpl {\r\n constructor(_object, _key) {\r\n this._object = _object;\r\n this._key = _key;\r\n this.__v_isRef = true;\r\n }\r\n get value() {\r\n return this._object[this._key];\r\n }\r\n set value(newVal) {\r\n this._object[this._key] = newVal;\r\n }\r\n}\r\nfunction toRef(object, key) {\r\n return isRef(object[key])\r\n ? object[key]\r\n : new ObjectRefImpl(object, key);\r\n}\n\nclass ComputedRefImpl {\r\n constructor(getter, _setter, isReadonly) {\r\n this._setter = _setter;\r\n this._dirty = true;\r\n this.__v_isRef = true;\r\n this.effect = effect(getter, {\r\n lazy: true,\r\n scheduler: () => {\r\n if (!this._dirty) {\r\n this._dirty = true;\r\n trigger(toRaw(this), \"set\" /* SET */, 'value');\r\n }\r\n }\r\n });\r\n this[\"__v_isReadonly\" /* IS_READONLY */] = isReadonly;\r\n }\r\n get value() {\r\n if (this._dirty) {\r\n this._value = this.effect();\r\n this._dirty = false;\r\n }\r\n track(toRaw(this), \"get\" /* GET */, 'value');\r\n return this._value;\r\n }\r\n set value(newValue) {\r\n this._setter(newValue);\r\n }\r\n}\r\nfunction computed(getterOrOptions) {\r\n let getter;\r\n let setter;\r\n if (isFunction(getterOrOptions)) {\r\n getter = getterOrOptions;\r\n setter = (process.env.NODE_ENV !== 'production')\r\n ? () => {\r\n console.warn('Write operation failed: computed value is readonly');\r\n }\r\n : NOOP;\r\n }\r\n else {\r\n getter = getterOrOptions.get;\r\n setter = getterOrOptions.set;\r\n }\r\n return new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);\r\n}\n\nexport { ITERATE_KEY, computed, customRef, effect, enableTracking, isProxy, isReactive, isReadonly, isRef, markRaw, pauseTracking, proxyRefs, reactive, readonly, ref, resetTracking, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, track, trigger, triggerRef, unref };\n","import { pauseTracking, resetTracking, isRef, toRaw, shallowReactive, trigger, isReactive, effect, stop, ref, isProxy, proxyRefs, toRef, reactive, shallowReadonly, track, computed as computed$1, isReadonly } from '@vue/reactivity';\nexport { customRef, isProxy, isReactive, isReadonly, isRef, markRaw, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref } from '@vue/reactivity';\nimport { isString, isFunction, isPromise, isArray, extend, EMPTY_OBJ, toHandlerKey, toNumber, hyphenate, camelize, isOn, hasOwn, isModelListener, def, isReservedProp, EMPTY_ARR, isObject, capitalize, toRawType, makeMap, remove, NOOP, hasChanged, isSet, isMap, invokeArrayFns, NO, getGlobalThis, normalizeClass, normalizeStyle, isGloballyWhitelisted } from '@vue/shared';\nexport { camelize, capitalize, toDisplayString, toHandlerKey } from '@vue/shared';\n\nconst stack = [];\r\nfunction pushWarningContext(vnode) {\r\n stack.push(vnode);\r\n}\r\nfunction popWarningContext() {\r\n stack.pop();\r\n}\r\nfunction warn(msg, ...args) {\r\n // avoid props formatting or warn handler tracking deps that might be mutated\r\n // during patch, leading to infinite recursion.\r\n pauseTracking();\r\n const instance = stack.length ? stack[stack.length - 1].component : null;\r\n const appWarnHandler = instance && instance.appContext.config.warnHandler;\r\n const trace = getComponentTrace();\r\n if (appWarnHandler) {\r\n callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [\r\n msg + args.join(''),\r\n instance && instance.proxy,\r\n trace\r\n .map(({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`)\r\n .join('\\n'),\r\n trace\r\n ]);\r\n }\r\n else {\r\n const warnArgs = [`[Vue warn]: ${msg}`, ...args];\r\n /* istanbul ignore if */\r\n if (trace.length &&\r\n // avoid spamming console during tests\r\n !false) {\r\n warnArgs.push(`\\n`, ...formatTrace(trace));\r\n }\r\n console.warn(...warnArgs);\r\n }\r\n resetTracking();\r\n}\r\nfunction getComponentTrace() {\r\n let currentVNode = stack[stack.length - 1];\r\n if (!currentVNode) {\r\n return [];\r\n }\r\n // we can't just use the stack because it will be incomplete during updates\r\n // that did not start from the root. Re-construct the parent chain using\r\n // instance parent pointers.\r\n const normalizedStack = [];\r\n while (currentVNode) {\r\n const last = normalizedStack[0];\r\n if (last && last.vnode === currentVNode) {\r\n last.recurseCount++;\r\n }\r\n else {\r\n normalizedStack.push({\r\n vnode: currentVNode,\r\n recurseCount: 0\r\n });\r\n }\r\n const parentInstance = currentVNode.component && currentVNode.component.parent;\r\n currentVNode = parentInstance && parentInstance.vnode;\r\n }\r\n return normalizedStack;\r\n}\r\n/* istanbul ignore next */\r\nfunction formatTrace(trace) {\r\n const logs = [];\r\n trace.forEach((entry, i) => {\r\n logs.push(...(i === 0 ? [] : [`\\n`]), ...formatTraceEntry(entry));\r\n });\r\n return logs;\r\n}\r\nfunction formatTraceEntry({ vnode, recurseCount }) {\r\n const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;\r\n const isRoot = vnode.component ? vnode.component.parent == null : false;\r\n const open = ` at <${formatComponentName(vnode.component, vnode.type, isRoot)}`;\r\n const close = `>` + postfix;\r\n return vnode.props\r\n ? [open, ...formatProps(vnode.props), close]\r\n : [open + close];\r\n}\r\n/* istanbul ignore next */\r\nfunction formatProps(props) {\r\n const res = [];\r\n const keys = Object.keys(props);\r\n keys.slice(0, 3).forEach(key => {\r\n res.push(...formatProp(key, props[key]));\r\n });\r\n if (keys.length > 3) {\r\n res.push(` ...`);\r\n }\r\n return res;\r\n}\r\n/* istanbul ignore next */\r\nfunction formatProp(key, value, raw) {\r\n if (isString(value)) {\r\n value = JSON.stringify(value);\r\n return raw ? value : [`${key}=${value}`];\r\n }\r\n else if (typeof value === 'number' ||\r\n typeof value === 'boolean' ||\r\n value == null) {\r\n return raw ? value : [`${key}=${value}`];\r\n }\r\n else if (isRef(value)) {\r\n value = formatProp(key, toRaw(value.value), true);\r\n return raw ? value : [`${key}=Ref<`, value, `>`];\r\n }\r\n else if (isFunction(value)) {\r\n return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];\r\n }\r\n else {\r\n value = toRaw(value);\r\n return raw ? value : [`${key}=`, value];\r\n }\r\n}\n\nconst ErrorTypeStrings = {\r\n [\"bc\" /* BEFORE_CREATE */]: 'beforeCreate hook',\r\n [\"c\" /* CREATED */]: 'created hook',\r\n [\"bm\" /* BEFORE_MOUNT */]: 'beforeMount hook',\r\n [\"m\" /* MOUNTED */]: 'mounted hook',\r\n [\"bu\" /* BEFORE_UPDATE */]: 'beforeUpdate hook',\r\n [\"u\" /* UPDATED */]: 'updated',\r\n [\"bum\" /* BEFORE_UNMOUNT */]: 'beforeUnmount hook',\r\n [\"um\" /* UNMOUNTED */]: 'unmounted hook',\r\n [\"a\" /* ACTIVATED */]: 'activated hook',\r\n [\"da\" /* DEACTIVATED */]: 'deactivated hook',\r\n [\"ec\" /* ERROR_CAPTURED */]: 'errorCaptured hook',\r\n [\"rtc\" /* RENDER_TRACKED */]: 'renderTracked hook',\r\n [\"rtg\" /* RENDER_TRIGGERED */]: 'renderTriggered hook',\r\n [0 /* SETUP_FUNCTION */]: 'setup function',\r\n [1 /* RENDER_FUNCTION */]: 'render function',\r\n [2 /* WATCH_GETTER */]: 'watcher getter',\r\n [3 /* WATCH_CALLBACK */]: 'watcher callback',\r\n [4 /* WATCH_CLEANUP */]: 'watcher cleanup function',\r\n [5 /* NATIVE_EVENT_HANDLER */]: 'native event handler',\r\n [6 /* COMPONENT_EVENT_HANDLER */]: 'component event handler',\r\n [7 /* VNODE_HOOK */]: 'vnode hook',\r\n [8 /* DIRECTIVE_HOOK */]: 'directive hook',\r\n [9 /* TRANSITION_HOOK */]: 'transition hook',\r\n [10 /* APP_ERROR_HANDLER */]: 'app errorHandler',\r\n [11 /* APP_WARN_HANDLER */]: 'app warnHandler',\r\n [12 /* FUNCTION_REF */]: 'ref function',\r\n [13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',\r\n [14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +\r\n 'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/vue-next'\r\n};\r\nfunction callWithErrorHandling(fn, instance, type, args) {\r\n let res;\r\n try {\r\n res = args ? fn(...args) : fn();\r\n }\r\n catch (err) {\r\n handleError(err, instance, type);\r\n }\r\n return res;\r\n}\r\nfunction callWithAsyncErrorHandling(fn, instance, type, args) {\r\n if (isFunction(fn)) {\r\n const res = callWithErrorHandling(fn, instance, type, args);\r\n if (res && isPromise(res)) {\r\n res.catch(err => {\r\n handleError(err, instance, type);\r\n });\r\n }\r\n return res;\r\n }\r\n const values = [];\r\n for (let i = 0; i < fn.length; i++) {\r\n values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));\r\n }\r\n return values;\r\n}\r\nfunction handleError(err, instance, type, throwInDev = true) {\r\n const contextVNode = instance ? instance.vnode : null;\r\n if (instance) {\r\n let cur = instance.parent;\r\n // the exposed instance is the render proxy to keep it consistent with 2.x\r\n const exposedInstance = instance.proxy;\r\n // in production the hook receives only the error code\r\n const errorInfo = (process.env.NODE_ENV !== 'production') ? ErrorTypeStrings[type] : type;\r\n while (cur) {\r\n const errorCapturedHooks = cur.ec;\r\n if (errorCapturedHooks) {\r\n for (let i = 0; i < errorCapturedHooks.length; i++) {\r\n if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {\r\n return;\r\n }\r\n }\r\n }\r\n cur = cur.parent;\r\n }\r\n // app-level handling\r\n const appErrorHandler = instance.appContext.config.errorHandler;\r\n if (appErrorHandler) {\r\n callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);\r\n return;\r\n }\r\n }\r\n logError(err, type, contextVNode, throwInDev);\r\n}\r\nfunction logError(err, type, contextVNode, throwInDev = true) {\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n const info = ErrorTypeStrings[type];\r\n if (contextVNode) {\r\n pushWarningContext(contextVNode);\r\n }\r\n warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);\r\n if (contextVNode) {\r\n popWarningContext();\r\n }\r\n // crash in dev by default so it's more noticeable\r\n if (throwInDev) {\r\n throw err;\r\n }\r\n else {\r\n console.error(err);\r\n }\r\n }\r\n else {\r\n // recover in prod to reduce the impact on end-user\r\n console.error(err);\r\n }\r\n}\n\nlet isFlushing = false;\r\nlet isFlushPending = false;\r\nconst queue = [];\r\nlet flushIndex = 0;\r\nconst pendingPreFlushCbs = [];\r\nlet activePreFlushCbs = null;\r\nlet preFlushIndex = 0;\r\nconst pendingPostFlushCbs = [];\r\nlet activePostFlushCbs = null;\r\nlet postFlushIndex = 0;\r\nconst resolvedPromise = Promise.resolve();\r\nlet currentFlushPromise = null;\r\nlet currentPreFlushParentJob = null;\r\nconst RECURSION_LIMIT = 100;\r\nfunction nextTick(fn) {\r\n const p = currentFlushPromise || resolvedPromise;\r\n return fn ? p.then(this ? fn.bind(this) : fn) : p;\r\n}\r\n// #2768\r\n// Use binary-search to find a suitable position in the queue,\r\n// so that the queue maintains the increasing order of job's id,\r\n// which can prevent the job from being skipped and also can avoid repeated patching.\r\nfunction findInsertionIndex(job) {\r\n // the start index should be `flushIndex + 1`\r\n let start = flushIndex + 1;\r\n let end = queue.length;\r\n const jobId = getId(job);\r\n while (start < end) {\r\n const middle = (start + end) >>> 1;\r\n const middleJobId = getId(queue[middle]);\r\n middleJobId < jobId ? (start = middle + 1) : (end = middle);\r\n }\r\n return start;\r\n}\r\nfunction queueJob(job) {\r\n // the dedupe search uses the startIndex argument of Array.includes()\r\n // by default the search index includes the current job that is being run\r\n // so it cannot recursively trigger itself again.\r\n // if the job is a watch() callback, the search will start with a +1 index to\r\n // allow it recursively trigger itself - it is the user's responsibility to\r\n // ensure it doesn't end up in an infinite loop.\r\n if ((!queue.length ||\r\n !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) &&\r\n job !== currentPreFlushParentJob) {\r\n const pos = findInsertionIndex(job);\r\n if (pos > -1) {\r\n queue.splice(pos, 0, job);\r\n }\r\n else {\r\n queue.push(job);\r\n }\r\n queueFlush();\r\n }\r\n}\r\nfunction queueFlush() {\r\n if (!isFlushing && !isFlushPending) {\r\n isFlushPending = true;\r\n currentFlushPromise = resolvedPromise.then(flushJobs);\r\n }\r\n}\r\nfunction invalidateJob(job) {\r\n const i = queue.indexOf(job);\r\n if (i > -1) {\r\n queue.splice(i, 1);\r\n }\r\n}\r\nfunction queueCb(cb, activeQueue, pendingQueue, index) {\r\n if (!isArray(cb)) {\r\n if (!activeQueue ||\r\n !activeQueue.includes(cb, cb.allowRecurse ? index + 1 : index)) {\r\n pendingQueue.push(cb);\r\n }\r\n }\r\n else {\r\n // if cb is an array, it is a component lifecycle hook which can only be\r\n // triggered by a job, which is already deduped in the main queue, so\r\n // we can skip duplicate check here to improve perf\r\n pendingQueue.push(...cb);\r\n }\r\n queueFlush();\r\n}\r\nfunction queuePreFlushCb(cb) {\r\n queueCb(cb, activePreFlushCbs, pendingPreFlushCbs, preFlushIndex);\r\n}\r\nfunction queuePostFlushCb(cb) {\r\n queueCb(cb, activePostFlushCbs, pendingPostFlushCbs, postFlushIndex);\r\n}\r\nfunction flushPreFlushCbs(seen, parentJob = null) {\r\n if (pendingPreFlushCbs.length) {\r\n currentPreFlushParentJob = parentJob;\r\n activePreFlushCbs = [...new Set(pendingPreFlushCbs)];\r\n pendingPreFlushCbs.length = 0;\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n seen = seen || new Map();\r\n }\r\n for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n checkRecursiveUpdates(seen, activePreFlushCbs[preFlushIndex]);\r\n }\r\n activePreFlushCbs[preFlushIndex]();\r\n }\r\n activePreFlushCbs = null;\r\n preFlushIndex = 0;\r\n currentPreFlushParentJob = null;\r\n // recursively flush until it drains\r\n flushPreFlushCbs(seen, parentJob);\r\n }\r\n}\r\nfunction flushPostFlushCbs(seen) {\r\n if (pendingPostFlushCbs.length) {\r\n const deduped = [...new Set(pendingPostFlushCbs)];\r\n pendingPostFlushCbs.length = 0;\r\n // #1947 already has active queue, nested flushPostFlushCbs call\r\n if (activePostFlushCbs) {\r\n activePostFlushCbs.push(...deduped);\r\n return;\r\n }\r\n activePostFlushCbs = deduped;\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n seen = seen || new Map();\r\n }\r\n activePostFlushCbs.sort((a, b) => getId(a) - getId(b));\r\n for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex]);\r\n }\r\n activePostFlushCbs[postFlushIndex]();\r\n }\r\n activePostFlushCbs = null;\r\n postFlushIndex = 0;\r\n }\r\n}\r\nconst getId = (job) => job.id == null ? Infinity : job.id;\r\nfunction flushJobs(seen) {\r\n isFlushPending = false;\r\n isFlushing = true;\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n seen = seen || new Map();\r\n }\r\n flushPreFlushCbs(seen);\r\n // Sort queue before flush.\r\n // This ensures that:\r\n // 1. Components are updated from parent to child. (because parent is always\r\n // created before the child so its render effect will have smaller\r\n // priority number)\r\n // 2. If a component is unmounted during a parent component's update,\r\n // its update can be skipped.\r\n queue.sort((a, b) => getId(a) - getId(b));\r\n try {\r\n for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {\r\n const job = queue[flushIndex];\r\n if (job) {\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n checkRecursiveUpdates(seen, job);\r\n }\r\n callWithErrorHandling(job, null, 14 /* SCHEDULER */);\r\n }\r\n }\r\n }\r\n finally {\r\n flushIndex = 0;\r\n queue.length = 0;\r\n flushPostFlushCbs(seen);\r\n isFlushing = false;\r\n currentFlushPromise = null;\r\n // some postFlushCb queued jobs!\r\n // keep flushing until it drains.\r\n if (queue.length || pendingPostFlushCbs.length) {\r\n flushJobs(seen);\r\n }\r\n }\r\n}\r\nfunction checkRecursiveUpdates(seen, fn) {\r\n if (!seen.has(fn)) {\r\n seen.set(fn, 1);\r\n }\r\n else {\r\n const count = seen.get(fn);\r\n if (count > RECURSION_LIMIT) {\r\n throw new Error(`Maximum recursive updates exceeded. ` +\r\n `This means you have a reactive effect that is mutating its own ` +\r\n `dependencies and thus recursively triggering itself. Possible sources ` +\r\n `include component template, render function, updated hook or ` +\r\n `watcher source function.`);\r\n }\r\n else {\r\n seen.set(fn, count + 1);\r\n }\r\n }\r\n}\n\n/* eslint-disable no-restricted-globals */\r\nlet isHmrUpdating = false;\r\nconst hmrDirtyComponents = new Set();\r\n// Expose the HMR runtime on the global object\r\n// This makes it entirely tree-shakable without polluting the exports and makes\r\n// it easier to be used in toolings like vue-loader\r\n// Note: for a component to be eligible for HMR it also needs the __hmrId option\r\n// to be set so that its instances can be registered / removed.\r\nif ((process.env.NODE_ENV !== 'production')) {\r\n const globalObject = typeof global !== 'undefined'\r\n ? global\r\n : typeof self !== 'undefined'\r\n ? self\r\n : typeof window !== 'undefined'\r\n ? window\r\n : {};\r\n globalObject.__VUE_HMR_RUNTIME__ = {\r\n createRecord: tryWrap(createRecord),\r\n rerender: tryWrap(rerender),\r\n reload: tryWrap(reload)\r\n };\r\n}\r\nconst map = new Map();\r\nfunction registerHMR(instance) {\r\n const id = instance.type.__hmrId;\r\n let record = map.get(id);\r\n if (!record) {\r\n createRecord(id, instance.type);\r\n record = map.get(id);\r\n }\r\n record.instances.add(instance);\r\n}\r\nfunction unregisterHMR(instance) {\r\n map.get(instance.type.__hmrId).instances.delete(instance);\r\n}\r\nfunction createRecord(id, component) {\r\n if (!component) {\r\n warn(`HMR API usage is out of date.\\n` +\r\n `Please upgrade vue-loader/vite/rollup-plugin-vue or other relevant ` +\r\n `dependency that handles Vue SFC compilation.`);\r\n component = {};\r\n }\r\n if (map.has(id)) {\r\n return false;\r\n }\r\n map.set(id, {\r\n component: isClassComponent(component) ? component.__vccOpts : component,\r\n instances: new Set()\r\n });\r\n return true;\r\n}\r\nfunction rerender(id, newRender) {\r\n const record = map.get(id);\r\n if (!record)\r\n return;\r\n if (newRender)\r\n record.component.render = newRender;\r\n // Array.from creates a snapshot which avoids the set being mutated during\r\n // updates\r\n Array.from(record.instances).forEach(instance => {\r\n if (newRender) {\r\n instance.render = newRender;\r\n }\r\n instance.renderCache = [];\r\n // this flag forces child components with slot content to update\r\n isHmrUpdating = true;\r\n instance.update();\r\n isHmrUpdating = false;\r\n });\r\n}\r\nfunction reload(id, newComp) {\r\n const record = map.get(id);\r\n if (!record)\r\n return;\r\n // Array.from creates a snapshot which avoids the set being mutated during\r\n // updates\r\n const { component, instances } = record;\r\n if (!hmrDirtyComponents.has(component)) {\r\n // 1. Update existing comp definition to match new one\r\n newComp = isClassComponent(newComp) ? newComp.__vccOpts : newComp;\r\n extend(component, newComp);\r\n for (const key in component) {\r\n if (!(key in newComp)) {\r\n delete component[key];\r\n }\r\n }\r\n // 2. Mark component dirty. This forces the renderer to replace the component\r\n // on patch.\r\n hmrDirtyComponents.add(component);\r\n // 3. Make sure to unmark the component after the reload.\r\n queuePostFlushCb(() => {\r\n hmrDirtyComponents.delete(component);\r\n });\r\n }\r\n Array.from(instances).forEach(instance => {\r\n if (instance.parent) {\r\n // 4. Force the parent instance to re-render. This will cause all updated\r\n // components to be unmounted and re-mounted. Queue the update so that we\r\n // don't end up forcing the same parent to re-render multiple times.\r\n queueJob(instance.parent.update);\r\n }\r\n else if (instance.appContext.reload) {\r\n // root instance mounted via createApp() has a reload method\r\n instance.appContext.reload();\r\n }\r\n else if (typeof window !== 'undefined') {\r\n // root instance inside tree created via raw render(). Force reload.\r\n window.location.reload();\r\n }\r\n else {\r\n console.warn('[HMR] Root or manually mounted instance modified. Full reload required.');\r\n }\r\n });\r\n}\r\nfunction tryWrap(fn) {\r\n return (id, arg) => {\r\n try {\r\n return fn(id, arg);\r\n }\r\n catch (e) {\r\n console.error(e);\r\n console.warn(`[HMR] Something went wrong during Vue component hot-reload. ` +\r\n `Full reload required.`);\r\n }\r\n };\r\n}\n\nlet devtools;\r\nfunction setDevtoolsHook(hook) {\r\n devtools = hook;\r\n}\r\nfunction devtoolsInitApp(app, version) {\r\n // TODO queue if devtools is undefined\r\n if (!devtools)\r\n return;\r\n devtools.emit(\"app:init\" /* APP_INIT */, app, version, {\r\n Fragment,\r\n Text,\r\n Comment,\r\n Static\r\n });\r\n}\r\nfunction devtoolsUnmountApp(app) {\r\n if (!devtools)\r\n return;\r\n devtools.emit(\"app:unmount\" /* APP_UNMOUNT */, app);\r\n}\r\nconst devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook(\"component:added\" /* COMPONENT_ADDED */);\r\nconst devtoolsComponentUpdated = /*#__PURE__*/ createDevtoolsComponentHook(\"component:updated\" /* COMPONENT_UPDATED */);\r\nconst devtoolsComponentRemoved = /*#__PURE__*/ createDevtoolsComponentHook(\"component:removed\" /* COMPONENT_REMOVED */);\r\nfunction createDevtoolsComponentHook(hook) {\r\n return (component) => {\r\n if (!devtools)\r\n return;\r\n devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);\r\n };\r\n}\r\nfunction devtoolsComponentEmit(component, event, params) {\r\n if (!devtools)\r\n return;\r\n devtools.emit(\"component:emit\" /* COMPONENT_EMIT */, component.appContext.app, component, event, params);\r\n}\n\nfunction emit(instance, event, ...rawArgs) {\r\n const props = instance.vnode.props || EMPTY_OBJ;\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n const { emitsOptions, propsOptions: [propsOptions] } = instance;\r\n if (emitsOptions) {\r\n if (!(event in emitsOptions)) {\r\n if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {\r\n warn(`Component emitted event \"${event}\" but it is neither declared in ` +\r\n `the emits option nor as an \"${toHandlerKey(event)}\" prop.`);\r\n }\r\n }\r\n else {\r\n const validator = emitsOptions[event];\r\n if (isFunction(validator)) {\r\n const isValid = validator(...rawArgs);\r\n if (!isValid) {\r\n warn(`Invalid event arguments: event validation failed for event \"${event}\".`);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n let args = rawArgs;\r\n const isModelListener = event.startsWith('update:');\r\n // for v-model update:xxx events, apply modifiers on args\r\n const modelArg = isModelListener && event.slice(7);\r\n if (modelArg && modelArg in props) {\r\n const modifiersKey = `${modelArg === 'modelValue' ? 'model' : modelArg}Modifiers`;\r\n const { number, trim } = props[modifiersKey] || EMPTY_OBJ;\r\n if (trim) {\r\n args = rawArgs.map(a => a.trim());\r\n }\r\n else if (number) {\r\n args = rawArgs.map(toNumber);\r\n }\r\n }\r\n if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {\r\n devtoolsComponentEmit(instance, event, args);\r\n }\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n const lowerCaseEvent = event.toLowerCase();\r\n if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {\r\n warn(`Event \"${lowerCaseEvent}\" is emitted in component ` +\r\n `${formatComponentName(instance, instance.type)} but the handler is registered for \"${event}\". ` +\r\n `Note that HTML attributes are case-insensitive and you cannot use ` +\r\n `v-on to listen to camelCase events when using in-DOM templates. ` +\r\n `You should probably use \"${hyphenate(event)}\" instead of \"${event}\".`);\r\n }\r\n }\r\n // convert handler name to camelCase. See issue #2249\r\n let handlerName = toHandlerKey(camelize(event));\r\n let handler = props[handlerName];\r\n // for v-model update:xxx events, also trigger kebab-case equivalent\r\n // for props passed via kebab-case\r\n if (!handler && isModelListener) {\r\n handlerName = toHandlerKey(hyphenate(event));\r\n handler = props[handlerName];\r\n }\r\n if (handler) {\r\n callWithAsyncErrorHandling(handler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);\r\n }\r\n const onceHandler = props[handlerName + `Once`];\r\n if (onceHandler) {\r\n if (!instance.emitted) {\r\n (instance.emitted = {})[handlerName] = true;\r\n }\r\n else if (instance.emitted[handlerName]) {\r\n return;\r\n }\r\n callWithAsyncErrorHandling(onceHandler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);\r\n }\r\n}\r\nfunction normalizeEmitsOptions(comp, appContext, asMixin = false) {\r\n if (!appContext.deopt && comp.__emits !== undefined) {\r\n return comp.__emits;\r\n }\r\n const raw = comp.emits;\r\n let normalized = {};\r\n // apply mixin/extends props\r\n let hasExtends = false;\r\n if (__VUE_OPTIONS_API__ && !isFunction(comp)) {\r\n const extendEmits = (raw) => {\r\n hasExtends = true;\r\n extend(normalized, normalizeEmitsOptions(raw, appContext, true));\r\n };\r\n if (!asMixin && appContext.mixins.length) {\r\n appContext.mixins.forEach(extendEmits);\r\n }\r\n if (comp.extends) {\r\n extendEmits(comp.extends);\r\n }\r\n if (comp.mixins) {\r\n comp.mixins.forEach(extendEmits);\r\n }\r\n }\r\n if (!raw && !hasExtends) {\r\n return (comp.__emits = null);\r\n }\r\n if (isArray(raw)) {\r\n raw.forEach(key => (normalized[key] = null));\r\n }\r\n else {\r\n extend(normalized, raw);\r\n }\r\n return (comp.__emits = normalized);\r\n}\r\n// Check if an incoming prop key is a declared emit event listener.\r\n// e.g. With `emits: { click: null }`, props named `onClick` and `onclick` are\r\n// both considered matched listeners.\r\nfunction isEmitListener(options, key) {\r\n if (!options || !isOn(key)) {\r\n return false;\r\n }\r\n key = key.slice(2).replace(/Once$/, '');\r\n return (hasOwn(options, key[0].toLowerCase() + key.slice(1)) ||\r\n hasOwn(options, hyphenate(key)) ||\r\n hasOwn(options, key));\r\n}\n\n/**\r\n * mark the current rendering instance for asset resolution (e.g.\r\n * resolveComponent, resolveDirective) during render\r\n */\r\nlet currentRenderingInstance = null;\r\nfunction setCurrentRenderingInstance(instance) {\r\n currentRenderingInstance = instance;\r\n}\r\n/**\r\n * dev only flag to track whether $attrs was used during render.\r\n * If $attrs was used during render then the warning for failed attrs\r\n * fallthrough can be suppressed.\r\n */\r\nlet accessedAttrs = false;\r\nfunction markAttrsAccessed() {\r\n accessedAttrs = true;\r\n}\r\nfunction renderComponentRoot(instance) {\r\n const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx } = instance;\r\n let result;\r\n currentRenderingInstance = instance;\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n accessedAttrs = false;\r\n }\r\n try {\r\n let fallthroughAttrs;\r\n if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {\r\n // withProxy is a proxy with a different `has` trap only for\r\n // runtime-compiled render functions using `with` block.\r\n const proxyToUse = withProxy || proxy;\r\n result = normalizeVNode(render.call(proxyToUse, proxyToUse, renderCache, props, setupState, data, ctx));\r\n fallthroughAttrs = attrs;\r\n }\r\n else {\r\n // functional\r\n const render = Component;\r\n // in dev, mark attrs accessed if optional props (attrs === props)\r\n if ((process.env.NODE_ENV !== 'production') && attrs === props) {\r\n markAttrsAccessed();\r\n }\r\n result = normalizeVNode(render.length > 1\r\n ? render(props, (process.env.NODE_ENV !== 'production')\r\n ? {\r\n get attrs() {\r\n markAttrsAccessed();\r\n return attrs;\r\n },\r\n slots,\r\n emit\r\n }\r\n : { attrs, slots, emit })\r\n : render(props, null /* we know it doesn't need it */));\r\n fallthroughAttrs = Component.props\r\n ? attrs\r\n : getFunctionalFallthrough(attrs);\r\n }\r\n // attr merging\r\n // in dev mode, comments are preserved, and it's possible for a template\r\n // to have comments along side the root element which makes it a fragment\r\n let root = result;\r\n let setRoot = undefined;\r\n if ((process.env.NODE_ENV !== 'production') &&\r\n result.patchFlag > 0 &&\r\n result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {\r\n ;\r\n [root, setRoot] = getChildRoot(result);\r\n }\r\n if (Component.inheritAttrs !== false && fallthroughAttrs) {\r\n const keys = Object.keys(fallthroughAttrs);\r\n const { shapeFlag } = root;\r\n if (keys.length) {\r\n if (shapeFlag & 1 /* ELEMENT */ ||\r\n shapeFlag & 6 /* COMPONENT */) {\r\n if (propsOptions && keys.some(isModelListener)) {\r\n // If a v-model listener (onUpdate:xxx) has a corresponding declared\r\n // prop, it indicates this component expects to handle v-model and\r\n // it should not fallthrough.\r\n // related: #1543, #1643, #1989\r\n fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);\r\n }\r\n root = cloneVNode(root, fallthroughAttrs);\r\n }\r\n else if ((process.env.NODE_ENV !== 'production') && !accessedAttrs && root.type !== Comment) {\r\n const allAttrs = Object.keys(attrs);\r\n const eventAttrs = [];\r\n const extraAttrs = [];\r\n for (let i = 0, l = allAttrs.length; i < l; i++) {\r\n const key = allAttrs[i];\r\n if (isOn(key)) {\r\n // ignore v-model handlers when they fail to fallthrough\r\n if (!isModelListener(key)) {\r\n // remove `on`, lowercase first letter to reflect event casing\r\n // accurately\r\n eventAttrs.push(key[2].toLowerCase() + key.slice(3));\r\n }\r\n }\r\n else {\r\n extraAttrs.push(key);\r\n }\r\n }\r\n if (extraAttrs.length) {\r\n warn(`Extraneous non-props attributes (` +\r\n `${extraAttrs.join(', ')}) ` +\r\n `were passed to component but could not be automatically inherited ` +\r\n `because component renders fragment or text root nodes.`);\r\n }\r\n if (eventAttrs.length) {\r\n warn(`Extraneous non-emits event listeners (` +\r\n `${eventAttrs.join(', ')}) ` +\r\n `were passed to component but could not be automatically inherited ` +\r\n `because component renders fragment or text root nodes. ` +\r\n `If the listener is intended to be a component custom event listener only, ` +\r\n `declare it using the \"emits\" option.`);\r\n }\r\n }\r\n }\r\n }\r\n // inherit directives\r\n if (vnode.dirs) {\r\n if ((process.env.NODE_ENV !== 'production') && !isElementRoot(root)) {\r\n warn(`Runtime directive used on component with non-element root node. ` +\r\n `The directives will not function as intended.`);\r\n }\r\n root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;\r\n }\r\n // inherit transition data\r\n if (vnode.transition) {\r\n if ((process.env.NODE_ENV !== 'production') && !isElementRoot(root)) {\r\n warn(`Component inside renders non-element root node ` +\r\n `that cannot be animated.`);\r\n }\r\n root.transition = vnode.transition;\r\n }\r\n if ((process.env.NODE_ENV !== 'production') && setRoot) {\r\n setRoot(root);\r\n }\r\n else {\r\n result = root;\r\n }\r\n }\r\n catch (err) {\r\n handleError(err, instance, 1 /* RENDER_FUNCTION */);\r\n result = createVNode(Comment);\r\n }\r\n currentRenderingInstance = null;\r\n return result;\r\n}\r\n/**\r\n * dev only\r\n * In dev mode, template root level comments are rendered, which turns the\r\n * template into a fragment root, but we need to locate the single element\r\n * root for attrs and scope id processing.\r\n */\r\nconst getChildRoot = (vnode) => {\r\n const rawChildren = vnode.children;\r\n const dynamicChildren = vnode.dynamicChildren;\r\n const childRoot = filterSingleRoot(rawChildren);\r\n if (!childRoot) {\r\n return [vnode, undefined];\r\n }\r\n const index = rawChildren.indexOf(childRoot);\r\n const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;\r\n const setRoot = (updatedRoot) => {\r\n rawChildren[index] = updatedRoot;\r\n if (dynamicChildren) {\r\n if (dynamicIndex > -1) {\r\n dynamicChildren[dynamicIndex] = updatedRoot;\r\n }\r\n else if (updatedRoot.patchFlag > 0) {\r\n vnode.dynamicChildren = [...dynamicChildren, updatedRoot];\r\n }\r\n }\r\n };\r\n return [normalizeVNode(childRoot), setRoot];\r\n};\r\nfunction filterSingleRoot(children) {\r\n let singleRoot;\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n if (isVNode(child)) {\r\n // ignore user comment\r\n if (child.type !== Comment || child.children === 'v-if') {\r\n if (singleRoot) {\r\n // has more than 1 non-comment child, return now\r\n return;\r\n }\r\n else {\r\n singleRoot = child;\r\n }\r\n }\r\n }\r\n else {\r\n return;\r\n }\r\n }\r\n return singleRoot;\r\n}\r\nconst getFunctionalFallthrough = (attrs) => {\r\n let res;\r\n for (const key in attrs) {\r\n if (key === 'class' || key === 'style' || isOn(key)) {\r\n (res || (res = {}))[key] = attrs[key];\r\n }\r\n }\r\n return res;\r\n};\r\nconst filterModelListeners = (attrs, props) => {\r\n const res = {};\r\n for (const key in attrs) {\r\n if (!isModelListener(key) || !(key.slice(9) in props)) {\r\n res[key] = attrs[key];\r\n }\r\n }\r\n return res;\r\n};\r\nconst isElementRoot = (vnode) => {\r\n return (vnode.shapeFlag & 6 /* COMPONENT */ ||\r\n vnode.shapeFlag & 1 /* ELEMENT */ ||\r\n vnode.type === Comment // potential v-if branch switch\r\n );\r\n};\r\nfunction shouldUpdateComponent(prevVNode, nextVNode, optimized) {\r\n const { props: prevProps, children: prevChildren, component } = prevVNode;\r\n const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;\r\n const emits = component.emitsOptions;\r\n // Parent component's render function was hot-updated. Since this may have\r\n // caused the child component's slots content to have changed, we need to\r\n // force the child to update as well.\r\n if ((process.env.NODE_ENV !== 'production') && (prevChildren || nextChildren) && isHmrUpdating) {\r\n return true;\r\n }\r\n // force child update for runtime directive or transition on component vnode.\r\n if (nextVNode.dirs || nextVNode.transition) {\r\n return true;\r\n }\r\n if (optimized && patchFlag >= 0) {\r\n if (patchFlag & 1024 /* DYNAMIC_SLOTS */) {\r\n // slot content that references values that might have changed,\r\n // e.g. in a v-for\r\n return true;\r\n }\r\n if (patchFlag & 16 /* FULL_PROPS */) {\r\n if (!prevProps) {\r\n return !!nextProps;\r\n }\r\n // presence of this flag indicates props are always non-null\r\n return hasPropsChanged(prevProps, nextProps, emits);\r\n }\r\n else if (patchFlag & 8 /* PROPS */) {\r\n const dynamicProps = nextVNode.dynamicProps;\r\n for (let i = 0; i < dynamicProps.length; i++) {\r\n const key = dynamicProps[i];\r\n if (nextProps[key] !== prevProps[key] &&\r\n !isEmitListener(emits, key)) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n // this path is only taken by manually written render functions\r\n // so presence of any children leads to a forced update\r\n if (prevChildren || nextChildren) {\r\n if (!nextChildren || !nextChildren.$stable) {\r\n return true;\r\n }\r\n }\r\n if (prevProps === nextProps) {\r\n return false;\r\n }\r\n if (!prevProps) {\r\n return !!nextProps;\r\n }\r\n if (!nextProps) {\r\n return true;\r\n }\r\n return hasPropsChanged(prevProps, nextProps, emits);\r\n }\r\n return false;\r\n}\r\nfunction hasPropsChanged(prevProps, nextProps, emitsOptions) {\r\n const nextKeys = Object.keys(nextProps);\r\n if (nextKeys.length !== Object.keys(prevProps).length) {\r\n return true;\r\n }\r\n for (let i = 0; i < nextKeys.length; i++) {\r\n const key = nextKeys[i];\r\n if (nextProps[key] !== prevProps[key] &&\r\n !isEmitListener(emitsOptions, key)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\nfunction updateHOCHostEl({ vnode, parent }, el // HostNode\r\n) {\r\n while (parent && parent.subTree === vnode) {\r\n (vnode = parent.vnode).el = el;\r\n parent = parent.parent;\r\n }\r\n}\n\nconst isSuspense = (type) => type.__isSuspense;\r\n// Suspense exposes a component-like API, and is treated like a component\r\n// in the compiler, but internally it's a special built-in type that hooks\r\n// directly into the renderer.\r\nconst SuspenseImpl = {\r\n // In order to make Suspense tree-shakable, we need to avoid importing it\r\n // directly in the renderer. The renderer checks for the __isSuspense flag\r\n // on a vnode's type and calls the `process` method, passing in renderer\r\n // internals.\r\n __isSuspense: true,\r\n process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized, \r\n // platform-specific impl passed from renderer\r\n rendererInternals) {\r\n if (n1 == null) {\r\n mountSuspense(n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized, rendererInternals);\r\n }\r\n else {\r\n patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, rendererInternals);\r\n }\r\n },\r\n hydrate: hydrateSuspense,\r\n create: createSuspenseBoundary\r\n};\r\n// Force-casted public typing for h and TSX props inference\r\nconst Suspense = (SuspenseImpl\r\n );\r\nfunction mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, optimized, rendererInternals) {\r\n const { p: patch, o: { createElement } } = rendererInternals;\r\n const hiddenContainer = createElement('div');\r\n const suspense = (vnode.suspense = createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, optimized, rendererInternals));\r\n // start mounting the content subtree in an off-dom container\r\n patch(null, (suspense.pendingBranch = vnode.ssContent), hiddenContainer, null, parentComponent, suspense, isSVG);\r\n // now check if we have encountered any async deps\r\n if (suspense.deps > 0) {\r\n // has async\r\n // mount the fallback tree\r\n patch(null, vnode.ssFallback, container, anchor, parentComponent, null, // fallback tree will not have suspense context\r\n isSVG);\r\n setActiveBranch(suspense, vnode.ssFallback);\r\n }\r\n else {\r\n // Suspense has no async deps. Just resolve.\r\n suspense.resolve();\r\n }\r\n}\r\nfunction patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, { p: patch, um: unmount, o: { createElement } }) {\r\n const suspense = (n2.suspense = n1.suspense);\r\n suspense.vnode = n2;\r\n n2.el = n1.el;\r\n const newBranch = n2.ssContent;\r\n const newFallback = n2.ssFallback;\r\n const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;\r\n if (pendingBranch) {\r\n suspense.pendingBranch = newBranch;\r\n if (isSameVNodeType(newBranch, pendingBranch)) {\r\n // same root type but content may have changed.\r\n patch(pendingBranch, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG);\r\n if (suspense.deps <= 0) {\r\n suspense.resolve();\r\n }\r\n else if (isInFallback) {\r\n patch(activeBranch, newFallback, container, anchor, parentComponent, null, // fallback tree will not have suspense context\r\n isSVG);\r\n setActiveBranch(suspense, newFallback);\r\n }\r\n }\r\n else {\r\n // toggled before pending tree is resolved\r\n suspense.pendingId++;\r\n if (isHydrating) {\r\n // if toggled before hydration is finished, the current DOM tree is\r\n // no longer valid. set it as the active branch so it will be unmounted\r\n // when resolved\r\n suspense.isHydrating = false;\r\n suspense.activeBranch = pendingBranch;\r\n }\r\n else {\r\n unmount(pendingBranch, parentComponent, suspense);\r\n }\r\n // increment pending ID. this is used to invalidate async callbacks\r\n // reset suspense state\r\n suspense.deps = 0;\r\n // discard effects from pending branch\r\n suspense.effects.length = 0;\r\n // discard previous container\r\n suspense.hiddenContainer = createElement('div');\r\n if (isInFallback) {\r\n // already in fallback state\r\n patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG);\r\n if (suspense.deps <= 0) {\r\n suspense.resolve();\r\n }\r\n else {\r\n patch(activeBranch, newFallback, container, anchor, parentComponent, null, // fallback tree will not have suspense context\r\n isSVG);\r\n setActiveBranch(suspense, newFallback);\r\n }\r\n }\r\n else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {\r\n // toggled \"back\" to current active branch\r\n patch(activeBranch, newBranch, container, anchor, parentComponent, suspense, isSVG);\r\n // force resolve\r\n suspense.resolve(true);\r\n }\r\n else {\r\n // switched to a 3rd branch\r\n patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG);\r\n if (suspense.deps <= 0) {\r\n suspense.resolve();\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {\r\n // root did not change, just normal patch\r\n patch(activeBranch, newBranch, container, anchor, parentComponent, suspense, isSVG);\r\n setActiveBranch(suspense, newBranch);\r\n }\r\n else {\r\n // root node toggled\r\n // invoke @pending event\r\n const onPending = n2.props && n2.props.onPending;\r\n if (isFunction(onPending)) {\r\n onPending();\r\n }\r\n // mount pending branch in off-dom container\r\n suspense.pendingBranch = newBranch;\r\n suspense.pendingId++;\r\n patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG);\r\n if (suspense.deps <= 0) {\r\n // incoming branch has no async deps, resolve now.\r\n suspense.resolve();\r\n }\r\n else {\r\n const { timeout, pendingId } = suspense;\r\n if (timeout > 0) {\r\n setTimeout(() => {\r\n if (suspense.pendingId === pendingId) {\r\n suspense.fallback(newFallback);\r\n }\r\n }, timeout);\r\n }\r\n else if (timeout === 0) {\r\n suspense.fallback(newFallback);\r\n }\r\n }\r\n }\r\n }\r\n}\r\nlet hasWarned = false;\r\nfunction createSuspenseBoundary(vnode, parent, parentComponent, container, hiddenContainer, anchor, isSVG, optimized, rendererInternals, isHydrating = false) {\r\n /* istanbul ignore if */\r\n if ((process.env.NODE_ENV !== 'production') && !false && !hasWarned) {\r\n hasWarned = true;\r\n // @ts-ignore `console.info` cannot be null error\r\n console[console.info ? 'info' : 'log'](` is an experimental feature and its API will likely change.`);\r\n }\r\n const { p: patch, m: move, um: unmount, n: next, o: { parentNode, remove } } = rendererInternals;\r\n const timeout = toNumber(vnode.props && vnode.props.timeout);\r\n const suspense = {\r\n vnode,\r\n parent,\r\n parentComponent,\r\n isSVG,\r\n container,\r\n hiddenContainer,\r\n anchor,\r\n deps: 0,\r\n pendingId: 0,\r\n timeout: typeof timeout === 'number' ? timeout : -1,\r\n activeBranch: null,\r\n pendingBranch: null,\r\n isInFallback: true,\r\n isHydrating,\r\n isUnmounted: false,\r\n effects: [],\r\n resolve(resume = false) {\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n if (!resume && !suspense.pendingBranch) {\r\n throw new Error(`suspense.resolve() is called without a pending branch.`);\r\n }\r\n if (suspense.isUnmounted) {\r\n throw new Error(`suspense.resolve() is called on an already unmounted suspense boundary.`);\r\n }\r\n }\r\n const { vnode, activeBranch, pendingBranch, pendingId, effects, parentComponent, container } = suspense;\r\n if (suspense.isHydrating) {\r\n suspense.isHydrating = false;\r\n }\r\n else if (!resume) {\r\n const delayEnter = activeBranch &&\r\n pendingBranch.transition &&\r\n pendingBranch.transition.mode === 'out-in';\r\n if (delayEnter) {\r\n activeBranch.transition.afterLeave = () => {\r\n if (pendingId === suspense.pendingId) {\r\n move(pendingBranch, container, anchor, 0 /* ENTER */);\r\n }\r\n };\r\n }\r\n // this is initial anchor on mount\r\n let { anchor } = suspense;\r\n // unmount current active tree\r\n if (activeBranch) {\r\n // if the fallback tree was mounted, it may have been moved\r\n // as part of a parent suspense. get the latest anchor for insertion\r\n anchor = next(activeBranch);\r\n unmount(activeBranch, parentComponent, suspense, true);\r\n }\r\n if (!delayEnter) {\r\n // move content from off-dom container to actual container\r\n move(pendingBranch, container, anchor, 0 /* ENTER */);\r\n }\r\n }\r\n setActiveBranch(suspense, pendingBranch);\r\n suspense.pendingBranch = null;\r\n suspense.isInFallback = false;\r\n // flush buffered effects\r\n // check if there is a pending parent suspense\r\n let parent = suspense.parent;\r\n let hasUnresolvedAncestor = false;\r\n while (parent) {\r\n if (parent.pendingBranch) {\r\n // found a pending parent suspense, merge buffered post jobs\r\n // into that parent\r\n parent.effects.push(...effects);\r\n hasUnresolvedAncestor = true;\r\n break;\r\n }\r\n parent = parent.parent;\r\n }\r\n // no pending parent suspense, flush all jobs\r\n if (!hasUnresolvedAncestor) {\r\n queuePostFlushCb(effects);\r\n }\r\n suspense.effects = [];\r\n // invoke @resolve event\r\n const onResolve = vnode.props && vnode.props.onResolve;\r\n if (isFunction(onResolve)) {\r\n onResolve();\r\n }\r\n },\r\n fallback(fallbackVNode) {\r\n if (!suspense.pendingBranch) {\r\n return;\r\n }\r\n const { vnode, activeBranch, parentComponent, container, isSVG } = suspense;\r\n // invoke @fallback event\r\n const onFallback = vnode.props && vnode.props.onFallback;\r\n if (isFunction(onFallback)) {\r\n onFallback();\r\n }\r\n const anchor = next(activeBranch);\r\n const mountFallback = () => {\r\n if (!suspense.isInFallback) {\r\n return;\r\n }\r\n // mount the fallback tree\r\n patch(null, fallbackVNode, container, anchor, parentComponent, null, // fallback tree will not have suspense context\r\n isSVG);\r\n setActiveBranch(suspense, fallbackVNode);\r\n };\r\n const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === 'out-in';\r\n if (delayEnter) {\r\n activeBranch.transition.afterLeave = mountFallback;\r\n }\r\n // unmount current active branch\r\n unmount(activeBranch, parentComponent, null, // no suspense so unmount hooks fire now\r\n true // shouldRemove\r\n );\r\n suspense.isInFallback = true;\r\n if (!delayEnter) {\r\n mountFallback();\r\n }\r\n },\r\n move(container, anchor, type) {\r\n suspense.activeBranch &&\r\n move(suspense.activeBranch, container, anchor, type);\r\n suspense.container = container;\r\n },\r\n next() {\r\n return suspense.activeBranch && next(suspense.activeBranch);\r\n },\r\n registerDep(instance, setupRenderEffect) {\r\n const isInPendingSuspense = !!suspense.pendingBranch;\r\n if (isInPendingSuspense) {\r\n suspense.deps++;\r\n }\r\n const hydratedEl = instance.vnode.el;\r\n instance\r\n .asyncDep.catch(err => {\r\n handleError(err, instance, 0 /* SETUP_FUNCTION */);\r\n })\r\n .then(asyncSetupResult => {\r\n // retry when the setup() promise resolves.\r\n // component may have been unmounted before resolve.\r\n if (instance.isUnmounted ||\r\n suspense.isUnmounted ||\r\n suspense.pendingId !== instance.suspenseId) {\r\n return;\r\n }\r\n // retry from this component\r\n instance.asyncResolved = true;\r\n const { vnode } = instance;\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n pushWarningContext(vnode);\r\n }\r\n handleSetupResult(instance, asyncSetupResult);\r\n if (hydratedEl) {\r\n // vnode may have been replaced if an update happened before the\r\n // async dep is resolved.\r\n vnode.el = hydratedEl;\r\n }\r\n const placeholder = !hydratedEl && instance.subTree.el;\r\n setupRenderEffect(instance, vnode, \r\n // component may have been moved before resolve.\r\n // if this is not a hydration, instance.subTree will be the comment\r\n // placeholder.\r\n parentNode(hydratedEl || instance.subTree.el), \r\n // anchor will not be used if this is hydration, so only need to\r\n // consider the comment placeholder case.\r\n hydratedEl ? null : next(instance.subTree), suspense, isSVG, optimized);\r\n if (placeholder) {\r\n remove(placeholder);\r\n }\r\n updateHOCHostEl(instance, vnode.el);\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n popWarningContext();\r\n }\r\n // only decrease deps count if suspense is not already resolved\r\n if (isInPendingSuspense && --suspense.deps === 0) {\r\n suspense.resolve();\r\n }\r\n });\r\n },\r\n unmount(parentSuspense, doRemove) {\r\n suspense.isUnmounted = true;\r\n if (suspense.activeBranch) {\r\n unmount(suspense.activeBranch, parentComponent, parentSuspense, doRemove);\r\n }\r\n if (suspense.pendingBranch) {\r\n unmount(suspense.pendingBranch, parentComponent, parentSuspense, doRemove);\r\n }\r\n }\r\n };\r\n return suspense;\r\n}\r\nfunction hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, optimized, rendererInternals, hydrateNode) {\r\n /* eslint-disable no-restricted-globals */\r\n const suspense = (vnode.suspense = createSuspenseBoundary(vnode, parentSuspense, parentComponent, node.parentNode, document.createElement('div'), null, isSVG, optimized, rendererInternals, true /* hydrating */));\r\n // there are two possible scenarios for server-rendered suspense:\r\n // - success: ssr content should be fully resolved\r\n // - failure: ssr content should be the fallback branch.\r\n // however, on the client we don't really know if it has failed or not\r\n // attempt to hydrate the DOM assuming it has succeeded, but we still\r\n // need to construct a suspense boundary first\r\n const result = hydrateNode(node, (suspense.pendingBranch = vnode.ssContent), parentComponent, suspense, optimized);\r\n if (suspense.deps === 0) {\r\n suspense.resolve();\r\n }\r\n return result;\r\n /* eslint-enable no-restricted-globals */\r\n}\r\nfunction normalizeSuspenseChildren(vnode) {\r\n const { shapeFlag, children } = vnode;\r\n let content;\r\n let fallback;\r\n if (shapeFlag & 32 /* SLOTS_CHILDREN */) {\r\n content = normalizeSuspenseSlot(children.default);\r\n fallback = normalizeSuspenseSlot(children.fallback);\r\n }\r\n else {\r\n content = normalizeSuspenseSlot(children);\r\n fallback = normalizeVNode(null);\r\n }\r\n return {\r\n content,\r\n fallback\r\n };\r\n}\r\nfunction normalizeSuspenseSlot(s) {\r\n if (isFunction(s)) {\r\n s = s();\r\n }\r\n if (isArray(s)) {\r\n const singleChild = filterSingleRoot(s);\r\n if ((process.env.NODE_ENV !== 'production') && !singleChild) {\r\n warn(` slots expect a single root node.`);\r\n }\r\n s = singleChild;\r\n }\r\n return normalizeVNode(s);\r\n}\r\nfunction queueEffectWithSuspense(fn, suspense) {\r\n if (suspense && suspense.pendingBranch) {\r\n if (isArray(fn)) {\r\n suspense.effects.push(...fn);\r\n }\r\n else {\r\n suspense.effects.push(fn);\r\n }\r\n }\r\n else {\r\n queuePostFlushCb(fn);\r\n }\r\n}\r\nfunction setActiveBranch(suspense, branch) {\r\n suspense.activeBranch = branch;\r\n const { vnode, parentComponent } = suspense;\r\n const el = (vnode.el = branch.el);\r\n // in case suspense is the root node of a component,\r\n // recursively update the HOC el\r\n if (parentComponent && parentComponent.subTree === vnode) {\r\n parentComponent.vnode.el = el;\r\n updateHOCHostEl(parentComponent, el);\r\n }\r\n}\n\nlet isRenderingCompiledSlot = 0;\r\nconst setCompiledSlotRendering = (n) => (isRenderingCompiledSlot += n);\r\n/**\r\n * Compiler runtime helper for rendering ``\r\n * @private\r\n */\r\nfunction renderSlot(slots, name, props = {}, \r\n// this is not a user-facing function, so the fallback is always generated by\r\n// the compiler and guaranteed to be a function returning an array\r\nfallback) {\r\n let slot = slots[name];\r\n if ((process.env.NODE_ENV !== 'production') && slot && slot.length > 1) {\r\n warn(`SSR-optimized slot function detected in a non-SSR-optimized render ` +\r\n `function. You need to mark this component with $dynamic-slots in the ` +\r\n `parent template.`);\r\n slot = () => [];\r\n }\r\n // a compiled slot disables block tracking by default to avoid manual\r\n // invocation interfering with template-based block tracking, but in\r\n // `renderSlot` we can be sure that it's template-based so we can force\r\n // enable it.\r\n isRenderingCompiledSlot++;\r\n openBlock();\r\n const validSlotContent = slot && ensureValidVNode(slot(props));\r\n const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* STABLE */\r\n ? 64 /* STABLE_FRAGMENT */\r\n : -2 /* BAIL */);\r\n isRenderingCompiledSlot--;\r\n return rendered;\r\n}\r\nfunction ensureValidVNode(vnodes) {\r\n return vnodes.some(child => {\r\n if (!isVNode(child))\r\n return true;\r\n if (child.type === Comment)\r\n return false;\r\n if (child.type === Fragment &&\r\n !ensureValidVNode(child.children))\r\n return false;\r\n return true;\r\n })\r\n ? vnodes\r\n : null;\r\n}\n\n/**\r\n * Wrap a slot function to memoize current rendering instance\r\n * @private\r\n */\r\nfunction withCtx(fn, ctx = currentRenderingInstance) {\r\n if (!ctx)\r\n return fn;\r\n const renderFnWithContext = (...args) => {\r\n // If a user calls a compiled slot inside a template expression (#1745), it\r\n // can mess up block tracking, so by default we need to push a null block to\r\n // avoid that. This isn't necessary if rendering a compiled ``.\r\n if (!isRenderingCompiledSlot) {\r\n openBlock(true /* null block that disables tracking */);\r\n }\r\n const owner = currentRenderingInstance;\r\n setCurrentRenderingInstance(ctx);\r\n const res = fn(...args);\r\n setCurrentRenderingInstance(owner);\r\n if (!isRenderingCompiledSlot) {\r\n closeBlock();\r\n }\r\n return res;\r\n };\r\n renderFnWithContext._c = true;\r\n return renderFnWithContext;\r\n}\n\n// SFC scoped style ID management.\r\nlet currentScopeId = null;\r\nconst scopeIdStack = [];\r\n/**\r\n * @private\r\n */\r\nfunction pushScopeId(id) {\r\n scopeIdStack.push((currentScopeId = id));\r\n}\r\n/**\r\n * @private\r\n */\r\nfunction popScopeId() {\r\n scopeIdStack.pop();\r\n currentScopeId = scopeIdStack[scopeIdStack.length - 1] || null;\r\n}\r\n/**\r\n * @private\r\n */\r\nfunction withScopeId(id) {\r\n return ((fn) => withCtx(function () {\r\n pushScopeId(id);\r\n const res = fn.apply(this, arguments);\r\n popScopeId();\r\n return res;\r\n }));\r\n}\n\nfunction initProps(instance, rawProps, isStateful, // result of bitwise flag comparison\r\nisSSR = false) {\r\n const props = {};\r\n const attrs = {};\r\n def(attrs, InternalObjectKey, 1);\r\n setFullProps(instance, rawProps, props, attrs);\r\n // validation\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n validateProps(props, instance);\r\n }\r\n if (isStateful) {\r\n // stateful\r\n instance.props = isSSR ? props : shallowReactive(props);\r\n }\r\n else {\r\n if (!instance.type.props) {\r\n // functional w/ optional props, props === attrs\r\n instance.props = attrs;\r\n }\r\n else {\r\n // functional w/ declared props\r\n instance.props = props;\r\n }\r\n }\r\n instance.attrs = attrs;\r\n}\r\nfunction updateProps(instance, rawProps, rawPrevProps, optimized) {\r\n const { props, attrs, vnode: { patchFlag } } = instance;\r\n const rawCurrentProps = toRaw(props);\r\n const [options] = instance.propsOptions;\r\n if (\r\n // always force full diff in dev\r\n // - #1942 if hmr is enabled with sfc component\r\n // - vite#872 non-sfc component used by sfc component\r\n !((process.env.NODE_ENV !== 'production') &&\r\n (instance.type.__hmrId ||\r\n (instance.parent && instance.parent.type.__hmrId))) &&\r\n (optimized || patchFlag > 0) &&\r\n !(patchFlag & 16 /* FULL_PROPS */)) {\r\n if (patchFlag & 8 /* PROPS */) {\r\n // Compiler-generated props & no keys change, just set the updated\r\n // the props.\r\n const propsToUpdate = instance.vnode.dynamicProps;\r\n for (let i = 0; i < propsToUpdate.length; i++) {\r\n const key = propsToUpdate[i];\r\n // PROPS flag guarantees rawProps to be non-null\r\n const value = rawProps[key];\r\n if (options) {\r\n // attr / props separation was done on init and will be consistent\r\n // in this code path, so just check if attrs have it.\r\n if (hasOwn(attrs, key)) {\r\n attrs[key] = value;\r\n }\r\n else {\r\n const camelizedKey = camelize(key);\r\n props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance);\r\n }\r\n }\r\n else {\r\n attrs[key] = value;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n // full props update.\r\n setFullProps(instance, rawProps, props, attrs);\r\n // in case of dynamic props, check if we need to delete keys from\r\n // the props object\r\n let kebabKey;\r\n for (const key in rawCurrentProps) {\r\n if (!rawProps ||\r\n // for camelCase\r\n (!hasOwn(rawProps, key) &&\r\n // it's possible the original props was passed in as kebab-case\r\n // and converted to camelCase (#955)\r\n ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))) {\r\n if (options) {\r\n if (rawPrevProps &&\r\n // for camelCase\r\n (rawPrevProps[key] !== undefined ||\r\n // for kebab-case\r\n rawPrevProps[kebabKey] !== undefined)) {\r\n props[key] = resolvePropValue(options, rawProps || EMPTY_OBJ, key, undefined, instance);\r\n }\r\n }\r\n else {\r\n delete props[key];\r\n }\r\n }\r\n }\r\n // in the case of functional component w/o props declaration, props and\r\n // attrs point to the same object so it should already have been updated.\r\n if (attrs !== rawCurrentProps) {\r\n for (const key in attrs) {\r\n if (!rawProps || !hasOwn(rawProps, key)) {\r\n delete attrs[key];\r\n }\r\n }\r\n }\r\n }\r\n // trigger updates for $attrs in case it's used in component slots\r\n trigger(instance, \"set\" /* SET */, '$attrs');\r\n if ((process.env.NODE_ENV !== 'production') && rawProps) {\r\n validateProps(props, instance);\r\n }\r\n}\r\nfunction setFullProps(instance, rawProps, props, attrs) {\r\n const [options, needCastKeys] = instance.propsOptions;\r\n if (rawProps) {\r\n for (const key in rawProps) {\r\n const value = rawProps[key];\r\n // key, ref are reserved and never passed down\r\n if (isReservedProp(key)) {\r\n continue;\r\n }\r\n // prop option names are camelized during normalization, so to support\r\n // kebab -> camel conversion here we need to camelize the key.\r\n let camelKey;\r\n if (options && hasOwn(options, (camelKey = camelize(key)))) {\r\n props[camelKey] = value;\r\n }\r\n else if (!isEmitListener(instance.emitsOptions, key)) {\r\n // Any non-declared (either as a prop or an emitted event) props are put\r\n // into a separate `attrs` object for spreading. Make sure to preserve\r\n // original key casing\r\n attrs[key] = value;\r\n }\r\n }\r\n }\r\n if (needCastKeys) {\r\n const rawCurrentProps = toRaw(props);\r\n for (let i = 0; i < needCastKeys.length; i++) {\r\n const key = needCastKeys[i];\r\n props[key] = resolvePropValue(options, rawCurrentProps, key, rawCurrentProps[key], instance);\r\n }\r\n }\r\n}\r\nfunction resolvePropValue(options, props, key, value, instance) {\r\n const opt = options[key];\r\n if (opt != null) {\r\n const hasDefault = hasOwn(opt, 'default');\r\n // default values\r\n if (hasDefault && value === undefined) {\r\n const defaultValue = opt.default;\r\n if (opt.type !== Function && isFunction(defaultValue)) {\r\n setCurrentInstance(instance);\r\n value = defaultValue(props);\r\n setCurrentInstance(null);\r\n }\r\n else {\r\n value = defaultValue;\r\n }\r\n }\r\n // boolean casting\r\n if (opt[0 /* shouldCast */]) {\r\n if (!hasOwn(props, key) && !hasDefault) {\r\n value = false;\r\n }\r\n else if (opt[1 /* shouldCastTrue */] &&\r\n (value === '' || value === hyphenate(key))) {\r\n value = true;\r\n }\r\n }\r\n }\r\n return value;\r\n}\r\nfunction normalizePropsOptions(comp, appContext, asMixin = false) {\r\n if (!appContext.deopt && comp.__props) {\r\n return comp.__props;\r\n }\r\n const raw = comp.props;\r\n const normalized = {};\r\n const needCastKeys = [];\r\n // apply mixin/extends props\r\n let hasExtends = false;\r\n if (__VUE_OPTIONS_API__ && !isFunction(comp)) {\r\n const extendProps = (raw) => {\r\n hasExtends = true;\r\n const [props, keys] = normalizePropsOptions(raw, appContext, true);\r\n extend(normalized, props);\r\n if (keys)\r\n needCastKeys.push(...keys);\r\n };\r\n if (!asMixin && appContext.mixins.length) {\r\n appContext.mixins.forEach(extendProps);\r\n }\r\n if (comp.extends) {\r\n extendProps(comp.extends);\r\n }\r\n if (comp.mixins) {\r\n comp.mixins.forEach(extendProps);\r\n }\r\n }\r\n if (!raw && !hasExtends) {\r\n return (comp.__props = EMPTY_ARR);\r\n }\r\n if (isArray(raw)) {\r\n for (let i = 0; i < raw.length; i++) {\r\n if ((process.env.NODE_ENV !== 'production') && !isString(raw[i])) {\r\n warn(`props must be strings when using array syntax.`, raw[i]);\r\n }\r\n const normalizedKey = camelize(raw[i]);\r\n if (validatePropName(normalizedKey)) {\r\n normalized[normalizedKey] = EMPTY_OBJ;\r\n }\r\n }\r\n }\r\n else if (raw) {\r\n if ((process.env.NODE_ENV !== 'production') && !isObject(raw)) {\r\n warn(`invalid props options`, raw);\r\n }\r\n for (const key in raw) {\r\n const normalizedKey = camelize(key);\r\n if (validatePropName(normalizedKey)) {\r\n const opt = raw[key];\r\n const prop = (normalized[normalizedKey] =\r\n isArray(opt) || isFunction(opt) ? { type: opt } : opt);\r\n if (prop) {\r\n const booleanIndex = getTypeIndex(Boolean, prop.type);\r\n const stringIndex = getTypeIndex(String, prop.type);\r\n prop[0 /* shouldCast */] = booleanIndex > -1;\r\n prop[1 /* shouldCastTrue */] =\r\n stringIndex < 0 || booleanIndex < stringIndex;\r\n // if the prop needs boolean casting or default value\r\n if (booleanIndex > -1 || hasOwn(prop, 'default')) {\r\n needCastKeys.push(normalizedKey);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return (comp.__props = [normalized, needCastKeys]);\r\n}\r\nfunction validatePropName(key) {\r\n if (key[0] !== '$') {\r\n return true;\r\n }\r\n else if ((process.env.NODE_ENV !== 'production')) {\r\n warn(`Invalid prop name: \"${key}\" is a reserved property.`);\r\n }\r\n return false;\r\n}\r\n// use function string name to check type constructors\r\n// so that it works across vms / iframes.\r\nfunction getType(ctor) {\r\n const match = ctor && ctor.toString().match(/^\\s*function (\\w+)/);\r\n return match ? match[1] : '';\r\n}\r\nfunction isSameType(a, b) {\r\n return getType(a) === getType(b);\r\n}\r\nfunction getTypeIndex(type, expectedTypes) {\r\n if (isArray(expectedTypes)) {\r\n for (let i = 0, len = expectedTypes.length; i < len; i++) {\r\n if (isSameType(expectedTypes[i], type)) {\r\n return i;\r\n }\r\n }\r\n }\r\n else if (isFunction(expectedTypes)) {\r\n return isSameType(expectedTypes, type) ? 0 : -1;\r\n }\r\n return -1;\r\n}\r\n/**\r\n * dev only\r\n */\r\nfunction validateProps(props, instance) {\r\n const rawValues = toRaw(props);\r\n const options = instance.propsOptions[0];\r\n for (const key in options) {\r\n let opt = options[key];\r\n if (opt == null)\r\n continue;\r\n validateProp(key, rawValues[key], opt, !hasOwn(rawValues, key));\r\n }\r\n}\r\n/**\r\n * dev only\r\n */\r\nfunction validateProp(name, value, prop, isAbsent) {\r\n const { type, required, validator } = prop;\r\n // required!\r\n if (required && isAbsent) {\r\n warn('Missing required prop: \"' + name + '\"');\r\n return;\r\n }\r\n // missing but optional\r\n if (value == null && !prop.required) {\r\n return;\r\n }\r\n // type check\r\n if (type != null && type !== true) {\r\n let isValid = false;\r\n const types = isArray(type) ? type : [type];\r\n const expectedTypes = [];\r\n // value is valid as long as one of the specified types match\r\n for (let i = 0; i < types.length && !isValid; i++) {\r\n const { valid, expectedType } = assertType(value, types[i]);\r\n expectedTypes.push(expectedType || '');\r\n isValid = valid;\r\n }\r\n if (!isValid) {\r\n warn(getInvalidTypeMessage(name, value, expectedTypes));\r\n return;\r\n }\r\n }\r\n // custom validator\r\n if (validator && !validator(value)) {\r\n warn('Invalid prop: custom validator check failed for prop \"' + name + '\".');\r\n }\r\n}\r\nconst isSimpleType = /*#__PURE__*/ makeMap('String,Number,Boolean,Function,Symbol,BigInt');\r\n/**\r\n * dev only\r\n */\r\nfunction assertType(value, type) {\r\n let valid;\r\n const expectedType = getType(type);\r\n if (isSimpleType(expectedType)) {\r\n const t = typeof value;\r\n valid = t === expectedType.toLowerCase();\r\n // for primitive wrapper objects\r\n if (!valid && t === 'object') {\r\n valid = value instanceof type;\r\n }\r\n }\r\n else if (expectedType === 'Object') {\r\n valid = isObject(value);\r\n }\r\n else if (expectedType === 'Array') {\r\n valid = isArray(value);\r\n }\r\n else {\r\n valid = value instanceof type;\r\n }\r\n return {\r\n valid,\r\n expectedType\r\n };\r\n}\r\n/**\r\n * dev only\r\n */\r\nfunction getInvalidTypeMessage(name, value, expectedTypes) {\r\n let message = `Invalid prop: type check failed for prop \"${name}\".` +\r\n ` Expected ${expectedTypes.map(capitalize).join(', ')}`;\r\n const expectedType = expectedTypes[0];\r\n const receivedType = toRawType(value);\r\n const expectedValue = styleValue(value, expectedType);\r\n const receivedValue = styleValue(value, receivedType);\r\n // check if we need to specify expected value\r\n if (expectedTypes.length === 1 &&\r\n isExplicable(expectedType) &&\r\n !isBoolean(expectedType, receivedType)) {\r\n message += ` with value ${expectedValue}`;\r\n }\r\n message += `, got ${receivedType} `;\r\n // check if we need to specify received value\r\n if (isExplicable(receivedType)) {\r\n message += `with value ${receivedValue}.`;\r\n }\r\n return message;\r\n}\r\n/**\r\n * dev only\r\n */\r\nfunction styleValue(value, type) {\r\n if (type === 'String') {\r\n return `\"${value}\"`;\r\n }\r\n else if (type === 'Number') {\r\n return `${Number(value)}`;\r\n }\r\n else {\r\n return `${value}`;\r\n }\r\n}\r\n/**\r\n * dev only\r\n */\r\nfunction isExplicable(type) {\r\n const explicitTypes = ['string', 'number', 'boolean'];\r\n return explicitTypes.some(elem => type.toLowerCase() === elem);\r\n}\r\n/**\r\n * dev only\r\n */\r\nfunction isBoolean(...args) {\r\n return args.some(elem => elem.toLowerCase() === 'boolean');\r\n}\n\nfunction injectHook(type, hook, target = currentInstance, prepend = false) {\r\n if (target) {\r\n const hooks = target[type] || (target[type] = []);\r\n // cache the error handling wrapper for injected hooks so the same hook\r\n // can be properly deduped by the scheduler. \"__weh\" stands for \"with error\r\n // handling\".\r\n const wrappedHook = hook.__weh ||\r\n (hook.__weh = (...args) => {\r\n if (target.isUnmounted) {\r\n return;\r\n }\r\n // disable tracking inside all lifecycle hooks\r\n // since they can potentially be called inside effects.\r\n pauseTracking();\r\n // Set currentInstance during hook invocation.\r\n // This assumes the hook does not synchronously trigger other hooks, which\r\n // can only be false when the user does something really funky.\r\n setCurrentInstance(target);\r\n const res = callWithAsyncErrorHandling(hook, target, type, args);\r\n setCurrentInstance(null);\r\n resetTracking();\r\n return res;\r\n });\r\n if (prepend) {\r\n hooks.unshift(wrappedHook);\r\n }\r\n else {\r\n hooks.push(wrappedHook);\r\n }\r\n return wrappedHook;\r\n }\r\n else if ((process.env.NODE_ENV !== 'production')) {\r\n const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ''));\r\n warn(`${apiName} is called when there is no active component instance to be ` +\r\n `associated with. ` +\r\n `Lifecycle injection APIs can only be used during execution of setup().` +\r\n (` If you are using async setup(), make sure to register lifecycle ` +\r\n `hooks before the first await statement.`\r\n ));\r\n }\r\n}\r\nconst createHook = (lifecycle) => (hook, target = currentInstance) => \r\n// post-create lifecycle registrations are noops during SSR\r\n!isInSSRComponentSetup && injectHook(lifecycle, hook, target);\r\nconst onBeforeMount = createHook(\"bm\" /* BEFORE_MOUNT */);\r\nconst onMounted = createHook(\"m\" /* MOUNTED */);\r\nconst onBeforeUpdate = createHook(\"bu\" /* BEFORE_UPDATE */);\r\nconst onUpdated = createHook(\"u\" /* UPDATED */);\r\nconst onBeforeUnmount = createHook(\"bum\" /* BEFORE_UNMOUNT */);\r\nconst onUnmounted = createHook(\"um\" /* UNMOUNTED */);\r\nconst onRenderTriggered = createHook(\"rtg\" /* RENDER_TRIGGERED */);\r\nconst onRenderTracked = createHook(\"rtc\" /* RENDER_TRACKED */);\r\nconst onErrorCaptured = (hook, target = currentInstance) => {\r\n injectHook(\"ec\" /* ERROR_CAPTURED */, hook, target);\r\n};\n\n// Simple effect.\r\nfunction watchEffect(effect, options) {\r\n return doWatch(effect, null, options);\r\n}\r\n// initial value for watchers to trigger on undefined initial values\r\nconst INITIAL_WATCHER_VALUE = {};\r\n// implementation\r\nfunction watch(source, cb, options) {\r\n if ((process.env.NODE_ENV !== 'production') && !isFunction(cb)) {\r\n warn(`\\`watch(fn, options?)\\` signature has been moved to a separate API. ` +\r\n `Use \\`watchEffect(fn, options?)\\` instead. \\`watch\\` now only ` +\r\n `supports \\`watch(source, cb, options?) signature.`);\r\n }\r\n return doWatch(source, cb, options);\r\n}\r\nfunction doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ, instance = currentInstance) {\r\n if ((process.env.NODE_ENV !== 'production') && !cb) {\r\n if (immediate !== undefined) {\r\n warn(`watch() \"immediate\" option is only respected when using the ` +\r\n `watch(source, callback, options?) signature.`);\r\n }\r\n if (deep !== undefined) {\r\n warn(`watch() \"deep\" option is only respected when using the ` +\r\n `watch(source, callback, options?) signature.`);\r\n }\r\n }\r\n const warnInvalidSource = (s) => {\r\n warn(`Invalid watch source: `, s, `A watch source can only be a getter/effect function, a ref, ` +\r\n `a reactive object, or an array of these types.`);\r\n };\r\n let getter;\r\n let forceTrigger = false;\r\n if (isRef(source)) {\r\n getter = () => source.value;\r\n forceTrigger = !!source._shallow;\r\n }\r\n else if (isReactive(source)) {\r\n getter = () => source;\r\n deep = true;\r\n }\r\n else if (isArray(source)) {\r\n getter = () => source.map(s => {\r\n if (isRef(s)) {\r\n return s.value;\r\n }\r\n else if (isReactive(s)) {\r\n return traverse(s);\r\n }\r\n else if (isFunction(s)) {\r\n return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */, [\r\n instance && instance.proxy\r\n ]);\r\n }\r\n else {\r\n (process.env.NODE_ENV !== 'production') && warnInvalidSource(s);\r\n }\r\n });\r\n }\r\n else if (isFunction(source)) {\r\n if (cb) {\r\n // getter with cb\r\n getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */, [\r\n instance && instance.proxy\r\n ]);\r\n }\r\n else {\r\n // no cb -> simple effect\r\n getter = () => {\r\n if (instance && instance.isUnmounted) {\r\n return;\r\n }\r\n if (cleanup) {\r\n cleanup();\r\n }\r\n return callWithErrorHandling(source, instance, 3 /* WATCH_CALLBACK */, [onInvalidate]);\r\n };\r\n }\r\n }\r\n else {\r\n getter = NOOP;\r\n (process.env.NODE_ENV !== 'production') && warnInvalidSource(source);\r\n }\r\n if (cb && deep) {\r\n const baseGetter = getter;\r\n getter = () => traverse(baseGetter());\r\n }\r\n let cleanup;\r\n const onInvalidate = (fn) => {\r\n cleanup = runner.options.onStop = () => {\r\n callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);\r\n };\r\n };\r\n let oldValue = isArray(source) ? [] : INITIAL_WATCHER_VALUE;\r\n const job = () => {\r\n if (!runner.active) {\r\n return;\r\n }\r\n if (cb) {\r\n // watch(source, cb)\r\n const newValue = runner();\r\n if (deep || forceTrigger || hasChanged(newValue, oldValue)) {\r\n // cleanup before running cb again\r\n if (cleanup) {\r\n cleanup();\r\n }\r\n callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [\r\n newValue,\r\n // pass undefined as the old value when it's changed for the first time\r\n oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,\r\n onInvalidate\r\n ]);\r\n oldValue = newValue;\r\n }\r\n }\r\n else {\r\n // watchEffect\r\n runner();\r\n }\r\n };\r\n // important: mark the job as a watcher callback so that scheduler knows\r\n // it is allowed to self-trigger (#1727)\r\n job.allowRecurse = !!cb;\r\n let scheduler;\r\n if (flush === 'sync') {\r\n scheduler = job;\r\n }\r\n else if (flush === 'post') {\r\n scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);\r\n }\r\n else {\r\n // default: 'pre'\r\n scheduler = () => {\r\n if (!instance || instance.isMounted) {\r\n queuePreFlushCb(job);\r\n }\r\n else {\r\n // with 'pre' option, the first call must happen before\r\n // the component is mounted so it is called synchronously.\r\n job();\r\n }\r\n };\r\n }\r\n const runner = effect(getter, {\r\n lazy: true,\r\n onTrack,\r\n onTrigger,\r\n scheduler\r\n });\r\n recordInstanceBoundEffect(runner, instance);\r\n // initial run\r\n if (cb) {\r\n if (immediate) {\r\n job();\r\n }\r\n else {\r\n oldValue = runner();\r\n }\r\n }\r\n else if (flush === 'post') {\r\n queuePostRenderEffect(runner, instance && instance.suspense);\r\n }\r\n else {\r\n runner();\r\n }\r\n return () => {\r\n stop(runner);\r\n if (instance) {\r\n remove(instance.effects, runner);\r\n }\r\n };\r\n}\r\n// this.$watch\r\nfunction instanceWatch(source, cb, options) {\r\n const publicThis = this.proxy;\r\n const getter = isString(source)\r\n ? () => publicThis[source]\r\n : source.bind(publicThis);\r\n return doWatch(getter, cb.bind(publicThis), options, this);\r\n}\r\nfunction traverse(value, seen = new Set()) {\r\n if (!isObject(value) || seen.has(value)) {\r\n return value;\r\n }\r\n seen.add(value);\r\n if (isRef(value)) {\r\n traverse(value.value, seen);\r\n }\r\n else if (isArray(value)) {\r\n for (let i = 0; i < value.length; i++) {\r\n traverse(value[i], seen);\r\n }\r\n }\r\n else if (isSet(value) || isMap(value)) {\r\n value.forEach((v) => {\r\n traverse(v, seen);\r\n });\r\n }\r\n else {\r\n for (const key in value) {\r\n traverse(value[key], seen);\r\n }\r\n }\r\n return value;\r\n}\n\nfunction useTransitionState() {\r\n const state = {\r\n isMounted: false,\r\n isLeaving: false,\r\n isUnmounting: false,\r\n leavingVNodes: new Map()\r\n };\r\n onMounted(() => {\r\n state.isMounted = true;\r\n });\r\n onBeforeUnmount(() => {\r\n state.isUnmounting = true;\r\n });\r\n return state;\r\n}\r\nconst TransitionHookValidator = [Function, Array];\r\nconst BaseTransitionImpl = {\r\n name: `BaseTransition`,\r\n props: {\r\n mode: String,\r\n appear: Boolean,\r\n persisted: Boolean,\r\n // enter\r\n onBeforeEnter: TransitionHookValidator,\r\n onEnter: TransitionHookValidator,\r\n onAfterEnter: TransitionHookValidator,\r\n onEnterCancelled: TransitionHookValidator,\r\n // leave\r\n onBeforeLeave: TransitionHookValidator,\r\n onLeave: TransitionHookValidator,\r\n onAfterLeave: TransitionHookValidator,\r\n onLeaveCancelled: TransitionHookValidator,\r\n // appear\r\n onBeforeAppear: TransitionHookValidator,\r\n onAppear: TransitionHookValidator,\r\n onAfterAppear: TransitionHookValidator,\r\n onAppearCancelled: TransitionHookValidator\r\n },\r\n setup(props, { slots }) {\r\n const instance = getCurrentInstance();\r\n const state = useTransitionState();\r\n let prevTransitionKey;\r\n return () => {\r\n const children = slots.default && getTransitionRawChildren(slots.default(), true);\r\n if (!children || !children.length) {\r\n return;\r\n }\r\n // warn multiple elements\r\n if ((process.env.NODE_ENV !== 'production') && children.length > 1) {\r\n warn(' can only be used on a single element or component. Use ' +\r\n ' for lists.');\r\n }\r\n // there's no need to track reactivity for these props so use the raw\r\n // props for a bit better perf\r\n const rawProps = toRaw(props);\r\n const { mode } = rawProps;\r\n // check mode\r\n if ((process.env.NODE_ENV !== 'production') && mode && !['in-out', 'out-in', 'default'].includes(mode)) {\r\n warn(`invalid mode: ${mode}`);\r\n }\r\n // at this point children has a guaranteed length of 1.\r\n const child = children[0];\r\n if (state.isLeaving) {\r\n return emptyPlaceholder(child);\r\n }\r\n // in the case of , we need to\r\n // compare the type of the kept-alive children.\r\n const innerChild = getKeepAliveChild(child);\r\n if (!innerChild) {\r\n return emptyPlaceholder(child);\r\n }\r\n const enterHooks = resolveTransitionHooks(innerChild, rawProps, state, instance);\r\n setTransitionHooks(innerChild, enterHooks);\r\n const oldChild = instance.subTree;\r\n const oldInnerChild = oldChild && getKeepAliveChild(oldChild);\r\n let transitionKeyChanged = false;\r\n const { getTransitionKey } = innerChild.type;\r\n if (getTransitionKey) {\r\n const key = getTransitionKey();\r\n if (prevTransitionKey === undefined) {\r\n prevTransitionKey = key;\r\n }\r\n else if (key !== prevTransitionKey) {\r\n prevTransitionKey = key;\r\n transitionKeyChanged = true;\r\n }\r\n }\r\n // handle mode\r\n if (oldInnerChild &&\r\n oldInnerChild.type !== Comment &&\r\n (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {\r\n const leavingHooks = resolveTransitionHooks(oldInnerChild, rawProps, state, instance);\r\n // update old tree's hooks in case of dynamic transition\r\n setTransitionHooks(oldInnerChild, leavingHooks);\r\n // switching between different views\r\n if (mode === 'out-in') {\r\n state.isLeaving = true;\r\n // return placeholder node and queue update when leave finishes\r\n leavingHooks.afterLeave = () => {\r\n state.isLeaving = false;\r\n instance.update();\r\n };\r\n return emptyPlaceholder(child);\r\n }\r\n else if (mode === 'in-out') {\r\n leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {\r\n const leavingVNodesCache = getLeavingNodesForType(state, oldInnerChild);\r\n leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;\r\n // early removal callback\r\n el._leaveCb = () => {\r\n earlyRemove();\r\n el._leaveCb = undefined;\r\n delete enterHooks.delayedLeave;\r\n };\r\n enterHooks.delayedLeave = delayedLeave;\r\n };\r\n }\r\n }\r\n return child;\r\n };\r\n }\r\n};\r\n// export the public type for h/tsx inference\r\n// also to avoid inline import() in generated d.ts files\r\nconst BaseTransition = BaseTransitionImpl;\r\nfunction getLeavingNodesForType(state, vnode) {\r\n const { leavingVNodes } = state;\r\n let leavingVNodesCache = leavingVNodes.get(vnode.type);\r\n if (!leavingVNodesCache) {\r\n leavingVNodesCache = Object.create(null);\r\n leavingVNodes.set(vnode.type, leavingVNodesCache);\r\n }\r\n return leavingVNodesCache;\r\n}\r\n// The transition hooks are attached to the vnode as vnode.transition\r\n// and will be called at appropriate timing in the renderer.\r\nfunction resolveTransitionHooks(vnode, props, state, instance) {\r\n const { appear, mode, persisted = false, onBeforeEnter, onEnter, onAfterEnter, onEnterCancelled, onBeforeLeave, onLeave, onAfterLeave, onLeaveCancelled, onBeforeAppear, onAppear, onAfterAppear, onAppearCancelled } = props;\r\n const key = String(vnode.key);\r\n const leavingVNodesCache = getLeavingNodesForType(state, vnode);\r\n const callHook = (hook, args) => {\r\n hook &&\r\n callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);\r\n };\r\n const hooks = {\r\n mode,\r\n persisted,\r\n beforeEnter(el) {\r\n let hook = onBeforeEnter;\r\n if (!state.isMounted) {\r\n if (appear) {\r\n hook = onBeforeAppear || onBeforeEnter;\r\n }\r\n else {\r\n return;\r\n }\r\n }\r\n // for same element (v-show)\r\n if (el._leaveCb) {\r\n el._leaveCb(true /* cancelled */);\r\n }\r\n // for toggled element with same key (v-if)\r\n const leavingVNode = leavingVNodesCache[key];\r\n if (leavingVNode &&\r\n isSameVNodeType(vnode, leavingVNode) &&\r\n leavingVNode.el._leaveCb) {\r\n // force early removal (not cancelled)\r\n leavingVNode.el._leaveCb();\r\n }\r\n callHook(hook, [el]);\r\n },\r\n enter(el) {\r\n let hook = onEnter;\r\n let afterHook = onAfterEnter;\r\n let cancelHook = onEnterCancelled;\r\n if (!state.isMounted) {\r\n if (appear) {\r\n hook = onAppear || onEnter;\r\n afterHook = onAfterAppear || onAfterEnter;\r\n cancelHook = onAppearCancelled || onEnterCancelled;\r\n }\r\n else {\r\n return;\r\n }\r\n }\r\n let called = false;\r\n const done = (el._enterCb = (cancelled) => {\r\n if (called)\r\n return;\r\n called = true;\r\n if (cancelled) {\r\n callHook(cancelHook, [el]);\r\n }\r\n else {\r\n callHook(afterHook, [el]);\r\n }\r\n if (hooks.delayedLeave) {\r\n hooks.delayedLeave();\r\n }\r\n el._enterCb = undefined;\r\n });\r\n if (hook) {\r\n hook(el, done);\r\n if (hook.length <= 1) {\r\n done();\r\n }\r\n }\r\n else {\r\n done();\r\n }\r\n },\r\n leave(el, remove) {\r\n const key = String(vnode.key);\r\n if (el._enterCb) {\r\n el._enterCb(true /* cancelled */);\r\n }\r\n if (state.isUnmounting) {\r\n return remove();\r\n }\r\n callHook(onBeforeLeave, [el]);\r\n let called = false;\r\n const done = (el._leaveCb = (cancelled) => {\r\n if (called)\r\n return;\r\n called = true;\r\n remove();\r\n if (cancelled) {\r\n callHook(onLeaveCancelled, [el]);\r\n }\r\n else {\r\n callHook(onAfterLeave, [el]);\r\n }\r\n el._leaveCb = undefined;\r\n if (leavingVNodesCache[key] === vnode) {\r\n delete leavingVNodesCache[key];\r\n }\r\n });\r\n leavingVNodesCache[key] = vnode;\r\n if (onLeave) {\r\n onLeave(el, done);\r\n if (onLeave.length <= 1) {\r\n done();\r\n }\r\n }\r\n else {\r\n done();\r\n }\r\n },\r\n clone(vnode) {\r\n return resolveTransitionHooks(vnode, props, state, instance);\r\n }\r\n };\r\n return hooks;\r\n}\r\n// the placeholder really only handles one special case: KeepAlive\r\n// in the case of a KeepAlive in a leave phase we need to return a KeepAlive\r\n// placeholder with empty content to avoid the KeepAlive instance from being\r\n// unmounted.\r\nfunction emptyPlaceholder(vnode) {\r\n if (isKeepAlive(vnode)) {\r\n vnode = cloneVNode(vnode);\r\n vnode.children = null;\r\n return vnode;\r\n }\r\n}\r\nfunction getKeepAliveChild(vnode) {\r\n return isKeepAlive(vnode)\r\n ? vnode.children\r\n ? vnode.children[0]\r\n : undefined\r\n : vnode;\r\n}\r\nfunction setTransitionHooks(vnode, hooks) {\r\n if (vnode.shapeFlag & 6 /* COMPONENT */ && vnode.component) {\r\n setTransitionHooks(vnode.component.subTree, hooks);\r\n }\r\n else if (vnode.shapeFlag & 128 /* SUSPENSE */) {\r\n vnode.ssContent.transition = hooks.clone(vnode.ssContent);\r\n vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);\r\n }\r\n else {\r\n vnode.transition = hooks;\r\n }\r\n}\r\nfunction getTransitionRawChildren(children, keepComment = false) {\r\n let ret = [];\r\n let keyedFragmentCount = 0;\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n // handle fragment children case, e.g. v-for\r\n if (child.type === Fragment) {\r\n if (child.patchFlag & 128 /* KEYED_FRAGMENT */)\r\n keyedFragmentCount++;\r\n ret = ret.concat(getTransitionRawChildren(child.children, keepComment));\r\n }\r\n // comment placeholders should be skipped, e.g. v-if\r\n else if (keepComment || child.type !== Comment) {\r\n ret.push(child);\r\n }\r\n }\r\n // #1126 if a transition children list contains multiple sub fragments, these\r\n // fragments will be merged into a flat children array. Since each v-for\r\n // fragment may contain different static bindings inside, we need to de-op\r\n // these children to force full diffs to ensure correct behavior.\r\n if (keyedFragmentCount > 1) {\r\n for (let i = 0; i < ret.length; i++) {\r\n ret[i].patchFlag = -2 /* BAIL */;\r\n }\r\n }\r\n return ret;\r\n}\n\nconst isKeepAlive = (vnode) => vnode.type.__isKeepAlive;\r\nconst KeepAliveImpl = {\r\n name: `KeepAlive`,\r\n // Marker for special handling inside the renderer. We are not using a ===\r\n // check directly on KeepAlive in the renderer, because importing it directly\r\n // would prevent it from being tree-shaken.\r\n __isKeepAlive: true,\r\n props: {\r\n include: [String, RegExp, Array],\r\n exclude: [String, RegExp, Array],\r\n max: [String, Number]\r\n },\r\n setup(props, { slots }) {\r\n const cache = new Map();\r\n const keys = new Set();\r\n let current = null;\r\n const instance = getCurrentInstance();\r\n const parentSuspense = instance.suspense;\r\n // KeepAlive communicates with the instantiated renderer via the\r\n // ctx where the renderer passes in its internals,\r\n // and the KeepAlive instance exposes activate/deactivate implementations.\r\n // The whole point of this is to avoid importing KeepAlive directly in the\r\n // renderer to facilitate tree-shaking.\r\n const sharedContext = instance.ctx;\r\n const { renderer: { p: patch, m: move, um: _unmount, o: { createElement } } } = sharedContext;\r\n const storageContainer = createElement('div');\r\n sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {\r\n const instance = vnode.component;\r\n move(vnode, container, anchor, 0 /* ENTER */, parentSuspense);\r\n // in case props have changed\r\n patch(instance.vnode, vnode, container, anchor, instance, parentSuspense, isSVG, optimized);\r\n queuePostRenderEffect(() => {\r\n instance.isDeactivated = false;\r\n if (instance.a) {\r\n invokeArrayFns(instance.a);\r\n }\r\n const vnodeHook = vnode.props && vnode.props.onVnodeMounted;\r\n if (vnodeHook) {\r\n invokeVNodeHook(vnodeHook, instance.parent, vnode);\r\n }\r\n }, parentSuspense);\r\n };\r\n sharedContext.deactivate = (vnode) => {\r\n const instance = vnode.component;\r\n move(vnode, storageContainer, null, 1 /* LEAVE */, parentSuspense);\r\n queuePostRenderEffect(() => {\r\n if (instance.da) {\r\n invokeArrayFns(instance.da);\r\n }\r\n const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;\r\n if (vnodeHook) {\r\n invokeVNodeHook(vnodeHook, instance.parent, vnode);\r\n }\r\n instance.isDeactivated = true;\r\n }, parentSuspense);\r\n };\r\n function unmount(vnode) {\r\n // reset the shapeFlag so it can be properly unmounted\r\n resetShapeFlag(vnode);\r\n _unmount(vnode, instance, parentSuspense);\r\n }\r\n function pruneCache(filter) {\r\n cache.forEach((vnode, key) => {\r\n const name = getComponentName(vnode.type);\r\n if (name && (!filter || !filter(name))) {\r\n pruneCacheEntry(key);\r\n }\r\n });\r\n }\r\n function pruneCacheEntry(key) {\r\n const cached = cache.get(key);\r\n if (!current || cached.type !== current.type) {\r\n unmount(cached);\r\n }\r\n else if (current) {\r\n // current active instance should no longer be kept-alive.\r\n // we can't unmount it now but it might be later, so reset its flag now.\r\n resetShapeFlag(current);\r\n }\r\n cache.delete(key);\r\n keys.delete(key);\r\n }\r\n // prune cache on include/exclude prop change\r\n watch(() => [props.include, props.exclude], ([include, exclude]) => {\r\n include && pruneCache(name => matches(include, name));\r\n exclude && pruneCache(name => !matches(exclude, name));\r\n }, \r\n // prune post-render after `current` has been updated\r\n { flush: 'post', deep: true });\r\n // cache sub tree after render\r\n let pendingCacheKey = null;\r\n const cacheSubtree = () => {\r\n // fix #1621, the pendingCacheKey could be 0\r\n if (pendingCacheKey != null) {\r\n cache.set(pendingCacheKey, getInnerChild(instance.subTree));\r\n }\r\n };\r\n onMounted(cacheSubtree);\r\n onUpdated(cacheSubtree);\r\n onBeforeUnmount(() => {\r\n cache.forEach(cached => {\r\n const { subTree, suspense } = instance;\r\n const vnode = getInnerChild(subTree);\r\n if (cached.type === vnode.type) {\r\n // current instance will be unmounted as part of keep-alive's unmount\r\n resetShapeFlag(vnode);\r\n // but invoke its deactivated hook here\r\n const da = vnode.component.da;\r\n da && queuePostRenderEffect(da, suspense);\r\n return;\r\n }\r\n unmount(cached);\r\n });\r\n });\r\n return () => {\r\n pendingCacheKey = null;\r\n if (!slots.default) {\r\n return null;\r\n }\r\n const children = slots.default();\r\n const rawVNode = children[0];\r\n if (children.length > 1) {\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n warn(`KeepAlive should contain exactly one component child.`);\r\n }\r\n current = null;\r\n return children;\r\n }\r\n else if (!isVNode(rawVNode) ||\r\n (!(rawVNode.shapeFlag & 4 /* STATEFUL_COMPONENT */) &&\r\n !(rawVNode.shapeFlag & 128 /* SUSPENSE */))) {\r\n current = null;\r\n return rawVNode;\r\n }\r\n let vnode = getInnerChild(rawVNode);\r\n const comp = vnode.type;\r\n const name = getComponentName(comp);\r\n const { include, exclude, max } = props;\r\n if ((include && (!name || !matches(include, name))) ||\r\n (exclude && name && matches(exclude, name))) {\r\n current = vnode;\r\n return rawVNode;\r\n }\r\n const key = vnode.key == null ? comp : vnode.key;\r\n const cachedVNode = cache.get(key);\r\n // clone vnode if it's reused because we are going to mutate it\r\n if (vnode.el) {\r\n vnode = cloneVNode(vnode);\r\n if (rawVNode.shapeFlag & 128 /* SUSPENSE */) {\r\n rawVNode.ssContent = vnode;\r\n }\r\n }\r\n // #1513 it's possible for the returned vnode to be cloned due to attr\r\n // fallthrough or scopeId, so the vnode here may not be the final vnode\r\n // that is mounted. Instead of caching it directly, we store the pending\r\n // key and cache `instance.subTree` (the normalized vnode) in\r\n // beforeMount/beforeUpdate hooks.\r\n pendingCacheKey = key;\r\n if (cachedVNode) {\r\n // copy over mounted state\r\n vnode.el = cachedVNode.el;\r\n vnode.component = cachedVNode.component;\r\n if (vnode.transition) {\r\n // recursively update transition hooks on subTree\r\n setTransitionHooks(vnode, vnode.transition);\r\n }\r\n // avoid vnode being mounted as fresh\r\n vnode.shapeFlag |= 512 /* COMPONENT_KEPT_ALIVE */;\r\n // make this key the freshest\r\n keys.delete(key);\r\n keys.add(key);\r\n }\r\n else {\r\n keys.add(key);\r\n // prune oldest entry\r\n if (max && keys.size > parseInt(max, 10)) {\r\n pruneCacheEntry(keys.values().next().value);\r\n }\r\n }\r\n // avoid vnode being unmounted\r\n vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;\r\n current = vnode;\r\n return rawVNode;\r\n };\r\n }\r\n};\r\n// export the public type for h/tsx inference\r\n// also to avoid inline import() in generated d.ts files\r\nconst KeepAlive = KeepAliveImpl;\r\nfunction matches(pattern, name) {\r\n if (isArray(pattern)) {\r\n return pattern.some((p) => matches(p, name));\r\n }\r\n else if (isString(pattern)) {\r\n return pattern.split(',').indexOf(name) > -1;\r\n }\r\n else if (pattern.test) {\r\n return pattern.test(name);\r\n }\r\n /* istanbul ignore next */\r\n return false;\r\n}\r\nfunction onActivated(hook, target) {\r\n registerKeepAliveHook(hook, \"a\" /* ACTIVATED */, target);\r\n}\r\nfunction onDeactivated(hook, target) {\r\n registerKeepAliveHook(hook, \"da\" /* DEACTIVATED */, target);\r\n}\r\nfunction registerKeepAliveHook(hook, type, target = currentInstance) {\r\n // cache the deactivate branch check wrapper for injected hooks so the same\r\n // hook can be properly deduped by the scheduler. \"__wdc\" stands for \"with\r\n // deactivation check\".\r\n const wrappedHook = hook.__wdc ||\r\n (hook.__wdc = () => {\r\n // only fire the hook if the target instance is NOT in a deactivated branch.\r\n let current = target;\r\n while (current) {\r\n if (current.isDeactivated) {\r\n return;\r\n }\r\n current = current.parent;\r\n }\r\n hook();\r\n });\r\n injectHook(type, wrappedHook, target);\r\n // In addition to registering it on the target instance, we walk up the parent\r\n // chain and register it on all ancestor instances that are keep-alive roots.\r\n // This avoids the need to walk the entire component tree when invoking these\r\n // hooks, and more importantly, avoids the need to track child components in\r\n // arrays.\r\n if (target) {\r\n let current = target.parent;\r\n while (current && current.parent) {\r\n if (isKeepAlive(current.parent.vnode)) {\r\n injectToKeepAliveRoot(wrappedHook, type, target, current);\r\n }\r\n current = current.parent;\r\n }\r\n }\r\n}\r\nfunction injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {\r\n // injectHook wraps the original for error handling, so make sure to remove\r\n // the wrapped version.\r\n const injected = injectHook(type, hook, keepAliveRoot, true /* prepend */);\r\n onUnmounted(() => {\r\n remove(keepAliveRoot[type], injected);\r\n }, target);\r\n}\r\nfunction resetShapeFlag(vnode) {\r\n let shapeFlag = vnode.shapeFlag;\r\n if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {\r\n shapeFlag -= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;\r\n }\r\n if (shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {\r\n shapeFlag -= 512 /* COMPONENT_KEPT_ALIVE */;\r\n }\r\n vnode.shapeFlag = shapeFlag;\r\n}\r\nfunction getInnerChild(vnode) {\r\n return vnode.shapeFlag & 128 /* SUSPENSE */ ? vnode.ssContent : vnode;\r\n}\n\nconst isInternalKey = (key) => key[0] === '_' || key === '$stable';\r\nconst normalizeSlotValue = (value) => isArray(value)\r\n ? value.map(normalizeVNode)\r\n : [normalizeVNode(value)];\r\nconst normalizeSlot = (key, rawSlot, ctx) => withCtx((props) => {\r\n if ((process.env.NODE_ENV !== 'production') && currentInstance) {\r\n warn(`Slot \"${key}\" invoked outside of the render function: ` +\r\n `this will not track dependencies used in the slot. ` +\r\n `Invoke the slot function inside the render function instead.`);\r\n }\r\n return normalizeSlotValue(rawSlot(props));\r\n}, ctx);\r\nconst normalizeObjectSlots = (rawSlots, slots) => {\r\n const ctx = rawSlots._ctx;\r\n for (const key in rawSlots) {\r\n if (isInternalKey(key))\r\n continue;\r\n const value = rawSlots[key];\r\n if (isFunction(value)) {\r\n slots[key] = normalizeSlot(key, value, ctx);\r\n }\r\n else if (value != null) {\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n warn(`Non-function value encountered for slot \"${key}\". ` +\r\n `Prefer function slots for better performance.`);\r\n }\r\n const normalized = normalizeSlotValue(value);\r\n slots[key] = () => normalized;\r\n }\r\n }\r\n};\r\nconst normalizeVNodeSlots = (instance, children) => {\r\n if ((process.env.NODE_ENV !== 'production') && !isKeepAlive(instance.vnode)) {\r\n warn(`Non-function value encountered for default slot. ` +\r\n `Prefer function slots for better performance.`);\r\n }\r\n const normalized = normalizeSlotValue(children);\r\n instance.slots.default = () => normalized;\r\n};\r\nconst initSlots = (instance, children) => {\r\n if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {\r\n const type = children._;\r\n if (type) {\r\n instance.slots = children;\r\n // make compiler marker non-enumerable\r\n def(children, '_', type);\r\n }\r\n else {\r\n normalizeObjectSlots(children, (instance.slots = {}));\r\n }\r\n }\r\n else {\r\n instance.slots = {};\r\n if (children) {\r\n normalizeVNodeSlots(instance, children);\r\n }\r\n }\r\n def(instance.slots, InternalObjectKey, 1);\r\n};\r\nconst updateSlots = (instance, children) => {\r\n const { vnode, slots } = instance;\r\n let needDeletionCheck = true;\r\n let deletionComparisonTarget = EMPTY_OBJ;\r\n if (vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {\r\n const type = children._;\r\n if (type) {\r\n // compiled slots.\r\n if ((process.env.NODE_ENV !== 'production') && isHmrUpdating) {\r\n // Parent was HMR updated so slot content may have changed.\r\n // force update slots and mark instance for hmr as well\r\n extend(slots, children);\r\n }\r\n else if (type === 1 /* STABLE */) {\r\n // compiled AND stable.\r\n // no need to update, and skip stale slots removal.\r\n needDeletionCheck = false;\r\n }\r\n else {\r\n // compiled but dynamic (v-if/v-for on slots) - update slots, but skip\r\n // normalization.\r\n extend(slots, children);\r\n }\r\n }\r\n else {\r\n needDeletionCheck = !children.$stable;\r\n normalizeObjectSlots(children, slots);\r\n }\r\n deletionComparisonTarget = children;\r\n }\r\n else if (children) {\r\n // non slot object children (direct value) passed to a component\r\n normalizeVNodeSlots(instance, children);\r\n deletionComparisonTarget = { default: 1 };\r\n }\r\n // delete stale slots\r\n if (needDeletionCheck) {\r\n for (const key in slots) {\r\n if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {\r\n delete slots[key];\r\n }\r\n }\r\n }\r\n};\n\n/**\r\nRuntime helper for applying directives to a vnode. Example usage:\r\n\nconst comp = resolveComponent('comp')\r\nconst foo = resolveDirective('foo')\r\nconst bar = resolveDirective('bar')\r\n\nreturn withDirectives(h(comp), [\r\n [foo, this.x],\r\n [bar, this.y]\r\n])\r\n*/\r\nconst isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');\r\nfunction validateDirectiveName(name) {\r\n if (isBuiltInDirective(name)) {\r\n warn('Do not use built-in directive ids as custom directive id: ' + name);\r\n }\r\n}\r\n/**\r\n * Adds directives to a VNode.\r\n */\r\nfunction withDirectives(vnode, directives) {\r\n const internalInstance = currentRenderingInstance;\r\n if (internalInstance === null) {\r\n (process.env.NODE_ENV !== 'production') && warn(`withDirectives can only be used inside render functions.`);\r\n return vnode;\r\n }\r\n const instance = internalInstance.proxy;\r\n const bindings = vnode.dirs || (vnode.dirs = []);\r\n for (let i = 0; i < directives.length; i++) {\r\n let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];\r\n if (isFunction(dir)) {\r\n dir = {\r\n mounted: dir,\r\n updated: dir\r\n };\r\n }\r\n bindings.push({\r\n dir,\r\n instance,\r\n value,\r\n oldValue: void 0,\r\n arg,\r\n modifiers\r\n });\r\n }\r\n return vnode;\r\n}\r\nfunction invokeDirectiveHook(vnode, prevVNode, instance, name) {\r\n const bindings = vnode.dirs;\r\n const oldBindings = prevVNode && prevVNode.dirs;\r\n for (let i = 0; i < bindings.length; i++) {\r\n const binding = bindings[i];\r\n if (oldBindings) {\r\n binding.oldValue = oldBindings[i].value;\r\n }\r\n const hook = binding.dir[name];\r\n if (hook) {\r\n callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [\r\n vnode.el,\r\n binding,\r\n vnode,\r\n prevVNode\r\n ]);\r\n }\r\n }\r\n}\n\nfunction createAppContext() {\r\n return {\r\n app: null,\r\n config: {\r\n isNativeTag: NO,\r\n performance: false,\r\n globalProperties: {},\r\n optionMergeStrategies: {},\r\n isCustomElement: NO,\r\n errorHandler: undefined,\r\n warnHandler: undefined\r\n },\r\n mixins: [],\r\n components: {},\r\n directives: {},\r\n provides: Object.create(null)\r\n };\r\n}\r\nlet uid = 0;\r\nfunction createAppAPI(render, hydrate) {\r\n return function createApp(rootComponent, rootProps = null) {\r\n if (rootProps != null && !isObject(rootProps)) {\r\n (process.env.NODE_ENV !== 'production') && warn(`root props passed to app.mount() must be an object.`);\r\n rootProps = null;\r\n }\r\n const context = createAppContext();\r\n const installedPlugins = new Set();\r\n let isMounted = false;\r\n const app = (context.app = {\r\n _uid: uid++,\r\n _component: rootComponent,\r\n _props: rootProps,\r\n _container: null,\r\n _context: context,\r\n version,\r\n get config() {\r\n return context.config;\r\n },\r\n set config(v) {\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n warn(`app.config cannot be replaced. Modify individual options instead.`);\r\n }\r\n },\r\n use(plugin, ...options) {\r\n if (installedPlugins.has(plugin)) {\r\n (process.env.NODE_ENV !== 'production') && warn(`Plugin has already been applied to target app.`);\r\n }\r\n else if (plugin && isFunction(plugin.install)) {\r\n installedPlugins.add(plugin);\r\n plugin.install(app, ...options);\r\n }\r\n else if (isFunction(plugin)) {\r\n installedPlugins.add(plugin);\r\n plugin(app, ...options);\r\n }\r\n else if ((process.env.NODE_ENV !== 'production')) {\r\n warn(`A plugin must either be a function or an object with an \"install\" ` +\r\n `function.`);\r\n }\r\n return app;\r\n },\r\n mixin(mixin) {\r\n if (__VUE_OPTIONS_API__) {\r\n if (!context.mixins.includes(mixin)) {\r\n context.mixins.push(mixin);\r\n // global mixin with props/emits de-optimizes props/emits\r\n // normalization caching.\r\n if (mixin.props || mixin.emits) {\r\n context.deopt = true;\r\n }\r\n }\r\n else if ((process.env.NODE_ENV !== 'production')) {\r\n warn('Mixin has already been applied to target app' +\r\n (mixin.name ? `: ${mixin.name}` : ''));\r\n }\r\n }\r\n else if ((process.env.NODE_ENV !== 'production')) {\r\n warn('Mixins are only available in builds supporting Options API');\r\n }\r\n return app;\r\n },\r\n component(name, component) {\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n validateComponentName(name, context.config);\r\n }\r\n if (!component) {\r\n return context.components[name];\r\n }\r\n if ((process.env.NODE_ENV !== 'production') && context.components[name]) {\r\n warn(`Component \"${name}\" has already been registered in target app.`);\r\n }\r\n context.components[name] = component;\r\n return app;\r\n },\r\n directive(name, directive) {\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n validateDirectiveName(name);\r\n }\r\n if (!directive) {\r\n return context.directives[name];\r\n }\r\n if ((process.env.NODE_ENV !== 'production') && context.directives[name]) {\r\n warn(`Directive \"${name}\" has already been registered in target app.`);\r\n }\r\n context.directives[name] = directive;\r\n return app;\r\n },\r\n mount(rootContainer, isHydrate) {\r\n if (!isMounted) {\r\n const vnode = createVNode(rootComponent, rootProps);\r\n // store app context on the root VNode.\r\n // this will be set on the root instance on initial mount.\r\n vnode.appContext = context;\r\n // HMR root reload\r\n if ((process.env.NODE_ENV !== 'production')) {\r\n context.reload = () => {\r\n render(cloneVNode(vnode), rootContainer);\r\n };\r\n }\r\n if (isHydrate && hydrate) {\r\n hydrate(vnode, rootContainer);\r\n }\r\n else {\r\n render(vnode, rootContainer);\r\n }\r\n isMounted = true;\r\n app._container = rootContainer;\r\n rootContainer.__vue_app__ = app;\r\n if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {\r\n devtoolsInitApp(app, version);\r\n }\r\n return vnode.component.proxy;\r\n }\r\n else if ((process.env.NODE_ENV !== 'production')) {\r\n warn(`App has already been mounted.\\n` +\r\n `If you want to remount the same app, move your app creation logic ` +\r\n `into a factory function and create fresh app instances for each ` +\r\n `mount - e.g. \\`const createMyApp = () => createApp(App)\\``);\r\n }\r\n },\r\n unmount() {\r\n if (isMounted) {\r\n render(null, app._container);\r\n if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {\r\n devtoolsUnmountApp(app);\r\n }\r\n delete app._container.__vue_app__;\r\n }\r\n else if ((process.env.NODE_ENV !== 'production')) {\r\n warn(`Cannot unmount an app that is not mounted.`);\r\n }\r\n },\r\n provide(key, value) {\r\n if ((process.env.NODE_ENV !== 'production') && key in context.provides) {\r\n warn(`App already provides property with key \"${String(key)}\". ` +\r\n `It will be overwritten with the new value.`);\r\n }\r\n // TypeScript doesn't allow symbols as index type\r\n // https://github.com/Microsoft/TypeScript/issues/24587\r\n context.provides[key] = value;\r\n return app;\r\n }\r\n });\r\n return app;\r\n };\r\n}\n\nlet hasMismatch = false;\r\nconst isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';\r\nconst isComment = (node) => node.nodeType === 8 /* COMMENT */;\r\n// Note: hydration is DOM-specific\r\n// But we have to place it in core due to tight coupling with core - splitting\r\n// it out creates a ton of unnecessary complexity.\r\n// Hydration also depends on some renderer internal logic which needs to be\r\n// passed in via arguments.\r\nfunction createHydrationFunctions(rendererInternals) {\r\n const { mt: mountComponent, p: patch, o: { patchProp, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;\r\n const hydrate = (vnode, container) => {\r\n if ((process.env.NODE_ENV !== 'production') && !container.hasChildNodes()) {\r\n warn(`Attempting to hydrate existing markup but container is empty. ` +\r\n `Performing full mount instead.`);\r\n patch(null, vnode, container);\r\n return;\r\n }\r\n hasMismatch = false;\r\n hydrateNode(container.firstChild, vnode, null, null);\r\n flushPostFlushCbs();\r\n if (hasMismatch && !false) {\r\n // this error should show up in production\r\n console.error(`Hydration completed but contains mismatches.`);\r\n }\r\n };\r\n const hydrateNode = (node, vnode, parentComponent, parentSuspense, optimized = false) => {\r\n const isFragmentStart = isComment(node) && node.data === '[';\r\n const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, isFragmentStart);\r\n const { type, ref, shapeFlag } = vnode;\r\n const domType = node.nodeType;\r\n vnode.el = node;\r\n let nextNode = null;\r\n switch (type) {\r\n case Text:\r\n if (domType !== 3 /* TEXT */) {\r\n nextNode = onMismatch();\r\n }\r\n else {\r\n if (node.data !== vnode.children) {\r\n hasMismatch = true;\r\n (process.env.NODE_ENV !== 'production') &&\r\n warn(`Hydration text mismatch:` +\r\n `\\n- Client: ${JSON.stringify(node.data)}` +\r\n `\\n- Server: ${JSON.stringify(vnode.children)}`);\r\n node.data = vnode.children;\r\n }\r\n nextNode = nextSibling(node);\r\n }\r\n break;\r\n case Comment:\r\n if (domType !== 8 /* COMMENT */ || isFragmentStart) {\r\n nextNode = onMismatch();\r\n }\r\n else {\r\n nextNode = nextSibling(node);\r\n }\r\n break;\r\n case Static:\r\n if (domType !== 1 /* ELEMENT */) {\r\n nextNode = onMismatch();\r\n }\r\n else {\r\n // determine anchor, adopt content\r\n nextNode = node;\r\n // if the static vnode has its content stripped during build,\r\n // adopt it from the server-rendered HTML.\r\n const needToAdoptContent = !vnode.children.length;\r\n for (let i = 0; i < vnode.staticCount; i++) {\r\n if (needToAdoptContent)\r\n vnode.children += nextNode.outerHTML;\r\n if (i === vnode.staticCount - 1) {\r\n vnode.anchor = nextNode;\r\n }\r\n nextNode = nextSibling(nextNode);\r\n }\r\n return nextNode;\r\n }\r\n break;\r\n case Fragment:\r\n if (!isFragmentStart) {\r\n nextNode = onMismatch();\r\n }\r\n else {\r\n nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, optimized);\r\n }\r\n break;\r\n default:\r\n if (shapeFlag & 1 /* ELEMENT */) {\r\n if (domType !== 1 /* ELEMENT */ ||\r\n vnode.type !== node.tagName.toLowerCase()) {\r\n nextNode = onMismatch();\r\n }\r\n else {\r\n nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, optimized);\r\n }\r\n }\r\n else if (shapeFlag & 6 /* COMPONENT */) {\r\n // when setting up the render effect, if the initial vnode already\r\n // has .el set, the component will perform hydration instead of mount\r\n // on its sub-tree.\r\n const container = parentNode(node);\r\n const hydrateComponent = () => {\r\n mountComponent(vnode, container, null, parentComponent, parentSuspense, isSVGContainer(container), optimized);\r\n };\r\n // async component\r\n const loadAsync = vnode.type.__asyncLoader;\r\n if (loadAsync) {\r\n loadAsync().then(hydrateComponent);\r\n }\r\n else {\r\n hydrateComponent();\r\n }\r\n // component may be async, so in the case of fragments we cannot rely\r\n // on component's rendered output to determine the end of the fragment\r\n // instead, we do a lookahead to find the end anchor node.\r\n nextNode = isFragmentStart\r\n ? locateClosingAsyncAnchor(node)\r\n : nextSibling(node);\r\n }\r\n else if (shapeFlag & 64 /* TELEPORT */) {\r\n if (domType !== 8 /* COMMENT */) {\r\n nextNode = onMismatch();\r\n }\r\n else {\r\n nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, optimized, rendererInternals, hydrateChildren);\r\n }\r\n }\r\n else if (shapeFlag & 128 /* SUSPENSE */) {\r\n nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, isSVGContainer(parentNode(node)), optimized, rendererInternals, hydrateNode);\r\n }\r\n else if ((process.env.NODE_ENV !== 'production')) {\r\n warn('Invalid HostVNode type:', type, `(${typeof type})`);\r\n }\r\n }\r\n if (ref != null) {\r\n setRef(ref, null, parentSuspense, vnode);\r\n }\r\n return nextNode;\r\n };\r\n const hydrateElement = (el, vnode, parentComponent, parentSuspense, optimized) => {\r\n optimized = optimized || !!vnode.dynamicChildren;\r\n const { props, patchFlag, shapeFlag, dirs } = vnode;\r\n // skip props & children if this is hoisted static nodes\r\n if (patchFlag !== -1 /* HOISTED */) {\r\n if (dirs) {\r\n invokeDirectiveHook(vnode, null, parentComponent, 'created');\r\n }\r\n // props\r\n if (props) {\r\n if (!optimized ||\r\n (patchFlag & 16 /* FULL_PROPS */ ||\r\n patchFlag & 32 /* HYDRATE_EVENTS */)) {\r\n for (const key in props) {\r\n if (!isReservedProp(key) && isOn(key)) {\r\n patchProp(el, key, null, props[key]);\r\n }\r\n }\r\n }\r\n else if (props.onClick) {\r\n // Fast path for click listeners (which is most often) to avoid\r\n // iterating through props.\r\n patchProp(el, 'onClick', null, props.onClick);\r\n }\r\n }\r\n // vnode / directive hooks\r\n let vnodeHooks;\r\n if ((vnodeHooks = props && props.onVnodeBeforeMount)) {\r\n invokeVNodeHook(vnodeHooks, parentComponent, vnode);\r\n }\r\n if (dirs) {\r\n invokeDirectiveHook(vnode, null, parentComponent, 'beforeMount');\r\n }\r\n if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {\r\n queueEffectWithSuspense(() => {\r\n vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);\r\n dirs && invokeDirectiveHook(vnode, null, parentComponent, 'mounted');\r\n }, parentSuspense);\r\n }\r\n // children\r\n if (shapeFlag & 16 /* ARRAY_CHILDREN */ &&\r\n // skip if element has innerHTML / textContent\r\n !(props && (props.innerHTML || props.textContent))) {\r\n let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, optimized);\r\n let hasWarned = false;\r\n while (next) {\r\n hasMismatch = true;\r\n if ((process.env.NODE_ENV !== 'production') && !hasWarned) {\r\n warn(`Hydration children mismatch in <${vnode.type}>: ` +\r\n `server rendered element contains more child nodes than client vdom.`);\r\n hasWarned = true;\r\n }\r\n // The SSRed DOM contains more nodes than it should. Remove them.\r\n const cur = next;\r\n next = next.nextSibling;\r\n remove(cur);\r\n }\r\n }\r\n else if (shapeFlag & 8 /* TEXT_CHILDREN */) {\r\n if (el.textContent !== vnode.children) {\r\n hasMismatch = true;\r\n (process.env.NODE_ENV !== 'production') &&\r\n warn(`Hydration text content mismatch in <${vnode.type}>:\\n` +\r\n `- Client: ${el.textContent}\\n` +\r\n `- Server: ${vnode.children}`);\r\n el.textContent = vnode.children;\r\n }\r\n }\r\n }\r\n return el.nextSibling;\r\n };\r\n const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, optimized) => {\r\n optimized = optimized || !!parentVNode.dynamicChildren;\r\n const children = parentVNode.children;\r\n const l = children.length;\r\n let hasWarned = false;\r\n for (let i = 0; i < l; i++) {\r\n const vnode = optimized\r\n ? children[i]\r\n : (children[i] = normalizeVNode(children[i]));\r\n if (node) {\r\n node = hydrateNode(node, vnode, parentComponent, parentSuspense, optimized);\r\n }\r\n else {\r\n hasMismatch = true;\r\n if ((process.env.NODE_ENV !== 'production') && !hasWarned) {\r\n warn(`Hydration children mismatch in <${container.tagName.toLowerCase()}>: ` +\r\n `server rendered element contains fewer child nodes than client vdom.`);\r\n hasWarned = true;\r\n }\r\n // the SSRed DOM didn't contain enough nodes. Mount the missing ones.\r\n patch(null, vnode, container, null, parentComponent, parentSuspense, isSVGContainer(container));\r\n }\r\n }\r\n return node;\r\n };\r\n const hydrateFragment = (node, vnode, parentComponent, parentSuspense, optimized) => {\r\n const container = parentNode(node);\r\n const next = hydrateChildren(nextSibling(node), vnode, container, parentComponent, parentSuspense, optimized);\r\n if (next && isComment(next) && next.data === ']') {\r\n return nextSibling((vnode.anchor = next));\r\n }\r\n else {\r\n // fragment didn't hydrate successfully, since we didn't get a end anchor\r\n // back. This should have led to node/children mismatch warnings.\r\n hasMismatch = true;\r\n // since the anchor is missing, we need to create one and insert it\r\n insert((vnode.anchor = createComment(`]`)), container, next);\r\n return next;\r\n }\r\n };\r\n const handleMismatch = (node, vnode, parentComponent, parentSuspense, isFragment) => {\r\n hasMismatch = true;\r\n (process.env.NODE_ENV !== 'production') &&\r\n warn(`Hydration node mismatch:\\n- Client vnode:`, vnode.type, `\\n- Server rendered DOM:`, node, node.nodeType === 3 /* TEXT */\r\n ? `(text)`\r\n : isComment(node) && node.data === '['\r\n ? `(start of fragment)`\r\n : ``);\r\n vnode.el = null;\r\n if (isFragment) {\r\n // remove excessive fragment nodes\r\n const end = locateClosingAsyncAnchor(node);\r\n while (true) {\r\n const next = nextSibling(node);\r\n if (next && next !== end) {\r\n remove(next);\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n const next = nextSibling(node);\r\n const container = parentNode(node);\r\n remove(node);\r\n patch(null, vnode, container, next, parentComponent, parentSuspense, isSVGContainer(container));\r\n return next;\r\n };\r\n const locateClosingAsyncAnchor = (node) => {\r\n let match = 0;\r\n while (node) {\r\n node = nextSibling(node);\r\n if (node && isComment(node)) {\r\n if (node.data === '[')\r\n match++;\r\n if (node.data === ']') {\r\n if (match === 0) {\r\n return nextSibling(node);\r\n }\r\n else {\r\n match--;\r\n }\r\n }\r\n }\r\n }\r\n return node;\r\n };\r\n return [hydrate, hydrateNode];\r\n}\n\nlet supported;\r\nlet perf;\r\nfunction startMeasure(instance, type) {\r\n if (instance.appContext.config.performance && isSupported()) {\r\n perf.mark(`vue-${type}-${instance.uid}`);\r\n }\r\n}\r\nfunction endMeasure(instance, type) {\r\n if (instance.appContext.config.performance && isSupported()) {\r\n const startTag = `vue-${type}-${instance.uid}`;\r\n const endTag = startTag + `:end`;\r\n perf.mark(endTag);\r\n perf.measure(`<${formatComponentName(instance, instance.type)}> ${type}`, startTag, endTag);\r\n perf.clearMarks(startTag);\r\n perf.clearMarks(endTag);\r\n }\r\n}\r\nfunction isSupported() {\r\n if (supported !== undefined) {\r\n return supported;\r\n }\r\n /* eslint-disable no-restricted-globals */\r\n if (typeof window !== 'undefined' && window.performance) {\r\n supported = true;\r\n perf = window.performance;\r\n }\r\n else {\r\n supported = false;\r\n }\r\n /* eslint-enable no-restricted-globals */\r\n return supported;\r\n}\n\n/**\r\n * This is only called in esm-bundler builds.\r\n * It is called when a renderer is created, in `baseCreateRenderer` so that\r\n * importing runtime-core is side-effects free.\r\n *\r\n * istanbul-ignore-next\r\n */\r\nfunction initFeatureFlags() {\r\n let needWarn = false;\r\n if (typeof __VUE_OPTIONS_API__ !== 'boolean') {\r\n needWarn = true;\r\n getGlobalThis().__VUE_OPTIONS_API__ = true;\r\n }\r\n if (typeof __VUE_PROD_DEVTOOLS__ !== 'boolean') {\r\n needWarn = true;\r\n getGlobalThis().__VUE_PROD_DEVTOOLS__ = false;\r\n }\r\n if ((process.env.NODE_ENV !== 'production') && needWarn) {\r\n console.warn(`You are running the esm-bundler build of Vue. It is recommended to ` +\r\n `configure your bundler to explicitly replace feature flag globals ` +\r\n `with boolean literals to get proper tree-shaking in the final bundle. ` +\r\n `See http://link.vuejs.org/feature-flags for more details.`);\r\n }\r\n}\n\n// implementation, close to no-op\r\nfunction defineComponent(options) {\r\n return isFunction(options) ? { setup: options, name: options.name } : options;\r\n}\n\nconst isAsyncWrapper = (i) => !!i.type.__asyncLoader;\r\nfunction defineAsyncComponent(source) {\r\n if (isFunction(source)) {\r\n source = { loader: source };\r\n }\r\n const { loader, loadingComponent, errorComponent, delay = 200, timeout, // undefined = never times out\r\n suspensible = true, onError: userOnError } = source;\r\n let pendingRequest = null;\r\n let resolvedComp;\r\n let retries = 0;\r\n const retry = () => {\r\n retries++;\r\n pendingRequest = null;\r\n return load();\r\n };\r\n const load = () => {\r\n let thisRequest;\r\n return (pendingRequest ||\r\n (thisRequest = pendingRequest = loader()\r\n .catch(err => {\r\n err = err instanceof Error ? err : new Error(String(err));\r\n if (userOnError) {\r\n return new Promise((resolve, reject) => {\r\n const userRetry = () => resolve(retry());\r\n const userFail = () => reject(err);\r\n userOnError(err, userRetry, userFail, retries + 1);\r\n });\r\n }\r\n else {\r\n throw err;\r\n }\r\n })\r\n .then((comp) => {\r\n if (thisRequest !== pendingRequest && pendingRequest) {\r\n return pendingRequest;\r\n }\r\n if ((process.env.NODE_ENV !== 'production') && !comp) {\r\n warn(`Async component loader resolved to undefined. ` +\r\n `If you are using retry(), make sure to return its return value.`);\r\n }\r\n // interop module default\r\n if (comp &&\r\n (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {\r\n comp = comp.default;\r\n }\r\n if ((process.env.NODE_ENV !== 'production') && comp && !isObject(comp) && !isFunction(comp)) {\r\n throw new Error(`Invalid async component load result: ${comp}`);\r\n }\r\n resolvedComp = comp;\r\n return comp;\r\n })));\r\n };\r\n return defineComponent({\r\n __asyncLoader: load,\r\n name: 'AsyncComponentWrapper',\r\n setup() {\r\n const instance = currentInstance;\r\n // already resolved\r\n if (resolvedComp) {\r\n return () => createInnerComp(resolvedComp, instance);\r\n }\r\n const onError = (err) => {\r\n pendingRequest = null;\r\n handleError(err, instance, 13 /* ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);\r\n };\r\n // suspense-controlled or SSR.\r\n if ((suspensible && instance.suspense) ||\r\n (false )) {\r\n return load()\r\n .then(comp => {\r\n return () => createInnerComp(comp, instance);\r\n })\r\n .catch(err => {\r\n onError(err);\r\n return () => errorComponent\r\n ? createVNode(errorComponent, {\r\n error: err\r\n })\r\n : null;\r\n });\r\n }\r\n const loaded = ref(false);\r\n const error = ref();\r\n const delayed = ref(!!delay);\r\n if (delay) {\r\n setTimeout(() => {\r\n delayed.value = false;\r\n }, delay);\r\n }\r\n if (timeout != null) {\r\n setTimeout(() => {\r\n if (!loaded.value && !error.value) {\r\n const err = new Error(`Async component timed out after ${timeout}ms.`);\r\n onError(err);\r\n error.value = err;\r\n }\r\n }, timeout);\r\n }\r\n load()\r\n .then(() => {\r\n loaded.value = true;\r\n })\r\n .catch(err => {\r\n onError(err);\r\n error.value = err;\r\n });\r\n return () => {\r\n if (loaded.value && resolvedComp) {\r\n return createInnerComp(resolvedComp, instance);\r\n }\r\n else if (error.value && errorComponent) {\r\n return createVNode(errorComponent, {\r\n error: error.value\r\n });\r\n }\r\n else if (loadingComponent && !delayed.value) {\r\n return createVNode(loadingComponent);\r\n }\r\n };\r\n }\r\n });\r\n}\r\nfunction createInnerComp(comp, { vnode: { ref, props, children } }) {\r\n const vnode = createVNode(comp, props, children);\r\n // ensure inner component inherits the async wrapper's ref owner\r\n vnode.ref = ref;\r\n return vnode;\r\n}\n\nconst prodEffectOptions = {\r\n scheduler: queueJob,\r\n // #1801, #2043 component render effects should allow recursive updates\r\n allowRecurse: true\r\n};\r\nfunction createDevEffectOptions(instance) {\r\n return {\r\n scheduler: queueJob,\r\n allowRecurse: true,\r\n onTrack: instance.rtc ? e => invokeArrayFns(instance.rtc, e) : void 0,\r\n onTrigger: instance.rtg ? e => invokeArrayFns(instance.rtg, e) : void 0\r\n };\r\n}\r\nconst queuePostRenderEffect = queueEffectWithSuspense\r\n ;\r\nconst setRef = (rawRef, oldRawRef, parentSuspense, vnode) => {\r\n if (isArray(rawRef)) {\r\n rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode));\r\n return;\r\n }\r\n let value;\r\n if (!vnode || isAsyncWrapper(vnode)) {\r\n value = null;\r\n }\r\n else {\r\n if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {\r\n value = vnode.component.exposed || vnode.component.proxy;\r\n }\r\n else {\r\n value = vnode.el;\r\n }\r\n }\r\n const { i: owner, r: ref } = rawRef;\r\n if ((process.env.NODE_ENV !== 'production') && !owner) {\r\n warn(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +\r\n `A vnode with ref must be created inside the render function.`);\r\n return;\r\n }\r\n const oldRef = oldRawRef && oldRawRef.r;\r\n const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;\r\n const setupState = owner.setupState;\r\n // unset old ref\r\n if (oldRef != null && oldRef !== ref) {\r\n if (isString(oldRef)) {\r\n refs[oldRef] = null;\r\n if (hasOwn(setupState, oldRef)) {\r\n setupState[oldRef] = null;\r\n }\r\n }\r\n else if (isRef(oldRef)) {\r\n oldRef.value = null;\r\n }\r\n }\r\n if (isString(ref)) {\r\n const doSet = () => {\r\n refs[ref] = value;\r\n if (hasOwn(setupState, ref)) {\r\n setupState[ref] = value;\r\n }\r\n };\r\n // #1789: for non-null values, set them after render\r\n // null values means this is unmount and it should not overwrite another\r\n // ref with the same key\r\n if (value) {\r\n doSet.id = -1;\r\n queuePostRenderEffect(doSet, parentSuspense);\r\n }\r\n else {\r\n doSet();\r\n }\r\n }\r\n else if (isRef(ref)) {\r\n const doSet = () => {\r\n ref.value = value;\r\n };\r\n if (value) {\r\n doSet.id = -1;\r\n queuePostRenderEffect(doSet, parentSuspense);\r\n }\r\n else {\r\n doSet();\r\n }\r\n }\r\n else if (isFunction(ref)) {\r\n callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);\r\n }\r\n else if ((process.env.NODE_ENV !== 'production')) {\r\n warn('Invalid template ref type:', value, `(${typeof value})`);\r\n }\r\n};\r\n/**\r\n * The createRenderer function accepts two generic arguments:\r\n * HostNode and HostElement, corresponding to Node and Element types in the\r\n * host environment. For example, for runtime-dom, HostNode would be the DOM\r\n * `Node` interface and HostElement would be the DOM `Element` interface.\r\n *\r\n * Custom renderers can pass in the platform specific types like this:\r\n *\r\n * ``` js\r\n * const { render, createApp } = createRenderer({\r\n * patchProp,\r\n * ...nodeOps\r\n * })\r\n * ```\r\n */\r\nfunction createRenderer(options) {\r\n return baseCreateRenderer(options);\r\n}\r\n// Separate API for creating hydration-enabled renderer.\r\n// Hydration logic is only used when calling this function, making it\r\n// tree-shakable.\r\nfunction createHydrationRenderer(options) {\r\n return baseCreateRenderer(options, createHydrationFunctions);\r\n}\r\n// implementation\r\nfunction baseCreateRenderer(options, createHydrationFns) {\r\n // compile-time feature flags check\r\n {\r\n initFeatureFlags();\r\n }\r\n if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {\r\n const target = getGlobalThis();\r\n target.__VUE__ = true;\r\n setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__);\r\n }\r\n const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, forcePatchProp: hostForcePatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = NOOP, cloneNode: hostCloneNode, insertStaticContent: hostInsertStaticContent } = options;\r\n // Note: functions inside this closure should use `const xxx = () => {}`\r\n // style in order to prevent being inlined by minifiers.\r\n const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, optimized = false) => {\r\n // patching & not same type, unmount old tree\r\n if (n1 && !isSameVNodeType(n1, n2)) {\r\n anchor = getNextHostNode(n1);\r\n unmount(n1, parentComponent, parentSuspense, true);\r\n n1 = null;\r\n }\r\n if (n2.patchFlag === -2 /* BAIL */) {\r\n optimized = false;\r\n n2.dynamicChildren = null;\r\n }\r\n const { type, ref, shapeFlag } = n2;\r\n switch (type) {\r\n case Text:\r\n processText(n1, n2, container, anchor);\r\n break;\r\n case Comment:\r\n processCommentNode(n1, n2, container, anchor);\r\n break;\r\n case Static:\r\n if (n1 == null) {\r\n mountStaticNode(n2, container, anchor, isSVG);\r\n }\r\n else if ((process.env.NODE_ENV !== 'production')) {\r\n patchStaticNode(n1, n2, container, isSVG);\r\n }\r\n break;\r\n case Fragment:\r\n processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);\r\n break;\r\n default:\r\n if (shapeFlag & 1 /* ELEMENT */) {\r\n processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);\r\n }\r\n else if (shapeFlag & 6 /* COMPONENT */) {\r\n processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);\r\n }\r\n else if (shapeFlag & 64 /* TELEPORT */) {\r\n type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized, internals);\r\n }\r\n else if (shapeFlag & 128 /* SUSPENSE */) {\r\n type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized, internals);\r\n }\r\n else if ((process.env.NODE_ENV !== 'production')) {\r\n warn('Invalid VNode type:', type, `(${typeof type})`);\r\n }\r\n }\r\n // set ref\r\n if (ref != null && parentComponent) {\r\n setRef(ref, n1 && n1.ref, parentSuspense, n2);\r\n }\r\n };\r\n const processText = (n1, n2, container, anchor) => {\r\n if (n1 == null) {\r\n hostInsert((n2.el = hostCreateText(n2.children)), container, anchor);\r\n }\r\n else {\r\n const el = (n2.el = n1.el);\r\n if (n2.children !== n1.children) {\r\n hostSetText(el, n2.children);\r\n }\r\n }\r\n };\r\n const processCommentNode = (n1, n2, container, anchor) => {\r\n if (n1 == null) {\r\n hostInsert((n2.el = hostCreateComment(n2.children || '')), container, anchor);\r\n }\r\n else {\r\n // there's no support for dynamic comments\r\n n2.el = n1.el;\r\n }\r\n };\r\n const mountStaticNode = (n2, container, anchor, isSVG) => {\r\n [n2.el, n2.anchor] = hostInsertStaticContent(n2.children, container, anchor, isSVG);\r\n };\r\n /**\r\n * Dev / HMR only\r\n */\r\n const patchStaticNode = (n1, n2, container, isSVG) => {\r\n // static nodes are only patched during dev for HMR\r\n if (n2.children !== n1.children) {\r\n const anchor = hostNextSibling(n1.anchor);\r\n // remove existing\r\n removeStaticNode(n1);\r\n [n2.el, n2.anchor] = hostInsertStaticContent(n2.children, container, anchor, isSVG);\r\n }\r\n else {\r\n n2.el = n1.el;\r\n n2.anchor = n1.anchor;\r\n }\r\n };\r\n const moveStaticNode = ({ el, anchor }, container, nextSibling) => {\r\n let next;\r\n while (el && el !== anchor) {\r\n next = hostNextSibling(el);\r\n hostInsert(el, container, nextSibling);\r\n el = next;\r\n }\r\n hostInsert(anchor, container, nextSibling);\r\n };\r\n const removeStaticNode = ({ el, anchor }) => {\r\n let next;\r\n while (el && el !== anchor) {\r\n next = hostNextSibling(el);\r\n hostRemove(el);\r\n el = next;\r\n }\r\n hostRemove(anchor);\r\n };\r\n const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {\r\n isSVG = isSVG || n2.type === 'svg';\r\n if (n1 == null) {\r\n mountElement(n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);\r\n }\r\n else {\r\n patchElement(n1, n2, parentComponent, parentSuspense, isSVG, optimized);\r\n }\r\n };\r\n const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {\r\n let el;\r\n let vnodeHook;\r\n const { type, props, shapeFlag, transition, scopeId, patchFlag, dirs } = vnode;\r\n if (!(process.env.NODE_ENV !== 'production') &&\r\n vnode.el &&\r\n hostCloneNode !== undefined &&\r\n patchFlag === -1 /* HOISTED */) {\r\n // If a vnode has non-null el, it means it's being reused.\r\n // Only static vnodes can be reused, so its mounted DOM nodes should be\r\n // exactly the same, and we can simply do a clone here.\r\n // only do this in production since cloned trees cannot be HMR updated.\r\n el = vnode.el = hostCloneNode(vnode.el);\r\n }\r\n else {\r\n el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is);\r\n // mount children first, since some props may rely on child content\r\n // being already rendered, e.g. `