@wearenotch/ui-react 0.2.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +19 -19
- package/dist/index.css +1 -1
- package/dist/index.d.ts +27 -2
- package/dist/index.esm.js +4699 -4648
- package/package.json +12 -3
package/dist/index.cjs.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),x=require("react"),qu=require("react-dom");function Ku(n){var e,t,s="";if(typeof n=="string"||typeof n=="number")s+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=Ku(n[e]))&&(s&&(s+=" "),s+=t)}else for(t in n)n[t]&&(s&&(s+=" "),s+=t);return s}function N(){for(var n,e,t=0,s="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=Ku(n))&&(s&&(s+=" "),s+=e);return s}const Rg="_button_r0s18_2",zg="_loading_r0s18_112",Bg="_icon_r0s18_116",jg="_label_r0s18_122",Lg="_spinner_r0s18_128",Fg="_spin_r0s18_128",rt={button:Rg,"size-sm":"_size-sm_r0s18_35","size-md":"_size-md_r0s18_41","size-lg":"_size-lg_r0s18_47","variant-primary":"_variant-primary_r0s18_54","variant-secondary":"_variant-secondary_r0s18_64","variant-tertiary":"_variant-tertiary_r0s18_74","variant-link":"_variant-link_r0s18_83","variant-destructive":"_variant-destructive_r0s18_97","full-width":"_full-width_r0s18_108",loading:zg,icon:Bg,label:jg,spinner:Lg,spin:Fg},Uu=x.forwardRef(({children:n,variant:e="primary",size:t="md",disabled:s=!1,loading:i=!1,type:r="button",leftIcon:o,rightIcon:a,fullWidth:l=!1,onClick:c,"aria-label":d,className:u},h)=>y.jsxs("button",{ref:h,type:r,disabled:s||i,onClick:c,"aria-label":d,"aria-disabled":s||i,"aria-busy":i,className:N(rt.button,rt[`variant-${e}`],rt[`size-${t}`],l&&rt["full-width"],i&&rt.loading,u),children:[i&&y.jsx("span",{className:rt.spinner,"aria-hidden":"true"}),!i&&o&&y.jsx("span",{className:rt.icon,children:o}),y.jsx("span",{className:rt.label,children:n}),!i&&a&&y.jsx("span",{className:rt.icon,children:a})]}));Uu.displayName="Button";const $l={"icon-button":"_icon-button_qn5w1_2","size-sm":"_size-sm_qn5w1_7","size-md":"_size-md_qn5w1_12","size-lg":"_size-lg_qn5w1_17"},Ju=x.forwardRef(({icon:n,"aria-label":e,variant:t="primary",size:s="md",disabled:i=!1,loading:r=!1,type:o="button",onClick:a,className:l},c)=>y.jsx("button",{ref:c,type:o,disabled:i||r,onClick:a,"aria-label":e,"aria-disabled":i||r,"aria-busy":r,className:N(rt.button,rt[`variant-${t}`],$l["icon-button"],$l[`size-${s}`],r&&rt.loading,l),children:r?y.jsx("span",{className:rt.spinner,"aria-hidden":"true"}):y.jsx("span",{"aria-hidden":"true",children:n})}));Ju.displayName="IconButton";const Wg="_wrapper_num9n_1",$g="_label_num9n_8",Hg="_required_num9n_18",Vg="_error_num9n_42",Yg="_disabled_num9n_51",qg="_readonly_num9n_58",Kg="_input_num9n_22",Ug="_leading_num9n_82",Jg="_trailing_num9n_83",nt={wrapper:Wg,label:$g,required:Hg,"input-wrapper":"_input-wrapper_num9n_22","size-sm":"_size-sm_num9n_38","size-md":"_size-md_num9n_39","size-lg":"_size-lg_num9n_40",error:Vg,disabled:Yg,readonly:qg,input:Kg,leading:Ug,trailing:Jg,"helper-text":"_helper-text_num9n_91","error-message":"_error-message_num9n_97"},Gu=x.forwardRef(({id:n,name:e,type:t="text",value:s,defaultValue:i,placeholder:r,label:o,helperText:a,errorMessage:l,size:c="md",disabled:d=!1,required:u=!1,readOnly:h=!1,leadingContent:f,trailingContent:p,maxLength:m,onChange:g,onBlur:b,onFocus:S,className:_,"aria-describedby":k},v)=>{const w=x.useId(),M=n??w,C=`${M}-helper`,O=`${M}-error`,D=!!l,A=[k,a?C:null,D?O:null].filter(Boolean).join(" ")||void 0;return y.jsxs("div",{className:N(nt.wrapper,_),children:[o&&y.jsxs("label",{htmlFor:M,className:nt.label,children:[o,u&&y.jsx("span",{className:nt.required,"aria-hidden":"true",children:" *"})]}),y.jsxs("div",{className:N(nt["input-wrapper"],nt[`size-${c}`],D&&nt.error,d&&nt.disabled,h&&nt.readonly),children:[f&&y.jsx("span",{className:nt.leading,"aria-hidden":"true",children:f}),y.jsx("input",{ref:v,id:M,name:e,type:t,value:s,defaultValue:i,placeholder:r,disabled:d,required:u,readOnly:h,maxLength:m,"aria-invalid":D,"aria-describedby":A,"aria-required":u,onChange:g,onBlur:b,onFocus:S,className:nt.input}),p&&y.jsx("span",{className:nt.trailing,"aria-hidden":"true",children:p})]}),a&&!D&&y.jsx("span",{id:C,className:nt["helper-text"],children:a}),D&&y.jsx("span",{id:O,role:"alert",className:nt["error-message"],children:l})]})});Gu.displayName="Input";const Gg="_wrapper_15ssi_1",Xg="_label_15ssi_8",Qg="_required_15ssi_18",Zg="_error_15ssi_35",ey="_disabled_15ssi_44",ty="_readonly_15ssi_51",ny="_textarea_15ssi_22",sy="_footer_15ssi_83",st={wrapper:Gg,label:Xg,required:Qg,"textarea-wrapper":"_textarea-wrapper_15ssi_22",error:Zg,disabled:ey,readonly:ty,textarea:ny,"no-resize":"_no-resize_15ssi_79",footer:sy,"helper-text":"_helper-text_15ssi_90","error-message":"_error-message_15ssi_96","char-count":"_char-count_15ssi_102"},Xu=x.forwardRef(({id:n,name:e,value:t,defaultValue:s,placeholder:i,label:r,helperText:o,errorMessage:a,disabled:l=!1,required:c=!1,readOnly:d=!1,autoResize:u=!1,rows:h=3,maxLength:f,showCount:p=!1,onChange:m,onBlur:g,className:b},S)=>{const _=x.useId(),k=n??_,v=`${k}-helper`,w=`${k}-error`,M=!!a,[C,O]=x.useState((s??t??"").length),D=[o?v:null,M?w:null].filter(Boolean).join(" ")||void 0,A=F=>{if(u){const j=F.currentTarget;j.style.height="auto",j.style.height=`${j.scrollHeight}px`}},P=F=>{O(F.target.value.length),m?.(F)};return y.jsxs("div",{className:N(st.wrapper,b),children:[r&&y.jsxs("label",{htmlFor:k,className:st.label,children:[r,c&&y.jsx("span",{className:st.required,"aria-hidden":"true",children:" *"})]}),y.jsx("div",{className:N(st["textarea-wrapper"],M&&st.error,l&&st.disabled,d&&st.readonly),children:y.jsx("textarea",{ref:S,id:k,name:e,value:t,defaultValue:s,placeholder:i,disabled:l,required:c,readOnly:d,rows:h,maxLength:f,"aria-invalid":M,"aria-describedby":D,"aria-required":c,onInput:A,onChange:P,onBlur:g,className:N(st.textarea,u&&st["no-resize"])})}),y.jsxs("div",{className:st.footer,children:[y.jsxs("div",{children:[o&&!M&&y.jsx("span",{id:v,className:st["helper-text"],children:o}),M&&y.jsx("span",{id:w,role:"alert",className:st["error-message"],children:a})]}),p&&f!==void 0&&y.jsxs("span",{className:st["char-count"],"aria-live":"polite",children:[C,"/",f]})]})]})});Xu.displayName="Textarea";const iy="_wrapper_r21q6_1",ry="_label_r21q6_7",oy="_box_r21q6_30",ay="_checked_r21q6_49",ly="_indeterminate_r21q6_50",cy="_error_r21q6_55",dy="_disabled_r21q6_59",uy="_checkmark_r21q6_65",hy="_dash_r21q6_75",Ye={wrapper:iy,label:ry,"label-disabled":"_label-disabled_r21q6_15","hidden-input":"_hidden-input_r21q6_21",box:oy,checked:ay,indeterminate:ly,error:cy,disabled:dy,checkmark:uy,dash:hy,"label-text":"_label-text_r21q6_83","helper-text":"_helper-text_r21q6_90","error-message":"_error-message_r21q6_97"},Qu=x.forwardRef(({id:n,indeterminate:e=!1,label:t,helperText:s,errorMessage:i,className:r,checked:o,disabled:a,...l},c)=>{const d=x.useRef(null),u=c??d,h=x.useId(),f=n??h,p=`${f}-helper`,m=`${f}-error`,g=!!i;return x.useEffect(()=>{u.current&&(u.current.indeterminate=e)},[e,u]),y.jsxs("div",{className:N(Ye.wrapper,r),children:[y.jsxs("label",{htmlFor:f,className:N(Ye.label,a&&Ye["label-disabled"]),children:[y.jsx("input",{...l,ref:u,id:f,type:"checkbox",checked:o,disabled:a,"aria-invalid":g,"aria-describedby":[s?p:null,g?m:null].filter(Boolean).join(" ")||void 0,className:Ye["hidden-input"]}),y.jsx("span",{className:N(Ye.box,o&&Ye.checked,e&&Ye.indeterminate,a&&Ye.disabled,g&&Ye.error),"aria-hidden":"true",children:e?y.jsx("span",{className:Ye.dash}):o?y.jsx("span",{className:Ye.checkmark}):null}),t&&y.jsx("span",{className:Ye["label-text"],children:t})]}),s&&!g&&y.jsx("span",{id:p,className:Ye["helper-text"],children:s}),g&&y.jsx("span",{id:m,role:"alert",className:Ye["error-message"],children:i})]})});Qu.displayName="Checkbox";const fy="_wrapper_jyuvx_1",py="_disabled_jyuvx_9",my="_track_jyuvx_24",gy="_thumb_jyuvx_56",An={wrapper:fy,disabled:py,"hidden-input":"_hidden-input_jyuvx_15",track:my,"size-md":"_size-md_jyuvx_33","size-sm":"_size-sm_jyuvx_38",thumb:gy,"label-text":"_label-text_jyuvx_84"},Zu=x.forwardRef(({id:n,name:e,checked:t,defaultChecked:s,disabled:i=!1,label:r,labelPosition:o="right",size:a="md",onChange:l,className:c,"aria-label":d},u)=>{const h=x.useId(),f=n??h,p=y.jsx("span",{className:N(An.track,An[`size-${a}`]),"aria-hidden":"true",children:y.jsx("span",{className:An.thumb})}),m=r&&y.jsx("span",{className:An["label-text"],children:r});return y.jsxs("label",{htmlFor:f,className:N(An.wrapper,i&&An.disabled,c),children:[o==="left"&&m,y.jsx("input",{ref:u,id:f,name:e,type:"checkbox",role:"switch",checked:t,defaultChecked:s,disabled:i,"aria-label":d??void 0,"aria-checked":t,onChange:l,className:An["hidden-input"]}),p,o==="right"&&m]})});Zu.displayName="Switch";const yy="_wrapper_7cpyp_1",by="_label_7cpyp_8",xy="_required_7cpyp_18",Ls={wrapper:yy,label:by,required:xy,"helper-text":"_helper-text_7cpyp_22","error-message":"_error-message_7cpyp_28"};function eh({label:n,helperText:e,errorMessage:t,required:s=!1,disabled:i=!1,children:r,className:o}){const a=x.useId(),l=r.props.id??a,c=`${l}-helper`,d=`${l}-error`,u=!!t,h=[e?c:null,u?d:null].filter(Boolean).join(" ")||void 0,f=x.cloneElement(r,{id:l,"aria-describedby":h,"aria-invalid":u||void 0,"aria-required":s||void 0,disabled:i||r.props.disabled});return y.jsxs("div",{className:N(Ls.wrapper,o),children:[n&&y.jsxs("label",{htmlFor:l,className:Ls.label,children:[n,s&&y.jsx("span",{className:Ls.required,"aria-hidden":"true",children:" *"})]}),f,e&&!u&&y.jsx("span",{id:c,className:Ls["helper-text"],children:e}),u&&y.jsx("span",{id:d,role:"alert",className:Ls["error-message"],children:t})]})}eh.displayName="FormField";const _y="_badge_2rw1o_1",ky="_dot_2rw1o_47",Wi={badge:_y,"size-sm":"_size-sm_2rw1o_12","size-md":"_size-md_2rw1o_13","size-lg":"_size-lg_2rw1o_14","variant-default":"_variant-default_2rw1o_17","variant-primary":"_variant-primary_2rw1o_21","variant-success":"_variant-success_2rw1o_25","variant-warning":"_variant-warning_2rw1o_29","variant-error":"_variant-error_2rw1o_33","variant-info":"_variant-info_2rw1o_37","variant-neutral":"_variant-neutral_2rw1o_41",dot:ky};function th({children:n,variant:e="default",size:t="md",dot:s=!1,className:i}){return y.jsxs("span",{className:N(Wi.badge,Wi[`variant-${e}`],Wi[`size-${t}`],i),children:[s&&y.jsx("span",{className:Wi.dot,"aria-hidden":"true"}),n]})}th.displayName="Badge";const wy="_alert_6wzio_1",vy="_icon_6wzio_11",Sy="_content_6wzio_18",My="_title_6wzio_25",Cy="_body_6wzio_30",Pn={alert:wy,icon:vy,content:Sy,title:My,body:Cy,"dismiss-btn":"_dismiss-btn_6wzio_35","variant-info":"_variant-info_6wzio_59","variant-success":"_variant-success_6wzio_65","variant-warning":"_variant-warning_6wzio_71","variant-error":"_variant-error_6wzio_77"},Oy={info:y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[y.jsx("circle",{cx:"8",cy:"8",r:"7.5",stroke:"currentColor",strokeWidth:"1"}),y.jsx("rect",{x:"7.25",y:"7",width:"1.5",height:"5",rx:".75",fill:"currentColor"}),y.jsx("circle",{cx:"8",cy:"5",r:".875",fill:"currentColor"})]}),success:y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[y.jsx("circle",{cx:"8",cy:"8",r:"7.5",stroke:"currentColor",strokeWidth:"1"}),y.jsx("path",{d:"M4.5 8.5l2.5 2.5 4.5-5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),warning:y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[y.jsx("path",{d:"M8 1.5L1 14.5h14L8 1.5z",stroke:"currentColor",strokeWidth:"1"}),y.jsx("rect",{x:"7.25",y:"6",width:"1.5",height:"4.5",rx:".75",fill:"currentColor"}),y.jsx("circle",{cx:"8",cy:"12",r:".875",fill:"currentColor"})]}),error:y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[y.jsx("circle",{cx:"8",cy:"8",r:"7.5",stroke:"currentColor",strokeWidth:"1"}),y.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})};function nh({variant:n="info",title:e,children:t,icon:s,dismissible:i=!1,onDismiss:r,className:o}){return y.jsxs("div",{role:"alert",className:N(Pn.alert,Pn[`variant-${n}`],o),children:[y.jsx("span",{className:Pn.icon,children:s??Oy[n]}),y.jsxs("div",{className:Pn.content,children:[e&&y.jsx("p",{className:Pn.title,children:e}),y.jsx("div",{className:Pn.body,children:t})]}),i&&y.jsx("button",{type:"button",onClick:r,"aria-label":"Dismiss alert",className:Pn["dismiss-btn"],children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M1 1l12 12M13 1L1 13",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})}nh.displayName="Alert";const Dy="_spinner_76228_1",Ty="_spin_76228_1",yo={spinner:Dy,spin:Ty,"size-xs":"_size-xs_76228_12","size-sm":"_size-sm_76228_13","size-md":"_size-md_76228_14","size-lg":"_size-lg_76228_15","size-xl":"_size-xl_76228_16","variant-primary":"_variant-primary_76228_19","variant-white":"_variant-white_76228_20","variant-current":"_variant-current_76228_21"};function sh({size:n="md",variant:e="primary",label:t="Loading…",className:s}){return y.jsx("span",{role:"status","aria-label":t,className:N(yo.spinner,yo[`size-${n}`],yo[`variant-${e}`],s)})}sh.displayName="Spinner";const Ny="_skeleton_115i9_1",Ey="_shimmer_115i9_1",Hl={skeleton:Ny,shimmer:Ey,"variant-text":"_variant-text_115i9_12","variant-circle":"_variant-circle_115i9_13","variant-rect":"_variant-rect_115i9_14"};function ih({variant:n="text",width:e,height:t,borderRadius:s,className:i}){const r={width:e??(n==="circle"?"2.5rem":"100%"),height:t??(n==="circle"?"2.5rem":n==="text"?"1em":"6rem"),borderRadius:s};return y.jsx("div",{"aria-hidden":"true",className:N(Hl.skeleton,Hl[`variant-${n}`],i),style:r})}ih.displayName="Skeleton";const Ay="_wrapper_2w1be_1",Py="_tooltip_2w1be_6",Iy="_arrow_2w1be_37",$i={wrapper:Ay,tooltip:Py,"position-top":"_position-top_2w1be_31","position-bottom":"_position-bottom_2w1be_32","position-left":"_position-left_2w1be_33","position-right":"_position-right_2w1be_34",arrow:Iy};function rh({content:n,children:e,position:t="top",delay:s=0,className:i}){const r=x.useId();return y.jsxs("span",{className:N($i.wrapper,i),style:{"--delay":`${s}ms`},children:[x.cloneElement(e,{"aria-describedby":r}),y.jsxs("span",{id:r,role:"tooltip",className:N($i.tooltip,$i[`position-${t}`]),children:[n,y.jsx("span",{className:$i.arrow,"aria-hidden":"true"})]})]})}rh.displayName="Tooltip";const Ry="_avatar_ygrwb_1",zy="_img_ygrwb_22",By="_icon_ygrwb_28",jy="_initials_ygrwb_33",Fs={avatar:Ry,"size-xs":"_size-xs_ygrwb_15","size-sm":"_size-sm_ygrwb_16","size-md":"_size-md_ygrwb_17","size-lg":"_size-lg_ygrwb_18","size-xl":"_size-xl_ygrwb_19","size-2xl":"_size-2xl_ygrwb_20",img:zy,icon:By,initials:jy},oh=x.forwardRef(({src:n,alt:e="",initials:t,size:s="md",className:i},r)=>{const[o,a]=x.useState(!1),l=!!n&&!o,c=!l&&!!t;return y.jsxs("span",{ref:r,className:N(Fs.avatar,Fs[`size-${s}`],i),"aria-label":e||t,children:[l&&y.jsx("img",{src:n,alt:e,className:Fs.img,onError:()=>a(!0)}),!l&&c&&y.jsx("span",{className:Fs.initials,"aria-hidden":"true",children:t.slice(0,2).toUpperCase()}),!l&&!c&&y.jsx("svg",{className:Fs.icon,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:y.jsx("path",{d:"M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10zm0 2c-5.33 0-8 2.67-8 4v1h16v-1c0-1.33-2.67-4-8-4z"})})]})});oh.displayName="Avatar";const Ly="_group_pnfer_1",Hi={group:Ly,"group-avatar":"_group-avatar_pnfer_7","overflow-badge":"_overflow-badge_pnfer_17","size-xs":"_size-xs_pnfer_33","size-sm":"_size-sm_pnfer_34","size-md":"_size-md_pnfer_35","size-lg":"_size-lg_pnfer_36","size-xl":"_size-xl_pnfer_37","size-2xl":"_size-2xl_pnfer_38"};function ah({children:n,max:e=5,size:t="md",className:s}){const i=x.Children.toArray(n),r=i.slice(0,e),o=i.length-e;return y.jsxs("span",{className:N(Hi.group,s),children:[r.map((a,l)=>x.cloneElement(a,{key:l,size:t,className:Hi["group-avatar"]})),o>0&&y.jsxs("span",{className:N(Hi["overflow-badge"],Hi[`size-${t}`]),children:["+",o]})]})}ah.displayName="AvatarGroup";const Fy="_tabs_12sm6_2",Wy="_tablist_12sm6_13",$y="_tab_12sm6_2",Hy="_panel_12sm6_156",mt={tabs:Fy,"orientation-vertical":"_orientation-vertical_12sm6_8",tablist:Wy,"full-width":"_full-width_12sm6_23",tab:$y,"variant-underline":"_variant-underline_12sm6_28","variant-button":"_variant-button_12sm6_38","size-sm":"_size-sm_12sm6_73","size-md":"_size-md_12sm6_79","is-active":"_is-active_12sm6_90","tab-badge":"_tab-badge_12sm6_136",panel:Hy},lh=x.createContext(null);function Fa(){const n=x.useContext(lh);if(!n)throw new Error("Tab components must be used inside <Tabs>");return n}function ch({value:n,defaultValue:e="",onValueChange:t,variant:s="underline",orientation:i="horizontal",size:r="md",fullWidth:o=!1,children:a,className:l}){const[c,d]=x.useState(e),u=n??c,h=f=>{n===void 0&&d(f),t?.(f)};return y.jsx(lh.Provider,{value:{activeTab:u,setActiveTab:h,variant:s,orientation:i,size:r,fullWidth:o},children:y.jsx("div",{className:N(mt.tabs,mt[`orientation-${i}`],l),children:a})})}ch.displayName="Tabs";function dh({children:n,className:e}){const{variant:t,orientation:s,fullWidth:i}=Fa();return y.jsx("div",{role:"tablist","aria-orientation":s,className:N(mt.tablist,mt[`variant-${t}`],mt[`orientation-${s}`],i&&mt["full-width"],e),children:n})}dh.displayName="TabList";function uh({value:n,disabled:e=!1,badge:t,children:s,className:i}){const{activeTab:r,setActiveTab:o,variant:a,size:l}=Fa(),c=r===n,d=u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),e||o(n))};return y.jsxs("button",{role:"tab","aria-selected":c,"aria-disabled":e,disabled:e,tabIndex:c?0:-1,onClick:()=>!e&&o(n),onKeyDown:d,className:N(mt.tab,mt[`variant-${a}`],mt[`size-${l}`],c&&mt["is-active"],i),children:[s,t!==void 0&&y.jsx("span",{className:mt["tab-badge"],children:t})]})}uh.displayName="Tab";function hh({value:n,children:e,className:t}){const{activeTab:s}=Fa();return s!==n?null:y.jsx("div",{role:"tabpanel",className:N(mt.panel,t),children:e})}hh.displayName="TabPanel";const Vy="_card_18d9f_1",Yy="_clickable_18d9f_31",qy="_image_18d9f_51",Ky="_header_18d9f_64",Uy="_body_18d9f_71",Jy="_footer_18d9f_79",xn={card:Vy,"variant-elevated":"_variant-elevated_18d9f_13","variant-outlined":"_variant-outlined_18d9f_18","variant-filled":"_variant-filled_18d9f_24",clickable:Yy,"image-wrap":"_image-wrap_18d9f_51",image:qy,header:Ky,body:Uy,footer:Jy},fh=x.forwardRef(({variant:n="elevated",clickable:e=!1,href:t,children:s,className:i,onClick:r,...o},a)=>{const l=N(xn.card,xn[`variant-${n}`],(e||t)&&xn.clickable,i);return t?y.jsx("a",{ref:a,href:t,className:l,...o,children:s}):y.jsx("div",{ref:a,className:l,onClick:r,role:e?"button":void 0,tabIndex:e?0:void 0,...o,children:s})});fh.displayName="Card";function ph({children:n,className:e}){return y.jsx("div",{className:N(xn.header,e),children:n})}ph.displayName="CardHeader";function mh({children:n,className:e}){return y.jsx("div",{className:N(xn.body,e),children:n})}mh.displayName="CardBody";function gh({children:n,className:e}){return y.jsx("div",{className:N(xn.footer,e),children:n})}gh.displayName="CardFooter";function yh({aspectRatio:n="16/9",className:e,alt:t="",...s}){return y.jsx("div",{className:N(xn["image-wrap"],e),style:{aspectRatio:n},children:y.jsx("img",{className:xn.image,alt:t,...s})})}yh.displayName="CardImage";const Gy="_pagination_anogk_1",Xy="_summary_anogk_9",Qy="_controls_anogk_15",Zy="_btn_anogk_22",eb="_ellipsis_anogk_65",tb="_select_anogk_85",De={pagination:Gy,summary:Xy,controls:Qy,btn:Zy,"page-btn":"_page-btn_anogk_54","is-active":"_is-active_anogk_58",ellipsis:eb,"size-sm":"_size-sm_anogk_76","size-md":"_size-md_anogk_77","page-size":"_page-size_anogk_80",select:tb,"go-to":"_go-to_anogk_102","go-to-label":"_go-to-label_anogk_108","go-to-input":"_go-to-input_anogk_114"};function nb(n,e,t){const s=[],i=Math.max(2,n-t),r=Math.min(e-1,n+t);for(let o=1;o<=e;o++)o===1||o===e||o>=i&&o<=r?s.push(o):s[s.length-1]!=="..."&&s.push("...");return s}function sb(){return y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M10 12L6 8l4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function ib(){return y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M6 4l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function rb(){return y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M8 12L4 8l4-4M13 12L9 8l4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function ob(){return y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M8 4l4 4-4 4M3 4l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}const bh=x.forwardRef(({total:n,page:e,pageSize:t=50,pageSizeOptions:s=[25,50,100],onPageChange:i,onPageSizeChange:r,size:o="md",showFirstLast:a=!0,showPageNumbers:l=!0,showPageSize:c=!1,showGoToPage:d=!1,siblingCount:u=1,className:h},f)=>{const[p,m]=x.useState(""),g=Math.max(1,Math.ceil(n/t)),b=nb(e,g,u),S=w=>{const M=Math.min(Math.max(1,w),g);M!==e&&i(M)},_=w=>{if(w.key==="Enter"){const M=parseInt(p,10);isNaN(M)||(S(M),m(""))}},k=(e-1)*t+1,v=Math.min(e*t,n);return y.jsxs("nav",{ref:f,"aria-label":"Pagination",className:N(De.pagination,De[`size-${o}`],h),children:[y.jsxs("span",{className:De.summary,children:[k,"–",v," of ",n]}),y.jsxs("div",{className:De.controls,children:[a&&y.jsx("button",{type:"button",className:De.btn,onClick:()=>S(1),disabled:e<=1,"aria-label":"First page",children:y.jsx(rb,{})}),y.jsx("button",{type:"button",className:De.btn,onClick:()=>S(e-1),disabled:e<=1,"aria-label":"Previous page",children:y.jsx(sb,{})}),l&&b.map((w,M)=>w==="..."?y.jsx("span",{className:De.ellipsis,"aria-hidden":"true",children:"…"},`ellipsis-${M}`):y.jsx("button",{type:"button",className:N(De.btn,De["page-btn"],e===w&&De["is-active"]),onClick:()=>S(w),"aria-label":`Page ${w}`,"aria-current":e===w?"page":void 0,children:w},w)),y.jsx("button",{type:"button",className:De.btn,onClick:()=>S(e+1),disabled:e>=g,"aria-label":"Next page",children:y.jsx(ib,{})}),a&&y.jsx("button",{type:"button",className:De.btn,onClick:()=>S(g),disabled:e>=g,"aria-label":"Last page",children:y.jsx(ob,{})})]}),c&&y.jsx("div",{className:De["page-size"],children:y.jsx("select",{value:t,onChange:w=>r?.(Number(w.target.value)),className:De.select,"aria-label":"Items per page",children:s.map(w=>y.jsxs("option",{value:w,children:[w," per page"]},w))})}),d&&y.jsxs("div",{className:De["go-to"],children:[y.jsx("span",{className:De["go-to-label"],children:"Go to page"}),y.jsx("input",{type:"number",min:1,max:g,value:p,onChange:w=>m(w.target.value),onKeyDown:_,className:De["go-to-input"],"aria-label":"Go to page number"})]})]})});bh.displayName="Pagination";const ab="_overlay_8rh55_2",lb="_dialog_8rh55_15",cb="_header_8rh55_35",db="_title_8rh55_50",ub="_description_8rh55_59",hb="_body_8rh55_94",fb="_footer_8rh55_105",pb="_actions_8rh55_112",it={overlay:ab,"fade-in":"_fade-in_8rh55_1",dialog:lb,"slide-up":"_slide-up_8rh55_1","size-sm":"_size-sm_8rh55_28","size-md":"_size-md_8rh55_29","size-lg":"_size-lg_8rh55_30","size-xl":"_size-xl_8rh55_31","size-full":"_size-full_8rh55_32",header:cb,"header-text":"_header-text_8rh55_43",title:db,description:ub,"close-btn":"_close-btn_8rh55_67",body:hb,footer:fb,actions:pb,"actions-leading":"_actions-leading_8rh55_118","actions-trailing":"_actions-trailing_8rh55_122"},mb=()=>y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M2 2l12 12M14 2L2 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Vl='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',xh=x.forwardRef(({open:n,onClose:e,title:t,description:s,footer:i,size:r="md",preventBackdropClose:o=!1,hideCloseButton:a=!1,children:l,className:c},d)=>{const u=x.useRef(null),h=d??u;if(x.useEffect(()=>{if(!n)return;const m=S=>{if(S.key==="Escape"){e();return}if(S.key==="Tab"){const _=h.current?.querySelectorAll(Vl);if(!_||_.length===0)return;const k=_[0],v=_[_.length-1];S.shiftKey&&document.activeElement===k?(S.preventDefault(),v.focus()):!S.shiftKey&&document.activeElement===v&&(S.preventDefault(),k.focus())}},g=document.body.style.overflow;document.body.style.overflow="hidden",document.addEventListener("keydown",m);const b=setTimeout(()=>{h.current?.querySelector(Vl)?.focus()},50);return()=>{document.body.style.overflow=g,document.removeEventListener("keydown",m),clearTimeout(b)}},[n,e,h]),!n)return null;const f="modal-title",p="modal-desc";return y.jsx("div",{className:it.overlay,role:"dialog","aria-modal":"true","aria-labelledby":t?f:void 0,"aria-describedby":s?p:void 0,onMouseDown:o?void 0:m=>{m.target===m.currentTarget&&e()},children:y.jsxs("div",{ref:h,className:N(it.dialog,it[`size-${r}`],c),children:[(t||!a)&&y.jsxs("div",{className:it.header,children:[y.jsxs("div",{className:it["header-text"],children:[t&&y.jsx("h2",{id:f,className:it.title,children:t}),s&&y.jsx("p",{id:p,className:it.description,children:s})]}),!a&&y.jsx("button",{type:"button",onClick:e,"aria-label":"Close modal",className:it["close-btn"],children:y.jsx(mb,{})})]}),l&&y.jsx("div",{className:it.body,children:l}),i&&y.jsx("div",{className:it.footer,children:i})]})})});xh.displayName="Modal";function _h({leading:n,children:e,className:t}){return y.jsxs("div",{className:N(it.actions,t),children:[n&&y.jsx("div",{className:it["actions-leading"],children:n}),y.jsx("div",{className:it["actions-trailing"],children:e})]})}_h.displayName="ModalActions";const gb="_accordion_1qnc2_1",yb="_item_1qnc2_7",bb="_trigger_1qnc2_16",xb="_chevron_1qnc2_49",_b="_content_1qnc2_61",Qt={accordion:gb,item:yb,trigger:bb,"trigger-text":"_trigger-text_1qnc2_44",chevron:xb,"chevron-open":"_chevron-open_1qnc2_55",content:_b,"content-inner":"_content-inner_1qnc2_65"},kh=x.createContext(null),wh=x.createContext(null);function vh(){const n=x.useContext(kh);if(!n)throw new Error("Accordion subcomponents must be used inside <Accordion>");return n}function Sh(){const n=x.useContext(wh);if(!n)throw new Error("AccordionTrigger/Content must be inside <AccordionItem>");return n}function Mh({multiple:n=!1,defaultValue:e,value:t,onValueChange:s,children:i,className:r}){const[o,a]=x.useState(()=>e?Array.isArray(e)?e:[e]:[]),l=t!==void 0?Array.isArray(t)?t:[t]:o,c=u=>l.includes(u),d=u=>{let h;c(u)?h=l.filter(f=>f!==u):h=n?[...l,u]:[u],t===void 0&&a(h),s?.(n?h:h[0]??"")};return y.jsx(kh.Provider,{value:{isOpen:c,toggle:d},children:y.jsx("div",{className:N(Qt.accordion,r),children:i})})}Mh.displayName="Accordion";function Ch({value:n,children:e,className:t}){const{isOpen:s}=vh(),i=x.useId(),r=s(n);return y.jsx(wh.Provider,{value:{value:n,isOpen:r,triggerId:`trigger-${i}`,contentId:`content-${i}`},children:y.jsx("div",{className:N(Qt.item,r&&Qt["item-open"],t),"data-state":r?"open":"closed",children:e})})}Ch.displayName="AccordionItem";function Oh({children:n,className:e}){const{toggle:t}=vh(),{value:s,isOpen:i,triggerId:r,contentId:o}=Sh();return y.jsxs("button",{type:"button",id:r,"aria-controls":o,"aria-expanded":i,onClick:()=>t(s),className:N(Qt.trigger,e),children:[y.jsx("span",{className:Qt["trigger-text"],children:n}),y.jsx("svg",{className:N(Qt.chevron,i&&Qt["chevron-open"]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M4 6l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]})}Oh.displayName="AccordionTrigger";function Dh({children:n,className:e}){const{isOpen:t,contentId:s,triggerId:i}=Sh(),r=x.useRef(null),o=x.useRef(!0);return x.useEffect(()=>{const a=r.current;if(a){if(o.current){o.current=!1,t||(a.style.height="0px");return}if(t){a.style.height=a.scrollHeight+"px";const l=setTimeout(()=>{a.style.height="auto"},250);return()=>clearTimeout(l)}else a.style.height=a.scrollHeight+"px",requestAnimationFrame(()=>{a.style.height="0px"})}},[t]),y.jsx("div",{ref:r,id:s,role:"region","aria-labelledby":i,"aria-hidden":!t,className:N(Qt.content,e),style:{overflow:"hidden"},children:y.jsx("div",{className:Qt["content-inner"],children:n})})}Dh.displayName="AccordionContent";const kb="_container_g2z5m_2",wb="_notification_g2z5m_20",vb="_icon_g2z5m_36",Sb="_content_g2z5m_42",Mb="_title_g2z5m_49",Cb="_message_g2z5m_54",Jt={container:kb,"position-top-right":"_position-top-right_g2z5m_12","position-top-left":"_position-top-left_g2z5m_13","position-top-center":"_position-top-center_g2z5m_14","position-bottom-right":"_position-bottom-right_g2z5m_15","position-bottom-left":"_position-bottom-left_g2z5m_16","position-bottom-center":"_position-bottom-center_g2z5m_17",notification:wb,"toast-in":"_toast-in_g2z5m_1",icon:vb,content:Sb,title:Mb,message:Cb,"dismiss-btn":"_dismiss-btn_g2z5m_61","variant-info":"_variant-info_g2z5m_85","variant-success":"_variant-success_g2z5m_86","variant-warning":"_variant-warning_g2z5m_87","variant-error":"_variant-error_g2z5m_88"},Ob={info:y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[y.jsx("circle",{cx:"8",cy:"8",r:"7.5",stroke:"currentColor",strokeWidth:"1"}),y.jsx("rect",{x:"7.25",y:"7",width:"1.5",height:"5",rx:".75",fill:"currentColor"}),y.jsx("circle",{cx:"8",cy:"5",r:".875",fill:"currentColor"})]}),success:y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[y.jsx("circle",{cx:"8",cy:"8",r:"7.5",stroke:"currentColor",strokeWidth:"1"}),y.jsx("path",{d:"M4.5 8.5l2.5 2.5 4.5-5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),warning:y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[y.jsx("path",{d:"M8 1.5L1 14.5h14L8 1.5z",stroke:"currentColor",strokeWidth:"1"}),y.jsx("rect",{x:"7.25",y:"6",width:"1.5",height:"4.5",rx:".75",fill:"currentColor"}),y.jsx("circle",{cx:"8",cy:"12",r:".875",fill:"currentColor"})]}),error:y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[y.jsx("circle",{cx:"8",cy:"8",r:"7.5",stroke:"currentColor",strokeWidth:"1"}),y.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})},Wa=x.forwardRef(({variant:n="info",title:e,message:t,duration:s=5e3,dismissible:i=!0,onDismiss:r,className:o},a)=>(x.useEffect(()=>{if(!s)return;const l=setTimeout(()=>r?.(),s);return()=>clearTimeout(l)},[s,r]),y.jsxs("div",{ref:a,role:"status","aria-live":"polite",className:N(Jt.notification,Jt[`variant-${n}`],o),children:[y.jsx("span",{className:Jt.icon,children:Ob[n]}),y.jsxs("div",{className:Jt.content,children:[e&&y.jsx("p",{className:Jt.title,children:e}),y.jsx("div",{className:Jt.message,children:t})]}),i&&y.jsx("button",{type:"button",onClick:r,"aria-label":"Dismiss notification",className:Jt["dismiss-btn"],children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M1 1l12 12M13 1L1 13",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})));Wa.displayName="Notification";const Th=x.createContext(null);function Db(){const n=x.useContext(Th);if(!n)throw new Error("useNotification must be used inside <NotificationProvider>");return n}let Tb=0;function Nb({children:n,position:e="top-right"}){const[t,s]=x.useState([]),i=x.useCallback(a=>{const l=`notif-${++Tb}`;return s(c=>[...c,{...a,id:l}]),l},[]),r=x.useCallback(a=>{s(l=>l.filter(c=>c.id!==a))},[]),o=x.useCallback(()=>s([]),[]);return y.jsxs(Th.Provider,{value:{notify:i,dismiss:r,dismissAll:o},children:[n,qu.createPortal(y.jsx("div",{className:N(Jt.container,Jt[`position-${e}`]),children:t.map(a=>y.jsx(Wa,{...a,onDismiss:()=>{a.onDismiss?.(),r(a.id)}},a.id))}),document.body)]})}const Eb="_wrapper_18h2l_2",Ab="_table_18h2l_12",Pb="_row_18h2l_75",Ib="_cell_18h2l_79",Rb="_striped_18h2l_88",zb="_hoverable_18h2l_93",Bb="_bordered_18h2l_134",jb="_checkbox_18h2l_145",Lb="_skeleton_18h2l_178",Fb="_shimmer_18h2l_1",Z={wrapper:Eb,table:Ab,"header-row":"_header-row_18h2l_24","header-cell":"_header-cell_18h2l_28","header-cell-sortable":"_header-cell-sortable_18h2l_43","header-label":"_header-label_18h2l_53","header-info":"_header-info_18h2l_57","sort-icon":"_sort-icon_18h2l_64","sort-icon-neutral":"_sort-icon-neutral_18h2l_70",row:Pb,cell:Ib,striped:Rb,hoverable:zb,"row-selected":"_row-selected_18h2l_99","col-checkbox":"_col-checkbox_18h2l_114","align-center":"_align-center_18h2l_120","align-right":"_align-right_18h2l_121","size-sm":"_size-sm_18h2l_124","size-md":"_size-md_18h2l_127","size-lg":"_size-lg_18h2l_130",bordered:Bb,checkbox:jb,"empty-row":"_empty-row_18h2l_154","empty-cell":"_empty-cell_18h2l_158","empty-default":"_empty-default_18h2l_164",skeleton:Lb,shimmer:Fb,"skeleton-check":"_skeleton-check_18h2l_191"};function Wb({direction:n}){return n==="asc"?y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M7 2v10M3 6l4-4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):n==="desc"?y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M7 2v10M3 8l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:Z["sort-icon-neutral"],children:y.jsx("path",{d:"M4 5l3-3 3 3M4 9l3 3 3-3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function $b(){return y.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[y.jsx("circle",{cx:"7",cy:"7",r:"6",stroke:"currentColor",strokeWidth:"1.2"}),y.jsx("rect",{x:"6.3",y:"6",width:"1.4",height:"4.5",rx:".7",fill:"currentColor"}),y.jsx("circle",{cx:"7",cy:"4.2",r:".8",fill:"currentColor"})]})}function Yl({checked:n,indeterminate:e,onChange:t,label:s}){const i=x.useRef(null);return x.useEffect(()=>{i.current&&(i.current.indeterminate=!!e)},[e]),y.jsx("input",{ref:i,type:"checkbox",checked:n,"aria-label":s,className:Z.checkbox,onChange:r=>t(r.target.checked)})}function Hb({columns:n,data:e,rowKey:t=(_,k)=>k,sortKey:s,sortDirection:i=!1,onSort:r,selectable:o=!1,selectedKeys:a,onSelectionChange:l,striped:c=!1,hoverable:d=!0,bordered:u=!1,size:h="md",emptyState:f,loading:p=!1,loadingRows:m=5,className:g,tableClassName:b},S){const _=e.map((D,A)=>t(D,A)),k=_.length>0&&_.every(D=>a?.has(D)),v=!k&&_.some(D=>a?.has(D)),w=x.useCallback(D=>{l?.(D?new Set(_):new Set)},[_,l]),M=x.useCallback((D,A)=>{if(!l||!a)return;const P=new Set(a);A?P.add(D):P.delete(D),l(P)},[a,l]),C=D=>{r&&(s!==D?r(D,"asc"):i==="asc"?r(D,"desc"):r(D,!1))},O=[o?"2.5rem":null,...n.map(D=>D.width??"1fr")].filter(Boolean).join(" ");return y.jsx("div",{ref:S,className:N(Z.wrapper,c&&Z.striped,d&&Z.hoverable,u&&Z.bordered,Z[`size-${h}`],g),children:y.jsxs("div",{role:"table",className:N(Z.table,b),style:{"--grid-cols":O},children:[y.jsx("div",{role:"rowgroup",children:y.jsxs("div",{role:"row",className:Z["header-row"],children:[o&&y.jsx("div",{role:"columnheader",className:N(Z["header-cell"],Z["col-checkbox"]),children:y.jsx(Yl,{checked:k,indeterminate:v,onChange:w,label:"Select all rows"})}),n.map(D=>y.jsxs("div",{role:"columnheader","aria-sort":s===D.key?i==="asc"?"ascending":i==="desc"?"descending":"none":void 0,className:N(Z["header-cell"],D.sortable&&Z["header-cell-sortable"],D.align&&Z[`align-${D.align}`]),onClick:D.sortable?()=>C(D.key):void 0,children:[y.jsx("span",{className:Z["header-label"],children:D.header}),D.headerTooltip&&y.jsx("span",{title:D.headerTooltip,className:Z["header-info"],children:y.jsx($b,{})}),D.sortable&&y.jsx("span",{className:Z["sort-icon"],children:y.jsx(Wb,{direction:s===D.key?i:!1})})]},D.key))]})}),y.jsx("div",{role:"rowgroup",children:p?Array.from({length:m}).map((D,A)=>y.jsxs("div",{role:"row",className:Z.row,children:[o&&y.jsx("div",{role:"cell",className:N(Z.cell,Z["col-checkbox"]),children:y.jsx("div",{className:N(Z.skeleton,Z["skeleton-check"])})}),n.map(P=>y.jsx("div",{role:"cell",className:N(Z.cell,P.align&&Z[`align-${P.align}`]),children:y.jsx("div",{className:Z.skeleton,style:{width:`${60+(A*13+P.key.length*7)%30}%`}})},P.key))]},A)):e.length===0?y.jsx("div",{role:"row",className:Z["empty-row"],children:y.jsx("div",{role:"cell",className:Z["empty-cell"],style:{gridColumn:"1 / -1"},children:f??y.jsxs("div",{className:Z["empty-default"],children:[y.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none","aria-hidden":"true",children:[y.jsx("rect",{x:"4",y:"8",width:"32",height:"24",rx:"3",stroke:"currentColor",strokeWidth:"1.5"}),y.jsx("path",{d:"M4 14h32",stroke:"currentColor",strokeWidth:"1.5"}),y.jsx("path",{d:"M13 21h14M13 25h8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),y.jsx("p",{children:"No data available"})]})})}):e.map((D,A)=>{const P=t(D,A),F=a?.has(P)??!1;return y.jsxs("div",{role:"row","aria-selected":o?F:void 0,className:N(Z.row,F&&Z["row-selected"]),children:[o&&y.jsx("div",{role:"cell",className:N(Z.cell,Z["col-checkbox"]),children:y.jsx(Yl,{checked:F,onChange:j=>M(P,j),label:`Select row ${A+1}`})}),n.map(j=>y.jsx("div",{role:"cell",className:N(Z.cell,j.align&&Z[`align-${j.align}`]),children:j.cell?j.cell(D[j.key],D,A):D[j.key]!=null?String(D[j.key]):"—"},j.key))]},P)})})]})})}const Vb=x.forwardRef(Hb),Yb="_breadcrumbs_cbfc3_1",qb="_list_cbfc3_5",Kb="_item_cbfc3_15",Ub="_link_cbfc3_21",Jb="_text_cbfc3_50",Gb="_separator_cbfc3_62",Vt={breadcrumbs:Yb,list:qb,item:Kb,link:Ub,"link-button":"_link-button_cbfc3_45",text:Jb,"text-current":"_text-current_cbfc3_57",separator:Gb},Nh=x.forwardRef(({items:n,separator:e="/",maxItems:t,className:s},i)=>{let r=n;return t&&n.length>t&&(r=[n[0],{label:"…"},...n.slice(n.length-(t-2))]),y.jsx("nav",{ref:i,"aria-label":"Breadcrumb",className:N(Vt.breadcrumbs,s),children:y.jsx("ol",{className:Vt.list,children:r.map((o,a)=>{const l=a===r.length-1;return y.jsxs("li",{className:Vt.item,children:[o.href&&!l?y.jsx("a",{href:o.href,onClick:o.onClick,className:Vt.link,children:o.label}):o.onClick&&!l?y.jsx("button",{type:"button",onClick:o.onClick,className:N(Vt.link,Vt["link-button"]),children:o.label}):y.jsx("span",{className:N(Vt.text,l&&Vt["text-current"]),"aria-current":l?"page":void 0,children:o.label}),!l&&y.jsx("span",{className:Vt.separator,"aria-hidden":"true",children:e})]},a)})})})});Nh.displayName="Breadcrumbs";const Xb="_stepper_n70bp_1",Qb="_list_n70bp_5",Zb="_step_n70bp_1",e0="_connector_n70bp_34",t0="_indicator_n70bp_74",n0="_content_n70bp_121",s0="_label_n70bp_127",i0="_optional_n70bp_138",r0="_description_n70bp_139",qe={stepper:Xb,list:Qb,"orientation-horizontal":"_orientation-horizontal_n70bp_14",step:Zb,"step-inner":"_step-inner_n70bp_25",connector:e0,"orientation-vertical":"_orientation-vertical_n70bp_42","step-completed":"_step-completed_n70bp_68","step-active":"_step-active_n70bp_69",indicator:t0,"indicator-upcoming":"_indicator-upcoming_n70bp_89","indicator-active":"_indicator-active_n70bp_96","indicator-completed":"_indicator-completed_n70bp_103",content:n0,label:s0,"label-upcoming":"_label-upcoming_n70bp_134",optional:i0,description:r0},o0=()=>y.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M2 6l3 3 5-5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Eh=x.forwardRef(({steps:n,activeStep:e,orientation:t="horizontal",onStepClick:s,className:i},r)=>{const o=a=>a<e?"completed":a===e?"active":"upcoming";return y.jsx("nav",{ref:r,"aria-label":"Progress steps",className:N(qe.stepper,qe[`orientation-${t}`],i),children:y.jsx("ol",{className:qe.list,children:n.map((a,l)=>{const c=o(l),d=!!s&&c==="completed";return y.jsxs("li",{className:N(qe.step,qe[`step-${c}`]),"aria-current":c==="active"?"step":void 0,children:[l>0&&y.jsx("div",{className:qe.connector,"aria-hidden":"true"}),y.jsxs("div",{className:qe["step-inner"],children:[y.jsx("button",{type:"button",className:N(qe.indicator,qe[`indicator-${c}`]),onClick:d?()=>s(l):void 0,disabled:!d,tabIndex:d?0:-1,"aria-label":`Step ${l+1}: ${a.label} — ${c}`,children:c==="completed"?y.jsx(o0,{}):y.jsx("span",{children:l+1})}),y.jsxs("div",{className:qe.content,children:[y.jsx("span",{className:N(qe.label,qe[`label-${c}`]),children:a.label}),a.optional&&y.jsx("span",{className:qe.optional,children:"Optional"}),a.description&&y.jsx("span",{className:qe.description,children:a.description})]})]})]},l)})})})});Eh.displayName="Stepper";const a0="_progress_1vwnz_1",l0="_header_1vwnz_9",c0="_label_1vwnz_15",d0="_value_1vwnz_16",u0="_track_1vwnz_23",h0="_fill_1vwnz_35",Et={progress:a0,header:l0,label:c0,value:d0,track:u0,"size-sm":"_size-sm_1vwnz_30","size-md":"_size-md_1vwnz_31","size-lg":"_size-lg_1vwnz_32",fill:h0,"variant-success":"_variant-success_1vwnz_43","variant-warning":"_variant-warning_1vwnz_44","variant-error":"_variant-error_1vwnz_45","fill-animated":"_fill-animated_1vwnz_48","progress-stripes":"_progress-stripes_1vwnz_1","fill-indeterminate":"_fill-indeterminate_1vwnz_66","progress-indeterminate":"_progress-indeterminate_1vwnz_1"},Ah=x.forwardRef(({value:n,max:e=100,size:t="md",variant:s="default",label:i,showValue:r=!1,animated:o=!1,indeterminate:a=!1,className:l},c)=>{const d=a?0:Math.min(100,Math.max(0,n/e*100)),u=Math.round(d);return y.jsxs("div",{ref:c,className:N(Et.progress,Et[`size-${t}`],Et[`variant-${s}`],l),children:[(i||r)&&y.jsxs("div",{className:Et.header,children:[i&&y.jsx("span",{className:Et.label,children:i}),r&&!a&&y.jsxs("span",{className:Et.value,children:[u,"%"]})]}),y.jsx("div",{role:"progressbar","aria-valuenow":a?void 0:n,"aria-valuemin":0,"aria-valuemax":e,"aria-label":i,"aria-valuetext":a?"Loading…":`${u}%`,className:Et.track,children:y.jsx("div",{className:N(Et.fill,o&&Et["fill-animated"],a&&Et["fill-indeterminate"]),style:a?void 0:{width:`${d}%`}})})]})});Ah.displayName="ProgressBar";const f0="_slider_gw56q_1",p0="_disabled_gw56q_9",m0="_header_gw56q_14",g0="_label_gw56q_20",y0="_value_gw56q_21",b0="_fill_gw56q_39",x0="_input_gw56q_55",_0="_ticks_gw56q_125",k0="_tick_gw56q_125",vt={slider:f0,disabled:p0,header:m0,label:g0,value:y0,"track-wrap":"_track-wrap_gw56q_28","size-sm":"_size-sm_gw56q_34","size-md":"_size-md_gw56q_35","size-lg":"_size-lg_gw56q_36",fill:b0,input:x0,ticks:_0,tick:k0},Ph=x.forwardRef(({value:n,defaultValue:e=0,min:t=0,max:s=100,step:i=1,disabled:r=!1,label:o,showValue:a=!1,showTicks:l=!1,size:c="md",onChange:d,formatValue:u=p=>String(p),className:h},f)=>{const p=x.useId(),[m,g]=x.useState(e),b=n!==void 0,S=b?n:m,_=(S-t)/(s-t)*100,k=x.useCallback(M=>{const C=Number(M.target.value);b||g(C),d?.(C)},[b,d]),v=Math.floor((s-t)/i)+1,w=l&&v<=21?Array.from({length:v},(M,C)=>t+C*i):[];return y.jsxs("div",{className:N(vt.slider,vt[`size-${c}`],r&&vt.disabled,h),children:[(o||a)&&y.jsxs("div",{className:vt.header,children:[o&&y.jsx("label",{htmlFor:p,className:vt.label,children:o}),a&&y.jsx("span",{className:vt.value,children:u(S)})]}),y.jsxs("div",{className:vt["track-wrap"],style:{"--pct":`${_}%`},children:[y.jsx("div",{className:vt.fill,"aria-hidden":"true",style:{width:`${_}%`}}),y.jsx("input",{ref:f,id:p,type:"range",min:t,max:s,step:i,value:S,disabled:r,onChange:k,className:vt.input,"aria-label":o,"aria-valuetext":u(S)})]}),w.length>0&&y.jsx("div",{className:vt.ticks,"aria-hidden":"true",children:w.map(M=>y.jsx("span",{className:vt.tick,style:{left:`${(M-t)/(s-t)*100}%`}},M))})]})});Ph.displayName="Slider";const w0="_tag_1du5j_1",v0="_disabled_1du5j_15",S0="_label_1du5j_61",M0="_dismiss_1du5j_66",cs={tag:w0,disabled:v0,"size-sm":"_size-sm_1du5j_21","size-md":"_size-md_1du5j_26","size-lg":"_size-lg_1du5j_31","variant-primary":"_variant-primary_1du5j_37","variant-success":"_variant-success_1du5j_43","variant-warning":"_variant-warning_1du5j_49","variant-error":"_variant-error_1du5j_55",label:S0,dismiss:M0},Ih=x.forwardRef(({size:n="md",variant:e="default",dismissible:t=!1,onDismiss:s,disabled:i=!1,className:r,children:o,...a},l)=>y.jsxs("span",{ref:l,className:N(cs.tag,cs[`size-${n}`],cs[`variant-${e}`],i&&cs.disabled,r),...a,children:[y.jsx("span",{className:cs.label,children:o}),t&&y.jsx("button",{type:"button",className:cs.dismiss,onClick:s,disabled:i,"aria-label":"Remove",children:y.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M1 1l8 8M9 1L1 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}));Ih.displayName="Tag";const C0="_wrapper_lgfzi_1",O0="_label_lgfzi_9",D0="_select_lgfzi_16",T0="_trigger_lgfzi_20",N0="_open_lgfzi_43",E0="_error_lgfzi_50",A0="_disabled_lgfzi_54",P0="_placeholder_lgfzi_67",I0="_icons_lgfzi_71",R0="_chevron_lgfzi_91",z0="_dropdown_lgfzi_100",B0="_list_lgfzi_134",j0="_option_lgfzi_142",he={wrapper:C0,label:O0,select:D0,trigger:T0,"size-sm":"_size-sm_lgfzi_35","size-md":"_size-md_lgfzi_36","size-lg":"_size-lg_lgfzi_37",open:N0,error:E0,disabled:A0,"trigger-text":"_trigger-text_lgfzi_59",placeholder:P0,icons:I0,"clear-btn":"_clear-btn_lgfzi_80",chevron:R0,"chevron-open":"_chevron-open_lgfzi_95",dropdown:z0,"search-wrap":"_search-wrap_lgfzi_113","search-input":"_search-input_lgfzi_118",list:B0,option:j0,"option-focused":"_option-focused_lgfzi_156","option-selected":"_option-selected_lgfzi_161","option-disabled":"_option-disabled_lgfzi_166","no-results":"_no-results_lgfzi_171","error-text":"_error-text_lgfzi_178"},Rh=x.forwardRef(({options:n,value:e,defaultValue:t,placeholder:s="Select…",size:i="md",disabled:r=!1,searchable:o=!1,clearable:a=!1,label:l,error:c,onChange:d,className:u,id:h},f)=>{const p=x.useId(),m=h??p,g=e!==void 0,[b,S]=x.useState(t??null),_=g?e??null:b,[k,v]=x.useState(!1),[w,M]=x.useState(""),[C,O]=x.useState(-1),D=x.useRef(null),A=x.useRef(null),P=x.useRef(null),F=n.find(E=>E.value===_)??null,j=o&&w?n.filter(E=>E.label.toLowerCase().includes(w.toLowerCase())):n,H=x.useCallback(E=>{E.disabled||(g||S(E.value),d?.(E.value),v(!1),M(""),O(-1))},[g,d]),K=x.useCallback(E=>{E.stopPropagation(),g||S(null),d?.(null)},[g,d]),G=x.useCallback(()=>{r||(v(E=>!E),O(-1))},[r]);x.useEffect(()=>{k&&o&&A.current?.focus()},[k,o]),x.useEffect(()=>{const E=V=>{D.current&&!D.current.contains(V.target)&&(v(!1),M(""))};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]);const R=x.useCallback(E=>{if(!k){(E.key==="Enter"||E.key===" "||E.key==="ArrowDown")&&(E.preventDefault(),v(!0),O(0));return}const V=j.filter(ee=>!ee.disabled);if(E.key==="Escape")v(!1),M("");else if(E.key==="ArrowDown")E.preventDefault(),O(ee=>Math.min(ee+1,V.length-1));else if(E.key==="ArrowUp")E.preventDefault(),O(ee=>Math.max(ee-1,0));else if(E.key==="Enter"&&C>=0){E.preventDefault();const ee=V[C];ee&&H(ee)}else E.key==="Tab"&&(v(!1),M(""))},[k,j,C,H]);return y.jsxs("div",{ref:f,className:N(he.wrapper,he[`size-${i}`],u),children:[l&&y.jsx("label",{htmlFor:m,className:he.label,children:l}),y.jsxs("div",{ref:D,className:N(he.select,k&&he.open,c&&he.error,r&&he.disabled),children:[y.jsxs("button",{type:"button",id:m,role:"combobox","aria-haspopup":"listbox","aria-expanded":k,"aria-controls":`${m}-listbox`,disabled:r,className:he.trigger,onClick:G,onKeyDown:R,children:[y.jsx("span",{className:N(he["trigger-text"],!F&&he.placeholder),children:F?F.label:s}),y.jsxs("span",{className:he.icons,children:[a&&_&&y.jsx("span",{role:"button","aria-label":"Clear selection",className:he["clear-btn"],onClick:K,onKeyDown:E=>{E.key==="Enter"&&K(E)},tabIndex:0,children:y.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),y.jsx("svg",{className:N(he.chevron,k&&he["chevron-open"]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M4 6l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]})]}),k&&y.jsxs("div",{className:he.dropdown,children:[o&&y.jsx("div",{className:he["search-wrap"],children:y.jsx("input",{ref:A,type:"text",className:he["search-input"],placeholder:"Search…",value:w,onChange:E=>{M(E.target.value),O(0)},onKeyDown:R,"aria-label":"Search options"})}),y.jsx("ul",{ref:P,id:`${m}-listbox`,role:"listbox",className:he.list,"aria-label":l??s,children:j.length===0?y.jsx("li",{className:he["no-results"],children:"No results"}):j.map((E,V)=>{const ee=j.filter((ke,et)=>!ke.disabled&&et<=V).length-1;return y.jsxs("li",{role:"option","aria-selected":E.value===_,"aria-disabled":E.disabled,className:N(he.option,E.value===_&&he["option-selected"],E.disabled&&he["option-disabled"],!E.disabled&&ee===C&&he["option-focused"]),onMouseDown:ke=>{ke.preventDefault(),H(E)},onMouseEnter:()=>!E.disabled&&O(ee),children:[E.label,E.value===_&&y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M2 7l3.5 3.5L12 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]},E.value)})})]})]}),c&&y.jsx("p",{className:he["error-text"],role:"alert",children:c})]})});Rh.displayName="Select";const L0="_wrapper_ebsbo_1",F0="_label_ebsbo_9",W0="_select_ebsbo_16",$0="_trigger_ebsbo_20",H0="_disabled_ebsbo_37",V0="_open_ebsbo_41",Y0="_error_ebsbo_48",q0="_tags_ebsbo_57",K0="_placeholder_ebsbo_66",U0="_tag_ebsbo_57",J0="_chevron_ebsbo_115",G0="_list_ebsbo_126",X0="_option_ebsbo_143",Q0="_checkbox_ebsbo_171",de={wrapper:L0,label:F0,select:W0,trigger:$0,"size-sm":"_size-sm_ebsbo_33","size-md":"_size-md_ebsbo_34","size-lg":"_size-lg_ebsbo_35",disabled:H0,open:V0,error:Y0,tags:q0,placeholder:K0,tag:U0,"tag-label":"_tag-label_ebsbo_83","tag-remove":"_tag-remove_ebsbo_87","search-input":"_search-input_ebsbo_103",chevron:J0,"chevron-open":"_chevron-open_ebsbo_121",list:G0,option:X0,"option-focused":"_option-focused_ebsbo_157","option-selected":"_option-selected_ebsbo_162","option-disabled":"_option-disabled_ebsbo_166",checkbox:Q0,"checkbox-checked":"_checkbox-checked_ebsbo_182","no-results":"_no-results_ebsbo_188","error-text":"_error-text_ebsbo_195"},zh=x.forwardRef(({options:n,value:e,defaultValue:t,placeholder:s="Select…",size:i="md",disabled:r=!1,searchable:o=!1,label:a,error:l,maxSelected:c,onChange:d,className:u,id:h},f)=>{const p=x.useId(),m=h??p,g=e!==void 0,[b,S]=x.useState(t??[]),_=g?e??[]:b,[k,v]=x.useState(!1),[w,M]=x.useState(""),[C,O]=x.useState(-1),D=x.useRef(null),A=x.useRef(null),P=o&&w?n.filter(R=>R.label.toLowerCase().includes(w.toLowerCase())):n,F=x.useCallback(R=>{g||S(R),d?.(R)},[g,d]),j=x.useCallback(R=>{if(R.disabled)return;if(_.includes(R.value))F(_.filter(V=>V!==R.value));else{if(c&&_.length>=c)return;F([..._,R.value])}M(""),o&&A.current?.focus()},[_,c,F,o]),H=x.useCallback((R,E)=>{E.stopPropagation(),F(_.filter(V=>V!==R))},[_,F]);x.useEffect(()=>{k&&o&&A.current?.focus()},[k,o]),x.useEffect(()=>{const R=E=>{D.current&&!D.current.contains(E.target)&&(v(!1),M(""))};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[]);const K=x.useCallback(R=>{if(!k){(R.key==="Enter"||R.key===" "||R.key==="ArrowDown")&&(R.preventDefault(),v(!0),O(0));return}const E=P.filter(V=>!V.disabled);if(R.key==="Escape")v(!1),M("");else if(R.key==="ArrowDown")R.preventDefault(),O(V=>Math.min(V+1,E.length-1));else if(R.key==="ArrowUp")R.preventDefault(),O(V=>Math.max(V-1,0));else if(R.key==="Enter"&&C>=0){R.preventDefault();const V=E[C];V&&j(V)}else R.key==="Tab"&&(v(!1),M(""))},[k,P,C,j]),G=n.filter(R=>_.includes(R.value));return y.jsxs("div",{ref:f,className:N(de.wrapper,de[`size-${i}`],u),children:[a&&y.jsx("label",{htmlFor:m,className:de.label,children:a}),y.jsxs("div",{ref:D,className:N(de.select,k&&de.open,l&&de.error,r&&de.disabled),children:[y.jsxs("div",{id:m,role:"combobox","aria-haspopup":"listbox","aria-expanded":k,"aria-controls":`${m}-listbox`,"aria-disabled":r,tabIndex:r?-1:0,className:de.trigger,onClick:()=>!r&&v(R=>!R),onKeyDown:K,children:[y.jsxs("div",{className:de.tags,children:[G.length===0&&y.jsx("span",{className:de.placeholder,children:s}),G.map(R=>y.jsxs("span",{className:de.tag,children:[y.jsx("span",{className:de["tag-label"],children:R.label}),y.jsx("button",{type:"button",className:de["tag-remove"],onClick:E=>H(R.value,E),"aria-label":`Remove ${R.label}`,tabIndex:-1,children:y.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M1 1l8 8M9 1L1 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]},R.value)),o&&k&&y.jsx("input",{ref:A,type:"text",className:de["search-input"],value:w,onChange:R=>{M(R.target.value),O(0)},onKeyDown:K,placeholder:G.length===0?s:"","aria-label":"Search options"})]}),y.jsx("svg",{className:N(de.chevron,k&&de["chevron-open"]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M4 6l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),k&&y.jsx("ul",{id:`${m}-listbox`,role:"listbox","aria-multiselectable":"true",className:de.list,"aria-label":a??s,children:P.length===0?y.jsx("li",{className:de["no-results"],children:"No results"}):P.map((R,E)=>{const V=P.filter((ke,et)=>!ke.disabled&&et<=E).length-1,ee=_.includes(R.value);return y.jsxs("li",{role:"option","aria-selected":ee,"aria-disabled":R.disabled,className:N(de.option,ee&&de["option-selected"],R.disabled&&de["option-disabled"],!R.disabled&&V===C&&de["option-focused"]),onMouseDown:ke=>{ke.preventDefault(),j(R)},onMouseEnter:()=>!R.disabled&&O(V),children:[y.jsx("span",{className:N(de.checkbox,ee&&de["checkbox-checked"]),"aria-hidden":"true",children:ee&&y.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:y.jsx("path",{d:"M1.5 5l2.5 2.5 4.5-4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),R.label]},R.value)})})]}),l&&y.jsx("p",{className:de["error-text"],role:"alert",children:l})]})});zh.displayName="MultiSelect";const Z0="_list_1dz0y_1",ex="_item_1dz0y_9",tx="_divided_1dz0y_30",nx="_selected_1dz0y_60",sx="_disabled_1dz0y_65",ix="_leading_1dz0y_70",rx="_content_1dz0y_77",ox="_trailing_1dz0y_82",Bt={list:Z0,"variant-unordered":"_variant-unordered_1dz0y_9",item:ex,"variant-ordered":"_variant-ordered_1dz0y_15",divided:tx,"size-sm":"_size-sm_1dz0y_35","size-md":"_size-md_1dz0y_41","size-lg":"_size-lg_1dz0y_47",selected:nx,disabled:sx,leading:ix,content:rx,trailing:ox},Bh=x.forwardRef(({disabled:n=!1,selected:e=!1,leading:t,trailing:s,className:i,children:r,...o},a)=>y.jsxs("li",{ref:a,className:N(Bt.item,e&&Bt.selected,n&&Bt.disabled,i),"aria-selected":e,"aria-disabled":n,...o,children:[t&&y.jsx("span",{className:Bt.leading,children:t}),y.jsx("span",{className:Bt.content,children:r}),s&&y.jsx("span",{className:Bt.trailing,children:s})]}));Bh.displayName="ListItem";const jh=x.forwardRef(({variant:n="none",size:e="md",divided:t=!1,className:s,children:i,...r},o)=>{const a=n==="ordered"?"ol":"ul";return y.jsx(a,{ref:o,className:N(Bt.list,Bt[`size-${e}`],Bt[`variant-${n}`],t&&Bt.divided,s),...r,children:i})});jh.displayName="List";const ax="_icon_wz4ut_12",lx="_title_wz4ut_24",cx="_description_wz4ut_32",dx="_action_wz4ut_40",Ws={"empty-state":"_empty-state_wz4ut_1",icon:ax,title:lx,description:cx,action:dx},Lh=x.forwardRef(({icon:n,title:e,description:t,action:s,className:i,...r},o)=>y.jsxs("div",{ref:o,className:N(Ws["empty-state"],i),role:"status",...r,children:[n&&y.jsx("div",{className:Ws.icon,"aria-hidden":"true",children:n}),y.jsx("p",{className:Ws.title,children:e}),t&&y.jsx("p",{className:Ws.description,children:t}),s&&y.jsx("div",{className:Ws.action,children:s})]}));Lh.displayName="EmptyState";const ux="_wrapper_1hkvb_1",hx="_label_1hkvb_9",fx="_dropzone_1hkvb_16",px="_disabled_1hkvb_31",mx="_dragging_1hkvb_41",gx="_error_1hkvb_46",yx="_content_1hkvb_59",bx="_hint_1hkvb_86",Ke={wrapper:ux,label:hx,dropzone:fx,"size-sm":"_size-sm_1hkvb_27","size-md":"_size-md_1hkvb_28","size-lg":"_size-lg_1hkvb_29",disabled:px,dragging:mx,error:gx,"file-input":"_file-input_1hkvb_55",content:yx,"upload-icon":"_upload-icon_1hkvb_68","upload-text":"_upload-text_1hkvb_75","upload-link":"_upload-link_1hkvb_81",hint:bx,"error-text":"_error-text_1hkvb_92"},Fh=x.forwardRef(({accept:n,multiple:e=!1,maxSize:t,disabled:s=!1,size:i="md",label:r,hint:o,error:a,onFiles:l,className:c,id:d},u)=>{const h=x.useId(),f=d??h,p=x.useRef(null),[m,g]=x.useState(!1),[b,S]=x.useState(null),_=x.useCallback(O=>{if(!O||O.length===0)return;const D=Array.from(O);if(t&&D.filter(P=>P.size>t).length>0){S(`File too large. Max size: ${Math.round(t/1024)}KB`);return}S(null),l?.(D)},[t,l]),k=x.useCallback(O=>{O.preventDefault(),g(!1),!s&&_(O.dataTransfer.files)},[s,_]),v=x.useCallback(O=>{O.preventDefault(),s||g(!0)},[s]),w=x.useCallback(()=>g(!1),[]),M=x.useCallback(O=>{_(O.target.files),O.target.value=""},[_]),C=a??b;return y.jsxs("div",{ref:u,className:N(Ke.wrapper,Ke[`size-${i}`],c),children:[r&&y.jsx("label",{htmlFor:f,className:Ke.label,children:r}),y.jsxs("div",{className:N(Ke.dropzone,m&&Ke.dragging,C&&Ke.error,s&&Ke.disabled),onDrop:k,onDragOver:v,onDragLeave:w,onClick:()=>!s&&p.current?.click(),role:"button",tabIndex:s?-1:0,"aria-disabled":s,"aria-label":r??"Upload files",onKeyDown:O=>{(O.key==="Enter"||O.key===" ")&&p.current?.click()},children:[y.jsx("input",{ref:p,id:f,type:"file",accept:n,multiple:e,disabled:s,className:Ke["file-input"],onChange:M,"aria-hidden":"true",tabIndex:-1}),y.jsxs("div",{className:Ke.content,children:[y.jsxs("svg",{className:Ke["upload-icon"],width:"24",height:"24",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[y.jsx("path",{d:"M12 15V3m0 0L8 7m4-4l4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),y.jsx("path",{d:"M3 15v4a2 2 0 002 2h14a2 2 0 002-2v-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),y.jsxs("p",{className:Ke["upload-text"],children:[y.jsx("span",{className:Ke["upload-link"],children:"Click to upload"})," or drag and drop"]}),o&&y.jsx("p",{className:Ke.hint,children:o})]})]}),C&&y.jsx("p",{className:Ke["error-text"],role:"alert",children:C})]})});Fh.displayName="FileUpload";const xx="_carousel_1k9q7_1",_x="_track_1k9q7_8",kx="_slides_1k9q7_14",wx="_slide_1k9q7_14",vx="_arrow_1k9q7_36",Sx="_dots_1k9q7_73",Mx="_dot_1k9q7_73",ut={carousel:xx,track:_x,slides:kx,slide:wx,"size-sm":"_size-sm_1k9q7_25","size-md":"_size-md_1k9q7_26","size-lg":"_size-lg_1k9q7_27",arrow:vx,"arrow-prev":"_arrow-prev_1k9q7_69","arrow-next":"_arrow-next_1k9q7_70",dots:Sx,dot:Mx,"dot-active":"_dot-active_1k9q7_95"},Wh=x.forwardRef(({slides:n,size:e="md",showArrows:t=!0,showDots:s=!0,autoPlay:i=!1,autoPlayInterval:r=4e3,loop:o=!1,defaultIndex:a=0,onSlideChange:l,className:c,...d},u)=>{const[h,f]=x.useState(a),p=x.useRef(null),m=x.useCallback(k=>{const v=o?(k%n.length+n.length)%n.length:Math.max(0,Math.min(k,n.length-1));f(v),l?.(v)},[o,n.length,l]),g=x.useCallback(()=>m(h-1),[h,m]),b=x.useCallback(()=>m(h+1),[h,m]);x.useEffect(()=>{if(i)return p.current=setTimeout(()=>{m(o||h+1<n.length?h+1:0)},r),()=>{p.current&&clearTimeout(p.current)}},[i,r,h,m,o,n.length]);const S=o||h>0,_=o||h<n.length-1;return y.jsxs("div",{ref:u,className:N(ut.carousel,ut[`size-${e}`],c),"aria-roledescription":"carousel",...d,children:[y.jsx("div",{className:ut.track,"aria-live":"polite",children:y.jsx("div",{className:ut.slides,style:{transform:`translateX(-${h*100}%)`},children:n.map((k,v)=>y.jsx("div",{className:ut.slide,role:"group","aria-roledescription":"slide","aria-label":`Slide ${v+1} of ${n.length}`,"aria-hidden":v!==h,children:k},v))})}),t&&y.jsxs(y.Fragment,{children:[y.jsx("button",{type:"button",className:N(ut.arrow,ut["arrow-prev"]),onClick:g,disabled:!S,"aria-label":"Previous slide",children:y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M12.5 5l-5 5 5 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),y.jsx("button",{type:"button",className:N(ut.arrow,ut["arrow-next"]),onClick:b,disabled:!_,"aria-label":"Next slide",children:y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M7.5 15l5-5-5-5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),s&&n.length>1&&y.jsx("div",{className:ut.dots,role:"tablist","aria-label":"Slides",children:n.map((k,v)=>y.jsx("button",{type:"button",role:"tab","aria-selected":v===h,"aria-label":`Go to slide ${v+1}`,className:N(ut.dot,v===h&&ut["dot-active"]),onClick:()=>m(v)},v))})]})});Wh.displayName="Carousel";function Cx(n,e,t="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:n,timeZoneName:t}).format(e).split(/\s/g).slice(2).join(" ")}const Ox={},Zs={};function Hn(n,e){try{const s=(Ox[n]||=new Intl.DateTimeFormat("en-US",{timeZone:n,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return s in Zs?Zs[s]:ql(s,s.split(":"))}catch{if(n in Zs)return Zs[n];const t=n?.match(Dx);return t?ql(n,t.slice(1)):NaN}}const Dx=/([+-]\d\d):?(\d\d)?/;function ql(n,e){const t=+(e[0]||0),s=+(e[1]||0),i=+(e[2]||0)/60;return Zs[n]=t*60+s>0?t*60+s+i:t*60-s-i}class jt extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Hn(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),$h(this),aa(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new jt(...t,e):new jt(Date.now(),e)}withTimeZone(e){return new jt(+this,e)}getTimezoneOffset(){const e=-Hn(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),aa(this),+this}[Symbol.for("constructDateFrom")](e){return new jt(+new Date(e),this.timeZone)}}const Kl=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(n=>{if(!Kl.test(n))return;const e=n.replace(Kl,"$1UTC");jt.prototype[e]&&(n.startsWith("get")?jt.prototype[n]=function(){return this.internal[e]()}:(jt.prototype[n]=function(){return Date.prototype[e].apply(this.internal,arguments),Tx(this),+this},jt.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),aa(this),+this}))});function aa(n){n.internal.setTime(+n),n.internal.setUTCSeconds(n.internal.getUTCSeconds()-Math.round(-Hn(n.timeZone,n)*60))}function Tx(n){Date.prototype.setFullYear.call(n,n.internal.getUTCFullYear(),n.internal.getUTCMonth(),n.internal.getUTCDate()),Date.prototype.setHours.call(n,n.internal.getUTCHours(),n.internal.getUTCMinutes(),n.internal.getUTCSeconds(),n.internal.getUTCMilliseconds()),$h(n)}function $h(n){const e=Hn(n.timeZone,n),t=e>0?Math.floor(e):Math.ceil(e),s=new Date(+n);s.setUTCHours(s.getUTCHours()-1);const i=-new Date(+n).getTimezoneOffset(),r=-new Date(+s).getTimezoneOffset(),o=i-r,a=Date.prototype.getHours.apply(n)!==n.internal.getUTCHours();o&&a&&n.internal.setUTCMinutes(n.internal.getUTCMinutes()+o);const l=i-t;l&&Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+l);const c=new Date(+n);c.setUTCSeconds(0);const d=i>0?c.getSeconds():(c.getSeconds()-60)%60,u=Math.round(-(Hn(n.timeZone,n)*60))%60;(u||d)&&(n.internal.setUTCSeconds(n.internal.getUTCSeconds()+u),Date.prototype.setUTCSeconds.call(n,Date.prototype.getUTCSeconds.call(n)+u+d));const h=Hn(n.timeZone,n),f=h>0?Math.floor(h):Math.ceil(h),m=-new Date(+n).getTimezoneOffset()-f,g=f!==t,b=m-l;if(g&&b){Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+b);const S=Hn(n.timeZone,n),_=S>0?Math.floor(S):Math.ceil(S),k=f-_;k&&(n.internal.setUTCMinutes(n.internal.getUTCMinutes()+k),Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+k))}}class ze extends jt{static tz(e,...t){return t.length?new ze(...t,e):new ze(Date.now(),e)}toISOString(){const[e,t,s]=this.tzComponents(),i=`${e}${t}:${s}`;return this.internal.toISOString().slice(0,-1)+i}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,s,i]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${s} ${t} ${i}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,s,i]=this.tzComponents();return`${e} GMT${t}${s}${i} (${Cx(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",s=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),i=String(Math.abs(e)%60).padStart(2,"0");return[t,s,i]}withTimeZone(e){return new ze(+this,e)}[Symbol.for("constructDateFrom")](e){return new ze(+new Date(e),this.timeZone)}}const Hh=6048e5,Nx=864e5,Ul=Symbol.for("constructDateFrom");function be(n,e){return typeof n=="function"?n(e):n&&typeof n=="object"&&Ul in n?n[Ul](e):n instanceof Date?new n.constructor(e):new Date(e)}function ae(n,e){return be(e||n,n)}function Vh(n,e,t){const s=ae(n,t?.in);return isNaN(e)?be(n,NaN):(e&&s.setDate(s.getDate()+e),s)}function Yh(n,e,t){const s=ae(n,t?.in);if(isNaN(e))return be(n,NaN);if(!e)return s;const i=s.getDate(),r=be(n,s.getTime());r.setMonth(s.getMonth()+e+1,0);const o=r.getDate();return i>=o?r:(s.setFullYear(r.getFullYear(),r.getMonth(),i),s)}let Ex={};function Pi(){return Ex}function Cs(n,e){const t=Pi(),s=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,i=ae(n,e?.in),r=i.getDay(),o=(r<s?7:0)+r-s;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function mi(n,e){return Cs(n,{...e,weekStartsOn:1})}function qh(n,e){const t=ae(n,e?.in),s=t.getFullYear(),i=be(t,0);i.setFullYear(s+1,0,4),i.setHours(0,0,0,0);const r=mi(i),o=be(t,0);o.setFullYear(s,0,4),o.setHours(0,0,0,0);const a=mi(o);return t.getTime()>=r.getTime()?s+1:t.getTime()>=a.getTime()?s:s-1}function Jl(n){const e=ae(n),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+n-+t}function zs(n,...e){const t=be.bind(null,e.find(s=>typeof s=="object"));return e.map(t)}function gi(n,e){const t=ae(n,e?.in);return t.setHours(0,0,0,0),t}function $a(n,e,t){const[s,i]=zs(t?.in,n,e),r=gi(s),o=gi(i),a=+r-Jl(r),l=+o-Jl(o);return Math.round((a-l)/Nx)}function Ax(n,e){const t=qh(n,e),s=be(n,0);return s.setFullYear(t,0,4),s.setHours(0,0,0,0),mi(s)}function Px(n,e,t){return Vh(n,e*7,t)}function Ix(n,e,t){return Yh(n,e*12,t)}function Rx(n,e){let t,s=e?.in;return n.forEach(i=>{!s&&typeof i=="object"&&(s=be.bind(null,i));const r=ae(i,s);(!t||t<r||isNaN(+r))&&(t=r)}),be(s,t||NaN)}function zx(n,e){let t,s=e?.in;return n.forEach(i=>{!s&&typeof i=="object"&&(s=be.bind(null,i));const r=ae(i,s);(!t||t>r||isNaN(+r))&&(t=r)}),be(s,t||NaN)}function Bx(n,e,t){const[s,i]=zs(t?.in,n,e);return+gi(s)==+gi(i)}function Kh(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function jx(n){return!(!Kh(n)&&typeof n!="number"||isNaN(+ae(n)))}function Uh(n,e,t){const[s,i]=zs(t?.in,n,e),r=s.getFullYear()-i.getFullYear(),o=s.getMonth()-i.getMonth();return r*12+o}function Lx(n,e){const t=ae(n,e?.in),s=t.getMonth();return t.setFullYear(t.getFullYear(),s+1,0),t.setHours(23,59,59,999),t}function Jh(n,e){const[t,s]=zs(n,e.start,e.end);return{start:t,end:s}}function Fx(n,e){const{start:t,end:s}=Jh(e?.in,n);let i=+t>+s;const r=i?+t:+s,o=i?s:t;o.setHours(0,0,0,0),o.setDate(1);let a=1;const l=[];for(;+o<=r;)l.push(be(t,o)),o.setMonth(o.getMonth()+a);return i?l.reverse():l}function Wx(n,e){const t=ae(n,e?.in);return t.setDate(1),t.setHours(0,0,0,0),t}function $x(n,e){const t=ae(n,e?.in),s=t.getFullYear();return t.setFullYear(s+1,0,0),t.setHours(23,59,59,999),t}function Gh(n,e){const t=ae(n,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function Hx(n,e){const{start:t,end:s}=Jh(e?.in,n);let i=+t>+s;const r=i?+t:+s,o=i?s:t;o.setHours(0,0,0,0),o.setMonth(0,1);let a=1;const l=[];for(;+o<=r;)l.push(be(t,o)),o.setFullYear(o.getFullYear()+a);return i?l.reverse():l}function Xh(n,e){const t=Pi(),s=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,i=ae(n,e?.in),r=i.getDay(),o=(r<s?-7:0)+6-(r-s);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function Vx(n,e){return Xh(n,{...e,weekStartsOn:1})}const Yx={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},qx=(n,e,t)=>{let s;const i=Yx[n];return typeof i=="string"?s=i:e===1?s=i.one:s=i.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+s:s+" ago":s};function bo(n){return(e={})=>{const t=e.width?String(e.width):n.defaultWidth;return n.formats[t]||n.formats[n.defaultWidth]}}const Kx={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Ux={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Jx={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Gx={date:bo({formats:Kx,defaultWidth:"full"}),time:bo({formats:Ux,defaultWidth:"full"}),dateTime:bo({formats:Jx,defaultWidth:"full"})},Xx={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Qx=(n,e,t,s)=>Xx[n];function $s(n){return(e,t)=>{const s=t?.context?String(t.context):"standalone";let i;if(s==="formatting"&&n.formattingValues){const o=n.defaultFormattingWidth||n.defaultWidth,a=t?.width?String(t.width):o;i=n.formattingValues[a]||n.formattingValues[o]}else{const o=n.defaultWidth,a=t?.width?String(t.width):n.defaultWidth;i=n.values[a]||n.values[o]}const r=n.argumentCallback?n.argumentCallback(e):e;return i[r]}}const Zx={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},e1={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},t1={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},n1={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},s1={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},i1={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},r1=(n,e)=>{const t=Number(n),s=t%100;if(s>20||s<10)switch(s%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},o1={ordinalNumber:r1,era:$s({values:Zx,defaultWidth:"wide"}),quarter:$s({values:e1,defaultWidth:"wide",argumentCallback:n=>n-1}),month:$s({values:t1,defaultWidth:"wide"}),day:$s({values:n1,defaultWidth:"wide"}),dayPeriod:$s({values:s1,defaultWidth:"wide",formattingValues:i1,defaultFormattingWidth:"wide"})};function Hs(n){return(e,t={})=>{const s=t.width,i=s&&n.matchPatterns[s]||n.matchPatterns[n.defaultMatchWidth],r=e.match(i);if(!r)return null;const o=r[0],a=s&&n.parsePatterns[s]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(a)?l1(a,u=>u.test(o)):a1(a,u=>u.test(o));let c;c=n.valueCallback?n.valueCallback(l):l,c=t.valueCallback?t.valueCallback(c):c;const d=e.slice(o.length);return{value:c,rest:d}}}function a1(n,e){for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&e(n[t]))return t}function l1(n,e){for(let t=0;t<n.length;t++)if(e(n[t]))return t}function c1(n){return(e,t={})=>{const s=e.match(n.matchPattern);if(!s)return null;const i=s[0],r=e.match(n.parsePattern);if(!r)return null;let o=n.valueCallback?n.valueCallback(r[0]):r[0];o=t.valueCallback?t.valueCallback(o):o;const a=e.slice(i.length);return{value:o,rest:a}}}const d1=/^(\d+)(th|st|nd|rd)?/i,u1=/\d+/i,h1={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},f1={any:[/^b/i,/^(a|c)/i]},p1={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},m1={any:[/1/i,/2/i,/3/i,/4/i]},g1={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},y1={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},b1={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},x1={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},_1={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},k1={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},w1={ordinalNumber:c1({matchPattern:d1,parsePattern:u1,valueCallback:n=>parseInt(n,10)}),era:Hs({matchPatterns:h1,defaultMatchWidth:"wide",parsePatterns:f1,defaultParseWidth:"any"}),quarter:Hs({matchPatterns:p1,defaultMatchWidth:"wide",parsePatterns:m1,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Hs({matchPatterns:g1,defaultMatchWidth:"wide",parsePatterns:y1,defaultParseWidth:"any"}),day:Hs({matchPatterns:b1,defaultMatchWidth:"wide",parsePatterns:x1,defaultParseWidth:"any"}),dayPeriod:Hs({matchPatterns:_1,defaultMatchWidth:"any",parsePatterns:k1,defaultParseWidth:"any"})},ys={code:"en-US",formatDistance:qx,formatLong:Gx,formatRelative:Qx,localize:o1,match:w1,options:{weekStartsOn:0,firstWeekContainsDate:1}};function v1(n,e){const t=ae(n,e?.in);return $a(t,Gh(t))+1}function Ha(n,e){const t=ae(n,e?.in),s=+mi(t)-+Ax(t);return Math.round(s/Hh)+1}function Qh(n,e){const t=ae(n,e?.in),s=t.getFullYear(),i=Pi(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=be(e?.in||n,0);o.setFullYear(s+1,0,r),o.setHours(0,0,0,0);const a=Cs(o,e),l=be(e?.in||n,0);l.setFullYear(s,0,r),l.setHours(0,0,0,0);const c=Cs(l,e);return+t>=+a?s+1:+t>=+c?s:s-1}function S1(n,e){const t=Pi(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,i=Qh(n,e),r=be(e?.in||n,0);return r.setFullYear(i,0,s),r.setHours(0,0,0,0),Cs(r,e)}function Va(n,e){const t=ae(n,e?.in),s=+Cs(t,e)-+S1(t,e);return Math.round(s/Hh)+1}function ie(n,e){const t=n<0?"-":"",s=Math.abs(n).toString().padStart(e,"0");return t+s}const an={y(n,e){const t=n.getFullYear(),s=t>0?t:1-t;return ie(e==="yy"?s%100:s,e.length)},M(n,e){const t=n.getMonth();return e==="M"?String(t+1):ie(t+1,2)},d(n,e){return ie(n.getDate(),e.length)},a(n,e){const t=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];default:return t==="am"?"a.m.":"p.m."}},h(n,e){return ie(n.getHours()%12||12,e.length)},H(n,e){return ie(n.getHours(),e.length)},m(n,e){return ie(n.getMinutes(),e.length)},s(n,e){return ie(n.getSeconds(),e.length)},S(n,e){const t=e.length,s=n.getMilliseconds(),i=Math.trunc(s*Math.pow(10,t-3));return ie(i,e.length)}},ds={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Gl={G:function(n,e,t){const s=n.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(s,{width:"abbreviated"});case"GGGGG":return t.era(s,{width:"narrow"});default:return t.era(s,{width:"wide"})}},y:function(n,e,t){if(e==="yo"){const s=n.getFullYear(),i=s>0?s:1-s;return t.ordinalNumber(i,{unit:"year"})}return an.y(n,e)},Y:function(n,e,t,s){const i=Qh(n,s),r=i>0?i:1-i;if(e==="YY"){const o=r%100;return ie(o,2)}return e==="Yo"?t.ordinalNumber(r,{unit:"year"}):ie(r,e.length)},R:function(n,e){const t=qh(n);return ie(t,e.length)},u:function(n,e){const t=n.getFullYear();return ie(t,e.length)},Q:function(n,e,t){const s=Math.ceil((n.getMonth()+1)/3);switch(e){case"Q":return String(s);case"QQ":return ie(s,2);case"Qo":return t.ordinalNumber(s,{unit:"quarter"});case"QQQ":return t.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(s,{width:"narrow",context:"formatting"});default:return t.quarter(s,{width:"wide",context:"formatting"})}},q:function(n,e,t){const s=Math.ceil((n.getMonth()+1)/3);switch(e){case"q":return String(s);case"qq":return ie(s,2);case"qo":return t.ordinalNumber(s,{unit:"quarter"});case"qqq":return t.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(s,{width:"narrow",context:"standalone"});default:return t.quarter(s,{width:"wide",context:"standalone"})}},M:function(n,e,t){const s=n.getMonth();switch(e){case"M":case"MM":return an.M(n,e);case"Mo":return t.ordinalNumber(s+1,{unit:"month"});case"MMM":return t.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(s,{width:"narrow",context:"formatting"});default:return t.month(s,{width:"wide",context:"formatting"})}},L:function(n,e,t){const s=n.getMonth();switch(e){case"L":return String(s+1);case"LL":return ie(s+1,2);case"Lo":return t.ordinalNumber(s+1,{unit:"month"});case"LLL":return t.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(s,{width:"narrow",context:"standalone"});default:return t.month(s,{width:"wide",context:"standalone"})}},w:function(n,e,t,s){const i=Va(n,s);return e==="wo"?t.ordinalNumber(i,{unit:"week"}):ie(i,e.length)},I:function(n,e,t){const s=Ha(n);return e==="Io"?t.ordinalNumber(s,{unit:"week"}):ie(s,e.length)},d:function(n,e,t){return e==="do"?t.ordinalNumber(n.getDate(),{unit:"date"}):an.d(n,e)},D:function(n,e,t){const s=v1(n);return e==="Do"?t.ordinalNumber(s,{unit:"dayOfYear"}):ie(s,e.length)},E:function(n,e,t){const s=n.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(s,{width:"short",context:"formatting"});default:return t.day(s,{width:"wide",context:"formatting"})}},e:function(n,e,t,s){const i=n.getDay(),r=(i-s.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return ie(r,2);case"eo":return t.ordinalNumber(r,{unit:"day"});case"eee":return t.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(i,{width:"short",context:"formatting"});default:return t.day(i,{width:"wide",context:"formatting"})}},c:function(n,e,t,s){const i=n.getDay(),r=(i-s.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return ie(r,e.length);case"co":return t.ordinalNumber(r,{unit:"day"});case"ccc":return t.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(i,{width:"narrow",context:"standalone"});case"cccccc":return t.day(i,{width:"short",context:"standalone"});default:return t.day(i,{width:"wide",context:"standalone"})}},i:function(n,e,t){const s=n.getDay(),i=s===0?7:s;switch(e){case"i":return String(i);case"ii":return ie(i,e.length);case"io":return t.ordinalNumber(i,{unit:"day"});case"iii":return t.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(s,{width:"short",context:"formatting"});default:return t.day(s,{width:"wide",context:"formatting"})}},a:function(n,e,t){const i=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(i,{width:"narrow",context:"formatting"});default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(n,e,t){const s=n.getHours();let i;switch(s===12?i=ds.noon:s===0?i=ds.midnight:i=s/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(i,{width:"narrow",context:"formatting"});default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(n,e,t){const s=n.getHours();let i;switch(s>=17?i=ds.evening:s>=12?i=ds.afternoon:s>=4?i=ds.morning:i=ds.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(i,{width:"narrow",context:"formatting"});default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(n,e,t){if(e==="ho"){let s=n.getHours()%12;return s===0&&(s=12),t.ordinalNumber(s,{unit:"hour"})}return an.h(n,e)},H:function(n,e,t){return e==="Ho"?t.ordinalNumber(n.getHours(),{unit:"hour"}):an.H(n,e)},K:function(n,e,t){const s=n.getHours()%12;return e==="Ko"?t.ordinalNumber(s,{unit:"hour"}):ie(s,e.length)},k:function(n,e,t){let s=n.getHours();return s===0&&(s=24),e==="ko"?t.ordinalNumber(s,{unit:"hour"}):ie(s,e.length)},m:function(n,e,t){return e==="mo"?t.ordinalNumber(n.getMinutes(),{unit:"minute"}):an.m(n,e)},s:function(n,e,t){return e==="so"?t.ordinalNumber(n.getSeconds(),{unit:"second"}):an.s(n,e)},S:function(n,e){return an.S(n,e)},X:function(n,e,t){const s=n.getTimezoneOffset();if(s===0)return"Z";switch(e){case"X":return Ql(s);case"XXXX":case"XX":return Bn(s);default:return Bn(s,":")}},x:function(n,e,t){const s=n.getTimezoneOffset();switch(e){case"x":return Ql(s);case"xxxx":case"xx":return Bn(s);default:return Bn(s,":")}},O:function(n,e,t){const s=n.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Xl(s,":");default:return"GMT"+Bn(s,":")}},z:function(n,e,t){const s=n.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Xl(s,":");default:return"GMT"+Bn(s,":")}},t:function(n,e,t){const s=Math.trunc(+n/1e3);return ie(s,e.length)},T:function(n,e,t){return ie(+n,e.length)}};function Xl(n,e=""){const t=n>0?"-":"+",s=Math.abs(n),i=Math.trunc(s/60),r=s%60;return r===0?t+String(i):t+String(i)+e+ie(r,2)}function Ql(n,e){return n%60===0?(n>0?"-":"+")+ie(Math.abs(n)/60,2):Bn(n,e)}function Bn(n,e=""){const t=n>0?"-":"+",s=Math.abs(n),i=ie(Math.trunc(s/60),2),r=ie(s%60,2);return t+i+e+r}const Zl=(n,e)=>{switch(n){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},Zh=(n,e)=>{switch(n){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},M1=(n,e)=>{const t=n.match(/(P+)(p+)?/)||[],s=t[1],i=t[2];if(!i)return Zl(n,e);let r;switch(s){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",Zl(s,e)).replace("{{time}}",Zh(i,e))},C1={p:Zh,P:M1},O1=/^D+$/,D1=/^Y+$/,T1=["D","DD","YY","YYYY"];function N1(n){return O1.test(n)}function E1(n){return D1.test(n)}function A1(n,e,t){const s=P1(n,e,t);if(console.warn(s),T1.includes(n))throw new RangeError(s)}function P1(n,e,t){const s=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${e}\`) for formatting ${s} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const I1=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,R1=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,z1=/^'([^]*?)'?$/,B1=/''/g,j1=/[a-zA-Z]/;function ei(n,e,t){const s=Pi(),i=t?.locale??s.locale??ys,r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,o=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,a=ae(n,t?.in);if(!jx(a))throw new RangeError("Invalid time value");let l=e.match(R1).map(d=>{const u=d[0];if(u==="p"||u==="P"){const h=C1[u];return h(d,i.formatLong)}return d}).join("").match(I1).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const u=d[0];if(u==="'")return{isToken:!1,value:L1(d)};if(Gl[u])return{isToken:!0,value:d};if(u.match(j1))throw new RangeError("Format string contains an unescaped latin alphabet character `"+u+"`");return{isToken:!1,value:d}});i.localize.preprocessor&&(l=i.localize.preprocessor(a,l));const c={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return l.map(d=>{if(!d.isToken)return d.value;const u=d.value;(!t?.useAdditionalWeekYearTokens&&E1(u)||!t?.useAdditionalDayOfYearTokens&&N1(u))&&A1(u,e,String(n));const h=Gl[u[0]];return h(a,u,i.localize,c)}).join("")}function L1(n){const e=n.match(z1);return e?e[1].replace(B1,"'"):n}function F1(n,e){const t=ae(n,e?.in),s=t.getFullYear(),i=t.getMonth(),r=be(t,0);return r.setFullYear(s,i+1,0),r.setHours(0,0,0,0),r.getDate()}function W1(n,e){return ae(n,e?.in).getMonth()}function $1(n,e){return ae(n,e?.in).getFullYear()}function H1(n,e){return+ae(n)>+ae(e)}function V1(n,e){return+ae(n)<+ae(e)}function Y1(n,e,t){const[s,i]=zs(t?.in,n,e);return s.getFullYear()===i.getFullYear()&&s.getMonth()===i.getMonth()}function q1(n,e,t){const[s,i]=zs(t?.in,n,e);return s.getFullYear()===i.getFullYear()}function K1(n,e,t){const s=ae(n,t?.in),i=s.getFullYear(),r=s.getDate(),o=be(n,0);o.setFullYear(i,e,15),o.setHours(0,0,0,0);const a=F1(o);return s.setMonth(e,Math.min(r,a)),s}function U1(n,e,t){const s=ae(n,t?.in);return isNaN(+s)?be(n,NaN):(s.setFullYear(e),s)}const ec=5,J1=4;function G1(n,e){const t=e.startOfMonth(n),s=t.getDay()>0?t.getDay():7,i=e.addDays(n,-s+1),r=e.addDays(i,ec*7-1);return e.getMonth(n)===e.getMonth(r)?ec:J1}function ef(n,e){const t=e.startOfMonth(n),s=t.getDay();return s===1?t:s===0?e.addDays(t,-6):e.addDays(t,-1*(s-1))}function X1(n,e){const t=ef(n,e),s=G1(n,e);return e.addDays(t,s*7-1)}const tf={...ys,labels:{labelDayButton:(n,e,t,s)=>{let i;s&&typeof s.format=="function"?i=s.format.bind(s):i=(o,a)=>ei(o,a,{locale:ys,...t});let r=i(n,"PPPP");return e.today&&(r=`Today, ${r}`),e.selected&&(r=`${r}, selected`),r},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:n=>`Week ${n}`,labelYearDropdown:"Choose the Year",labelGrid:(n,e,t)=>{let s;return t&&typeof t.format=="function"?s=t.format.bind(t):s=(i,r)=>ei(i,r,{locale:ys,...e}),s(n,"LLLL yyyy")},labelGridcell:(n,e,t,s)=>{let i;s&&typeof s.format=="function"?i=s.format.bind(s):i=(o,a)=>ei(o,a,{locale:ys,...t});let r=i(n,"PPPP");return e?.today&&(r=`Today, ${r}`),r},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(n,e,t)=>{let s;return t&&typeof t.format=="function"?s=t.format.bind(t):s=(i,r)=>ei(i,r,{locale:ys,...e}),s(n,"cccc")}}};class dt{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?ze.tz(this.options.timeZone):new this.Date,this.newDate=(s,i,r)=>this.overrides?.newDate?this.overrides.newDate(s,i,r):this.options.timeZone?new ze(s,i,r,this.options.timeZone):new Date(s,i,r),this.addDays=(s,i)=>this.overrides?.addDays?this.overrides.addDays(s,i):Vh(s,i),this.addMonths=(s,i)=>this.overrides?.addMonths?this.overrides.addMonths(s,i):Yh(s,i),this.addWeeks=(s,i)=>this.overrides?.addWeeks?this.overrides.addWeeks(s,i):Px(s,i),this.addYears=(s,i)=>this.overrides?.addYears?this.overrides.addYears(s,i):Ix(s,i),this.differenceInCalendarDays=(s,i)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(s,i):$a(s,i),this.differenceInCalendarMonths=(s,i)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(s,i):Uh(s,i),this.eachMonthOfInterval=s=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(s):Fx(s),this.eachYearOfInterval=s=>{const i=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(s):Hx(s),r=new Set(i.map(a=>this.getYear(a)));if(r.size===i.length)return i;const o=[];return r.forEach(a=>{o.push(new Date(a,0,1))}),o},this.endOfBroadcastWeek=s=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(s):X1(s,this),this.endOfISOWeek=s=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(s):Vx(s),this.endOfMonth=s=>this.overrides?.endOfMonth?this.overrides.endOfMonth(s):Lx(s),this.endOfWeek=(s,i)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(s,i):Xh(s,this.options),this.endOfYear=s=>this.overrides?.endOfYear?this.overrides.endOfYear(s):$x(s),this.format=(s,i,r)=>{const o=this.overrides?.format?this.overrides.format(s,i,this.options):ei(s,i,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(o):o},this.getISOWeek=s=>this.overrides?.getISOWeek?this.overrides.getISOWeek(s):Ha(s),this.getMonth=(s,i)=>this.overrides?.getMonth?this.overrides.getMonth(s,this.options):W1(s,this.options),this.getYear=(s,i)=>this.overrides?.getYear?this.overrides.getYear(s,this.options):$1(s,this.options),this.getWeek=(s,i)=>this.overrides?.getWeek?this.overrides.getWeek(s,this.options):Va(s,this.options),this.isAfter=(s,i)=>this.overrides?.isAfter?this.overrides.isAfter(s,i):H1(s,i),this.isBefore=(s,i)=>this.overrides?.isBefore?this.overrides.isBefore(s,i):V1(s,i),this.isDate=s=>this.overrides?.isDate?this.overrides.isDate(s):Kh(s),this.isSameDay=(s,i)=>this.overrides?.isSameDay?this.overrides.isSameDay(s,i):Bx(s,i),this.isSameMonth=(s,i)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(s,i):Y1(s,i),this.isSameYear=(s,i)=>this.overrides?.isSameYear?this.overrides.isSameYear(s,i):q1(s,i),this.max=s=>this.overrides?.max?this.overrides.max(s):Rx(s),this.min=s=>this.overrides?.min?this.overrides.min(s):zx(s),this.setMonth=(s,i)=>this.overrides?.setMonth?this.overrides.setMonth(s,i):K1(s,i),this.setYear=(s,i)=>this.overrides?.setYear?this.overrides.setYear(s,i):U1(s,i),this.startOfBroadcastWeek=(s,i)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(s,this):ef(s,this),this.startOfDay=s=>this.overrides?.startOfDay?this.overrides.startOfDay(s):gi(s),this.startOfISOWeek=s=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(s):mi(s),this.startOfMonth=s=>this.overrides?.startOfMonth?this.overrides.startOfMonth(s):Wx(s),this.startOfWeek=(s,i)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(s,this.options):Cs(s,this.options),this.startOfYear=s=>this.overrides?.startOfYear?this.overrides.startOfYear(s):Gh(s),this.options={locale:tf,...e},this.overrides=t}getDigitMap(){const{numerals:e="latn"}=this.options,t=new Intl.NumberFormat("en-US",{numberingSystem:e}),s={};for(let i=0;i<10;i++)s[i.toString()]=t.format(i);return s}replaceDigits(e){const t=this.getDigitMap();return e.replace(/\d/g,s=>t[s]||s)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&dt.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:t,timeZone:s,numerals:i}=this.options,r=t?.code;if(r&&dt.yearFirstLocales.has(r))try{return new Intl.DateTimeFormat(r,{month:"long",year:"numeric",timeZone:s,numberingSystem:i}).format(e)}catch{}const o=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,o)}}dt.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const $t=new dt;class nf{constructor(e,t,s=$t){this.date=e,this.displayMonth=t,this.outside=!!(t&&!s.isSameMonth(e,t)),this.dateLib=s,this.isoDate=s.format(e,"yyyy-MM-dd"),this.displayMonthId=s.format(t,"yyyy-MM"),this.dateMonthId=s.format(e,"yyyy-MM")}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class Q1{constructor(e,t){this.date=e,this.weeks=t}}class Z1{constructor(e,t){this.days=t,this.weekNumber=e}}function e_(n){return x.createElement("button",{...n})}function t_(n){return x.createElement("span",{...n})}function n_(n){const{size:e=24,orientation:t="left",className:s}=n;return x.createElement("svg",{className:s,width:e,height:e,viewBox:"0 0 24 24"},t==="up"&&x.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),t==="down"&&x.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),t==="left"&&x.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),t==="right"&&x.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function s_(n){const{day:e,modifiers:t,...s}=n;return x.createElement("td",{...s})}function i_(n){const{day:e,modifiers:t,...s}=n,i=x.useRef(null);return x.useEffect(()=>{t.focused&&i.current?.focus()},[t.focused]),x.createElement("button",{ref:i,...s})}var B;(function(n){n.Root="root",n.Chevron="chevron",n.Day="day",n.DayButton="day_button",n.CaptionLabel="caption_label",n.Dropdowns="dropdowns",n.Dropdown="dropdown",n.DropdownRoot="dropdown_root",n.Footer="footer",n.MonthGrid="month_grid",n.MonthCaption="month_caption",n.MonthsDropdown="months_dropdown",n.Month="month",n.Months="months",n.Nav="nav",n.NextMonthButton="button_next",n.PreviousMonthButton="button_previous",n.Week="week",n.Weeks="weeks",n.Weekday="weekday",n.Weekdays="weekdays",n.WeekNumber="week_number",n.WeekNumberHeader="week_number_header",n.YearsDropdown="years_dropdown"})(B||(B={}));var fe;(function(n){n.disabled="disabled",n.hidden="hidden",n.outside="outside",n.focused="focused",n.today="today"})(fe||(fe={}));var Ot;(function(n){n.range_end="range_end",n.range_middle="range_middle",n.range_start="range_start",n.selected="selected"})(Ot||(Ot={}));var ot;(function(n){n.weeks_before_enter="weeks_before_enter",n.weeks_before_exit="weeks_before_exit",n.weeks_after_enter="weeks_after_enter",n.weeks_after_exit="weeks_after_exit",n.caption_after_enter="caption_after_enter",n.caption_after_exit="caption_after_exit",n.caption_before_enter="caption_before_enter",n.caption_before_exit="caption_before_exit"})(ot||(ot={}));function r_(n){const{options:e,className:t,components:s,classNames:i,...r}=n,o=[i[B.Dropdown],t].join(" "),a=e?.find(({value:l})=>l===r.value);return x.createElement("span",{"data-disabled":r.disabled,className:i[B.DropdownRoot]},x.createElement(s.Select,{className:o,...r},e?.map(({value:l,label:c,disabled:d})=>x.createElement(s.Option,{key:l,value:l,disabled:d},c))),x.createElement("span",{className:i[B.CaptionLabel],"aria-hidden":!0},a?.label,x.createElement(s.Chevron,{orientation:"down",size:18,className:i[B.Chevron]})))}function o_(n){return x.createElement("div",{...n})}function a_(n){return x.createElement("div",{...n})}function l_(n){const{calendarMonth:e,displayIndex:t,...s}=n;return x.createElement("div",{...s},n.children)}function c_(n){const{calendarMonth:e,displayIndex:t,...s}=n;return x.createElement("div",{...s})}function d_(n){return x.createElement("table",{...n})}function u_(n){return x.createElement("div",{...n})}const sf=x.createContext(void 0);function Ii(){const n=x.useContext(sf);if(n===void 0)throw new Error("useDayPicker() must be used within a custom component.");return n}function h_(n){const{components:e}=Ii();return x.createElement(e.Dropdown,{...n})}function f_(n){const{onPreviousClick:e,onNextClick:t,previousMonth:s,nextMonth:i,...r}=n,{components:o,classNames:a,labels:{labelPrevious:l,labelNext:c}}=Ii(),d=x.useCallback(h=>{i&&t?.(h)},[i,t]),u=x.useCallback(h=>{s&&e?.(h)},[s,e]);return x.createElement("nav",{...r},x.createElement(o.PreviousMonthButton,{type:"button",className:a[B.PreviousMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":l(s),onClick:u},x.createElement(o.Chevron,{disabled:s?void 0:!0,className:a[B.Chevron],orientation:"left"})),x.createElement(o.NextMonthButton,{type:"button",className:a[B.NextMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":c(i),onClick:d},x.createElement(o.Chevron,{disabled:i?void 0:!0,orientation:"right",className:a[B.Chevron]})))}function p_(n){const{components:e}=Ii();return x.createElement(e.Button,{...n})}function m_(n){return x.createElement("option",{...n})}function g_(n){const{components:e}=Ii();return x.createElement(e.Button,{...n})}function y_(n){const{rootRef:e,...t}=n;return x.createElement("div",{...t,ref:e})}function b_(n){return x.createElement("select",{...n})}function x_(n){const{week:e,...t}=n;return x.createElement("tr",{...t})}function __(n){return x.createElement("th",{...n})}function k_(n){return x.createElement("thead",{"aria-hidden":!0},x.createElement("tr",{...n}))}function w_(n){const{week:e,...t}=n;return x.createElement("th",{...t})}function v_(n){return x.createElement("th",{...n})}function S_(n){return x.createElement("tbody",{...n})}function M_(n){const{components:e}=Ii();return x.createElement(e.Dropdown,{...n})}const C_=Object.freeze(Object.defineProperty({__proto__:null,Button:e_,CaptionLabel:t_,Chevron:n_,Day:s_,DayButton:i_,Dropdown:r_,DropdownNav:o_,Footer:a_,Month:l_,MonthCaption:c_,MonthGrid:d_,Months:u_,MonthsDropdown:h_,Nav:f_,NextMonthButton:p_,Option:m_,PreviousMonthButton:g_,Root:y_,Select:b_,Week:x_,WeekNumber:w_,WeekNumberHeader:v_,Weekday:__,Weekdays:k_,Weeks:S_,YearsDropdown:M_},Symbol.toStringTag,{value:"Module"}));function Zt(n,e,t=!1,s=$t){let{from:i,to:r}=n;const{differenceInCalendarDays:o,isSameDay:a}=s;return i&&r?(o(r,i)<0&&([i,r]=[r,i]),o(e,i)>=(t?1:0)&&o(r,e)>=(t?1:0)):!t&&r?a(r,e):!t&&i?a(i,e):!1}function Ya(n){return!!(n&&typeof n=="object"&&"before"in n&&"after"in n)}function $r(n){return!!(n&&typeof n=="object"&&"from"in n)}function qa(n){return!!(n&&typeof n=="object"&&"after"in n)}function Ka(n){return!!(n&&typeof n=="object"&&"before"in n)}function rf(n){return!!(n&&typeof n=="object"&&"dayOfWeek"in n)}function of(n,e){return Array.isArray(n)&&n.every(e.isDate)}function en(n,e,t=$t){const s=Array.isArray(e)?e:[e],{isSameDay:i,differenceInCalendarDays:r,isAfter:o}=t;return s.some(a=>{if(typeof a=="boolean")return a;if(t.isDate(a))return i(n,a);if(of(a,t))return a.some(l=>i(n,l));if($r(a))return Zt(a,n,!1,t);if(rf(a))return Array.isArray(a.dayOfWeek)?a.dayOfWeek.includes(n.getDay()):a.dayOfWeek===n.getDay();if(Ya(a)){const l=r(a.before,n),c=r(a.after,n),d=l>0,u=c<0;return o(a.before,a.after)?u&&d:d||u}return qa(a)?r(n,a.after)>0:Ka(a)?r(a.before,n)>0:typeof a=="function"?a(n):!1})}function O_(n,e,t,s,i){const{disabled:r,hidden:o,modifiers:a,showOutsideDays:l,broadcastCalendar:c,today:d=i.today()}=e,{isSameDay:u,isSameMonth:h,startOfMonth:f,isBefore:p,endOfMonth:m,isAfter:g}=i,b=t&&f(t),S=s&&m(s),_={[fe.focused]:[],[fe.outside]:[],[fe.disabled]:[],[fe.hidden]:[],[fe.today]:[]},k={};for(const v of n){const{date:w,displayMonth:M}=v,C=!!(M&&!h(w,M)),O=!!(b&&p(w,b)),D=!!(S&&g(w,S)),A=!!(r&&en(w,r,i)),P=!!(o&&en(w,o,i))||O||D||!c&&!l&&C||c&&l===!1&&C,F=u(w,d);C&&_.outside.push(v),A&&_.disabled.push(v),P&&_.hidden.push(v),F&&_.today.push(v),a&&Object.keys(a).forEach(j=>{const H=a?.[j];H&&en(w,H,i)&&(k[j]?k[j].push(v):k[j]=[v])})}return v=>{const w={[fe.focused]:!1,[fe.disabled]:!1,[fe.hidden]:!1,[fe.outside]:!1,[fe.today]:!1},M={};for(const C in _){const O=_[C];w[C]=O.some(D=>D===v)}for(const C in k)M[C]=k[C].some(O=>O===v);return{...w,...M}}}function D_(n,e,t={}){return Object.entries(n).filter(([,i])=>i===!0).reduce((i,[r])=>(t[r]?i.push(t[r]):e[fe[r]]?i.push(e[fe[r]]):e[Ot[r]]&&i.push(e[Ot[r]]),i),[e[B.Day]])}function T_(n){return{...C_,...n}}function N_(n){const e={"data-mode":n.mode??void 0,"data-required":"required"in n?n.required:void 0,"data-multiple-months":n.numberOfMonths&&n.numberOfMonths>1||void 0,"data-week-numbers":n.showWeekNumber||void 0,"data-broadcast-calendar":n.broadcastCalendar||void 0,"data-nav-layout":n.navLayout||void 0};return Object.entries(n).forEach(([t,s])=>{t.startsWith("data-")&&(e[t]=s)}),e}function E_(){const n={};for(const e in B)n[B[e]]=`rdp-${B[e]}`;for(const e in fe)n[fe[e]]=`rdp-${fe[e]}`;for(const e in Ot)n[Ot[e]]=`rdp-${Ot[e]}`;for(const e in ot)n[ot[e]]=`rdp-${ot[e]}`;return n}function af(n,e,t){return(t??new dt(e)).formatMonthYear(n)}const A_=af;function P_(n,e,t){return(t??new dt(e)).format(n,"d")}function I_(n,e=$t){return e.format(n,"LLLL")}function R_(n,e,t){return(t??new dt(e)).format(n,"cccccc")}function z_(n,e=$t){return n<10?e.formatNumber(`0${n.toLocaleString()}`):e.formatNumber(`${n.toLocaleString()}`)}function B_(){return""}function lf(n,e=$t){return e.format(n,"yyyy")}const j_=lf,L_=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:af,formatDay:P_,formatMonthCaption:A_,formatMonthDropdown:I_,formatWeekNumber:z_,formatWeekNumberHeader:B_,formatWeekdayName:R_,formatYearCaption:j_,formatYearDropdown:lf},Symbol.toStringTag,{value:"Module"}));function F_(n){return n?.formatMonthCaption&&!n.formatCaption&&(n.formatCaption=n.formatMonthCaption),n?.formatYearCaption&&!n.formatYearDropdown&&(n.formatYearDropdown=n.formatYearCaption),{...L_,...n}}function Ua(n,e,t,s){let i=(s??new dt(t)).format(n,"PPPP");return e.today&&(i=`Today, ${i}`),e.selected&&(i=`${i}, selected`),i}const W_=Ua;function Ja(n,e,t){return(t??new dt(e)).formatMonthYear(n)}const $_=Ja;function cf(n,e,t,s){let i=(s??new dt(t)).format(n,"PPPP");return e?.today&&(i=`Today, ${i}`),i}function df(n){return"Choose the Month"}function uf(){return""}const H_="Go to the Next Month";function hf(n,e){return H_}function ff(n){return"Go to the Previous Month"}function pf(n,e,t){return(t??new dt(e)).format(n,"cccc")}function mf(n,e){return`Week ${n}`}function gf(n){return"Week Number"}function yf(n){return"Choose the Year"}const V_=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:$_,labelDay:W_,labelDayButton:Ua,labelGrid:Ja,labelGridcell:cf,labelMonthDropdown:df,labelNav:uf,labelNext:hf,labelPrevious:ff,labelWeekNumber:mf,labelWeekNumberHeader:gf,labelWeekday:pf,labelYearDropdown:yf},Symbol.toStringTag,{value:"Module"})),St=(n,e,t)=>e||(t?typeof t=="function"?t:(...s)=>t:n);function Y_(n,e){const t=e.locale?.labels??{};return{...V_,...n??{},labelDayButton:St(Ua,n?.labelDayButton,t.labelDayButton),labelMonthDropdown:St(df,n?.labelMonthDropdown,t.labelMonthDropdown),labelNext:St(hf,n?.labelNext,t.labelNext),labelPrevious:St(ff,n?.labelPrevious,t.labelPrevious),labelWeekNumber:St(mf,n?.labelWeekNumber,t.labelWeekNumber),labelYearDropdown:St(yf,n?.labelYearDropdown,t.labelYearDropdown),labelGrid:St(Ja,n?.labelGrid,t.labelGrid),labelGridcell:St(cf,n?.labelGridcell,t.labelGridcell),labelNav:St(uf,n?.labelNav,t.labelNav),labelWeekNumberHeader:St(gf,n?.labelWeekNumberHeader,t.labelWeekNumberHeader),labelWeekday:St(pf,n?.labelWeekday,t.labelWeekday)}}function q_(n,e,t,s,i){const{startOfMonth:r,startOfYear:o,endOfYear:a,eachMonthOfInterval:l,getMonth:c}=i;return l({start:o(n),end:a(n)}).map(h=>{const f=s.formatMonthDropdown(h,i),p=c(h),m=e&&h<r(e)||t&&h>r(t)||!1;return{value:p,label:f,disabled:m}})}function K_(n,e={},t={}){let s={...e?.[B.Day]};return Object.entries(n).filter(([,i])=>i===!0).forEach(([i])=>{s={...s,...t?.[i]}}),s}function U_(n,e,t,s){const i=s??n.today(),r=t?n.startOfBroadcastWeek(i,n):e?n.startOfISOWeek(i):n.startOfWeek(i),o=[];for(let a=0;a<7;a++){const l=n.addDays(r,a);o.push(l)}return o}function J_(n,e,t,s,i=!1){if(!n||!e)return;const{startOfYear:r,endOfYear:o,eachYearOfInterval:a,getYear:l}=s,c=r(n),d=o(e),u=a({start:c,end:d});return i&&u.reverse(),u.map(h=>{const f=t.formatYearDropdown(h,s);return{value:l(h),label:f,disabled:!1}})}function G_(n,e={}){const{weekStartsOn:t,locale:s}=e,i=t??s?.options?.weekStartsOn??0,r=a=>{const l=typeof a=="number"||typeof a=="string"?new Date(a):a;return new ze(l.getFullYear(),l.getMonth(),l.getDate(),12,0,0,n)},o=a=>{const l=r(a);return new Date(l.getFullYear(),l.getMonth(),l.getDate(),0,0,0,0)};return{today:()=>r(ze.tz(n)),newDate:(a,l,c)=>new ze(a,l,c,12,0,0,n),startOfDay:a=>r(a),startOfWeek:(a,l)=>{const c=r(a),d=l?.weekStartsOn??i,u=(c.getDay()-d+7)%7;return c.setDate(c.getDate()-u),c},startOfISOWeek:a=>{const l=r(a),c=(l.getDay()-1+7)%7;return l.setDate(l.getDate()-c),l},startOfMonth:a=>{const l=r(a);return l.setDate(1),l},startOfYear:a=>{const l=r(a);return l.setMonth(0,1),l},endOfWeek:(a,l)=>{const c=r(a),h=(((l?.weekStartsOn??i)+6)%7-c.getDay()+7)%7;return c.setDate(c.getDate()+h),c},endOfISOWeek:a=>{const l=r(a),c=(7-l.getDay())%7;return l.setDate(l.getDate()+c),l},endOfMonth:a=>{const l=r(a);return l.setMonth(l.getMonth()+1,0),l},endOfYear:a=>{const l=r(a);return l.setMonth(11,31),l},eachMonthOfInterval:a=>{const l=r(a.start),c=r(a.end),d=[],u=new ze(l.getFullYear(),l.getMonth(),1,12,0,0,n),h=c.getFullYear()*12+c.getMonth();for(;u.getFullYear()*12+u.getMonth()<=h;)d.push(new ze(u,n)),u.setMonth(u.getMonth()+1,1);return d},addDays:(a,l)=>{const c=r(a);return c.setDate(c.getDate()+l),c},addWeeks:(a,l)=>{const c=r(a);return c.setDate(c.getDate()+l*7),c},addMonths:(a,l)=>{const c=r(a);return c.setMonth(c.getMonth()+l),c},addYears:(a,l)=>{const c=r(a);return c.setFullYear(c.getFullYear()+l),c},eachYearOfInterval:a=>{const l=r(a.start),c=r(a.end),d=[],u=new ze(l.getFullYear(),0,1,12,0,0,n);for(;u.getFullYear()<=c.getFullYear();)d.push(new ze(u,n)),u.setFullYear(u.getFullYear()+1,0,1);return d},getWeek:(a,l)=>{const c=o(a);return Va(c,{weekStartsOn:l?.weekStartsOn??i,firstWeekContainsDate:l?.firstWeekContainsDate??s?.options?.firstWeekContainsDate??1})},getISOWeek:a=>{const l=o(a);return Ha(l)},differenceInCalendarDays:(a,l)=>{const c=o(a),d=o(l);return $a(c,d)},differenceInCalendarMonths:(a,l)=>{const c=o(a),d=o(l);return Uh(c,d)}}}const Ri=n=>n instanceof HTMLElement?n:null,xo=n=>[...n.querySelectorAll("[data-animated-month]")??[]],X_=n=>Ri(n.querySelector("[data-animated-month]")),_o=n=>Ri(n.querySelector("[data-animated-caption]")),ko=n=>Ri(n.querySelector("[data-animated-weeks]")),Q_=n=>Ri(n.querySelector("[data-animated-nav]")),Z_=n=>Ri(n.querySelector("[data-animated-weekdays]"));function ek(n,e,{classNames:t,months:s,focused:i,dateLib:r}){const o=x.useRef(null),a=x.useRef(s),l=x.useRef(!1);x.useLayoutEffect(()=>{const c=a.current;if(a.current=s,!e||!n.current||!(n.current instanceof HTMLElement)||s.length===0||c.length===0||s.length!==c.length)return;const d=r.isSameMonth(s[0].date,c[0].date),u=r.isAfter(s[0].date,c[0].date),h=u?t[ot.caption_after_enter]:t[ot.caption_before_enter],f=u?t[ot.weeks_after_enter]:t[ot.weeks_before_enter],p=o.current,m=n.current.cloneNode(!0);if(m instanceof HTMLElement?(xo(m).forEach(_=>{if(!(_ instanceof HTMLElement))return;const k=X_(_);k&&_.contains(k)&&_.removeChild(k);const v=_o(_);v&&v.classList.remove(h);const w=ko(_);w&&w.classList.remove(f)}),o.current=m):o.current=null,l.current||d||i)return;const g=p instanceof HTMLElement?xo(p):[],b=xo(n.current);if(b?.every(S=>S instanceof HTMLElement)&&g&&g.every(S=>S instanceof HTMLElement)){l.current=!0,n.current.style.isolation="isolate";const S=Q_(n.current);S&&(S.style.zIndex="1"),b.forEach((_,k)=>{const v=g[k];if(!v)return;_.style.position="relative",_.style.overflow="hidden";const w=_o(_);w&&w.classList.add(h);const M=ko(_);M&&M.classList.add(f);const C=()=>{l.current=!1,n.current&&(n.current.style.isolation=""),S&&(S.style.zIndex=""),w&&w.classList.remove(h),M&&M.classList.remove(f),_.style.position="",_.style.overflow="",_.contains(v)&&_.removeChild(v)};v.style.pointerEvents="none",v.style.position="absolute",v.style.overflow="hidden",v.setAttribute("aria-hidden","true");const O=Z_(v);O&&(O.style.opacity="0");const D=_o(v);D&&(D.classList.add(u?t[ot.caption_before_exit]:t[ot.caption_after_exit]),D.addEventListener("animationend",C));const A=ko(v);A&&A.classList.add(u?t[ot.weeks_before_exit]:t[ot.weeks_after_exit]),_.insertBefore(v,_.firstChild)})}})}function tk(n,e,t,s){const i=n[0],r=n[n.length-1],{ISOWeek:o,fixedWeeks:a,broadcastCalendar:l}=t??{},{addDays:c,differenceInCalendarDays:d,differenceInCalendarMonths:u,endOfBroadcastWeek:h,endOfISOWeek:f,endOfMonth:p,endOfWeek:m,isAfter:g,startOfBroadcastWeek:b,startOfISOWeek:S,startOfWeek:_}=s,k=l?b(i,s):o?S(i):_(i),v=l?h(r):o?f(p(r)):m(p(r)),w=e&&(l?h(e):o?f(e):m(e)),M=w&&g(v,w)?w:v,C=d(M,k),O=u(r,i)+1,D=[];for(let F=0;F<=C;F++){const j=c(k,F);D.push(j)}const P=(l?35:42)*O;if(a&&D.length<P){const F=P-D.length;for(let j=0;j<F;j++){const H=c(D[D.length-1],1);D.push(H)}}return D}function nk(n){const e=[];return n.reduce((t,s)=>{const i=s.weeks.reduce((r,o)=>r.concat(o.days.slice()),e.slice());return t.concat(i.slice())},e.slice())}function sk(n,e,t,s){const{numberOfMonths:i=1}=t,r=[];for(let o=0;o<i;o++){const a=s.addMonths(n,o);if(e&&a>e)break;r.push(a)}return r}function tc(n,e,t,s){const{month:i,defaultMonth:r,today:o=s.today(),numberOfMonths:a=1}=n;let l=i||r||o;const{differenceInCalendarMonths:c,addMonths:d,startOfMonth:u}=s;if(t&&c(t,l)<a-1){const h=-1*(a-1);l=d(t,h)}return e&&c(l,e)<0&&(l=e),u(l)}function ik(n,e,t,s){const{addDays:i,endOfBroadcastWeek:r,endOfISOWeek:o,endOfMonth:a,endOfWeek:l,getISOWeek:c,getWeek:d,startOfBroadcastWeek:u,startOfISOWeek:h,startOfWeek:f}=s,p=n.reduce((m,g)=>{const b=t.broadcastCalendar?u(g,s):t.ISOWeek?h(g):f(g),S=t.broadcastCalendar?r(g):t.ISOWeek?o(a(g)):l(a(g)),_=e.filter(M=>M>=b&&M<=S),k=t.broadcastCalendar?35:42;if(t.fixedWeeks&&_.length<k){const M=e.filter(C=>{const O=k-_.length;return C>S&&C<=i(S,O)});_.push(...M)}const v=_.reduce((M,C)=>{const O=t.ISOWeek?c(C):d(C),D=M.find(P=>P.weekNumber===O),A=new nf(C,g,s);return D?D.days.push(A):M.push(new Z1(O,[A])),M},[]),w=new Q1(g,v);return m.push(w),m},[]);return t.reverseMonths?p.reverse():p}function rk(n,e){let{startMonth:t,endMonth:s}=n;const{startOfYear:i,startOfDay:r,startOfMonth:o,endOfMonth:a,addYears:l,endOfYear:c,newDate:d,today:u}=e,{fromYear:h,toYear:f,fromMonth:p,toMonth:m}=n;!t&&p&&(t=p),!t&&h&&(t=e.newDate(h,0,1)),!s&&m&&(s=m),!s&&f&&(s=d(f,11,31));const g=n.captionLayout==="dropdown"||n.captionLayout==="dropdown-years";return t?t=o(t):h?t=d(h,0,1):!t&&g&&(t=i(l(n.today??u(),-100))),s?s=a(s):f?s=d(f,11,31):!s&&g&&(s=c(n.today??u())),[t&&r(t),s&&r(s)]}function ok(n,e,t,s){if(t.disableNavigation)return;const{pagedNavigation:i,numberOfMonths:r=1}=t,{startOfMonth:o,addMonths:a,differenceInCalendarMonths:l}=s,c=i?r:1,d=o(n);if(!e)return a(d,c);if(!(l(e,n)<r))return a(d,c)}function ak(n,e,t,s){if(t.disableNavigation)return;const{pagedNavigation:i,numberOfMonths:r}=t,{startOfMonth:o,addMonths:a,differenceInCalendarMonths:l}=s,c=i?r??1:1,d=o(n);if(!e)return a(d,-c);if(!(l(d,e)<=0))return a(d,-c)}function lk(n){const e=[];return n.reduce((t,s)=>t.concat(s.weeks.slice()),e.slice())}function Hr(n,e){const[t,s]=x.useState(n);return[e===void 0?t:e,s]}function ck(n,e){const[t,s]=rk(n,e),{startOfMonth:i,endOfMonth:r}=e,o=tc(n,t,s,e),[a,l]=Hr(o,n.month?o:void 0);x.useEffect(()=>{const k=tc(n,t,s,e);l(k)},[n.timeZone]);const{months:c,weeks:d,days:u,previousMonth:h,nextMonth:f}=x.useMemo(()=>{const k=sk(a,s,{numberOfMonths:n.numberOfMonths},e),v=tk(k,n.endMonth?r(n.endMonth):void 0,{ISOWeek:n.ISOWeek,fixedWeeks:n.fixedWeeks,broadcastCalendar:n.broadcastCalendar},e),w=ik(k,v,{broadcastCalendar:n.broadcastCalendar,fixedWeeks:n.fixedWeeks,ISOWeek:n.ISOWeek,reverseMonths:n.reverseMonths},e),M=lk(w),C=nk(w),O=ak(a,t,n,e),D=ok(a,s,n,e);return{months:w,weeks:M,days:C,previousMonth:O,nextMonth:D}},[e,a.getTime(),s?.getTime(),t?.getTime(),n.disableNavigation,n.broadcastCalendar,n.endMonth?.getTime(),n.fixedWeeks,n.ISOWeek,n.numberOfMonths,n.pagedNavigation,n.reverseMonths]),{disableNavigation:p,onMonthChange:m}=n,g=k=>d.some(v=>v.days.some(w=>w.isEqualTo(k))),b=k=>{if(p)return;let v=i(k);t&&v<i(t)&&(v=i(t)),s&&v>i(s)&&(v=i(s)),l(v),m?.(v)};return{months:c,weeks:d,days:u,navStart:t,navEnd:s,previousMonth:h,nextMonth:f,goToMonth:b,goToDay:k=>{g(k)||b(k.date)}}}var It;(function(n){n[n.Today=0]="Today",n[n.Selected=1]="Selected",n[n.LastFocused=2]="LastFocused",n[n.FocusedModifier=3]="FocusedModifier"})(It||(It={}));function nc(n){return!n[fe.disabled]&&!n[fe.hidden]&&!n[fe.outside]}function dk(n,e,t,s){let i,r=-1;for(const o of n){const a=e(o);nc(a)&&(a[fe.focused]&&r<It.FocusedModifier?(i=o,r=It.FocusedModifier):s?.isEqualTo(o)&&r<It.LastFocused?(i=o,r=It.LastFocused):t(o.date)&&r<It.Selected?(i=o,r=It.Selected):a[fe.today]&&r<It.Today&&(i=o,r=It.Today))}return i||(i=n.find(o=>nc(e(o)))),i}function uk(n,e,t,s,i,r,o){const{ISOWeek:a,broadcastCalendar:l}=r,{addDays:c,addMonths:d,addWeeks:u,addYears:h,endOfBroadcastWeek:f,endOfISOWeek:p,endOfWeek:m,max:g,min:b,startOfBroadcastWeek:S,startOfISOWeek:_,startOfWeek:k}=o;let w={day:c,week:u,month:d,year:h,startOfWeek:M=>l?S(M,o):a?_(M):k(M),endOfWeek:M=>l?f(M):a?p(M):m(M)}[n](t,e==="after"?1:-1);return e==="before"&&s?w=g([s,w]):e==="after"&&i&&(w=b([i,w])),w}function bf(n,e,t,s,i,r,o,a=0){if(a>365)return;const l=uk(n,e,t.date,s,i,r,o),c=!!(r.disabled&&en(l,r.disabled,o)),d=!!(r.hidden&&en(l,r.hidden,o)),u=l,h=new nf(l,u,o);return!c&&!d?h:bf(n,e,h,s,i,r,o,a+1)}function hk(n,e,t,s,i){const{autoFocus:r}=n,[o,a]=x.useState(),l=dk(e.days,t,s||(()=>!1),o),[c,d]=x.useState(r?l:void 0);return{isFocusTarget:m=>!!l?.isEqualTo(m),setFocused:d,focused:c,blur:()=>{a(c),d(void 0)},moveFocus:(m,g)=>{if(!c)return;const b=bf(m,g,c,e.navStart,e.navEnd,n,i);b&&(n.disableNavigation&&!e.days.some(_=>_.isEqualTo(b))||(e.goToDay(b),d(b)))}}}function fk(n,e){const{selected:t,required:s,onSelect:i}=n,[r,o]=Hr(t,i?t:void 0),a=i?t:r,{isSameDay:l}=e,c=f=>a?.some(p=>l(p,f))??!1,{min:d,max:u}=n;return{selected:a,select:(f,p,m)=>{let g=[...a??[]];if(c(f)){if(a?.length===d||s&&a?.length===1)return;g=a?.filter(b=>!l(b,f))}else a?.length===u?g=[f]:g=[...g,f];return i||o(g),i?.(g,f,p,m),g},isSelected:c}}function pk(n,e,t=0,s=0,i=!1,r=$t){const{from:o,to:a}=e||{},{isSameDay:l,isAfter:c,isBefore:d}=r;let u;if(!o&&!a)u={from:n,to:t>0?void 0:n};else if(o&&!a)l(o,n)?t===0?u={from:o,to:n}:i?u={from:o,to:void 0}:u=void 0:d(n,o)?u={from:n,to:o}:u={from:o,to:n};else if(o&&a)if(l(o,n)&&l(a,n))i?u={from:o,to:a}:u=void 0;else if(l(o,n))u={from:o,to:t>0?void 0:n};else if(l(a,n))u={from:n,to:t>0?void 0:n};else if(d(n,o))u={from:n,to:a};else if(c(n,o))u={from:o,to:n};else if(c(n,a))u={from:o,to:n};else throw new Error("Invalid range");if(u?.from&&u?.to){const h=r.differenceInCalendarDays(u.to,u.from);s>0&&h>s?u={from:n,to:void 0}:t>1&&h<t&&(u={from:n,to:void 0})}return u}function mk(n,e,t=$t){const s=Array.isArray(e)?e:[e];let i=n.from;const r=t.differenceInCalendarDays(n.to,n.from),o=Math.min(r,6);for(let a=0;a<=o;a++){if(s.includes(i.getDay()))return!0;i=t.addDays(i,1)}return!1}function sc(n,e,t=$t){return Zt(n,e.from,!1,t)||Zt(n,e.to,!1,t)||Zt(e,n.from,!1,t)||Zt(e,n.to,!1,t)}function gk(n,e,t=$t){const s=Array.isArray(e)?e:[e];if(s.filter(a=>typeof a!="function").some(a=>typeof a=="boolean"?a:t.isDate(a)?Zt(n,a,!1,t):of(a,t)?a.some(l=>Zt(n,l,!1,t)):$r(a)?a.from&&a.to?sc(n,{from:a.from,to:a.to},t):!1:rf(a)?mk(n,a.dayOfWeek,t):Ya(a)?t.isAfter(a.before,a.after)?sc(n,{from:t.addDays(a.after,1),to:t.addDays(a.before,-1)},t):en(n.from,a,t)||en(n.to,a,t):qa(a)||Ka(a)?en(n.from,a,t)||en(n.to,a,t):!1))return!0;const o=s.filter(a=>typeof a=="function");if(o.length){let a=n.from;const l=t.differenceInCalendarDays(n.to,n.from);for(let c=0;c<=l;c++){if(o.some(d=>d(a)))return!0;a=t.addDays(a,1)}}return!1}function yk(n,e){const{disabled:t,excludeDisabled:s,resetOnSelect:i,selected:r,required:o,onSelect:a}=n,[l,c]=Hr(r,a?r:void 0),d=a?r:l;return{selected:d,select:(f,p,m)=>{const{min:g,max:b}=n;let S;if(f){const _=d?.from,k=d?.to,v=!!_&&!!k,w=!!_&&!!k&&e.isSameDay(_,k)&&e.isSameDay(f,_);i&&(v||!d?.from)?!o&&w?S=void 0:S={from:f,to:void 0}:S=pk(f,d,g,b,o,e)}return s&&t&&S?.from&&S.to&&gk({from:S.from,to:S.to},t,e)&&(S.from=f,S.to=void 0),a||c(S),a?.(S,f,p,m),S},isSelected:f=>d&&Zt(d,f,!1,e)}}function bk(n,e){const{selected:t,required:s,onSelect:i}=n,[r,o]=Hr(t,i?t:void 0),a=i?t:r,{isSameDay:l}=e;return{selected:a,select:(u,h,f)=>{let p=u;return!s&&a&&a&&l(u,a)&&(p=void 0),i||o(p),i?.(p,u,h,f),p},isSelected:u=>a?l(a,u):!1}}function xk(n,e){const t=bk(n,e),s=fk(n,e),i=yk(n,e);switch(n.mode){case"single":return t;case"multiple":return s;case"range":return i;default:return}}function ft(n,e){return n instanceof ze&&n.timeZone===e?n:new ze(n,e)}function us(n,e,t){return ft(n,e)}function ic(n,e,t){return typeof n=="boolean"||typeof n=="function"?n:n instanceof Date?us(n,e):Array.isArray(n)?n.map(s=>s instanceof Date?us(s,e):s):$r(n)?{...n,from:n.from?ft(n.from,e):n.from,to:n.to?ft(n.to,e):n.to}:Ya(n)?{before:us(n.before,e),after:us(n.after,e)}:qa(n)?{after:us(n.after,e)}:Ka(n)?{before:us(n.before,e)}:n}function wo(n,e,t){return n&&(Array.isArray(n)?n.map(s=>ic(s,e)):ic(n,e))}function _k(n){let e=n;const t=e.timeZone;if(t&&(e={...n,timeZone:t},e.today&&(e.today=ft(e.today,t)),e.month&&(e.month=ft(e.month,t)),e.defaultMonth&&(e.defaultMonth=ft(e.defaultMonth,t)),e.startMonth&&(e.startMonth=ft(e.startMonth,t)),e.endMonth&&(e.endMonth=ft(e.endMonth,t)),e.mode==="single"&&e.selected?e.selected=ft(e.selected,t):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(Y=>ft(Y,t)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?ft(e.selected.from,t):e.selected.from,to:e.selected.to?ft(e.selected.to,t):e.selected.to}),e.disabled!==void 0&&(e.disabled=wo(e.disabled,t)),e.hidden!==void 0&&(e.hidden=wo(e.hidden,t)),e.modifiers)){const Y={};Object.keys(e.modifiers).forEach(se=>{Y[se]=wo(e.modifiers?.[se],t)}),e.modifiers=Y}const{components:s,formatters:i,labels:r,dateLib:o,locale:a,classNames:l}=x.useMemo(()=>{const Y={...tf,...e.locale},se=e.broadcastCalendar?1:e.weekStartsOn,W=e.noonSafe&&e.timeZone?G_(e.timeZone,{weekStartsOn:se,locale:Y}):void 0,te=e.dateLib&&W?{...W,...e.dateLib}:e.dateLib??W,tt=new dt({locale:Y,weekStartsOn:se,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},te);return{dateLib:tt,components:T_(e.components),formatters:F_(e.formatters),labels:Y_(e.labels,tt.options),locale:Y,classNames:{...E_(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.noonSafe,e.components,e.formatters,e.labels,e.classNames]);e.today||(e={...e,today:o.today()});const{captionLayout:c,mode:d,navLayout:u,numberOfMonths:h=1,onDayBlur:f,onDayClick:p,onDayFocus:m,onDayKeyDown:g,onDayMouseEnter:b,onDayMouseLeave:S,onNextClick:_,onPrevClick:k,showWeekNumber:v,styles:w}=e,{formatCaption:M,formatDay:C,formatMonthDropdown:O,formatWeekNumber:D,formatWeekNumberHeader:A,formatWeekdayName:P,formatYearDropdown:F}=i,j=ck(e,o),{days:H,months:K,navStart:G,navEnd:R,previousMonth:E,nextMonth:V,goToMonth:ee}=j,ke=O_(H,e,G,R,o),{isSelected:et,select:wt,selected:Tt}=xk(e,o)??{},{blur:Nt,focused:Bl,isFocusTarget:lg,moveFocus:jl,setFocused:Fi}=hk(e,j,ke,et??(()=>!1),o),{labelDayButton:cg,labelGridcell:dg,labelGrid:ug,labelMonthDropdown:hg,labelNav:Ll,labelPrevious:fg,labelNext:pg,labelWeekday:mg,labelWeekNumber:gg,labelWeekNumberHeader:yg,labelYearDropdown:bg}=r,xg=x.useMemo(()=>U_(o,e.ISOWeek,e.broadcastCalendar,e.today),[o,e.ISOWeek,e.broadcastCalendar,e.today]),Fl=d!==void 0||p!==void 0,fo=x.useCallback(()=>{E&&(ee(E),k?.(E))},[E,ee,k]),po=x.useCallback(()=>{V&&(ee(V),_?.(V))},[ee,V,_]),_g=x.useCallback((Y,se)=>W=>{W.preventDefault(),W.stopPropagation(),Fi(Y),!se.disabled&&(wt?.(Y.date,se,W),p?.(Y.date,se,W))},[wt,p,Fi]),kg=x.useCallback((Y,se)=>W=>{Fi(Y),m?.(Y.date,se,W)},[m,Fi]),wg=x.useCallback((Y,se)=>W=>{Nt(),f?.(Y.date,se,W)},[Nt,f]),vg=x.useCallback((Y,se)=>W=>{const te={ArrowLeft:[W.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[W.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[W.shiftKey?"year":"week","after"],ArrowUp:[W.shiftKey?"year":"week","before"],PageUp:[W.shiftKey?"year":"month","before"],PageDown:[W.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(te[W.key]){W.preventDefault(),W.stopPropagation();const[tt,Q]=te[W.key];jl(tt,Q)}g?.(Y.date,se,W)},[jl,g,e.dir]),Sg=x.useCallback((Y,se)=>W=>{b?.(Y.date,se,W)},[b]),Mg=x.useCallback((Y,se)=>W=>{S?.(Y.date,se,W)},[S]),Cg=x.useCallback(Y=>se=>{const W=Number(se.target.value),te=o.setMonth(o.startOfMonth(Y),W);ee(te)},[o,ee]),Og=x.useCallback(Y=>se=>{const W=Number(se.target.value),te=o.setYear(o.startOfMonth(Y),W);ee(te)},[o,ee]),{className:Dg,style:Tg}=x.useMemo(()=>({className:[l[B.Root],e.className].filter(Boolean).join(" "),style:{...w?.[B.Root],...e.style}}),[l,e.className,e.style,w]),Ng=N_(e),Wl=x.useRef(null);ek(Wl,!!e.animate,{classNames:l,months:K,focused:Bl,dateLib:o});const Eg={dayPickerProps:e,selected:Tt,select:wt,isSelected:et,months:K,nextMonth:V,previousMonth:E,goToMonth:ee,getModifiers:ke,components:s,classNames:l,styles:w,labels:r,formatters:i};return x.createElement(sf.Provider,{value:Eg},x.createElement(s.Root,{rootRef:e.animate?Wl:void 0,className:Dg,style:Tg,dir:e.dir,id:e.id,lang:e.lang??a.code,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...Ng},x.createElement(s.Months,{className:l[B.Months],style:w?.[B.Months]},!e.hideNavigation&&!u&&x.createElement(s.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[B.Nav],style:w?.[B.Nav],"aria-label":Ll(),onPreviousClick:fo,onNextClick:po,previousMonth:E,nextMonth:V}),K.map((Y,se)=>x.createElement(s.Month,{"data-animated-month":e.animate?"true":void 0,className:l[B.Month],style:w?.[B.Month],key:se,displayIndex:se,calendarMonth:Y},u==="around"&&!e.hideNavigation&&se===0&&x.createElement(s.PreviousMonthButton,{type:"button",className:l[B.PreviousMonthButton],tabIndex:E?void 0:-1,"aria-disabled":E?void 0:!0,"aria-label":fg(E),onClick:fo,"data-animated-button":e.animate?"true":void 0},x.createElement(s.Chevron,{disabled:E?void 0:!0,className:l[B.Chevron],orientation:e.dir==="rtl"?"right":"left"})),x.createElement(s.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:l[B.MonthCaption],style:w?.[B.MonthCaption],calendarMonth:Y,displayIndex:se},c?.startsWith("dropdown")?x.createElement(s.DropdownNav,{className:l[B.Dropdowns],style:w?.[B.Dropdowns]},(()=>{const W=c==="dropdown"||c==="dropdown-months"?x.createElement(s.MonthsDropdown,{key:"month",className:l[B.MonthsDropdown],"aria-label":hg(),classNames:l,components:s,disabled:!!e.disableNavigation,onChange:Cg(Y.date),options:q_(Y.date,G,R,i,o),style:w?.[B.Dropdown],value:o.getMonth(Y.date)}):x.createElement("span",{key:"month"},O(Y.date,o)),te=c==="dropdown"||c==="dropdown-years"?x.createElement(s.YearsDropdown,{key:"year",className:l[B.YearsDropdown],"aria-label":bg(o.options),classNames:l,components:s,disabled:!!e.disableNavigation,onChange:Og(Y.date),options:J_(G,R,i,o,!!e.reverseYears),style:w?.[B.Dropdown],value:o.getYear(Y.date)}):x.createElement("span",{key:"year"},F(Y.date,o));return o.getMonthYearOrder()==="year-first"?[te,W]:[W,te]})(),x.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},M(Y.date,o.options,o))):x.createElement(s.CaptionLabel,{className:l[B.CaptionLabel],role:"status","aria-live":"polite"},M(Y.date,o.options,o))),u==="around"&&!e.hideNavigation&&se===h-1&&x.createElement(s.NextMonthButton,{type:"button",className:l[B.NextMonthButton],tabIndex:V?void 0:-1,"aria-disabled":V?void 0:!0,"aria-label":pg(V),onClick:po,"data-animated-button":e.animate?"true":void 0},x.createElement(s.Chevron,{disabled:V?void 0:!0,className:l[B.Chevron],orientation:e.dir==="rtl"?"left":"right"})),se===h-1&&u==="after"&&!e.hideNavigation&&x.createElement(s.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[B.Nav],style:w?.[B.Nav],"aria-label":Ll(),onPreviousClick:fo,onNextClick:po,previousMonth:E,nextMonth:V}),x.createElement(s.MonthGrid,{role:"grid","aria-multiselectable":d==="multiple"||d==="range","aria-label":ug(Y.date,o.options,o)||void 0,className:l[B.MonthGrid],style:w?.[B.MonthGrid]},!e.hideWeekdays&&x.createElement(s.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:l[B.Weekdays],style:w?.[B.Weekdays]},v&&x.createElement(s.WeekNumberHeader,{"aria-label":yg(o.options),className:l[B.WeekNumberHeader],style:w?.[B.WeekNumberHeader],scope:"col"},A()),xg.map(W=>x.createElement(s.Weekday,{"aria-label":mg(W,o.options,o),className:l[B.Weekday],key:String(W),style:w?.[B.Weekday],scope:"col"},P(W,o.options,o)))),x.createElement(s.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:l[B.Weeks],style:w?.[B.Weeks]},Y.weeks.map(W=>x.createElement(s.Week,{className:l[B.Week],key:W.weekNumber,style:w?.[B.Week],week:W},v&&x.createElement(s.WeekNumber,{week:W,style:w?.[B.WeekNumber],"aria-label":gg(W.weekNumber,{locale:a}),className:l[B.WeekNumber],scope:"row",role:"rowheader"},D(W.weekNumber,o)),W.days.map(te=>{const{date:tt}=te,Q=ke(te);if(Q[fe.focused]=!Q.hidden&&!!Bl?.isEqualTo(te),Q[Ot.selected]=et?.(tt)||Q.selected,$r(Tt)){const{from:mo,to:go}=Tt;Q[Ot.range_start]=!!(mo&&go&&o.isSameDay(tt,mo)),Q[Ot.range_end]=!!(mo&&go&&o.isSameDay(tt,go)),Q[Ot.range_middle]=Zt(Tt,tt,!0,o)}const Ag=K_(Q,w,e.modifiersStyles),Pg=D_(Q,l,e.modifiersClassNames),Ig=!Fl&&!Q.hidden?dg(tt,Q,o.options,o):void 0;return x.createElement(s.Day,{key:`${te.isoDate}_${te.displayMonthId}`,day:te,modifiers:Q,className:Pg.join(" "),style:Ag,role:"gridcell","aria-selected":Q.selected||void 0,"aria-label":Ig,"data-day":te.isoDate,"data-month":te.outside?te.dateMonthId:void 0,"data-selected":Q.selected||void 0,"data-disabled":Q.disabled||void 0,"data-hidden":Q.hidden||void 0,"data-outside":te.outside||void 0,"data-focused":Q.focused||void 0,"data-today":Q.today||void 0},!Q.hidden&&Fl?x.createElement(s.DayButton,{className:l[B.DayButton],style:w?.[B.DayButton],type:"button",day:te,modifiers:Q,disabled:!Q.focused&&Q.disabled||void 0,"aria-disabled":Q.focused&&Q.disabled||void 0,tabIndex:lg(te)?0:-1,"aria-label":cg(tt,Q,o.options,o),onClick:_g(te,Q),onBlur:wg(te,Q),onFocus:kg(te,Q),onKeyDown:vg(te,Q),onMouseEnter:Sg(te,Q),onMouseLeave:Mg(te,Q)},C(tt,o.options,o)):!Q.hidden&&C(te.date,o.options,o))})))))))),e.footer&&x.createElement(s.Footer,{className:l[B.Footer],style:w?.[B.Footer],role:"status","aria-live":"polite"},e.footer)))}function Dt(n){const e=Object.prototype.toString.call(n);return n instanceof Date||typeof n=="object"&&e==="[object Date]"?new n.constructor(+n):typeof n=="number"||e==="[object Number]"||typeof n=="string"||e==="[object String]"?new Date(n):new Date(NaN)}function es(n,e){return n instanceof Date?new n.constructor(e):new Date(e)}const xf=6048e5,kk=864e5;let wk={};function Vr(){return wk}function yi(n,e){const t=Vr(),s=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,i=Dt(n),r=i.getDay(),o=(r<s?7:0)+r-s;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function yr(n){return yi(n,{weekStartsOn:1})}function _f(n){const e=Dt(n),t=e.getFullYear(),s=es(n,0);s.setFullYear(t+1,0,4),s.setHours(0,0,0,0);const i=yr(s),r=es(n,0);r.setFullYear(t,0,4),r.setHours(0,0,0,0);const o=yr(r);return e.getTime()>=i.getTime()?t+1:e.getTime()>=o.getTime()?t:t-1}function rc(n){const e=Dt(n);return e.setHours(0,0,0,0),e}function oc(n){const e=Dt(n),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+n-+t}function vk(n,e){const t=rc(n),s=rc(e),i=+t-oc(t),r=+s-oc(s);return Math.round((i-r)/kk)}function Sk(n){const e=_f(n),t=es(n,0);return t.setFullYear(e,0,4),t.setHours(0,0,0,0),yr(t)}function Mk(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function kf(n){if(!Mk(n)&&typeof n!="number")return!1;const e=Dt(n);return!isNaN(Number(e))}function Ck(n){const e=Dt(n),t=es(n,0);return t.setFullYear(e.getFullYear(),0,1),t.setHours(0,0,0,0),t}const Ok={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Dk=(n,e,t)=>{let s;const i=Ok[n];return typeof i=="string"?s=i:e===1?s=i.one:s=i.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+s:s+" ago":s};function vo(n){return(e={})=>{const t=e.width?String(e.width):n.defaultWidth;return n.formats[t]||n.formats[n.defaultWidth]}}const Tk={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Nk={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ek={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Ak={date:vo({formats:Tk,defaultWidth:"full"}),time:vo({formats:Nk,defaultWidth:"full"}),dateTime:vo({formats:Ek,defaultWidth:"full"})},Pk={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ik=(n,e,t,s)=>Pk[n];function Vs(n){return(e,t)=>{const s=t?.context?String(t.context):"standalone";let i;if(s==="formatting"&&n.formattingValues){const o=n.defaultFormattingWidth||n.defaultWidth,a=t?.width?String(t.width):o;i=n.formattingValues[a]||n.formattingValues[o]}else{const o=n.defaultWidth,a=t?.width?String(t.width):n.defaultWidth;i=n.values[a]||n.values[o]}const r=n.argumentCallback?n.argumentCallback(e):e;return i[r]}}const Rk={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},zk={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Bk={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},jk={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Lk={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Fk={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Wk=(n,e)=>{const t=Number(n),s=t%100;if(s>20||s<10)switch(s%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},$k={ordinalNumber:Wk,era:Vs({values:Rk,defaultWidth:"wide"}),quarter:Vs({values:zk,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Vs({values:Bk,defaultWidth:"wide"}),day:Vs({values:jk,defaultWidth:"wide"}),dayPeriod:Vs({values:Lk,defaultWidth:"wide",formattingValues:Fk,defaultFormattingWidth:"wide"})};function Ys(n){return(e,t={})=>{const s=t.width,i=s&&n.matchPatterns[s]||n.matchPatterns[n.defaultMatchWidth],r=e.match(i);if(!r)return null;const o=r[0],a=s&&n.parsePatterns[s]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(a)?Vk(a,u=>u.test(o)):Hk(a,u=>u.test(o));let c;c=n.valueCallback?n.valueCallback(l):l,c=t.valueCallback?t.valueCallback(c):c;const d=e.slice(o.length);return{value:c,rest:d}}}function Hk(n,e){for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&e(n[t]))return t}function Vk(n,e){for(let t=0;t<n.length;t++)if(e(n[t]))return t}function Yk(n){return(e,t={})=>{const s=e.match(n.matchPattern);if(!s)return null;const i=s[0],r=e.match(n.parsePattern);if(!r)return null;let o=n.valueCallback?n.valueCallback(r[0]):r[0];o=t.valueCallback?t.valueCallback(o):o;const a=e.slice(i.length);return{value:o,rest:a}}}const qk=/^(\d+)(th|st|nd|rd)?/i,Kk=/\d+/i,Uk={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Jk={any:[/^b/i,/^(a|c)/i]},Gk={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Xk={any:[/1/i,/2/i,/3/i,/4/i]},Qk={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Zk={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},ew={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},tw={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},nw={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},sw={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},iw={ordinalNumber:Yk({matchPattern:qk,parsePattern:Kk,valueCallback:n=>parseInt(n,10)}),era:Ys({matchPatterns:Uk,defaultMatchWidth:"wide",parsePatterns:Jk,defaultParseWidth:"any"}),quarter:Ys({matchPatterns:Gk,defaultMatchWidth:"wide",parsePatterns:Xk,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Ys({matchPatterns:Qk,defaultMatchWidth:"wide",parsePatterns:Zk,defaultParseWidth:"any"}),day:Ys({matchPatterns:ew,defaultMatchWidth:"wide",parsePatterns:tw,defaultParseWidth:"any"}),dayPeriod:Ys({matchPatterns:nw,defaultMatchWidth:"any",parsePatterns:sw,defaultParseWidth:"any"})},rw={code:"en-US",formatDistance:Dk,formatLong:Ak,formatRelative:Ik,localize:$k,match:iw,options:{weekStartsOn:0,firstWeekContainsDate:1}};function ow(n){const e=Dt(n);return vk(e,Ck(e))+1}function aw(n){const e=Dt(n),t=+yr(e)-+Sk(e);return Math.round(t/xf)+1}function wf(n,e){const t=Dt(n),s=t.getFullYear(),i=Vr(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=es(n,0);o.setFullYear(s+1,0,r),o.setHours(0,0,0,0);const a=yi(o,e),l=es(n,0);l.setFullYear(s,0,r),l.setHours(0,0,0,0);const c=yi(l,e);return t.getTime()>=a.getTime()?s+1:t.getTime()>=c.getTime()?s:s-1}function lw(n,e){const t=Vr(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,i=wf(n,e),r=es(n,0);return r.setFullYear(i,0,s),r.setHours(0,0,0,0),yi(r,e)}function cw(n,e){const t=Dt(n),s=+yi(t,e)-+lw(t,e);return Math.round(s/xf)+1}function re(n,e){const t=n<0?"-":"",s=Math.abs(n).toString().padStart(e,"0");return t+s}const ln={y(n,e){const t=n.getFullYear(),s=t>0?t:1-t;return re(e==="yy"?s%100:s,e.length)},M(n,e){const t=n.getMonth();return e==="M"?String(t+1):re(t+1,2)},d(n,e){return re(n.getDate(),e.length)},a(n,e){const t=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];default:return t==="am"?"a.m.":"p.m."}},h(n,e){return re(n.getHours()%12||12,e.length)},H(n,e){return re(n.getHours(),e.length)},m(n,e){return re(n.getMinutes(),e.length)},s(n,e){return re(n.getSeconds(),e.length)},S(n,e){const t=e.length,s=n.getMilliseconds(),i=Math.trunc(s*Math.pow(10,t-3));return re(i,e.length)}},hs={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ac={G:function(n,e,t){const s=n.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(s,{width:"abbreviated"});case"GGGGG":return t.era(s,{width:"narrow"});default:return t.era(s,{width:"wide"})}},y:function(n,e,t){if(e==="yo"){const s=n.getFullYear(),i=s>0?s:1-s;return t.ordinalNumber(i,{unit:"year"})}return ln.y(n,e)},Y:function(n,e,t,s){const i=wf(n,s),r=i>0?i:1-i;if(e==="YY"){const o=r%100;return re(o,2)}return e==="Yo"?t.ordinalNumber(r,{unit:"year"}):re(r,e.length)},R:function(n,e){const t=_f(n);return re(t,e.length)},u:function(n,e){const t=n.getFullYear();return re(t,e.length)},Q:function(n,e,t){const s=Math.ceil((n.getMonth()+1)/3);switch(e){case"Q":return String(s);case"QQ":return re(s,2);case"Qo":return t.ordinalNumber(s,{unit:"quarter"});case"QQQ":return t.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(s,{width:"narrow",context:"formatting"});default:return t.quarter(s,{width:"wide",context:"formatting"})}},q:function(n,e,t){const s=Math.ceil((n.getMonth()+1)/3);switch(e){case"q":return String(s);case"qq":return re(s,2);case"qo":return t.ordinalNumber(s,{unit:"quarter"});case"qqq":return t.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(s,{width:"narrow",context:"standalone"});default:return t.quarter(s,{width:"wide",context:"standalone"})}},M:function(n,e,t){const s=n.getMonth();switch(e){case"M":case"MM":return ln.M(n,e);case"Mo":return t.ordinalNumber(s+1,{unit:"month"});case"MMM":return t.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(s,{width:"narrow",context:"formatting"});default:return t.month(s,{width:"wide",context:"formatting"})}},L:function(n,e,t){const s=n.getMonth();switch(e){case"L":return String(s+1);case"LL":return re(s+1,2);case"Lo":return t.ordinalNumber(s+1,{unit:"month"});case"LLL":return t.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(s,{width:"narrow",context:"standalone"});default:return t.month(s,{width:"wide",context:"standalone"})}},w:function(n,e,t,s){const i=cw(n,s);return e==="wo"?t.ordinalNumber(i,{unit:"week"}):re(i,e.length)},I:function(n,e,t){const s=aw(n);return e==="Io"?t.ordinalNumber(s,{unit:"week"}):re(s,e.length)},d:function(n,e,t){return e==="do"?t.ordinalNumber(n.getDate(),{unit:"date"}):ln.d(n,e)},D:function(n,e,t){const s=ow(n);return e==="Do"?t.ordinalNumber(s,{unit:"dayOfYear"}):re(s,e.length)},E:function(n,e,t){const s=n.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(s,{width:"short",context:"formatting"});default:return t.day(s,{width:"wide",context:"formatting"})}},e:function(n,e,t,s){const i=n.getDay(),r=(i-s.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return re(r,2);case"eo":return t.ordinalNumber(r,{unit:"day"});case"eee":return t.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(i,{width:"short",context:"formatting"});default:return t.day(i,{width:"wide",context:"formatting"})}},c:function(n,e,t,s){const i=n.getDay(),r=(i-s.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return re(r,e.length);case"co":return t.ordinalNumber(r,{unit:"day"});case"ccc":return t.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(i,{width:"narrow",context:"standalone"});case"cccccc":return t.day(i,{width:"short",context:"standalone"});default:return t.day(i,{width:"wide",context:"standalone"})}},i:function(n,e,t){const s=n.getDay(),i=s===0?7:s;switch(e){case"i":return String(i);case"ii":return re(i,e.length);case"io":return t.ordinalNumber(i,{unit:"day"});case"iii":return t.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(s,{width:"short",context:"formatting"});default:return t.day(s,{width:"wide",context:"formatting"})}},a:function(n,e,t){const i=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(i,{width:"narrow",context:"formatting"});default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(n,e,t){const s=n.getHours();let i;switch(s===12?i=hs.noon:s===0?i=hs.midnight:i=s/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(i,{width:"narrow",context:"formatting"});default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(n,e,t){const s=n.getHours();let i;switch(s>=17?i=hs.evening:s>=12?i=hs.afternoon:s>=4?i=hs.morning:i=hs.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(i,{width:"narrow",context:"formatting"});default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(n,e,t){if(e==="ho"){let s=n.getHours()%12;return s===0&&(s=12),t.ordinalNumber(s,{unit:"hour"})}return ln.h(n,e)},H:function(n,e,t){return e==="Ho"?t.ordinalNumber(n.getHours(),{unit:"hour"}):ln.H(n,e)},K:function(n,e,t){const s=n.getHours()%12;return e==="Ko"?t.ordinalNumber(s,{unit:"hour"}):re(s,e.length)},k:function(n,e,t){let s=n.getHours();return s===0&&(s=24),e==="ko"?t.ordinalNumber(s,{unit:"hour"}):re(s,e.length)},m:function(n,e,t){return e==="mo"?t.ordinalNumber(n.getMinutes(),{unit:"minute"}):ln.m(n,e)},s:function(n,e,t){return e==="so"?t.ordinalNumber(n.getSeconds(),{unit:"second"}):ln.s(n,e)},S:function(n,e){return ln.S(n,e)},X:function(n,e,t){const s=n.getTimezoneOffset();if(s===0)return"Z";switch(e){case"X":return cc(s);case"XXXX":case"XX":return jn(s);default:return jn(s,":")}},x:function(n,e,t){const s=n.getTimezoneOffset();switch(e){case"x":return cc(s);case"xxxx":case"xx":return jn(s);default:return jn(s,":")}},O:function(n,e,t){const s=n.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+lc(s,":");default:return"GMT"+jn(s,":")}},z:function(n,e,t){const s=n.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+lc(s,":");default:return"GMT"+jn(s,":")}},t:function(n,e,t){const s=Math.trunc(n.getTime()/1e3);return re(s,e.length)},T:function(n,e,t){const s=n.getTime();return re(s,e.length)}};function lc(n,e=""){const t=n>0?"-":"+",s=Math.abs(n),i=Math.trunc(s/60),r=s%60;return r===0?t+String(i):t+String(i)+e+re(r,2)}function cc(n,e){return n%60===0?(n>0?"-":"+")+re(Math.abs(n)/60,2):jn(n,e)}function jn(n,e=""){const t=n>0?"-":"+",s=Math.abs(n),i=re(Math.trunc(s/60),2),r=re(s%60,2);return t+i+e+r}const dc=(n,e)=>{switch(n){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},vf=(n,e)=>{switch(n){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},dw=(n,e)=>{const t=n.match(/(P+)(p+)?/)||[],s=t[1],i=t[2];if(!i)return dc(n,e);let r;switch(s){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",dc(s,e)).replace("{{time}}",vf(i,e))},uw={p:vf,P:dw},hw=/^D+$/,fw=/^Y+$/,pw=["D","DD","YY","YYYY"];function mw(n){return hw.test(n)}function gw(n){return fw.test(n)}function yw(n,e,t){const s=bw(n,e,t);if(console.warn(s),pw.includes(n))throw new RangeError(s)}function bw(n,e,t){const s=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${e}\`) for formatting ${s} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const xw=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,_w=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,kw=/^'([^]*?)'?$/,ww=/''/g,vw=/[a-zA-Z]/;function Sw(n,e,t){const s=Vr(),i=s.locale??rw,r=s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,o=s.weekStartsOn??s.locale?.options?.weekStartsOn??0,a=Dt(n);if(!kf(a))throw new RangeError("Invalid time value");let l=e.match(_w).map(d=>{const u=d[0];if(u==="p"||u==="P"){const h=uw[u];return h(d,i.formatLong)}return d}).join("").match(xw).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const u=d[0];if(u==="'")return{isToken:!1,value:Mw(d)};if(ac[u])return{isToken:!0,value:d};if(u.match(vw))throw new RangeError("Format string contains an unescaped latin alphabet character `"+u+"`");return{isToken:!1,value:d}});i.localize.preprocessor&&(l=i.localize.preprocessor(a,l));const c={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return l.map(d=>{if(!d.isToken)return d.value;const u=d.value;(gw(u)||mw(u))&&yw(u,e,String(n));const h=ac[u[0]];return h(a,u,i.localize,c)}).join("")}function Mw(n){const e=n.match(kw);return e?e[1].replace(ww,"'"):n}const Cw="_wrapper_1cmyh_1",Ow="_label_1cmyh_9",Dw="_datepicker_1cmyh_16",Tw="_trigger_1cmyh_20",Nw="_open_1cmyh_43",Ew="_error_1cmyh_50",Aw="_disabled_1cmyh_54",Pw="_icon_1cmyh_59",Iw="_placeholder_1cmyh_64",Rw="_popover_1cmyh_68",ne={wrapper:Cw,label:Ow,datepicker:Dw,trigger:Tw,"size-sm":"_size-sm_1cmyh_35","size-md":"_size-md_1cmyh_36","size-lg":"_size-lg_1cmyh_37",open:Nw,error:Ew,disabled:Aw,icon:Pw,placeholder:Iw,popover:Rw,"error-text":"_error-text_1cmyh_80","rdp-root":"_rdp-root_1cmyh_88","rdp-months":"_rdp-months_1cmyh_94","rdp-month":"_rdp-month_1cmyh_94","rdp-caption":"_rdp-caption_1cmyh_104","rdp-caption-label":"_rdp-caption-label_1cmyh_111","rdp-nav":"_rdp-nav_1cmyh_117","rdp-nav-button":"_rdp-nav-button_1cmyh_122","rdp-table":"_rdp-table_1cmyh_140","rdp-head-row":"_rdp-head-row_1cmyh_145","rdp-row":"_rdp-row_1cmyh_146","rdp-head-cell":"_rdp-head-cell_1cmyh_151","rdp-cell":"_rdp-cell_1cmyh_163","rdp-day":"_rdp-day_1cmyh_169","rdp-day-disabled":"_rdp-day-disabled_1cmyh_184","rdp-day-selected":"_rdp-day-selected_1cmyh_184","rdp-day-today":"_rdp-day-today_1cmyh_194","rdp-day-outside":"_rdp-day-outside_1cmyh_204"},Sf=x.forwardRef(({value:n,defaultValue:e=null,placeholder:t="Pick a date",size:s="md",disabled:i=!1,label:r,error:o,dateFormat:a="MMM d, yyyy",minDate:l,maxDate:c,onChange:d,className:u,id:h},f)=>{const p=x.useId(),m=h??p,g=n!==void 0,[b,S]=x.useState(e),_=g?n??null:b,[k,v]=x.useState(!1),w=x.useRef(null),M=x.useCallback(O=>{const D=O??null;g||S(D),d?.(D),v(!1)},[g,d]);x.useEffect(()=>{const O=D=>{w.current&&!w.current.contains(D.target)&&v(!1)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);const C=_&&kf(_)?Sw(_,a):"";return y.jsxs("div",{ref:f,className:N(ne.wrapper,ne[`size-${s}`],u),children:[r&&y.jsx("label",{htmlFor:m,className:ne.label,children:r}),y.jsxs("div",{ref:w,className:N(ne.datepicker,k&&ne.open,o&&ne.error,i&&ne.disabled),children:[y.jsxs("button",{type:"button",id:m,className:ne.trigger,onClick:()=>!i&&v(O=>!O),disabled:i,"aria-haspopup":"dialog","aria-expanded":k,"aria-label":r??"Select date",children:[y.jsxs("svg",{className:ne.icon,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[y.jsx("rect",{x:"1",y:"3",width:"14",height:"12",rx:"2",stroke:"currentColor",strokeWidth:"1.2"}),y.jsx("path",{d:"M1 7h14",stroke:"currentColor",strokeWidth:"1.2"}),y.jsx("path",{d:"M5 1v4M11 1v4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),y.jsx("span",{className:N(!C&&ne.placeholder),children:C||t})]}),k&&y.jsx("div",{className:ne.popover,role:"dialog","aria-modal":"true","aria-label":"Date picker calendar",children:y.jsx(_k,{mode:"single",selected:_??void 0,onSelect:M,disabled:[...l?[{before:l}]:[],...c?[{after:c}]:[]],classNames:{root:ne["rdp-root"],months:ne["rdp-months"],month:ne["rdp-month"],caption:ne["rdp-caption"],caption_label:ne["rdp-caption-label"],nav:ne["rdp-nav"],nav_button:ne["rdp-nav-button"],nav_button_previous:ne["rdp-nav-prev"],nav_button_next:ne["rdp-nav-next"],table:ne["rdp-table"],head_row:ne["rdp-head-row"],head_cell:ne["rdp-head-cell"],row:ne["rdp-row"],cell:ne["rdp-cell"],day:ne["rdp-day"],day_selected:ne["rdp-day-selected"],day_today:ne["rdp-day-today"],day_disabled:ne["rdp-day-disabled"],day_outside:ne["rdp-day-outside"]}})})]}),o&&y.jsx("p",{className:ne["error-text"],role:"alert",children:o})]})});Sf.displayName="DatePicker";function Te(n){this.content=n}Te.prototype={constructor:Te,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var s=t&&t!=n?this.remove(t):this,i=s.find(n),r=s.content.slice();return i==-1?r.push(t||n,e):(r[i+1]=e,t&&(r[i]=t)),new Te(r)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Te(t)},addToStart:function(n,e){return new Te([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Te(t)},addBefore:function(n,e,t){var s=this.remove(e),i=s.content.slice(),r=s.find(n);return i.splice(r==-1?i.length:r,0,e,t),new Te(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Te.from(n),n.size?new Te(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Te.from(n),n.size?new Te(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Te.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Te.from=function(n){if(n instanceof Te)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Te(e)};function Mf(n,e,t){for(let s=0;;s++){if(s==n.childCount||s==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(s),r=e.child(s);if(i==r){t+=i.nodeSize;continue}if(!i.sameMarkup(r))return t;if(i.isText&&i.text!=r.text){for(let o=0;i.text[o]==r.text[o];o++)t++;return t}if(i.content.size||r.content.size){let o=Mf(i.content,r.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Cf(n,e,t,s){for(let i=n.childCount,r=e.childCount;;){if(i==0||r==0)return i==r?null:{a:t,b:s};let o=n.child(--i),a=e.child(--r),l=o.nodeSize;if(o==a){t-=l,s-=l;continue}if(!o.sameMarkup(a))return{a:t,b:s};if(o.isText&&o.text!=a.text){let c=0,d=Math.min(o.text.length,a.text.length);for(;c<d&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,t--,s--;return{a:t,b:s}}if(o.content.size||a.content.size){let c=Cf(o.content,a.content,t-1,s-1);if(c)return c}t-=l,s-=l}}class T{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let s=0;s<e.length;s++)this.size+=e[s].nodeSize}nodesBetween(e,t,s,i=0,r){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&s(l,i+a,r||null,o)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,t-d),s,i+d)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,s,i){let r="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&s&&(o?o=!1:r+=s),r+=c},0),r}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,s=e.firstChild,i=this.content.slice(),r=0;for(t.isText&&t.sameMarkup(s)&&(i[i.length-1]=t.withText(t.text+s.text),r=1);r<e.content.length;r++)i.push(e.content[r]);return new T(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let s=[],i=0;if(t>e)for(let r=0,o=0;o<t;r++){let a=this.content[r],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),s.push(a),i+=a.nodeSize),o=l}return new T(s,i)}cutByIndex(e,t){return e==t?T.empty:e==0&&t==this.content.length?this:new T(this.content.slice(e,t))}replaceChild(e,t){let s=this.content[e];if(s==t)return this;let i=this.content.slice(),r=this.size+t.nodeSize-s.nodeSize;return i[e]=t,new T(i,r)}addToStart(e){return new T([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new T(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,s=0;t<this.content.length;t++){let i=this.content[t];e(i,s,t),s+=i.nodeSize}}findDiffStart(e,t=0){return Mf(this,e,t)}findDiffEnd(e,t=this.size,s=e.size){return Cf(this,e,t,s)}findIndex(e){if(e==0)return Vi(0,e);if(e==this.size)return Vi(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,s=0;;t++){let i=this.child(t),r=s+i.nodeSize;if(r>=e)return r==e?Vi(t+1,r):Vi(t,s);s=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return T.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new T(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return T.empty;let t,s=0;for(let i=0;i<e.length;i++){let r=e[i];s+=r.nodeSize,i&&r.isText&&e[i-1].sameMarkup(r)?(t||(t=e.slice(0,i)),t[t.length-1]=r.withText(t[t.length-1].text+r.text)):t&&t.push(r)}return new T(t||e,s)}static from(e){if(!e)return T.empty;if(e instanceof T)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new T([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}T.empty=new T([],0);const So={index:0,offset:0};function Vi(n,e){return So.index=n,So.offset=e,So}function br(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let s=0;s<n.length;s++)if(!br(n[s],e[s]))return!1}else{for(let s in n)if(!(s in e)||!br(n[s],e[s]))return!1;for(let s in e)if(!(s in n))return!1}return!0}let ce=class la{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,s=!1;for(let i=0;i<e.length;i++){let r=e[i];if(this.eq(r))return e;if(this.type.excludes(r.type))t||(t=e.slice(0,i));else{if(r.type.excludes(this.type))return e;!s&&r.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),s=!0),t&&t.push(r)}}return t||(t=e.slice()),s||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&br(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let s=e.marks[t.type];if(!s)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=s.create(t.attrs);return s.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let s=0;s<e.length;s++)if(!e[s].eq(t[s]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return la.none;if(e instanceof la)return[e];let t=e.slice();return t.sort((s,i)=>s.type.rank-i.type.rank),t}};ce.none=[];class xr extends Error{}class I{constructor(e,t,s){this.content=e,this.openStart=t,this.openEnd=s}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let s=Df(this.content,e+this.openStart,t);return s&&new I(s,this.openStart,this.openEnd)}removeBetween(e,t){return new I(Of(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return I.empty;let s=t.openStart||0,i=t.openEnd||0;if(typeof s!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new I(T.fromJSON(e,t.content),s,i)}static maxOpen(e,t=!0){let s=0,i=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)s++;for(let r=e.lastChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.lastChild)i++;return new I(e,s,i)}}I.empty=new I(T.empty,0,0);function Of(n,e,t){let{index:s,offset:i}=n.findIndex(e),r=n.maybeChild(s),{index:o,offset:a}=n.findIndex(t);if(i==e||r.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(s!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(s,r.copy(Of(r.content,e-i-1,t-i-1)))}function Df(n,e,t,s){let{index:i,offset:r}=n.findIndex(e),o=n.maybeChild(i);if(r==e||o.isText)return s&&!s.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=Df(o.content,e-r-1,t,o);return a&&n.replaceChild(i,o.copy(a))}function zw(n,e,t){if(t.openStart>n.depth)throw new xr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new xr("Inconsistent open depths");return Tf(n,e,t,0)}function Tf(n,e,t,s){let i=n.index(s),r=n.node(s);if(i==e.index(s)&&s<n.depth-t.openStart){let o=Tf(n,e,t,s+1);return r.copy(r.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==s&&e.depth==s){let o=n.parent,a=o.content;return Jn(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Bw(t,n);return Jn(r,Ef(n,o,a,e,s))}else return Jn(r,_r(n,e,s))}function Nf(n,e){if(!e.type.compatibleContent(n.type))throw new xr("Cannot join "+e.type.name+" onto "+n.type.name)}function ca(n,e,t){let s=n.node(t);return Nf(s,e.node(t)),s}function Un(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function ai(n,e,t,s){let i=(e||n).node(t),r=0,o=e?e.index(t):i.childCount;n&&(r=n.index(t),n.depth>t?r++:n.textOffset&&(Un(n.nodeAfter,s),r++));for(let a=r;a<o;a++)Un(i.child(a),s);e&&e.depth==t&&e.textOffset&&Un(e.nodeBefore,s)}function Jn(n,e){return n.type.checkContent(e),n.copy(e)}function Ef(n,e,t,s,i){let r=n.depth>i&&ca(n,e,i+1),o=s.depth>i&&ca(t,s,i+1),a=[];return ai(null,n,i,a),r&&o&&e.index(i)==t.index(i)?(Nf(r,o),Un(Jn(r,Ef(n,e,t,s,i+1)),a)):(r&&Un(Jn(r,_r(n,e,i+1)),a),ai(e,t,i,a),o&&Un(Jn(o,_r(t,s,i+1)),a)),ai(s,null,i,a),new T(a)}function _r(n,e,t){let s=[];if(ai(null,n,t,s),n.depth>t){let i=ca(n,e,t+1);Un(Jn(i,_r(n,e,t+1)),s)}return ai(e,null,t,s),new T(s)}function Bw(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let r=t-1;r>=0;r--)i=e.node(r).copy(T.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class bi{constructor(e,t,s){this.pos=e,this.path=t,this.parentOffset=s,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let s=this.pos-this.path[this.path.length-1],i=e.child(t);return s?e.child(t).cut(s):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let s=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let r=0;r<e;r++)i+=s.child(r).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ce.none;if(this.textOffset)return e.child(t).marks;let s=e.maybeChild(t-1),i=e.maybeChild(t);if(!s){let a=s;s=i,i=a}let r=s.marks;for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let s=t.marks,i=e.parent.maybeChild(e.index());for(var r=0;r<s.length;r++)s[r].type.spec.inclusive===!1&&(!i||!s[r].isInSet(i.marks))&&(s=s[r--].removeFromSet(s));return s}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let s=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);s>=0;s--)if(e.pos<=this.end(s)&&(!t||t(this.node(s))))return new kr(this,e,s);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let s=[],i=0,r=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(r),c=r-l;if(s.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;r=c-1,i+=l+1}return new bi(t,s,r)}static resolveCached(e,t){let s=uc.get(e);if(s)for(let r=0;r<s.elts.length;r++){let o=s.elts[r];if(o.pos==t)return o}else uc.set(e,s=new jw);let i=s.elts[s.i]=bi.resolve(e,t);return s.i=(s.i+1)%Lw,i}}class jw{constructor(){this.elts=[],this.i=0}}const Lw=12,uc=new WeakMap;class kr{constructor(e,t,s){this.$from=e,this.$to=t,this.depth=s}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Fw=Object.create(null);let _n=class da{constructor(e,t,s,i=ce.none){this.type=e,this.attrs=t,this.marks=i,this.content=s||T.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,s,i=0){this.content.nodesBetween(e,t,s,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,s,i){return this.content.textBetween(e,t,s,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,s){return this.type==e&&br(this.attrs,t||e.defaultAttrs||Fw)&&ce.sameSet(this.marks,s||ce.none)}copy(e=null){return e==this.content?this:new da(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new da(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,s=!1){if(e==t)return I.empty;let i=this.resolve(e),r=this.resolve(t),o=s?0:i.sharedDepth(t),a=i.start(o),c=i.node(o).content.cut(i.pos-a,r.pos-a);return new I(c,i.depth-o,r.depth-o)}replace(e,t,s){return zw(this.resolve(e),this.resolve(t),s)}nodeAt(e){for(let t=this;;){let{index:s,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(s),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:s}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:s}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:s}=this.content.findIndex(e);if(s<e)return{node:this.content.child(t),index:t,offset:s};let i=this.content.child(t-1);return{node:i,index:t-1,offset:s-i.nodeSize}}resolve(e){return bi.resolveCached(this,e)}resolveNoCache(e){return bi.resolve(this,e)}rangeHasMark(e,t,s){let i=!1;return t>e&&this.nodesBetween(e,t,r=>(s.isInSet(r.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Af(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,s=T.empty,i=0,r=s.childCount){let o=this.contentMatchAt(e).matchFragment(s,i,r),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<r;l++)if(!this.type.allowsMarks(s.child(l).marks))return!1;return!0}canReplaceWith(e,t,s,i){if(i&&!this.type.allowsMarks(i))return!1;let r=this.contentMatchAt(e).matchType(s),o=r&&r.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ce.none;for(let t=0;t<this.marks.length;t++){let s=this.marks[t];s.type.checkAttrs(s.attrs),e=s.addToSet(e)}if(!ce.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let s;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");s=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,s)}let i=T.fromJSON(e,t.content),r=e.nodeType(t.type).create(t.attrs,i,s);return r.type.checkAttrs(r.attrs),r}};_n.prototype.text=void 0;class wr extends _n{constructor(e,t,s,i){if(super(e,t,null,i),!s)throw new RangeError("Empty text nodes are not allowed");this.text=s}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Af(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new wr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new wr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Af(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class ts{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let s=new Ww(e,t);if(s.next==null)return ts.empty;let i=Pf(s);s.next&&s.err("Unexpected trailing text");let r=Uw(Kw(i));return Jw(r,s),r}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,s=e.childCount){let i=this;for(let r=t;i&&r<s;r++)i=i.matchType(e.child(r).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let s=0;s<e.next.length;s++)if(this.next[t].type==e.next[s].type)return!0;return!1}fillBefore(e,t=!1,s=0){let i=[this];function r(o,a){let l=o.matchFragment(e,s);if(l&&(!t||l.validEnd))return T.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:u}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let h=r(u,a.concat(d));if(h)return h}}return null}return r(this,[])}findWrapping(e){for(let s=0;s<this.wrapCache.length;s+=2)if(this.wrapCache[s]==e)return this.wrapCache[s+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),s=[{match:this,type:null,via:null}];for(;s.length;){let i=s.shift(),r=i.match;if(r.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<r.next.length;o++){let{type:a,next:l}=r.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(s.push({match:a.contentMatch,type:a,via:i}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(s){e.push(s);for(let i=0;i<s.next.length;i++)e.indexOf(s.next[i].next)==-1&&t(s.next[i].next)}return t(this),e.map((s,i)=>{let r=i+(s.validEnd?"*":" ")+" ";for(let o=0;o<s.next.length;o++)r+=(o?", ":"")+s.next[o].type.name+"->"+e.indexOf(s.next[o].next);return r}).join(`
|
|
2
|
-
`)}}ts.empty=new ts(!0);class Ww{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Pf(n){let e=[];do e.push($w(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function $w(n){let e=[];do e.push(Hw(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Hw(n){let e=qw(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Vw(n,e);else break;return e}function hc(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Vw(n,e){let t=hc(n),s=t;return n.eat(",")&&(n.next!="}"?s=hc(n):s=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:s,expr:e}}function Yw(n,e){let t=n.nodeTypes,s=t[e];if(s)return[s];let i=[];for(let r in t){let o=t[r];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function qw(n){if(n.eat("(")){let e=Pf(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Yw(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Kw(n){let e=[[]];return i(r(n,0),t()),e;function t(){return e.push([])-1}function s(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function r(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(r(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=r(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=t())}else if(o.type=="star"){let l=t();return s(a,l),i(r(o.expr,l),l),[s(l)]}else if(o.type=="plus"){let l=t();return i(r(o.expr,a),l),i(r(o.expr,l),l),[s(l)]}else{if(o.type=="opt")return[s(a)].concat(r(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let d=t();i(r(o.expr,l),d),l=d}if(o.max==-1)i(r(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let d=t();s(l,d),i(r(o.expr,l),d),l=d}return[s(l)]}else{if(o.type=="name")return[s(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function If(n,e){return e-n}function fc(n,e){let t=[];return s(e),t.sort(If);function s(i){let r=n[i];if(r.length==1&&!r[0].term)return s(r[0].to);t.push(i);for(let o=0;o<r.length;o++){let{term:a,to:l}=r[o];!a&&t.indexOf(l)==-1&&s(l)}}}function Uw(n){let e=Object.create(null);return t(fc(n,0));function t(s){let i=[];s.forEach(o=>{n[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d<i.length;d++)i[d][0]==a&&(c=i[d][1]);fc(n,l).forEach(d=>{c||i.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let r=e[s.join(",")]=new ts(s.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(If);r.next.push({type:i[o][0],next:e[a.join(",")]||t(a)})}return r}}function Jw(n,e){for(let t=0,s=[n];t<s.length;t++){let i=s[t],r=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),r&&!(l.isText||l.hasRequiredAttrs())&&(r=!1),s.indexOf(c)==-1&&s.push(c)}r&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Rf(n){let e=Object.create(null);for(let t in n){let s=n[t];if(!s.hasDefault)return null;e[t]=s.default}return e}function zf(n,e){let t=Object.create(null);for(let s in n){let i=e&&e[s];if(i===void 0){let r=n[s];if(r.hasDefault)i=r.default;else throw new RangeError("No value supplied for attribute "+s)}t[s]=i}return t}function Bf(n,e,t,s){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let r=n[i];r.validate&&r.validate(e[i])}}function jf(n,e){let t=Object.create(null);if(e)for(let s in e)t[s]=new Xw(n,s,e[s]);return t}let pc=class Lf{constructor(e,t,s){this.name=e,this.schema=t,this.spec=s,this.markSet=null,this.groups=s.group?s.group.split(" "):[],this.attrs=jf(e,s.attrs),this.defaultAttrs=Rf(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(s.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ts.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:zf(this.attrs,e)}create(e=null,t,s){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new _n(this,this.computeAttrs(e),T.from(t),ce.setFrom(s))}createChecked(e=null,t,s){return t=T.from(t),this.checkContent(t),new _n(this,this.computeAttrs(e),t,ce.setFrom(s))}createAndFill(e=null,t,s){if(e=this.computeAttrs(e),t=T.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),r=i&&i.fillBefore(T.empty,!0);return r?new _n(this,e,t.append(r),ce.setFrom(s)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let s=0;s<e.childCount;s++)if(!this.allowsMarks(e.child(s).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Bf(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let s=0;s<e.length;s++)this.allowsMarkType(e[s].type)?t&&t.push(e[s]):t||(t=e.slice(0,s));return t?t.length?t:ce.none:e}static compile(e,t){let s=Object.create(null);e.forEach((r,o)=>s[r]=new Lf(r,t,o));let i=t.spec.topNode||"doc";if(!s[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!s.text)throw new RangeError("Every schema needs a 'text' type");for(let r in s.text.attrs)throw new RangeError("The text node type should not have attributes");return s}};function Gw(n,e,t){let s=t.split("|");return i=>{let r=i===null?"null":typeof i;if(s.indexOf(r)<0)throw new RangeError(`Expected value of type ${s} for attribute ${e} on type ${n}, got ${r}`)}}class Xw{constructor(e,t,s){this.hasDefault=Object.prototype.hasOwnProperty.call(s,"default"),this.default=s.default,this.validate=typeof s.validate=="string"?Gw(e,t,s.validate):s.validate}get isRequired(){return!this.hasDefault}}class Yr{constructor(e,t,s,i){this.name=e,this.rank=t,this.schema=s,this.spec=i,this.attrs=jf(e,i.attrs),this.excluded=null;let r=Rf(this.attrs);this.instance=r?new ce(this,r):null}create(e=null){return!e&&this.instance?this.instance:new ce(this,zf(this.attrs,e))}static compile(e,t){let s=Object.create(null),i=0;return e.forEach((r,o)=>s[r]=new Yr(r,i++,t,o)),s}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Bf(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Ff{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Te.from(e.nodes),t.marks=Te.from(e.marks||{}),this.nodes=pc.compile(this.spec.nodes,this),this.marks=Yr.compile(this.spec.marks,this);let s=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let r=this.nodes[i],o=r.spec.content||"",a=r.spec.marks;if(r.contentMatch=s[o]||(s[o]=ts.parse(o,this.nodes)),r.inlineContent=r.contentMatch.inlineContent,r.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!r.isInline||!r.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=r}r.markSet=a=="_"?null:a?mc(this,a.split(" ")):a==""||!r.inlineContent?[]:null}for(let i in this.marks){let r=this.marks[i],o=r.spec.excludes;r.excluded=o==null?[r]:o==""?[]:mc(this,o.split(" "))}this.nodeFromJSON=i=>_n.fromJSON(this,i),this.markFromJSON=i=>ce.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,s,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof pc){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,s,i)}text(e,t){let s=this.nodes.text;return new wr(s,s.defaultAttrs,e,ce.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function mc(n,e){let t=[];for(let s=0;s<e.length;s++){let i=e[s],r=n.marks[i],o=r;if(r)t.push(r);else for(let a in n.marks){let l=n.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[s]+"'")}return t}function Qw(n){return n.tag!=null}function Zw(n){return n.style!=null}class kn{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let s=this.matchedStyles=[];t.forEach(i=>{if(Qw(i))this.tags.push(i);else if(Zw(i)){let r=/[^=]*/.exec(i.style)[0];s.indexOf(r)<0&&s.push(r),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let r=e.nodes[i.node];return r.contentMatch.matchType(r)})}parse(e,t={}){let s=new yc(this,t,!1);return s.addAll(e,ce.none,t.from,t.to),s.finish()}parseSlice(e,t={}){let s=new yc(this,t,!0);return s.addAll(e,ce.none,t.from,t.to),I.maxOpen(s.finish())}matchTag(e,t,s){for(let i=s?this.tags.indexOf(s)+1:0;i<this.tags.length;i++){let r=this.tags[i];if(nv(e,r.tag)&&(r.namespace===void 0||e.namespaceURI==r.namespace)&&(!r.context||t.matchesContext(r.context))){if(r.getAttrs){let o=r.getAttrs(e);if(o===!1)continue;r.attrs=o||void 0}return r}}}matchStyle(e,t,s,i){for(let r=i?this.styles.indexOf(i)+1:0;r<this.styles.length;r++){let o=this.styles[r],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!s.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function s(i){let r=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<r)break}t.splice(o,0,i)}for(let i in e.marks){let r=e.marks[i].spec.parseDOM;r&&r.forEach(o=>{s(o=bc(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let r=e.nodes[i].spec.parseDOM;r&&r.forEach(o=>{s(o=bc(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new kn(e,kn.schemaRules(e)))}}const Wf={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ev={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},$f={ol:!0,ul:!0},xi=1,ua=2,li=4;function gc(n,e,t){return e!=null?(e?xi:0)|(e==="full"?ua:0):n&&n.whitespace=="pre"?xi|ua:t&~li}class Yi{constructor(e,t,s,i,r,o){this.type=e,this.attrs=t,this.marks=s,this.solid=i,this.options=o,this.content=[],this.activeMarks=ce.none,this.match=r||(o&li?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(T.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let s=this.type.contentMatch,i;return(i=s.findWrapping(e.type))?(this.match=s,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&xi)){let s=this.content[this.content.length-1],i;if(s&&s.isText&&(i=/[ \t\r\n\u000c]+$/.exec(s.text))){let r=s;s.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-i[0].length))}}let t=T.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(T.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Wf.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class yc{constructor(e,t,s){this.parser=e,this.options=t,this.isOpen=s,this.open=0,this.localPreserveWS=!1;let i=t.topNode,r,o=gc(null,t.preserveWhitespace,0)|(s?li:0);i?r=new Yi(i.type,i.attrs,ce.none,!0,t.topMatch||i.type.contentMatch,o):s?r=new Yi(null,null,ce.none,!0,null,o):r=new Yi(e.schema.topNodeType,null,ce.none,!0,null,o),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let s=e.nodeValue,i=this.top,r=i.options&ua?"full":this.localPreserveWS||(i.options&xi)>0,{schema:o}=this.parser;if(r==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(s)){if(r)if(r==="full")s=s.replace(/\r\n?/g,`
|
|
3
|
-
`);else if(o.linebreakReplacement&&/[\r\n]/.test(
|
|
4
|
-
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let s=e.style;if(s&&s.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let r=this.parser.matchedStyles[i],o=s.getPropertyValue(r);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(r,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,s,i){let r,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),s,e.nodeName=="BR")||this.leafFallback(e,s);else{let l=this.enter(o,t.attrs||null,s,t.preserveWhitespace);l&&(r=!0,s=l)}else{let l=this.parser.schema.marks[t.mark];s=s.concat(l.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,s,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,s,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,s),this.findAround(e,l,!1)}r&&this.sync(a)&&this.open--}addAll(e,t,s,i){let r=s||0;for(let o=s?e.childNodes[s]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(o,t);this.findAtPoint(e,r)}findPlace(e,t,s){let i,r;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,r=l,!c.length))break;if(l.solid){if(s)break;a+=2}}if(!i)return null;this.sync(r);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,s){if(e.isInline&&this.needsBlock&&!this.top.type){let r=this.textblockFromContext();r&&(t=this.enterInner(r,null,t))}let i=this.findPlace(e,t,s);if(i){this.closeExtra();let r=this.top;r.match&&(r.match=r.match.matchType(e.type));let o=ce.none;for(let a of i.concat(e.marks))(r.type?r.type.allowsMarkType(a.type):xc(a.type,e.type))&&(o=a.addToSet(o));return r.content.push(e.mark(o)),!0}return!1}enter(e,t,s,i){let r=this.findPlace(e.create(t),s,!1);return r&&(r=this.enterInner(e,t,s,!0,i)),r}enterInner(e,t,s,i=!1,r){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=gc(e,r,o.options);o.options&li&&o.content.length==0&&(a|=li);let l=ce.none;return s=s.filter(c=>(o.type?o.type.allowsMarkType(c.type):xc(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Yi(e,t,l,i,null,a)),this.open++,s}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=xi)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let s=this.nodes[t].content;for(let i=s.length-1;i>=0;i--)e+=s[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let s=0;s<this.find.length;s++)this.find[s].node==e&&this.find[s].offset==t&&(this.find[s].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,s){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(s?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),s=this.options.context,i=!this.isOpen&&(!s||s.parent.type==this.nodes[0].type),r=-(s?s.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=r;l--)if(o(a-1,l))return!0;return!1}else{let d=l>0||l==0&&i?this.nodes[l].type:s&&l>=r?s.node(l-r).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(s&&s.isTextblock&&s.defaultAttrs)return s}for(let t in this.parser.schema.nodes){let s=this.parser.schema.nodes[t];if(s.isTextblock&&s.defaultAttrs)return s}}}function tv(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let s=e.nodeType==1?e.nodeName.toLowerCase():null;s&&$f.hasOwnProperty(s)&&t?(t.appendChild(e),e=t):s=="li"?t=e:s&&(t=null)}}function nv(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function bc(n){let e={};for(let t in n)e[t]=n[t];return e}function xc(n,e){let t=e.schema.nodes;for(let s in t){let i=t[s];if(!i.allowsMarkType(n))continue;let r=[],o=a=>{r.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:d}=a.edge(l);if(c==e||r.indexOf(d)<0&&o(d))return!0}};if(o(i.contentMatch))return!0}}class as{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},s){s||(s=Mo(t).createDocumentFragment());let i=s,r=[];return e.forEach(o=>{if(r.length||o.marks.length){let a=0,l=0;for(;a<r.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(r[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<r.length;)i=r.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],d=this.serializeMark(c,o.isInline,t);d&&(r.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),s}serializeNodeInner(e,t){let{dom:s,contentDOM:i}=ur(Mo(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return s}serializeNode(e,t={}){let s=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let r=this.serializeMark(e.marks[i],e.isInline,t);r&&((r.contentDOM||r.dom).appendChild(s),s=r.dom)}return s}serializeMark(e,t,s={}){let i=this.marks[e.type.name];return i&&ur(Mo(s),i(e,t),null,e.attrs)}static renderSpec(e,t,s=null,i){return ur(e,t,s,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new as(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=_c(e.nodes);return t.text||(t.text=s=>s.text),t}static marksFromSchema(e){return _c(e.marks)}}function _c(n){let e={};for(let t in n){let s=n[t].spec.toDOM;s&&(e[t]=s)}return e}function Mo(n){return n.document||window.document}const kc=new WeakMap;function sv(n){let e=kc.get(n);return e===void 0&&kc.set(n,e=iv(n)),e}function iv(n){let e=null;function t(s){if(s&&typeof s=="object")if(Array.isArray(s))if(typeof s[0]=="string")e||(e=[]),e.push(s);else for(let i=0;i<s.length;i++)t(s[i]);else for(let i in s)t(s[i])}return t(n),e}function ur(n,e,t,s){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],r;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(s&&(r=sv(s))&&r.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let a,l=t?n.createElementNS(t,i):n.createElement(i),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let h=u.indexOf(" ");h>0?l.setAttributeNS(u.slice(0,h),u.slice(h+1),c[u]):u=="style"&&l.style?l.style.cssText=c[u]:l.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let h=e[u];if(h===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:p}=ur(n,h,t,s);if(l.appendChild(f),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const Hf=65535,Vf=Math.pow(2,16);function rv(n,e){return n+e*Vf}function wc(n){return n&Hf}function ov(n){return(n-(n&Hf))/Vf}const Yf=1,qf=2,hr=4,Kf=8;class ha{constructor(e,t,s){this.pos=e,this.delInfo=t,this.recover=s}get deleted(){return(this.delInfo&Kf)>0}get deletedBefore(){return(this.delInfo&(Yf|hr))>0}get deletedAfter(){return(this.delInfo&(qf|hr))>0}get deletedAcross(){return(this.delInfo&hr)>0}}class lt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&<.empty)return lt.empty}recover(e){let t=0,s=wc(e);if(!this.inverted)for(let i=0;i<s;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[s*3]+t+ov(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,s){let i=0,r=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+r],d=this.ranges[a+o],u=l+c;if(e<=u){let h=c?e==l?-1:e==u?1:t:t,f=l+i+(h<0?0:d);if(s)return f;let p=e==(t<0?l:u)?null:rv(a/3,e-l),m=e==l?qf:e==u?Yf:hr;return(t<0?e!=l:e!=u)&&(m|=Kf),new ha(f,m,p)}i+=d-c}return s?e+i:new ha(e+i,0,null)}touches(e,t){let s=0,i=wc(t),r=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?s:0);if(l>e)break;let c=this.ranges[a+r],d=l+c;if(e<=d&&a==i*3)return!0;s+=this.ranges[a+o]-c}return!1}forEach(e){let t=this.inverted?2:1,s=this.inverted?1:2;for(let i=0,r=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?r:0),l=o+(this.inverted?0:r),c=this.ranges[i+t],d=this.ranges[i+s];e(a,a+c,l,l+d),r+=d-c}}invert(){return new lt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?lt.empty:new lt(e<0?[0,-e,0]:[0,0,e])}}lt.empty=new lt([]);class _i{constructor(e,t,s=0,i=e?e.length:0){this.mirror=t,this.from=s,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new _i(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,s=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?s+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,s=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?s-i-1:void 0)}}invert(){let e=new _i;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let s=this.from;s<this.to;s++)e=this._maps[s].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,s){let i=0;for(let r=this.from;r<this.to;r++){let o=this._maps[r],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(r);if(l!=null&&l>r&&l<this.to){r=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return s?e:new ha(e,i,null)}}const Co=Object.create(null);class Fe{getMap(){return lt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let s=Co[t.stepType];if(!s)throw new RangeError(`No step type ${t.stepType} defined`);return s.fromJSON(e,t)}static jsonID(e,t){if(e in Co)throw new RangeError("Duplicate use of step JSON ID "+e);return Co[e]=t,t.prototype.jsonID=e,t}}class ye{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ye(e,null)}static fail(e){return new ye(null,e)}static fromReplace(e,t,s,i){try{return ye.ok(e.replace(t,s,i))}catch(r){if(r instanceof xr)return ye.fail(r.message);throw r}}}function Ga(n,e,t){let s=[];for(let i=0;i<n.childCount;i++){let r=n.child(i);r.content.size&&(r=r.copy(Ga(r.content,e,r))),r.isInline&&(r=e(r,t,i)),s.push(r)}return T.fromArray(s)}class fn extends Fe{constructor(e,t,s){super(),this.from=e,this.to=t,this.mark=s}apply(e){let t=e.slice(this.from,this.to),s=e.resolve(this.from),i=s.node(s.sharedDepth(this.to)),r=new I(Ga(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return ye.fromReplace(e,this.from,this.to,r)}invert(){return new Lt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),s=e.mapResult(this.to,-1);return t.deleted&&s.deleted||t.pos>=s.pos?null:new fn(t.pos,s.pos,this.mark)}merge(e){return e instanceof fn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new fn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new fn(t.from,t.to,e.markFromJSON(t.mark))}}Fe.jsonID("addMark",fn);class Lt extends Fe{constructor(e,t,s){super(),this.from=e,this.to=t,this.mark=s}apply(e){let t=e.slice(this.from,this.to),s=new I(Ga(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return ye.fromReplace(e,this.from,this.to,s)}invert(){return new fn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),s=e.mapResult(this.to,-1);return t.deleted&&s.deleted||t.pos>=s.pos?null:new Lt(t.pos,s.pos,this.mark)}merge(e){return e instanceof Lt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Lt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Lt(t.from,t.to,e.markFromJSON(t.mark))}}Fe.jsonID("removeMark",Lt);class pn extends Fe{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ye.fail("No node at mark step's position");let s=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ye.fromReplace(e,this.pos,this.pos+1,new I(T.from(s),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let s=this.mark.addToSet(t.marks);if(s.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(s))return new pn(this.pos,t.marks[i]);return new pn(this.pos,this.mark)}}return new ns(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new pn(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new pn(t.pos,e.markFromJSON(t.mark))}}Fe.jsonID("addNodeMark",pn);class ns extends Fe{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ye.fail("No node at mark step's position");let s=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ye.fromReplace(e,this.pos,this.pos+1,new I(T.from(s),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new pn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ns(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ns(t.pos,e.markFromJSON(t.mark))}}Fe.jsonID("removeNodeMark",ns);class ve extends Fe{constructor(e,t,s,i=!1){super(),this.from=e,this.to=t,this.slice=s,this.structure=i}apply(e){return this.structure&&fa(e,this.from,this.to)?ye.fail("Structure replace would overwrite content"):ye.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new lt([this.from,this.to-this.from,this.slice.size])}invert(e){return new ve(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),s=e.mapResult(this.to,-1);return t.deletedAcross&&s.deletedAcross?null:new ve(t.pos,Math.max(t.pos,s.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ve)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?I.empty:new I(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ve(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?I.empty:new I(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ve(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ve(t.from,t.to,I.fromJSON(e,t.slice),!!t.structure)}}Fe.jsonID("replace",ve);class Se extends Fe{constructor(e,t,s,i,r,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=s,this.gapTo=i,this.slice=r,this.insert=o,this.structure=a}apply(e){if(this.structure&&(fa(e,this.from,this.gapFrom)||fa(e,this.gapTo,this.to)))return ye.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ye.fail("Gap is not a flat range");let s=this.slice.insertAt(this.insert,t.content);return s?ye.fromReplace(e,this.from,this.to,s):ye.fail("Content does not fit in gap")}getMap(){return new lt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Se(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),s=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),r=this.to==this.gapTo?s.pos:e.map(this.gapTo,1);return t.deletedAcross&&s.deletedAcross||i<t.pos||r>s.pos?null:new Se(t.pos,s.pos,i,r,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Se(t.from,t.to,t.gapFrom,t.gapTo,I.fromJSON(e,t.slice),t.insert,!!t.structure)}}Fe.jsonID("replaceAround",Se);function fa(n,e,t){let s=n.resolve(e),i=t-e,r=s.depth;for(;i>0&&r>0&&s.indexAfter(r)==s.node(r).childCount;)r--,i--;if(i>0){let o=s.node(r).maybeChild(s.indexAfter(r));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function av(n,e,t,s){let i=[],r=[],o,a;n.doc.nodesBetween(e,t,(l,c,d)=>{if(!l.isInline)return;let u=l.marks;if(!s.isInSet(u)&&d.type.allowsMarkType(s.type)){let h=Math.max(c,e),f=Math.min(c+l.nodeSize,t),p=s.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(p)||(o&&o.to==h&&o.mark.eq(u[m])?o.to=f:i.push(o=new Lt(h,f,u[m])));a&&a.to==h?a.to=f:r.push(a=new fn(h,f,s))}}),i.forEach(l=>n.step(l)),r.forEach(l=>n.step(l))}function lv(n,e,t,s){let i=[],r=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;r++;let l=null;if(s instanceof Yr){let c=o.marks,d;for(;d=s.isInSet(c);)(l||(l=[])).push(d),c=d.removeFromSet(c)}else s?s.isInSet(o.marks)&&(l=[s]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let d=0;d<l.length;d++){let u=l[d],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==r-1&&u.eq(i[f].style)&&(h=p)}h?(h.to=c,h.step=r):i.push({style:u,from:Math.max(a,e),to:c,step:r})}}}),i.forEach(o=>n.step(new Lt(o.from,o.to,o.style)))}function Xa(n,e,t,s=t.contentMatch,i=!0){let r=n.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<r.childCount;l++){let c=r.child(l),d=a+c.nodeSize,u=s.matchType(c.type);if(!u)o.push(new ve(a,d,I.empty));else{s=u;for(let h=0;h<c.marks.length;h++)t.allowsMarkType(c.marks[h].type)||n.step(new Lt(a,d,c.marks[h]));if(i&&c.isText&&t.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new I(T.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new ve(a+h.index,a+h.index+h[0].length,p))}}a=d}if(!s.validEnd){let l=s.fillBefore(T.empty,!0);n.replace(a,a,new I(l,0,0))}for(let l=o.length-1;l>=0;l--)n.step(o[l])}function cv(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Bs(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let s=n.depth,i=0,r=0;;--s){let o=n.$from.node(s),a=n.$from.index(s)+i,l=n.$to.indexAfter(s)-r;if(s<n.depth&&o.canReplace(a,l,t))return s;if(s==0||o.type.spec.isolating||!cv(o,a,l))break;a&&(i=1),l<o.childCount&&(r=1)}return null}function dv(n,e,t){let{$from:s,$to:i,depth:r}=e,o=s.before(r+1),a=i.after(r+1),l=o,c=a,d=T.empty,u=0;for(let p=r,m=!1;p>t;p--)m||s.index(p)>0?(m=!0,d=T.from(s.node(p).copy(d)),u++):l--;let h=T.empty,f=0;for(let p=r,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,h=T.from(i.node(p).copy(h)),f++):c++;n.step(new Se(l,c,o,a,new I(d.append(h),u,f),d.size-u,!0))}function Qa(n,e,t=null,s=n){let i=uv(n,e),r=i&&hv(s,e);return r?i.map(vc).concat({type:e,attrs:t}).concat(r.map(vc)):null}function vc(n){return{type:n,attrs:null}}function uv(n,e){let{parent:t,startIndex:s,endIndex:i}=n,r=t.contentMatchAt(s).findWrapping(e);if(!r)return null;let o=r.length?r[0]:e;return t.canReplaceWith(s,i,o)?r:null}function hv(n,e){let{parent:t,startIndex:s,endIndex:i}=n,r=t.child(s),o=e.contentMatch.findWrapping(r.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=s;l&&c<i;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:o}function fv(n,e,t){let s=T.empty;for(let o=t.length-1;o>=0;o--){if(s.size){let a=t[o].type.contentMatch.matchFragment(s);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}s=T.from(t[o].type.create(t[o].attrs,s))}let i=e.start,r=e.end;n.step(new Se(i,r,i,r,new I(s,0,0),t.length,!0))}function pv(n,e,t,s,i){if(!s.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let r=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(s,l)&&mv(n.doc,n.mapping.slice(r).map(a),s)){let c=null;if(s.schema.linebreakReplacement){let f=s.whitespace=="pre",p=!!s.contentMatch.matchType(s.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&Jf(n,o,a,r),Xa(n,n.mapping.slice(r).map(a,1),s,void 0,c===null);let d=n.mapping.slice(r),u=d.map(a,1),h=d.map(a+o.nodeSize,1);return n.step(new Se(u,h,u+1,h-1,new I(T.from(s.create(l,null,o.marks)),0,0),1,!0)),c===!0&&Uf(n,o,a,r),!1}})}function Uf(n,e,t,s){e.forEach((i,r)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=n.mapping.slice(s).map(t+1+r+o.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Jf(n,e,t,s){e.forEach((i,r)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(s).map(t+1+r);n.replaceWith(o,o+1,e.type.schema.text(`
|
|
5
|
-
`))}})}function mv(n,e,t){let s=n.resolve(e),i=s.index();return s.parent.canReplaceWith(i,i+1,t)}function gv(n,e,t,s,i){let r=n.doc.nodeAt(e);if(!r)throw new RangeError("No node at given position");t||(t=r.type);let o=t.create(s,null,i||r.marks);if(r.isLeaf)return n.replaceWith(e,e+r.nodeSize,o);if(!t.validContent(r.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Se(e,e+r.nodeSize,e+1,e+r.nodeSize-1,new I(T.from(o),0,0),1,!0))}function sn(n,e,t=1,s){let i=n.resolve(e),r=i.depth-t,o=s&&s[s.length-1]||i.parent;if(r<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,d=t-2;c>r;c--,d--){let u=i.node(c),h=i.index(c);if(u.type.spec.isolating)return!1;let f=u.content.cutByIndex(h,u.childCount),p=s&&s[d+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=s&&s[d]||u;if(!u.canReplace(h+1,u.childCount)||!m.type.validContent(f))return!1}let a=i.indexAfter(r),l=s&&s[0];return i.node(r).canReplaceWith(a,a,l?l.type:i.node(r+1).type)}function yv(n,e,t=1,s){let i=n.doc.resolve(e),r=T.empty,o=T.empty;for(let a=i.depth,l=i.depth-t,c=t-1;a>l;a--,c--){r=T.from(i.node(a).copy(r));let d=s&&s[c];o=T.from(d?d.type.create(d.attrs,o):i.node(a).copy(o))}n.step(new ve(e,e,new I(r.append(o),t,t),!0))}function Tn(n,e){let t=n.resolve(e),s=t.index();return Gf(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(s,s+1)}function bv(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:s}=n.type.schema;for(let i=0;i<e.childCount;i++){let r=e.child(i),o=r.type==s?n.type.schema.nodes.text:r.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(r.marks))return!1}return t.validEnd}function Gf(n,e){return!!(n&&e&&!n.isLeaf&&bv(n,e))}function qr(n,e,t=-1){let s=n.resolve(e);for(let i=s.depth;;i--){let r,o,a=s.index(i);if(i==s.depth?(r=s.nodeBefore,o=s.nodeAfter):t>0?(r=s.node(i+1),a++,o=s.node(i).maybeChild(a)):(r=s.node(i).maybeChild(a-1),o=s.node(i+1)),r&&!r.isTextblock&&Gf(r,o)&&s.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?s.before(i):s.after(i)}}function xv(n,e,t){let s=null,{linebreakReplacement:i}=n.doc.type.schema,r=n.doc.resolve(e-t),o=r.node().type;if(i&&o.inlineContent){let d=o.whitespace=="pre",u=!!o.contentMatch.matchType(i);d&&!u?s=!1:!d&&u&&(s=!0)}let a=n.steps.length;if(s===!1){let d=n.doc.resolve(e+t);Jf(n,d.node(),d.before(),a)}o.inlineContent&&Xa(n,e+t-1,o,r.node().contentMatchAt(r.index()),s==null);let l=n.mapping.slice(a),c=l.map(e-t);if(n.step(new ve(c,l.map(e+t,-1),I.empty,!0)),s===!0){let d=n.doc.resolve(c);Uf(n,d.node(),d.before(),n.steps.length)}return n}function _v(n,e,t){let s=n.resolve(e);if(s.parent.canReplaceWith(s.index(),s.index(),t))return e;if(s.parentOffset==0)for(let i=s.depth-1;i>=0;i--){let r=s.index(i);if(s.node(i).canReplaceWith(r,r,t))return s.before(i+1);if(r>0)return null}if(s.parentOffset==s.parent.content.size)for(let i=s.depth-1;i>=0;i--){let r=s.indexAfter(i);if(s.node(i).canReplaceWith(r,r,t))return s.after(i+1);if(r<s.node(i).childCount)return null}return null}function Xf(n,e,t){let s=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let r=0;r<t.openStart;r++)i=i.firstChild.content;for(let r=1;r<=(t.openStart==0&&t.size?2:1);r++)for(let o=s.depth;o>=0;o--){let a=o==s.depth?0:s.pos<=(s.start(o+1)+s.end(o+1))/2?-1:1,l=s.index(o)+(a>0?1:0),c=s.node(o),d=!1;if(r==1)d=c.canReplace(l,l,i);else{let u=c.contentMatchAt(l).findWrapping(i.firstChild.type);d=u&&c.canReplaceWith(l,l,u[0])}if(d)return a==0?s.pos:a<0?s.before(o+1):s.after(o+1)}return null}function Kr(n,e,t=e,s=I.empty){if(e==t&&!s.size)return null;let i=n.resolve(e),r=n.resolve(t);return Qf(i,r,s)?new ve(e,t,s):new kv(i,r,s).fit()}function Qf(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class kv{constructor(e,t,s){this.$from=e,this.$to=t,this.unplaced=s,this.frontier=[],this.placed=T.empty;for(let i=0;i<=e.depth;i++){let r=e.node(i);this.frontier.push({type:r.type,match:r.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=T.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,s=this.$from,i=this.close(e<0?this.$to:s.doc.resolve(e));if(!i)return null;let r=this.placed,o=s.depth,a=i.depth;for(;o&&a&&r.childCount==1;)r=r.firstChild.content,o--,a--;let l=new I(r,o,a);return e>-1?new Se(s.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||s.pos!=this.$to.pos?new ve(s.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,s=0,i=this.unplaced.openEnd;s<e;s++){let r=t.firstChild;if(t.childCount>1&&(i=0),r.type.spec.isolating&&i<=s){e=s;break}t=r.content}for(let t=1;t<=2;t++)for(let s=t==1?e:this.unplaced.openStart;s>=0;s--){let i,r=null;s?(r=Oo(this.unplaced.content,s-1).firstChild,i=r.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],d,u=null;if(t==1&&(o?c.matchType(o.type)||(u=c.fillBefore(T.from(o),!1)):r&&l.compatibleContent(r.type)))return{sliceDepth:s,frontierDepth:a,parent:r,inject:u};if(t==2&&o&&(d=c.findWrapping(o.type)))return{sliceDepth:s,frontierDepth:a,parent:r,wrap:d};if(r&&c.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:s}=this.unplaced,i=Oo(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new I(e,t+1,Math.max(s,i.size+t>=e.size-s?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:s}=this.unplaced,i=Oo(e,t);if(i.childCount<=1&&t>0){let r=e.size-t<=t+i.size;this.unplaced=new I(ti(e,t-1,1),t-1,r?t-1:s)}else this.unplaced=new I(ti(e,t,1),t,s)}placeNodes({sliceDepth:e,frontierDepth:t,parent:s,inject:i,wrap:r}){for(;this.depth>t;)this.closeFrontierNode();if(r)for(let m=0;m<r.length;m++)this.openFrontierNode(r[m]);let o=this.unplaced,a=s?s.content:o.content,l=o.openStart-e,c=0,d=[],{match:u,type:h}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)d.push(i.child(m));u=u.matchFragment(i)}let f=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let m=a.child(c),g=u.matchType(m.type);if(!g)break;c++,(c>1||l==0||m.content.size)&&(u=g,d.push(Zf(m.mark(h.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?f:-1)))}let p=c==a.childCount;p||(f=-1),this.placed=ni(this.placed,t,T.from(d)),this.frontier[t].match=u,p&&f<0&&s&&s.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<f;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=p?e==0?I.empty:new I(ti(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new I(ti(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Do(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:s}=this.$to,i=this.$to.after(s);for(;s>1&&i==this.$to.end(--s);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:s,type:i}=this.frontier[t],r=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=Do(e,t,i,s,r);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],d=Do(e,a,c,l,!0);if(!d||d.childCount)continue e}return{depth:t,fit:o,move:r?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=ni(this.placed,t.depth,t.fit)),e=t.move;for(let s=t.depth+1;s<=e.depth;s++){let i=e.node(s),r=i.type.contentMatch.fillBefore(i.content,!0,e.index(s));this.openFrontierNode(i.type,i.attrs,r)}return e}openFrontierNode(e,t=null,s){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=ni(this.placed,this.depth,T.from(e.create(t,s))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(T.empty,!0);t.childCount&&(this.placed=ni(this.placed,this.frontier.length,t))}}function ti(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(ti(n.firstChild.content,e-1,t)))}function ni(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(ni(n.lastChild.content,e-1,t)))}function Oo(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Zf(n,e,t){if(e<=0)return n;let s=n.content;return e>1&&(s=s.replaceChild(0,Zf(s.firstChild,e-1,s.childCount==1?t-1:0))),e>0&&(s=n.type.contentMatch.fillBefore(s).append(s),t<=0&&(s=s.append(n.type.contentMatch.matchFragment(s).fillBefore(T.empty,!0)))),n.copy(s)}function Do(n,e,t,s,i){let r=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==r.childCount&&!t.compatibleContent(r.type))return null;let a=s.fillBefore(r.content,!0,o);return a&&!wv(t,r.content,o)?a:null}function wv(n,e,t){for(let s=t;s<e.childCount;s++)if(!n.allowsMarks(e.child(s).marks))return!0;return!1}function vv(n){return n.spec.defining||n.spec.definingForContent}function Sv(n,e,t,s){if(!s.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),r=n.doc.resolve(t);if(Qf(i,r,s))return n.step(new ve(e,t,s));let o=tp(i,r);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==f&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],d=s.openStart;for(let h=s.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==s.openStart)break;h=p.content}for(let h=d-1;h>=0;h--){let f=c[h],p=vv(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(a)-1)))d=h;else if(p||!f.type.isTextblock)break}for(let h=s.openStart;h>=0;h--){let f=(h+d+1)%(s.openStart+1),p=c[f];if(p)for(let m=0;m<o.length;m++){let g=o[(m+l)%o.length],b=!0;g<0&&(b=!1,g=-g);let S=i.node(g-1),_=i.index(g-1);if(S.canReplaceWith(_,_,p.type,p.marks))return n.replace(i.before(g),b?r.after(g):t,new I(ep(s.content,0,s.openStart,f),f,s.openEnd))}}let u=n.steps.length;for(let h=o.length-1;h>=0&&(n.replace(e,t,s),!(n.steps.length>u));h--){let f=o[h];f<0||(e=i.before(f),t=r.after(f))}}function ep(n,e,t,s,i){if(e<t){let r=n.firstChild;n=n.replaceChild(0,r.copy(ep(r.content,e+1,t,s,r)))}if(e>s){let r=i.contentMatchAt(0),o=r.fillBefore(n).append(n);n=o.append(r.matchFragment(o).fillBefore(T.empty,!0))}return n}function Mv(n,e,t,s){if(!s.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=_v(n.doc,e,s.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new I(T.from(s),0,0))}function Cv(n,e,t){let s=n.doc.resolve(e),i=n.doc.resolve(t),r=tp(s,i);for(let o=0;o<r.length;o++){let a=r[o],l=o==r.length-1;if(l&&a==0||s.node(a).type.contentMatch.validEnd)return n.delete(s.start(a),i.end(a));if(a>0&&(l||s.node(a-1).canReplace(s.index(a-1),i.indexAfter(a-1))))return n.delete(s.before(a),i.after(a))}for(let o=1;o<=s.depth&&o<=i.depth;o++)if(e-s.start(o)==s.depth-o&&t>s.end(o)&&i.end(o)-t!=i.depth-o&&s.start(o-1)==i.start(o-1)&&s.node(o-1).canReplace(s.index(o-1),i.index(o-1)))return n.delete(s.before(o),t);n.delete(e,t)}function tp(n,e){let t=[],s=Math.min(n.depth,e.depth);for(let i=s;i>=0;i--){let r=n.start(i);if(r<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(r==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==r-1)&&t.push(i)}return t}class ws extends Fe{constructor(e,t,s){super(),this.pos=e,this.attr=t,this.value=s}apply(e){let t=e.nodeAt(this.pos);if(!t)return ye.fail("No node at attribute step's position");let s=Object.create(null);for(let r in t.attrs)s[r]=t.attrs[r];s[this.attr]=this.value;let i=t.type.create(s,null,t.marks);return ye.fromReplace(e,this.pos,this.pos+1,new I(T.from(i),0,t.isLeaf?0:1))}getMap(){return lt.empty}invert(e){return new ws(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ws(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ws(t.pos,t.attr,t.value)}}Fe.jsonID("attr",ws);class ki extends Fe{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let s=e.type.create(t,e.content,e.marks);return ye.ok(s)}getMap(){return lt.empty}invert(e){return new ki(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new ki(t.attr,t.value)}}Fe.jsonID("docAttr",ki);let Os=class extends Error{};Os=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Os.prototype=Object.create(Error.prototype);Os.prototype.constructor=Os;Os.prototype.name="TransformError";class Ov{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new _i}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Os(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let s=0;s<this.mapping.maps.length;s++){let i=this.mapping.maps[s];s&&(e=i.map(e,1),t=i.map(t,-1)),i.forEach((r,o,a,l)=>{e=Math.min(e,a),t=Math.max(t,l)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,s=I.empty){let i=Kr(this.doc,e,t,s);return i&&this.step(i),this}replaceWith(e,t,s){return this.replace(e,t,new I(T.from(s),0,0))}delete(e,t){return this.replace(e,t,I.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,s){return Sv(this,e,t,s),this}replaceRangeWith(e,t,s){return Mv(this,e,t,s),this}deleteRange(e,t){return Cv(this,e,t),this}lift(e,t){return dv(this,e,t),this}join(e,t=1){return xv(this,e,t),this}wrap(e,t){return fv(this,e,t),this}setBlockType(e,t=e,s,i=null){return pv(this,e,t,s,i),this}setNodeMarkup(e,t,s=null,i){return gv(this,e,t,s,i),this}setNodeAttribute(e,t,s){return this.step(new ws(e,t,s)),this}setDocAttribute(e,t){return this.step(new ki(e,t)),this}addNodeMark(e,t){return this.step(new pn(e,t)),this}removeNodeMark(e,t){let s=this.doc.nodeAt(e);if(!s)throw new RangeError("No node at position "+e);if(t instanceof ce)t.isInSet(s.marks)&&this.step(new ns(e,t));else{let i=s.marks,r,o=[];for(;r=t.isInSet(i);)o.push(new ns(e,r)),i=r.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,s){return yv(this,e,t,s),this}addMark(e,t,s){return av(this,e,t,s),this}removeMark(e,t,s){return lv(this,e,t,s),this}clearIncompatible(e,t,s){return Xa(this,e,t,s),this}}const To=Object.create(null);class q{constructor(e,t,s){this.$anchor=e,this.$head=t,this.ranges=s||[new Dv(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=I.empty){let s=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=s,s=s.lastChild;let r=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],d=e.mapping.slice(r);e.replaceRange(d.map(l.pos),d.map(c.pos),a?I.empty:t),a==0&&Cc(e,r,(s?s.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let s=e.steps.length,i=this.ranges;for(let r=0;r<i.length;r++){let{$from:o,$to:a}=i[r],l=e.mapping.slice(s),c=l.map(o.pos),d=l.map(a.pos);r?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),Cc(e,s,t.isInline?-1:1))}}static findFrom(e,t,s=!1){let i=e.parent.inlineContent?new $(e):bs(e.node(0),e.parent,e.pos,e.index(),t,s);if(i)return i;for(let r=e.depth-1;r>=0;r--){let o=t<0?bs(e.node(0),e.node(r),e.before(r+1),e.index(r),t,s):bs(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,s);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new ct(e.node(0))}static atStart(e){return bs(e,e,0,0,1)||new ct(e)}static atEnd(e){return bs(e,e,e.content.size,e.childCount,-1)||new ct(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let s=To[t.type];if(!s)throw new RangeError(`No selection type ${t.type} defined`);return s.fromJSON(e,t)}static jsonID(e,t){if(e in To)throw new RangeError("Duplicate use of selection JSON ID "+e);return To[e]=t,t.prototype.jsonID=e,t}getBookmark(){return $.between(this.$anchor,this.$head).getBookmark()}}q.prototype.visible=!0;class Dv{constructor(e,t){this.$from=e,this.$to=t}}let Sc=!1;function Mc(n){!Sc&&!n.parent.inlineContent&&(Sc=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class $ extends q{constructor(e,t=e){Mc(e),Mc(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let s=e.resolve(t.map(this.head));if(!s.parent.inlineContent)return q.near(s);let i=e.resolve(t.map(this.anchor));return new $(i.parent.inlineContent?i:s,s)}replace(e,t=I.empty){if(super.replace(e,t),t==I.empty){let s=this.$from.marksAcross(this.$to);s&&e.ensureMarks(s)}}eq(e){return e instanceof $&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ur(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new $(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,s=t){let i=e.resolve(t);return new this(i,s==t?i:e.resolve(s))}static between(e,t,s){let i=e.pos-t.pos;if((!s||i)&&(s=i>=0?1:-1),!t.parent.inlineContent){let r=q.findFrom(t,s,!0)||q.findFrom(t,-s,!0);if(r)t=r.$head;else return q.near(t,s)}return e.parent.inlineContent||(i==0?e=t:(e=(q.findFrom(e,-s,!0)||q.findFrom(e,s,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new $(e,t)}}q.jsonID("text",$);class Ur{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Ur(e.map(this.anchor),e.map(this.head))}resolve(e){return $.between(e.resolve(this.anchor),e.resolve(this.head))}}class L extends q{constructor(e){let t=e.nodeAfter,s=e.node(0).resolve(e.pos+t.nodeSize);super(e,s),this.node=t}map(e,t){let{deleted:s,pos:i}=t.mapResult(this.anchor),r=e.resolve(i);return s?q.near(r):new L(r)}content(){return new I(T.from(this.node),0,0)}eq(e){return e instanceof L&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Za(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new L(e.resolve(t.anchor))}static create(e,t){return new L(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}L.prototype.visible=!1;q.jsonID("node",L);class Za{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:s}=e.mapResult(this.anchor);return t?new Ur(s,s):new Za(s)}resolve(e){let t=e.resolve(this.anchor),s=t.nodeAfter;return s&&L.isSelectable(s)?new L(t):q.near(t)}}class ct extends q{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=I.empty){if(t==I.empty){e.delete(0,e.doc.content.size);let s=q.atStart(e.doc);s.eq(e.selection)||e.setSelection(s)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new ct(e)}map(e){return new ct(e)}eq(e){return e instanceof ct}getBookmark(){return Tv}}q.jsonID("all",ct);const Tv={map(){return this},resolve(n){return new ct(n)}};function bs(n,e,t,s,i,r=!1){if(e.inlineContent)return $.create(n,t);for(let o=s-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!r&&L.isSelectable(a))return L.create(n,t-(i<0?a.nodeSize:0))}else{let l=bs(n,a,t+i,i<0?a.childCount:0,i,r);if(l)return l}t+=a.nodeSize*i}return null}function Cc(n,e,t){let s=n.steps.length-1;if(s<e)return;let i=n.steps[s];if(!(i instanceof ve||i instanceof Se))return;let r=n.mapping.maps[s],o;r.forEach((a,l,c,d)=>{o==null&&(o=d)}),n.setSelection(q.near(n.doc.resolve(o),t))}const Oc=1,qi=2,Dc=4;class Nv extends Ov{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Oc)&~qi,this.storedMarks=null,this}get selectionSet(){return(this.updated&Oc)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=qi,this}ensureMarks(e){return ce.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&qi)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~qi,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let s=this.selection;return t&&(e=e.mark(this.storedMarks||(s.empty?s.$from.marks():s.$from.marksAcross(s.$to)||ce.none))),s.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,s){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(s==null&&(s=t),!e)return this.deleteRange(t,s);let r=this.storedMarks;if(!r){let o=this.doc.resolve(t);r=s==t?o.marks():o.marksAcross(this.doc.resolve(s))}return this.replaceRangeWith(t,s,i.text(e,r)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(q.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Dc,this}get scrolledIntoView(){return(this.updated&Dc)>0}}function Tc(n,e){return!e||!n?n:n.bind(e)}class si{constructor(e,t,s){this.name=e,this.init=Tc(t.init,s),this.apply=Tc(t.apply,s)}}const Ev=[new si("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new si("selection",{init(n,e){return n.selection||q.atStart(e.doc)},apply(n){return n.selection}}),new si("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,s){return s.selection.$cursor?n.storedMarks:null}}),new si("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class No{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Ev.slice(),t&&t.forEach(s=>{if(this.pluginsByKey[s.key])throw new RangeError("Adding different instances of a keyed plugin ("+s.key+")");this.plugins.push(s),this.pluginsByKey[s.key]=s,s.spec.state&&this.fields.push(new si(s.key,s.spec.state,s))})}}class _s{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let s=0;s<this.config.plugins.length;s++)if(s!=t){let i=this.config.plugins[s];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],s=this.applyInner(e),i=null;for(;;){let r=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,c=i?i[o].state:this,d=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,c,s);if(d&&s.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let u=0;u<this.config.plugins.length;u++)i.push(u<o?{state:s,n:t.length}:{state:this,n:0})}t.push(d),s=s.applyInner(d),r=!0}i&&(i[o]={state:s,n:t.length})}}if(!r)return{state:s,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new _s(this.config),s=this.config.fields;for(let i=0;i<s.length;i++){let r=s[i];t[r.name]=r.apply(e,this[r.name],this,t)}return t}get tr(){return new Nv(this)}static create(e){let t=new No(e.doc?e.doc.type.schema:e.schema,e.plugins),s=new _s(t);for(let i=0;i<t.fields.length;i++)s[t.fields[i].name]=t.fields[i].init(e,s);return s}reconfigure(e){let t=new No(this.schema,e.plugins),s=t.fields,i=new _s(t);for(let r=0;r<s.length;r++){let o=s[r].name;i[o]=this.hasOwnProperty(o)?this[o]:s[r].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(s=>s.toJSON())),e&&typeof e=="object")for(let s in e){if(s=="doc"||s=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[s],r=i.spec.state;r&&r.toJSON&&(t[s]=r.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,s){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new No(e.schema,e.plugins),r=new _s(i);return i.fields.forEach(o=>{if(o.name=="doc")r.doc=_n.fromJSON(e.schema,t.doc);else if(o.name=="selection")r.selection=q.fromJSON(r.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(r.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(s)for(let a in s){let l=s[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){r[o.name]=c.fromJSON.call(l,e,t[a],r);return}}r[o.name]=o.init(e,r)}}),r}}function np(n,e,t){for(let s in n){let i=n[s];i instanceof Function?i=i.bind(e):s=="handleDOMEvents"&&(i=np(i,e,{})),t[s]=i}return t}class Ze{constructor(e){this.spec=e,this.props={},e.props&&np(e.props,this,this.props),this.key=e.key?e.key.key:sp("plugin")}getState(e){return e[this.key]}}const Eo=Object.create(null);function sp(n){return n in Eo?n+"$"+ ++Eo[n]:(Eo[n]=0,n+"$")}class Ht{constructor(e="key"){this.key=sp(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ne=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Ds=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let pa=null;const Gt=function(n,e,t){let s=pa||(pa=document.createRange());return s.setEnd(n,t??n.nodeValue.length),s.setStart(n,e||0),s},Av=function(){pa=null},ss=function(n,e,t,s){return t&&(Nc(n,e,t,s,-1)||Nc(n,e,t,s,1))},Pv=/^(img|br|input|textarea|hr)$/i;function Nc(n,e,t,s,i){for(var r;;){if(n==t&&e==s)return!0;if(e==(i<0?0:gt(n))){let o=n.parentNode;if(!o||o.nodeType!=1||zi(n)||Pv.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ne(n)+(i<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((r=o.pmViewDesc)===null||r===void 0)&&r.ignoreForSelection)e+=i;else return!1;else n=o,e=i<0?gt(n):0}else return!1}}function gt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Iv(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=gt(n)}else if(n.parentNode&&!zi(n))e=Ne(n),n=n.parentNode;else return null}}function Rv(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!zi(n))e=Ne(n)+1,n=n.parentNode;else return null}}function zv(n,e,t){for(let s=e==0,i=e==gt(n);s||i;){if(n==t)return!0;let r=Ne(n);if(n=n.parentNode,!n)return!1;s=s&&r==0,i=i&&r==gt(n)}}function zi(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Jr=function(n){return n.focusNode&&ss(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Wn(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Bv(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function jv(n,e,t){if(n.caretPositionFromPoint)try{let s=n.caretPositionFromPoint(e,t);if(s)return{node:s.offsetNode,offset:Math.min(gt(s.offsetNode),s.offset)}}catch{}if(n.caretRangeFromPoint){let s=n.caretRangeFromPoint(e,t);if(s)return{node:s.startContainer,offset:Math.min(gt(s.startContainer),s.startOffset)}}}const Ft=typeof navigator<"u"?navigator:null,Ec=typeof document<"u"?document:null,Nn=Ft&&Ft.userAgent||"",ma=/Edge\/(\d+)/.exec(Nn),ip=/MSIE \d/.exec(Nn),ga=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Nn),Xe=!!(ip||ga||ma),wn=ip?document.documentMode:ga?+ga[1]:ma?+ma[1]:0,xt=!Xe&&/gecko\/(\d+)/i.test(Nn);xt&&+(/Firefox\/(\d+)/.exec(Nn)||[0,0])[1];const ya=!Xe&&/Chrome\/(\d+)/.exec(Nn),Ae=!!ya,rp=ya?+ya[1]:0,je=!Xe&&!!Ft&&/Apple Computer/.test(Ft.vendor),Ts=je&&(/Mobile\/\w+/.test(Nn)||!!Ft&&Ft.maxTouchPoints>2),pt=Ts||(Ft?/Mac/.test(Ft.platform):!1),op=Ft?/Win/.test(Ft.platform):!1,tn=/Android \d/.test(Nn),Bi=!!Ec&&"webkitFontSmoothing"in Ec.documentElement.style,Lv=Bi?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Fv(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Yt(n,e){return typeof n=="number"?n:n[e]}function Wv(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,s=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*s}}function Ac(n,e,t){let s=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,r=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(o.nodeType!=1){o=Ds(o);continue}let a=o,l=a==r.body,c=l?Fv(r):Wv(a),d=0,u=0;if(e.top<c.top+Yt(s,"top")?u=-(c.top-e.top+Yt(i,"top")):e.bottom>c.bottom-Yt(s,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+Yt(i,"top")-c.top:e.bottom-c.bottom+Yt(i,"bottom")),e.left<c.left+Yt(s,"left")?d=-(c.left-e.left+Yt(i,"left")):e.right>c.right-Yt(s,"right")&&(d=e.right-c.right+Yt(i,"right")),d||u)if(l)r.defaultView.scrollBy(d,u);else{let f=a.scrollLeft,p=a.scrollTop;u&&(a.scrollTop+=u),d&&(a.scrollLeft+=d);let m=a.scrollLeft-f,g=a.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let h=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:Ds(o)}}function $v(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),s,i;for(let r=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=n.root.elementFromPoint(r,o);if(!a||a==n.dom||!n.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){s=a,i=l.top;break}}return{refDOM:s,refTop:i,stack:ap(n.dom)}}function ap(n){let e=[],t=n.ownerDocument;for(let s=n;s&&(e.push({dom:s,top:s.scrollTop,left:s.scrollLeft}),n!=t);s=Ds(s));return e}function Hv({refDOM:n,refTop:e,stack:t}){let s=n?n.getBoundingClientRect().top:0;lp(t,s==0?0:s-e)}function lp(n,e){for(let t=0;t<n.length;t++){let{dom:s,top:i,left:r}=n[t];s.scrollTop!=i+e&&(s.scrollTop=i+e),s.scrollLeft!=r&&(s.scrollLeft=r)}}let fs=null;function Vv(n){if(n.setActive)return n.setActive();if(fs)return n.focus(fs);let e=ap(n);n.focus(fs==null?{get preventScroll(){return fs={preventScroll:!0},!0}}:void 0),fs||(fs=!1,lp(e,0))}function cp(n,e){let t,s=2e8,i,r=0,o=e.top,a=e.top,l,c;for(let d=n.firstChild,u=0;d;d=d.nextSibling,u++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=Gt(d).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<s){t=d,s=m,i=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,d.nodeType==1&&m&&(r=u+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=d,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(r=u+1)}}return!t&&l&&(t=l,i=c,s=0),t&&t.nodeType==3?Yv(t,i):!t||s&&t.nodeType==1?{node:n,offset:r}:cp(t,i)}function Yv(n,e){let t=n.nodeValue.length,s=document.createRange(),i;for(let r=0;r<t;r++){s.setEnd(n,r+1),s.setStart(n,r);let o=cn(s,1);if(o.top!=o.bottom&&el(e,o)){i={node:n,offset:r+(e.left>=(o.left+o.right)/2?1:0)};break}}return s.detach(),i||{node:n,offset:0}}function el(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function qv(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Kv(n,e,t){let{node:s,offset:i}=cp(e,t),r=-1;if(s.nodeType==1&&!s.firstChild){let o=s.getBoundingClientRect();r=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(s,i,r)}function Uv(n,e,t,s){let i=-1;for(let r=e,o=!1;r!=n.dom;){let a=n.docView.nearestDesc(r,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>s.left||l.top>s.top?i=a.posBefore:(!o&&l.right<s.left||l.bottom<s.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?s.top<(l.top+l.bottom)/2:s.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;r=a.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function dp(n,e,t){let s=n.childNodes.length;if(s&&t.top<t.bottom)for(let i=Math.max(0,Math.min(s-1,Math.floor(s*(e.top-t.top)/(t.bottom-t.top))-2)),r=i;;){let o=n.childNodes[r];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(el(e,c))return dp(o,e,c)}}if((r=(r+1)%s)==i)break}return n}function Jv(n,e){let t=n.dom.ownerDocument,s,i=0,r=jv(t,e.left,e.top);r&&({node:s,offset:i}=r);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=n.dom.getBoundingClientRect();if(!el(e,c)||(o=dp(n.dom,e,c),!o))return null}if(je)for(let c=o;s&&c;c=Ds(c))c.draggable&&(s=void 0);if(o=qv(o,e),s){if(xt&&s.nodeType==1&&(i=Math.min(i,s.childNodes.length),i<s.childNodes.length)){let d=s.childNodes[i],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&i++}let c;Bi&&i&&s.nodeType==1&&(c=s.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,s==n.dom&&i==s.childNodes.length-1&&s.lastChild.nodeType==1&&e.top>s.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(i==0||s.nodeType!=1||s.childNodes[i-1].nodeName!="BR")&&(a=Uv(n,s,i,e))}a==null&&(a=Kv(n,o,e));let l=n.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Pc(n){return n.top<n.bottom||n.left<n.right}function cn(n,e){let t=n.getClientRects();if(t.length){let s=t[e<0?0:t.length-1];if(Pc(s))return s}return Array.prototype.find.call(t,Pc)||n.getBoundingClientRect()}const Gv=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function up(n,e,t){let{node:s,offset:i,atom:r}=n.docView.domFromPos(e,t<0?-1:1),o=Bi||xt;if(s.nodeType==3)if(o&&(Gv.test(s.nodeValue)||(t<0?!i:i==s.nodeValue.length))){let l=cn(Gt(s,i,i),t);if(xt&&i&&/\s/.test(s.nodeValue[i-1])&&i<s.nodeValue.length){let c=cn(Gt(s,i-1,i-1),-1);if(c.top==l.top){let d=cn(Gt(s,i,i+1),-1);if(d.top!=l.top)return qs(d,d.left<c.left)}}return l}else{let l=i,c=i,d=t<0?1:-1;return t<0&&!i?(c++,d=-1):t>=0&&i==s.nodeValue.length?(l--,d=1):t<0?l--:c++,qs(cn(Gt(s,l,c),d),d<0)}if(!n.state.doc.resolve(e-(r||0)).parent.inlineContent){if(r==null&&i&&(t<0||i==gt(s))){let l=s.childNodes[i-1];if(l.nodeType==1)return Ao(l.getBoundingClientRect(),!1)}if(r==null&&i<gt(s)){let l=s.childNodes[i];if(l.nodeType==1)return Ao(l.getBoundingClientRect(),!0)}return Ao(s.getBoundingClientRect(),t>=0)}if(r==null&&i&&(t<0||i==gt(s))){let l=s.childNodes[i-1],c=l.nodeType==3?Gt(l,gt(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return qs(cn(c,1),!1)}if(r==null&&i<gt(s)){let l=s.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Gt(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return qs(cn(c,-1),!0)}return qs(cn(s.nodeType==3?Gt(s):s,-t),t>=0)}function qs(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function Ao(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function hp(n,e,t){let s=n.state,i=n.root.activeElement;s!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{s!=e&&n.updateState(s),i!=n.dom&&i&&i.focus()}}function Xv(n,e,t){let s=e.selection,i=t=="up"?s.$from:s.$to;return hp(n,e,()=>{let{node:r}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(r,!0);if(!a)break;if(a.node.isBlock){r=a.contentDOM||a.dom;break}r=a.dom.parentNode}let o=up(n,i.pos,1);for(let a=r.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Gt(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let d=l[c];if(d.bottom>d.top+1&&(t=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const Qv=/[\u0590-\u08ac]/;function Zv(n,e,t){let{$head:s}=e.selection;if(!s.parent.isTextblock)return!1;let i=s.parentOffset,r=!i,o=i==s.parent.content.size,a=n.domSelection();return a?!Qv.test(s.parent.textContent)||!a.modify?t=="left"||t=="backward"?r:o:hp(n,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:u}=n.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",t,"character");let f=s.depth?n.docView.domAfterPos(s.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!f.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==m;try{a.collapse(d,u),l&&(l!=d||c!=u)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),g}):s.pos==s.start()||s.pos==s.end()}let Ic=null,Rc=null,zc=!1;function eS(n,e,t){return Ic==e&&Rc==t?zc:(Ic=e,Rc=t,zc=t=="up"||t=="down"?Xv(n,e,t):Zv(n,e,t))}const _t=0,Bc=1,Vn=2,Wt=3;class ji{constructor(e,t,s,i){this.parent=e,this.children=t,this.dom=s,this.contentDOM=i,this.dirty=_t,s.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,s){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,s=this.posAtStart;;t++){let i=this.children[t];if(i==e)return s;s+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,s){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(s<0){let r,o;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&!((o=r.pmViewDesc)&&o.parent==this);)r=r.previousSibling;return r?this.posBeforeChild(o)+o.size:this.posAtStart}else{let r,o;if(e==this.contentDOM)r=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.nextSibling}for(;r&&!((o=r.pmViewDesc)&&o.parent==this);)r=r.nextSibling;return r?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>Ne(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let r=e;;r=r.parentNode){if(r==this.dom){i=!1;break}if(r.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let r=e;;r=r.parentNode){if(r==this.dom){i=!0;break}if(r.nextSibling)break}}return i??s>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let s=!0,i=e;i;i=i.parentNode){let r=this.getDesc(i),o;if(r&&(!t||r.node))if(s&&(o=r.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))s=!1;else return r}}getDesc(e){let t=e.pmViewDesc;for(let s=t;s;s=s.parent)if(s==this)return t}posFromDOM(e,t,s){for(let i=e;i;i=i.parentNode){let r=this.getDesc(i);if(r)return r.localPosFromDOM(e,t,s)}return-1}descAt(e){for(let t=0,s=0;t<this.children.length;t++){let i=this.children[t],r=s+i.size;if(s==e&&r!=s){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<r)return i.descAt(e-s-i.border);s=r}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let s=0,i=0;for(let r=0;s<this.children.length;s++){let o=this.children[s],a=r+o.size;if(a>e||o instanceof pp){i=e-r;break}r=a}if(i)return this.children[s].domFromPos(i-this.children[s].border,t);for(let r;s&&!(r=this.children[s-1]).size&&r instanceof fp&&r.side>=0;s--);if(t<=0){let r,o=!0;for(;r=s?this.children[s-1]:null,!(!r||r.dom.parentNode==this.contentDOM);s--,o=!1);return r&&t&&o&&!r.border&&!r.domAtom?r.domFromPos(r.size,t):{node:this.contentDOM,offset:r?Ne(r.dom)+1:0}}else{let r,o=!0;for(;r=s<this.children.length?this.children[s]:null,!(!r||r.dom.parentNode==this.contentDOM);s++,o=!1);return r&&o&&!r.border&&!r.domAtom?r.domFromPos(0,t):{node:this.contentDOM,offset:r?Ne(r.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,s=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,r=-1;for(let o=s,a=0;;a++){let l=this.children[a],c=o+l.size;if(i==-1&&e<=c){let d=o+l.border;if(e>=d&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,d);e=o;for(let u=a;u>0;u--){let h=this.children[u-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Ne(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(c>t||a==this.children.length-1)){t=c;for(let d=a+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){r=Ne(u.dom);break}t+=u.size}r==-1&&(r=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:r}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:s}=this.domFromPos(e,0);if(t.nodeType!=1||s==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[s]}setSelection(e,t,s,i=!1){let r=Math.min(e,t),o=Math.max(e,t);for(let f=0,p=0;f<this.children.length;f++){let m=this.children[f],g=p+m.size;if(r>p&&o<g)return m.setSelection(e-p-m.border,t-p-m.border,s,i);p=g}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),c=s.root.getSelection(),d=s.domSelectionRange(),u=!1;if((xt||je)&&e==t){let{node:f,offset:p}=a;if(f.nodeType==3){if(u=!!(p&&f.nodeValue[p-1]==`
|
|
6
|
-
`),u&&p==f.nodeValue.length)for(let m=f,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:Ne(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=f.childNodes[p-1];u=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(xt&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let f=d.focusNode.childNodes[d.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||u&&je)&&ss(a.node,a.offset,d.anchorNode,d.anchorOffset)&&ss(l.node,l.offset,d.focusNode,d.focusOffset))return;let h=!1;if((c.extend||e==t)&&!(u&&xt)){c.collapse(a.node,a.offset);try{e!=t&&c.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>t){let p=a;a=l,l=p}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let s=0,i=0;i<this.children.length;i++){let r=this.children[i],o=s+r.size;if(s==o?e<=o&&t>=s:e<o&&t>s){let a=s+r.border,l=o-r.border;if(e>=a&&t<=l){this.dirty=e==s||t==o?Vn:Bc,e==a&&t==l&&(r.contentLost||r.dom.parentNode!=this.contentDOM)?r.dirty=Wt:r.markDirty(e-a,t-a);return}else r.dirty=r.dom==r.contentDOM&&r.dom.parentNode==this.contentDOM&&!r.children.length?Vn:Wt}s=o}this.dirty=Vn}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let s=e==1?Vn:Bc;t.dirty<s&&(t.dirty=s)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class fp extends ji{constructor(e,t,s,i){let r,o=t.type.toDOM;if(typeof o=="function"&&(o=o(s,()=>{if(!r)return i;if(r.parent)return r.parent.posBeforeChild(r)})),!t.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,r=this}matchesWidget(e){return this.dirty==_t&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class tS extends ji{constructor(e,t,s,i){super(e,[],t,null),this.textDOM=s,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class is extends ji{constructor(e,t,s,i,r){super(e,[],s,i),this.mark=t,this.spec=r}static create(e,t,s,i){let r=i.nodeViews[t.type.name],o=r&&r(t,i,s);return(!o||!o.dom)&&(o=as.renderSpec(document,t.type.spec.toDOM(t,s),null,t.attrs)),new is(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Wt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Wt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=_t){let s=this.parent;for(;!s.node;)s=s.parent;s.dirty<this.dirty&&(s.dirty=this.dirty),this.dirty=_t}}slice(e,t,s){let i=is.create(this.parent,this.mark,!0,s),r=this.children,o=this.size;t<o&&(r=xa(r,t,o,s)),e>0&&(r=xa(r,0,e,s));for(let a=0;a<r.length;a++)r[a].parent=i;return i.children=r,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class vn extends ji{constructor(e,t,s,i,r,o,a,l,c){super(e,[],r,o),this.node=t,this.outerDeco=s,this.innerDeco=i,this.nodeDOM=a}static create(e,t,s,i,r,o){let a=r.nodeViews[t.type.name],l,c=a&&a(t,r,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},s,i),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=as.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let h=d;return d=yp(d,s,t),c?l=new nS(e,t,s,i,d,u||null,h,c,r,o+1):t.isText?new Gr(e,t,s,i,d,h,r):new vn(e,t,s,i,d,u||null,h,r,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let s=this.children[t];if(this.dom.contains(s.dom.parentNode)){e.contentElement=s.dom.parentNode;break}}e.contentElement||(e.getContent=()=>T.empty)}return e}matchesNode(e,t,s){return this.dirty==_t&&e.eq(this.node)&&vr(t,this.outerDeco)&&s.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let s=this.node.inlineContent,i=t,r=e.composing?this.localCompositionInfo(e,t):null,o=r&&r.pos>-1?r:null,a=r&&r.pos<0,l=new iS(this,o&&o.node,e);aS(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?l.syncToMarks(c.spec.marks,s,e,d):c.type.side>=0&&!u&&l.syncToMarks(d==this.node.childCount?ce.none:this.node.child(d).marks,s,e,d),l.placeWidget(c,e,i)},(c,d,u,h)=>{l.syncToMarks(c.marks,s,e,h);let f;l.findNodeMatch(c,d,u,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(f=l.findIndexWithChild(r.node))>-1&&l.updateNodeAt(c,d,u,f,e)||l.updateNextNode(c,d,u,e,h,i)||l.addNode(c,d,u,e,i),i+=c.nodeSize}),l.syncToMarks([],s,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Vn)&&(o&&this.protectLocalComposition(e,o),mp(this.contentDOM,this.children,e),Ts&&lS(this.dom))}localCompositionInfo(e,t){let{from:s,to:i}=e.state.selection;if(!(e.state.selection instanceof $)||s<t||i>t+this.node.content.size)return null;let r=e.input.compositionNode;if(!r||!this.dom.contains(r.parentNode))return null;if(this.node.inlineContent){let o=r.nodeValue,a=cS(this.node.content,o,s-t,i-t);return a<0?null:{node:r,pos:a,text:o}}else return{node:r,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:s,text:i}){if(this.getDesc(t))return;let r=t;for(;r.parentNode!=this.contentDOM;r=r.parentNode){for(;r.previousSibling;)r.parentNode.removeChild(r.previousSibling);for(;r.nextSibling;)r.parentNode.removeChild(r.nextSibling);r.pmViewDesc&&(r.pmViewDesc=void 0)}let o=new tS(this,r,t,i);e.input.compositionNodes.push(o),this.children=xa(this.children,s,s+i.length,e,o)}update(e,t,s,i){return this.dirty==Wt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,s,i),!0)}updateInner(e,t,s,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=s,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=_t}updateOuterDeco(e){if(vr(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=gp(this.dom,this.nodeDOM,ba(this.outerDeco,this.node,t),ba(e,this.node,t)),this.dom!=s&&(s.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function jc(n,e,t,s,i){yp(s,e,n);let r=new vn(void 0,n,e,t,s,s,s,i,0);return r.contentDOM&&r.updateChildren(i,0),r}class Gr extends vn{constructor(e,t,s,i,r,o,a){super(e,t,s,i,r,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,s,i){return this.dirty==Wt||this.dirty!=_t&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=_t||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=_t,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,s){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,s)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,s){let i=this.node.cut(e,t),r=document.createTextNode(i.text);return new Gr(this.parent,i,this.outerDeco,this.innerDeco,r,r,s)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Wt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class pp extends ji{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==_t&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class nS extends vn{constructor(e,t,s,i,r,o,a,l,c,d){super(e,t,s,i,r,o,a,c,d),this.spec=l}update(e,t,s,i){if(this.dirty==Wt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let r=this.spec.update(e,t,s);return r&&this.updateInner(e,t,s,i),r}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,s,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,s,i){this.spec.setSelection?this.spec.setSelection(e,t,s.root):super.setSelection(e,t,s,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function mp(n,e,t){let s=n.firstChild,i=!1;for(let r=0;r<e.length;r++){let o=e[r],a=o.dom;if(a.parentNode==n){for(;a!=s;)s=Lc(s),i=!0;s=s.nextSibling}else i=!0,n.insertBefore(a,s);if(o instanceof is){let l=s?s.previousSibling:n.lastChild;mp(o.contentDOM,o.children,t),s=l?l.nextSibling:n.firstChild}}for(;s;)s=Lc(s),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const ci=function(n){n&&(this.nodeName=n)};ci.prototype=Object.create(null);const Yn=[new ci];function ba(n,e,t){if(n.length==0)return Yn;let s=t?Yn[0]:new ci,i=[s];for(let r=0;r<n.length;r++){let o=n[r].type.attrs;if(o){o.nodeName&&i.push(s=new ci(o.nodeName));for(let a in o){let l=o[a];l!=null&&(t&&i.length==1&&i.push(s=new ci(e.isInline?"span":"div")),a=="class"?s.class=(s.class?s.class+" ":"")+l:a=="style"?s.style=(s.style?s.style+";":"")+l:a!="nodeName"&&(s[a]=l))}}}return i}function gp(n,e,t,s){if(t==Yn&&s==Yn)return e;let i=e;for(let r=0;r<s.length;r++){let o=s[r],a=t[r];if(r){let l;a&&a.nodeName==o.nodeName&&i!=n&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=Yn[0]),i=l}sS(i,a||Yn[0],o)}return i}function sS(n,e,t){for(let s in e)s!="class"&&s!="style"&&s!="nodeName"&&!(s in t)&&n.removeAttribute(s);for(let s in t)s!="class"&&s!="style"&&s!="nodeName"&&t[s]!=e[s]&&n.setAttribute(s,t[s]);if(e.class!=t.class){let s=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let r=0;r<s.length;r++)i.indexOf(s[r])==-1&&n.classList.remove(s[r]);for(let r=0;r<i.length;r++)s.indexOf(i[r])==-1&&n.classList.add(i[r]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let s=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=s.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function yp(n,e,t){return gp(n,n,Yn,ba(e,t,n.nodeType!=1))}function vr(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function Lc(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class iS{constructor(e,t,s){this.lock=t,this.view=s,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=rS(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let s=e;s<t;s++)this.top.children[s].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,s,i){let r=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;r<a&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&e[r].type.spec.spanning!==!1;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=_t,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;i<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let d=this.index;d<c;d++){let u=this.top.children[d];if(u.matchesMark(e[o])&&!this.isLocked(u.dom)){l=d;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let d=is.create(this.top,e[o],t,s);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,s,i){let r=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,s))r=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,t,s)&&!this.preMatch.matched.has(c)){r=a;break}}return r<0?!1:(this.destroyBetween(this.index,r),this.index++,!0)}updateNodeAt(e,t,s,i,r){let o=this.top.children[i];return o.dirty==Wt&&o.dom==o.contentDOM&&(o.dirty=Vn),o.update(e,t,s,r)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let s=e.pmViewDesc;if(s){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==s)return i}return-1}e=t}}updateNextNode(e,t,s,i,r,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof vn){let c=this.preMatch.matched.get(l);if(c!=null&&c!=r)return!1;let d=l.dom,u,h=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Wt&&vr(t,l.outerDeco));if(!h&&l.update(e,t,s,i))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(u=this.recreateWrapper(l,e,t,s,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Vn,u.updateChildren(i,o+1),u.dirty=_t),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,s,i,r,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!vr(s,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=vn.create(this.top,t,s,i,r,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,t,s,i,r){let o=vn.create(this.top,e,t,s,i,r);o.contentDOM&&o.updateChildren(i,r+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,s){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let r=new fp(this.top,e,t,s);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof is;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Gr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((je||Ae)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let s=document.createElement(e);e=="IMG"&&(s.className="ProseMirror-separator",s.alt=""),e=="BR"&&(s.className="ProseMirror-trailingBreak");let i=new pp(this.top,[],s,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function rS(n,e){let t=e,s=t.children.length,i=n.childCount,r=new Map,o=[];e:for(;i>0;){let a;for(;;)if(s){let c=t.children[s-1];if(c instanceof is)t=c,s=c.children.length;else{a=c,s--;break}}else{if(t==e)break e;s=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=n.child(i-1))break;--i,r.set(a,i),o.push(a)}}return{index:i,matched:r,matches:o.reverse()}}function oS(n,e){return n.type.side-e.type.side}function aS(n,e,t,s){let i=e.locals(n),r=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);s(d,i,e.forChild(r,d),c),r+=d.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let d,u;for(;o<i.length&&i[o].to==r;){let g=i[o++];g.widget&&(d?(u||(u=[d])).push(g):d=g)}if(d)if(u){u.sort(oS);for(let g=0;g<u.length;g++)t(u[g],c,!!l)}else t(d,c,!!l);let h,f;if(l)f=-1,h=l,l=null;else if(c<n.childCount)f=c,h=n.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=r&&a.splice(g--,1);for(;o<i.length&&i[o].from<=r&&i[o].to>r;)a.push(i[o++]);let p=r+h.nodeSize;if(h.isText){let g=p;o<i.length&&i[o].from<g&&(g=i[o].from);for(let b=0;b<a.length;b++)a[b].to<g&&(g=a[b].to);g<p&&(l=h.cut(g-r),h=h.cut(0,g-r),p=g,f=-1)}else for(;o<i.length&&i[o].to<p;)o++;let m=h.isInline&&!h.isLeaf?a.filter(g=>!g.inline):a.slice();s(h,m,e.forChild(r,h),f),r=p}}function lS(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function cS(n,e,t,s){for(let i=0,r=0;i<n.childCount&&r<=s;){let o=n.child(i++),a=r;if(r+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<n.childCount;){let c=n.child(i++);if(r+=c.nodeSize,!c.isText)break;l+=c.text}if(r>=t){if(r>=s&&l.slice(s-e.length-a,s-a)==e)return s-e.length;let c=a<s?l.lastIndexOf(e,s-a-1):-1;if(c>=0&&c+e.length+a>=t)return a+c;if(t==s&&l.length>=s+e.length-a&&l.slice(s-a,s-a+e.length)==e)return s}}return-1}function xa(n,e,t,s,i){let r=[];for(let o=0,a=0;o<n.length;o++){let l=n[o],c=a,d=a+=l.size;c>=t||d<=e?r.push(l):(c<e&&r.push(l.slice(0,e-c,s)),i&&(r.push(i),i=void 0),d>t&&r.push(l.slice(t-c,l.size,s)))}return r}function tl(n,e=null){let t=n.domSelectionRange(),s=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),r=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=s.resolve(o),l,c;if(Jr(t)){for(l=o;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&L.isSelectable(u)&&i.parent&&!(u.isInline&&zv(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;c=new L(o==h?a:s.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let u=o,h=o;for(let f=0;f<t.rangeCount;f++){let p=t.getRangeAt(f);u=Math.min(u,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(u<0)return null;[l,o]=h==n.state.selection.anchor?[h,u]:[u,h],a=s.resolve(o)}else l=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let d=s.resolve(l);if(!c){let u=e=="pointer"||n.state.selection.head<a.pos&&!r?1:-1;c=nl(n,d,a,u)}return c}function bp(n){return n.editable?n.hasFocus():_p(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function rn(n,e=!1){let t=n.state.selection;if(xp(n,t),!!bp(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Ae){let s=n.domSelectionRange(),i=n.domObserver.currentSelection;if(s.anchorNode&&i.anchorNode&&ss(s.anchorNode,s.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)uS(n);else{let{anchor:s,head:i}=t,r,o;Fc&&!(t instanceof $)&&(t.$from.parent.inlineContent||(r=Wc(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=Wc(n,t.to))),n.docView.setSelection(s,i,n,e),Fc&&(r&&$c(r),o&&$c(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&dS(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Fc=je||Ae&&rp<63;function Wc(n,e){let{node:t,offset:s}=n.docView.domFromPos(e,0),i=s<t.childNodes.length?t.childNodes[s]:null,r=s?t.childNodes[s-1]:null;if(je&&i&&i.contentEditable=="false")return Po(i);if((!i||i.contentEditable=="false")&&(!r||r.contentEditable=="false")){if(i)return Po(i);if(r)return Po(r)}}function Po(n){return n.contentEditable="true",je&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function $c(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function dS(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),s=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=s||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!bp(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function uS(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,s=t.nodeName=="IMG";s?e.collapse(t.parentNode,Ne(t)+1):e.collapse(t,0),!s&&!n.state.selection.visible&&Xe&&wn<=11&&(t.disabled=!0,t.disabled=!1)}function xp(n,e){if(e instanceof L){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Hc(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Hc(n)}function Hc(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function nl(n,e,t,s){return n.someProp("createSelectionBetween",i=>i(n,e,t))||$.between(e,t,s)}function Vc(n){return n.editable&&!n.hasFocus()?!1:_p(n)}function _p(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function hS(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return ss(e.node,e.offset,t.anchorNode,t.anchorOffset)}function _a(n,e){let{$anchor:t,$head:s}=n.selection,i=e>0?t.max(s):t.min(s),r=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return r&&q.findFrom(r,e)}function dn(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Yc(n,e,t){let s=n.state.selection;if(s instanceof $)if(t.indexOf("s")>-1){let{$head:i}=s,r=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!r||r.isText||!r.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+r.nodeSize*(e<0?-1:1));return dn(n,new $(s.$anchor,o))}else if(s.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=_a(n.state,e);return i&&i instanceof L?dn(n,i):!1}else if(!(pt&&t.indexOf("m")>-1)){let i=s.$head,r=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!r||r.isText)return!1;let a=e<0?i.pos-r.nodeSize:i.pos;return r.isAtom||(o=n.docView.descAt(a))&&!o.contentDOM?L.isSelectable(r)?dn(n,new L(e<0?n.state.doc.resolve(i.pos-r.nodeSize):i)):Bi?dn(n,new $(n.state.doc.resolve(e<0?a:a+r.nodeSize))):!1:!1}}else return!1;else{if(s instanceof L&&s.node.isInline)return dn(n,new $(e>0?s.$to:s.$from));{let i=_a(n.state,e);return i?dn(n,i):!1}}}function Sr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function di(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function ps(n,e){return e<0?fS(n):pS(n)}function fS(n){let e=n.domSelectionRange(),t=e.focusNode,s=e.focusOffset;if(!t)return;let i,r,o=!1;for(xt&&t.nodeType==1&&s<Sr(t)&&di(t.childNodes[s],-1)&&(o=!0);;)if(s>0){if(t.nodeType!=1)break;{let a=t.childNodes[s-1];if(di(a,-1))i=t,r=--s;else if(a.nodeType==3)t=a,s=t.nodeValue.length;else break}}else{if(kp(t))break;{let a=t.previousSibling;for(;a&&di(a,-1);)i=t.parentNode,r=Ne(a),a=a.previousSibling;if(a)t=a,s=Sr(t);else{if(t=t.parentNode,t==n.dom)break;s=0}}}o?ka(n,t,s):i&&ka(n,i,r)}function pS(n){let e=n.domSelectionRange(),t=e.focusNode,s=e.focusOffset;if(!t)return;let i=Sr(t),r,o;for(;;)if(s<i){if(t.nodeType!=1)break;let a=t.childNodes[s];if(di(a,1))r=t,o=++s;else break}else{if(kp(t))break;{let a=t.nextSibling;for(;a&&di(a,1);)r=a.parentNode,o=Ne(a)+1,a=a.nextSibling;if(a)t=a,s=0,i=Sr(t);else{if(t=t.parentNode,t==n.dom)break;s=i=0}}}r&&ka(n,r,o)}function kp(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function mS(n,e){for(;n&&e==n.childNodes.length&&!zi(n);)e=Ne(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function gS(n,e){for(;n&&!e&&!zi(n);)e=Ne(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function ka(n,e,t){if(e.nodeType!=3){let r,o;(o=mS(e,t))?(e=o,t=0):(r=gS(e,t))&&(e=r,t=r.nodeValue.length)}let s=n.domSelection();if(!s)return;if(Jr(s)){let r=document.createRange();r.setEnd(e,t),r.setStart(e,t),s.removeAllRanges(),s.addRange(r)}else s.extend&&s.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&rn(n)},50)}function qc(n,e){let t=n.state.doc.resolve(e);if(!(Ae||op)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let r=n.coordsAtPos(e-1),o=(r.top+r.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(r.left-i.left)>1)return r.left<i.left?"ltr":"rtl"}if(e<t.end()){let r=n.coordsAtPos(e+1),o=(r.top+r.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(r.left-i.left)>1)return r.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Kc(n,e,t){let s=n.state.selection;if(s instanceof $&&!s.empty||t.indexOf("s")>-1||pt&&t.indexOf("m")>-1)return!1;let{$from:i,$to:r}=s;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=_a(n.state,e);if(o&&o instanceof L)return dn(n,o)}if(!i.parent.inlineContent){let o=e<0?i:r,a=s instanceof ct?q.near(o,e):q.findFrom(o,e);return a?dn(n,a):!1}return!1}function Uc(n,e){if(!(n.state.selection instanceof $))return!0;let{$head:t,$anchor:s,empty:i}=n.state.selection;if(!t.sameParent(s))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let r=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(r&&!r.isText){let o=n.state.tr;return e<0?o.delete(t.pos-r.nodeSize,t.pos):o.delete(t.pos,t.pos+r.nodeSize),n.dispatch(o),!0}return!1}function Jc(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function yS(n){if(!je||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let s=e.firstChild;Jc(n,s,"true"),setTimeout(()=>Jc(n,s,"false"),20)}return!1}function bS(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function xS(n,e){let t=e.keyCode,s=bS(e);if(t==8||pt&&t==72&&s=="c")return Uc(n,-1)||ps(n,-1);if(t==46&&!e.shiftKey||pt&&t==68&&s=="c")return Uc(n,1)||ps(n,1);if(t==13||t==27)return!0;if(t==37||pt&&t==66&&s=="c"){let i=t==37?qc(n,n.state.selection.from)=="ltr"?-1:1:-1;return Yc(n,i,s)||ps(n,i)}else if(t==39||pt&&t==70&&s=="c"){let i=t==39?qc(n,n.state.selection.from)=="ltr"?1:-1:1;return Yc(n,i,s)||ps(n,i)}else{if(t==38||pt&&t==80&&s=="c")return Kc(n,-1,s)||ps(n,-1);if(t==40||pt&&t==78&&s=="c")return yS(n)||Kc(n,1,s)||ps(n,1);if(s==(pt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function sl(n,e){n.someProp("transformCopied",f=>{e=f(e,n)});let t=[],{content:s,openStart:i,openEnd:r}=e;for(;i>1&&r>1&&s.childCount==1&&s.firstChild.childCount==1;){i--,r--;let f=s.firstChild;t.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),s=f.content}let o=n.someProp("clipboardSerializer")||as.fromSchema(n.state.schema),a=Op(),l=a.createElement("div");l.appendChild(o.serializeFragment(s,{document:a}));let c=l.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=Cp[c.nodeName.toLowerCase()]);){for(let f=d.length-1;f>=0;f--){let p=a.createElement(d[f]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),u++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${r}${u?` -${u}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",f=>f(e,n))||e.content.textBetween(0,e.content.size,`
|
|
7
|
-
|
|
8
|
-
`);return{dom:l,text:h,slice:e}}function
|
|
9
|
-
`))),0,0),n.someProp("transformPasted",h=>{a=h(a,n,!0)}),a;let u=n.someProp("clipboardTextParser",h=>h(e,i,s,n));if(u)a=u;else{let h=i.marks(),{schema:f}=n.state,p=as.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(f.text(m,h)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),o=vS(t),Bi&&SS(o);let c=o&&o.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||kn.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||d),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!_S.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)a=MS(Gc(a,+d[1],+d[2]),d[4]);else if(a=I.maxOpen(kS(a.content,i),!0),a.openStart||a.openEnd){let u=0,h=0;for(let f=a.content.firstChild;u<a.openStart&&!f.type.spec.isolating;u++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=Gc(a,u,h)}return n.someProp("transformPasted",u=>{a=u(a,n,l)}),a}const _S=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function kS(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),r,o=[];if(n.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&r.length&&Sp(l,r,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Mp(o[o.length-1],r.length));let d=vp(a,l);o.push(d),i=i.matchType(d.type),r=l}}),o)return T.from(o)}return n}function vp(n,e,t=0){for(let s=e.length-1;s>=t;s--)n=e[s].create(null,T.from(n));return n}function Sp(n,e,t,s,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let r=Sp(n,e,t,s.lastChild,i+1);if(r)return s.copy(s.content.replaceChild(s.childCount-1,r));if(s.contentMatchAt(s.childCount).matchType(i==n.length-1?t.type:n[i+1]))return s.copy(s.content.append(T.from(vp(t,n,i+1))))}}function Mp(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Mp(n.lastChild,e-1)),s=n.contentMatchAt(n.childCount).fillBefore(T.empty,!0);return n.copy(t.append(s))}function wa(n,e,t,s,i,r){let o=e<0?n.firstChild:n.lastChild,a=o.content;return n.childCount>1&&(r=0),i<s-1&&(a=wa(a,e,t,s,i+1,r)),i>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,r<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(T.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(a))}function Gc(n,e,t){return e<n.openStart&&(n=new I(wa(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new I(wa(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Cp={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Xc=null;function Op(){return Xc||(Xc=document.implementation.createHTMLDocument("title"))}let Io=null;function wS(n){let e=window.trustedTypes;return e?(Io||(Io=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Io.createHTML(n)):n}function vS(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Op().createElement("div"),s=/<([a-z][^>\s]+)/i.exec(n),i;if((i=s&&Cp[s[1].toLowerCase()])&&(n=i.map(r=>"<"+r+">").join("")+n+i.map(r=>"</"+r+">").reverse().join("")),t.innerHTML=wS(n),i)for(let r=0;r<i.length;r++)t=t.querySelector(i[r])||t;return t}function SS(n){let e=n.querySelectorAll(Ae?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let s=e[t];s.childNodes.length==1&&s.textContent==" "&&s.parentNode&&s.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),s)}}function MS(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,s;try{s=JSON.parse(e)}catch{return n}let{content:i,openStart:r,openEnd:o}=n;for(let a=s.length-2;a>=0;a-=2){let l=t.nodes[s[a]];if(!l||l.hasRequiredAttrs())break;i=T.from(l.create(s[a+1],i)),r++,o++}return new I(i,r,o)}const We={},$e={},CS={touchstart:!0,touchmove:!0};class OS{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function DS(n){for(let e in We){let t=We[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=s=>{NS(n,s)&&!il(n,s)&&(n.editable||!(s.type in $e))&&t(n,s)},CS[e]?{passive:!0}:void 0)}je&&n.dom.addEventListener("input",()=>null),va(n)}function mn(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function TS(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function va(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=s=>il(n,s))})}function il(n,e){return n.someProp("handleDOMEvents",t=>{let s=t[e.type];return s?s(n,e)||e.defaultPrevented:!1})}function NS(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function ES(n,e){!il(n,e)&&We[e.type]&&(n.editable||!(e.type in $e))&&We[e.type](n,e)}$e.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Tp(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(tn&&Ae&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Ts&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let s=Date.now();n.input.lastIOSEnter=s,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==s&&(n.someProp("handleKeyDown",i=>i(n,Wn(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",s=>s(n,t))||xS(n,t)?t.preventDefault():mn(n,"key")};$e.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};$e.keypress=(n,e)=>{let t=e;if(Tp(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||pt&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let s=n.state.selection;if(!(s instanceof $)||!s.$from.sameParent(s.$to)){let i=String.fromCharCode(t.charCode),r=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,s.$from.pos,s.$to.pos,i,r))&&n.dispatch(r()),t.preventDefault()}};function Xr(n){return{left:n.clientX,top:n.clientY}}function AS(n,e){let t=e.x-n.clientX,s=e.y-n.clientY;return t*t+s*s<100}function rl(n,e,t,s,i){if(s==-1)return!1;let r=n.state.doc.resolve(s);for(let o=r.depth+1;o>0;o--)if(n.someProp(e,a=>o>r.depth?a(n,t,r.nodeAfter,r.before(o),i,!0):a(n,t,r.node(o),r.before(o),i,!1)))return!0;return!1}function vs(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let s=n.state.tr.setSelection(e);s.setMeta("pointer",!0),n.dispatch(s)}function PS(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),s=t.nodeAfter;return s&&s.isAtom&&L.isSelectable(s)?(vs(n,new L(t)),!0):!1}function IS(n,e){if(e==-1)return!1;let t=n.state.selection,s,i;t instanceof L&&(s=t.node);let r=n.state.doc.resolve(e);for(let o=r.depth+1;o>0;o--){let a=o>r.depth?r.nodeAfter:r.node(o);if(L.isSelectable(a)){s&&t.$from.depth>0&&o>=t.$from.depth&&r.before(t.$from.depth+1)==t.$from.pos?i=r.before(t.$from.depth):i=r.before(o);break}}return i!=null?(vs(n,L.create(n.state.doc,i)),!0):!1}function RS(n,e,t,s,i){return rl(n,"handleClickOn",e,t,s)||n.someProp("handleClick",r=>r(n,e,s))||(i?IS(n,t):PS(n,t))}function zS(n,e,t,s){return rl(n,"handleDoubleClickOn",e,t,s)||n.someProp("handleDoubleClick",i=>i(n,e,s))}function BS(n,e,t,s){return rl(n,"handleTripleClickOn",e,t,s)||n.someProp("handleTripleClick",i=>i(n,e,s))||jS(n,t,s)}function jS(n,e,t){if(t.button!=0)return!1;let s=n.state.doc;if(e==-1)return s.inlineContent?(vs(n,$.create(s,0,s.content.size)),!0):!1;let i=s.resolve(e);for(let r=i.depth+1;r>0;r--){let o=r>i.depth?i.nodeAfter:i.node(r),a=i.before(r);if(o.inlineContent)vs(n,$.create(s,a+1,a+1+o.content.size));else if(L.isSelectable(o))vs(n,L.create(s,a));else continue;return!0}}function ol(n){return Mr(n)}const Dp=pt?"metaKey":"ctrlKey";We.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let s=ol(n),i=Date.now(),r="singleClick";i-n.input.lastClick.time<500&&AS(t,n.input.lastClick)&&!t[Dp]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?r="doubleClick":n.input.lastClick.type=="doubleClick"&&(r="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:r,button:t.button};let o=n.posAtCoords(Xr(t));o&&(r=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new LS(n,o,t,!!s)):(r=="doubleClick"?zS:BS)(n,o.pos,o.inside,t)?t.preventDefault():mn(n,"pointer"))};class LS{constructor(e,t,s,i){this.view=e,this.pos=t,this.event=s,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!s[Dp],this.allowDefault=s.shiftKey;let r,o;if(t.inside>-1)r=e.state.doc.nodeAt(t.inside),o=t.inside;else{let d=e.state.doc.resolve(t.pos);r=d.parent,o=d.depth?d.before():0}const a=i?null:s.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(s.button==0&&r.type.spec.draggable&&r.type.spec.selectable!==!1||c instanceof L&&c.from<=o&&c.to>o)&&(this.mightDrag={node:r,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&xt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),mn(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>rn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Xr(e))),this.updateAllowDefault(e),this.allowDefault||!t?mn(this.view,"pointer"):RS(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||je&&this.mightDrag&&!this.mightDrag.node.isAtom||Ae&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(vs(this.view,q.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):mn(this.view,"pointer")}move(e){this.updateAllowDefault(e),mn(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}We.touchstart=n=>{n.input.lastTouch=Date.now(),ol(n),mn(n,"pointer")};We.touchmove=n=>{n.input.lastTouch=Date.now(),mn(n,"pointer")};We.contextmenu=n=>ol(n);function Tp(n,e){return n.composing?!0:je&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const FS=tn?5e3:-1;$e.compositionstart=$e.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof $&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(s=>s.type.spec.inclusive===!1)||Ae&&op&&WS(n)))n.markCursor=n.state.storedMarks||t.marks(),Mr(n,!0),n.markCursor=null;else if(Mr(n,!e.selection.empty),xt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let s=n.domSelectionRange();for(let i=s.focusNode,r=s.focusOffset;i&&i.nodeType==1&&r!=0;){let o=r<0?i.lastChild:i.childNodes[r-1];if(!o)break;if(o.nodeType==3){let a=n.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,r=-1}}n.input.composing=!0}Np(n,FS)};function WS(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let s=e.childNodes[t];return s.nodeType==1&&s.contentEditable=="false"}$e.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Np(n,20))};function Np(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Mr(n),e))}function Ep(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=HS());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function $S(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Iv(e.focusNode,e.focusOffset),s=Rv(e.focusNode,e.focusOffset);if(t&&s&&t!=s){let i=s.pmViewDesc,r=n.domObserver.lastChangedTextNode;if(t==r||s==r)return r;if(!i||!i.isText(s.nodeValue))return s;if(n.input.compositionNode==s){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return s}}return t||s}function HS(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Mr(n,e=!1){if(!(tn&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Ep(n),e||n.docView&&n.docView.dirty){let t=tl(n),s=n.state.selection;return t&&!t.eq(s)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!s.$from.node(s.$from.sharedDepth(s.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function VS(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let s=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),s.removeAllRanges(),s.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const wi=Xe&&wn<15||Ts&&Lv<604;We.copy=$e.cut=(n,e)=>{let t=e,s=n.state.selection,i=t.type=="cut";if(s.empty)return;let r=wi?null:t.clipboardData,o=s.content(),{dom:a,text:l}=sl(n,o);r?(t.preventDefault(),r.clearData(),r.setData("text/html",a.innerHTML),r.setData("text/plain",l)):VS(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function YS(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function qS(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,s=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(s.contentEditable="true"),s.style.cssText="position: fixed; left: -10000px; top: 10px",s.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),s.parentNode&&s.parentNode.removeChild(s),t?vi(n,s.value,null,i,e):vi(n,s.textContent,s.innerHTML,i,e)},50)}function vi(n,e,t,s,i){let r=wp(n,e,t,s,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,i,r||I.empty)))return!0;if(!r)return!1;let o=YS(r),a=o?n.state.tr.replaceSelectionWith(o,s):n.state.tr.replaceSelection(r);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Ap(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}$e.paste=(n,e)=>{let t=e;if(n.composing&&!tn)return;let s=wi?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;s&&vi(n,Ap(s),s.getData("text/html"),i,t)?t.preventDefault():qS(n,t)};class Pp{constructor(e,t,s){this.slice=e,this.move=t,this.node=s}}const KS=pt?"altKey":"ctrlKey";function Ip(n,e){let t=n.someProp("dragCopies",s=>!s(e));return t??!e[KS]}We.dragstart=(n,e)=>{let t=e,s=n.input.mouseDown;if(s&&s.done(),!t.dataTransfer)return;let i=n.state.selection,r=i.empty?null:n.posAtCoords(Xr(t)),o;if(!(r&&r.pos>=i.from&&r.pos<=(i instanceof L?i.to-1:i.to))){if(s&&s.mightDrag)o=L.create(n.state.doc,s.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(o=L.create(n.state.doc,u.posBefore))}}let a=(o||n.state.selection).content(),{dom:l,text:c,slice:d}=sl(n,a);(!t.dataTransfer.files.length||!Ae||rp>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(wi?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",wi||t.dataTransfer.setData("text/plain",c),n.dragging=new Pp(d,Ip(n,t),o)};We.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};$e.dragover=$e.dragenter=(n,e)=>e.preventDefault();$e.drop=(n,e)=>{try{US(n,e,n.dragging)}finally{n.dragging=null}};function US(n,e,t){if(!e.dataTransfer)return;let s=n.posAtCoords(Xr(e));if(!s)return;let i=n.state.doc.resolve(s.pos),r=t&&t.slice;r?n.someProp("transformPasted",f=>{r=f(r,n,!1)}):r=wp(n,Ap(e.dataTransfer),wi?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(t&&Ip(n,e));if(n.someProp("handleDrop",f=>f(n,e,r||I.empty,o))){e.preventDefault();return}if(!r)return;e.preventDefault();let a=r?Xf(n.state.doc,i.pos,r):i.pos;a==null&&(a=i.pos);let l=n.state.tr;if(o){let{node:f}=t;f?f.replace(l):l.deleteSelection()}let c=l.mapping.map(a),d=r.openStart==0&&r.openEnd==0&&r.content.childCount==1,u=l.doc;if(d?l.replaceRangeWith(c,c,r.content.firstChild):l.replaceRange(c,c,r),l.doc.eq(u))return;let h=l.doc.resolve(c);if(d&&L.isSelectable(r.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(r.content.firstChild))l.setSelection(new L(h));else{let f=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((p,m,g,b)=>f=b),l.setSelection(nl(n,h,l.doc.resolve(f)))}n.focus(),n.dispatch(l.setMeta("uiEvent","drop"))}We.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&rn(n)},20))};We.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};We.beforeinput=(n,e)=>{if(Ae&&tn&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:s}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=s||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",r=>r(n,Wn(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in $e)We[n]=$e[n];function Si(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Cr{constructor(e,t){this.toDOM=e,this.spec=t||Gn,this.side=this.spec.side||0}map(e,t,s,i){let{pos:r,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new yt(r-s,r-s,this)}valid(){return!0}eq(e){return this==e||e instanceof Cr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Si(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Sn{constructor(e,t){this.attrs=e,this.spec=t||Gn}map(e,t,s,i){let r=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-s,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-s;return r>=o?null:new yt(r,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Sn&&Si(this.attrs,e.attrs)&&Si(this.spec,e.spec)}static is(e){return e.type instanceof Sn}destroy(){}}class al{constructor(e,t){this.attrs=e,this.spec=t||Gn}map(e,t,s,i){let r=e.mapResult(t.from+i,1);if(r.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=r.pos?null:new yt(r.pos-s,o.pos-s,this)}valid(e,t){let{index:s,offset:i}=e.content.findIndex(t.from),r;return i==t.from&&!(r=e.child(s)).isText&&i+r.nodeSize==t.to}eq(e){return this==e||e instanceof al&&Si(this.attrs,e.attrs)&&Si(this.spec,e.spec)}destroy(){}}class yt{constructor(e,t,s){this.from=e,this.to=t,this.type=s}copy(e,t){return new yt(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,s){return this.type.map(e,this,t,s)}static widget(e,t,s){return new yt(e,e,new Cr(t,s))}static inline(e,t,s,i){return new yt(e,t,new Sn(s,i))}static node(e,t,s,i){return new yt(e,t,new al(s,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Sn}get widget(){return this.type instanceof Cr}}const xs=[],Gn={};class xe{constructor(e,t){this.local=e.length?e:xs,this.children=t.length?t:xs}static create(e,t){return t.length?Or(t,e,0,Gn):Re}find(e,t,s){let i=[];return this.findInner(e??0,t??1e9,i,0,s),i}findInner(e,t,s,i,r){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!r||r(a.spec))&&s.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,s,i+a,r)}}map(e,t,s){return this==Re||e.maps.length==0?this:this.mapInner(e,t,0,0,s||Gn)}mapInner(e,t,s,i,r){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,s,i);l&&l.type.valid(t,l)?(o||(o=[])).push(l):r.onRemove&&r.onRemove(this.local[a].spec)}return this.children.length?JS(this.children,o||[],e,t,s,i,r):o?new xe(o.sort(Xn),xs):Re}add(e,t){return t.length?this==Re?xe.create(e,t):this.addInner(e,t,0):this}addInner(e,t,s){let i,r=0;e.forEach((a,l)=>{let c=l+s,d;if(d=zp(t,a,c)){for(i||(i=this.children.slice());r<i.length&&i[r]<l;)r+=3;i[r]==l?i[r+2]=i[r+2].addInner(a,d,c+1):i.splice(r,0,l,l+a.nodeSize,Or(d,a,c+1,Gn)),r+=3}});let o=Rp(r?Bp(t):t,-s);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new xe(o.length?this.local.concat(o).sort(Xn):this.local,i||this.children)}remove(e){return e.length==0||this==Re?this:this.removeInner(e,0)}removeInner(e,t){let s=this.children,i=this.local;for(let r=0;r<s.length;r+=3){let o,a=s[r]+t,l=s[r+1]+t;for(let d=0,u;d<e.length;d++)(u=e[d])&&u.from>a&&u.to<l&&(e[d]=null,(o||(o=[])).push(u));if(!o)continue;s==this.children&&(s=this.children.slice());let c=s[r+2].removeInner(o,a+1);c!=Re?s[r+2]=c:(s.splice(r,3),r-=3)}if(i.length){for(let r=0,o;r<e.length;r++)if(o=e[r])for(let a=0;a<i.length;a++)i[a].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return s==this.children&&i==this.local?this:i.length||s.length?new xe(i,s):Re}forChild(e,t){if(this==Re)return this;if(t.isLeaf)return xe.empty;let s,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(s=this.children[a+2]);break}let r=e+1,o=r+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>r&&l.type instanceof Sn){let c=Math.max(r,l.from)-r,d=Math.min(o,l.to)-r;c<d&&(i||(i=[])).push(l.copy(c,d))}}if(i){let a=new xe(i.sort(Xn),xs);return s?new hn([a,s]):a}return s||Re}eq(e){if(this==e)return!0;if(!(e instanceof xe)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return ll(this.localsInner(e))}localsInner(e){if(this==Re)return xs;if(e.inlineContent||!this.local.some(Sn.is))return this.local;let t=[];for(let s=0;s<this.local.length;s++)this.local[s].type instanceof Sn||t.push(this.local[s]);return t}forEachSet(e){e(this)}}xe.empty=new xe([],[]);xe.removeOverlap=ll;const Re=xe.empty;class hn{constructor(e){this.members=e}map(e,t){const s=this.members.map(i=>i.map(e,t,Gn));return hn.from(s)}forChild(e,t){if(t.isLeaf)return xe.empty;let s=[];for(let i=0;i<this.members.length;i++){let r=this.members[i].forChild(e,t);r!=Re&&(r instanceof hn?s=s.concat(r.members):s.push(r))}return hn.from(s)}eq(e){if(!(e instanceof hn)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,s=!0;for(let i=0;i<this.members.length;i++){let r=this.members[i].localsInner(e);if(r.length)if(!t)t=r;else{s&&(t=t.slice(),s=!1);for(let o=0;o<r.length;o++)t.push(r[o])}}return t?ll(s?t:t.sort(Xn)):xs}static from(e){switch(e.length){case 0:return Re;case 1:return e[0];default:return new hn(e.every(t=>t instanceof xe)?e:e.reduce((t,s)=>t.concat(s instanceof xe?s:s.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function JS(n,e,t,s,i,r,o){let a=n.slice();for(let c=0,d=r;c<t.maps.length;c++){let u=0;t.maps[c].forEach((h,f,p,m)=>{let g=m-p-(f-h);for(let b=0;b<a.length;b+=3){let S=a[b+1];if(S<0||h>S+d-u)continue;let _=a[b]+d-u;f>=_?a[b+1]=h<=_?-2:-1:h>=d&&g&&(a[b]+=g,a[b+1]+=g)}u+=g}),d=t.maps[c].map(d,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let d=t.map(n[c]+r),u=d-i;if(u<0||u>=s.content.size){l=!0;continue}let h=t.map(n[c+1]+r,-1),f=h-i,{index:p,offset:m}=s.content.findIndex(u),g=s.maybeChild(p);if(g&&m==u&&m+g.nodeSize==f){let b=a[c+2].mapInner(t,g,d+1,n[c]+r+1,o);b!=Re?(a[c]=u,a[c+1]=f,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=GS(a,n,e,t,i,r,o),d=Or(c,s,0,o);e=d.local;for(let u=0;u<a.length;u+=3)a[u+1]<0&&(a.splice(u,3),u-=3);for(let u=0,h=0;u<d.children.length;u+=3){let f=d.children[u];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,d.children[u],d.children[u+1],d.children[u+2])}}return new xe(e.sort(Xn),a)}function Rp(n,e){if(!e||!n.length)return n;let t=[];for(let s=0;s<n.length;s++){let i=n[s];t.push(new yt(i.from+e,i.to+e,i.type))}return t}function GS(n,e,t,s,i,r,o){function a(l,c){for(let d=0;d<l.local.length;d++){let u=l.local[d].map(s,i,c);u?t.push(u):o.onRemove&&o.onRemove(l.local[d].spec)}for(let d=0;d<l.children.length;d+=3)a(l.children[d+2],l.children[d]+c+1)}for(let l=0;l<n.length;l+=3)n[l+1]==-1&&a(n[l+2],e[l]+r+1);return t}function zp(n,e,t){if(e.isLeaf)return null;let s=t+e.nodeSize,i=null;for(let r=0,o;r<n.length;r++)(o=n[r])&&o.from>t&&o.to<s&&((i||(i=[])).push(o),n[r]=null);return i}function Bp(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Or(n,e,t,s){let i=[],r=!1;e.forEach((a,l)=>{let c=zp(n,a,l+t);if(c){r=!0;let d=Or(c,a,t+l+1,s);d!=Re&&i.push(l,l+a.nodeSize,d)}});let o=Rp(r?Bp(n):n,-t).sort(Xn);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(s.onRemove&&s.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new xe(o,i):Re}function Xn(n,e){return n.from-e.from||n.to-e.to}function ll(n){let e=n;for(let t=0;t<e.length-1;t++){let s=e[t];if(s.from!=s.to)for(let i=t+1;i<e.length;i++){let r=e[i];if(r.from==s.from){r.to!=s.to&&(e==n&&(e=n.slice()),e[i]=r.copy(r.from,s.to),Qc(e,i+1,r.copy(s.to,r.to)));continue}else{r.from<s.to&&(e==n&&(e=n.slice()),e[t]=s.copy(s.from,r.from),Qc(e,i,s.copy(r.from,s.to)));break}}}return e}function Qc(n,e,t){for(;e<n.length&&Xn(t,n[e])>0;)e++;n.splice(e,0,t)}function Ro(n){let e=[];return n.someProp("decorations",t=>{let s=t(n.state);s&&s!=Re&&e.push(s)}),n.cursorWrapper&&e.push(xe.create(n.state.doc,[n.cursorWrapper.deco])),hn.from(e)}const XS={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},QS=Xe&&wn<=11;class ZS{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class eM{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ZS,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(s=>{for(let i=0;i<s.length;i++)this.queue.push(s[i]);Xe&&wn<=11&&s.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():je&&e.composing&&s.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),QS&&(this.onCharData=s=>{this.queue.push({target:s.target,type:"characterData",oldValue:s.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,XS)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Vc(this.view)){if(this.suppressingSelectionUpdates)return rn(this.view);if(Xe&&wn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ss(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,s;for(let r=e.focusNode;r;r=Ds(r))t.add(r);for(let r=e.anchorNode;r;r=Ds(r))if(t.has(r)){s=r;break}let i=s&&this.view.docView.nearestDesc(s);if(i&&i.ignoreMutation({type:"selection",target:s.nodeType==3?s.parentNode:s}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let s=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(s)&&Vc(e)&&!this.ignoreSelectionChange(s),r=-1,o=-1,a=!1,l=[];if(e.editable)for(let d=0;d<t.length;d++){let u=this.registerMutation(t[d],l);u&&(r=r<0?u.from:Math.min(u.from,r),o=o<0?u.to:Math.max(u.to,o),u.typeOver&&(a=!0))}if(l.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of l)if(d.nodeName=="BR"&&d.parentNode){let u=d.nextSibling;u&&u.nodeType==1&&u.contentEditable=="false"&&d.parentNode.removeChild(d)}}else if(xt&&l.length){let d=l.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,h]=d;u.parentNode&&u.parentNode.parentNode==h.parentNode?h.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let h of d){let f=h.parentNode;f&&f.nodeName=="LI"&&(!u||sM(e,u)!=f)&&h.remove()}}}let c=null;r<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Jr(s)&&(c=tl(e))&&c.eq(q.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,rn(e),this.currentSelection.set(s),e.scrollToSelection()):(r>-1||i)&&(r>-1&&(e.docView.markDirty(r,o),tM(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,iM(e,l)),this.handleDOMChange(r,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(s)||rn(e),this.currentSelection.set(s))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let s=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(s==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!s||s.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let u=e.addedNodes[d];t.push(u),u.nodeType==3&&(this.lastChangedTextNode=u)}if(s.contentDOM&&s.contentDOM!=s.dom&&!s.contentDOM.contains(e.target))return{from:s.posBefore,to:s.posAfter};let i=e.previousSibling,r=e.nextSibling;if(Xe&&wn<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:u,nextSibling:h}=e.addedNodes[d];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(i=u),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(r=h)}let o=i&&i.parentNode==e.target?Ne(i)+1:0,a=s.localPosFromDOM(e.target,o,-1),l=r&&r.parentNode==e.target?Ne(r):e.target.childNodes.length,c=s.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:s.posAtStart-s.border,to:s.posAtEnd+s.border}:(this.lastChangedTextNode=e.target,{from:s.posAtStart,to:s.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Zc=new WeakMap,ed=!1;function tM(n){if(!Zc.has(n)&&(Zc.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=xt,ed)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),ed=!0}}function td(n,e){let t=e.startContainer,s=e.startOffset,i=e.endContainer,r=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return ss(o.node,o.offset,i,r)&&([t,s,i,r]=[i,r,t,s]),{anchorNode:t,anchorOffset:s,focusNode:i,focusOffset:r}}function nM(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return td(n,i)}let t;function s(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",s,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",s,!0),t?td(n,t):null}function sM(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let s=n.docView.nearestDesc(t,!0);if(s&&s.node.isBlock)return t}return null}function iM(n,e){var t;let{focusNode:s,focusOffset:i}=n.domSelectionRange();for(let r of e)if(((t=r.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let o=r.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(r,a.firstChild),s==r&&n.domSelection().collapse(r,i)}else r.parentNode.removeChild(r)}}function rM(n,e,t){let{node:s,fromOffset:i,toOffset:r,from:o,to:a}=n.docView.parseRange(e,t),l=n.domSelectionRange(),c,d=l.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:l.anchorOffset}],Jr(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Ae&&n.input.lastKeyCode===8)for(let g=r;g>i;g--){let b=s.childNodes[g-1],S=b.pmViewDesc;if(b.nodeName=="BR"&&!S){r=g;break}if(!S||S.size)break}let u=n.state.doc,h=n.someProp("domParser")||kn.fromSchema(n.state.schema),f=u.resolve(o),p=null,m=h.parse(s,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:r,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:oM,context:f});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),p={anchor:g+o,head:b+o}}return{doc:m,sel:p,from:o,to:a}}function oM(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(je&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||je&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const aM=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function lM(n,e,t,s,i){let r=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let M=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,C=tl(n,M);if(C&&!n.state.selection.eq(C)){if(Ae&&tn&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",D=>D(n,Wn(13,"Enter"))))return;let O=n.state.tr.setSelection(C);M=="pointer"?O.setMeta("pointer",!0):M=="key"&&O.scrollIntoView(),r&&O.setMeta("composition",r),n.dispatch(O)}return}let o=n.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=n.state.doc.resolve(t).after(a+1);let l=n.state.selection,c=rM(n,e,t),d=n.state.doc,u=d.slice(c.from,c.to),h,f;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,f="end"):(h=n.state.selection.from,f="start"),n.input.lastKeyCode=null;let p=uM(u.content,c.doc.content,c.from,h,f);if(p&&n.input.domChangeCount++,(Ts&&n.input.lastIOSEnter>Date.now()-225||tn)&&i.some(M=>M.nodeType==1&&!aM.test(M.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",M=>M(n,Wn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(s&&l instanceof $&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let M=nd(n,n.state.doc,c.sel);if(M&&!M.eq(n.state.selection)){let C=n.state.tr.setSelection(M);r&&C.setMeta("composition",r),n.dispatch(C)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof $&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),Xe&&wn<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),b=d.resolve(p.start),S=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA;if((Ts&&n.input.lastIOSEnter>Date.now()-225&&(!S||i.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!S&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(c.doc.textBetween(m.pos,g.pos,"","")))&&n.someProp("handleKeyDown",M=>M(n,Wn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&dM(d,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",M=>M(n,Wn(8,"Backspace")))){tn&&Ae&&n.domObserver.suppressSelectionUpdates();return}Ae&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),tn&&!S&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(M){return M(n,Wn(13,"Enter"))})},20));let _=p.start,k=p.endA,v=M=>{let C=M||n.state.tr.replace(_,k,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let O=nd(n,C.doc,c.sel);O&&!(Ae&&n.composing&&O.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(O.head==_||O.head==C.mapping.map(k)-1)||Xe&&O.empty&&O.head==_)&&C.setSelection(O)}return r&&C.setMeta("composition",r),C.scrollIntoView()},w;if(S)if(m.pos==g.pos){Xe&&wn<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>rn(n),20));let M=v(n.state.tr.delete(_,k)),C=d.resolve(p.start).marksAcross(d.resolve(p.endA));C&&M.ensureMarks(C),n.dispatch(M)}else if(p.endA==p.endB&&(w=cM(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let M=v(n.state.tr);w.type=="add"?M.addMark(_,k,w.mark):M.removeMark(_,k,w.mark),n.dispatch(M)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let M=m.parent.textBetween(m.parentOffset,g.parentOffset),C=()=>v(n.state.tr.insertText(M,_,k));n.someProp("handleTextInput",O=>O(n,_,k,M,C))||n.dispatch(C())}else n.dispatch(v());else n.dispatch(v())}function nd(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:nl(n,e.resolve(t.anchor),e.resolve(t.head))}function cM(n,e){let t=n.firstChild.marks,s=e.firstChild.marks,i=t,r=s,o,a,l;for(let d=0;d<s.length;d++)i=s[d].removeFromSet(i);for(let d=0;d<t.length;d++)r=t[d].removeFromSet(r);if(i.length==1&&r.length==0)a=i[0],o="add",l=d=>d.mark(a.addToSet(d.marks));else if(i.length==0&&r.length==1)a=r[0],o="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(l(e.child(d)));if(T.from(c).eq(n))return{mark:a,type:o}}function dM(n,e,t,s,i){if(t-e<=i.pos-s.pos||zo(s,!0,!1)<i.pos)return!1;let r=n.resolve(e);if(!s.parent.isTextblock){let a=r.nodeAfter;return a!=null&&t==e+a.nodeSize}if(r.parentOffset<r.parent.content.size||!r.parent.isTextblock)return!1;let o=n.resolve(zo(r,!0,!0));return!o.parent.isTextblock||o.pos>t||zo(o,!0,!1)<t?!1:s.parent.content.cut(s.parentOffset).eq(o.parent.content)}function zo(n,e,t){let s=n.depth,i=e?n.end():n.pos;for(;s>0&&(e||n.indexAfter(s)==n.node(s).childCount);)s--,i++,e=!1;if(t){let r=n.node(s).maybeChild(n.indexAfter(s));for(;r&&!r.isLeaf;)r=r.firstChild,i++}return i}function uM(n,e,t,s,i){let r=n.findDiffStart(e,t);if(r==null)return null;let{a:o,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let l=Math.max(0,r-Math.min(o,a));s-=o+l-r}if(o<r&&n.size<e.size){let l=s<=r&&s>=o?r-s:0;r-=l,r&&r<e.size&&sd(e.textBetween(r-1,r+1))&&(r+=l?1:-1),a=r+(a-o),o=r}else if(a<r){let l=s<=r&&s>=a?r-s:0;r-=l,r&&r<n.size&&sd(n.textBetween(r-1,r+1))&&(r+=l?1:-1),o=r+(o-a),a=r}return{start:r,endA:o,endB:a}}function sd(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class jp{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new OS,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(ld),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=od(this),rd(this),this.nodeViews=ad(this),this.docView=jc(this.state.doc,id(this),Ro(this),this.dom,this),this.domObserver=new eM(this,(s,i,r,o)=>lM(this,s,i,r,o)),this.domObserver.start(),DS(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&va(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ld),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let s in this._props)t[s]=this._props[s];t.state=this.state;for(let s in e)t[s]=e[s];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var s;let i=this.state,r=!1,o=!1;e.storedMarks&&this.composing&&(Ep(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=ad(this);fM(f,this.nodeViews)&&(this.nodeViews=f,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&va(this),this.editable=od(this),rd(this);let l=Ro(this),c=id(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",u=r||!this.docView.matchesNode(e.doc,c,l);(u||!e.selection.eq(i.selection))&&(o=!0);let h=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&$v(this);if(o){this.domObserver.stop();let f=u&&(Xe||Ae)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&hM(i.selection,e.selection);if(u){let p=Ae?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=$S(this)),(r||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=jc(e.doc,c,l,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&hS(this))?rn(this,f):(xp(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((s=this.dragging)===null||s===void 0)&&s.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&Hv(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof L){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Ac(this,t.getBoundingClientRect(),e)}else Ac(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let s=this.directPlugins[t];s.spec.view&&this.pluginViews.push(s.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let s=this.state.plugins[t];s.spec.view&&this.pluginViews.push(s.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let s=this.pluginViews[t];s.update&&s.update(this,e)}}updateDraggedNode(e,t){let s=e.node,i=-1;if(this.state.doc.nodeAt(s.from)==s.node)i=s.from;else{let r=s.from+(this.state.doc.content.size-t.doc.content.size);(r>0&&this.state.doc.nodeAt(r))==s.node&&(i=r)}this.dragging=new Pp(e.slice,e.move,i<0?void 0:L.create(this.state.doc,i))}someProp(e,t){let s=this._props&&this._props[e],i;if(s!=null&&(i=t?t(s):s))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=t?t(a):a))return i}let r=this.state.plugins;if(r)for(let o=0;o<r.length;o++){let a=r[o].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(Xe){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Vv(this.dom),rn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Jv(this,e)}coordsAtPos(e,t=1){return up(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,s=-1){let i=this.docView.posFromDOM(e,t,s);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return eS(this,t||this.state,e)}pasteHTML(e,t){return vi(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return vi(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return sl(this,e)}destroy(){this.docView&&(TS(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ro(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Av())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return ES(this,e)}domSelectionRange(){let e=this.domSelection();return e?je&&this.root.nodeType===11&&Bv(this.dom.ownerDocument)==this.dom&&nM(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}jp.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function id(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let s in t)s=="class"?e.class+=" "+t[s]:s=="style"?e.style=(e.style?e.style+";":"")+t[s]:!e[s]&&s!="contenteditable"&&s!="nodeName"&&(e[s]=String(t[s]))}),e.translate||(e.translate="no"),[yt.node(0,n.state.doc.content.size,e)]}function rd(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:yt.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function od(n){return!n.someProp("editable",e=>e(n.state)===!1)}function hM(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function ad(n){let e=Object.create(null);function t(s){for(let i in s)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=s[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function fM(n,e){let t=0,s=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)s++;return t!=s}function ld(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Cn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Dr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},pM=typeof navigator<"u"&&/Mac/.test(navigator.platform),mM=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ee=0;Ee<10;Ee++)Cn[48+Ee]=Cn[96+Ee]=String(Ee);for(var Ee=1;Ee<=24;Ee++)Cn[Ee+111]="F"+Ee;for(var Ee=65;Ee<=90;Ee++)Cn[Ee]=String.fromCharCode(Ee+32),Dr[Ee]=String.fromCharCode(Ee);for(var Bo in Cn)Dr.hasOwnProperty(Bo)||(Dr[Bo]=Cn[Bo]);function gM(n){var e=pM&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||mM&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Dr:Cn)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const yM=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),bM=typeof navigator<"u"&&/Win/.test(navigator.platform);function xM(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let s,i,r,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))s=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))r=!0;else if(/^mod$/i.test(l))yM?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return s&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),r&&(t="Shift-"+t),t}function _M(n){let e=Object.create(null);for(let t in n)e[xM(t)]=n[t];return e}function jo(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function kM(n){return new Ze({props:{handleKeyDown:Lp(n)}})}function Lp(n){let e=_M(n);return function(t,s){let i=gM(s),r,o=e[jo(i,s)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(s.shiftKey){let a=e[jo(i,s,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((s.altKey||s.metaKey||s.ctrlKey)&&!(bM&&s.ctrlKey&&s.altKey)&&(r=Cn[s.keyCode])&&r!=i){let a=e[jo(r,s)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}const cl=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Fp(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Wp=(n,e,t)=>{let s=Fp(n,t);if(!s)return!1;let i=dl(s);if(!i){let o=s.blockRange(),a=o&&Bs(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let r=i.nodeBefore;if(Gp(n,i,e,-1))return!0;if(s.parent.content.size==0&&(Ns(r,"end")||L.isSelectable(r)))for(let o=s.depth;;o--){let a=Kr(n.doc,s.before(o),s.after(o),I.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=n.tr.step(a);l.setSelection(Ns(r,"end")?q.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):L.create(l.doc,i.pos-r.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||s.node(o-1).childCount>1)break}return r.isAtom&&i.depth==s.depth-1?(e&&e(n.tr.delete(i.pos-r.nodeSize,i.pos).scrollIntoView()),!0):!1},wM=(n,e,t)=>{let s=Fp(n,t);if(!s)return!1;let i=dl(s);return i?$p(n,i,e):!1},vM=(n,e,t)=>{let s=Vp(n,t);if(!s)return!1;let i=ul(s);return i?$p(n,i,e):!1};function $p(n,e,t){let s=e.nodeBefore,i=s,r=e.pos-1;for(;!i.isTextblock;r--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let c=Kr(n.doc,r,l,I.empty);if(!c||c.from!=r||c instanceof ve&&c.slice.size>=l-r)return!1;if(t){let d=n.tr.step(c);d.setSelection($.create(d.doc,r)),t(d.scrollIntoView())}return!0}function Ns(n,e,t=!1){for(let s=n;s;s=e=="start"?s.firstChild:s.lastChild){if(s.isTextblock)return!0;if(t&&s.childCount!=1)return!1}return!1}const Hp=(n,e,t)=>{let{$head:s,empty:i}=n.selection,r=s;if(!i)return!1;if(s.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):s.parentOffset>0)return!1;r=dl(s)}let o=r&&r.nodeBefore;return!o||!L.isSelectable(o)?!1:(e&&e(n.tr.setSelection(L.create(n.doc,r.pos-o.nodeSize)).scrollIntoView()),!0)};function dl(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Vp(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Yp=(n,e,t)=>{let s=Vp(n,t);if(!s)return!1;let i=ul(s);if(!i)return!1;let r=i.nodeAfter;if(Gp(n,i,e,1))return!0;if(s.parent.content.size==0&&(Ns(r,"start")||L.isSelectable(r))){let o=Kr(n.doc,s.before(),s.after(),I.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=n.tr.step(o);a.setSelection(Ns(r,"start")?q.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):L.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return r.isAtom&&i.depth==s.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+r.nodeSize).scrollIntoView()),!0):!1},qp=(n,e,t)=>{let{$head:s,empty:i}=n.selection,r=s;if(!i)return!1;if(s.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):s.parentOffset<s.parent.content.size)return!1;r=ul(s)}let o=r&&r.nodeAfter;return!o||!L.isSelectable(o)?!1:(e&&e(n.tr.setSelection(L.create(n.doc,r.pos)).scrollIntoView()),!0)};function ul(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const SM=(n,e)=>{let t=n.selection,s=t instanceof L,i;if(s){if(t.node.isTextblock||!Tn(n.doc,t.from))return!1;i=t.from}else if(i=qr(n.doc,t.from,-1),i==null)return!1;if(e){let r=n.tr.join(i);s&&r.setSelection(L.create(r.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(r.scrollIntoView())}return!0},MM=(n,e)=>{let t=n.selection,s;if(t instanceof L){if(t.node.isTextblock||!Tn(n.doc,t.to))return!1;s=t.to}else if(s=qr(n.doc,t.to,1),s==null)return!1;return e&&e(n.tr.join(s).scrollIntoView()),!0},CM=(n,e)=>{let{$from:t,$to:s}=n.selection,i=t.blockRange(s),r=i&&Bs(i);return r==null?!1:(e&&e(n.tr.lift(i,r).scrollIntoView()),!0)},Kp=(n,e)=>{let{$head:t,$anchor:s}=n.selection;return!t.parent.type.spec.code||!t.sameParent(s)?!1:(e&&e(n.tr.insertText(`
|
|
10
|
-
`).scrollIntoView()),!0)};function hl(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const OM=(n,e)=>{let{$head:t,$anchor:s}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(s))return!1;let i=t.node(-1),r=t.indexAfter(-1),o=hl(i.contentMatchAt(r));if(!o||!i.canReplaceWith(r,r,o))return!1;if(e){let a=t.after(),l=n.tr.replaceWith(a,a,o.createAndFill());l.setSelection(q.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Up=(n,e)=>{let t=n.selection,{$from:s,$to:i}=t;if(t instanceof ct||s.parent.inlineContent||i.parent.inlineContent)return!1;let r=hl(i.parent.contentMatchAt(i.indexAfter()));if(!r||!r.isTextblock)return!1;if(e){let o=(!s.parentOffset&&i.index()<i.parent.childCount?s:i).pos,a=n.tr.insert(o,r.createAndFill());a.setSelection($.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Jp=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let r=t.before();if(sn(n.doc,r))return e&&e(n.tr.split(r).scrollIntoView()),!0}let s=t.blockRange(),i=s&&Bs(s);return i==null?!1:(e&&e(n.tr.lift(s,i).scrollIntoView()),!0)};function DM(n){return(e,t)=>{let{$from:s,$to:i}=e.selection;if(e.selection instanceof L&&e.selection.node.isBlock)return!s.parentOffset||!sn(e.doc,s.pos)?!1:(t&&t(e.tr.split(s.pos).scrollIntoView()),!0);if(!s.depth)return!1;let r=[],o,a,l=!1,c=!1;for(let f=s.depth;;f--)if(s.node(f).isBlock){l=s.end(f)==s.pos+(s.depth-f),c=s.start(f)==s.pos-(s.depth-f),a=hl(s.node(f-1).contentMatchAt(s.indexAfter(f-1))),r.unshift(l&&a?{type:a}:null),o=f;break}else{if(f==1)return!1;r.unshift(null)}let d=e.tr;(e.selection instanceof $||e.selection instanceof ct)&&d.deleteSelection();let u=d.mapping.map(s.pos),h=sn(d.doc,u,r.length,r);if(h||(r[0]=a?{type:a}:null,h=sn(d.doc,u,r.length,r)),!h)return!1;if(d.split(u,r.length,r),!l&&c&&s.node(o).type!=a){let f=d.mapping.map(s.before(o)),p=d.doc.resolve(f);a&&s.node(o-1).canReplaceWith(p.index(),p.index()+1,a)&&d.setNodeMarkup(d.mapping.map(s.before(o)),a)}return t&&t(d.scrollIntoView()),!0}}const TM=DM(),NM=(n,e)=>{let{$from:t,to:s}=n.selection,i,r=t.sharedDepth(s);return r==0?!1:(i=t.before(r),e&&e(n.tr.setSelection(L.create(n.doc,i))),!0)};function EM(n,e,t){let s=e.nodeBefore,i=e.nodeAfter,r=e.index();return!s||!i||!s.type.compatibleContent(i.type)?!1:!s.content.size&&e.parent.canReplace(r-1,r)?(t&&t(n.tr.delete(e.pos-s.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(r,r+1)||!(i.isTextblock||Tn(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Gp(n,e,t,s){let i=e.nodeBefore,r=e.nodeAfter,o,a,l=i.type.spec.isolating||r.type.spec.isolating;if(!l&&EM(n,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(r.type))&&a.matchType(o[0]||r.type).validEnd){if(t){let f=e.pos+r.nodeSize,p=T.empty;for(let b=o.length-1;b>=0;b--)p=T.from(o[b].create(null,p));p=T.from(i.copy(p));let m=n.tr.step(new Se(e.pos-1,f,e.pos,f,new I(p,1,0),o.length,!0)),g=m.doc.resolve(f+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Tn(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let d=r.type.spec.isolating||s>0&&l?null:q.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),h=u&&Bs(u);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(u,h).scrollIntoView()),!0;if(c&&Ns(r,"start",!0)&&Ns(i,"end")){let f=i,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let m=r,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(t){let b=T.empty;for(let _=p.length-1;_>=0;_--)b=T.from(p[_].copy(b));let S=n.tr.step(new Se(e.pos-p.length,e.pos+r.nodeSize,e.pos+g,e.pos+r.nodeSize-g,new I(b,p.length,0),0,!0));t(S.scrollIntoView())}return!0}}return!1}function Xp(n){return function(e,t){let s=e.selection,i=n<0?s.$from:s.$to,r=i.depth;for(;i.node(r).isInline;){if(!r)return!1;r--}return i.node(r).isTextblock?(t&&t(e.tr.setSelection($.create(e.doc,n<0?i.start(r):i.end(r)))),!0):!1}}const AM=Xp(-1),PM=Xp(1);function IM(n,e=null){return function(t,s){let{$from:i,$to:r}=t.selection,o=i.blockRange(r),a=o&&Qa(o,n,e);return a?(s&&s(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function cd(n,e=null){return function(t,s){let i=!1;for(let r=0;r<t.selection.ranges.length&&!i;r++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[r];t.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(n,e)))if(l.type==n)i=!0;else{let d=t.doc.resolve(c),u=d.index();i=d.parent.canReplaceWith(u,u+1,n)}})}if(!i)return!1;if(s){let r=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[o];r.setBlockType(a,l,n,e)}s(r.scrollIntoView())}return!0}}function fl(...n){return function(e,t,s){for(let i=0;i<n.length;i++)if(n[i](e,t,s))return!0;return!1}}fl(cl,Wp,Hp);fl(cl,Yp,qp);fl(Kp,Up,Jp,TM);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function RM(n,e=null){return function(t,s){let{$from:i,$to:r}=t.selection,o=i.blockRange(r);if(!o)return!1;let a=s?t.tr:null;return zM(a,o,n,e)?(s&&s(a.scrollIntoView()),!0):!1}}function zM(n,e,t,s=null){let i=!1,r=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);r=new kr(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new kr(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=Qa(r,t,s,e);return a?(n&&BM(n,e,a,i,t),!0):!1}function BM(n,e,t,s,i){let r=T.empty;for(let d=t.length-1;d>=0;d--)r=T.from(t[d].type.create(t[d].attrs,r));n.step(new Se(e.start-(s?2:0),e.end,e.start,e.end,new I(r,0,0),t.length,!0));let o=0;for(let d=0;d<t.length;d++)t[d].type==i&&(o=d+1);let a=t.length-o,l=e.start+t.length-(s?2:0),c=e.parent;for(let d=e.startIndex,u=e.endIndex,h=!0;d<u;d++,h=!1)!h&&sn(n.doc,l,a)&&(n.split(l,a),l+=2*a),l+=c.child(d).nodeSize;return n}function jM(n){return function(e,t){let{$from:s,$to:i}=e.selection,r=s.blockRange(i,o=>o.childCount>0&&o.firstChild.type==n);return r?t?s.node(r.depth-1).type==n?LM(e,t,n,r):FM(e,t,r):!0:!1}}function LM(n,e,t,s){let i=n.tr,r=s.end,o=s.$to.end(s.depth);r<o&&(i.step(new Se(r-1,o,r,o,new I(T.from(t.create(null,s.parent.copy())),1,0),1,!0)),s=new kr(i.doc.resolve(s.$from.pos),i.doc.resolve(o),s.depth));const a=Bs(s);if(a==null)return!1;i.lift(s,a);let l=i.doc.resolve(i.mapping.map(r,-1)-1);return Tn(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function FM(n,e,t){let s=n.tr,i=t.parent;for(let f=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)f-=i.child(p).nodeSize,s.delete(f-1,f+1);let r=s.doc.resolve(t.start),o=r.nodeAfter;if(s.mapping.map(t.end)!=t.start+r.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,c=r.node(-1),d=r.index(-1);if(!c.canReplace(d+(a?0:1),d+1,o.content.append(l?T.empty:T.from(i))))return!1;let u=r.pos,h=u+o.nodeSize;return s.step(new Se(u-(a?1:0),h+(l?1:0),u+1,h-1,new I((a?T.empty:T.from(i.copy(T.empty))).append(l?T.empty:T.from(i.copy(T.empty))),a?0:1,l?0:1),a?0:1)),e(s.scrollIntoView()),!0}function WM(n){return function(e,t){let{$from:s,$to:i}=e.selection,r=s.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!r)return!1;let o=r.startIndex;if(o==0)return!1;let a=r.parent,l=a.child(o-1);if(l.type!=n)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,d=T.from(c?n.create():null),u=new I(T.from(n.create(null,T.from(a.type.create(null,d)))),c?3:1,0),h=r.start,f=r.end;t(e.tr.step(new Se(h-(c?3:1),f,h,f,u,1,!0)).scrollIntoView())}return!0}}function Qr(n){const{state:e,transaction:t}=n;let{selection:s}=t,{doc:i}=t,{storedMarks:r}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return r},get selection(){return s},get doc(){return i},get tr(){return s=t.selection,i=t.doc,r=t.storedMarks,t}}}class Zr{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:s}=this,{view:i}=t,{tr:r}=s,o=this.buildProps(r);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...d)=>{const u=l(...d)(o);return!r.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(r),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:s,editor:i,state:r}=this,{view:o}=i,a=[],l=!!e,c=e||r.tr,d=()=>(!l&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),a.every(h=>h===!0)),u={...Object.fromEntries(Object.entries(s).map(([h,f])=>[h,(...m)=>{const g=this.buildProps(c,t),b=f(...m)(g);return a.push(b),u}])),run:d};return u}createCan(e){const{rawCommands:t,state:s}=this,i=!1,r=e||s.tr,o=this.buildProps(r,i);return{...Object.fromEntries(Object.entries(t).map(([l,c])=>[l,(...d)=>c(...d)({...o,dispatch:void 0})])),chain:()=>this.createChain(r,i)}}buildProps(e,t=!0){const{rawCommands:s,editor:i,state:r}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:Qr({state:r,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(s).map(([l,c])=>[l,(...d)=>c(...d)(a)]))}};return a}}class $M{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const s=this.callbacks[e];return s&&s.forEach(i=>i.apply(this,t)),this}off(e,t){const s=this.callbacks[e];return s&&(t?this.callbacks[e]=s.filter(i=>i!==t):delete this.callbacks[e]),this}once(e,t){const s=(...i)=>{this.off(e,s),t.apply(this,i)};return this.on(e,s)}removeAllListeners(){this.callbacks={}}}function z(n,e,t){return n.config[e]===void 0&&n.parent?z(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?z(n.parent,e,t):null}):n.config[e]}function eo(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),s=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:s}}function Qp(n){const e=[],{nodeExtensions:t,markExtensions:s}=eo(n),i=[...t,...s],r={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},l=z(o,"addGlobalAttributes",a);if(!l)return;l().forEach(d=>{d.types.forEach(u=>{Object.entries(d.attributes).forEach(([h,f])=>{e.push({type:u,name:h,attribute:{...r,...f}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=z(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([d,u])=>{const h={...r,...u};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:o.name,name:d,attribute:h})})}),e}function Oe(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function He(...n){return n.filter(e=>!!e).reduce((e,t)=>{const s={...e};return Object.entries(t).forEach(([i,r])=>{if(!s[i]){s[i]=r;return}if(i==="class"){const a=r?String(r).split(" "):[],l=s[i]?s[i].split(" "):[],c=a.filter(d=>!l.includes(d));s[i]=[...l,...c].join(" ")}else if(i==="style"){const a=r?r.split(";").map(d=>d.trim()).filter(Boolean):[],l=s[i]?s[i].split(";").map(d=>d.trim()).filter(Boolean):[],c=new Map;l.forEach(d=>{const[u,h]=d.split(":").map(f=>f.trim());c.set(u,h)}),a.forEach(d=>{const[u,h]=d.split(":").map(f=>f.trim());c.set(u,h)}),s[i]=Array.from(c.entries()).map(([d,u])=>`${d}: ${u}`).join("; ")}else s[i]=r}),s},{})}function Sa(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,s)=>He(t,s),{})}function Zp(n){return typeof n=="function"}function U(n,e=void 0,...t){return Zp(n)?e?n.bind(e)(...t):n(...t):n}function HM(n={}){return Object.keys(n).length===0&&n.constructor===Object}function VM(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function dd(n,e){return"style"in n?n:{...n,getAttrs:t=>{const s=n.getAttrs?n.getAttrs(t):n.attrs;if(s===!1)return!1;const i=e.reduce((r,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):VM(t.getAttribute(o.name));return a==null?r:{...r,[o.name]:a}},{});return{...s,...i}}}}function ud(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&HM(t)?!1:t!=null))}function YM(n,e){var t;const s=Qp(n),{nodeExtensions:i,markExtensions:r}=eo(n),o=(t=i.find(c=>z(c,"topNode")))===null||t===void 0?void 0:t.name,a=Object.fromEntries(i.map(c=>{const d=s.filter(b=>b.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=n.reduce((b,S)=>{const _=z(S,"extendNodeSchema",u);return{...b,..._?_(c):{}}},{}),f=ud({...h,content:U(z(c,"content",u)),marks:U(z(c,"marks",u)),group:U(z(c,"group",u)),inline:U(z(c,"inline",u)),atom:U(z(c,"atom",u)),selectable:U(z(c,"selectable",u)),draggable:U(z(c,"draggable",u)),code:U(z(c,"code",u)),whitespace:U(z(c,"whitespace",u)),linebreakReplacement:U(z(c,"linebreakReplacement",u)),defining:U(z(c,"defining",u)),isolating:U(z(c,"isolating",u)),attrs:Object.fromEntries(d.map(b=>{var S;return[b.name,{default:(S=b?.attribute)===null||S===void 0?void 0:S.default}]}))}),p=U(z(c,"parseHTML",u));p&&(f.parseDOM=p.map(b=>dd(b,d)));const m=z(c,"renderHTML",u);m&&(f.toDOM=b=>m({node:b,HTMLAttributes:Sa(b,d)}));const g=z(c,"renderText",u);return g&&(f.toText=g),[c.name,f]})),l=Object.fromEntries(r.map(c=>{const d=s.filter(g=>g.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=n.reduce((g,b)=>{const S=z(b,"extendMarkSchema",u);return{...g,...S?S(c):{}}},{}),f=ud({...h,inclusive:U(z(c,"inclusive",u)),excludes:U(z(c,"excludes",u)),group:U(z(c,"group",u)),spanning:U(z(c,"spanning",u)),code:U(z(c,"code",u)),attrs:Object.fromEntries(d.map(g=>{var b;return[g.name,{default:(b=g?.attribute)===null||b===void 0?void 0:b.default}]}))}),p=U(z(c,"parseHTML",u));p&&(f.parseDOM=p.map(g=>dd(g,d)));const m=z(c,"renderHTML",u);return m&&(f.toDOM=g=>m({mark:g,HTMLAttributes:Sa(g,d)})),[c.name,f]}));return new Ff({topNode:o,nodes:a,marks:l})}function Lo(n,e){return e.nodes[n]||e.marks[n]||null}function hd(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function pl(n,e){const t=as.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}const qM=(n,e=500)=>{let t="";const s=n.parentOffset;return n.parent.nodesBetween(Math.max(0,s-e),s,(i,r,o,a)=>{var l,c;const d=((c=(l=i.type.spec).toText)===null||c===void 0?void 0:c.call(l,{node:i,pos:r,parent:o,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,s-r))}),t};function ml(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class to{constructor(e){this.find=e.find,this.handler=e.handler}}const KM=(n,e)=>{if(ml(e))return e.exec(n);const t=e(n);if(!t)return null;const s=[t.text];return s.index=t.index,s.input=n,s.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),s.push(t.replaceWith)),s};function Ki(n){var e;const{editor:t,from:s,to:i,text:r,rules:o,plugin:a}=n,{view:l}=t;if(l.composing)return!1;const c=l.state.doc.resolve(s);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(h=>h.type.spec.code))return!1;let d=!1;const u=qM(c)+r;return o.forEach(h=>{if(d)return;const f=KM(u,h.find);if(!f)return;const p=l.state.tr,m=Qr({state:l.state,transaction:p}),g={from:s-(f[0].length-r.length),to:i},{commands:b,chain:S,can:_}=new Zr({editor:t,state:m});h.handler({state:m,range:g,match:f,commands:b,chain:S,can:_})===null||!p.steps.length||(p.setMeta(a,{transform:p,from:s,to:i,text:r}),l.dispatch(p),d=!0)}),d}function UM(n){const{editor:e,rules:t}=n,s=new Ze({state:{init(){return null},apply(i,r,o){const a=i.getMeta(s);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:d}=l;typeof d=="string"?d=d:d=pl(T.from(d),o.schema);const{from:u}=l,h=u+d.length;Ki({editor:e,from:u,to:h,text:d,rules:t,plugin:s})}),i.selectionSet||i.docChanged?null:r}},props:{handleTextInput(i,r,o,a){return Ki({editor:e,from:r,to:o,text:a,rules:t,plugin:s})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:r}=i.state.selection;r&&Ki({editor:e,from:r.pos,to:r.pos,text:"",rules:t,plugin:s})}),!1)},handleKeyDown(i,r){if(r.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Ki({editor:e,from:o.pos,to:o.pos,text:`
|
|
11
|
-
`,rules:t,plugin:
|
|
12
|
-
|
|
13
|
-
`,textSerializers:o={}}=t||{};let a="";return n.nodesBetween(s,i,(l,c,d,u)=>{var h;l.isBlock&&c>s&&(a+=r);const f=o?.[l.type.name];if(f)return d&&(a+=f({node:l,pos:c,parent:d,index:u,range:e})),!1;l.isText&&(a+=(h=l?.text)===null||h===void 0?void 0:h.slice(Math.max(s,c)-c,i-c))}),a}function tm(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const sC=Ve.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ze({key:new Ht("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:s,selection:i}=e,{ranges:r}=i,o=Math.min(...r.map(d=>d.$from.pos)),a=Math.max(...r.map(d=>d.$to.pos)),l=tm(t);return em(s,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),iC=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),rC=(n=!1)=>({commands:e})=>e.setContent("",n),oC=()=>({state:n,tr:e,dispatch:t})=>{const{selection:s}=e,{ranges:i}=s;return t&&i.forEach(({$from:r,$to:o})=>{n.doc.nodesBetween(r.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:d}=e,u=c.resolve(d.map(l)),h=c.resolve(d.map(l+a.nodeSize)),f=u.blockRange(h);if(!f)return;const p=Bs(f);if(a.type.isTextblock){const{defaultType:m}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(f.start,m)}(p||p===0)&&e.lift(f,p)})}),!0},aC=n=>e=>n(e),lC=()=>({state:n,dispatch:e})=>Up(n,e),cC=(n,e)=>({editor:t,tr:s})=>{const{state:i}=t,r=i.doc.slice(n.from,n.to);s.deleteRange(n.from,n.to);const o=s.mapping.map(e);return s.insert(o,r.content),s.setSelection(new $(s.doc.resolve(Math.max(o-1,0)))),!0},dC=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,s=t.$anchor.node();if(s.content.size>0)return!1;const i=n.selection.$anchor;for(let r=i.depth;r>0;r-=1)if(i.node(r).type===s.type){if(e){const a=i.before(r),l=i.after(r);n.delete(a,l).scrollIntoView()}return!0}return!1},uC=n=>({tr:e,state:t,dispatch:s})=>{const i=Oe(n,t.schema),r=e.selection.$anchor;for(let o=r.depth;o>0;o-=1)if(r.node(o).type===i){if(s){const l=r.before(o),c=r.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},hC=n=>({tr:e,dispatch:t})=>{const{from:s,to:i}=n;return t&&e.delete(s,i),!0},fC=()=>({state:n,dispatch:e})=>cl(n,e),pC=()=>({commands:n})=>n.keyboardShortcut("Enter"),mC=()=>({state:n,dispatch:e})=>OM(n,e);function Tr(n,e,t={strict:!0}){const s=Object.keys(e);return s.length?s.every(i=>t.strict?e[i]===n[i]:ml(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function nm(n,e,t={}){return n.find(s=>s.type===e&&Tr(Object.fromEntries(Object.keys(t).map(i=>[i,s.attrs[i]])),t))}function fd(n,e,t={}){return!!nm(n,e,t)}function gl(n,e,t){var s;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(d=>d.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(d=>d.type===e)||(t=t||((s=i.node.marks[0])===null||s===void 0?void 0:s.attrs),!nm([...i.node.marks],e,t)))return;let o=i.index,a=n.start()+i.offset,l=o+1,c=a+i.node.nodeSize;for(;o>0&&fd([...n.parent.child(o-1).marks],e,t);)o-=1,a-=n.parent.child(o).nodeSize;for(;l<n.parent.childCount&&fd([...n.parent.child(l).marks],e,t);)c+=n.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function En(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}const gC=(n,e={})=>({tr:t,state:s,dispatch:i})=>{const r=En(n,s.schema),{doc:o,selection:a}=t,{$from:l,from:c,to:d}=a;if(i){const u=gl(l,r,e);if(u&&u.from<=c&&u.to>=d){const h=$.create(o,u.from,u.to);t.setSelection(h)}}return!0},yC=n=>e=>{const t=typeof n=="function"?n(e):n;for(let s=0;s<t.length;s+=1)if(t[s](e))return!0;return!1};function sm(n){return n instanceof $}function qn(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function im(n,e=null){if(!e)return null;const t=q.atStart(n),s=q.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return s;const i=t.from,r=s.to;return e==="all"?$.create(n,qn(0,i,r),qn(n.content.size,i,r)):$.create(n,qn(e,i,r),qn(e,i,r))}function pd(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Nr(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function bC(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const xC=(n=null,e={})=>({editor:t,view:s,tr:i,dispatch:r})=>{e={scrollIntoView:!0,...e};const o=()=>{(Nr()||pd())&&s.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(s.focus(),bC()&&!Nr()&&!pd()&&s.dom.focus({preventScroll:!0}))})};if(s.hasFocus()&&n===null||n===!1)return!0;if(r&&n===null&&!sm(t.state.selection))return o(),!0;const a=im(i.doc,n)||t.state.selection,l=t.state.selection.eq(a);return r&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},_C=(n,e)=>t=>n.every((s,i)=>e(s,{...t,index:i})),kC=(n,e)=>({tr:t,commands:s})=>s.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),rm=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const s=e[t];s.nodeType===3&&s.nodeValue&&/^(\n\s\s|\n)$/.test(s.nodeValue)?n.removeChild(s):s.nodeType===1&&rm(s)}return n};function Gi(n){const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return rm(t)}function Mi(n,e,t){if(n instanceof _n||n instanceof T)return n;t={slice:!0,parseOptions:{},...t};const s=typeof n=="object"&&n!==null,i=typeof n=="string";if(s)try{if(Array.isArray(n)&&n.length>0)return T.fromArray(n.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(n);return t.errorOnInvalidContent&&o.check(),o}catch(r){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",r),Mi("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,a="";const l=new Ff({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?kn.fromSchema(l).parseSlice(Gi(n),t.parseOptions):kn.fromSchema(l).parse(Gi(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const r=kn.fromSchema(e);return t.slice?r.parseSlice(Gi(n),t.parseOptions).content:r.parse(Gi(n),t.parseOptions)}return Mi("",e,t)}function wC(n,e,t){const s=n.steps.length-1;if(s<e)return;const i=n.steps[s];if(!(i instanceof ve||i instanceof Se))return;const r=n.mapping.maps[s];let o=0;r.forEach((a,l,c,d)=>{o===0&&(o=d)}),n.setSelection(q.near(n.doc.resolve(o),t))}const vC=n=>!("type"in n),SC=(n,e,t)=>({tr:s,dispatch:i,editor:r})=>{var o;if(i){t={parseOptions:r.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const l=g=>{r.emit("contentError",{editor:r,error:g,disableCollaboration:()=>{r.storage.collaboration&&(r.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!r.options.enableContentCheck&&r.options.emitContentError)try{Mi(e,r.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){l(g)}try{a=Mi(e,r.schema,{parseOptions:c,errorOnInvalidContent:(o=t.errorOnInvalidContent)!==null&&o!==void 0?o:r.options.enableContentCheck})}catch(g){return l(g),!1}let{from:d,to:u}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,f=!0;if((vC(a)?a:[a]).forEach(g=>{g.check(),h=h?g.isText&&g.marks.length===0:!1,f=f?g.isBlock:!1}),d===u&&f){const{parent:g}=s.doc.resolve(d);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(d-=1,u+=1)}let m;if(h){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof T){let g="";e.forEach(b=>{b.text&&(g+=b.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;s.insertText(m,d,u)}else m=a,s.replaceWith(d,u,m);t.updateSelection&&wC(s,s.steps.length-1,-1),t.applyInputRules&&s.setMeta("applyInputRules",{from:d,text:m}),t.applyPasteRules&&s.setMeta("applyPasteRules",{from:d,text:m})}return!0},MC=()=>({state:n,dispatch:e})=>SM(n,e),CC=()=>({state:n,dispatch:e})=>MM(n,e),OC=()=>({state:n,dispatch:e})=>Wp(n,e),DC=()=>({state:n,dispatch:e})=>Yp(n,e),TC=()=>({state:n,dispatch:e,tr:t})=>{try{const s=qr(n.doc,n.selection.$from.pos,-1);return s==null?!1:(t.join(s,2),e&&e(t),!0)}catch{return!1}},NC=()=>({state:n,dispatch:e,tr:t})=>{try{const s=qr(n.doc,n.selection.$from.pos,1);return s==null?!1:(t.join(s,2),e&&e(t),!0)}catch{return!1}},EC=()=>({state:n,dispatch:e})=>wM(n,e),AC=()=>({state:n,dispatch:e})=>vM(n,e);function om(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function PC(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let s,i,r,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))s=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))r=!0;else if(/^mod$/i.test(l))Nr()||om()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return s&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),r&&(t=`Shift-${t}`),t}const IC=n=>({editor:e,view:t,tr:s,dispatch:i})=>{const r=PC(n).split(/-(?!$)/),o=r.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:r.includes("Alt"),ctrlKey:r.includes("Ctrl"),metaKey:r.includes("Meta"),shiftKey:r.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l?.steps.forEach(c=>{const d=c.map(s.mapping);d&&i&&s.maybeStep(d)}),!0};function Ci(n,e,t={}){const{from:s,to:i,empty:r}=n.selection,o=e?Oe(e,n.schema):null,a=[];n.doc.nodesBetween(s,i,(u,h)=>{if(u.isText)return;const f=Math.max(s,h),p=Math.min(i,h+u.nodeSize);a.push({node:u,from:f,to:p})});const l=i-s,c=a.filter(u=>o?o.name===u.node.type.name:!0).filter(u=>Tr(u.node.attrs,t,{strict:!1}));return r?!!c.length:c.reduce((u,h)=>u+h.to-h.from,0)>=l}const RC=(n,e={})=>({state:t,dispatch:s})=>{const i=Oe(n,t.schema);return Ci(t,i,e)?CM(t,s):!1},zC=()=>({state:n,dispatch:e})=>Jp(n,e),BC=n=>({state:e,dispatch:t})=>{const s=Oe(n,e.schema);return jM(s)(e,t)},jC=()=>({state:n,dispatch:e})=>Kp(n,e);function so(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function md(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((s,i)=>(t.includes(i)||(s[i]=n[i]),s),{})}const LC=(n,e)=>({tr:t,state:s,dispatch:i})=>{let r=null,o=null;const a=so(typeof n=="string"?n:n.name,s.schema);return a?(a==="node"&&(r=Oe(n,s.schema)),a==="mark"&&(o=En(n,s.schema)),i&&t.selection.ranges.forEach(l=>{s.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,d)=>{r&&r===c.type&&t.setNodeMarkup(d,void 0,md(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(u=>{o===u.type&&t.addMark(d,d+c.nodeSize,o.create(md(u.attrs,e)))})})}),!0):!1},FC=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),WC=()=>({tr:n,dispatch:e})=>{if(e){const t=new ct(n.doc);n.setSelection(t)}return!0},$C=()=>({state:n,dispatch:e})=>Hp(n,e),HC=()=>({state:n,dispatch:e})=>qp(n,e),VC=()=>({state:n,dispatch:e})=>NM(n,e),YC=()=>({state:n,dispatch:e})=>PM(n,e),qC=()=>({state:n,dispatch:e})=>AM(n,e);function Ma(n,e,t={},s={}){return Mi(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:s.errorOnInvalidContent})}const KC=(n,e=!1,t={},s={})=>({editor:i,tr:r,dispatch:o,commands:a})=>{var l,c;const{doc:d}=r;if(t.preserveWhitespace!=="full"){const u=Ma(n,i.schema,t,{errorOnInvalidContent:(l=s.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck});return o&&r.replaceWith(0,d.content.size,u).setMeta("preventUpdate",!e),!0}return o&&r.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:d.content.size},n,{parseOptions:t,errorOnInvalidContent:(c=s.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck})};function am(n,e){const t=En(e,n.schema),{from:s,to:i,empty:r}=n.selection,o=[];r?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(s,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function UC(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function JC(n,e){for(let t=n.depth;t>0;t-=1){const s=n.node(t);if(e(s))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:s}}}function yl(n){return e=>JC(e.$from,n)}function GC(n,e){const t={from:0,to:n.content.size};return em(n,t,e)}function XC(n,e){const t=Oe(e,n.schema),{from:s,to:i}=n.selection,r=[];n.doc.nodesBetween(s,i,a=>{r.push(a)});const o=r.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function QC(n,e){const t=so(typeof e=="string"?e:e.name,n.schema);return t==="node"?XC(n,e):t==="mark"?am(n,e):{}}function lm(n,e,t){const s=[];return n===e?t.resolve(n).marks().forEach(i=>{const r=t.resolve(n),o=gl(r,i.type);o&&s.push({mark:i,...o})}):t.nodesBetween(n,e,(i,r)=>{!i||i?.nodeSize===void 0||s.push(...i.marks.map(o=>({from:r,to:r+i.nodeSize,mark:o})))}),s}function fr(n,e,t){return Object.fromEntries(Object.entries(t).filter(([s])=>{const i=n.find(r=>r.type===e&&r.name===s);return i?i.attribute.keepOnSplit:!1}))}function Ca(n,e,t={}){const{empty:s,ranges:i}=n.selection,r=e?En(e,n.schema):null;if(s)return!!(n.storedMarks||n.selection.$from.marks()).filter(u=>r?r.name===u.type.name:!0).find(u=>Tr(u.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:u,$to:h})=>{const f=u.pos,p=h.pos;n.doc.nodesBetween(f,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(f,g),S=Math.min(p,g+m.nodeSize),_=S-b;o+=_,a.push(...m.marks.map(k=>({mark:k,from:b,to:S})))})}),o===0)return!1;const l=a.filter(u=>r?r.name===u.mark.type.name:!0).filter(u=>Tr(u.mark.attrs,t,{strict:!1})).reduce((u,h)=>u+h.to-h.from,0),c=a.filter(u=>r?u.mark.type!==r&&u.mark.type.excludes(r):!0).reduce((u,h)=>u+h.to-h.from,0);return(l>0?l+c:l)>=o}function ZC(n,e,t={}){if(!e)return Ci(n,null,t)||Ca(n,null,t);const s=so(e,n.schema);return s==="node"?Ci(n,e,t):s==="mark"?Ca(n,e,t):!1}function gd(n,e){const{nodeExtensions:t}=eo(e),s=t.find(o=>o.name===n);if(!s)return!1;const i={name:s.name,options:s.options,storage:s.storage},r=U(z(s,"group",i));return typeof r!="string"?!1:r.split(" ").includes("list")}function bl(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var s;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((s=n.text)!==null&&s!==void 0?s:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(r=>{i!==!1&&(bl(r,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function eO(n){return n instanceof L}function tO(n,e,t){var s;const{selection:i}=e;let r=null;if(sm(i)&&(r=i.$cursor),r){const a=(s=n.storedMarks)!==null&&s!==void 0?s:r.marks();return!!t.isInSet(a)||!a.some(l=>l.type.excludes(t))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,l.pos,(d,u,h)=>{if(c)return!1;if(d.isInline){const f=!h||h.type.allowsMarkType(t),p=!!t.isInSet(d.marks)||!d.marks.some(m=>m.type.excludes(t));c=f&&p}return!c}),c})}const nO=(n,e={})=>({tr:t,state:s,dispatch:i})=>{const{selection:r}=t,{empty:o,ranges:a}=r,l=En(n,s.schema);if(i)if(o){const c=am(s,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;s.doc.nodesBetween(d,u,(h,f)=>{const p=Math.max(f,d),m=Math.min(f+h.nodeSize,u);h.marks.find(b=>b.type===l)?h.marks.forEach(b=>{l===b.type&&t.addMark(p,m,l.create({...b.attrs,...e}))}):t.addMark(p,m,l.create(e))})});return tO(s,t,l)},sO=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),iO=(n,e={})=>({state:t,dispatch:s,chain:i})=>{const r=Oe(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),r.isTextblock?i().command(({commands:a})=>cd(r,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>cd(r,{...o,...e})(a,s)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},rO=n=>({tr:e,dispatch:t})=>{if(t){const{doc:s}=e,i=qn(n,0,s.content.size),r=L.create(s,i);e.setSelection(r)}return!0},oO=n=>({tr:e,dispatch:t})=>{if(t){const{doc:s}=e,{from:i,to:r}=typeof n=="number"?{from:n,to:n}:n,o=$.atStart(s).from,a=$.atEnd(s).to,l=qn(i,o,a),c=qn(r,o,a),d=$.create(s,l,c);e.setSelection(d)}return!0},aO=n=>({state:e,dispatch:t})=>{const s=Oe(n,e.schema);return WM(s)(e,t)};function yd(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const s=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(s)}}const lO=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:s,editor:i})=>{const{selection:r,doc:o}=e,{$from:a,$to:l}=r,c=i.extensionManager.attributes,d=fr(c,a.node().type.name,a.node().attrs);if(r instanceof L&&r.node.isBlock)return!a.parentOffset||!sn(o,a.pos)?!1:(s&&(n&&yd(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const u=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:UC(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=u&&h?[{type:h,attrs:d}]:void 0,p=sn(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!p&&sn(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(p=!0,f=h?[{type:h,attrs:d}]:void 0),s){if(p&&(r instanceof $&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),h&&!u&&!a.parentOffset&&a.parent.type!==h)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}n&&yd(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},cO=(n,e={})=>({tr:t,state:s,dispatch:i,editor:r})=>{var o;const a=Oe(n,s.schema),{$from:l,$to:c}=s.selection,d=s.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==a)return!1;const h=r.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let b=T.empty;const S=l.index(-1)?1:l.index(-2)?2:3;for(let C=l.depth-S;C>=l.depth-3;C-=1)b=T.from(l.node(C).copy(b));const _=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,k={...fr(h,l.node().type.name,l.node().attrs),...e},v=((o=a.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(k))||void 0;b=b.append(T.from(a.createAndFill(null,v)||void 0));const w=l.before(l.depth-(S-1));t.replace(w,l.after(-_),new I(b,4-S,0));let M=-1;t.doc.nodesBetween(w,t.doc.content.size,(C,O)=>{if(M>-1)return!1;C.isTextblock&&C.content.size===0&&(M=O+1)}),M>-1&&t.setSelection($.near(t.doc.resolve(M))),t.scrollIntoView()}return!0}const f=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...fr(h,u.type.name,u.attrs),...e},m={...fr(h,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,c.pos);const g=f?[{type:a,attrs:p},{type:f,attrs:m}]:[{type:a,attrs:p}];if(!sn(t.doc,l.pos,2))return!1;if(i){const{selection:b,storedMarks:S}=s,{splittableMarks:_}=r.extensionManager,k=S||b.$to.parentOffset&&b.$from.marks();if(t.split(l.pos,2,g).scrollIntoView(),!k||!i)return!0;const v=k.filter(w=>_.includes(w.type.name));t.ensureMarks(v)}return!0},Fo=(n,e)=>{const t=yl(o=>o.type===e)(n.selection);if(!t)return!0;const s=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(s===void 0)return!0;const i=n.doc.nodeAt(s);return t.node.type===i?.type&&Tn(n.doc,t.pos)&&n.join(t.pos),!0},Wo=(n,e)=>{const t=yl(o=>o.type===e)(n.selection);if(!t)return!0;const s=n.doc.resolve(t.start).after(t.depth);if(s===void 0)return!0;const i=n.doc.nodeAt(s);return t.node.type===i?.type&&Tn(n.doc,s)&&n.join(s),!0},dO=(n,e,t,s={})=>({editor:i,tr:r,state:o,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:u,splittableMarks:h}=i.extensionManager,f=Oe(n,o.schema),p=Oe(e,o.schema),{selection:m,storedMarks:g}=o,{$from:b,$to:S}=m,_=b.blockRange(S),k=g||m.$to.parentOffset&&m.$from.marks();if(!_)return!1;const v=yl(w=>gd(w.type.name,u))(m);if(_.depth>=1&&v&&_.depth-v.depth<=1){if(v.node.type===f)return c.liftListItem(p);if(gd(v.node.type.name,u)&&f.validContent(v.node.content)&&a)return l().command(()=>(r.setNodeMarkup(v.pos,f),!0)).command(()=>Fo(r,f)).command(()=>Wo(r,f)).run()}return!t||!k||!a?l().command(()=>d().wrapInList(f,s)?!0:c.clearNodes()).wrapInList(f,s).command(()=>Fo(r,f)).command(()=>Wo(r,f)).run():l().command(()=>{const w=d().wrapInList(f,s),M=k.filter(C=>h.includes(C.type.name));return r.ensureMarks(M),w?!0:c.clearNodes()}).wrapInList(f,s).command(()=>Fo(r,f)).command(()=>Wo(r,f)).run()},uO=(n,e={},t={})=>({state:s,commands:i})=>{const{extendEmptyMarkRange:r=!1}=t,o=En(n,s.schema);return Ca(s,o,e)?i.unsetMark(o,{extendEmptyMarkRange:r}):i.setMark(o,e)},hO=(n,e,t={})=>({state:s,commands:i})=>{const r=Oe(n,s.schema),o=Oe(e,s.schema),a=Ci(s,r,t);let l;return s.selection.$anchor.sameParent(s.selection.$head)&&(l=s.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(r,{...l,...t})},fO=(n,e={})=>({state:t,commands:s})=>{const i=Oe(n,t.schema);return Ci(t,i,e)?s.lift(i):s.wrapIn(i,e)},pO=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let s=0;s<t.length;s+=1){const i=t[s];let r;if(i.spec.isInputRules&&(r=i.getState(n))){if(e){const o=n.tr,a=r.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(r.text){const l=o.doc.resolve(r.from).marks();o.replaceWith(r.from,r.to,n.schema.text(r.text,l))}else o.delete(r.from,r.to)}return!0}}return!1},mO=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:s,ranges:i}=t;return s||e&&i.forEach(r=>{n.removeMark(r.$from.pos,r.$to.pos)}),!0},gO=(n,e={})=>({tr:t,state:s,dispatch:i})=>{var r;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=En(n,s.schema),{$from:c,empty:d,ranges:u}=a;if(!i)return!0;if(d&&o){let{from:h,to:f}=a;const p=(r=c.marks().find(g=>g.type===l))===null||r===void 0?void 0:r.attrs,m=gl(c,l,p);m&&(h=m.from,f=m.to),t.removeMark(h,f,l)}else u.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,l)});return t.removeStoredMark(l),!0},yO=(n,e={})=>({tr:t,state:s,dispatch:i})=>{let r=null,o=null;const a=so(typeof n=="string"?n:n.name,s.schema);return a?(a==="node"&&(r=Oe(n,s.schema)),a==="mark"&&(o=En(n,s.schema)),i&&t.selection.ranges.forEach(l=>{const c=l.$from.pos,d=l.$to.pos;let u,h,f,p;t.selection.empty?s.doc.nodesBetween(c,d,(m,g)=>{r&&r===m.type&&(f=Math.max(g,c),p=Math.min(g+m.nodeSize,d),u=g,h=m)}):s.doc.nodesBetween(c,d,(m,g)=>{g<c&&r&&r===m.type&&(f=Math.max(g,c),p=Math.min(g+m.nodeSize,d),u=g,h=m),g>=c&&g<=d&&(r&&r===m.type&&t.setNodeMarkup(g,void 0,{...m.attrs,...e}),o&&m.marks.length&&m.marks.forEach(b=>{if(o===b.type){const S=Math.max(g,c),_=Math.min(g+m.nodeSize,d);t.addMark(S,_,o.create({...b.attrs,...e}))}}))}),h&&(u!==void 0&&t.setNodeMarkup(u,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(m=>{o===m.type&&t.addMark(f,p,o.create({...m.attrs,...e}))}))}),!0):!1},bO=(n,e={})=>({state:t,dispatch:s})=>{const i=Oe(n,t.schema);return IM(i,e)(t,s)},xO=(n,e={})=>({state:t,dispatch:s})=>{const i=Oe(n,t.schema);return RM(i,e)(t,s)};var _O=Object.freeze({__proto__:null,blur:iC,clearContent:rC,clearNodes:oC,command:aC,createParagraphNear:lC,cut:cC,deleteCurrentNode:dC,deleteNode:uC,deleteRange:hC,deleteSelection:fC,enter:pC,exitCode:mC,extendMarkRange:gC,first:yC,focus:xC,forEach:_C,insertContent:kC,insertContentAt:SC,joinBackward:OC,joinDown:CC,joinForward:DC,joinItemBackward:TC,joinItemForward:NC,joinTextblockBackward:EC,joinTextblockForward:AC,joinUp:MC,keyboardShortcut:IC,lift:RC,liftEmptyBlock:zC,liftListItem:BC,newlineInCode:jC,resetAttributes:LC,scrollIntoView:FC,selectAll:WC,selectNodeBackward:$C,selectNodeForward:HC,selectParentNode:VC,selectTextblockEnd:YC,selectTextblockStart:qC,setContent:KC,setMark:nO,setMeta:sO,setNode:iO,setNodeSelection:rO,setTextSelection:oO,sinkListItem:aO,splitBlock:lO,splitListItem:cO,toggleList:dO,toggleMark:uO,toggleNode:hO,toggleWrap:fO,undoInputRule:pO,unsetAllMarks:mO,unsetMark:gO,updateAttributes:yO,wrapIn:bO,wrapInList:xO});const kO=Ve.create({name:"commands",addCommands(){return{..._O}}}),wO=Ve.create({name:"drop",addProseMirrorPlugins(){return[new Ze({key:new Ht("tiptapDrop"),props:{handleDrop:(n,e,t,s)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:s})}}})]}}),vO=Ve.create({name:"editable",addProseMirrorPlugins(){return[new Ze({key:new Ht("editable"),props:{editable:()=>this.editor.options.editable}})]}}),SO=new Ht("focusEvents"),MO=Ve.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Ze({key:SO,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const s=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(s),!1},blur:(e,t)=>{n.isFocused=!1;const s=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(s),!1}}}})]}}),CO=Ve.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:d,$anchor:u}=l,{pos:h,parent:f}=u,p=u.parent.isTextblock&&h>0?a.doc.resolve(h-1):u,m=p.parent.type.spec.isolating,g=u.pos-u.parentOffset,b=m&&p.parent.childCount===1?g===u.pos:q.atStart(c).from===h;return!d||!f.type.isTextblock||f.textContent.length||!b||b&&u.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),s={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...s},r={...s,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Nr()||om()?r:i},addProseMirrorPlugins(){return[new Ze({key:new Ht("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(m=>m.getMeta("composition")))return;const s=n.some(m=>m.docChanged)&&!e.doc.eq(t.doc),i=n.some(m=>m.getMeta("preventClearDocument"));if(!s||i)return;const{empty:r,from:o,to:a}=e.selection,l=q.atStart(e.doc).from,c=q.atEnd(e.doc).to;if(r||!(o===l&&a===c)||!bl(t.doc))return;const h=t.tr,f=Qr({state:t,transaction:h}),{commands:p}=new Zr({editor:this.editor,state:f});if(p.clearNodes(),!!h.steps.length)return h}})]}}),OO=Ve.create({name:"paste",addProseMirrorPlugins(){return[new Ze({key:new Ht("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),DO=Ve.create({name:"tabindex",addProseMirrorPlugins(){return[new Ze({key:new Ht("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class $n{get name(){return this.node.type.name}constructor(e,t,s=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=s,this.resolvedPos=e,this.editor=t,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,s=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,s=this.to-1}this.editor.commands.insertContentAt({from:t,to:s},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new $n(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new $n(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new $n(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,s)=>{const i=t.isBlock&&!t.isTextblock,r=t.isAtom&&!t.isText,o=this.pos+s+(r?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(o);if(!i&&a.depth<=this.depth)return;const l=new $n(a,this.editor,i,i?t:null);i&&(l.actualDepth=this.depth+1),e.push(new $n(a,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let s=null,i=this.parent;for(;i&&!s;){if(i.node.type.name===e)if(Object.keys(t).length>0){const r=i.node.attrs,o=Object.keys(t);for(let a=0;a<o.length;a+=1){const l=o[a];if(r[l]!==t[l])break}}else s=i;i=i.parent}return s}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},s=!1){let i=[];if(!this.children||this.children.length===0)return i;const r=Object.keys(t);return this.children.forEach(o=>{s&&i.length>0||(o.node.type.name===e&&r.every(l=>t[l]===o.node.attrs[l])&&i.push(o),!(s&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,s))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}}const TO=`.ProseMirror {
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react/jsx-runtime"),x=require("react"),Uu=require("react-dom");function Ju(n){var e,t,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var s=n.length;for(e=0;e<s;e++)n[e]&&(t=Ju(n[e]))&&(i&&(i+=" "),i+=t)}else for(t in n)n[t]&&(i&&(i+=" "),i+=t);return i}function N(){for(var n,e,t=0,i="",s=arguments.length;t<s;t++)(n=arguments[t])&&(e=Ju(n))&&(i&&(i+=" "),i+=e);return i}const Bg="_button_r0s18_2",Lg="_loading_r0s18_112",Fg="_icon_r0s18_116",Wg="_label_r0s18_122",$g="_spinner_r0s18_128",Hg="_spin_r0s18_128",rt={button:Bg,"size-sm":"_size-sm_r0s18_35","size-md":"_size-md_r0s18_41","size-lg":"_size-lg_r0s18_47","variant-primary":"_variant-primary_r0s18_54","variant-secondary":"_variant-secondary_r0s18_64","variant-tertiary":"_variant-tertiary_r0s18_74","variant-link":"_variant-link_r0s18_83","variant-destructive":"_variant-destructive_r0s18_97","full-width":"_full-width_r0s18_108",loading:Lg,icon:Fg,label:Wg,spinner:$g,spin:Hg},Gu=x.forwardRef(({children:n,variant:e="primary",size:t="md",disabled:i=!1,loading:s=!1,type:r="button",leftIcon:o,rightIcon:a,fullWidth:l=!1,onClick:c,"aria-label":d,className:u},h)=>b.jsxs("button",{ref:h,type:r,disabled:i||s,onClick:c,"aria-label":d,"aria-disabled":i||s,"aria-busy":s,className:N(rt.button,rt[`variant-${e}`],rt[`size-${t}`],l&&rt["full-width"],s&&rt.loading,u),children:[s&&b.jsx("span",{className:rt.spinner,"aria-hidden":"true"}),!s&&o&&b.jsx("span",{className:rt.icon,children:o}),b.jsx("span",{className:rt.label,children:n}),!s&&a&&b.jsx("span",{className:rt.icon,children:a})]}));Gu.displayName="Button";const Vg="_loading_txai2_96",Yg="_label_txai2_100",qg="_spinner_txai2_106",Kg="_spin_txai2_106",ci={"danger-button":"_danger-button_txai2_2","variant-filled":"_variant-filled_txai2_35","variant-outline":"_variant-outline_txai2_49","variant-ghost":"_variant-ghost_txai2_63","size-sm":"_size-sm_txai2_77","size-md":"_size-md_txai2_83","size-lg":"_size-lg_txai2_89",loading:Vg,label:Yg,spinner:qg,spin:Kg},Xu=x.forwardRef(({children:n,variant:e="filled",size:t="md",disabled:i=!1,loading:s=!1,type:r="button",onClick:o,"aria-label":a,className:l},c)=>b.jsxs("button",{ref:c,type:r,disabled:i||s,onClick:o,"aria-label":a,"aria-disabled":i||s,"aria-busy":s,className:N(ci["danger-button"],ci[`variant-${e}`],ci[`size-${t}`],s&&ci.loading,l),children:[s&&b.jsx("span",{className:ci.spinner,"aria-hidden":"true"}),b.jsx("span",{className:ci.label,children:n})]}));Xu.displayName="DangerButton";const Vl={"icon-button":"_icon-button_xpm72_2","size-sm":"_size-sm_xpm72_18","size-md":"_size-md_xpm72_23","size-lg":"_size-lg_xpm72_28"},Qu=x.forwardRef(({icon:n,"aria-label":e,variant:t="primary",size:i="md",disabled:s=!1,loading:r=!1,type:o="button",onClick:a,className:l},c)=>b.jsx("button",{ref:c,type:o,disabled:s||r,onClick:a,"aria-label":e,"aria-disabled":s||r,"aria-busy":r,className:N(rt.button,rt[`variant-${t}`],Vl["icon-button"],Vl[`size-${i}`],r&&rt.loading,l),children:r?b.jsx("span",{className:rt.spinner,"aria-hidden":"true"}):b.jsx("span",{"aria-hidden":"true",children:n})}));Qu.displayName="IconButton";const Ug="_wrapper_f20fx_1",Jg="_label_f20fx_8",Gg="_required_f20fx_18",Xg="_error_f20fx_42",Qg="_disabled_f20fx_51",Zg="_readonly_f20fx_58",eb="_input_f20fx_22",tb="_leading_f20fx_82",nb="_trailing_f20fx_83",nt={wrapper:Ug,label:Jg,required:Gg,"input-wrapper":"_input-wrapper_f20fx_22","size-sm":"_size-sm_f20fx_38","size-md":"_size-md_f20fx_39","size-lg":"_size-lg_f20fx_40",error:Xg,disabled:Qg,readonly:Zg,input:eb,leading:tb,trailing:nb,"helper-text":"_helper-text_f20fx_91","error-message":"_error-message_f20fx_97"},Zu=x.forwardRef(({id:n,name:e,type:t="text",value:i,defaultValue:s,placeholder:r,label:o,helperText:a,errorMessage:l,size:c="md",disabled:d=!1,required:u=!1,readOnly:h=!1,leadingContent:f,trailingContent:p,maxLength:m,onChange:g,onBlur:y,onFocus:S,className:_,"aria-describedby":k},v)=>{const w=x.useId(),M=n??w,C=`${M}-helper`,O=`${M}-error`,D=!!l,A=[k,a?C:null,D?O:null].filter(Boolean).join(" ")||void 0;return b.jsxs("div",{className:N(nt.wrapper,_),children:[o&&b.jsxs("label",{htmlFor:M,className:nt.label,children:[o,u&&b.jsx("span",{className:nt.required,"aria-hidden":"true",children:" *"})]}),b.jsxs("div",{className:N(nt["input-wrapper"],nt[`size-${c}`],D&&nt.error,d&&nt.disabled,h&&nt.readonly),children:[f&&b.jsx("span",{className:nt.leading,"aria-hidden":"true",children:f}),b.jsx("input",{ref:v,id:M,name:e,type:t,value:i,defaultValue:s,placeholder:r,disabled:d,required:u,readOnly:h,maxLength:m,"aria-invalid":D,"aria-describedby":A,"aria-required":u,onChange:g,onBlur:y,onFocus:S,className:nt.input}),p&&b.jsx("span",{className:nt.trailing,"aria-hidden":"true",children:p})]}),a&&!D&&b.jsx("span",{id:C,className:nt["helper-text"],children:a}),D&&b.jsx("span",{id:O,role:"alert",className:nt["error-message"],children:l})]})});Zu.displayName="Input";const ib="_wrapper_1j2yn_1",sb="_label_1j2yn_8",rb="_required_1j2yn_18",ob="_error_1j2yn_35",ab="_disabled_1j2yn_44",lb="_readonly_1j2yn_51",cb="_textarea_1j2yn_22",db="_footer_1j2yn_83",it={wrapper:ib,label:sb,required:rb,"textarea-wrapper":"_textarea-wrapper_1j2yn_22",error:ob,disabled:ab,readonly:lb,textarea:cb,"no-resize":"_no-resize_1j2yn_79",footer:db,"helper-text":"_helper-text_1j2yn_90","error-message":"_error-message_1j2yn_96","char-count":"_char-count_1j2yn_102"},eh=x.forwardRef(({id:n,name:e,value:t,defaultValue:i,placeholder:s,label:r,helperText:o,errorMessage:a,disabled:l=!1,required:c=!1,readOnly:d=!1,autoResize:u=!1,rows:h=3,maxLength:f,showCount:p=!1,onChange:m,onBlur:g,className:y},S)=>{const _=x.useId(),k=n??_,v=`${k}-helper`,w=`${k}-error`,M=!!a,[C,O]=x.useState((i??t??"").length),D=[o?v:null,M?w:null].filter(Boolean).join(" ")||void 0,A=F=>{if(u){const B=F.currentTarget;B.style.height="auto",B.style.height=`${B.scrollHeight}px`}},P=F=>{O(F.target.value.length),m?.(F)};return b.jsxs("div",{className:N(it.wrapper,y),children:[r&&b.jsxs("label",{htmlFor:k,className:it.label,children:[r,c&&b.jsx("span",{className:it.required,"aria-hidden":"true",children:" *"})]}),b.jsx("div",{className:N(it["textarea-wrapper"],M&&it.error,l&&it.disabled,d&&it.readonly),children:b.jsx("textarea",{ref:S,id:k,name:e,value:t,defaultValue:i,placeholder:s,disabled:l,required:c,readOnly:d,rows:h,maxLength:f,"aria-invalid":M,"aria-describedby":D,"aria-required":c,onInput:A,onChange:P,onBlur:g,className:N(it.textarea,u&&it["no-resize"])})}),b.jsxs("div",{className:it.footer,children:[b.jsxs("div",{children:[o&&!M&&b.jsx("span",{id:v,className:it["helper-text"],children:o}),M&&b.jsx("span",{id:w,role:"alert",className:it["error-message"],children:a})]}),p&&f!==void 0&&b.jsxs("span",{className:it["char-count"],"aria-live":"polite",children:[C,"/",f]})]})]})});eh.displayName="Textarea";const ub="_wrapper_1ewcj_1",hb="_label_1ewcj_7",fb="_box_1ewcj_30",pb="_checked_1ewcj_49",mb="_indeterminate_1ewcj_50",gb="_error_1ewcj_55",bb="_disabled_1ewcj_59",yb="_checkmark_1ewcj_65",xb="_dash_1ewcj_75",Ye={wrapper:ub,label:hb,"label-disabled":"_label-disabled_1ewcj_15","hidden-input":"_hidden-input_1ewcj_21",box:fb,checked:pb,indeterminate:mb,error:gb,disabled:bb,checkmark:yb,dash:xb,"label-text":"_label-text_1ewcj_83","helper-text":"_helper-text_1ewcj_90","error-message":"_error-message_1ewcj_97"},th=x.forwardRef(({id:n,indeterminate:e=!1,label:t,helperText:i,errorMessage:s,className:r,checked:o,disabled:a,...l},c)=>{const d=x.useRef(null),u=c??d,h=x.useId(),f=n??h,p=`${f}-helper`,m=`${f}-error`,g=!!s;return x.useEffect(()=>{u.current&&(u.current.indeterminate=e)},[e,u]),b.jsxs("div",{className:N(Ye.wrapper,r),children:[b.jsxs("label",{htmlFor:f,className:N(Ye.label,a&&Ye["label-disabled"]),children:[b.jsx("input",{...l,ref:u,id:f,type:"checkbox",checked:o,disabled:a,"aria-invalid":g,"aria-describedby":[i?p:null,g?m:null].filter(Boolean).join(" ")||void 0,className:Ye["hidden-input"]}),b.jsx("span",{className:N(Ye.box,o&&Ye.checked,e&&Ye.indeterminate,a&&Ye.disabled,g&&Ye.error),"aria-hidden":"true",children:e?b.jsx("span",{className:Ye.dash}):o?b.jsx("span",{className:Ye.checkmark}):null}),t&&b.jsx("span",{className:Ye["label-text"],children:t})]}),i&&!g&&b.jsx("span",{id:p,className:Ye["helper-text"],children:i}),g&&b.jsx("span",{id:m,role:"alert",className:Ye["error-message"],children:s})]})});th.displayName="Checkbox";const _b="_wrapper_fp3e5_1",kb="_disabled_fp3e5_9",wb="_track_fp3e5_24",vb="_thumb_fp3e5_56",Pn={wrapper:_b,disabled:kb,"hidden-input":"_hidden-input_fp3e5_15",track:wb,"size-md":"_size-md_fp3e5_33","size-sm":"_size-sm_fp3e5_38",thumb:vb,"label-text":"_label-text_fp3e5_84"},nh=x.forwardRef(({id:n,name:e,checked:t,defaultChecked:i,disabled:s=!1,label:r,labelPosition:o="right",size:a="md",onChange:l,className:c,"aria-label":d},u)=>{const h=x.useId(),f=n??h,p=b.jsx("span",{className:N(Pn.track,Pn[`size-${a}`]),"aria-hidden":"true",children:b.jsx("span",{className:Pn.thumb})}),m=r&&b.jsx("span",{className:Pn["label-text"],children:r});return b.jsxs("label",{htmlFor:f,className:N(Pn.wrapper,s&&Pn.disabled,c),children:[o==="left"&&m,b.jsx("input",{ref:u,id:f,name:e,type:"checkbox",role:"switch",checked:t,defaultChecked:i,disabled:s,"aria-label":d??void 0,"aria-checked":t,onChange:l,className:Pn["hidden-input"]}),p,o==="right"&&m]})});nh.displayName="Switch";const Sb="_wrapper_128bg_1",Mb="_label_128bg_8",Cb="_required_128bg_18",Fi={wrapper:Sb,label:Mb,required:Cb,"helper-text":"_helper-text_128bg_22","error-message":"_error-message_128bg_28"};function ih({label:n,helperText:e,errorMessage:t,required:i=!1,disabled:s=!1,children:r,className:o}){const a=x.useId(),l=r.props.id??a,c=`${l}-helper`,d=`${l}-error`,u=!!t,h=[e?c:null,u?d:null].filter(Boolean).join(" ")||void 0,f=x.cloneElement(r,{id:l,"aria-describedby":h,"aria-invalid":u||void 0,"aria-required":i||void 0,disabled:s||r.props.disabled});return b.jsxs("div",{className:N(Fi.wrapper,o),children:[n&&b.jsxs("label",{htmlFor:l,className:Fi.label,children:[n,i&&b.jsx("span",{className:Fi.required,"aria-hidden":"true",children:" *"})]}),f,e&&!u&&b.jsx("span",{id:c,className:Fi["helper-text"],children:e}),u&&b.jsx("span",{id:d,role:"alert",className:Fi["error-message"],children:t})]})}ih.displayName="FormField";const Ob="_badge_1b7rz_1",Db="_dot_1b7rz_47",Hs={badge:Ob,"size-sm":"_size-sm_1b7rz_12","size-md":"_size-md_1b7rz_13","size-lg":"_size-lg_1b7rz_14","variant-default":"_variant-default_1b7rz_17","variant-primary":"_variant-primary_1b7rz_21","variant-success":"_variant-success_1b7rz_25","variant-warning":"_variant-warning_1b7rz_29","variant-error":"_variant-error_1b7rz_33","variant-info":"_variant-info_1b7rz_37","variant-neutral":"_variant-neutral_1b7rz_41",dot:Db};function sh({children:n,variant:e="default",size:t="md",dot:i=!1,className:s}){return b.jsxs("span",{className:N(Hs.badge,Hs[`variant-${e}`],Hs[`size-${t}`],s),children:[i&&b.jsx("span",{className:Hs.dot,"aria-hidden":"true"}),n]})}sh.displayName="Badge";const Tb="_alert_1kb0y_1",Nb="_icon_1kb0y_11",Eb="_content_1kb0y_18",Ab="_title_1kb0y_25",Pb="_body_1kb0y_30",In={alert:Tb,icon:Nb,content:Eb,title:Ab,body:Pb,"dismiss-btn":"_dismiss-btn_1kb0y_35","variant-info":"_variant-info_1kb0y_59","variant-success":"_variant-success_1kb0y_65","variant-warning":"_variant-warning_1kb0y_71","variant-error":"_variant-error_1kb0y_77"},Ib={info:b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[b.jsx("circle",{cx:"8",cy:"8",r:"7.5",stroke:"currentColor",strokeWidth:"1"}),b.jsx("rect",{x:"7.25",y:"7",width:"1.5",height:"5",rx:".75",fill:"currentColor"}),b.jsx("circle",{cx:"8",cy:"5",r:".875",fill:"currentColor"})]}),success:b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[b.jsx("circle",{cx:"8",cy:"8",r:"7.5",stroke:"currentColor",strokeWidth:"1"}),b.jsx("path",{d:"M4.5 8.5l2.5 2.5 4.5-5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),warning:b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[b.jsx("path",{d:"M8 1.5L1 14.5h14L8 1.5z",stroke:"currentColor",strokeWidth:"1"}),b.jsx("rect",{x:"7.25",y:"6",width:"1.5",height:"4.5",rx:".75",fill:"currentColor"}),b.jsx("circle",{cx:"8",cy:"12",r:".875",fill:"currentColor"})]}),error:b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[b.jsx("circle",{cx:"8",cy:"8",r:"7.5",stroke:"currentColor",strokeWidth:"1"}),b.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})};function rh({variant:n="info",title:e,children:t,icon:i,dismissible:s=!1,onDismiss:r,className:o}){return b.jsxs("div",{role:"alert",className:N(In.alert,In[`variant-${n}`],o),children:[b.jsx("span",{className:In.icon,children:i??Ib[n]}),b.jsxs("div",{className:In.content,children:[e&&b.jsx("p",{className:In.title,children:e}),b.jsx("div",{className:In.body,children:t})]}),s&&b.jsx("button",{type:"button",onClick:r,"aria-label":"Dismiss alert",className:In["dismiss-btn"],children:b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M1 1l12 12M13 1L1 13",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})}rh.displayName="Alert";const Rb="_spinner_1e99b_1",zb="_spin_1e99b_1",xo={spinner:Rb,spin:zb,"size-xs":"_size-xs_1e99b_12","size-sm":"_size-sm_1e99b_13","size-md":"_size-md_1e99b_14","size-lg":"_size-lg_1e99b_15","size-xl":"_size-xl_1e99b_16","variant-primary":"_variant-primary_1e99b_19","variant-white":"_variant-white_1e99b_20","variant-current":"_variant-current_1e99b_21"};function oh({size:n="md",variant:e="primary",label:t="Loading…",className:i}){return b.jsx("span",{role:"status","aria-label":t,className:N(xo.spinner,xo[`size-${n}`],xo[`variant-${e}`],i)})}oh.displayName="Spinner";const jb="_skeleton_115i9_1",Bb="_shimmer_115i9_1",Yl={skeleton:jb,shimmer:Bb,"variant-text":"_variant-text_115i9_12","variant-circle":"_variant-circle_115i9_13","variant-rect":"_variant-rect_115i9_14"};function ah({variant:n="text",width:e,height:t,borderRadius:i,className:s}){const r={width:e??(n==="circle"?"2.5rem":"100%"),height:t??(n==="circle"?"2.5rem":n==="text"?"1em":"6rem"),borderRadius:i};return b.jsx("div",{"aria-hidden":"true",className:N(Yl.skeleton,Yl[`variant-${n}`],s),style:r})}ah.displayName="Skeleton";const Lb="_wrapper_2w1be_1",Fb="_tooltip_2w1be_6",Wb="_arrow_2w1be_37",Vs={wrapper:Lb,tooltip:Fb,"position-top":"_position-top_2w1be_31","position-bottom":"_position-bottom_2w1be_32","position-left":"_position-left_2w1be_33","position-right":"_position-right_2w1be_34",arrow:Wb};function lh({content:n,children:e,position:t="top",delay:i=0,className:s}){const r=x.useId();return b.jsxs("span",{className:N(Vs.wrapper,s),style:{"--delay":`${i}ms`},children:[x.cloneElement(e,{"aria-describedby":r}),b.jsxs("span",{id:r,role:"tooltip",className:N(Vs.tooltip,Vs[`position-${t}`]),children:[n,b.jsx("span",{className:Vs.arrow,"aria-hidden":"true"})]})]})}lh.displayName="Tooltip";const $b="_avatar_ygrwb_1",Hb="_img_ygrwb_22",Vb="_icon_ygrwb_28",Yb="_initials_ygrwb_33",Wi={avatar:$b,"size-xs":"_size-xs_ygrwb_15","size-sm":"_size-sm_ygrwb_16","size-md":"_size-md_ygrwb_17","size-lg":"_size-lg_ygrwb_18","size-xl":"_size-xl_ygrwb_19","size-2xl":"_size-2xl_ygrwb_20",img:Hb,icon:Vb,initials:Yb},ch=x.forwardRef(({src:n,alt:e="",initials:t,size:i="md",className:s},r)=>{const[o,a]=x.useState(!1),l=!!n&&!o,c=!l&&!!t;return b.jsxs("span",{ref:r,className:N(Wi.avatar,Wi[`size-${i}`],s),"aria-label":e||t,children:[l&&b.jsx("img",{src:n,alt:e,className:Wi.img,onError:()=>a(!0)}),!l&&c&&b.jsx("span",{className:Wi.initials,"aria-hidden":"true",children:t.slice(0,2).toUpperCase()}),!l&&!c&&b.jsx("svg",{className:Wi.icon,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:b.jsx("path",{d:"M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10zm0 2c-5.33 0-8 2.67-8 4v1h16v-1c0-1.33-2.67-4-8-4z"})})]})});ch.displayName="Avatar";const qb="_group_16onb_1",Ys={group:qb,"group-avatar":"_group-avatar_16onb_7","overflow-badge":"_overflow-badge_16onb_17","size-xs":"_size-xs_16onb_33","size-sm":"_size-sm_16onb_34","size-md":"_size-md_16onb_35","size-lg":"_size-lg_16onb_36","size-xl":"_size-xl_16onb_37","size-2xl":"_size-2xl_16onb_38"};function dh({children:n,max:e=5,size:t="md",className:i}){const s=x.Children.toArray(n),r=s.slice(0,e),o=s.length-e;return b.jsxs("span",{className:N(Ys.group,i),children:[r.map((a,l)=>x.cloneElement(a,{key:l,size:t,className:Ys["group-avatar"]})),o>0&&b.jsxs("span",{className:N(Ys["overflow-badge"],Ys[`size-${t}`]),children:["+",o]})]})}dh.displayName="AvatarGroup";const Kb="_tabs_1ynmi_2",Ub="_tablist_1ynmi_13",Jb="_tab_1ynmi_2",Gb="_panel_1ynmi_233",mt={tabs:Kb,"orientation-vertical":"_orientation-vertical_1ynmi_8",tablist:Ub,"full-width":"_full-width_1ynmi_23",tab:Jb,"variant-underline":"_variant-underline_1ynmi_28","variant-button":"_variant-button_1ynmi_38","size-sm":"_size-sm_1ynmi_73","size-md":"_size-md_1ynmi_79","is-active":"_is-active_1ynmi_90","tab-badge":"_tab-badge_1ynmi_136","variant-line":"_variant-line_1ynmi_156","variant-enclosed":"_variant-enclosed_1ynmi_181","variant-pills":"_variant-pills_1ynmi_208",panel:Gb},uh=x.createContext(null);function $a(){const n=x.useContext(uh);if(!n)throw new Error("Tab components must be used inside <Tabs>");return n}function hh({value:n,defaultValue:e="",onValueChange:t,variant:i="underline",orientation:s="horizontal",size:r="md",fullWidth:o=!1,children:a,className:l}){const[c,d]=x.useState(e),u=n??c,h=f=>{n===void 0&&d(f),t?.(f)};return b.jsx(uh.Provider,{value:{activeTab:u,setActiveTab:h,variant:i,orientation:s,size:r,fullWidth:o},children:b.jsx("div",{className:N(mt.tabs,mt[`orientation-${s}`],l),children:a})})}hh.displayName="Tabs";function fh({children:n,className:e}){const{variant:t,orientation:i,fullWidth:s}=$a();return b.jsx("div",{role:"tablist","aria-orientation":i,className:N(mt.tablist,mt[`variant-${t}`],mt[`orientation-${i}`],s&&mt["full-width"],e),children:n})}fh.displayName="TabList";function ph({value:n,disabled:e=!1,badge:t,children:i,className:s}){const{activeTab:r,setActiveTab:o,variant:a,size:l}=$a(),c=r===n,d=u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),e||o(n))};return b.jsxs("button",{role:"tab","aria-selected":c,"aria-disabled":e,disabled:e,tabIndex:c?0:-1,onClick:()=>!e&&o(n),onKeyDown:d,className:N(mt.tab,mt[`variant-${a}`],mt[`size-${l}`],c&&mt["is-active"],s),children:[i,t!==void 0&&b.jsx("span",{className:mt["tab-badge"],children:t})]})}ph.displayName="Tab";function mh({value:n,children:e,className:t}){const{activeTab:i}=$a();return i!==n?null:b.jsx("div",{role:"tabpanel",className:N(mt.panel,t),children:e})}mh.displayName="TabPanel";const Xb="_card_18d9f_1",Qb="_clickable_18d9f_31",Zb="_image_18d9f_51",ey="_header_18d9f_64",ty="_body_18d9f_71",ny="_footer_18d9f_79",_n={card:Xb,"variant-elevated":"_variant-elevated_18d9f_13","variant-outlined":"_variant-outlined_18d9f_18","variant-filled":"_variant-filled_18d9f_24",clickable:Qb,"image-wrap":"_image-wrap_18d9f_51",image:Zb,header:ey,body:ty,footer:ny},gh=x.forwardRef(({variant:n="elevated",clickable:e=!1,href:t,children:i,className:s,onClick:r,...o},a)=>{const l=N(_n.card,_n[`variant-${n}`],(e||t)&&_n.clickable,s);return t?b.jsx("a",{ref:a,href:t,className:l,...o,children:i}):b.jsx("div",{ref:a,className:l,onClick:r,role:e?"button":void 0,tabIndex:e?0:void 0,...o,children:i})});gh.displayName="Card";function bh({children:n,className:e}){return b.jsx("div",{className:N(_n.header,e),children:n})}bh.displayName="CardHeader";function yh({children:n,className:e}){return b.jsx("div",{className:N(_n.body,e),children:n})}yh.displayName="CardBody";function xh({children:n,className:e}){return b.jsx("div",{className:N(_n.footer,e),children:n})}xh.displayName="CardFooter";function _h({aspectRatio:n="16/9",className:e,alt:t="",...i}){return b.jsx("div",{className:N(_n["image-wrap"],e),style:{aspectRatio:n},children:b.jsx("img",{className:_n.image,alt:t,...i})})}_h.displayName="CardImage";const iy="_pagination_anogk_1",sy="_summary_anogk_9",ry="_controls_anogk_15",oy="_btn_anogk_22",ay="_ellipsis_anogk_65",ly="_select_anogk_85",De={pagination:iy,summary:sy,controls:ry,btn:oy,"page-btn":"_page-btn_anogk_54","is-active":"_is-active_anogk_58",ellipsis:ay,"size-sm":"_size-sm_anogk_76","size-md":"_size-md_anogk_77","page-size":"_page-size_anogk_80",select:ly,"go-to":"_go-to_anogk_102","go-to-label":"_go-to-label_anogk_108","go-to-input":"_go-to-input_anogk_114"};function cy(n,e,t){const i=[],s=Math.max(2,n-t),r=Math.min(e-1,n+t);for(let o=1;o<=e;o++)o===1||o===e||o>=s&&o<=r?i.push(o):i[i.length-1]!=="..."&&i.push("...");return i}function dy(){return b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M10 12L6 8l4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function uy(){return b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M6 4l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function hy(){return b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M8 12L4 8l4-4M13 12L9 8l4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function fy(){return b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M8 4l4 4-4 4M3 4l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}const kh=x.forwardRef(({total:n,page:e,pageSize:t=50,pageSizeOptions:i=[25,50,100],onPageChange:s,onPageSizeChange:r,size:o="md",showFirstLast:a=!0,showPageNumbers:l=!0,showPageSize:c=!1,showGoToPage:d=!1,siblingCount:u=1,className:h},f)=>{const[p,m]=x.useState(""),g=Math.max(1,Math.ceil(n/t)),y=cy(e,g,u),S=w=>{const M=Math.min(Math.max(1,w),g);M!==e&&s(M)},_=w=>{if(w.key==="Enter"){const M=parseInt(p,10);isNaN(M)||(S(M),m(""))}},k=(e-1)*t+1,v=Math.min(e*t,n);return b.jsxs("nav",{ref:f,"aria-label":"Pagination",className:N(De.pagination,De[`size-${o}`],h),children:[b.jsxs("span",{className:De.summary,children:[k,"–",v," of ",n]}),b.jsxs("div",{className:De.controls,children:[a&&b.jsx("button",{type:"button",className:De.btn,onClick:()=>S(1),disabled:e<=1,"aria-label":"First page",children:b.jsx(hy,{})}),b.jsx("button",{type:"button",className:De.btn,onClick:()=>S(e-1),disabled:e<=1,"aria-label":"Previous page",children:b.jsx(dy,{})}),l&&y.map((w,M)=>w==="..."?b.jsx("span",{className:De.ellipsis,"aria-hidden":"true",children:"…"},`ellipsis-${M}`):b.jsx("button",{type:"button",className:N(De.btn,De["page-btn"],e===w&&De["is-active"]),onClick:()=>S(w),"aria-label":`Page ${w}`,"aria-current":e===w?"page":void 0,children:w},w)),b.jsx("button",{type:"button",className:De.btn,onClick:()=>S(e+1),disabled:e>=g,"aria-label":"Next page",children:b.jsx(uy,{})}),a&&b.jsx("button",{type:"button",className:De.btn,onClick:()=>S(g),disabled:e>=g,"aria-label":"Last page",children:b.jsx(fy,{})})]}),c&&b.jsx("div",{className:De["page-size"],children:b.jsx("select",{value:t,onChange:w=>r?.(Number(w.target.value)),className:De.select,"aria-label":"Items per page",children:i.map(w=>b.jsxs("option",{value:w,children:[w," per page"]},w))})}),d&&b.jsxs("div",{className:De["go-to"],children:[b.jsx("span",{className:De["go-to-label"],children:"Go to page"}),b.jsx("input",{type:"number",min:1,max:g,value:p,onChange:w=>m(w.target.value),onKeyDown:_,className:De["go-to-input"],"aria-label":"Go to page number"})]})]})});kh.displayName="Pagination";const py="_overlay_8rh55_2",my="_dialog_8rh55_15",gy="_header_8rh55_35",by="_title_8rh55_50",yy="_description_8rh55_59",xy="_body_8rh55_94",_y="_footer_8rh55_105",ky="_actions_8rh55_112",st={overlay:py,"fade-in":"_fade-in_8rh55_1",dialog:my,"slide-up":"_slide-up_8rh55_1","size-sm":"_size-sm_8rh55_28","size-md":"_size-md_8rh55_29","size-lg":"_size-lg_8rh55_30","size-xl":"_size-xl_8rh55_31","size-full":"_size-full_8rh55_32",header:gy,"header-text":"_header-text_8rh55_43",title:by,description:yy,"close-btn":"_close-btn_8rh55_67",body:xy,footer:_y,actions:ky,"actions-leading":"_actions-leading_8rh55_118","actions-trailing":"_actions-trailing_8rh55_122"},wy=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M2 2l12 12M14 2L2 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),ql='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',wh=x.forwardRef(({open:n,onClose:e,title:t,description:i,footer:s,size:r="md",preventBackdropClose:o=!1,hideCloseButton:a=!1,children:l,className:c},d)=>{const u=x.useRef(null),h=d??u;if(x.useEffect(()=>{if(!n)return;const m=S=>{if(S.key==="Escape"){e();return}if(S.key==="Tab"){const _=h.current?.querySelectorAll(ql);if(!_||_.length===0)return;const k=_[0],v=_[_.length-1];S.shiftKey&&document.activeElement===k?(S.preventDefault(),v.focus()):!S.shiftKey&&document.activeElement===v&&(S.preventDefault(),k.focus())}},g=document.body.style.overflow;document.body.style.overflow="hidden",document.addEventListener("keydown",m);const y=setTimeout(()=>{h.current?.querySelector(ql)?.focus()},50);return()=>{document.body.style.overflow=g,document.removeEventListener("keydown",m),clearTimeout(y)}},[n,e,h]),!n)return null;const f="modal-title",p="modal-desc";return b.jsx("div",{className:st.overlay,role:"dialog","aria-modal":"true","aria-labelledby":t?f:void 0,"aria-describedby":i?p:void 0,onMouseDown:o?void 0:m=>{m.target===m.currentTarget&&e()},children:b.jsxs("div",{ref:h,className:N(st.dialog,st[`size-${r}`],c),children:[(t||!a)&&b.jsxs("div",{className:st.header,children:[b.jsxs("div",{className:st["header-text"],children:[t&&b.jsx("h2",{id:f,className:st.title,children:t}),i&&b.jsx("p",{id:p,className:st.description,children:i})]}),!a&&b.jsx("button",{type:"button",onClick:e,"aria-label":"Close modal",className:st["close-btn"],children:b.jsx(wy,{})})]}),l&&b.jsx("div",{className:st.body,children:l}),s&&b.jsx("div",{className:st.footer,children:s})]})})});wh.displayName="Modal";function vh({leading:n,children:e,className:t}){return b.jsxs("div",{className:N(st.actions,t),children:[n&&b.jsx("div",{className:st["actions-leading"],children:n}),b.jsx("div",{className:st["actions-trailing"],children:e})]})}vh.displayName="ModalActions";const vy="_accordion_1qnc2_1",Sy="_item_1qnc2_7",My="_trigger_1qnc2_16",Cy="_chevron_1qnc2_49",Oy="_content_1qnc2_61",Zt={accordion:vy,item:Sy,trigger:My,"trigger-text":"_trigger-text_1qnc2_44",chevron:Cy,"chevron-open":"_chevron-open_1qnc2_55",content:Oy,"content-inner":"_content-inner_1qnc2_65"},Sh=x.createContext(null),Mh=x.createContext(null);function Ch(){const n=x.useContext(Sh);if(!n)throw new Error("Accordion subcomponents must be used inside <Accordion>");return n}function Oh(){const n=x.useContext(Mh);if(!n)throw new Error("AccordionTrigger/Content must be inside <AccordionItem>");return n}function Dh({multiple:n=!1,defaultValue:e,value:t,onValueChange:i,children:s,className:r}){const[o,a]=x.useState(()=>e?Array.isArray(e)?e:[e]:[]),l=t!==void 0?Array.isArray(t)?t:[t]:o,c=u=>l.includes(u),d=u=>{let h;c(u)?h=l.filter(f=>f!==u):h=n?[...l,u]:[u],t===void 0&&a(h),i?.(n?h:h[0]??"")};return b.jsx(Sh.Provider,{value:{isOpen:c,toggle:d},children:b.jsx("div",{className:N(Zt.accordion,r),children:s})})}Dh.displayName="Accordion";function Th({value:n,children:e,className:t}){const{isOpen:i}=Ch(),s=x.useId(),r=i(n);return b.jsx(Mh.Provider,{value:{value:n,isOpen:r,triggerId:`trigger-${s}`,contentId:`content-${s}`},children:b.jsx("div",{className:N(Zt.item,r&&Zt["item-open"],t),"data-state":r?"open":"closed",children:e})})}Th.displayName="AccordionItem";function Nh({children:n,className:e}){const{toggle:t}=Ch(),{value:i,isOpen:s,triggerId:r,contentId:o}=Oh();return b.jsxs("button",{type:"button",id:r,"aria-controls":o,"aria-expanded":s,onClick:()=>t(i),className:N(Zt.trigger,e),children:[b.jsx("span",{className:Zt["trigger-text"],children:n}),b.jsx("svg",{className:N(Zt.chevron,s&&Zt["chevron-open"]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M4 6l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]})}Nh.displayName="AccordionTrigger";function Eh({children:n,className:e}){const{isOpen:t,contentId:i,triggerId:s}=Oh(),r=x.useRef(null),o=x.useRef(!0);return x.useEffect(()=>{const a=r.current;if(a){if(o.current){o.current=!1,t||(a.style.height="0px");return}if(t){a.style.height=a.scrollHeight+"px";const l=setTimeout(()=>{a.style.height="auto"},250);return()=>clearTimeout(l)}else a.style.height=a.scrollHeight+"px",requestAnimationFrame(()=>{a.style.height="0px"})}},[t]),b.jsx("div",{ref:r,id:i,role:"region","aria-labelledby":s,"aria-hidden":!t,className:N(Zt.content,e),style:{overflow:"hidden"},children:b.jsx("div",{className:Zt["content-inner"],children:n})})}Eh.displayName="AccordionContent";const Dy="_container_rbmhn_2",Ty="_notification_rbmhn_20",Ny="_icon_rbmhn_36",Ey="_content_rbmhn_42",Ay="_title_rbmhn_49",Py="_message_rbmhn_54",Gt={container:Dy,"position-top-right":"_position-top-right_rbmhn_12","position-top-left":"_position-top-left_rbmhn_13","position-top-center":"_position-top-center_rbmhn_14","position-bottom-right":"_position-bottom-right_rbmhn_15","position-bottom-left":"_position-bottom-left_rbmhn_16","position-bottom-center":"_position-bottom-center_rbmhn_17",notification:Ty,"toast-in":"_toast-in_rbmhn_1",icon:Ny,content:Ey,title:Ay,message:Py,"dismiss-btn":"_dismiss-btn_rbmhn_61","variant-info":"_variant-info_rbmhn_85","variant-success":"_variant-success_rbmhn_86","variant-warning":"_variant-warning_rbmhn_87","variant-error":"_variant-error_rbmhn_88"},Iy={info:b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[b.jsx("circle",{cx:"8",cy:"8",r:"7.5",stroke:"currentColor",strokeWidth:"1"}),b.jsx("rect",{x:"7.25",y:"7",width:"1.5",height:"5",rx:".75",fill:"currentColor"}),b.jsx("circle",{cx:"8",cy:"5",r:".875",fill:"currentColor"})]}),success:b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[b.jsx("circle",{cx:"8",cy:"8",r:"7.5",stroke:"currentColor",strokeWidth:"1"}),b.jsx("path",{d:"M4.5 8.5l2.5 2.5 4.5-5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),warning:b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[b.jsx("path",{d:"M8 1.5L1 14.5h14L8 1.5z",stroke:"currentColor",strokeWidth:"1"}),b.jsx("rect",{x:"7.25",y:"6",width:"1.5",height:"4.5",rx:".75",fill:"currentColor"}),b.jsx("circle",{cx:"8",cy:"12",r:".875",fill:"currentColor"})]}),error:b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[b.jsx("circle",{cx:"8",cy:"8",r:"7.5",stroke:"currentColor",strokeWidth:"1"}),b.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})},Ha=x.forwardRef(({variant:n="info",title:e,message:t,duration:i=5e3,dismissible:s=!0,onDismiss:r,className:o},a)=>(x.useEffect(()=>{if(!i)return;const l=setTimeout(()=>r?.(),i);return()=>clearTimeout(l)},[i,r]),b.jsxs("div",{ref:a,role:"status","aria-live":"polite",className:N(Gt.notification,Gt[`variant-${n}`],o),children:[b.jsx("span",{className:Gt.icon,children:Iy[n]}),b.jsxs("div",{className:Gt.content,children:[e&&b.jsx("p",{className:Gt.title,children:e}),b.jsx("div",{className:Gt.message,children:t})]}),s&&b.jsx("button",{type:"button",onClick:r,"aria-label":"Dismiss notification",className:Gt["dismiss-btn"],children:b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M1 1l12 12M13 1L1 13",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})));Ha.displayName="Notification";const Ah=x.createContext(null);function Ry(){const n=x.useContext(Ah);if(!n)throw new Error("useNotification must be used inside <NotificationProvider>");return n}let zy=0;function jy({children:n,position:e="top-right"}){const[t,i]=x.useState([]),s=x.useCallback(a=>{const l=`notif-${++zy}`;return i(c=>[...c,{...a,id:l}]),l},[]),r=x.useCallback(a=>{i(l=>l.filter(c=>c.id!==a))},[]),o=x.useCallback(()=>i([]),[]);return b.jsxs(Ah.Provider,{value:{notify:s,dismiss:r,dismissAll:o},children:[n,Uu.createPortal(b.jsx("div",{className:N(Gt.container,Gt[`position-${e}`]),children:t.map(a=>b.jsx(Ha,{...a,onDismiss:()=>{a.onDismiss?.(),r(a.id)}},a.id))}),document.body)]})}const By="_wrapper_d9t7m_2",Ly="_table_d9t7m_12",Fy="_row_d9t7m_75",Wy="_cell_d9t7m_79",$y="_striped_d9t7m_88",Hy="_hoverable_d9t7m_93",Vy="_bordered_d9t7m_134",Yy="_checkbox_d9t7m_145",qy="_skeleton_d9t7m_178",Ky="_shimmer_d9t7m_1",Z={wrapper:By,table:Ly,"header-row":"_header-row_d9t7m_24","header-cell":"_header-cell_d9t7m_28","header-cell-sortable":"_header-cell-sortable_d9t7m_43","header-label":"_header-label_d9t7m_53","header-info":"_header-info_d9t7m_57","sort-icon":"_sort-icon_d9t7m_64","sort-icon-neutral":"_sort-icon-neutral_d9t7m_70",row:Fy,cell:Wy,striped:$y,hoverable:Hy,"row-selected":"_row-selected_d9t7m_99","col-checkbox":"_col-checkbox_d9t7m_114","align-center":"_align-center_d9t7m_120","align-right":"_align-right_d9t7m_121","size-sm":"_size-sm_d9t7m_124","size-md":"_size-md_d9t7m_127","size-lg":"_size-lg_d9t7m_130",bordered:Vy,checkbox:Yy,"empty-row":"_empty-row_d9t7m_154","empty-cell":"_empty-cell_d9t7m_158","empty-default":"_empty-default_d9t7m_164",skeleton:qy,shimmer:Ky,"skeleton-check":"_skeleton-check_d9t7m_191"};function Uy({direction:n}){return n==="asc"?b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M7 2v10M3 6l4-4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):n==="desc"?b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M7 2v10M3 8l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:Z["sort-icon-neutral"],children:b.jsx("path",{d:"M4 5l3-3 3 3M4 9l3 3 3-3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Jy(){return b.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[b.jsx("circle",{cx:"7",cy:"7",r:"6",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("rect",{x:"6.3",y:"6",width:"1.4",height:"4.5",rx:".7",fill:"currentColor"}),b.jsx("circle",{cx:"7",cy:"4.2",r:".8",fill:"currentColor"})]})}function Kl({checked:n,indeterminate:e,onChange:t,label:i}){const s=x.useRef(null);return x.useEffect(()=>{s.current&&(s.current.indeterminate=!!e)},[e]),b.jsx("input",{ref:s,type:"checkbox",checked:n,"aria-label":i,className:Z.checkbox,onChange:r=>t(r.target.checked)})}function Gy({columns:n,data:e,rowKey:t=(_,k)=>k,sortKey:i,sortDirection:s=!1,onSort:r,selectable:o=!1,selectedKeys:a,onSelectionChange:l,striped:c=!1,hoverable:d=!0,bordered:u=!1,size:h="md",emptyState:f,loading:p=!1,loadingRows:m=5,className:g,tableClassName:y},S){const _=(e??[]).map((D,A)=>t(D,A)),k=_.length>0&&_.every(D=>a?.has(D)),v=!k&&_.some(D=>a?.has(D)),w=x.useCallback(D=>{l?.(D?new Set(_):new Set)},[_,l]),M=x.useCallback((D,A)=>{if(!l||!a)return;const P=new Set(a);A?P.add(D):P.delete(D),l(P)},[a,l]),C=D=>{r&&(i!==D?r(D,"asc"):s==="asc"?r(D,"desc"):r(D,!1))},O=[o?"2.5rem":null,...(n??[]).map(D=>D.width??"1fr")].filter(Boolean).join(" ");return b.jsx("div",{ref:S,className:N(Z.wrapper,c&&Z.striped,d&&Z.hoverable,u&&Z.bordered,Z[`size-${h}`],g),children:b.jsxs("div",{role:"table",className:N(Z.table,y),style:{"--grid-cols":O},children:[b.jsx("div",{role:"rowgroup",children:b.jsxs("div",{role:"row",className:Z["header-row"],children:[o&&b.jsx("div",{role:"columnheader",className:N(Z["header-cell"],Z["col-checkbox"]),children:b.jsx(Kl,{checked:k,indeterminate:v,onChange:w,label:"Select all rows"})}),(n??[]).map(D=>b.jsxs("div",{role:"columnheader","aria-sort":i===D.key?s==="asc"?"ascending":s==="desc"?"descending":"none":void 0,className:N(Z["header-cell"],D.sortable&&Z["header-cell-sortable"],D.align&&Z[`align-${D.align}`]),onClick:D.sortable?()=>C(D.key):void 0,children:[b.jsx("span",{className:Z["header-label"],children:D.header}),D.headerTooltip&&b.jsx("span",{title:D.headerTooltip,className:Z["header-info"],children:b.jsx(Jy,{})}),D.sortable&&b.jsx("span",{className:Z["sort-icon"],children:b.jsx(Uy,{direction:i===D.key?s:!1})})]},D.key))]})}),b.jsx("div",{role:"rowgroup",children:p?Array.from({length:m}).map((D,A)=>b.jsxs("div",{role:"row",className:Z.row,children:[o&&b.jsx("div",{role:"cell",className:N(Z.cell,Z["col-checkbox"]),children:b.jsx("div",{className:N(Z.skeleton,Z["skeleton-check"])})}),(n??[]).map(P=>b.jsx("div",{role:"cell",className:N(Z.cell,P.align&&Z[`align-${P.align}`]),children:b.jsx("div",{className:Z.skeleton,style:{width:`${60+(A*13+P.key.length*7)%30}%`}})},P.key))]},A)):(e??[]).length===0?b.jsx("div",{role:"row",className:Z["empty-row"],children:b.jsx("div",{role:"cell",className:Z["empty-cell"],style:{gridColumn:"1 / -1"},children:f??b.jsxs("div",{className:Z["empty-default"],children:[b.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none","aria-hidden":"true",children:[b.jsx("rect",{x:"4",y:"8",width:"32",height:"24",rx:"3",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("path",{d:"M4 14h32",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("path",{d:"M13 21h14M13 25h8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),b.jsx("p",{children:"No data available"})]})})}):(e??[]).map((D,A)=>{const P=t(D,A),F=a?.has(P)??!1;return b.jsxs("div",{role:"row","aria-selected":o?F:void 0,className:N(Z.row,F&&Z["row-selected"]),children:[o&&b.jsx("div",{role:"cell",className:N(Z.cell,Z["col-checkbox"]),children:b.jsx(Kl,{checked:F,onChange:B=>M(P,B),label:`Select row ${A+1}`})}),(n??[]).map(B=>b.jsx("div",{role:"cell",className:N(Z.cell,B.align&&Z[`align-${B.align}`]),children:B.cell?B.cell(D[B.key],D,A):D[B.key]!=null?String(D[B.key]):"—"},B.key))]},P)})})]})})}const Xy=x.forwardRef(Gy),Qy="_breadcrumbs_cbfc3_1",Zy="_list_cbfc3_5",e0="_item_cbfc3_15",t0="_link_cbfc3_21",n0="_text_cbfc3_50",i0="_separator_cbfc3_62",Yt={breadcrumbs:Qy,list:Zy,item:e0,link:t0,"link-button":"_link-button_cbfc3_45",text:n0,"text-current":"_text-current_cbfc3_57",separator:i0},Ph=x.forwardRef(({items:n,separator:e="/",maxItems:t,className:i},s)=>{let r=n;return t&&n.length>t&&(r=[n[0],{label:"…"},...n.slice(n.length-(t-2))]),b.jsx("nav",{ref:s,"aria-label":"Breadcrumb",className:N(Yt.breadcrumbs,i),children:b.jsx("ol",{className:Yt.list,children:r.map((o,a)=>{const l=a===r.length-1;return b.jsxs("li",{className:Yt.item,children:[o.href&&!l?b.jsx("a",{href:o.href,onClick:o.onClick,className:Yt.link,children:o.label}):o.onClick&&!l?b.jsx("button",{type:"button",onClick:o.onClick,className:N(Yt.link,Yt["link-button"]),children:o.label}):b.jsx("span",{className:N(Yt.text,l&&Yt["text-current"]),"aria-current":l?"page":void 0,children:o.label}),!l&&b.jsx("span",{className:Yt.separator,"aria-hidden":"true",children:e})]},a)})})})});Ph.displayName="Breadcrumbs";const s0="_stepper_n70bp_1",r0="_list_n70bp_5",o0="_step_n70bp_1",a0="_connector_n70bp_34",l0="_indicator_n70bp_74",c0="_content_n70bp_121",d0="_label_n70bp_127",u0="_optional_n70bp_138",h0="_description_n70bp_139",qe={stepper:s0,list:r0,"orientation-horizontal":"_orientation-horizontal_n70bp_14",step:o0,"step-inner":"_step-inner_n70bp_25",connector:a0,"orientation-vertical":"_orientation-vertical_n70bp_42","step-completed":"_step-completed_n70bp_68","step-active":"_step-active_n70bp_69",indicator:l0,"indicator-upcoming":"_indicator-upcoming_n70bp_89","indicator-active":"_indicator-active_n70bp_96","indicator-completed":"_indicator-completed_n70bp_103",content:c0,label:d0,"label-upcoming":"_label-upcoming_n70bp_134",optional:u0,description:h0},f0=()=>b.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M2 6l3 3 5-5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Ih=x.forwardRef(({steps:n,activeStep:e,orientation:t="horizontal",onStepClick:i,className:s},r)=>{const o=a=>a<e?"completed":a===e?"active":"upcoming";return b.jsx("nav",{ref:r,"aria-label":"Progress steps",className:N(qe.stepper,qe[`orientation-${t}`],s),children:b.jsx("ol",{className:qe.list,children:n.map((a,l)=>{const c=o(l),d=!!i&&c==="completed";return b.jsxs("li",{className:N(qe.step,qe[`step-${c}`]),"aria-current":c==="active"?"step":void 0,children:[l>0&&b.jsx("div",{className:qe.connector,"aria-hidden":"true"}),b.jsxs("div",{className:qe["step-inner"],children:[b.jsx("button",{type:"button",className:N(qe.indicator,qe[`indicator-${c}`]),onClick:d?()=>i(l):void 0,disabled:!d,tabIndex:d?0:-1,"aria-label":`Step ${l+1}: ${a.label} — ${c}`,children:c==="completed"?b.jsx(f0,{}):b.jsx("span",{children:l+1})}),b.jsxs("div",{className:qe.content,children:[b.jsx("span",{className:N(qe.label,qe[`label-${c}`]),children:a.label}),a.optional&&b.jsx("span",{className:qe.optional,children:"Optional"}),a.description&&b.jsx("span",{className:qe.description,children:a.description})]})]})]},l)})})})});Ih.displayName="Stepper";const p0="_progress_4wlv9_1",m0="_header_4wlv9_9",g0="_label_4wlv9_15",b0="_value_4wlv9_16",y0="_track_4wlv9_23",x0="_fill_4wlv9_35",At={progress:p0,header:m0,label:g0,value:b0,track:y0,"size-sm":"_size-sm_4wlv9_30","size-md":"_size-md_4wlv9_31","size-lg":"_size-lg_4wlv9_32",fill:x0,"variant-success":"_variant-success_4wlv9_43","variant-warning":"_variant-warning_4wlv9_44","variant-error":"_variant-error_4wlv9_45","fill-animated":"_fill-animated_4wlv9_48","progress-stripes":"_progress-stripes_4wlv9_1","fill-indeterminate":"_fill-indeterminate_4wlv9_66","progress-indeterminate":"_progress-indeterminate_4wlv9_1"},Rh=x.forwardRef(({value:n,max:e=100,size:t="md",variant:i="default",label:s,showValue:r=!1,animated:o=!1,indeterminate:a=!1,className:l},c)=>{const d=a?0:Math.min(100,Math.max(0,n/e*100)),u=Math.round(d);return b.jsxs("div",{ref:c,className:N(At.progress,At[`size-${t}`],At[`variant-${i}`],l),children:[(s||r)&&b.jsxs("div",{className:At.header,children:[s&&b.jsx("span",{className:At.label,children:s}),r&&!a&&b.jsxs("span",{className:At.value,children:[u,"%"]})]}),b.jsx("div",{role:"progressbar","aria-valuenow":a?void 0:n,"aria-valuemin":0,"aria-valuemax":e,"aria-label":s,"aria-valuetext":a?"Loading…":`${u}%`,className:At.track,children:b.jsx("div",{className:N(At.fill,o&&At["fill-animated"],a&&At["fill-indeterminate"]),style:a?void 0:{width:`${d}%`}})})]})});Rh.displayName="ProgressBar";const _0="_slider_10pt9_1",k0="_disabled_10pt9_9",w0="_header_10pt9_14",v0="_label_10pt9_20",S0="_value_10pt9_21",M0="_fill_10pt9_39",C0="_input_10pt9_55",O0="_ticks_10pt9_125",D0="_tick_10pt9_125",vt={slider:_0,disabled:k0,header:w0,label:v0,value:S0,"track-wrap":"_track-wrap_10pt9_28","size-sm":"_size-sm_10pt9_34","size-md":"_size-md_10pt9_35","size-lg":"_size-lg_10pt9_36",fill:M0,input:C0,ticks:O0,tick:D0},zh=x.forwardRef(({value:n,defaultValue:e=0,min:t=0,max:i=100,step:s=1,disabled:r=!1,label:o,showValue:a=!1,showTicks:l=!1,size:c="md",onChange:d,formatValue:u=p=>String(p),className:h},f)=>{const p=x.useId(),[m,g]=x.useState(e),y=n!==void 0,S=y?n:m,_=(S-t)/(i-t)*100,k=x.useCallback(M=>{const C=Number(M.target.value);y||g(C),d?.(C)},[y,d]),v=Math.floor((i-t)/s)+1,w=l&&v<=21?Array.from({length:v},(M,C)=>t+C*s):[];return b.jsxs("div",{className:N(vt.slider,vt[`size-${c}`],r&&vt.disabled,h),children:[(o||a)&&b.jsxs("div",{className:vt.header,children:[o&&b.jsx("label",{htmlFor:p,className:vt.label,children:o}),a&&b.jsx("span",{className:vt.value,children:u(S)})]}),b.jsxs("div",{className:vt["track-wrap"],style:{"--pct":`${_}%`},children:[b.jsx("div",{className:vt.fill,"aria-hidden":"true",style:{width:`${_}%`}}),b.jsx("input",{ref:f,id:p,type:"range",min:t,max:i,step:s,value:S,disabled:r,onChange:k,className:vt.input,"aria-label":o,"aria-valuetext":u(S)})]}),w.length>0&&b.jsx("div",{className:vt.ticks,"aria-hidden":"true",children:w.map(M=>b.jsx("span",{className:vt.tick,style:{left:`${(M-t)/(i-t)*100}%`}},M))})]})});zh.displayName="Slider";const T0="_tag_1n5cw_1",N0="_disabled_1n5cw_15",E0="_label_1n5cw_61",A0="_dismiss_1n5cw_66",di={tag:T0,disabled:N0,"size-sm":"_size-sm_1n5cw_21","size-md":"_size-md_1n5cw_26","size-lg":"_size-lg_1n5cw_31","variant-primary":"_variant-primary_1n5cw_37","variant-success":"_variant-success_1n5cw_43","variant-warning":"_variant-warning_1n5cw_49","variant-error":"_variant-error_1n5cw_55",label:E0,dismiss:A0},jh=x.forwardRef(({size:n="md",variant:e="default",dismissible:t=!1,onDismiss:i,disabled:s=!1,className:r,children:o,...a},l)=>b.jsxs("span",{ref:l,className:N(di.tag,di[`size-${n}`],di[`variant-${e}`],s&&di.disabled,r),...a,children:[b.jsx("span",{className:di.label,children:o}),t&&b.jsx("button",{type:"button",className:di.dismiss,onClick:i,disabled:s,"aria-label":"Remove",children:b.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M1 1l8 8M9 1L1 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}));jh.displayName="Tag";const P0="_wrapper_1gzlj_1",I0="_label_1gzlj_9",R0="_select_1gzlj_16",z0="_trigger_1gzlj_20",j0="_open_1gzlj_43",B0="_error_1gzlj_50",L0="_disabled_1gzlj_54",F0="_placeholder_1gzlj_67",W0="_icons_1gzlj_71",$0="_chevron_1gzlj_91",H0="_dropdown_1gzlj_100",V0="_list_1gzlj_134",Y0="_option_1gzlj_142",he={wrapper:P0,label:I0,select:R0,trigger:z0,"size-sm":"_size-sm_1gzlj_35","size-md":"_size-md_1gzlj_36","size-lg":"_size-lg_1gzlj_37",open:j0,error:B0,disabled:L0,"trigger-text":"_trigger-text_1gzlj_59",placeholder:F0,icons:W0,"clear-btn":"_clear-btn_1gzlj_80",chevron:$0,"chevron-open":"_chevron-open_1gzlj_95",dropdown:H0,"search-wrap":"_search-wrap_1gzlj_113","search-input":"_search-input_1gzlj_118",list:V0,option:Y0,"option-focused":"_option-focused_1gzlj_156","option-selected":"_option-selected_1gzlj_161","option-disabled":"_option-disabled_1gzlj_166","no-results":"_no-results_1gzlj_171","error-text":"_error-text_1gzlj_178"},Bh=x.forwardRef(({options:n,value:e,defaultValue:t,placeholder:i="Select…",size:s="md",disabled:r=!1,searchable:o=!1,clearable:a=!1,label:l,error:c,onChange:d,className:u,id:h},f)=>{const p=x.useId(),m=h??p,g=e!==void 0,[y,S]=x.useState(t??null),_=g?e??null:y,[k,v]=x.useState(!1),[w,M]=x.useState(""),[C,O]=x.useState(-1),D=x.useRef(null),A=x.useRef(null),P=x.useRef(null),F=n.find(E=>E.value===_)??null,B=o&&w?n.filter(E=>E.label.toLowerCase().includes(w.toLowerCase())):n,H=x.useCallback(E=>{E.disabled||(g||S(E.value),d?.(E.value),v(!1),M(""),O(-1))},[g,d]),K=x.useCallback(E=>{E.stopPropagation(),g||S(null),d?.(null)},[g,d]),G=x.useCallback(()=>{r||(v(E=>!E),O(-1))},[r]);x.useEffect(()=>{k&&o&&A.current?.focus()},[k,o]),x.useEffect(()=>{const E=V=>{D.current&&!D.current.contains(V.target)&&(v(!1),M(""))};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]);const R=x.useCallback(E=>{if(!k){(E.key==="Enter"||E.key===" "||E.key==="ArrowDown")&&(E.preventDefault(),v(!0),O(0));return}const V=B.filter(ee=>!ee.disabled);if(E.key==="Escape")v(!1),M("");else if(E.key==="ArrowDown")E.preventDefault(),O(ee=>Math.min(ee+1,V.length-1));else if(E.key==="ArrowUp")E.preventDefault(),O(ee=>Math.max(ee-1,0));else if(E.key==="Enter"&&C>=0){E.preventDefault();const ee=V[C];ee&&H(ee)}else E.key==="Tab"&&(v(!1),M(""))},[k,B,C,H]);return b.jsxs("div",{ref:f,className:N(he.wrapper,he[`size-${s}`],u),children:[l&&b.jsx("label",{htmlFor:m,className:he.label,children:l}),b.jsxs("div",{ref:D,className:N(he.select,k&&he.open,c&&he.error,r&&he.disabled),children:[b.jsxs("button",{type:"button",id:m,role:"combobox","aria-haspopup":"listbox","aria-expanded":k,"aria-controls":`${m}-listbox`,disabled:r,className:he.trigger,onClick:G,onKeyDown:R,children:[b.jsx("span",{className:N(he["trigger-text"],!F&&he.placeholder),children:F?F.label:i}),b.jsxs("span",{className:he.icons,children:[a&&_&&b.jsx("span",{role:"button","aria-label":"Clear selection",className:he["clear-btn"],onClick:K,onKeyDown:E=>{E.key==="Enter"&&K(E)},tabIndex:0,children:b.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),b.jsx("svg",{className:N(he.chevron,k&&he["chevron-open"]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M4 6l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]})]}),k&&b.jsxs("div",{className:he.dropdown,children:[o&&b.jsx("div",{className:he["search-wrap"],children:b.jsx("input",{ref:A,type:"text",className:he["search-input"],placeholder:"Search…",value:w,onChange:E=>{M(E.target.value),O(0)},onKeyDown:R,"aria-label":"Search options"})}),b.jsx("ul",{ref:P,id:`${m}-listbox`,role:"listbox",className:he.list,"aria-label":l??i,children:B.length===0?b.jsx("li",{className:he["no-results"],children:"No results"}):B.map((E,V)=>{const ee=B.filter((ke,et)=>!ke.disabled&&et<=V).length-1;return b.jsxs("li",{role:"option","aria-selected":E.value===_,"aria-disabled":E.disabled,className:N(he.option,E.value===_&&he["option-selected"],E.disabled&&he["option-disabled"],!E.disabled&&ee===C&&he["option-focused"]),onMouseDown:ke=>{ke.preventDefault(),H(E)},onMouseEnter:()=>!E.disabled&&O(ee),children:[E.label,E.value===_&&b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M2 7l3.5 3.5L12 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]},E.value)})})]})]}),c&&b.jsx("p",{className:he["error-text"],role:"alert",children:c})]})});Bh.displayName="Select";const q0="_wrapper_1nvek_1",K0="_label_1nvek_9",U0="_select_1nvek_16",J0="_trigger_1nvek_20",G0="_disabled_1nvek_37",X0="_open_1nvek_41",Q0="_error_1nvek_48",Z0="_tags_1nvek_57",ex="_placeholder_1nvek_66",tx="_tag_1nvek_57",nx="_chevron_1nvek_115",ix="_list_1nvek_126",sx="_option_1nvek_143",rx="_checkbox_1nvek_171",de={wrapper:q0,label:K0,select:U0,trigger:J0,"size-sm":"_size-sm_1nvek_33","size-md":"_size-md_1nvek_34","size-lg":"_size-lg_1nvek_35",disabled:G0,open:X0,error:Q0,tags:Z0,placeholder:ex,tag:tx,"tag-label":"_tag-label_1nvek_83","tag-remove":"_tag-remove_1nvek_87","search-input":"_search-input_1nvek_103",chevron:nx,"chevron-open":"_chevron-open_1nvek_121",list:ix,option:sx,"option-focused":"_option-focused_1nvek_157","option-selected":"_option-selected_1nvek_162","option-disabled":"_option-disabled_1nvek_166",checkbox:rx,"checkbox-checked":"_checkbox-checked_1nvek_182","no-results":"_no-results_1nvek_188","error-text":"_error-text_1nvek_195"},Lh=x.forwardRef(({options:n,value:e,defaultValue:t,placeholder:i="Select…",size:s="md",disabled:r=!1,searchable:o=!1,label:a,error:l,maxSelected:c,onChange:d,className:u,id:h},f)=>{const p=x.useId(),m=h??p,g=e!==void 0,[y,S]=x.useState(t??[]),_=g?e??[]:y,[k,v]=x.useState(!1),[w,M]=x.useState(""),[C,O]=x.useState(-1),D=x.useRef(null),A=x.useRef(null),P=o&&w?n.filter(R=>R.label.toLowerCase().includes(w.toLowerCase())):n,F=x.useCallback(R=>{g||S(R),d?.(R)},[g,d]),B=x.useCallback(R=>{if(R.disabled)return;if(_.includes(R.value))F(_.filter(V=>V!==R.value));else{if(c&&_.length>=c)return;F([..._,R.value])}M(""),o&&A.current?.focus()},[_,c,F,o]),H=x.useCallback((R,E)=>{E.stopPropagation(),F(_.filter(V=>V!==R))},[_,F]);x.useEffect(()=>{k&&o&&A.current?.focus()},[k,o]),x.useEffect(()=>{const R=E=>{D.current&&!D.current.contains(E.target)&&(v(!1),M(""))};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[]);const K=x.useCallback(R=>{if(!k){(R.key==="Enter"||R.key===" "||R.key==="ArrowDown")&&(R.preventDefault(),v(!0),O(0));return}const E=P.filter(V=>!V.disabled);if(R.key==="Escape")v(!1),M("");else if(R.key==="ArrowDown")R.preventDefault(),O(V=>Math.min(V+1,E.length-1));else if(R.key==="ArrowUp")R.preventDefault(),O(V=>Math.max(V-1,0));else if(R.key==="Enter"&&C>=0){R.preventDefault();const V=E[C];V&&B(V)}else R.key==="Tab"&&(v(!1),M(""))},[k,P,C,B]),G=n.filter(R=>_.includes(R.value));return b.jsxs("div",{ref:f,className:N(de.wrapper,de[`size-${s}`],u),children:[a&&b.jsx("label",{htmlFor:m,className:de.label,children:a}),b.jsxs("div",{ref:D,className:N(de.select,k&&de.open,l&&de.error,r&&de.disabled),children:[b.jsxs("div",{id:m,role:"combobox","aria-haspopup":"listbox","aria-expanded":k,"aria-controls":`${m}-listbox`,"aria-disabled":r,tabIndex:r?-1:0,className:de.trigger,onClick:()=>!r&&v(R=>!R),onKeyDown:K,children:[b.jsxs("div",{className:de.tags,children:[G.length===0&&b.jsx("span",{className:de.placeholder,children:i}),G.map(R=>b.jsxs("span",{className:de.tag,children:[b.jsx("span",{className:de["tag-label"],children:R.label}),b.jsx("button",{type:"button",className:de["tag-remove"],onClick:E=>H(R.value,E),"aria-label":`Remove ${R.label}`,tabIndex:-1,children:b.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M1 1l8 8M9 1L1 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]},R.value)),o&&k&&b.jsx("input",{ref:A,type:"text",className:de["search-input"],value:w,onChange:R=>{M(R.target.value),O(0)},onKeyDown:K,placeholder:G.length===0?i:"","aria-label":"Search options"})]}),b.jsx("svg",{className:N(de.chevron,k&&de["chevron-open"]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M4 6l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),k&&b.jsx("ul",{id:`${m}-listbox`,role:"listbox","aria-multiselectable":"true",className:de.list,"aria-label":a??i,children:P.length===0?b.jsx("li",{className:de["no-results"],children:"No results"}):P.map((R,E)=>{const V=P.filter((ke,et)=>!ke.disabled&&et<=E).length-1,ee=_.includes(R.value);return b.jsxs("li",{role:"option","aria-selected":ee,"aria-disabled":R.disabled,className:N(de.option,ee&&de["option-selected"],R.disabled&&de["option-disabled"],!R.disabled&&V===C&&de["option-focused"]),onMouseDown:ke=>{ke.preventDefault(),B(R)},onMouseEnter:()=>!R.disabled&&O(V),children:[b.jsx("span",{className:N(de.checkbox,ee&&de["checkbox-checked"]),"aria-hidden":"true",children:ee&&b.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:b.jsx("path",{d:"M1.5 5l2.5 2.5 4.5-4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),R.label]},R.value)})})]}),l&&b.jsx("p",{className:de["error-text"],role:"alert",children:l})]})});Lh.displayName="MultiSelect";const ox="_list_1dz0y_1",ax="_item_1dz0y_9",lx="_divided_1dz0y_30",cx="_selected_1dz0y_60",dx="_disabled_1dz0y_65",ux="_leading_1dz0y_70",hx="_content_1dz0y_77",fx="_trailing_1dz0y_82",Bt={list:ox,"variant-unordered":"_variant-unordered_1dz0y_9",item:ax,"variant-ordered":"_variant-ordered_1dz0y_15",divided:lx,"size-sm":"_size-sm_1dz0y_35","size-md":"_size-md_1dz0y_41","size-lg":"_size-lg_1dz0y_47",selected:cx,disabled:dx,leading:ux,content:hx,trailing:fx},Fh=x.forwardRef(({disabled:n=!1,selected:e=!1,leading:t,trailing:i,className:s,children:r,...o},a)=>b.jsxs("li",{ref:a,className:N(Bt.item,e&&Bt.selected,n&&Bt.disabled,s),"aria-selected":e,"aria-disabled":n,...o,children:[t&&b.jsx("span",{className:Bt.leading,children:t}),b.jsx("span",{className:Bt.content,children:r}),i&&b.jsx("span",{className:Bt.trailing,children:i})]}));Fh.displayName="ListItem";const Wh=x.forwardRef(({variant:n="none",size:e="md",divided:t=!1,className:i,children:s,...r},o)=>{const a=n==="ordered"?"ol":"ul";return b.jsx(a,{ref:o,className:N(Bt.list,Bt[`size-${e}`],Bt[`variant-${n}`],t&&Bt.divided,i),...r,children:s})});Wh.displayName="List";const px="_icon_wz4ut_12",mx="_title_wz4ut_24",gx="_description_wz4ut_32",bx="_action_wz4ut_40",$i={"empty-state":"_empty-state_wz4ut_1",icon:px,title:mx,description:gx,action:bx},$h=x.forwardRef(({icon:n,title:e,description:t,action:i,className:s,...r},o)=>b.jsxs("div",{ref:o,className:N($i["empty-state"],s),role:"status",...r,children:[n&&b.jsx("div",{className:$i.icon,"aria-hidden":"true",children:n}),b.jsx("p",{className:$i.title,children:e}),t&&b.jsx("p",{className:$i.description,children:t}),i&&b.jsx("div",{className:$i.action,children:i})]}));$h.displayName="EmptyState";const yx="_wrapper_1sowp_1",xx="_label_1sowp_9",_x="_dropzone_1sowp_16",kx="_disabled_1sowp_31",wx="_dragging_1sowp_41",vx="_error_1sowp_46",Sx="_content_1sowp_59",Mx="_hint_1sowp_86",Ke={wrapper:yx,label:xx,dropzone:_x,"size-sm":"_size-sm_1sowp_27","size-md":"_size-md_1sowp_28","size-lg":"_size-lg_1sowp_29",disabled:kx,dragging:wx,error:vx,"file-input":"_file-input_1sowp_55",content:Sx,"upload-icon":"_upload-icon_1sowp_68","upload-text":"_upload-text_1sowp_75","upload-link":"_upload-link_1sowp_81",hint:Mx,"error-text":"_error-text_1sowp_92"},Hh=x.forwardRef(({accept:n,multiple:e=!1,maxSize:t,disabled:i=!1,size:s="md",label:r,hint:o,error:a,onFiles:l,className:c,id:d},u)=>{const h=x.useId(),f=d??h,p=x.useRef(null),[m,g]=x.useState(!1),[y,S]=x.useState(null),_=x.useCallback(O=>{if(!O||O.length===0)return;const D=Array.from(O);if(t&&D.filter(P=>P.size>t).length>0){S(`File too large. Max size: ${Math.round(t/1024)}KB`);return}S(null),l?.(D)},[t,l]),k=x.useCallback(O=>{O.preventDefault(),g(!1),!i&&_(O.dataTransfer.files)},[i,_]),v=x.useCallback(O=>{O.preventDefault(),i||g(!0)},[i]),w=x.useCallback(()=>g(!1),[]),M=x.useCallback(O=>{_(O.target.files),O.target.value=""},[_]),C=a??y;return b.jsxs("div",{ref:u,className:N(Ke.wrapper,Ke[`size-${s}`],c),children:[r&&b.jsx("label",{htmlFor:f,className:Ke.label,children:r}),b.jsxs("div",{className:N(Ke.dropzone,m&&Ke.dragging,C&&Ke.error,i&&Ke.disabled),onDrop:k,onDragOver:v,onDragLeave:w,onClick:()=>!i&&p.current?.click(),role:"button",tabIndex:i?-1:0,"aria-disabled":i,"aria-label":r??"Upload files",onKeyDown:O=>{(O.key==="Enter"||O.key===" ")&&p.current?.click()},children:[b.jsx("input",{ref:p,id:f,type:"file",accept:n,multiple:e,disabled:i,className:Ke["file-input"],onChange:M,"aria-hidden":"true",tabIndex:-1}),b.jsxs("div",{className:Ke.content,children:[b.jsxs("svg",{className:Ke["upload-icon"],width:"24",height:"24",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[b.jsx("path",{d:"M12 15V3m0 0L8 7m4-4l4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),b.jsx("path",{d:"M3 15v4a2 2 0 002 2h14a2 2 0 002-2v-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),b.jsxs("p",{className:Ke["upload-text"],children:[b.jsx("span",{className:Ke["upload-link"],children:"Click to upload"})," or drag and drop"]}),o&&b.jsx("p",{className:Ke.hint,children:o})]})]}),C&&b.jsx("p",{className:Ke["error-text"],role:"alert",children:C})]})});Hh.displayName="FileUpload";const Cx="_carousel_1dzws_1",Ox="_track_1dzws_8",Dx="_slides_1dzws_14",Tx="_slide_1dzws_14",Nx="_arrow_1dzws_36",Ex="_dots_1dzws_73",Ax="_dot_1dzws_73",ut={carousel:Cx,track:Ox,slides:Dx,slide:Tx,"size-sm":"_size-sm_1dzws_25","size-md":"_size-md_1dzws_26","size-lg":"_size-lg_1dzws_27",arrow:Nx,"arrow-prev":"_arrow-prev_1dzws_69","arrow-next":"_arrow-next_1dzws_70",dots:Ex,dot:Ax,"dot-active":"_dot-active_1dzws_95"},Vh=x.forwardRef(({slides:n,size:e="md",showArrows:t=!0,showDots:i=!0,autoPlay:s=!1,autoPlayInterval:r=4e3,loop:o=!1,defaultIndex:a=0,onSlideChange:l,className:c,...d},u)=>{const[h,f]=x.useState(a),p=x.useRef(null),m=x.useCallback(k=>{const v=o?(k%n.length+n.length)%n.length:Math.max(0,Math.min(k,n.length-1));f(v),l?.(v)},[o,n.length,l]),g=x.useCallback(()=>m(h-1),[h,m]),y=x.useCallback(()=>m(h+1),[h,m]);x.useEffect(()=>{if(s)return p.current=setTimeout(()=>{m(o||h+1<n.length?h+1:0)},r),()=>{p.current&&clearTimeout(p.current)}},[s,r,h,m,o,n.length]);const S=o||h>0,_=o||h<n.length-1;return b.jsxs("div",{ref:u,className:N(ut.carousel,ut[`size-${e}`],c),"aria-roledescription":"carousel",...d,children:[b.jsx("div",{className:ut.track,"aria-live":"polite",children:b.jsx("div",{className:ut.slides,style:{transform:`translateX(-${h*100}%)`},children:n.map((k,v)=>b.jsx("div",{className:ut.slide,role:"group","aria-roledescription":"slide","aria-label":`Slide ${v+1} of ${n.length}`,"aria-hidden":v!==h,children:k},v))})}),t&&b.jsxs(b.Fragment,{children:[b.jsx("button",{type:"button",className:N(ut.arrow,ut["arrow-prev"]),onClick:g,disabled:!S,"aria-label":"Previous slide",children:b.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M12.5 5l-5 5 5 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),b.jsx("button",{type:"button",className:N(ut.arrow,ut["arrow-next"]),onClick:y,disabled:!_,"aria-label":"Next slide",children:b.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M7.5 15l5-5-5-5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),i&&n.length>1&&b.jsx("div",{className:ut.dots,role:"tablist","aria-label":"Slides",children:n.map((k,v)=>b.jsx("button",{type:"button",role:"tab","aria-selected":v===h,"aria-label":`Go to slide ${v+1}`,className:N(ut.dot,v===h&&ut["dot-active"]),onClick:()=>m(v)},v))})]})});Vh.displayName="Carousel";function Px(n,e,t="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:n,timeZoneName:t}).format(e).split(/\s/g).slice(2).join(" ")}const Ix={},es={};function Vn(n,e){try{const i=(Ix[n]||=new Intl.DateTimeFormat("en-US",{timeZone:n,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return i in es?es[i]:Ul(i,i.split(":"))}catch{if(n in es)return es[n];const t=n?.match(Rx);return t?Ul(n,t.slice(1)):NaN}}const Rx=/([+-]\d\d):?(\d\d)?/;function Ul(n,e){const t=+(e[0]||0),i=+(e[1]||0),s=+(e[2]||0)/60;return es[n]=t*60+i>0?t*60+i+s:t*60-i-s}class Lt extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Vn(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),Yh(this),ca(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new Lt(...t,e):new Lt(Date.now(),e)}withTimeZone(e){return new Lt(+this,e)}getTimezoneOffset(){const e=-Vn(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),ca(this),+this}[Symbol.for("constructDateFrom")](e){return new Lt(+new Date(e),this.timeZone)}}const Jl=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(n=>{if(!Jl.test(n))return;const e=n.replace(Jl,"$1UTC");Lt.prototype[e]&&(n.startsWith("get")?Lt.prototype[n]=function(){return this.internal[e]()}:(Lt.prototype[n]=function(){return Date.prototype[e].apply(this.internal,arguments),zx(this),+this},Lt.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),ca(this),+this}))});function ca(n){n.internal.setTime(+n),n.internal.setUTCSeconds(n.internal.getUTCSeconds()-Math.round(-Vn(n.timeZone,n)*60))}function zx(n){Date.prototype.setFullYear.call(n,n.internal.getUTCFullYear(),n.internal.getUTCMonth(),n.internal.getUTCDate()),Date.prototype.setHours.call(n,n.internal.getUTCHours(),n.internal.getUTCMinutes(),n.internal.getUTCSeconds(),n.internal.getUTCMilliseconds()),Yh(n)}function Yh(n){const e=Vn(n.timeZone,n),t=e>0?Math.floor(e):Math.ceil(e),i=new Date(+n);i.setUTCHours(i.getUTCHours()-1);const s=-new Date(+n).getTimezoneOffset(),r=-new Date(+i).getTimezoneOffset(),o=s-r,a=Date.prototype.getHours.apply(n)!==n.internal.getUTCHours();o&&a&&n.internal.setUTCMinutes(n.internal.getUTCMinutes()+o);const l=s-t;l&&Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+l);const c=new Date(+n);c.setUTCSeconds(0);const d=s>0?c.getSeconds():(c.getSeconds()-60)%60,u=Math.round(-(Vn(n.timeZone,n)*60))%60;(u||d)&&(n.internal.setUTCSeconds(n.internal.getUTCSeconds()+u),Date.prototype.setUTCSeconds.call(n,Date.prototype.getUTCSeconds.call(n)+u+d));const h=Vn(n.timeZone,n),f=h>0?Math.floor(h):Math.ceil(h),m=-new Date(+n).getTimezoneOffset()-f,g=f!==t,y=m-l;if(g&&y){Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+y);const S=Vn(n.timeZone,n),_=S>0?Math.floor(S):Math.ceil(S),k=f-_;k&&(n.internal.setUTCMinutes(n.internal.getUTCMinutes()+k),Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+k))}}class ze extends Lt{static tz(e,...t){return t.length?new ze(...t,e):new ze(Date.now(),e)}toISOString(){const[e,t,i]=this.tzComponents(),s=`${e}${t}:${i}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,i,s]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${i} ${t} ${s}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,i,s]=this.tzComponents();return`${e} GMT${t}${i}${s} (${Px(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",i=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),s=String(Math.abs(e)%60).padStart(2,"0");return[t,i,s]}withTimeZone(e){return new ze(+this,e)}[Symbol.for("constructDateFrom")](e){return new ze(+new Date(e),this.timeZone)}}const qh=6048e5,jx=864e5,Gl=Symbol.for("constructDateFrom");function ye(n,e){return typeof n=="function"?n(e):n&&typeof n=="object"&&Gl in n?n[Gl](e):n instanceof Date?new n.constructor(e):new Date(e)}function oe(n,e){return ye(e||n,n)}function Kh(n,e,t){const i=oe(n,t?.in);return isNaN(e)?ye(n,NaN):(e&&i.setDate(i.getDate()+e),i)}function Uh(n,e,t){const i=oe(n,t?.in);if(isNaN(e))return ye(n,NaN);if(!e)return i;const s=i.getDate(),r=ye(n,i.getTime());r.setMonth(i.getMonth()+e+1,0);const o=r.getDate();return s>=o?r:(i.setFullYear(r.getFullYear(),r.getMonth(),s),i)}let Bx={};function Rs(){return Bx}function Oi(n,e){const t=Rs(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,s=oe(n,e?.in),r=s.getDay(),o=(r<i?7:0)+r-i;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function bs(n,e){return Oi(n,{...e,weekStartsOn:1})}function Jh(n,e){const t=oe(n,e?.in),i=t.getFullYear(),s=ye(t,0);s.setFullYear(i+1,0,4),s.setHours(0,0,0,0);const r=bs(s),o=ye(t,0);o.setFullYear(i,0,4),o.setHours(0,0,0,0);const a=bs(o);return t.getTime()>=r.getTime()?i+1:t.getTime()>=a.getTime()?i:i-1}function Xl(n){const e=oe(n),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+n-+t}function ji(n,...e){const t=ye.bind(null,e.find(i=>typeof i=="object"));return e.map(t)}function ys(n,e){const t=oe(n,e?.in);return t.setHours(0,0,0,0),t}function Va(n,e,t){const[i,s]=ji(t?.in,n,e),r=ys(i),o=ys(s),a=+r-Xl(r),l=+o-Xl(o);return Math.round((a-l)/jx)}function Lx(n,e){const t=Jh(n,e),i=ye(n,0);return i.setFullYear(t,0,4),i.setHours(0,0,0,0),bs(i)}function Fx(n,e,t){return Kh(n,e*7,t)}function Wx(n,e,t){return Uh(n,e*12,t)}function $x(n,e){let t,i=e?.in;return n.forEach(s=>{!i&&typeof s=="object"&&(i=ye.bind(null,s));const r=oe(s,i);(!t||t<r||isNaN(+r))&&(t=r)}),ye(i,t||NaN)}function Hx(n,e){let t,i=e?.in;return n.forEach(s=>{!i&&typeof s=="object"&&(i=ye.bind(null,s));const r=oe(s,i);(!t||t>r||isNaN(+r))&&(t=r)}),ye(i,t||NaN)}function Vx(n,e,t){const[i,s]=ji(t?.in,n,e);return+ys(i)==+ys(s)}function Gh(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function Yx(n){return!(!Gh(n)&&typeof n!="number"||isNaN(+oe(n)))}function Xh(n,e,t){const[i,s]=ji(t?.in,n,e),r=i.getFullYear()-s.getFullYear(),o=i.getMonth()-s.getMonth();return r*12+o}function qx(n,e){const t=oe(n,e?.in),i=t.getMonth();return t.setFullYear(t.getFullYear(),i+1,0),t.setHours(23,59,59,999),t}function Qh(n,e){const[t,i]=ji(n,e.start,e.end);return{start:t,end:i}}function Kx(n,e){const{start:t,end:i}=Qh(e?.in,n);let s=+t>+i;const r=s?+t:+i,o=s?i:t;o.setHours(0,0,0,0),o.setDate(1);let a=1;const l=[];for(;+o<=r;)l.push(ye(t,o)),o.setMonth(o.getMonth()+a);return s?l.reverse():l}function Ux(n,e){const t=oe(n,e?.in);return t.setDate(1),t.setHours(0,0,0,0),t}function Jx(n,e){const t=oe(n,e?.in),i=t.getFullYear();return t.setFullYear(i+1,0,0),t.setHours(23,59,59,999),t}function Zh(n,e){const t=oe(n,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function Gx(n,e){const{start:t,end:i}=Qh(e?.in,n);let s=+t>+i;const r=s?+t:+i,o=s?i:t;o.setHours(0,0,0,0),o.setMonth(0,1);let a=1;const l=[];for(;+o<=r;)l.push(ye(t,o)),o.setFullYear(o.getFullYear()+a);return s?l.reverse():l}function ef(n,e){const t=Rs(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,s=oe(n,e?.in),r=s.getDay(),o=(r<i?-7:0)+6-(r-i);return s.setDate(s.getDate()+o),s.setHours(23,59,59,999),s}function Xx(n,e){return ef(n,{...e,weekStartsOn:1})}const Qx={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Zx=(n,e,t)=>{let i;const s=Qx[n];return typeof s=="string"?i=s:e===1?i=s.one:i=s.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+i:i+" ago":i};function _o(n){return(e={})=>{const t=e.width?String(e.width):n.defaultWidth;return n.formats[t]||n.formats[n.defaultWidth]}}const e1={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},t1={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},n1={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},i1={date:_o({formats:e1,defaultWidth:"full"}),time:_o({formats:t1,defaultWidth:"full"}),dateTime:_o({formats:n1,defaultWidth:"full"})},s1={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},r1=(n,e,t,i)=>s1[n];function Hi(n){return(e,t)=>{const i=t?.context?String(t.context):"standalone";let s;if(i==="formatting"&&n.formattingValues){const o=n.defaultFormattingWidth||n.defaultWidth,a=t?.width?String(t.width):o;s=n.formattingValues[a]||n.formattingValues[o]}else{const o=n.defaultWidth,a=t?.width?String(t.width):n.defaultWidth;s=n.values[a]||n.values[o]}const r=n.argumentCallback?n.argumentCallback(e):e;return s[r]}}const o1={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},a1={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},l1={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},c1={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},d1={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},u1={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},h1=(n,e)=>{const t=Number(n),i=t%100;if(i>20||i<10)switch(i%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},f1={ordinalNumber:h1,era:Hi({values:o1,defaultWidth:"wide"}),quarter:Hi({values:a1,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Hi({values:l1,defaultWidth:"wide"}),day:Hi({values:c1,defaultWidth:"wide"}),dayPeriod:Hi({values:d1,defaultWidth:"wide",formattingValues:u1,defaultFormattingWidth:"wide"})};function Vi(n){return(e,t={})=>{const i=t.width,s=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],r=e.match(s);if(!r)return null;const o=r[0],a=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(a)?m1(a,u=>u.test(o)):p1(a,u=>u.test(o));let c;c=n.valueCallback?n.valueCallback(l):l,c=t.valueCallback?t.valueCallback(c):c;const d=e.slice(o.length);return{value:c,rest:d}}}function p1(n,e){for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&e(n[t]))return t}function m1(n,e){for(let t=0;t<n.length;t++)if(e(n[t]))return t}function g1(n){return(e,t={})=>{const i=e.match(n.matchPattern);if(!i)return null;const s=i[0],r=e.match(n.parsePattern);if(!r)return null;let o=n.valueCallback?n.valueCallback(r[0]):r[0];o=t.valueCallback?t.valueCallback(o):o;const a=e.slice(s.length);return{value:o,rest:a}}}const b1=/^(\d+)(th|st|nd|rd)?/i,y1=/\d+/i,x1={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},_1={any:[/^b/i,/^(a|c)/i]},k1={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},w1={any:[/1/i,/2/i,/3/i,/4/i]},v1={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},S1={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},M1={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},C1={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},O1={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},D1={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},T1={ordinalNumber:g1({matchPattern:b1,parsePattern:y1,valueCallback:n=>parseInt(n,10)}),era:Vi({matchPatterns:x1,defaultMatchWidth:"wide",parsePatterns:_1,defaultParseWidth:"any"}),quarter:Vi({matchPatterns:k1,defaultMatchWidth:"wide",parsePatterns:w1,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Vi({matchPatterns:v1,defaultMatchWidth:"wide",parsePatterns:S1,defaultParseWidth:"any"}),day:Vi({matchPatterns:M1,defaultMatchWidth:"wide",parsePatterns:C1,defaultParseWidth:"any"}),dayPeriod:Vi({matchPatterns:O1,defaultMatchWidth:"any",parsePatterns:D1,defaultParseWidth:"any"})},yi={code:"en-US",formatDistance:Zx,formatLong:i1,formatRelative:r1,localize:f1,match:T1,options:{weekStartsOn:0,firstWeekContainsDate:1}};function N1(n,e){const t=oe(n,e?.in);return Va(t,Zh(t))+1}function Ya(n,e){const t=oe(n,e?.in),i=+bs(t)-+Lx(t);return Math.round(i/qh)+1}function tf(n,e){const t=oe(n,e?.in),i=t.getFullYear(),s=Rs(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,o=ye(e?.in||n,0);o.setFullYear(i+1,0,r),o.setHours(0,0,0,0);const a=Oi(o,e),l=ye(e?.in||n,0);l.setFullYear(i,0,r),l.setHours(0,0,0,0);const c=Oi(l,e);return+t>=+a?i+1:+t>=+c?i:i-1}function E1(n,e){const t=Rs(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,s=tf(n,e),r=ye(e?.in||n,0);return r.setFullYear(s,0,i),r.setHours(0,0,0,0),Oi(r,e)}function qa(n,e){const t=oe(n,e?.in),i=+Oi(t,e)-+E1(t,e);return Math.round(i/qh)+1}function ie(n,e){const t=n<0?"-":"",i=Math.abs(n).toString().padStart(e,"0");return t+i}const ln={y(n,e){const t=n.getFullYear(),i=t>0?t:1-t;return ie(e==="yy"?i%100:i,e.length)},M(n,e){const t=n.getMonth();return e==="M"?String(t+1):ie(t+1,2)},d(n,e){return ie(n.getDate(),e.length)},a(n,e){const t=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];default:return t==="am"?"a.m.":"p.m."}},h(n,e){return ie(n.getHours()%12||12,e.length)},H(n,e){return ie(n.getHours(),e.length)},m(n,e){return ie(n.getMinutes(),e.length)},s(n,e){return ie(n.getSeconds(),e.length)},S(n,e){const t=e.length,i=n.getMilliseconds(),s=Math.trunc(i*Math.pow(10,t-3));return ie(s,e.length)}},ui={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ql={G:function(n,e,t){const i=n.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(i,{width:"abbreviated"});case"GGGGG":return t.era(i,{width:"narrow"});default:return t.era(i,{width:"wide"})}},y:function(n,e,t){if(e==="yo"){const i=n.getFullYear(),s=i>0?i:1-i;return t.ordinalNumber(s,{unit:"year"})}return ln.y(n,e)},Y:function(n,e,t,i){const s=tf(n,i),r=s>0?s:1-s;if(e==="YY"){const o=r%100;return ie(o,2)}return e==="Yo"?t.ordinalNumber(r,{unit:"year"}):ie(r,e.length)},R:function(n,e){const t=Jh(n);return ie(t,e.length)},u:function(n,e){const t=n.getFullYear();return ie(t,e.length)},Q:function(n,e,t){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"Q":return String(i);case"QQ":return ie(i,2);case"Qo":return t.ordinalNumber(i,{unit:"quarter"});case"QQQ":return t.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(i,{width:"narrow",context:"formatting"});default:return t.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,e,t){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"q":return String(i);case"qq":return ie(i,2);case"qo":return t.ordinalNumber(i,{unit:"quarter"});case"qqq":return t.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(i,{width:"narrow",context:"standalone"});default:return t.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,e,t){const i=n.getMonth();switch(e){case"M":case"MM":return ln.M(n,e);case"Mo":return t.ordinalNumber(i+1,{unit:"month"});case"MMM":return t.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(i,{width:"narrow",context:"formatting"});default:return t.month(i,{width:"wide",context:"formatting"})}},L:function(n,e,t){const i=n.getMonth();switch(e){case"L":return String(i+1);case"LL":return ie(i+1,2);case"Lo":return t.ordinalNumber(i+1,{unit:"month"});case"LLL":return t.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(i,{width:"narrow",context:"standalone"});default:return t.month(i,{width:"wide",context:"standalone"})}},w:function(n,e,t,i){const s=qa(n,i);return e==="wo"?t.ordinalNumber(s,{unit:"week"}):ie(s,e.length)},I:function(n,e,t){const i=Ya(n);return e==="Io"?t.ordinalNumber(i,{unit:"week"}):ie(i,e.length)},d:function(n,e,t){return e==="do"?t.ordinalNumber(n.getDate(),{unit:"date"}):ln.d(n,e)},D:function(n,e,t){const i=N1(n);return e==="Do"?t.ordinalNumber(i,{unit:"dayOfYear"}):ie(i,e.length)},E:function(n,e,t){const i=n.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(i,{width:"short",context:"formatting"});default:return t.day(i,{width:"wide",context:"formatting"})}},e:function(n,e,t,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return ie(r,2);case"eo":return t.ordinalNumber(r,{unit:"day"});case"eee":return t.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(s,{width:"short",context:"formatting"});default:return t.day(s,{width:"wide",context:"formatting"})}},c:function(n,e,t,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return ie(r,e.length);case"co":return t.ordinalNumber(r,{unit:"day"});case"ccc":return t.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(s,{width:"narrow",context:"standalone"});case"cccccc":return t.day(s,{width:"short",context:"standalone"});default:return t.day(s,{width:"wide",context:"standalone"})}},i:function(n,e,t){const i=n.getDay(),s=i===0?7:i;switch(e){case"i":return String(s);case"ii":return ie(s,e.length);case"io":return t.ordinalNumber(s,{unit:"day"});case"iii":return t.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(i,{width:"short",context:"formatting"});default:return t.day(i,{width:"wide",context:"formatting"})}},a:function(n,e,t){const s=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(n,e,t){const i=n.getHours();let s;switch(i===12?s=ui.noon:i===0?s=ui.midnight:s=i/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(n,e,t){const i=n.getHours();let s;switch(i>=17?s=ui.evening:i>=12?s=ui.afternoon:i>=4?s=ui.morning:s=ui.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(n,e,t){if(e==="ho"){let i=n.getHours()%12;return i===0&&(i=12),t.ordinalNumber(i,{unit:"hour"})}return ln.h(n,e)},H:function(n,e,t){return e==="Ho"?t.ordinalNumber(n.getHours(),{unit:"hour"}):ln.H(n,e)},K:function(n,e,t){const i=n.getHours()%12;return e==="Ko"?t.ordinalNumber(i,{unit:"hour"}):ie(i,e.length)},k:function(n,e,t){let i=n.getHours();return i===0&&(i=24),e==="ko"?t.ordinalNumber(i,{unit:"hour"}):ie(i,e.length)},m:function(n,e,t){return e==="mo"?t.ordinalNumber(n.getMinutes(),{unit:"minute"}):ln.m(n,e)},s:function(n,e,t){return e==="so"?t.ordinalNumber(n.getSeconds(),{unit:"second"}):ln.s(n,e)},S:function(n,e){return ln.S(n,e)},X:function(n,e,t){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return ec(i);case"XXXX":case"XX":return Bn(i);default:return Bn(i,":")}},x:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"x":return ec(i);case"xxxx":case"xx":return Bn(i);default:return Bn(i,":")}},O:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Zl(i,":");default:return"GMT"+Bn(i,":")}},z:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Zl(i,":");default:return"GMT"+Bn(i,":")}},t:function(n,e,t){const i=Math.trunc(+n/1e3);return ie(i,e.length)},T:function(n,e,t){return ie(+n,e.length)}};function Zl(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),s=Math.trunc(i/60),r=i%60;return r===0?t+String(s):t+String(s)+e+ie(r,2)}function ec(n,e){return n%60===0?(n>0?"-":"+")+ie(Math.abs(n)/60,2):Bn(n,e)}function Bn(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),s=ie(Math.trunc(i/60),2),r=ie(i%60,2);return t+s+e+r}const tc=(n,e)=>{switch(n){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},nf=(n,e)=>{switch(n){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},A1=(n,e)=>{const t=n.match(/(P+)(p+)?/)||[],i=t[1],s=t[2];if(!s)return tc(n,e);let r;switch(i){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",tc(i,e)).replace("{{time}}",nf(s,e))},P1={p:nf,P:A1},I1=/^D+$/,R1=/^Y+$/,z1=["D","DD","YY","YYYY"];function j1(n){return I1.test(n)}function B1(n){return R1.test(n)}function L1(n,e,t){const i=F1(n,e,t);if(console.warn(i),z1.includes(n))throw new RangeError(i)}function F1(n,e,t){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${e}\`) for formatting ${i} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const W1=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$1=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,H1=/^'([^]*?)'?$/,V1=/''/g,Y1=/[a-zA-Z]/;function ts(n,e,t){const i=Rs(),s=t?.locale??i.locale??yi,r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,a=oe(n,t?.in);if(!Yx(a))throw new RangeError("Invalid time value");let l=e.match($1).map(d=>{const u=d[0];if(u==="p"||u==="P"){const h=P1[u];return h(d,s.formatLong)}return d}).join("").match(W1).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const u=d[0];if(u==="'")return{isToken:!1,value:q1(d)};if(Ql[u])return{isToken:!0,value:d};if(u.match(Y1))throw new RangeError("Format string contains an unescaped latin alphabet character `"+u+"`");return{isToken:!1,value:d}});s.localize.preprocessor&&(l=s.localize.preprocessor(a,l));const c={firstWeekContainsDate:r,weekStartsOn:o,locale:s};return l.map(d=>{if(!d.isToken)return d.value;const u=d.value;(!t?.useAdditionalWeekYearTokens&&B1(u)||!t?.useAdditionalDayOfYearTokens&&j1(u))&&L1(u,e,String(n));const h=Ql[u[0]];return h(a,u,s.localize,c)}).join("")}function q1(n){const e=n.match(H1);return e?e[1].replace(V1,"'"):n}function K1(n,e){const t=oe(n,e?.in),i=t.getFullYear(),s=t.getMonth(),r=ye(t,0);return r.setFullYear(i,s+1,0),r.setHours(0,0,0,0),r.getDate()}function U1(n,e){return oe(n,e?.in).getMonth()}function J1(n,e){return oe(n,e?.in).getFullYear()}function G1(n,e){return+oe(n)>+oe(e)}function X1(n,e){return+oe(n)<+oe(e)}function Q1(n,e,t){const[i,s]=ji(t?.in,n,e);return i.getFullYear()===s.getFullYear()&&i.getMonth()===s.getMonth()}function Z1(n,e,t){const[i,s]=ji(t?.in,n,e);return i.getFullYear()===s.getFullYear()}function e_(n,e,t){const i=oe(n,t?.in),s=i.getFullYear(),r=i.getDate(),o=ye(n,0);o.setFullYear(s,e,15),o.setHours(0,0,0,0);const a=K1(o);return i.setMonth(e,Math.min(r,a)),i}function t_(n,e,t){const i=oe(n,t?.in);return isNaN(+i)?ye(n,NaN):(i.setFullYear(e),i)}const nc=5,n_=4;function i_(n,e){const t=e.startOfMonth(n),i=t.getDay()>0?t.getDay():7,s=e.addDays(n,-i+1),r=e.addDays(s,nc*7-1);return e.getMonth(n)===e.getMonth(r)?nc:n_}function sf(n,e){const t=e.startOfMonth(n),i=t.getDay();return i===1?t:i===0?e.addDays(t,-6):e.addDays(t,-1*(i-1))}function s_(n,e){const t=sf(n,e),i=i_(n,e);return e.addDays(t,i*7-1)}const rf={...yi,labels:{labelDayButton:(n,e,t,i)=>{let s;i&&typeof i.format=="function"?s=i.format.bind(i):s=(o,a)=>ts(o,a,{locale:yi,...t});let r=s(n,"PPPP");return e.today&&(r=`Today, ${r}`),e.selected&&(r=`${r}, selected`),r},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:n=>`Week ${n}`,labelYearDropdown:"Choose the Year",labelGrid:(n,e,t)=>{let i;return t&&typeof t.format=="function"?i=t.format.bind(t):i=(s,r)=>ts(s,r,{locale:yi,...e}),i(n,"LLLL yyyy")},labelGridcell:(n,e,t,i)=>{let s;i&&typeof i.format=="function"?s=i.format.bind(i):s=(o,a)=>ts(o,a,{locale:yi,...t});let r=s(n,"PPPP");return e?.today&&(r=`Today, ${r}`),r},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(n,e,t)=>{let i;return t&&typeof t.format=="function"?i=t.format.bind(t):i=(s,r)=>ts(s,r,{locale:yi,...e}),i(n,"cccc")}}};class dt{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?ze.tz(this.options.timeZone):new this.Date,this.newDate=(i,s,r)=>this.overrides?.newDate?this.overrides.newDate(i,s,r):this.options.timeZone?new ze(i,s,r,this.options.timeZone):new Date(i,s,r),this.addDays=(i,s)=>this.overrides?.addDays?this.overrides.addDays(i,s):Kh(i,s),this.addMonths=(i,s)=>this.overrides?.addMonths?this.overrides.addMonths(i,s):Uh(i,s),this.addWeeks=(i,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(i,s):Fx(i,s),this.addYears=(i,s)=>this.overrides?.addYears?this.overrides.addYears(i,s):Wx(i,s),this.differenceInCalendarDays=(i,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(i,s):Va(i,s),this.differenceInCalendarMonths=(i,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(i,s):Xh(i,s),this.eachMonthOfInterval=i=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(i):Kx(i),this.eachYearOfInterval=i=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(i):Gx(i),r=new Set(s.map(a=>this.getYear(a)));if(r.size===s.length)return s;const o=[];return r.forEach(a=>{o.push(new Date(a,0,1))}),o},this.endOfBroadcastWeek=i=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(i):s_(i,this),this.endOfISOWeek=i=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(i):Xx(i),this.endOfMonth=i=>this.overrides?.endOfMonth?this.overrides.endOfMonth(i):qx(i),this.endOfWeek=(i,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(i,s):ef(i,this.options),this.endOfYear=i=>this.overrides?.endOfYear?this.overrides.endOfYear(i):Jx(i),this.format=(i,s,r)=>{const o=this.overrides?.format?this.overrides.format(i,s,this.options):ts(i,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(o):o},this.getISOWeek=i=>this.overrides?.getISOWeek?this.overrides.getISOWeek(i):Ya(i),this.getMonth=(i,s)=>this.overrides?.getMonth?this.overrides.getMonth(i,this.options):U1(i,this.options),this.getYear=(i,s)=>this.overrides?.getYear?this.overrides.getYear(i,this.options):J1(i,this.options),this.getWeek=(i,s)=>this.overrides?.getWeek?this.overrides.getWeek(i,this.options):qa(i,this.options),this.isAfter=(i,s)=>this.overrides?.isAfter?this.overrides.isAfter(i,s):G1(i,s),this.isBefore=(i,s)=>this.overrides?.isBefore?this.overrides.isBefore(i,s):X1(i,s),this.isDate=i=>this.overrides?.isDate?this.overrides.isDate(i):Gh(i),this.isSameDay=(i,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(i,s):Vx(i,s),this.isSameMonth=(i,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(i,s):Q1(i,s),this.isSameYear=(i,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(i,s):Z1(i,s),this.max=i=>this.overrides?.max?this.overrides.max(i):$x(i),this.min=i=>this.overrides?.min?this.overrides.min(i):Hx(i),this.setMonth=(i,s)=>this.overrides?.setMonth?this.overrides.setMonth(i,s):e_(i,s),this.setYear=(i,s)=>this.overrides?.setYear?this.overrides.setYear(i,s):t_(i,s),this.startOfBroadcastWeek=(i,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(i,this):sf(i,this),this.startOfDay=i=>this.overrides?.startOfDay?this.overrides.startOfDay(i):ys(i),this.startOfISOWeek=i=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(i):bs(i),this.startOfMonth=i=>this.overrides?.startOfMonth?this.overrides.startOfMonth(i):Ux(i),this.startOfWeek=(i,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(i,this.options):Oi(i,this.options),this.startOfYear=i=>this.overrides?.startOfYear?this.overrides.startOfYear(i):Zh(i),this.options={locale:rf,...e},this.overrides=t}getDigitMap(){const{numerals:e="latn"}=this.options,t=new Intl.NumberFormat("en-US",{numberingSystem:e}),i={};for(let s=0;s<10;s++)i[s.toString()]=t.format(s);return i}replaceDigits(e){const t=this.getDigitMap();return e.replace(/\d/g,i=>t[i]||i)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&dt.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:t,timeZone:i,numerals:s}=this.options,r=t?.code;if(r&&dt.yearFirstLocales.has(r))try{return new Intl.DateTimeFormat(r,{month:"long",year:"numeric",timeZone:i,numberingSystem:s}).format(e)}catch{}const o=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,o)}}dt.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Ht=new dt;class of{constructor(e,t,i=Ht){this.date=e,this.displayMonth=t,this.outside=!!(t&&!i.isSameMonth(e,t)),this.dateLib=i,this.isoDate=i.format(e,"yyyy-MM-dd"),this.displayMonthId=i.format(t,"yyyy-MM"),this.dateMonthId=i.format(e,"yyyy-MM")}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class r_{constructor(e,t){this.date=e,this.weeks=t}}class o_{constructor(e,t){this.days=t,this.weekNumber=e}}function a_(n){return x.createElement("button",{...n})}function l_(n){return x.createElement("span",{...n})}function c_(n){const{size:e=24,orientation:t="left",className:i}=n;return x.createElement("svg",{className:i,width:e,height:e,viewBox:"0 0 24 24"},t==="up"&&x.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),t==="down"&&x.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),t==="left"&&x.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),t==="right"&&x.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function d_(n){const{day:e,modifiers:t,...i}=n;return x.createElement("td",{...i})}function u_(n){const{day:e,modifiers:t,...i}=n,s=x.useRef(null);return x.useEffect(()=>{t.focused&&s.current?.focus()},[t.focused]),x.createElement("button",{ref:s,...i})}var j;(function(n){n.Root="root",n.Chevron="chevron",n.Day="day",n.DayButton="day_button",n.CaptionLabel="caption_label",n.Dropdowns="dropdowns",n.Dropdown="dropdown",n.DropdownRoot="dropdown_root",n.Footer="footer",n.MonthGrid="month_grid",n.MonthCaption="month_caption",n.MonthsDropdown="months_dropdown",n.Month="month",n.Months="months",n.Nav="nav",n.NextMonthButton="button_next",n.PreviousMonthButton="button_previous",n.Week="week",n.Weeks="weeks",n.Weekday="weekday",n.Weekdays="weekdays",n.WeekNumber="week_number",n.WeekNumberHeader="week_number_header",n.YearsDropdown="years_dropdown"})(j||(j={}));var fe;(function(n){n.disabled="disabled",n.hidden="hidden",n.outside="outside",n.focused="focused",n.today="today"})(fe||(fe={}));var Dt;(function(n){n.range_end="range_end",n.range_middle="range_middle",n.range_start="range_start",n.selected="selected"})(Dt||(Dt={}));var ot;(function(n){n.weeks_before_enter="weeks_before_enter",n.weeks_before_exit="weeks_before_exit",n.weeks_after_enter="weeks_after_enter",n.weeks_after_exit="weeks_after_exit",n.caption_after_enter="caption_after_enter",n.caption_after_exit="caption_after_exit",n.caption_before_enter="caption_before_enter",n.caption_before_exit="caption_before_exit"})(ot||(ot={}));function h_(n){const{options:e,className:t,components:i,classNames:s,...r}=n,o=[s[j.Dropdown],t].join(" "),a=e?.find(({value:l})=>l===r.value);return x.createElement("span",{"data-disabled":r.disabled,className:s[j.DropdownRoot]},x.createElement(i.Select,{className:o,...r},e?.map(({value:l,label:c,disabled:d})=>x.createElement(i.Option,{key:l,value:l,disabled:d},c))),x.createElement("span",{className:s[j.CaptionLabel],"aria-hidden":!0},a?.label,x.createElement(i.Chevron,{orientation:"down",size:18,className:s[j.Chevron]})))}function f_(n){return x.createElement("div",{...n})}function p_(n){return x.createElement("div",{...n})}function m_(n){const{calendarMonth:e,displayIndex:t,...i}=n;return x.createElement("div",{...i},n.children)}function g_(n){const{calendarMonth:e,displayIndex:t,...i}=n;return x.createElement("div",{...i})}function b_(n){return x.createElement("table",{...n})}function y_(n){return x.createElement("div",{...n})}const af=x.createContext(void 0);function zs(){const n=x.useContext(af);if(n===void 0)throw new Error("useDayPicker() must be used within a custom component.");return n}function x_(n){const{components:e}=zs();return x.createElement(e.Dropdown,{...n})}function __(n){const{onPreviousClick:e,onNextClick:t,previousMonth:i,nextMonth:s,...r}=n,{components:o,classNames:a,labels:{labelPrevious:l,labelNext:c}}=zs(),d=x.useCallback(h=>{s&&t?.(h)},[s,t]),u=x.useCallback(h=>{i&&e?.(h)},[i,e]);return x.createElement("nav",{...r},x.createElement(o.PreviousMonthButton,{type:"button",className:a[j.PreviousMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":l(i),onClick:u},x.createElement(o.Chevron,{disabled:i?void 0:!0,className:a[j.Chevron],orientation:"left"})),x.createElement(o.NextMonthButton,{type:"button",className:a[j.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":c(s),onClick:d},x.createElement(o.Chevron,{disabled:s?void 0:!0,orientation:"right",className:a[j.Chevron]})))}function k_(n){const{components:e}=zs();return x.createElement(e.Button,{...n})}function w_(n){return x.createElement("option",{...n})}function v_(n){const{components:e}=zs();return x.createElement(e.Button,{...n})}function S_(n){const{rootRef:e,...t}=n;return x.createElement("div",{...t,ref:e})}function M_(n){return x.createElement("select",{...n})}function C_(n){const{week:e,...t}=n;return x.createElement("tr",{...t})}function O_(n){return x.createElement("th",{...n})}function D_(n){return x.createElement("thead",{"aria-hidden":!0},x.createElement("tr",{...n}))}function T_(n){const{week:e,...t}=n;return x.createElement("th",{...t})}function N_(n){return x.createElement("th",{...n})}function E_(n){return x.createElement("tbody",{...n})}function A_(n){const{components:e}=zs();return x.createElement(e.Dropdown,{...n})}const P_=Object.freeze(Object.defineProperty({__proto__:null,Button:a_,CaptionLabel:l_,Chevron:c_,Day:d_,DayButton:u_,Dropdown:h_,DropdownNav:f_,Footer:p_,Month:m_,MonthCaption:g_,MonthGrid:b_,Months:y_,MonthsDropdown:x_,Nav:__,NextMonthButton:k_,Option:w_,PreviousMonthButton:v_,Root:S_,Select:M_,Week:C_,WeekNumber:T_,WeekNumberHeader:N_,Weekday:O_,Weekdays:D_,Weeks:E_,YearsDropdown:A_},Symbol.toStringTag,{value:"Module"}));function en(n,e,t=!1,i=Ht){let{from:s,to:r}=n;const{differenceInCalendarDays:o,isSameDay:a}=i;return s&&r?(o(r,s)<0&&([s,r]=[r,s]),o(e,s)>=(t?1:0)&&o(r,e)>=(t?1:0)):!t&&r?a(r,e):!t&&s?a(s,e):!1}function Ka(n){return!!(n&&typeof n=="object"&&"before"in n&&"after"in n)}function Vr(n){return!!(n&&typeof n=="object"&&"from"in n)}function Ua(n){return!!(n&&typeof n=="object"&&"after"in n)}function Ja(n){return!!(n&&typeof n=="object"&&"before"in n)}function lf(n){return!!(n&&typeof n=="object"&&"dayOfWeek"in n)}function cf(n,e){return Array.isArray(n)&&n.every(e.isDate)}function tn(n,e,t=Ht){const i=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:r,isAfter:o}=t;return i.some(a=>{if(typeof a=="boolean")return a;if(t.isDate(a))return s(n,a);if(cf(a,t))return a.some(l=>s(n,l));if(Vr(a))return en(a,n,!1,t);if(lf(a))return Array.isArray(a.dayOfWeek)?a.dayOfWeek.includes(n.getDay()):a.dayOfWeek===n.getDay();if(Ka(a)){const l=r(a.before,n),c=r(a.after,n),d=l>0,u=c<0;return o(a.before,a.after)?u&&d:d||u}return Ua(a)?r(n,a.after)>0:Ja(a)?r(a.before,n)>0:typeof a=="function"?a(n):!1})}function I_(n,e,t,i,s){const{disabled:r,hidden:o,modifiers:a,showOutsideDays:l,broadcastCalendar:c,today:d=s.today()}=e,{isSameDay:u,isSameMonth:h,startOfMonth:f,isBefore:p,endOfMonth:m,isAfter:g}=s,y=t&&f(t),S=i&&m(i),_={[fe.focused]:[],[fe.outside]:[],[fe.disabled]:[],[fe.hidden]:[],[fe.today]:[]},k={};for(const v of n){const{date:w,displayMonth:M}=v,C=!!(M&&!h(w,M)),O=!!(y&&p(w,y)),D=!!(S&&g(w,S)),A=!!(r&&tn(w,r,s)),P=!!(o&&tn(w,o,s))||O||D||!c&&!l&&C||c&&l===!1&&C,F=u(w,d);C&&_.outside.push(v),A&&_.disabled.push(v),P&&_.hidden.push(v),F&&_.today.push(v),a&&Object.keys(a).forEach(B=>{const H=a?.[B];H&&tn(w,H,s)&&(k[B]?k[B].push(v):k[B]=[v])})}return v=>{const w={[fe.focused]:!1,[fe.disabled]:!1,[fe.hidden]:!1,[fe.outside]:!1,[fe.today]:!1},M={};for(const C in _){const O=_[C];w[C]=O.some(D=>D===v)}for(const C in k)M[C]=k[C].some(O=>O===v);return{...w,...M}}}function R_(n,e,t={}){return Object.entries(n).filter(([,s])=>s===!0).reduce((s,[r])=>(t[r]?s.push(t[r]):e[fe[r]]?s.push(e[fe[r]]):e[Dt[r]]&&s.push(e[Dt[r]]),s),[e[j.Day]])}function z_(n){return{...P_,...n}}function j_(n){const e={"data-mode":n.mode??void 0,"data-required":"required"in n?n.required:void 0,"data-multiple-months":n.numberOfMonths&&n.numberOfMonths>1||void 0,"data-week-numbers":n.showWeekNumber||void 0,"data-broadcast-calendar":n.broadcastCalendar||void 0,"data-nav-layout":n.navLayout||void 0};return Object.entries(n).forEach(([t,i])=>{t.startsWith("data-")&&(e[t]=i)}),e}function B_(){const n={};for(const e in j)n[j[e]]=`rdp-${j[e]}`;for(const e in fe)n[fe[e]]=`rdp-${fe[e]}`;for(const e in Dt)n[Dt[e]]=`rdp-${Dt[e]}`;for(const e in ot)n[ot[e]]=`rdp-${ot[e]}`;return n}function df(n,e,t){return(t??new dt(e)).formatMonthYear(n)}const L_=df;function F_(n,e,t){return(t??new dt(e)).format(n,"d")}function W_(n,e=Ht){return e.format(n,"LLLL")}function $_(n,e,t){return(t??new dt(e)).format(n,"cccccc")}function H_(n,e=Ht){return n<10?e.formatNumber(`0${n.toLocaleString()}`):e.formatNumber(`${n.toLocaleString()}`)}function V_(){return""}function uf(n,e=Ht){return e.format(n,"yyyy")}const Y_=uf,q_=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:df,formatDay:F_,formatMonthCaption:L_,formatMonthDropdown:W_,formatWeekNumber:H_,formatWeekNumberHeader:V_,formatWeekdayName:$_,formatYearCaption:Y_,formatYearDropdown:uf},Symbol.toStringTag,{value:"Module"}));function K_(n){return n?.formatMonthCaption&&!n.formatCaption&&(n.formatCaption=n.formatMonthCaption),n?.formatYearCaption&&!n.formatYearDropdown&&(n.formatYearDropdown=n.formatYearCaption),{...q_,...n}}function Ga(n,e,t,i){let s=(i??new dt(t)).format(n,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s}const U_=Ga;function Xa(n,e,t){return(t??new dt(e)).formatMonthYear(n)}const J_=Xa;function hf(n,e,t,i){let s=(i??new dt(t)).format(n,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function ff(n){return"Choose the Month"}function pf(){return""}const G_="Go to the Next Month";function mf(n,e){return G_}function gf(n){return"Go to the Previous Month"}function bf(n,e,t){return(t??new dt(e)).format(n,"cccc")}function yf(n,e){return`Week ${n}`}function xf(n){return"Week Number"}function _f(n){return"Choose the Year"}const X_=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:J_,labelDay:U_,labelDayButton:Ga,labelGrid:Xa,labelGridcell:hf,labelMonthDropdown:ff,labelNav:pf,labelNext:mf,labelPrevious:gf,labelWeekNumber:yf,labelWeekNumberHeader:xf,labelWeekday:bf,labelYearDropdown:_f},Symbol.toStringTag,{value:"Module"})),St=(n,e,t)=>e||(t?typeof t=="function"?t:(...i)=>t:n);function Q_(n,e){const t=e.locale?.labels??{};return{...X_,...n??{},labelDayButton:St(Ga,n?.labelDayButton,t.labelDayButton),labelMonthDropdown:St(ff,n?.labelMonthDropdown,t.labelMonthDropdown),labelNext:St(mf,n?.labelNext,t.labelNext),labelPrevious:St(gf,n?.labelPrevious,t.labelPrevious),labelWeekNumber:St(yf,n?.labelWeekNumber,t.labelWeekNumber),labelYearDropdown:St(_f,n?.labelYearDropdown,t.labelYearDropdown),labelGrid:St(Xa,n?.labelGrid,t.labelGrid),labelGridcell:St(hf,n?.labelGridcell,t.labelGridcell),labelNav:St(pf,n?.labelNav,t.labelNav),labelWeekNumberHeader:St(xf,n?.labelWeekNumberHeader,t.labelWeekNumberHeader),labelWeekday:St(bf,n?.labelWeekday,t.labelWeekday)}}function Z_(n,e,t,i,s){const{startOfMonth:r,startOfYear:o,endOfYear:a,eachMonthOfInterval:l,getMonth:c}=s;return l({start:o(n),end:a(n)}).map(h=>{const f=i.formatMonthDropdown(h,s),p=c(h),m=e&&h<r(e)||t&&h>r(t)||!1;return{value:p,label:f,disabled:m}})}function ek(n,e={},t={}){let i={...e?.[j.Day]};return Object.entries(n).filter(([,s])=>s===!0).forEach(([s])=>{i={...i,...t?.[s]}}),i}function tk(n,e,t,i){const s=i??n.today(),r=t?n.startOfBroadcastWeek(s,n):e?n.startOfISOWeek(s):n.startOfWeek(s),o=[];for(let a=0;a<7;a++){const l=n.addDays(r,a);o.push(l)}return o}function nk(n,e,t,i,s=!1){if(!n||!e)return;const{startOfYear:r,endOfYear:o,eachYearOfInterval:a,getYear:l}=i,c=r(n),d=o(e),u=a({start:c,end:d});return s&&u.reverse(),u.map(h=>{const f=t.formatYearDropdown(h,i);return{value:l(h),label:f,disabled:!1}})}function ik(n,e={}){const{weekStartsOn:t,locale:i}=e,s=t??i?.options?.weekStartsOn??0,r=a=>{const l=typeof a=="number"||typeof a=="string"?new Date(a):a;return new ze(l.getFullYear(),l.getMonth(),l.getDate(),12,0,0,n)},o=a=>{const l=r(a);return new Date(l.getFullYear(),l.getMonth(),l.getDate(),0,0,0,0)};return{today:()=>r(ze.tz(n)),newDate:(a,l,c)=>new ze(a,l,c,12,0,0,n),startOfDay:a=>r(a),startOfWeek:(a,l)=>{const c=r(a),d=l?.weekStartsOn??s,u=(c.getDay()-d+7)%7;return c.setDate(c.getDate()-u),c},startOfISOWeek:a=>{const l=r(a),c=(l.getDay()-1+7)%7;return l.setDate(l.getDate()-c),l},startOfMonth:a=>{const l=r(a);return l.setDate(1),l},startOfYear:a=>{const l=r(a);return l.setMonth(0,1),l},endOfWeek:(a,l)=>{const c=r(a),h=(((l?.weekStartsOn??s)+6)%7-c.getDay()+7)%7;return c.setDate(c.getDate()+h),c},endOfISOWeek:a=>{const l=r(a),c=(7-l.getDay())%7;return l.setDate(l.getDate()+c),l},endOfMonth:a=>{const l=r(a);return l.setMonth(l.getMonth()+1,0),l},endOfYear:a=>{const l=r(a);return l.setMonth(11,31),l},eachMonthOfInterval:a=>{const l=r(a.start),c=r(a.end),d=[],u=new ze(l.getFullYear(),l.getMonth(),1,12,0,0,n),h=c.getFullYear()*12+c.getMonth();for(;u.getFullYear()*12+u.getMonth()<=h;)d.push(new ze(u,n)),u.setMonth(u.getMonth()+1,1);return d},addDays:(a,l)=>{const c=r(a);return c.setDate(c.getDate()+l),c},addWeeks:(a,l)=>{const c=r(a);return c.setDate(c.getDate()+l*7),c},addMonths:(a,l)=>{const c=r(a);return c.setMonth(c.getMonth()+l),c},addYears:(a,l)=>{const c=r(a);return c.setFullYear(c.getFullYear()+l),c},eachYearOfInterval:a=>{const l=r(a.start),c=r(a.end),d=[],u=new ze(l.getFullYear(),0,1,12,0,0,n);for(;u.getFullYear()<=c.getFullYear();)d.push(new ze(u,n)),u.setFullYear(u.getFullYear()+1,0,1);return d},getWeek:(a,l)=>{const c=o(a);return qa(c,{weekStartsOn:l?.weekStartsOn??s,firstWeekContainsDate:l?.firstWeekContainsDate??i?.options?.firstWeekContainsDate??1})},getISOWeek:a=>{const l=o(a);return Ya(l)},differenceInCalendarDays:(a,l)=>{const c=o(a),d=o(l);return Va(c,d)},differenceInCalendarMonths:(a,l)=>{const c=o(a),d=o(l);return Xh(c,d)}}}const js=n=>n instanceof HTMLElement?n:null,ko=n=>[...n.querySelectorAll("[data-animated-month]")??[]],sk=n=>js(n.querySelector("[data-animated-month]")),wo=n=>js(n.querySelector("[data-animated-caption]")),vo=n=>js(n.querySelector("[data-animated-weeks]")),rk=n=>js(n.querySelector("[data-animated-nav]")),ok=n=>js(n.querySelector("[data-animated-weekdays]"));function ak(n,e,{classNames:t,months:i,focused:s,dateLib:r}){const o=x.useRef(null),a=x.useRef(i),l=x.useRef(!1);x.useLayoutEffect(()=>{const c=a.current;if(a.current=i,!e||!n.current||!(n.current instanceof HTMLElement)||i.length===0||c.length===0||i.length!==c.length)return;const d=r.isSameMonth(i[0].date,c[0].date),u=r.isAfter(i[0].date,c[0].date),h=u?t[ot.caption_after_enter]:t[ot.caption_before_enter],f=u?t[ot.weeks_after_enter]:t[ot.weeks_before_enter],p=o.current,m=n.current.cloneNode(!0);if(m instanceof HTMLElement?(ko(m).forEach(_=>{if(!(_ instanceof HTMLElement))return;const k=sk(_);k&&_.contains(k)&&_.removeChild(k);const v=wo(_);v&&v.classList.remove(h);const w=vo(_);w&&w.classList.remove(f)}),o.current=m):o.current=null,l.current||d||s)return;const g=p instanceof HTMLElement?ko(p):[],y=ko(n.current);if(y?.every(S=>S instanceof HTMLElement)&&g&&g.every(S=>S instanceof HTMLElement)){l.current=!0,n.current.style.isolation="isolate";const S=rk(n.current);S&&(S.style.zIndex="1"),y.forEach((_,k)=>{const v=g[k];if(!v)return;_.style.position="relative",_.style.overflow="hidden";const w=wo(_);w&&w.classList.add(h);const M=vo(_);M&&M.classList.add(f);const C=()=>{l.current=!1,n.current&&(n.current.style.isolation=""),S&&(S.style.zIndex=""),w&&w.classList.remove(h),M&&M.classList.remove(f),_.style.position="",_.style.overflow="",_.contains(v)&&_.removeChild(v)};v.style.pointerEvents="none",v.style.position="absolute",v.style.overflow="hidden",v.setAttribute("aria-hidden","true");const O=ok(v);O&&(O.style.opacity="0");const D=wo(v);D&&(D.classList.add(u?t[ot.caption_before_exit]:t[ot.caption_after_exit]),D.addEventListener("animationend",C));const A=vo(v);A&&A.classList.add(u?t[ot.weeks_before_exit]:t[ot.weeks_after_exit]),_.insertBefore(v,_.firstChild)})}})}function lk(n,e,t,i){const s=n[0],r=n[n.length-1],{ISOWeek:o,fixedWeeks:a,broadcastCalendar:l}=t??{},{addDays:c,differenceInCalendarDays:d,differenceInCalendarMonths:u,endOfBroadcastWeek:h,endOfISOWeek:f,endOfMonth:p,endOfWeek:m,isAfter:g,startOfBroadcastWeek:y,startOfISOWeek:S,startOfWeek:_}=i,k=l?y(s,i):o?S(s):_(s),v=l?h(r):o?f(p(r)):m(p(r)),w=e&&(l?h(e):o?f(e):m(e)),M=w&&g(v,w)?w:v,C=d(M,k),O=u(r,s)+1,D=[];for(let F=0;F<=C;F++){const B=c(k,F);D.push(B)}const P=(l?35:42)*O;if(a&&D.length<P){const F=P-D.length;for(let B=0;B<F;B++){const H=c(D[D.length-1],1);D.push(H)}}return D}function ck(n){const e=[];return n.reduce((t,i)=>{const s=i.weeks.reduce((r,o)=>r.concat(o.days.slice()),e.slice());return t.concat(s.slice())},e.slice())}function dk(n,e,t,i){const{numberOfMonths:s=1}=t,r=[];for(let o=0;o<s;o++){const a=i.addMonths(n,o);if(e&&a>e)break;r.push(a)}return r}function ic(n,e,t,i){const{month:s,defaultMonth:r,today:o=i.today(),numberOfMonths:a=1}=n;let l=s||r||o;const{differenceInCalendarMonths:c,addMonths:d,startOfMonth:u}=i;if(t&&c(t,l)<a-1){const h=-1*(a-1);l=d(t,h)}return e&&c(l,e)<0&&(l=e),u(l)}function uk(n,e,t,i){const{addDays:s,endOfBroadcastWeek:r,endOfISOWeek:o,endOfMonth:a,endOfWeek:l,getISOWeek:c,getWeek:d,startOfBroadcastWeek:u,startOfISOWeek:h,startOfWeek:f}=i,p=n.reduce((m,g)=>{const y=t.broadcastCalendar?u(g,i):t.ISOWeek?h(g):f(g),S=t.broadcastCalendar?r(g):t.ISOWeek?o(a(g)):l(a(g)),_=e.filter(M=>M>=y&&M<=S),k=t.broadcastCalendar?35:42;if(t.fixedWeeks&&_.length<k){const M=e.filter(C=>{const O=k-_.length;return C>S&&C<=s(S,O)});_.push(...M)}const v=_.reduce((M,C)=>{const O=t.ISOWeek?c(C):d(C),D=M.find(P=>P.weekNumber===O),A=new of(C,g,i);return D?D.days.push(A):M.push(new o_(O,[A])),M},[]),w=new r_(g,v);return m.push(w),m},[]);return t.reverseMonths?p.reverse():p}function hk(n,e){let{startMonth:t,endMonth:i}=n;const{startOfYear:s,startOfDay:r,startOfMonth:o,endOfMonth:a,addYears:l,endOfYear:c,newDate:d,today:u}=e,{fromYear:h,toYear:f,fromMonth:p,toMonth:m}=n;!t&&p&&(t=p),!t&&h&&(t=e.newDate(h,0,1)),!i&&m&&(i=m),!i&&f&&(i=d(f,11,31));const g=n.captionLayout==="dropdown"||n.captionLayout==="dropdown-years";return t?t=o(t):h?t=d(h,0,1):!t&&g&&(t=s(l(n.today??u(),-100))),i?i=a(i):f?i=d(f,11,31):!i&&g&&(i=c(n.today??u())),[t&&r(t),i&&r(i)]}function fk(n,e,t,i){if(t.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:r=1}=t,{startOfMonth:o,addMonths:a,differenceInCalendarMonths:l}=i,c=s?r:1,d=o(n);if(!e)return a(d,c);if(!(l(e,n)<r))return a(d,c)}function pk(n,e,t,i){if(t.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:r}=t,{startOfMonth:o,addMonths:a,differenceInCalendarMonths:l}=i,c=s?r??1:1,d=o(n);if(!e)return a(d,-c);if(!(l(d,e)<=0))return a(d,-c)}function mk(n){const e=[];return n.reduce((t,i)=>t.concat(i.weeks.slice()),e.slice())}function Yr(n,e){const[t,i]=x.useState(n);return[e===void 0?t:e,i]}function gk(n,e){const[t,i]=hk(n,e),{startOfMonth:s,endOfMonth:r}=e,o=ic(n,t,i,e),[a,l]=Yr(o,n.month?o:void 0);x.useEffect(()=>{const k=ic(n,t,i,e);l(k)},[n.timeZone]);const{months:c,weeks:d,days:u,previousMonth:h,nextMonth:f}=x.useMemo(()=>{const k=dk(a,i,{numberOfMonths:n.numberOfMonths},e),v=lk(k,n.endMonth?r(n.endMonth):void 0,{ISOWeek:n.ISOWeek,fixedWeeks:n.fixedWeeks,broadcastCalendar:n.broadcastCalendar},e),w=uk(k,v,{broadcastCalendar:n.broadcastCalendar,fixedWeeks:n.fixedWeeks,ISOWeek:n.ISOWeek,reverseMonths:n.reverseMonths},e),M=mk(w),C=ck(w),O=pk(a,t,n,e),D=fk(a,i,n,e);return{months:w,weeks:M,days:C,previousMonth:O,nextMonth:D}},[e,a.getTime(),i?.getTime(),t?.getTime(),n.disableNavigation,n.broadcastCalendar,n.endMonth?.getTime(),n.fixedWeeks,n.ISOWeek,n.numberOfMonths,n.pagedNavigation,n.reverseMonths]),{disableNavigation:p,onMonthChange:m}=n,g=k=>d.some(v=>v.days.some(w=>w.isEqualTo(k))),y=k=>{if(p)return;let v=s(k);t&&v<s(t)&&(v=s(t)),i&&v>s(i)&&(v=s(i)),l(v),m?.(v)};return{months:c,weeks:d,days:u,navStart:t,navEnd:i,previousMonth:h,nextMonth:f,goToMonth:y,goToDay:k=>{g(k)||y(k.date)}}}var Rt;(function(n){n[n.Today=0]="Today",n[n.Selected=1]="Selected",n[n.LastFocused=2]="LastFocused",n[n.FocusedModifier=3]="FocusedModifier"})(Rt||(Rt={}));function sc(n){return!n[fe.disabled]&&!n[fe.hidden]&&!n[fe.outside]}function bk(n,e,t,i){let s,r=-1;for(const o of n){const a=e(o);sc(a)&&(a[fe.focused]&&r<Rt.FocusedModifier?(s=o,r=Rt.FocusedModifier):i?.isEqualTo(o)&&r<Rt.LastFocused?(s=o,r=Rt.LastFocused):t(o.date)&&r<Rt.Selected?(s=o,r=Rt.Selected):a[fe.today]&&r<Rt.Today&&(s=o,r=Rt.Today))}return s||(s=n.find(o=>sc(e(o)))),s}function yk(n,e,t,i,s,r,o){const{ISOWeek:a,broadcastCalendar:l}=r,{addDays:c,addMonths:d,addWeeks:u,addYears:h,endOfBroadcastWeek:f,endOfISOWeek:p,endOfWeek:m,max:g,min:y,startOfBroadcastWeek:S,startOfISOWeek:_,startOfWeek:k}=o;let w={day:c,week:u,month:d,year:h,startOfWeek:M=>l?S(M,o):a?_(M):k(M),endOfWeek:M=>l?f(M):a?p(M):m(M)}[n](t,e==="after"?1:-1);return e==="before"&&i?w=g([i,w]):e==="after"&&s&&(w=y([s,w])),w}function kf(n,e,t,i,s,r,o,a=0){if(a>365)return;const l=yk(n,e,t.date,i,s,r,o),c=!!(r.disabled&&tn(l,r.disabled,o)),d=!!(r.hidden&&tn(l,r.hidden,o)),u=l,h=new of(l,u,o);return!c&&!d?h:kf(n,e,h,i,s,r,o,a+1)}function xk(n,e,t,i,s){const{autoFocus:r}=n,[o,a]=x.useState(),l=bk(e.days,t,i||(()=>!1),o),[c,d]=x.useState(r?l:void 0);return{isFocusTarget:m=>!!l?.isEqualTo(m),setFocused:d,focused:c,blur:()=>{a(c),d(void 0)},moveFocus:(m,g)=>{if(!c)return;const y=kf(m,g,c,e.navStart,e.navEnd,n,s);y&&(n.disableNavigation&&!e.days.some(_=>_.isEqualTo(y))||(e.goToDay(y),d(y)))}}}function _k(n,e){const{selected:t,required:i,onSelect:s}=n,[r,o]=Yr(t,s?t:void 0),a=s?t:r,{isSameDay:l}=e,c=f=>a?.some(p=>l(p,f))??!1,{min:d,max:u}=n;return{selected:a,select:(f,p,m)=>{let g=[...a??[]];if(c(f)){if(a?.length===d||i&&a?.length===1)return;g=a?.filter(y=>!l(y,f))}else a?.length===u?g=[f]:g=[...g,f];return s||o(g),s?.(g,f,p,m),g},isSelected:c}}function kk(n,e,t=0,i=0,s=!1,r=Ht){const{from:o,to:a}=e||{},{isSameDay:l,isAfter:c,isBefore:d}=r;let u;if(!o&&!a)u={from:n,to:t>0?void 0:n};else if(o&&!a)l(o,n)?t===0?u={from:o,to:n}:s?u={from:o,to:void 0}:u=void 0:d(n,o)?u={from:n,to:o}:u={from:o,to:n};else if(o&&a)if(l(o,n)&&l(a,n))s?u={from:o,to:a}:u=void 0;else if(l(o,n))u={from:o,to:t>0?void 0:n};else if(l(a,n))u={from:n,to:t>0?void 0:n};else if(d(n,o))u={from:n,to:a};else if(c(n,o))u={from:o,to:n};else if(c(n,a))u={from:o,to:n};else throw new Error("Invalid range");if(u?.from&&u?.to){const h=r.differenceInCalendarDays(u.to,u.from);i>0&&h>i?u={from:n,to:void 0}:t>1&&h<t&&(u={from:n,to:void 0})}return u}function wk(n,e,t=Ht){const i=Array.isArray(e)?e:[e];let s=n.from;const r=t.differenceInCalendarDays(n.to,n.from),o=Math.min(r,6);for(let a=0;a<=o;a++){if(i.includes(s.getDay()))return!0;s=t.addDays(s,1)}return!1}function rc(n,e,t=Ht){return en(n,e.from,!1,t)||en(n,e.to,!1,t)||en(e,n.from,!1,t)||en(e,n.to,!1,t)}function vk(n,e,t=Ht){const i=Array.isArray(e)?e:[e];if(i.filter(a=>typeof a!="function").some(a=>typeof a=="boolean"?a:t.isDate(a)?en(n,a,!1,t):cf(a,t)?a.some(l=>en(n,l,!1,t)):Vr(a)?a.from&&a.to?rc(n,{from:a.from,to:a.to},t):!1:lf(a)?wk(n,a.dayOfWeek,t):Ka(a)?t.isAfter(a.before,a.after)?rc(n,{from:t.addDays(a.after,1),to:t.addDays(a.before,-1)},t):tn(n.from,a,t)||tn(n.to,a,t):Ua(a)||Ja(a)?tn(n.from,a,t)||tn(n.to,a,t):!1))return!0;const o=i.filter(a=>typeof a=="function");if(o.length){let a=n.from;const l=t.differenceInCalendarDays(n.to,n.from);for(let c=0;c<=l;c++){if(o.some(d=>d(a)))return!0;a=t.addDays(a,1)}}return!1}function Sk(n,e){const{disabled:t,excludeDisabled:i,resetOnSelect:s,selected:r,required:o,onSelect:a}=n,[l,c]=Yr(r,a?r:void 0),d=a?r:l;return{selected:d,select:(f,p,m)=>{const{min:g,max:y}=n;let S;if(f){const _=d?.from,k=d?.to,v=!!_&&!!k,w=!!_&&!!k&&e.isSameDay(_,k)&&e.isSameDay(f,_);s&&(v||!d?.from)?!o&&w?S=void 0:S={from:f,to:void 0}:S=kk(f,d,g,y,o,e)}return i&&t&&S?.from&&S.to&&vk({from:S.from,to:S.to},t,e)&&(S.from=f,S.to=void 0),a||c(S),a?.(S,f,p,m),S},isSelected:f=>d&&en(d,f,!1,e)}}function Mk(n,e){const{selected:t,required:i,onSelect:s}=n,[r,o]=Yr(t,s?t:void 0),a=s?t:r,{isSameDay:l}=e;return{selected:a,select:(u,h,f)=>{let p=u;return!i&&a&&a&&l(u,a)&&(p=void 0),s||o(p),s?.(p,u,h,f),p},isSelected:u=>a?l(a,u):!1}}function Ck(n,e){const t=Mk(n,e),i=_k(n,e),s=Sk(n,e);switch(n.mode){case"single":return t;case"multiple":return i;case"range":return s;default:return}}function ft(n,e){return n instanceof ze&&n.timeZone===e?n:new ze(n,e)}function hi(n,e,t){return ft(n,e)}function oc(n,e,t){return typeof n=="boolean"||typeof n=="function"?n:n instanceof Date?hi(n,e):Array.isArray(n)?n.map(i=>i instanceof Date?hi(i,e):i):Vr(n)?{...n,from:n.from?ft(n.from,e):n.from,to:n.to?ft(n.to,e):n.to}:Ka(n)?{before:hi(n.before,e),after:hi(n.after,e)}:Ua(n)?{after:hi(n.after,e)}:Ja(n)?{before:hi(n.before,e)}:n}function So(n,e,t){return n&&(Array.isArray(n)?n.map(i=>oc(i,e)):oc(n,e))}function Ok(n){let e=n;const t=e.timeZone;if(t&&(e={...n,timeZone:t},e.today&&(e.today=ft(e.today,t)),e.month&&(e.month=ft(e.month,t)),e.defaultMonth&&(e.defaultMonth=ft(e.defaultMonth,t)),e.startMonth&&(e.startMonth=ft(e.startMonth,t)),e.endMonth&&(e.endMonth=ft(e.endMonth,t)),e.mode==="single"&&e.selected?e.selected=ft(e.selected,t):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(Y=>ft(Y,t)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?ft(e.selected.from,t):e.selected.from,to:e.selected.to?ft(e.selected.to,t):e.selected.to}),e.disabled!==void 0&&(e.disabled=So(e.disabled,t)),e.hidden!==void 0&&(e.hidden=So(e.hidden,t)),e.modifiers)){const Y={};Object.keys(e.modifiers).forEach(ne=>{Y[ne]=So(e.modifiers?.[ne],t)}),e.modifiers=Y}const{components:i,formatters:s,labels:r,dateLib:o,locale:a,classNames:l}=x.useMemo(()=>{const Y={...rf,...e.locale},ne=e.broadcastCalendar?1:e.weekStartsOn,W=e.noonSafe&&e.timeZone?ik(e.timeZone,{weekStartsOn:ne,locale:Y}):void 0,te=e.dateLib&&W?{...W,...e.dateLib}:e.dateLib??W,tt=new dt({locale:Y,weekStartsOn:ne,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},te);return{dateLib:tt,components:z_(e.components),formatters:K_(e.formatters),labels:Q_(e.labels,tt.options),locale:Y,classNames:{...B_(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.noonSafe,e.components,e.formatters,e.labels,e.classNames]);e.today||(e={...e,today:o.today()});const{captionLayout:c,mode:d,navLayout:u,numberOfMonths:h=1,onDayBlur:f,onDayClick:p,onDayFocus:m,onDayKeyDown:g,onDayMouseEnter:y,onDayMouseLeave:S,onNextClick:_,onPrevClick:k,showWeekNumber:v,styles:w}=e,{formatCaption:M,formatDay:C,formatMonthDropdown:O,formatWeekNumber:D,formatWeekNumberHeader:A,formatWeekdayName:P,formatYearDropdown:F}=s,B=gk(e,o),{days:H,months:K,navStart:G,navEnd:R,previousMonth:E,nextMonth:V,goToMonth:ee}=B,ke=I_(H,e,G,R,o),{isSelected:et,select:wt,selected:Nt}=Ck(e,o)??{},{blur:Et,focused:Ll,isFocusTarget:ug,moveFocus:Fl,setFocused:$s}=xk(e,B,ke,et??(()=>!1),o),{labelDayButton:hg,labelGridcell:fg,labelGrid:pg,labelMonthDropdown:mg,labelNav:Wl,labelPrevious:gg,labelNext:bg,labelWeekday:yg,labelWeekNumber:xg,labelWeekNumberHeader:_g,labelYearDropdown:kg}=r,wg=x.useMemo(()=>tk(o,e.ISOWeek,e.broadcastCalendar,e.today),[o,e.ISOWeek,e.broadcastCalendar,e.today]),$l=d!==void 0||p!==void 0,mo=x.useCallback(()=>{E&&(ee(E),k?.(E))},[E,ee,k]),go=x.useCallback(()=>{V&&(ee(V),_?.(V))},[ee,V,_]),vg=x.useCallback((Y,ne)=>W=>{W.preventDefault(),W.stopPropagation(),$s(Y),!ne.disabled&&(wt?.(Y.date,ne,W),p?.(Y.date,ne,W))},[wt,p,$s]),Sg=x.useCallback((Y,ne)=>W=>{$s(Y),m?.(Y.date,ne,W)},[m,$s]),Mg=x.useCallback((Y,ne)=>W=>{Et(),f?.(Y.date,ne,W)},[Et,f]),Cg=x.useCallback((Y,ne)=>W=>{const te={ArrowLeft:[W.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[W.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[W.shiftKey?"year":"week","after"],ArrowUp:[W.shiftKey?"year":"week","before"],PageUp:[W.shiftKey?"year":"month","before"],PageDown:[W.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(te[W.key]){W.preventDefault(),W.stopPropagation();const[tt,Q]=te[W.key];Fl(tt,Q)}g?.(Y.date,ne,W)},[Fl,g,e.dir]),Og=x.useCallback((Y,ne)=>W=>{y?.(Y.date,ne,W)},[y]),Dg=x.useCallback((Y,ne)=>W=>{S?.(Y.date,ne,W)},[S]),Tg=x.useCallback(Y=>ne=>{const W=Number(ne.target.value),te=o.setMonth(o.startOfMonth(Y),W);ee(te)},[o,ee]),Ng=x.useCallback(Y=>ne=>{const W=Number(ne.target.value),te=o.setYear(o.startOfMonth(Y),W);ee(te)},[o,ee]),{className:Eg,style:Ag}=x.useMemo(()=>({className:[l[j.Root],e.className].filter(Boolean).join(" "),style:{...w?.[j.Root],...e.style}}),[l,e.className,e.style,w]),Pg=j_(e),Hl=x.useRef(null);ak(Hl,!!e.animate,{classNames:l,months:K,focused:Ll,dateLib:o});const Ig={dayPickerProps:e,selected:Nt,select:wt,isSelected:et,months:K,nextMonth:V,previousMonth:E,goToMonth:ee,getModifiers:ke,components:i,classNames:l,styles:w,labels:r,formatters:s};return x.createElement(af.Provider,{value:Ig},x.createElement(i.Root,{rootRef:e.animate?Hl:void 0,className:Eg,style:Ag,dir:e.dir,id:e.id,lang:e.lang??a.code,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...Pg},x.createElement(i.Months,{className:l[j.Months],style:w?.[j.Months]},!e.hideNavigation&&!u&&x.createElement(i.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[j.Nav],style:w?.[j.Nav],"aria-label":Wl(),onPreviousClick:mo,onNextClick:go,previousMonth:E,nextMonth:V}),K.map((Y,ne)=>x.createElement(i.Month,{"data-animated-month":e.animate?"true":void 0,className:l[j.Month],style:w?.[j.Month],key:ne,displayIndex:ne,calendarMonth:Y},u==="around"&&!e.hideNavigation&&ne===0&&x.createElement(i.PreviousMonthButton,{type:"button",className:l[j.PreviousMonthButton],tabIndex:E?void 0:-1,"aria-disabled":E?void 0:!0,"aria-label":gg(E),onClick:mo,"data-animated-button":e.animate?"true":void 0},x.createElement(i.Chevron,{disabled:E?void 0:!0,className:l[j.Chevron],orientation:e.dir==="rtl"?"right":"left"})),x.createElement(i.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:l[j.MonthCaption],style:w?.[j.MonthCaption],calendarMonth:Y,displayIndex:ne},c?.startsWith("dropdown")?x.createElement(i.DropdownNav,{className:l[j.Dropdowns],style:w?.[j.Dropdowns]},(()=>{const W=c==="dropdown"||c==="dropdown-months"?x.createElement(i.MonthsDropdown,{key:"month",className:l[j.MonthsDropdown],"aria-label":mg(),classNames:l,components:i,disabled:!!e.disableNavigation,onChange:Tg(Y.date),options:Z_(Y.date,G,R,s,o),style:w?.[j.Dropdown],value:o.getMonth(Y.date)}):x.createElement("span",{key:"month"},O(Y.date,o)),te=c==="dropdown"||c==="dropdown-years"?x.createElement(i.YearsDropdown,{key:"year",className:l[j.YearsDropdown],"aria-label":kg(o.options),classNames:l,components:i,disabled:!!e.disableNavigation,onChange:Ng(Y.date),options:nk(G,R,s,o,!!e.reverseYears),style:w?.[j.Dropdown],value:o.getYear(Y.date)}):x.createElement("span",{key:"year"},F(Y.date,o));return o.getMonthYearOrder()==="year-first"?[te,W]:[W,te]})(),x.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},M(Y.date,o.options,o))):x.createElement(i.CaptionLabel,{className:l[j.CaptionLabel],role:"status","aria-live":"polite"},M(Y.date,o.options,o))),u==="around"&&!e.hideNavigation&&ne===h-1&&x.createElement(i.NextMonthButton,{type:"button",className:l[j.NextMonthButton],tabIndex:V?void 0:-1,"aria-disabled":V?void 0:!0,"aria-label":bg(V),onClick:go,"data-animated-button":e.animate?"true":void 0},x.createElement(i.Chevron,{disabled:V?void 0:!0,className:l[j.Chevron],orientation:e.dir==="rtl"?"left":"right"})),ne===h-1&&u==="after"&&!e.hideNavigation&&x.createElement(i.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[j.Nav],style:w?.[j.Nav],"aria-label":Wl(),onPreviousClick:mo,onNextClick:go,previousMonth:E,nextMonth:V}),x.createElement(i.MonthGrid,{role:"grid","aria-multiselectable":d==="multiple"||d==="range","aria-label":pg(Y.date,o.options,o)||void 0,className:l[j.MonthGrid],style:w?.[j.MonthGrid]},!e.hideWeekdays&&x.createElement(i.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:l[j.Weekdays],style:w?.[j.Weekdays]},v&&x.createElement(i.WeekNumberHeader,{"aria-label":_g(o.options),className:l[j.WeekNumberHeader],style:w?.[j.WeekNumberHeader],scope:"col"},A()),wg.map(W=>x.createElement(i.Weekday,{"aria-label":yg(W,o.options,o),className:l[j.Weekday],key:String(W),style:w?.[j.Weekday],scope:"col"},P(W,o.options,o)))),x.createElement(i.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:l[j.Weeks],style:w?.[j.Weeks]},Y.weeks.map(W=>x.createElement(i.Week,{className:l[j.Week],key:W.weekNumber,style:w?.[j.Week],week:W},v&&x.createElement(i.WeekNumber,{week:W,style:w?.[j.WeekNumber],"aria-label":xg(W.weekNumber,{locale:a}),className:l[j.WeekNumber],scope:"row",role:"rowheader"},D(W.weekNumber,o)),W.days.map(te=>{const{date:tt}=te,Q=ke(te);if(Q[fe.focused]=!Q.hidden&&!!Ll?.isEqualTo(te),Q[Dt.selected]=et?.(tt)||Q.selected,Vr(Nt)){const{from:bo,to:yo}=Nt;Q[Dt.range_start]=!!(bo&&yo&&o.isSameDay(tt,bo)),Q[Dt.range_end]=!!(bo&&yo&&o.isSameDay(tt,yo)),Q[Dt.range_middle]=en(Nt,tt,!0,o)}const Rg=ek(Q,w,e.modifiersStyles),zg=R_(Q,l,e.modifiersClassNames),jg=!$l&&!Q.hidden?fg(tt,Q,o.options,o):void 0;return x.createElement(i.Day,{key:`${te.isoDate}_${te.displayMonthId}`,day:te,modifiers:Q,className:zg.join(" "),style:Rg,role:"gridcell","aria-selected":Q.selected||void 0,"aria-label":jg,"data-day":te.isoDate,"data-month":te.outside?te.dateMonthId:void 0,"data-selected":Q.selected||void 0,"data-disabled":Q.disabled||void 0,"data-hidden":Q.hidden||void 0,"data-outside":te.outside||void 0,"data-focused":Q.focused||void 0,"data-today":Q.today||void 0},!Q.hidden&&$l?x.createElement(i.DayButton,{className:l[j.DayButton],style:w?.[j.DayButton],type:"button",day:te,modifiers:Q,disabled:!Q.focused&&Q.disabled||void 0,"aria-disabled":Q.focused&&Q.disabled||void 0,tabIndex:ug(te)?0:-1,"aria-label":hg(tt,Q,o.options,o),onClick:vg(te,Q),onBlur:Mg(te,Q),onFocus:Sg(te,Q),onKeyDown:Cg(te,Q),onMouseEnter:Og(te,Q),onMouseLeave:Dg(te,Q)},C(tt,o.options,o)):!Q.hidden&&C(te.date,o.options,o))})))))))),e.footer&&x.createElement(i.Footer,{className:l[j.Footer],style:w?.[j.Footer],role:"status","aria-live":"polite"},e.footer)))}function Tt(n){const e=Object.prototype.toString.call(n);return n instanceof Date||typeof n=="object"&&e==="[object Date]"?new n.constructor(+n):typeof n=="number"||e==="[object Number]"||typeof n=="string"||e==="[object String]"?new Date(n):new Date(NaN)}function ti(n,e){return n instanceof Date?new n.constructor(e):new Date(e)}const wf=6048e5,Dk=864e5;let Tk={};function qr(){return Tk}function xs(n,e){const t=qr(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,s=Tt(n),r=s.getDay(),o=(r<i?7:0)+r-i;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function xr(n){return xs(n,{weekStartsOn:1})}function vf(n){const e=Tt(n),t=e.getFullYear(),i=ti(n,0);i.setFullYear(t+1,0,4),i.setHours(0,0,0,0);const s=xr(i),r=ti(n,0);r.setFullYear(t,0,4),r.setHours(0,0,0,0);const o=xr(r);return e.getTime()>=s.getTime()?t+1:e.getTime()>=o.getTime()?t:t-1}function ac(n){const e=Tt(n);return e.setHours(0,0,0,0),e}function lc(n){const e=Tt(n),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+n-+t}function Nk(n,e){const t=ac(n),i=ac(e),s=+t-lc(t),r=+i-lc(i);return Math.round((s-r)/Dk)}function Ek(n){const e=vf(n),t=ti(n,0);return t.setFullYear(e,0,4),t.setHours(0,0,0,0),xr(t)}function Ak(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function Sf(n){if(!Ak(n)&&typeof n!="number")return!1;const e=Tt(n);return!isNaN(Number(e))}function Pk(n){const e=Tt(n),t=ti(n,0);return t.setFullYear(e.getFullYear(),0,1),t.setHours(0,0,0,0),t}const Ik={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Rk=(n,e,t)=>{let i;const s=Ik[n];return typeof s=="string"?i=s:e===1?i=s.one:i=s.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+i:i+" ago":i};function Mo(n){return(e={})=>{const t=e.width?String(e.width):n.defaultWidth;return n.formats[t]||n.formats[n.defaultWidth]}}const zk={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},jk={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Bk={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Lk={date:Mo({formats:zk,defaultWidth:"full"}),time:Mo({formats:jk,defaultWidth:"full"}),dateTime:Mo({formats:Bk,defaultWidth:"full"})},Fk={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Wk=(n,e,t,i)=>Fk[n];function Yi(n){return(e,t)=>{const i=t?.context?String(t.context):"standalone";let s;if(i==="formatting"&&n.formattingValues){const o=n.defaultFormattingWidth||n.defaultWidth,a=t?.width?String(t.width):o;s=n.formattingValues[a]||n.formattingValues[o]}else{const o=n.defaultWidth,a=t?.width?String(t.width):n.defaultWidth;s=n.values[a]||n.values[o]}const r=n.argumentCallback?n.argumentCallback(e):e;return s[r]}}const $k={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Hk={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Vk={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Yk={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},qk={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Kk={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Uk=(n,e)=>{const t=Number(n),i=t%100;if(i>20||i<10)switch(i%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},Jk={ordinalNumber:Uk,era:Yi({values:$k,defaultWidth:"wide"}),quarter:Yi({values:Hk,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Yi({values:Vk,defaultWidth:"wide"}),day:Yi({values:Yk,defaultWidth:"wide"}),dayPeriod:Yi({values:qk,defaultWidth:"wide",formattingValues:Kk,defaultFormattingWidth:"wide"})};function qi(n){return(e,t={})=>{const i=t.width,s=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],r=e.match(s);if(!r)return null;const o=r[0],a=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(a)?Xk(a,u=>u.test(o)):Gk(a,u=>u.test(o));let c;c=n.valueCallback?n.valueCallback(l):l,c=t.valueCallback?t.valueCallback(c):c;const d=e.slice(o.length);return{value:c,rest:d}}}function Gk(n,e){for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&e(n[t]))return t}function Xk(n,e){for(let t=0;t<n.length;t++)if(e(n[t]))return t}function Qk(n){return(e,t={})=>{const i=e.match(n.matchPattern);if(!i)return null;const s=i[0],r=e.match(n.parsePattern);if(!r)return null;let o=n.valueCallback?n.valueCallback(r[0]):r[0];o=t.valueCallback?t.valueCallback(o):o;const a=e.slice(s.length);return{value:o,rest:a}}}const Zk=/^(\d+)(th|st|nd|rd)?/i,ew=/\d+/i,tw={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},nw={any:[/^b/i,/^(a|c)/i]},iw={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},sw={any:[/1/i,/2/i,/3/i,/4/i]},rw={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},ow={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},aw={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},lw={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},cw={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},dw={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},uw={ordinalNumber:Qk({matchPattern:Zk,parsePattern:ew,valueCallback:n=>parseInt(n,10)}),era:qi({matchPatterns:tw,defaultMatchWidth:"wide",parsePatterns:nw,defaultParseWidth:"any"}),quarter:qi({matchPatterns:iw,defaultMatchWidth:"wide",parsePatterns:sw,defaultParseWidth:"any",valueCallback:n=>n+1}),month:qi({matchPatterns:rw,defaultMatchWidth:"wide",parsePatterns:ow,defaultParseWidth:"any"}),day:qi({matchPatterns:aw,defaultMatchWidth:"wide",parsePatterns:lw,defaultParseWidth:"any"}),dayPeriod:qi({matchPatterns:cw,defaultMatchWidth:"any",parsePatterns:dw,defaultParseWidth:"any"})},hw={code:"en-US",formatDistance:Rk,formatLong:Lk,formatRelative:Wk,localize:Jk,match:uw,options:{weekStartsOn:0,firstWeekContainsDate:1}};function fw(n){const e=Tt(n);return Nk(e,Pk(e))+1}function pw(n){const e=Tt(n),t=+xr(e)-+Ek(e);return Math.round(t/wf)+1}function Mf(n,e){const t=Tt(n),i=t.getFullYear(),s=qr(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,o=ti(n,0);o.setFullYear(i+1,0,r),o.setHours(0,0,0,0);const a=xs(o,e),l=ti(n,0);l.setFullYear(i,0,r),l.setHours(0,0,0,0);const c=xs(l,e);return t.getTime()>=a.getTime()?i+1:t.getTime()>=c.getTime()?i:i-1}function mw(n,e){const t=qr(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,s=Mf(n,e),r=ti(n,0);return r.setFullYear(s,0,i),r.setHours(0,0,0,0),xs(r,e)}function gw(n,e){const t=Tt(n),i=+xs(t,e)-+mw(t,e);return Math.round(i/wf)+1}function se(n,e){const t=n<0?"-":"",i=Math.abs(n).toString().padStart(e,"0");return t+i}const cn={y(n,e){const t=n.getFullYear(),i=t>0?t:1-t;return se(e==="yy"?i%100:i,e.length)},M(n,e){const t=n.getMonth();return e==="M"?String(t+1):se(t+1,2)},d(n,e){return se(n.getDate(),e.length)},a(n,e){const t=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];default:return t==="am"?"a.m.":"p.m."}},h(n,e){return se(n.getHours()%12||12,e.length)},H(n,e){return se(n.getHours(),e.length)},m(n,e){return se(n.getMinutes(),e.length)},s(n,e){return se(n.getSeconds(),e.length)},S(n,e){const t=e.length,i=n.getMilliseconds(),s=Math.trunc(i*Math.pow(10,t-3));return se(s,e.length)}},fi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},cc={G:function(n,e,t){const i=n.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(i,{width:"abbreviated"});case"GGGGG":return t.era(i,{width:"narrow"});default:return t.era(i,{width:"wide"})}},y:function(n,e,t){if(e==="yo"){const i=n.getFullYear(),s=i>0?i:1-i;return t.ordinalNumber(s,{unit:"year"})}return cn.y(n,e)},Y:function(n,e,t,i){const s=Mf(n,i),r=s>0?s:1-s;if(e==="YY"){const o=r%100;return se(o,2)}return e==="Yo"?t.ordinalNumber(r,{unit:"year"}):se(r,e.length)},R:function(n,e){const t=vf(n);return se(t,e.length)},u:function(n,e){const t=n.getFullYear();return se(t,e.length)},Q:function(n,e,t){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"Q":return String(i);case"QQ":return se(i,2);case"Qo":return t.ordinalNumber(i,{unit:"quarter"});case"QQQ":return t.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(i,{width:"narrow",context:"formatting"});default:return t.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,e,t){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"q":return String(i);case"qq":return se(i,2);case"qo":return t.ordinalNumber(i,{unit:"quarter"});case"qqq":return t.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(i,{width:"narrow",context:"standalone"});default:return t.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,e,t){const i=n.getMonth();switch(e){case"M":case"MM":return cn.M(n,e);case"Mo":return t.ordinalNumber(i+1,{unit:"month"});case"MMM":return t.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(i,{width:"narrow",context:"formatting"});default:return t.month(i,{width:"wide",context:"formatting"})}},L:function(n,e,t){const i=n.getMonth();switch(e){case"L":return String(i+1);case"LL":return se(i+1,2);case"Lo":return t.ordinalNumber(i+1,{unit:"month"});case"LLL":return t.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(i,{width:"narrow",context:"standalone"});default:return t.month(i,{width:"wide",context:"standalone"})}},w:function(n,e,t,i){const s=gw(n,i);return e==="wo"?t.ordinalNumber(s,{unit:"week"}):se(s,e.length)},I:function(n,e,t){const i=pw(n);return e==="Io"?t.ordinalNumber(i,{unit:"week"}):se(i,e.length)},d:function(n,e,t){return e==="do"?t.ordinalNumber(n.getDate(),{unit:"date"}):cn.d(n,e)},D:function(n,e,t){const i=fw(n);return e==="Do"?t.ordinalNumber(i,{unit:"dayOfYear"}):se(i,e.length)},E:function(n,e,t){const i=n.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(i,{width:"short",context:"formatting"});default:return t.day(i,{width:"wide",context:"formatting"})}},e:function(n,e,t,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return se(r,2);case"eo":return t.ordinalNumber(r,{unit:"day"});case"eee":return t.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(s,{width:"short",context:"formatting"});default:return t.day(s,{width:"wide",context:"formatting"})}},c:function(n,e,t,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return se(r,e.length);case"co":return t.ordinalNumber(r,{unit:"day"});case"ccc":return t.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(s,{width:"narrow",context:"standalone"});case"cccccc":return t.day(s,{width:"short",context:"standalone"});default:return t.day(s,{width:"wide",context:"standalone"})}},i:function(n,e,t){const i=n.getDay(),s=i===0?7:i;switch(e){case"i":return String(s);case"ii":return se(s,e.length);case"io":return t.ordinalNumber(s,{unit:"day"});case"iii":return t.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(i,{width:"short",context:"formatting"});default:return t.day(i,{width:"wide",context:"formatting"})}},a:function(n,e,t){const s=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(n,e,t){const i=n.getHours();let s;switch(i===12?s=fi.noon:i===0?s=fi.midnight:s=i/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(n,e,t){const i=n.getHours();let s;switch(i>=17?s=fi.evening:i>=12?s=fi.afternoon:i>=4?s=fi.morning:s=fi.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(n,e,t){if(e==="ho"){let i=n.getHours()%12;return i===0&&(i=12),t.ordinalNumber(i,{unit:"hour"})}return cn.h(n,e)},H:function(n,e,t){return e==="Ho"?t.ordinalNumber(n.getHours(),{unit:"hour"}):cn.H(n,e)},K:function(n,e,t){const i=n.getHours()%12;return e==="Ko"?t.ordinalNumber(i,{unit:"hour"}):se(i,e.length)},k:function(n,e,t){let i=n.getHours();return i===0&&(i=24),e==="ko"?t.ordinalNumber(i,{unit:"hour"}):se(i,e.length)},m:function(n,e,t){return e==="mo"?t.ordinalNumber(n.getMinutes(),{unit:"minute"}):cn.m(n,e)},s:function(n,e,t){return e==="so"?t.ordinalNumber(n.getSeconds(),{unit:"second"}):cn.s(n,e)},S:function(n,e){return cn.S(n,e)},X:function(n,e,t){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return uc(i);case"XXXX":case"XX":return Ln(i);default:return Ln(i,":")}},x:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"x":return uc(i);case"xxxx":case"xx":return Ln(i);default:return Ln(i,":")}},O:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+dc(i,":");default:return"GMT"+Ln(i,":")}},z:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+dc(i,":");default:return"GMT"+Ln(i,":")}},t:function(n,e,t){const i=Math.trunc(n.getTime()/1e3);return se(i,e.length)},T:function(n,e,t){const i=n.getTime();return se(i,e.length)}};function dc(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),s=Math.trunc(i/60),r=i%60;return r===0?t+String(s):t+String(s)+e+se(r,2)}function uc(n,e){return n%60===0?(n>0?"-":"+")+se(Math.abs(n)/60,2):Ln(n,e)}function Ln(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),s=se(Math.trunc(i/60),2),r=se(i%60,2);return t+s+e+r}const hc=(n,e)=>{switch(n){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},Cf=(n,e)=>{switch(n){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},bw=(n,e)=>{const t=n.match(/(P+)(p+)?/)||[],i=t[1],s=t[2];if(!s)return hc(n,e);let r;switch(i){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",hc(i,e)).replace("{{time}}",Cf(s,e))},yw={p:Cf,P:bw},xw=/^D+$/,_w=/^Y+$/,kw=["D","DD","YY","YYYY"];function ww(n){return xw.test(n)}function vw(n){return _w.test(n)}function Sw(n,e,t){const i=Mw(n,e,t);if(console.warn(i),kw.includes(n))throw new RangeError(i)}function Mw(n,e,t){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${e}\`) for formatting ${i} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Cw=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ow=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Dw=/^'([^]*?)'?$/,Tw=/''/g,Nw=/[a-zA-Z]/;function Ew(n,e,t){const i=qr(),s=i.locale??hw,r=i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=i.weekStartsOn??i.locale?.options?.weekStartsOn??0,a=Tt(n);if(!Sf(a))throw new RangeError("Invalid time value");let l=e.match(Ow).map(d=>{const u=d[0];if(u==="p"||u==="P"){const h=yw[u];return h(d,s.formatLong)}return d}).join("").match(Cw).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const u=d[0];if(u==="'")return{isToken:!1,value:Aw(d)};if(cc[u])return{isToken:!0,value:d};if(u.match(Nw))throw new RangeError("Format string contains an unescaped latin alphabet character `"+u+"`");return{isToken:!1,value:d}});s.localize.preprocessor&&(l=s.localize.preprocessor(a,l));const c={firstWeekContainsDate:r,weekStartsOn:o,locale:s};return l.map(d=>{if(!d.isToken)return d.value;const u=d.value;(vw(u)||ww(u))&&Sw(u,e,String(n));const h=cc[u[0]];return h(a,u,s.localize,c)}).join("")}function Aw(n){const e=n.match(Dw);return e?e[1].replace(Tw,"'"):n}const Pw="_wrapper_izsg8_1",Iw="_label_izsg8_9",Rw="_datepicker_izsg8_16",zw="_trigger_izsg8_20",jw="_open_izsg8_43",Bw="_error_izsg8_50",Lw="_disabled_izsg8_54",Fw="_icon_izsg8_59",Ww="_placeholder_izsg8_64",$w="_popover_izsg8_68",ce={wrapper:Pw,label:Iw,datepicker:Rw,trigger:zw,"size-sm":"_size-sm_izsg8_35","size-md":"_size-md_izsg8_36","size-lg":"_size-lg_izsg8_37",open:jw,error:Bw,disabled:Lw,icon:Fw,placeholder:Ww,popover:$w,"error-text":"_error-text_izsg8_80","rdp-root":"_rdp-root_izsg8_88","rdp-months":"_rdp-months_izsg8_107","rdp-month":"_rdp-month_izsg8_107","rdp-caption":"_rdp-caption_izsg8_117","rdp-caption-label":"_rdp-caption-label_izsg8_124","rdp-nav":"_rdp-nav_izsg8_130","rdp-nav-button":"_rdp-nav-button_izsg8_135","rdp-table":"_rdp-table_izsg8_153","rdp-head-row":"_rdp-head-row_izsg8_158","rdp-row":"_rdp-row_izsg8_159","rdp-head-cell":"_rdp-head-cell_izsg8_164","rdp-cell":"_rdp-cell_izsg8_176","rdp-day":"_rdp-day_izsg8_182"},Of=x.forwardRef(({value:n,defaultValue:e=null,placeholder:t="Pick a date",size:i="md",disabled:s=!1,label:r,error:o,dateFormat:a="MMM d, yyyy",minDate:l,maxDate:c,onChange:d,className:u,id:h},f)=>{const p=x.useId(),m=h??p,g=n!==void 0,[y,S]=x.useState(e),_=g?n??null:y,[k,v]=x.useState(!1),w=x.useRef(null),M=x.useCallback(O=>{const D=O??null;g||S(D),d?.(D),v(!1)},[g,d]);x.useEffect(()=>{const O=D=>{w.current&&!w.current.contains(D.target)&&v(!1)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);const C=_&&Sf(_)?Ew(_,a):"";return b.jsxs("div",{ref:f,className:N(ce.wrapper,ce[`size-${i}`],u),children:[r&&b.jsx("label",{htmlFor:m,className:ce.label,children:r}),b.jsxs("div",{ref:w,className:N(ce.datepicker,k&&ce.open,o&&ce.error,s&&ce.disabled),children:[b.jsxs("button",{type:"button",id:m,className:ce.trigger,onClick:()=>!s&&v(O=>!O),disabled:s,"aria-haspopup":"dialog","aria-expanded":k,"aria-label":r??"Select date",children:[b.jsxs("svg",{className:ce.icon,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[b.jsx("rect",{x:"1",y:"3",width:"14",height:"12",rx:"2",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("path",{d:"M1 7h14",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("path",{d:"M5 1v4M11 1v4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),b.jsx("span",{className:N(!C&&ce.placeholder),children:C||t})]}),k&&b.jsx("div",{className:ce.popover,role:"dialog","aria-modal":"true","aria-label":"Date picker calendar",children:b.jsx(Ok,{mode:"single",selected:_??void 0,onSelect:M,disabled:[...l?[{before:l}]:[],...c?[{after:c}]:[]],classNames:{root:ce["rdp-root"],months:ce["rdp-months"],month:ce["rdp-month"],month_caption:ce["rdp-caption"],caption_label:ce["rdp-caption-label"],nav:ce["rdp-nav"],button_previous:ce["rdp-nav-button"],button_next:ce["rdp-nav-button"],month_grid:ce["rdp-table"],weekdays:ce["rdp-head-row"],weekday:ce["rdp-head-cell"],week:ce["rdp-row"],day:ce["rdp-cell"],day_button:ce["rdp-day"]}})})]}),o&&b.jsx("p",{className:ce["error-text"],role:"alert",children:o})]})});Of.displayName="DatePicker";function Te(n){this.content=n}Te.prototype={constructor:Te,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var i=t&&t!=n?this.remove(t):this,s=i.find(n),r=i.content.slice();return s==-1?r.push(t||n,e):(r[s+1]=e,t&&(r[s]=t)),new Te(r)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Te(t)},addToStart:function(n,e){return new Te([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Te(t)},addBefore:function(n,e,t){var i=this.remove(e),s=i.content.slice(),r=i.find(n);return s.splice(r==-1?s.length:r,0,e,t),new Te(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Te.from(n),n.size?new Te(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Te.from(n),n.size?new Te(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Te.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Te.from=function(n){if(n instanceof Te)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Te(e)};function Df(n,e,t){for(let i=0;;i++){if(i==n.childCount||i==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(i),r=e.child(i);if(s==r){t+=s.nodeSize;continue}if(!s.sameMarkup(r))return t;if(s.isText&&s.text!=r.text){for(let o=0;s.text[o]==r.text[o];o++)t++;return t}if(s.content.size||r.content.size){let o=Df(s.content,r.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Tf(n,e,t,i){for(let s=n.childCount,r=e.childCount;;){if(s==0||r==0)return s==r?null:{a:t,b:i};let o=n.child(--s),a=e.child(--r),l=o.nodeSize;if(o==a){t-=l,i-=l;continue}if(!o.sameMarkup(a))return{a:t,b:i};if(o.isText&&o.text!=a.text){let c=0,d=Math.min(o.text.length,a.text.length);for(;c<d&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,t--,i--;return{a:t,b:i}}if(o.content.size||a.content.size){let c=Tf(o.content,a.content,t-1,i-1);if(c)return c}t-=l,i-=l}}class T{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,t,i,s=0,r){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&i(l,s+a,r||null,o)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,t-d),i,s+d)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,i,s){let r="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&i&&(o?o=!1:r+=i),r+=c},0),r}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,i=e.firstChild,s=this.content.slice(),r=0;for(t.isText&&t.sameMarkup(i)&&(s[s.length-1]=t.withText(t.text+i.text),r=1);r<e.content.length;r++)s.push(e.content[r]);return new T(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let i=[],s=0;if(t>e)for(let r=0,o=0;o<t;r++){let a=this.content[r],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),i.push(a),s+=a.nodeSize),o=l}return new T(i,s)}cutByIndex(e,t){return e==t?T.empty:e==0&&t==this.content.length?this:new T(this.content.slice(e,t))}replaceChild(e,t){let i=this.content[e];if(i==t)return this;let s=this.content.slice(),r=this.size+t.nodeSize-i.nodeSize;return s[e]=t,new T(s,r)}addToStart(e){return new T([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new T(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,i=0;t<this.content.length;t++){let s=this.content[t];e(s,i,t),i+=s.nodeSize}}findDiffStart(e,t=0){return Df(this,e,t)}findDiffEnd(e,t=this.size,i=e.size){return Tf(this,e,t,i)}findIndex(e){if(e==0)return qs(0,e);if(e==this.size)return qs(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,i=0;;t++){let s=this.child(t),r=i+s.nodeSize;if(r>=e)return r==e?qs(t+1,r):qs(t,i);i=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return T.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new T(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return T.empty;let t,i=0;for(let s=0;s<e.length;s++){let r=e[s];i+=r.nodeSize,s&&r.isText&&e[s-1].sameMarkup(r)?(t||(t=e.slice(0,s)),t[t.length-1]=r.withText(t[t.length-1].text+r.text)):t&&t.push(r)}return new T(t||e,i)}static from(e){if(!e)return T.empty;if(e instanceof T)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new T([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}T.empty=new T([],0);const Co={index:0,offset:0};function qs(n,e){return Co.index=n,Co.offset=e,Co}function _r(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!_r(n[i],e[i]))return!1}else{for(let i in n)if(!(i in e)||!_r(n[i],e[i]))return!1;for(let i in e)if(!(i in n))return!1}return!0}let le=class da{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,i=!1;for(let s=0;s<e.length;s++){let r=e[s];if(this.eq(r))return e;if(this.type.excludes(r.type))t||(t=e.slice(0,s));else{if(r.type.excludes(this.type))return e;!i&&r.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),i=!0),t&&t.push(r)}}return t||(t=e.slice()),i||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&_r(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let i=e.marks[t.type];if(!i)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=i.create(t.attrs);return i.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!e[i].eq(t[i]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return da.none;if(e instanceof da)return[e];let t=e.slice();return t.sort((i,s)=>i.type.rank-s.type.rank),t}};le.none=[];class kr extends Error{}class I{constructor(e,t,i){this.content=e,this.openStart=t,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let i=Ef(this.content,e+this.openStart,t);return i&&new I(i,this.openStart,this.openEnd)}removeBetween(e,t){return new I(Nf(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return I.empty;let i=t.openStart||0,s=t.openEnd||0;if(typeof i!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new I(T.fromJSON(e,t.content),i,s)}static maxOpen(e,t=!0){let i=0,s=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)i++;for(let r=e.lastChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.lastChild)s++;return new I(e,i,s)}}I.empty=new I(T.empty,0,0);function Nf(n,e,t){let{index:i,offset:s}=n.findIndex(e),r=n.maybeChild(i),{index:o,offset:a}=n.findIndex(t);if(s==e||r.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(i!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(i,r.copy(Nf(r.content,e-s-1,t-s-1)))}function Ef(n,e,t,i){let{index:s,offset:r}=n.findIndex(e),o=n.maybeChild(s);if(r==e||o.isText)return i&&!i.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=Ef(o.content,e-r-1,t,o);return a&&n.replaceChild(s,o.copy(a))}function Hw(n,e,t){if(t.openStart>n.depth)throw new kr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new kr("Inconsistent open depths");return Af(n,e,t,0)}function Af(n,e,t,i){let s=n.index(i),r=n.node(i);if(s==e.index(i)&&i<n.depth-t.openStart){let o=Af(n,e,t,i+1);return r.copy(r.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==i&&e.depth==i){let o=n.parent,a=o.content;return Gn(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Vw(t,n);return Gn(r,If(n,o,a,e,i))}else return Gn(r,wr(n,e,i))}function Pf(n,e){if(!e.type.compatibleContent(n.type))throw new kr("Cannot join "+e.type.name+" onto "+n.type.name)}function ua(n,e,t){let i=n.node(t);return Pf(i,e.node(t)),i}function Jn(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function cs(n,e,t,i){let s=(e||n).node(t),r=0,o=e?e.index(t):s.childCount;n&&(r=n.index(t),n.depth>t?r++:n.textOffset&&(Jn(n.nodeAfter,i),r++));for(let a=r;a<o;a++)Jn(s.child(a),i);e&&e.depth==t&&e.textOffset&&Jn(e.nodeBefore,i)}function Gn(n,e){return n.type.checkContent(e),n.copy(e)}function If(n,e,t,i,s){let r=n.depth>s&&ua(n,e,s+1),o=i.depth>s&&ua(t,i,s+1),a=[];return cs(null,n,s,a),r&&o&&e.index(s)==t.index(s)?(Pf(r,o),Jn(Gn(r,If(n,e,t,i,s+1)),a)):(r&&Jn(Gn(r,wr(n,e,s+1)),a),cs(e,t,s,a),o&&Jn(Gn(o,wr(t,i,s+1)),a)),cs(i,null,s,a),new T(a)}function wr(n,e,t){let i=[];if(cs(null,n,t,i),n.depth>t){let s=ua(n,e,t+1);Jn(Gn(s,wr(n,e,t+1)),i)}return cs(e,null,t,i),new T(i)}function Vw(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let r=t-1;r>=0;r--)s=e.node(r).copy(T.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class _s{constructor(e,t,i){this.pos=e,this.path=t,this.parentOffset=i,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let i=this.pos-this.path[this.path.length-1],s=e.child(t);return i?e.child(t).cut(i):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let i=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let r=0;r<e;r++)s+=i.child(r).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return le.none;if(this.textOffset)return e.child(t).marks;let i=e.maybeChild(t-1),s=e.maybeChild(t);if(!i){let a=i;i=s,s=a}let r=i.marks;for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!s||!r[o].isInSet(s.marks))&&(r=r[o--].removeFromSet(r));return r}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let i=t.marks,s=e.parent.maybeChild(e.index());for(var r=0;r<i.length;r++)i[r].type.spec.inclusive===!1&&(!s||!i[r].isInSet(s.marks))&&(i=i[r--].removeFromSet(i));return i}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let i=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);i>=0;i--)if(e.pos<=this.end(i)&&(!t||t(this.node(i))))return new vr(this,e,i);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let i=[],s=0,r=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(r),c=r-l;if(i.push(o,a,s+l),!c||(o=o.child(a),o.isText))break;r=c-1,s+=l+1}return new _s(t,i,r)}static resolveCached(e,t){let i=fc.get(e);if(i)for(let r=0;r<i.elts.length;r++){let o=i.elts[r];if(o.pos==t)return o}else fc.set(e,i=new Yw);let s=i.elts[i.i]=_s.resolve(e,t);return i.i=(i.i+1)%qw,s}}class Yw{constructor(){this.elts=[],this.i=0}}const qw=12,fc=new WeakMap;class vr{constructor(e,t,i){this.$from=e,this.$to=t,this.depth=i}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Kw=Object.create(null);let kn=class ha{constructor(e,t,i,s=le.none){this.type=e,this.attrs=t,this.marks=s,this.content=i||T.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,i,s=0){this.content.nodesBetween(e,t,i,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,i,s){return this.content.textBetween(e,t,i,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,i){return this.type==e&&_r(this.attrs,t||e.defaultAttrs||Kw)&&le.sameSet(this.marks,i||le.none)}copy(e=null){return e==this.content?this:new ha(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ha(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,i=!1){if(e==t)return I.empty;let s=this.resolve(e),r=this.resolve(t),o=i?0:s.sharedDepth(t),a=s.start(o),c=s.node(o).content.cut(s.pos-a,r.pos-a);return new I(c,s.depth-o,r.depth-o)}replace(e,t,i){return Hw(this.resolve(e),this.resolve(t),i)}nodeAt(e){for(let t=this;;){let{index:i,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(i),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:i}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:i}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:i}=this.content.findIndex(e);if(i<e)return{node:this.content.child(t),index:t,offset:i};let s=this.content.child(t-1);return{node:s,index:t-1,offset:i-s.nodeSize}}resolve(e){return _s.resolveCached(this,e)}resolveNoCache(e){return _s.resolve(this,e)}rangeHasMark(e,t,i){let s=!1;return t>e&&this.nodesBetween(e,t,r=>(i.isInSet(r.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Rf(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,i=T.empty,s=0,r=i.childCount){let o=this.contentMatchAt(e).matchFragment(i,s,r),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=s;l<r;l++)if(!this.type.allowsMarks(i.child(l).marks))return!1;return!0}canReplaceWith(e,t,i,s){if(s&&!this.type.allowsMarks(s))return!1;let r=this.contentMatchAt(e).matchType(i),o=r&&r.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=le.none;for(let t=0;t<this.marks.length;t++){let i=this.marks[t];i.type.checkAttrs(i.attrs),e=i.addToSet(e)}if(!le.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let i;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,i)}let s=T.fromJSON(e,t.content),r=e.nodeType(t.type).create(t.attrs,s,i);return r.type.checkAttrs(r.attrs),r}};kn.prototype.text=void 0;class Sr extends kn{constructor(e,t,i,s){if(super(e,t,null,s),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Rf(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Sr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Sr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Rf(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class ni{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let i=new Uw(e,t);if(i.next==null)return ni.empty;let s=zf(i);i.next&&i.err("Unexpected trailing text");let r=tv(ev(s));return nv(r,i),r}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,i=e.childCount){let s=this;for(let r=t;s&&r<i;r++)s=s.matchType(e.child(r).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let i=0;i<e.next.length;i++)if(this.next[t].type==e.next[i].type)return!0;return!1}fillBefore(e,t=!1,i=0){let s=[this];function r(o,a){let l=o.matchFragment(e,i);if(l&&(!t||l.validEnd))return T.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:u}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&s.indexOf(u)==-1){s.push(u);let h=r(u,a.concat(d));if(h)return h}}return null}return r(this,[])}findWrapping(e){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==e)return this.wrapCache[i+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),i=[{match:this,type:null,via:null}];for(;i.length;){let s=i.shift(),r=s.match;if(r.matchType(e)){let o=[];for(let a=s;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<r.next.length;o++){let{type:a,next:l}=r.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!s.type||l.validEnd)&&(i.push({match:a.contentMatch,type:a,via:s}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(i){e.push(i);for(let s=0;s<i.next.length;s++)e.indexOf(i.next[s].next)==-1&&t(i.next[s].next)}return t(this),e.map((i,s)=>{let r=s+(i.validEnd?"*":" ")+" ";for(let o=0;o<i.next.length;o++)r+=(o?", ":"")+i.next[o].type.name+"->"+e.indexOf(i.next[o].next);return r}).join(`
|
|
2
|
+
`)}}ni.empty=new ni(!0);class Uw{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function zf(n){let e=[];do e.push(Jw(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Jw(n){let e=[];do e.push(Gw(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Gw(n){let e=Zw(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Xw(n,e);else break;return e}function pc(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Xw(n,e){let t=pc(n),i=t;return n.eat(",")&&(n.next!="}"?i=pc(n):i=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:i,expr:e}}function Qw(n,e){let t=n.nodeTypes,i=t[e];if(i)return[i];let s=[];for(let r in t){let o=t[r];o.isInGroup(e)&&s.push(o)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function Zw(n){if(n.eat("(")){let e=zf(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Qw(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function ev(n){let e=[[]];return s(r(n,0),t()),e;function t(){return e.push([])-1}function i(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function s(o,a){o.forEach(l=>l.to=a)}function r(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(r(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=r(o.exprs[l],a);if(l==o.exprs.length-1)return c;s(c,a=t())}else if(o.type=="star"){let l=t();return i(a,l),s(r(o.expr,l),l),[i(l)]}else if(o.type=="plus"){let l=t();return s(r(o.expr,a),l),s(r(o.expr,l),l),[i(l)]}else{if(o.type=="opt")return[i(a)].concat(r(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let d=t();s(r(o.expr,l),d),l=d}if(o.max==-1)s(r(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let d=t();i(l,d),s(r(o.expr,l),d),l=d}return[i(l)]}else{if(o.type=="name")return[i(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function jf(n,e){return e-n}function mc(n,e){let t=[];return i(e),t.sort(jf);function i(s){let r=n[s];if(r.length==1&&!r[0].term)return i(r[0].to);t.push(s);for(let o=0;o<r.length;o++){let{term:a,to:l}=r[o];!a&&t.indexOf(l)==-1&&i(l)}}}function tv(n){let e=Object.create(null);return t(mc(n,0));function t(i){let s=[];i.forEach(o=>{n[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d<s.length;d++)s[d][0]==a&&(c=s[d][1]);mc(n,l).forEach(d=>{c||s.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let r=e[i.join(",")]=new ni(i.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let a=s[o][1].sort(jf);r.next.push({type:s[o][0],next:e[a.join(",")]||t(a)})}return r}}function nv(n,e){for(let t=0,i=[n];t<i.length;t++){let s=i[t],r=!s.validEnd,o=[];for(let a=0;a<s.next.length;a++){let{type:l,next:c}=s.next[a];o.push(l.name),r&&!(l.isText||l.hasRequiredAttrs())&&(r=!1),i.indexOf(c)==-1&&i.push(c)}r&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Bf(n){let e=Object.create(null);for(let t in n){let i=n[t];if(!i.hasDefault)return null;e[t]=i.default}return e}function Lf(n,e){let t=Object.create(null);for(let i in n){let s=e&&e[i];if(s===void 0){let r=n[i];if(r.hasDefault)s=r.default;else throw new RangeError("No value supplied for attribute "+i)}t[i]=s}return t}function Ff(n,e,t,i){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let r=n[s];r.validate&&r.validate(e[s])}}function Wf(n,e){let t=Object.create(null);if(e)for(let i in e)t[i]=new sv(n,i,e[i]);return t}let gc=class $f{constructor(e,t,i){this.name=e,this.schema=t,this.spec=i,this.markSet=null,this.groups=i.group?i.group.split(" "):[],this.attrs=Wf(e,i.attrs),this.defaultAttrs=Bf(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(i.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ni.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Lf(this.attrs,e)}create(e=null,t,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new kn(this,this.computeAttrs(e),T.from(t),le.setFrom(i))}createChecked(e=null,t,i){return t=T.from(t),this.checkContent(t),new kn(this,this.computeAttrs(e),t,le.setFrom(i))}createAndFill(e=null,t,i){if(e=this.computeAttrs(e),t=T.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let s=this.contentMatch.matchFragment(t),r=s&&s.fillBefore(T.empty,!0);return r?new kn(this,e,t.append(r),le.setFrom(i)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let i=0;i<e.childCount;i++)if(!this.allowsMarks(e.child(i).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ff(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let i=0;i<e.length;i++)this.allowsMarkType(e[i].type)?t&&t.push(e[i]):t||(t=e.slice(0,i));return t?t.length?t:le.none:e}static compile(e,t){let i=Object.create(null);e.forEach((r,o)=>i[r]=new $f(r,t,o));let s=t.spec.topNode||"doc";if(!i[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!i.text)throw new RangeError("Every schema needs a 'text' type");for(let r in i.text.attrs)throw new RangeError("The text node type should not have attributes");return i}};function iv(n,e,t){let i=t.split("|");return s=>{let r=s===null?"null":typeof s;if(i.indexOf(r)<0)throw new RangeError(`Expected value of type ${i} for attribute ${e} on type ${n}, got ${r}`)}}class sv{constructor(e,t,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?iv(e,t,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class Kr{constructor(e,t,i,s){this.name=e,this.rank=t,this.schema=i,this.spec=s,this.attrs=Wf(e,s.attrs),this.excluded=null;let r=Bf(this.attrs);this.instance=r?new le(this,r):null}create(e=null){return!e&&this.instance?this.instance:new le(this,Lf(this.attrs,e))}static compile(e,t){let i=Object.create(null),s=0;return e.forEach((r,o)=>i[r]=new Kr(r,s++,t,o)),i}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Ff(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Hf{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=Te.from(e.nodes),t.marks=Te.from(e.marks||{}),this.nodes=gc.compile(this.spec.nodes,this),this.marks=Kr.compile(this.spec.marks,this);let i=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let r=this.nodes[s],o=r.spec.content||"",a=r.spec.marks;if(r.contentMatch=i[o]||(i[o]=ni.parse(o,this.nodes)),r.inlineContent=r.contentMatch.inlineContent,r.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!r.isInline||!r.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=r}r.markSet=a=="_"?null:a?bc(this,a.split(" ")):a==""||!r.inlineContent?[]:null}for(let s in this.marks){let r=this.marks[s],o=r.spec.excludes;r.excluded=o==null?[r]:o==""?[]:bc(this,o.split(" "))}this.nodeFromJSON=s=>kn.fromJSON(this,s),this.markFromJSON=s=>le.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,i,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof gc){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,i,s)}text(e,t){let i=this.nodes.text;return new Sr(i,i.defaultAttrs,e,le.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function bc(n,e){let t=[];for(let i=0;i<e.length;i++){let s=e[i],r=n.marks[s],o=r;if(r)t.push(r);else for(let a in n.marks){let l=n.marks[a];(s=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(s)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[i]+"'")}return t}function rv(n){return n.tag!=null}function ov(n){return n.style!=null}class wn{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let i=this.matchedStyles=[];t.forEach(s=>{if(rv(s))this.tags.push(s);else if(ov(s)){let r=/[^=]*/.exec(s.style)[0];i.indexOf(r)<0&&i.push(r),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let r=e.nodes[s.node];return r.contentMatch.matchType(r)})}parse(e,t={}){let i=new xc(this,t,!1);return i.addAll(e,le.none,t.from,t.to),i.finish()}parseSlice(e,t={}){let i=new xc(this,t,!0);return i.addAll(e,le.none,t.from,t.to),I.maxOpen(i.finish())}matchTag(e,t,i){for(let s=i?this.tags.indexOf(i)+1:0;s<this.tags.length;s++){let r=this.tags[s];if(cv(e,r.tag)&&(r.namespace===void 0||e.namespaceURI==r.namespace)&&(!r.context||t.matchesContext(r.context))){if(r.getAttrs){let o=r.getAttrs(e);if(o===!1)continue;r.attrs=o||void 0}return r}}}matchStyle(e,t,i,s){for(let r=s?this.styles.indexOf(s)+1:0;r<this.styles.length;r++){let o=this.styles[r],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!i.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function i(s){let r=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<r)break}t.splice(o,0,s)}for(let s in e.marks){let r=e.marks[s].spec.parseDOM;r&&r.forEach(o=>{i(o=_c(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let r=e.nodes[s].spec.parseDOM;r&&r.forEach(o=>{i(o=_c(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new wn(e,wn.schemaRules(e)))}}const Vf={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},av={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Yf={ol:!0,ul:!0},ks=1,fa=2,ds=4;function yc(n,e,t){return e!=null?(e?ks:0)|(e==="full"?fa:0):n&&n.whitespace=="pre"?ks|fa:t&~ds}class Ks{constructor(e,t,i,s,r,o){this.type=e,this.attrs=t,this.marks=i,this.solid=s,this.options=o,this.content=[],this.activeMarks=le.none,this.match=r||(o&ds?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(T.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let i=this.type.contentMatch,s;return(s=i.findWrapping(e.type))?(this.match=i,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ks)){let i=this.content[this.content.length-1],s;if(i&&i.isText&&(s=/[ \t\r\n\u000c]+$/.exec(i.text))){let r=i;i.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-s[0].length))}}let t=T.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(T.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Vf.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class xc{constructor(e,t,i){this.parser=e,this.options=t,this.isOpen=i,this.open=0,this.localPreserveWS=!1;let s=t.topNode,r,o=yc(null,t.preserveWhitespace,0)|(i?ds:0);s?r=new Ks(s.type,s.attrs,le.none,!0,t.topMatch||s.type.contentMatch,o):i?r=new Ks(null,null,le.none,!0,null,o):r=new Ks(e.schema.topNodeType,null,le.none,!0,null,o),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let i=e.nodeValue,s=this.top,r=s.options&fa?"full":this.localPreserveWS||(s.options&ks)>0,{schema:o}=this.parser;if(r==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(i)){if(r)if(r==="full")i=i.replace(/\r\n?/g,`
|
|
3
|
+
`);else if(o.linebreakReplacement&&/[\r\n]/.test(i)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=i.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[l]&&this.insertNode(o.text(a[l]),t,!/\S/.test(a[l]));i=""}else i=i.replace(/\r?\n|\r/g," ");else if(i=i.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(i)&&this.open==this.nodes.length-1){let a=s.content[s.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(i=i.slice(1))}i&&this.insertNode(o.text(i),t,!/\S/.test(i)),this.findInText(e)}else this.findInside(e)}addElement(e,t,i){let s=this.localPreserveWS,r=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;Yf.hasOwnProperty(o)&&this.parser.normalizeLists&&lv(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,i));e:if(l?l.ignore:av.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,d=this.needsBlock;if(Vf.hasOwnProperty(o))r.content.length&&r.content[0].isInline&&this.open&&(this.open--,r=this.top),c=!0,r.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let u=l&&l.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),c&&this.sync(r),this.needsBlock=d}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
|
+
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let i=e.style;if(i&&i.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let r=this.parser.matchedStyles[s],o=i.getPropertyValue(r);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(r,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,i,s){let r,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),i,e.nodeName=="BR")||this.leafFallback(e,i);else{let l=this.enter(o,t.attrs||null,i,t.preserveWhitespace);l&&(r=!0,i=l)}else{let l=this.parser.schema.marks[t.mark];i=i.concat(l.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,i,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,i,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,i),this.findAround(e,l,!1)}r&&this.sync(a)&&this.open--}addAll(e,t,i,s){let r=i||0;for(let o=i?e.childNodes[i]:e.firstChild,a=s==null?null:e.childNodes[s];o!=a;o=o.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(o,t);this.findAtPoint(e,r)}findPlace(e,t,i){let s,r;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!s||s.length>c.length+a)&&(s=c,r=l,!c.length))break;if(l.solid){if(i)break;a+=2}}if(!s)return null;this.sync(r);for(let o=0;o<s.length;o++)t=this.enterInner(s[o],null,t,!1);return t}insertNode(e,t,i){if(e.isInline&&this.needsBlock&&!this.top.type){let r=this.textblockFromContext();r&&(t=this.enterInner(r,null,t))}let s=this.findPlace(e,t,i);if(s){this.closeExtra();let r=this.top;r.match&&(r.match=r.match.matchType(e.type));let o=le.none;for(let a of s.concat(e.marks))(r.type?r.type.allowsMarkType(a.type):kc(a.type,e.type))&&(o=a.addToSet(o));return r.content.push(e.mark(o)),!0}return!1}enter(e,t,i,s){let r=this.findPlace(e.create(t),i,!1);return r&&(r=this.enterInner(e,t,i,!0,s)),r}enterInner(e,t,i,s=!1,r){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=yc(e,r,o.options);o.options&ds&&o.content.length==0&&(a|=ds);let l=le.none;return i=i.filter(c=>(o.type?o.type.allowsMarkType(c.type):kc(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Ks(e,t,l,s,null,a)),this.open++,i}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=ks)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let i=this.nodes[t].content;for(let s=i.length-1;s>=0;s--)e+=i[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==e&&this.find[i].offset==t&&(this.find[i].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,i){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(i?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),i=this.options.context,s=!this.isOpen&&(!i||i.parent.type==this.nodes[0].type),r=-(i?i.depth+1:0)+(s?0:1),o=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=r;l--)if(o(a-1,l))return!0;return!1}else{let d=l>0||l==0&&s?this.nodes[l].type:i&&l>=r?i.node(l-r).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(i&&i.isTextblock&&i.defaultAttrs)return i}for(let t in this.parser.schema.nodes){let i=this.parser.schema.nodes[t];if(i.isTextblock&&i.defaultAttrs)return i}}}function lv(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&Yf.hasOwnProperty(i)&&t?(t.appendChild(e),e=t):i=="li"?t=e:i&&(t=null)}}function cv(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function _c(n){let e={};for(let t in n)e[t]=n[t];return e}function kc(n,e){let t=e.schema.nodes;for(let i in t){let s=t[i];if(!s.allowsMarkType(n))continue;let r=[],o=a=>{r.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:d}=a.edge(l);if(c==e||r.indexOf(d)<0&&o(d))return!0}};if(o(s.contentMatch))return!0}}class ai{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},i){i||(i=Oo(t).createDocumentFragment());let s=i,r=[];return e.forEach(o=>{if(r.length||o.marks.length){let a=0,l=0;for(;a<r.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(r[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<r.length;)s=r.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],d=this.serializeMark(c,o.isInline,t);d&&(r.push([c,s]),s.appendChild(d.dom),s=d.contentDOM||d.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),i}serializeNodeInner(e,t){let{dom:i,contentDOM:s}=fr(Oo(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return i}serializeNode(e,t={}){let i=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let r=this.serializeMark(e.marks[s],e.isInline,t);r&&((r.contentDOM||r.dom).appendChild(i),i=r.dom)}return i}serializeMark(e,t,i={}){let s=this.marks[e.type.name];return s&&fr(Oo(i),s(e,t),null,e.attrs)}static renderSpec(e,t,i=null,s){return fr(e,t,i,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ai(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=wc(e.nodes);return t.text||(t.text=i=>i.text),t}static marksFromSchema(e){return wc(e.marks)}}function wc(n){let e={};for(let t in n){let i=n[t].spec.toDOM;i&&(e[t]=i)}return e}function Oo(n){return n.document||window.document}const vc=new WeakMap;function dv(n){let e=vc.get(n);return e===void 0&&vc.set(n,e=uv(n)),e}function uv(n){let e=null;function t(i){if(i&&typeof i=="object")if(Array.isArray(i))if(typeof i[0]=="string")e||(e=[]),e.push(i);else for(let s=0;s<i.length;s++)t(i[s]);else for(let s in i)t(i[s])}return t(n),e}function fr(n,e,t,i){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],r;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(i&&(r=dv(i))&&r.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(t=s.slice(0,o),s=s.slice(o+1));let a,l=t?n.createElementNS(t,s):n.createElement(s),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let h=u.indexOf(" ");h>0?l.setAttributeNS(u.slice(0,h),u.slice(h+1),c[u]):u=="style"&&l.style?l.style.cssText=c[u]:l.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let h=e[u];if(h===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:p}=fr(n,h,t,i);if(l.appendChild(f),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const qf=65535,Kf=Math.pow(2,16);function hv(n,e){return n+e*Kf}function Sc(n){return n&qf}function fv(n){return(n-(n&qf))/Kf}const Uf=1,Jf=2,pr=4,Gf=8;class pa{constructor(e,t,i){this.pos=e,this.delInfo=t,this.recover=i}get deleted(){return(this.delInfo&Gf)>0}get deletedBefore(){return(this.delInfo&(Uf|pr))>0}get deletedAfter(){return(this.delInfo&(Jf|pr))>0}get deletedAcross(){return(this.delInfo&pr)>0}}class lt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&<.empty)return lt.empty}recover(e){let t=0,i=Sc(e);if(!this.inverted)for(let s=0;s<i;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[i*3]+t+fv(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,i){let s=0,r=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?s:0);if(l>e)break;let c=this.ranges[a+r],d=this.ranges[a+o],u=l+c;if(e<=u){let h=c?e==l?-1:e==u?1:t:t,f=l+s+(h<0?0:d);if(i)return f;let p=e==(t<0?l:u)?null:hv(a/3,e-l),m=e==l?Jf:e==u?Uf:pr;return(t<0?e!=l:e!=u)&&(m|=Gf),new pa(f,m,p)}s+=d-c}return i?e+s:new pa(e+s,0,null)}touches(e,t){let i=0,s=Sc(t),r=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+r],d=l+c;if(e<=d&&a==s*3)return!0;i+=this.ranges[a+o]-c}return!1}forEach(e){let t=this.inverted?2:1,i=this.inverted?1:2;for(let s=0,r=0;s<this.ranges.length;s+=3){let o=this.ranges[s],a=o-(this.inverted?r:0),l=o+(this.inverted?0:r),c=this.ranges[s+t],d=this.ranges[s+i];e(a,a+c,l,l+d),r+=d-c}}invert(){return new lt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?lt.empty:new lt(e<0?[0,-e,0]:[0,0,e])}}lt.empty=new lt([]);class ws{constructor(e,t,i=0,s=e?e.length:0){this.mirror=t,this.from=i,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new ws(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,i=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?i+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,i=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?i-s-1:void 0)}}invert(){let e=new ws;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let i=this.from;i<this.to;i++)e=this._maps[i].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,i){let s=0;for(let r=this.from;r<this.to;r++){let o=this._maps[r],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(r);if(l!=null&&l>r&&l<this.to){r=l,e=this._maps[l].recover(a.recover);continue}}s|=a.delInfo,e=a.pos}return i?e:new pa(e,s,null)}}const Do=Object.create(null);class Fe{getMap(){return lt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=Do[t.stepType];if(!i)throw new RangeError(`No step type ${t.stepType} defined`);return i.fromJSON(e,t)}static jsonID(e,t){if(e in Do)throw new RangeError("Duplicate use of step JSON ID "+e);return Do[e]=t,t.prototype.jsonID=e,t}}class be{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new be(e,null)}static fail(e){return new be(null,e)}static fromReplace(e,t,i,s){try{return be.ok(e.replace(t,i,s))}catch(r){if(r instanceof kr)return be.fail(r.message);throw r}}}function Qa(n,e,t){let i=[];for(let s=0;s<n.childCount;s++){let r=n.child(s);r.content.size&&(r=r.copy(Qa(r.content,e,r))),r.isInline&&(r=e(r,t,s)),i.push(r)}return T.fromArray(i)}class pn extends Fe{constructor(e,t,i){super(),this.from=e,this.to=t,this.mark=i}apply(e){let t=e.slice(this.from,this.to),i=e.resolve(this.from),s=i.node(i.sharedDepth(this.to)),r=new I(Qa(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return be.fromReplace(e,this.from,this.to,r)}invert(){return new Ft(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new pn(t.pos,i.pos,this.mark)}merge(e){return e instanceof pn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new pn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new pn(t.from,t.to,e.markFromJSON(t.mark))}}Fe.jsonID("addMark",pn);class Ft extends Fe{constructor(e,t,i){super(),this.from=e,this.to=t,this.mark=i}apply(e){let t=e.slice(this.from,this.to),i=new I(Qa(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return be.fromReplace(e,this.from,this.to,i)}invert(){return new pn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new Ft(t.pos,i.pos,this.mark)}merge(e){return e instanceof Ft&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ft(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ft(t.from,t.to,e.markFromJSON(t.mark))}}Fe.jsonID("removeMark",Ft);class mn extends Fe{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return be.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return be.fromReplace(e,this.pos,this.pos+1,new I(T.from(i),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let i=this.mark.addToSet(t.marks);if(i.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(i))return new mn(this.pos,t.marks[s]);return new mn(this.pos,this.mark)}}return new ii(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new mn(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new mn(t.pos,e.markFromJSON(t.mark))}}Fe.jsonID("addNodeMark",mn);class ii extends Fe{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return be.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return be.fromReplace(e,this.pos,this.pos+1,new I(T.from(i),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new mn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ii(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ii(t.pos,e.markFromJSON(t.mark))}}Fe.jsonID("removeNodeMark",ii);class ve extends Fe{constructor(e,t,i,s=!1){super(),this.from=e,this.to=t,this.slice=i,this.structure=s}apply(e){return this.structure&&ma(e,this.from,this.to)?be.fail("Structure replace would overwrite content"):be.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new lt([this.from,this.to-this.from,this.slice.size])}invert(e){return new ve(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deletedAcross&&i.deletedAcross?null:new ve(t.pos,Math.max(t.pos,i.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ve)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?I.empty:new I(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ve(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?I.empty:new I(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ve(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ve(t.from,t.to,I.fromJSON(e,t.slice),!!t.structure)}}Fe.jsonID("replace",ve);class Se extends Fe{constructor(e,t,i,s,r,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=i,this.gapTo=s,this.slice=r,this.insert=o,this.structure=a}apply(e){if(this.structure&&(ma(e,this.from,this.gapFrom)||ma(e,this.gapTo,this.to)))return be.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return be.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,t.content);return i?be.fromReplace(e,this.from,this.to,i):be.fail("Content does not fit in gap")}getMap(){return new lt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Se(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),r=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return t.deletedAcross&&i.deletedAcross||s<t.pos||r>i.pos?null:new Se(t.pos,i.pos,s,r,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Se(t.from,t.to,t.gapFrom,t.gapTo,I.fromJSON(e,t.slice),t.insert,!!t.structure)}}Fe.jsonID("replaceAround",Se);function ma(n,e,t){let i=n.resolve(e),s=t-e,r=i.depth;for(;s>0&&r>0&&i.indexAfter(r)==i.node(r).childCount;)r--,s--;if(s>0){let o=i.node(r).maybeChild(i.indexAfter(r));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function pv(n,e,t,i){let s=[],r=[],o,a;n.doc.nodesBetween(e,t,(l,c,d)=>{if(!l.isInline)return;let u=l.marks;if(!i.isInSet(u)&&d.type.allowsMarkType(i.type)){let h=Math.max(c,e),f=Math.min(c+l.nodeSize,t),p=i.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(p)||(o&&o.to==h&&o.mark.eq(u[m])?o.to=f:s.push(o=new Ft(h,f,u[m])));a&&a.to==h?a.to=f:r.push(a=new pn(h,f,i))}}),s.forEach(l=>n.step(l)),r.forEach(l=>n.step(l))}function mv(n,e,t,i){let s=[],r=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;r++;let l=null;if(i instanceof Kr){let c=o.marks,d;for(;d=i.isInSet(c);)(l||(l=[])).push(d),c=d.removeFromSet(c)}else i?i.isInSet(o.marks)&&(l=[i]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let d=0;d<l.length;d++){let u=l[d],h;for(let f=0;f<s.length;f++){let p=s[f];p.step==r-1&&u.eq(s[f].style)&&(h=p)}h?(h.to=c,h.step=r):s.push({style:u,from:Math.max(a,e),to:c,step:r})}}}),s.forEach(o=>n.step(new Ft(o.from,o.to,o.style)))}function Za(n,e,t,i=t.contentMatch,s=!0){let r=n.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<r.childCount;l++){let c=r.child(l),d=a+c.nodeSize,u=i.matchType(c.type);if(!u)o.push(new ve(a,d,I.empty));else{i=u;for(let h=0;h<c.marks.length;h++)t.allowsMarkType(c.marks[h].type)||n.step(new Ft(a,d,c.marks[h]));if(s&&c.isText&&t.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new I(T.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new ve(a+h.index,a+h.index+h[0].length,p))}}a=d}if(!i.validEnd){let l=i.fillBefore(T.empty,!0);n.replace(a,a,new I(l,0,0))}for(let l=o.length-1;l>=0;l--)n.step(o[l])}function gv(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Bi(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let i=n.depth,s=0,r=0;;--i){let o=n.$from.node(i),a=n.$from.index(i)+s,l=n.$to.indexAfter(i)-r;if(i<n.depth&&o.canReplace(a,l,t))return i;if(i==0||o.type.spec.isolating||!gv(o,a,l))break;a&&(s=1),l<o.childCount&&(r=1)}return null}function bv(n,e,t){let{$from:i,$to:s,depth:r}=e,o=i.before(r+1),a=s.after(r+1),l=o,c=a,d=T.empty,u=0;for(let p=r,m=!1;p>t;p--)m||i.index(p)>0?(m=!0,d=T.from(i.node(p).copy(d)),u++):l--;let h=T.empty,f=0;for(let p=r,m=!1;p>t;p--)m||s.after(p+1)<s.end(p)?(m=!0,h=T.from(s.node(p).copy(h)),f++):c++;n.step(new Se(l,c,o,a,new I(d.append(h),u,f),d.size-u,!0))}function el(n,e,t=null,i=n){let s=yv(n,e),r=s&&xv(i,e);return r?s.map(Mc).concat({type:e,attrs:t}).concat(r.map(Mc)):null}function Mc(n){return{type:n,attrs:null}}function yv(n,e){let{parent:t,startIndex:i,endIndex:s}=n,r=t.contentMatchAt(i).findWrapping(e);if(!r)return null;let o=r.length?r[0]:e;return t.canReplaceWith(i,s,o)?r:null}function xv(n,e){let{parent:t,startIndex:i,endIndex:s}=n,r=t.child(i),o=e.contentMatch.findWrapping(r.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=i;l&&c<s;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:o}function _v(n,e,t){let i=T.empty;for(let o=t.length-1;o>=0;o--){if(i.size){let a=t[o].type.contentMatch.matchFragment(i);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=T.from(t[o].type.create(t[o].attrs,i))}let s=e.start,r=e.end;n.step(new Se(s,r,s,r,new I(i,0,0),t.length,!0))}function kv(n,e,t,i,s){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let r=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{let l=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(i,l)&&wv(n.doc,n.mapping.slice(r).map(a),i)){let c=null;if(i.schema.linebreakReplacement){let f=i.whitespace=="pre",p=!!i.contentMatch.matchType(i.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&Qf(n,o,a,r),Za(n,n.mapping.slice(r).map(a,1),i,void 0,c===null);let d=n.mapping.slice(r),u=d.map(a,1),h=d.map(a+o.nodeSize,1);return n.step(new Se(u,h,u+1,h-1,new I(T.from(i.create(l,null,o.marks)),0,0),1,!0)),c===!0&&Xf(n,o,a,r),!1}})}function Xf(n,e,t,i){e.forEach((s,r)=>{if(s.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(s.text);){let l=n.mapping.slice(i).map(t+1+r+o.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Qf(n,e,t,i){e.forEach((s,r)=>{if(s.type==s.type.schema.linebreakReplacement){let o=n.mapping.slice(i).map(t+1+r);n.replaceWith(o,o+1,e.type.schema.text(`
|
|
5
|
+
`))}})}function wv(n,e,t){let i=n.resolve(e),s=i.index();return i.parent.canReplaceWith(s,s+1,t)}function vv(n,e,t,i,s){let r=n.doc.nodeAt(e);if(!r)throw new RangeError("No node at given position");t||(t=r.type);let o=t.create(i,null,s||r.marks);if(r.isLeaf)return n.replaceWith(e,e+r.nodeSize,o);if(!t.validContent(r.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Se(e,e+r.nodeSize,e+1,e+r.nodeSize-1,new I(T.from(o),0,0),1,!0))}function rn(n,e,t=1,i){let s=n.resolve(e),r=s.depth-t,o=i&&i[i.length-1]||s.parent;if(r<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,d=t-2;c>r;c--,d--){let u=s.node(c),h=s.index(c);if(u.type.spec.isolating)return!1;let f=u.content.cutByIndex(h,u.childCount),p=i&&i[d+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=i&&i[d]||u;if(!u.canReplace(h+1,u.childCount)||!m.type.validContent(f))return!1}let a=s.indexAfter(r),l=i&&i[0];return s.node(r).canReplaceWith(a,a,l?l.type:s.node(r+1).type)}function Sv(n,e,t=1,i){let s=n.doc.resolve(e),r=T.empty,o=T.empty;for(let a=s.depth,l=s.depth-t,c=t-1;a>l;a--,c--){r=T.from(s.node(a).copy(r));let d=i&&i[c];o=T.from(d?d.type.create(d.attrs,o):s.node(a).copy(o))}n.step(new ve(e,e,new I(r.append(o),t,t),!0))}function Nn(n,e){let t=n.resolve(e),i=t.index();return Zf(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(i,i+1)}function Mv(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:i}=n.type.schema;for(let s=0;s<e.childCount;s++){let r=e.child(s),o=r.type==i?n.type.schema.nodes.text:r.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(r.marks))return!1}return t.validEnd}function Zf(n,e){return!!(n&&e&&!n.isLeaf&&Mv(n,e))}function Ur(n,e,t=-1){let i=n.resolve(e);for(let s=i.depth;;s--){let r,o,a=i.index(s);if(s==i.depth?(r=i.nodeBefore,o=i.nodeAfter):t>0?(r=i.node(s+1),a++,o=i.node(s).maybeChild(a)):(r=i.node(s).maybeChild(a-1),o=i.node(s+1)),r&&!r.isTextblock&&Zf(r,o)&&i.node(s).canReplace(a,a+1))return e;if(s==0)break;e=t<0?i.before(s):i.after(s)}}function Cv(n,e,t){let i=null,{linebreakReplacement:s}=n.doc.type.schema,r=n.doc.resolve(e-t),o=r.node().type;if(s&&o.inlineContent){let d=o.whitespace=="pre",u=!!o.contentMatch.matchType(s);d&&!u?i=!1:!d&&u&&(i=!0)}let a=n.steps.length;if(i===!1){let d=n.doc.resolve(e+t);Qf(n,d.node(),d.before(),a)}o.inlineContent&&Za(n,e+t-1,o,r.node().contentMatchAt(r.index()),i==null);let l=n.mapping.slice(a),c=l.map(e-t);if(n.step(new ve(c,l.map(e+t,-1),I.empty,!0)),i===!0){let d=n.doc.resolve(c);Xf(n,d.node(),d.before(),n.steps.length)}return n}function Ov(n,e,t){let i=n.resolve(e);if(i.parent.canReplaceWith(i.index(),i.index(),t))return e;if(i.parentOffset==0)for(let s=i.depth-1;s>=0;s--){let r=i.index(s);if(i.node(s).canReplaceWith(r,r,t))return i.before(s+1);if(r>0)return null}if(i.parentOffset==i.parent.content.size)for(let s=i.depth-1;s>=0;s--){let r=i.indexAfter(s);if(i.node(s).canReplaceWith(r,r,t))return i.after(s+1);if(r<i.node(s).childCount)return null}return null}function ep(n,e,t){let i=n.resolve(e);if(!t.content.size)return e;let s=t.content;for(let r=0;r<t.openStart;r++)s=s.firstChild.content;for(let r=1;r<=(t.openStart==0&&t.size?2:1);r++)for(let o=i.depth;o>=0;o--){let a=o==i.depth?0:i.pos<=(i.start(o+1)+i.end(o+1))/2?-1:1,l=i.index(o)+(a>0?1:0),c=i.node(o),d=!1;if(r==1)d=c.canReplace(l,l,s);else{let u=c.contentMatchAt(l).findWrapping(s.firstChild.type);d=u&&c.canReplaceWith(l,l,u[0])}if(d)return a==0?i.pos:a<0?i.before(o+1):i.after(o+1)}return null}function Jr(n,e,t=e,i=I.empty){if(e==t&&!i.size)return null;let s=n.resolve(e),r=n.resolve(t);return tp(s,r,i)?new ve(e,t,i):new Dv(s,r,i).fit()}function tp(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Dv{constructor(e,t,i){this.$from=e,this.$to=t,this.unplaced=i,this.frontier=[],this.placed=T.empty;for(let s=0;s<=e.depth;s++){let r=e.node(s);this.frontier.push({type:r.type,match:r.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=T.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,i=this.$from,s=this.close(e<0?this.$to:i.doc.resolve(e));if(!s)return null;let r=this.placed,o=i.depth,a=s.depth;for(;o&&a&&r.childCount==1;)r=r.firstChild.content,o--,a--;let l=new I(r,o,a);return e>-1?new Se(i.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||i.pos!=this.$to.pos?new ve(i.pos,s.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,i=0,s=this.unplaced.openEnd;i<e;i++){let r=t.firstChild;if(t.childCount>1&&(s=0),r.type.spec.isolating&&s<=i){e=i;break}t=r.content}for(let t=1;t<=2;t++)for(let i=t==1?e:this.unplaced.openStart;i>=0;i--){let s,r=null;i?(r=To(this.unplaced.content,i-1).firstChild,s=r.content):s=this.unplaced.content;let o=s.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],d,u=null;if(t==1&&(o?c.matchType(o.type)||(u=c.fillBefore(T.from(o),!1)):r&&l.compatibleContent(r.type)))return{sliceDepth:i,frontierDepth:a,parent:r,inject:u};if(t==2&&o&&(d=c.findWrapping(o.type)))return{sliceDepth:i,frontierDepth:a,parent:r,wrap:d};if(r&&c.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:i}=this.unplaced,s=To(e,t);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new I(e,t+1,Math.max(i,s.size+t>=e.size-i?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:i}=this.unplaced,s=To(e,t);if(s.childCount<=1&&t>0){let r=e.size-t<=t+s.size;this.unplaced=new I(ns(e,t-1,1),t-1,r?t-1:i)}else this.unplaced=new I(ns(e,t,1),t,i)}placeNodes({sliceDepth:e,frontierDepth:t,parent:i,inject:s,wrap:r}){for(;this.depth>t;)this.closeFrontierNode();if(r)for(let m=0;m<r.length;m++)this.openFrontierNode(r[m]);let o=this.unplaced,a=i?i.content:o.content,l=o.openStart-e,c=0,d=[],{match:u,type:h}=this.frontier[t];if(s){for(let m=0;m<s.childCount;m++)d.push(s.child(m));u=u.matchFragment(s)}let f=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let m=a.child(c),g=u.matchType(m.type);if(!g)break;c++,(c>1||l==0||m.content.size)&&(u=g,d.push(np(m.mark(h.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?f:-1)))}let p=c==a.childCount;p||(f=-1),this.placed=is(this.placed,t,T.from(d)),this.frontier[t].match=u,p&&f<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<f;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?I.empty:new I(ns(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new I(ns(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!No(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:i}=this.$to,s=this.$to.after(i);for(;i>1&&s==this.$to.end(--i);)++s;return s}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:i,type:s}=this.frontier[t],r=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=No(e,t,s,i,r);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],d=No(e,a,c,l,!0);if(!d||d.childCount)continue e}return{depth:t,fit:o,move:r?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=is(this.placed,t.depth,t.fit)),e=t.move;for(let i=t.depth+1;i<=e.depth;i++){let s=e.node(i),r=s.type.contentMatch.fillBefore(s.content,!0,e.index(i));this.openFrontierNode(s.type,s.attrs,r)}return e}openFrontierNode(e,t=null,i){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=is(this.placed,this.depth,T.from(e.create(t,i))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(T.empty,!0);t.childCount&&(this.placed=is(this.placed,this.frontier.length,t))}}function ns(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(ns(n.firstChild.content,e-1,t)))}function is(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(is(n.lastChild.content,e-1,t)))}function To(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function np(n,e,t){if(e<=0)return n;let i=n.content;return e>1&&(i=i.replaceChild(0,np(i.firstChild,e-1,i.childCount==1?t-1:0))),e>0&&(i=n.type.contentMatch.fillBefore(i).append(i),t<=0&&(i=i.append(n.type.contentMatch.matchFragment(i).fillBefore(T.empty,!0)))),n.copy(i)}function No(n,e,t,i,s){let r=n.node(e),o=s?n.indexAfter(e):n.index(e);if(o==r.childCount&&!t.compatibleContent(r.type))return null;let a=i.fillBefore(r.content,!0,o);return a&&!Tv(t,r.content,o)?a:null}function Tv(n,e,t){for(let i=t;i<e.childCount;i++)if(!n.allowsMarks(e.child(i).marks))return!0;return!1}function Nv(n){return n.spec.defining||n.spec.definingForContent}function Ev(n,e,t,i){if(!i.size)return n.deleteRange(e,t);let s=n.doc.resolve(e),r=n.doc.resolve(t);if(tp(s,r,i))return n.step(new ve(e,t,i));let o=sp(s,r);o[o.length-1]==0&&o.pop();let a=-(s.depth+1);o.unshift(a);for(let h=s.depth,f=s.pos-1;h>0;h--,f--){let p=s.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?a=h:s.before(h)==f&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],d=i.openStart;for(let h=i.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==i.openStart)break;h=p.content}for(let h=d-1;h>=0;h--){let f=c[h],p=Nv(f.type);if(p&&!f.sameMarkup(s.node(Math.abs(a)-1)))d=h;else if(p||!f.type.isTextblock)break}for(let h=i.openStart;h>=0;h--){let f=(h+d+1)%(i.openStart+1),p=c[f];if(p)for(let m=0;m<o.length;m++){let g=o[(m+l)%o.length],y=!0;g<0&&(y=!1,g=-g);let S=s.node(g-1),_=s.index(g-1);if(S.canReplaceWith(_,_,p.type,p.marks))return n.replace(s.before(g),y?r.after(g):t,new I(ip(i.content,0,i.openStart,f),f,i.openEnd))}}let u=n.steps.length;for(let h=o.length-1;h>=0&&(n.replace(e,t,i),!(n.steps.length>u));h--){let f=o[h];f<0||(e=s.before(f),t=r.after(f))}}function ip(n,e,t,i,s){if(e<t){let r=n.firstChild;n=n.replaceChild(0,r.copy(ip(r.content,e+1,t,i,r)))}if(e>i){let r=s.contentMatchAt(0),o=r.fillBefore(n).append(n);n=o.append(r.matchFragment(o).fillBefore(T.empty,!0))}return n}function Av(n,e,t,i){if(!i.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let s=Ov(n.doc,e,i.type);s!=null&&(e=t=s)}n.replaceRange(e,t,new I(T.from(i),0,0))}function Pv(n,e,t){let i=n.doc.resolve(e),s=n.doc.resolve(t),r=sp(i,s);for(let o=0;o<r.length;o++){let a=r[o],l=o==r.length-1;if(l&&a==0||i.node(a).type.contentMatch.validEnd)return n.delete(i.start(a),s.end(a));if(a>0&&(l||i.node(a-1).canReplace(i.index(a-1),s.indexAfter(a-1))))return n.delete(i.before(a),s.after(a))}for(let o=1;o<=i.depth&&o<=s.depth;o++)if(e-i.start(o)==i.depth-o&&t>i.end(o)&&s.end(o)-t!=s.depth-o&&i.start(o-1)==s.start(o-1)&&i.node(o-1).canReplace(i.index(o-1),s.index(o-1)))return n.delete(i.before(o),t);n.delete(e,t)}function sp(n,e){let t=[],i=Math.min(n.depth,e.depth);for(let s=i;s>=0;s--){let r=n.start(s);if(r<n.pos-(n.depth-s)||e.end(s)>e.pos+(e.depth-s)||n.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(r==e.start(s)||s==n.depth&&s==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==r-1)&&t.push(s)}return t}class vi extends Fe{constructor(e,t,i){super(),this.pos=e,this.attr=t,this.value=i}apply(e){let t=e.nodeAt(this.pos);if(!t)return be.fail("No node at attribute step's position");let i=Object.create(null);for(let r in t.attrs)i[r]=t.attrs[r];i[this.attr]=this.value;let s=t.type.create(i,null,t.marks);return be.fromReplace(e,this.pos,this.pos+1,new I(T.from(s),0,t.isLeaf?0:1))}getMap(){return lt.empty}invert(e){return new vi(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new vi(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new vi(t.pos,t.attr,t.value)}}Fe.jsonID("attr",vi);class vs extends Fe{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let s in e.attrs)t[s]=e.attrs[s];t[this.attr]=this.value;let i=e.type.create(t,e.content,e.marks);return be.ok(i)}getMap(){return lt.empty}invert(e){return new vs(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new vs(t.attr,t.value)}}Fe.jsonID("docAttr",vs);let Di=class extends Error{};Di=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Di.prototype=Object.create(Error.prototype);Di.prototype.constructor=Di;Di.prototype.name="TransformError";class Iv{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ws}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Di(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let i=0;i<this.mapping.maps.length;i++){let s=this.mapping.maps[i];i&&(e=s.map(e,1),t=s.map(t,-1)),s.forEach((r,o,a,l)=>{e=Math.min(e,a),t=Math.max(t,l)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,i=I.empty){let s=Jr(this.doc,e,t,i);return s&&this.step(s),this}replaceWith(e,t,i){return this.replace(e,t,new I(T.from(i),0,0))}delete(e,t){return this.replace(e,t,I.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,i){return Ev(this,e,t,i),this}replaceRangeWith(e,t,i){return Av(this,e,t,i),this}deleteRange(e,t){return Pv(this,e,t),this}lift(e,t){return bv(this,e,t),this}join(e,t=1){return Cv(this,e,t),this}wrap(e,t){return _v(this,e,t),this}setBlockType(e,t=e,i,s=null){return kv(this,e,t,i,s),this}setNodeMarkup(e,t,i=null,s){return vv(this,e,t,i,s),this}setNodeAttribute(e,t,i){return this.step(new vi(e,t,i)),this}setDocAttribute(e,t){return this.step(new vs(e,t)),this}addNodeMark(e,t){return this.step(new mn(e,t)),this}removeNodeMark(e,t){let i=this.doc.nodeAt(e);if(!i)throw new RangeError("No node at position "+e);if(t instanceof le)t.isInSet(i.marks)&&this.step(new ii(e,t));else{let s=i.marks,r,o=[];for(;r=t.isInSet(s);)o.push(new ii(e,r)),s=r.removeFromSet(s);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,i){return Sv(this,e,t,i),this}addMark(e,t,i){return pv(this,e,t,i),this}removeMark(e,t,i){return mv(this,e,t,i),this}clearIncompatible(e,t,i){return Za(this,e,t,i),this}}const Eo=Object.create(null);class q{constructor(e,t,i){this.$anchor=e,this.$head=t,this.ranges=i||[new Rv(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=I.empty){let i=t.content.lastChild,s=null;for(let a=0;a<t.openEnd;a++)s=i,i=i.lastChild;let r=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],d=e.mapping.slice(r);e.replaceRange(d.map(l.pos),d.map(c.pos),a?I.empty:t),a==0&&Dc(e,r,(i?i.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,t){let i=e.steps.length,s=this.ranges;for(let r=0;r<s.length;r++){let{$from:o,$to:a}=s[r],l=e.mapping.slice(i),c=l.map(o.pos),d=l.map(a.pos);r?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),Dc(e,i,t.isInline?-1:1))}}static findFrom(e,t,i=!1){let s=e.parent.inlineContent?new $(e):xi(e.node(0),e.parent,e.pos,e.index(),t,i);if(s)return s;for(let r=e.depth-1;r>=0;r--){let o=t<0?xi(e.node(0),e.node(r),e.before(r+1),e.index(r),t,i):xi(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,i);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new ct(e.node(0))}static atStart(e){return xi(e,e,0,0,1)||new ct(e)}static atEnd(e){return xi(e,e,e.content.size,e.childCount,-1)||new ct(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let i=Eo[t.type];if(!i)throw new RangeError(`No selection type ${t.type} defined`);return i.fromJSON(e,t)}static jsonID(e,t){if(e in Eo)throw new RangeError("Duplicate use of selection JSON ID "+e);return Eo[e]=t,t.prototype.jsonID=e,t}getBookmark(){return $.between(this.$anchor,this.$head).getBookmark()}}q.prototype.visible=!0;class Rv{constructor(e,t){this.$from=e,this.$to=t}}let Cc=!1;function Oc(n){!Cc&&!n.parent.inlineContent&&(Cc=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class $ extends q{constructor(e,t=e){Oc(e),Oc(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let i=e.resolve(t.map(this.head));if(!i.parent.inlineContent)return q.near(i);let s=e.resolve(t.map(this.anchor));return new $(s.parent.inlineContent?s:i,i)}replace(e,t=I.empty){if(super.replace(e,t),t==I.empty){let i=this.$from.marksAcross(this.$to);i&&e.ensureMarks(i)}}eq(e){return e instanceof $&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Gr(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new $(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,i=t){let s=e.resolve(t);return new this(s,i==t?s:e.resolve(i))}static between(e,t,i){let s=e.pos-t.pos;if((!i||s)&&(i=s>=0?1:-1),!t.parent.inlineContent){let r=q.findFrom(t,i,!0)||q.findFrom(t,-i,!0);if(r)t=r.$head;else return q.near(t,i)}return e.parent.inlineContent||(s==0?e=t:(e=(q.findFrom(e,-i,!0)||q.findFrom(e,i,!0)).$anchor,e.pos<t.pos!=s<0&&(e=t))),new $(e,t)}}q.jsonID("text",$);class Gr{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Gr(e.map(this.anchor),e.map(this.head))}resolve(e){return $.between(e.resolve(this.anchor),e.resolve(this.head))}}class L extends q{constructor(e){let t=e.nodeAfter,i=e.node(0).resolve(e.pos+t.nodeSize);super(e,i),this.node=t}map(e,t){let{deleted:i,pos:s}=t.mapResult(this.anchor),r=e.resolve(s);return i?q.near(r):new L(r)}content(){return new I(T.from(this.node),0,0)}eq(e){return e instanceof L&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new tl(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new L(e.resolve(t.anchor))}static create(e,t){return new L(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}L.prototype.visible=!1;q.jsonID("node",L);class tl{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:i}=e.mapResult(this.anchor);return t?new Gr(i,i):new tl(i)}resolve(e){let t=e.resolve(this.anchor),i=t.nodeAfter;return i&&L.isSelectable(i)?new L(t):q.near(t)}}class ct extends q{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=I.empty){if(t==I.empty){e.delete(0,e.doc.content.size);let i=q.atStart(e.doc);i.eq(e.selection)||e.setSelection(i)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new ct(e)}map(e){return new ct(e)}eq(e){return e instanceof ct}getBookmark(){return zv}}q.jsonID("all",ct);const zv={map(){return this},resolve(n){return new ct(n)}};function xi(n,e,t,i,s,r=!1){if(e.inlineContent)return $.create(n,t);for(let o=i-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let a=e.child(o);if(a.isAtom){if(!r&&L.isSelectable(a))return L.create(n,t-(s<0?a.nodeSize:0))}else{let l=xi(n,a,t+s,s<0?a.childCount:0,s,r);if(l)return l}t+=a.nodeSize*s}return null}function Dc(n,e,t){let i=n.steps.length-1;if(i<e)return;let s=n.steps[i];if(!(s instanceof ve||s instanceof Se))return;let r=n.mapping.maps[i],o;r.forEach((a,l,c,d)=>{o==null&&(o=d)}),n.setSelection(q.near(n.doc.resolve(o),t))}const Tc=1,Us=2,Nc=4;class jv extends Iv{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Tc)&~Us,this.storedMarks=null,this}get selectionSet(){return(this.updated&Tc)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Us,this}ensureMarks(e){return le.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Us)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Us,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let i=this.selection;return t&&(e=e.mark(this.storedMarks||(i.empty?i.$from.marks():i.$from.marksAcross(i.$to)||le.none))),i.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,i){let s=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(i==null&&(i=t),!e)return this.deleteRange(t,i);let r=this.storedMarks;if(!r){let o=this.doc.resolve(t);r=i==t?o.marks():o.marksAcross(this.doc.resolve(i))}return this.replaceRangeWith(t,i,s.text(e,r)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(q.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Nc,this}get scrolledIntoView(){return(this.updated&Nc)>0}}function Ec(n,e){return!e||!n?n:n.bind(e)}class ss{constructor(e,t,i){this.name=e,this.init=Ec(t.init,i),this.apply=Ec(t.apply,i)}}const Bv=[new ss("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new ss("selection",{init(n,e){return n.selection||q.atStart(e.doc)},apply(n){return n.selection}}),new ss("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,i){return i.selection.$cursor?n.storedMarks:null}}),new ss("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Ao{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Bv.slice(),t&&t.forEach(i=>{if(this.pluginsByKey[i.key])throw new RangeError("Adding different instances of a keyed plugin ("+i.key+")");this.plugins.push(i),this.pluginsByKey[i.key]=i,i.spec.state&&this.fields.push(new ss(i.key,i.spec.state,i))})}}class ki{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let i=0;i<this.config.plugins.length;i++)if(i!=t){let s=this.config.plugins[i];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],i=this.applyInner(e),s=null;for(;;){let r=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=s?s[o].n:0,c=s?s[o].state:this,d=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,c,i);if(d&&i.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!s){s=[];for(let u=0;u<this.config.plugins.length;u++)s.push(u<o?{state:i,n:t.length}:{state:this,n:0})}t.push(d),i=i.applyInner(d),r=!0}s&&(s[o]={state:i,n:t.length})}}if(!r)return{state:i,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new ki(this.config),i=this.config.fields;for(let s=0;s<i.length;s++){let r=i[s];t[r.name]=r.apply(e,this[r.name],this,t)}return t}get tr(){return new jv(this)}static create(e){let t=new Ao(e.doc?e.doc.type.schema:e.schema,e.plugins),i=new ki(t);for(let s=0;s<t.fields.length;s++)i[t.fields[s].name]=t.fields[s].init(e,i);return i}reconfigure(e){let t=new Ao(this.schema,e.plugins),i=t.fields,s=new ki(t);for(let r=0;r<i.length;r++){let o=i[r].name;s[o]=this.hasOwnProperty(o)?this[o]:i[r].init(e,s)}return s}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(i=>i.toJSON())),e&&typeof e=="object")for(let i in e){if(i=="doc"||i=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[i],r=s.spec.state;r&&r.toJSON&&(t[i]=r.toJSON.call(s,this[s.key]))}return t}static fromJSON(e,t,i){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new Ao(e.schema,e.plugins),r=new ki(s);return s.fields.forEach(o=>{if(o.name=="doc")r.doc=kn.fromJSON(e.schema,t.doc);else if(o.name=="selection")r.selection=q.fromJSON(r.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(r.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(i)for(let a in i){let l=i[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){r[o.name]=c.fromJSON.call(l,e,t[a],r);return}}r[o.name]=o.init(e,r)}}),r}}function rp(n,e,t){for(let i in n){let s=n[i];s instanceof Function?s=s.bind(e):i=="handleDOMEvents"&&(s=rp(s,e,{})),t[i]=s}return t}class Ze{constructor(e){this.spec=e,this.props={},e.props&&rp(e.props,this,this.props),this.key=e.key?e.key.key:op("plugin")}getState(e){return e[this.key]}}const Po=Object.create(null);function op(n){return n in Po?n+"$"+ ++Po[n]:(Po[n]=0,n+"$")}class Vt{constructor(e="key"){this.key=op(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ne=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Ti=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let ga=null;const Xt=function(n,e,t){let i=ga||(ga=document.createRange());return i.setEnd(n,t??n.nodeValue.length),i.setStart(n,e||0),i},Lv=function(){ga=null},si=function(n,e,t,i){return t&&(Ac(n,e,t,i,-1)||Ac(n,e,t,i,1))},Fv=/^(img|br|input|textarea|hr)$/i;function Ac(n,e,t,i,s){for(var r;;){if(n==t&&e==i)return!0;if(e==(s<0?0:gt(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Bs(n)||Fv.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ne(n)+(s<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((r=o.pmViewDesc)===null||r===void 0)&&r.ignoreForSelection)e+=s;else return!1;else n=o,e=s<0?gt(n):0}else return!1}}function gt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Wv(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=gt(n)}else if(n.parentNode&&!Bs(n))e=Ne(n),n=n.parentNode;else return null}}function $v(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Bs(n))e=Ne(n)+1,n=n.parentNode;else return null}}function Hv(n,e,t){for(let i=e==0,s=e==gt(n);i||s;){if(n==t)return!0;let r=Ne(n);if(n=n.parentNode,!n)return!1;i=i&&r==0,s=s&&r==gt(n)}}function Bs(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Xr=function(n){return n.focusNode&&si(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function $n(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Vv(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Yv(n,e,t){if(n.caretPositionFromPoint)try{let i=n.caretPositionFromPoint(e,t);if(i)return{node:i.offsetNode,offset:Math.min(gt(i.offsetNode),i.offset)}}catch{}if(n.caretRangeFromPoint){let i=n.caretRangeFromPoint(e,t);if(i)return{node:i.startContainer,offset:Math.min(gt(i.startContainer),i.startOffset)}}}const Wt=typeof navigator<"u"?navigator:null,Pc=typeof document<"u"?document:null,En=Wt&&Wt.userAgent||"",ba=/Edge\/(\d+)/.exec(En),ap=/MSIE \d/.exec(En),ya=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(En),Xe=!!(ap||ya||ba),vn=ap?document.documentMode:ya?+ya[1]:ba?+ba[1]:0,xt=!Xe&&/gecko\/(\d+)/i.test(En);xt&&+(/Firefox\/(\d+)/.exec(En)||[0,0])[1];const xa=!Xe&&/Chrome\/(\d+)/.exec(En),Ae=!!xa,lp=xa?+xa[1]:0,Be=!Xe&&!!Wt&&/Apple Computer/.test(Wt.vendor),Ni=Be&&(/Mobile\/\w+/.test(En)||!!Wt&&Wt.maxTouchPoints>2),pt=Ni||(Wt?/Mac/.test(Wt.platform):!1),cp=Wt?/Win/.test(Wt.platform):!1,nn=/Android \d/.test(En),Ls=!!Pc&&"webkitFontSmoothing"in Pc.documentElement.style,qv=Ls?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Kv(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function qt(n,e){return typeof n=="number"?n:n[e]}function Uv(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,i=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*i}}function Ic(n,e,t){let i=n.someProp("scrollThreshold")||0,s=n.someProp("scrollMargin")||5,r=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(o.nodeType!=1){o=Ti(o);continue}let a=o,l=a==r.body,c=l?Kv(r):Uv(a),d=0,u=0;if(e.top<c.top+qt(i,"top")?u=-(c.top-e.top+qt(s,"top")):e.bottom>c.bottom-qt(i,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+qt(s,"top")-c.top:e.bottom-c.bottom+qt(s,"bottom")),e.left<c.left+qt(i,"left")?d=-(c.left-e.left+qt(s,"left")):e.right>c.right-qt(i,"right")&&(d=e.right-c.right+qt(s,"right")),d||u)if(l)r.defaultView.scrollBy(d,u);else{let f=a.scrollLeft,p=a.scrollTop;u&&(a.scrollTop+=u),d&&(a.scrollLeft+=d);let m=a.scrollLeft-f,g=a.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let h=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:Ti(o)}}function Jv(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),i,s;for(let r=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=n.root.elementFromPoint(r,o);if(!a||a==n.dom||!n.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){i=a,s=l.top;break}}return{refDOM:i,refTop:s,stack:dp(n.dom)}}function dp(n){let e=[],t=n.ownerDocument;for(let i=n;i&&(e.push({dom:i,top:i.scrollTop,left:i.scrollLeft}),n!=t);i=Ti(i));return e}function Gv({refDOM:n,refTop:e,stack:t}){let i=n?n.getBoundingClientRect().top:0;up(t,i==0?0:i-e)}function up(n,e){for(let t=0;t<n.length;t++){let{dom:i,top:s,left:r}=n[t];i.scrollTop!=s+e&&(i.scrollTop=s+e),i.scrollLeft!=r&&(i.scrollLeft=r)}}let pi=null;function Xv(n){if(n.setActive)return n.setActive();if(pi)return n.focus(pi);let e=dp(n);n.focus(pi==null?{get preventScroll(){return pi={preventScroll:!0},!0}}:void 0),pi||(pi=!1,up(e,0))}function hp(n,e){let t,i=2e8,s,r=0,o=e.top,a=e.top,l,c;for(let d=n.firstChild,u=0;d;d=d.nextSibling,u++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=Xt(d).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<i){t=d,i=m,s=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,d.nodeType==1&&m&&(r=u+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=d,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(r=u+1)}}return!t&&l&&(t=l,s=c,i=0),t&&t.nodeType==3?Qv(t,s):!t||i&&t.nodeType==1?{node:n,offset:r}:hp(t,s)}function Qv(n,e){let t=n.nodeValue.length,i=document.createRange(),s;for(let r=0;r<t;r++){i.setEnd(n,r+1),i.setStart(n,r);let o=dn(i,1);if(o.top!=o.bottom&&nl(e,o)){s={node:n,offset:r+(e.left>=(o.left+o.right)/2?1:0)};break}}return i.detach(),s||{node:n,offset:0}}function nl(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Zv(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function eS(n,e,t){let{node:i,offset:s}=hp(e,t),r=-1;if(i.nodeType==1&&!i.firstChild){let o=i.getBoundingClientRect();r=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(i,s,r)}function tS(n,e,t,i){let s=-1;for(let r=e,o=!1;r!=n.dom;){let a=n.docView.nearestDesc(r,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>i.left||l.top>i.top?s=a.posBefore:(!o&&l.right<i.left||l.bottom<i.top)&&(s=a.posAfter),o=!0),!a.contentDOM&&s<0&&!a.node.isText))return(a.node.isBlock?i.top<(l.top+l.bottom)/2:i.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;r=a.dom.parentNode}return s>-1?s:n.docView.posFromDOM(e,t,-1)}function fp(n,e,t){let i=n.childNodes.length;if(i&&t.top<t.bottom)for(let s=Math.max(0,Math.min(i-1,Math.floor(i*(e.top-t.top)/(t.bottom-t.top))-2)),r=s;;){let o=n.childNodes[r];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(nl(e,c))return fp(o,e,c)}}if((r=(r+1)%i)==s)break}return n}function nS(n,e){let t=n.dom.ownerDocument,i,s=0,r=Yv(t,e.left,e.top);r&&({node:i,offset:s}=r);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=n.dom.getBoundingClientRect();if(!nl(e,c)||(o=fp(n.dom,e,c),!o))return null}if(Be)for(let c=o;i&&c;c=Ti(c))c.draggable&&(i=void 0);if(o=Zv(o,e),i){if(xt&&i.nodeType==1&&(s=Math.min(s,i.childNodes.length),s<i.childNodes.length)){let d=i.childNodes[s],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&s++}let c;Ls&&s&&i.nodeType==1&&(c=i.childNodes[s-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&s--,i==n.dom&&s==i.childNodes.length-1&&i.lastChild.nodeType==1&&e.top>i.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(s==0||i.nodeType!=1||i.childNodes[s-1].nodeName!="BR")&&(a=tS(n,i,s,e))}a==null&&(a=eS(n,o,e));let l=n.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Rc(n){return n.top<n.bottom||n.left<n.right}function dn(n,e){let t=n.getClientRects();if(t.length){let i=t[e<0?0:t.length-1];if(Rc(i))return i}return Array.prototype.find.call(t,Rc)||n.getBoundingClientRect()}const iS=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function pp(n,e,t){let{node:i,offset:s,atom:r}=n.docView.domFromPos(e,t<0?-1:1),o=Ls||xt;if(i.nodeType==3)if(o&&(iS.test(i.nodeValue)||(t<0?!s:s==i.nodeValue.length))){let l=dn(Xt(i,s,s),t);if(xt&&s&&/\s/.test(i.nodeValue[s-1])&&s<i.nodeValue.length){let c=dn(Xt(i,s-1,s-1),-1);if(c.top==l.top){let d=dn(Xt(i,s,s+1),-1);if(d.top!=l.top)return Ki(d,d.left<c.left)}}return l}else{let l=s,c=s,d=t<0?1:-1;return t<0&&!s?(c++,d=-1):t>=0&&s==i.nodeValue.length?(l--,d=1):t<0?l--:c++,Ki(dn(Xt(i,l,c),d),d<0)}if(!n.state.doc.resolve(e-(r||0)).parent.inlineContent){if(r==null&&s&&(t<0||s==gt(i))){let l=i.childNodes[s-1];if(l.nodeType==1)return Io(l.getBoundingClientRect(),!1)}if(r==null&&s<gt(i)){let l=i.childNodes[s];if(l.nodeType==1)return Io(l.getBoundingClientRect(),!0)}return Io(i.getBoundingClientRect(),t>=0)}if(r==null&&s&&(t<0||s==gt(i))){let l=i.childNodes[s-1],c=l.nodeType==3?Xt(l,gt(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Ki(dn(c,1),!1)}if(r==null&&s<gt(i)){let l=i.childNodes[s];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Xt(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return Ki(dn(c,-1),!0)}return Ki(dn(i.nodeType==3?Xt(i):i,-t),t>=0)}function Ki(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function Io(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function mp(n,e,t){let i=n.state,s=n.root.activeElement;i!=e&&n.updateState(e),s!=n.dom&&n.focus();try{return t()}finally{i!=e&&n.updateState(i),s!=n.dom&&s&&s.focus()}}function sS(n,e,t){let i=e.selection,s=t=="up"?i.$from:i.$to;return mp(n,e,()=>{let{node:r}=n.docView.domFromPos(s.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(r,!0);if(!a)break;if(a.node.isBlock){r=a.contentDOM||a.dom;break}r=a.dom.parentNode}let o=pp(n,s.pos,1);for(let a=r.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Xt(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let d=l[c];if(d.bottom>d.top+1&&(t=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const rS=/[\u0590-\u08ac]/;function oS(n,e,t){let{$head:i}=e.selection;if(!i.parent.isTextblock)return!1;let s=i.parentOffset,r=!s,o=s==i.parent.content.size,a=n.domSelection();return a?!rS.test(i.parent.textContent)||!a.modify?t=="left"||t=="backward"?r:o:mp(n,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:u}=n.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",t,"character");let f=i.depth?n.docView.domAfterPos(i.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!f.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==m;try{a.collapse(d,u),l&&(l!=d||c!=u)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),g}):i.pos==i.start()||i.pos==i.end()}let zc=null,jc=null,Bc=!1;function aS(n,e,t){return zc==e&&jc==t?Bc:(zc=e,jc=t,Bc=t=="up"||t=="down"?sS(n,e,t):oS(n,e,t))}const _t=0,Lc=1,Yn=2,$t=3;class Fs{constructor(e,t,i,s){this.parent=e,this.children=t,this.dom=i,this.contentDOM=s,this.dirty=_t,i.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,i){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,i=this.posAtStart;;t++){let s=this.children[t];if(s==e)return i;i+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,i){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(i<0){let r,o;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&!((o=r.pmViewDesc)&&o.parent==this);)r=r.previousSibling;return r?this.posBeforeChild(o)+o.size:this.posAtStart}else{let r,o;if(e==this.contentDOM)r=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.nextSibling}for(;r&&!((o=r.pmViewDesc)&&o.parent==this);)r=r.nextSibling;return r?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=t>Ne(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let r=e;;r=r.parentNode){if(r==this.dom){s=!1;break}if(r.previousSibling)break}if(s==null&&t==e.childNodes.length)for(let r=e;;r=r.parentNode){if(r==this.dom){s=!0;break}if(r.nextSibling)break}}return s??i>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let i=!0,s=e;s;s=s.parentNode){let r=this.getDesc(s),o;if(r&&(!t||r.node))if(i&&(o=r.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))i=!1;else return r}}getDesc(e){let t=e.pmViewDesc;for(let i=t;i;i=i.parent)if(i==this)return t}posFromDOM(e,t,i){for(let s=e;s;s=s.parentNode){let r=this.getDesc(s);if(r)return r.localPosFromDOM(e,t,i)}return-1}descAt(e){for(let t=0,i=0;t<this.children.length;t++){let s=this.children[t],r=i+s.size;if(i==e&&r!=i){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let a=s.children[o];if(a.size){s=a;break}}return s}if(e<r)return s.descAt(e-i-s.border);i=r}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let i=0,s=0;for(let r=0;i<this.children.length;i++){let o=this.children[i],a=r+o.size;if(a>e||o instanceof bp){s=e-r;break}r=a}if(s)return this.children[i].domFromPos(s-this.children[i].border,t);for(let r;i&&!(r=this.children[i-1]).size&&r instanceof gp&&r.side>=0;i--);if(t<=0){let r,o=!0;for(;r=i?this.children[i-1]:null,!(!r||r.dom.parentNode==this.contentDOM);i--,o=!1);return r&&t&&o&&!r.border&&!r.domAtom?r.domFromPos(r.size,t):{node:this.contentDOM,offset:r?Ne(r.dom)+1:0}}else{let r,o=!0;for(;r=i<this.children.length?this.children[i]:null,!(!r||r.dom.parentNode==this.contentDOM);i++,o=!1);return r&&o&&!r.border&&!r.domAtom?r.domFromPos(0,t):{node:this.contentDOM,offset:r?Ne(r.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,i=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,r=-1;for(let o=i,a=0;;a++){let l=this.children[a],c=o+l.size;if(s==-1&&e<=c){let d=o+l.border;if(e>=d&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,d);e=o;for(let u=a;u>0;u--){let h=this.children[u-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){s=Ne(h.dom)+1;break}e-=h.size}s==-1&&(s=0)}if(s>-1&&(c>t||a==this.children.length-1)){t=c;for(let d=a+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){r=Ne(u.dom);break}t+=u.size}r==-1&&(r=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:s,toOffset:r}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:i}=this.domFromPos(e,0);if(t.nodeType!=1||i==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[i]}setSelection(e,t,i,s=!1){let r=Math.min(e,t),o=Math.max(e,t);for(let f=0,p=0;f<this.children.length;f++){let m=this.children[f],g=p+m.size;if(r>p&&o<g)return m.setSelection(e-p-m.border,t-p-m.border,i,s);p=g}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),c=i.root.getSelection(),d=i.domSelectionRange(),u=!1;if((xt||Be)&&e==t){let{node:f,offset:p}=a;if(f.nodeType==3){if(u=!!(p&&f.nodeValue[p-1]==`
|
|
6
|
+
`),u&&p==f.nodeValue.length)for(let m=f,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:Ne(g)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=f.childNodes[p-1];u=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(xt&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let f=d.focusNode.childNodes[d.focusOffset];f&&f.contentEditable=="false"&&(s=!0)}if(!(s||u&&Be)&&si(a.node,a.offset,d.anchorNode,d.anchorOffset)&&si(l.node,l.offset,d.focusNode,d.focusOffset))return;let h=!1;if((c.extend||e==t)&&!(u&&xt)){c.collapse(a.node,a.offset);try{e!=t&&c.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>t){let p=a;a=l,l=p}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let i=0,s=0;s<this.children.length;s++){let r=this.children[s],o=i+r.size;if(i==o?e<=o&&t>=i:e<o&&t>i){let a=i+r.border,l=o-r.border;if(e>=a&&t<=l){this.dirty=e==i||t==o?Yn:Lc,e==a&&t==l&&(r.contentLost||r.dom.parentNode!=this.contentDOM)?r.dirty=$t:r.markDirty(e-a,t-a);return}else r.dirty=r.dom==r.contentDOM&&r.dom.parentNode==this.contentDOM&&!r.children.length?Yn:$t}i=o}this.dirty=Yn}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let i=e==1?Yn:Lc;t.dirty<i&&(t.dirty=i)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class gp extends Fs{constructor(e,t,i,s){let r,o=t.type.toDOM;if(typeof o=="function"&&(o=o(i,()=>{if(!r)return s;if(r.parent)return r.parent.posBeforeChild(r)})),!t.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,r=this}matchesWidget(e){return this.dirty==_t&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class lS extends Fs{constructor(e,t,i,s){super(e,[],t,null),this.textDOM=i,this.text=s}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class ri extends Fs{constructor(e,t,i,s,r){super(e,[],i,s),this.mark=t,this.spec=r}static create(e,t,i,s){let r=s.nodeViews[t.type.name],o=r&&r(t,s,i);return(!o||!o.dom)&&(o=ai.renderSpec(document,t.type.spec.toDOM(t,i),null,t.attrs)),new ri(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&$t||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=$t&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=_t){let i=this.parent;for(;!i.node;)i=i.parent;i.dirty<this.dirty&&(i.dirty=this.dirty),this.dirty=_t}}slice(e,t,i){let s=ri.create(this.parent,this.mark,!0,i),r=this.children,o=this.size;t<o&&(r=ka(r,t,o,i)),e>0&&(r=ka(r,0,e,i));for(let a=0;a<r.length;a++)r[a].parent=s;return s.children=r,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Sn extends Fs{constructor(e,t,i,s,r,o,a,l,c){super(e,[],r,o),this.node=t,this.outerDeco=i,this.innerDeco=s,this.nodeDOM=a}static create(e,t,i,s,r,o){let a=r.nodeViews[t.type.name],l,c=a&&a(t,r,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},i,s),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=ai.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let h=d;return d=_p(d,i,t),c?l=new cS(e,t,i,s,d,u||null,h,c,r,o+1):t.isText?new Qr(e,t,i,s,d,h,r):new Sn(e,t,i,s,d,u||null,h,r,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let i=this.children[t];if(this.dom.contains(i.dom.parentNode)){e.contentElement=i.dom.parentNode;break}}e.contentElement||(e.getContent=()=>T.empty)}return e}matchesNode(e,t,i){return this.dirty==_t&&e.eq(this.node)&&Mr(t,this.outerDeco)&&i.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let i=this.node.inlineContent,s=t,r=e.composing?this.localCompositionInfo(e,t):null,o=r&&r.pos>-1?r:null,a=r&&r.pos<0,l=new uS(this,o&&o.node,e);pS(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?l.syncToMarks(c.spec.marks,i,e,d):c.type.side>=0&&!u&&l.syncToMarks(d==this.node.childCount?le.none:this.node.child(d).marks,i,e,d),l.placeWidget(c,e,s)},(c,d,u,h)=>{l.syncToMarks(c.marks,i,e,h);let f;l.findNodeMatch(c,d,u,h)||a&&e.state.selection.from>s&&e.state.selection.to<s+c.nodeSize&&(f=l.findIndexWithChild(r.node))>-1&&l.updateNodeAt(c,d,u,f,e)||l.updateNextNode(c,d,u,e,h,s)||l.addNode(c,d,u,e,s),s+=c.nodeSize}),l.syncToMarks([],i,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Yn)&&(o&&this.protectLocalComposition(e,o),yp(this.contentDOM,this.children,e),Ni&&mS(this.dom))}localCompositionInfo(e,t){let{from:i,to:s}=e.state.selection;if(!(e.state.selection instanceof $)||i<t||s>t+this.node.content.size)return null;let r=e.input.compositionNode;if(!r||!this.dom.contains(r.parentNode))return null;if(this.node.inlineContent){let o=r.nodeValue,a=gS(this.node.content,o,i-t,s-t);return a<0?null:{node:r,pos:a,text:o}}else return{node:r,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:i,text:s}){if(this.getDesc(t))return;let r=t;for(;r.parentNode!=this.contentDOM;r=r.parentNode){for(;r.previousSibling;)r.parentNode.removeChild(r.previousSibling);for(;r.nextSibling;)r.parentNode.removeChild(r.nextSibling);r.pmViewDesc&&(r.pmViewDesc=void 0)}let o=new lS(this,r,t,s);e.input.compositionNodes.push(o),this.children=ka(this.children,i,i+s.length,e,o)}update(e,t,i,s){return this.dirty==$t||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,i,s),!0)}updateInner(e,t,i,s){this.updateOuterDeco(t),this.node=e,this.innerDeco=i,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=_t}updateOuterDeco(e){if(Mr(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,i=this.dom;this.dom=xp(this.dom,this.nodeDOM,_a(this.outerDeco,this.node,t),_a(e,this.node,t)),this.dom!=i&&(i.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Fc(n,e,t,i,s){_p(i,e,n);let r=new Sn(void 0,n,e,t,i,i,i,s,0);return r.contentDOM&&r.updateChildren(s,0),r}class Qr extends Sn{constructor(e,t,i,s,r,o,a){super(e,t,i,s,r,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,i,s){return this.dirty==$t||this.dirty!=_t&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=_t||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=_t,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,i){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,i)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,i){let s=this.node.cut(e,t),r=document.createTextNode(s.text);return new Qr(this.parent,s,this.outerDeco,this.innerDeco,r,r,i)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=$t)}get domAtom(){return!1}isText(e){return this.node.text==e}}class bp extends Fs{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==_t&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class cS extends Sn{constructor(e,t,i,s,r,o,a,l,c,d){super(e,t,i,s,r,o,a,c,d),this.spec=l}update(e,t,i,s){if(this.dirty==$t)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let r=this.spec.update(e,t,i);return r&&this.updateInner(e,t,i,s),r}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,i,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,i,s){this.spec.setSelection?this.spec.setSelection(e,t,i.root):super.setSelection(e,t,i,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function yp(n,e,t){let i=n.firstChild,s=!1;for(let r=0;r<e.length;r++){let o=e[r],a=o.dom;if(a.parentNode==n){for(;a!=i;)i=Wc(i),s=!0;i=i.nextSibling}else s=!0,n.insertBefore(a,i);if(o instanceof ri){let l=i?i.previousSibling:n.lastChild;yp(o.contentDOM,o.children,t),i=l?l.nextSibling:n.firstChild}}for(;i;)i=Wc(i),s=!0;s&&t.trackWrites==n&&(t.trackWrites=null)}const us=function(n){n&&(this.nodeName=n)};us.prototype=Object.create(null);const qn=[new us];function _a(n,e,t){if(n.length==0)return qn;let i=t?qn[0]:new us,s=[i];for(let r=0;r<n.length;r++){let o=n[r].type.attrs;if(o){o.nodeName&&s.push(i=new us(o.nodeName));for(let a in o){let l=o[a];l!=null&&(t&&s.length==1&&s.push(i=new us(e.isInline?"span":"div")),a=="class"?i.class=(i.class?i.class+" ":"")+l:a=="style"?i.style=(i.style?i.style+";":"")+l:a!="nodeName"&&(i[a]=l))}}}return s}function xp(n,e,t,i){if(t==qn&&i==qn)return e;let s=e;for(let r=0;r<i.length;r++){let o=i[r],a=t[r];if(r){let l;a&&a.nodeName==o.nodeName&&s!=n&&(l=s.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(s),a=qn[0]),s=l}dS(s,a||qn[0],o)}return s}function dS(n,e,t){for(let i in e)i!="class"&&i!="style"&&i!="nodeName"&&!(i in t)&&n.removeAttribute(i);for(let i in t)i!="class"&&i!="style"&&i!="nodeName"&&t[i]!=e[i]&&n.setAttribute(i,t[i]);if(e.class!=t.class){let i=e.class?e.class.split(" ").filter(Boolean):[],s=t.class?t.class.split(" ").filter(Boolean):[];for(let r=0;r<i.length;r++)s.indexOf(i[r])==-1&&n.classList.remove(i[r]);for(let r=0;r<s.length;r++)i.indexOf(s[r])==-1&&n.classList.add(s[r]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let i=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=i.exec(e.style);)n.style.removeProperty(s[1])}t.style&&(n.style.cssText+=t.style)}}function _p(n,e,t){return xp(n,n,qn,_a(e,t,n.nodeType!=1))}function Mr(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function Wc(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class uS{constructor(e,t,i){this.lock=t,this.view=i,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=hS(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let i=e;i<t;i++)this.top.children[i].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,i,s){let r=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;r<a&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&e[r].type.spec.spanning!==!1;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=_t,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;s<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let d=this.index;d<c;d++){let u=this.top.children[d];if(u.matchesMark(e[o])&&!this.isLocked(u.dom)){l=d;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let d=ri.create(this.top,e[o],t,i);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,i,s){let r=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,i))r=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,t,i)&&!this.preMatch.matched.has(c)){r=a;break}}return r<0?!1:(this.destroyBetween(this.index,r),this.index++,!0)}updateNodeAt(e,t,i,s,r){let o=this.top.children[s];return o.dirty==$t&&o.dom==o.contentDOM&&(o.dirty=Yn),o.update(e,t,i,r)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let i=e.pmViewDesc;if(i){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==i)return s}return-1}e=t}}updateNextNode(e,t,i,s,r,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Sn){let c=this.preMatch.matched.get(l);if(c!=null&&c!=r)return!1;let d=l.dom,u,h=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=$t&&Mr(t,l.outerDeco));if(!h&&l.update(e,t,i,s))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(u=this.recreateWrapper(l,e,t,i,s,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Yn,u.updateChildren(s,o+1),u.dirty=_t),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,i,s,r,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Mr(i,e.outerDeco)||!s.eq(e.innerDeco))return null;let a=Sn.create(this.top,t,i,s,r,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,t,i,s,r){let o=Sn.create(this.top,e,t,i,s,r);o.contentDOM&&o.updateChildren(s,r+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,i){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let r=new gp(this.top,e,t,i);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof ri;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Qr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Be||Ae)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let i=document.createElement(e);e=="IMG"&&(i.className="ProseMirror-separator",i.alt=""),e=="BR"&&(i.className="ProseMirror-trailingBreak");let s=new bp(this.top,[],i,null);t!=this.top?t.children.push(s):t.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function hS(n,e){let t=e,i=t.children.length,s=n.childCount,r=new Map,o=[];e:for(;s>0;){let a;for(;;)if(i){let c=t.children[i-1];if(c instanceof ri)t=c,i=c.children.length;else{a=c,i--;break}}else{if(t==e)break e;i=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=n.child(s-1))break;--s,r.set(a,s),o.push(a)}}return{index:s,matched:r,matches:o.reverse()}}function fS(n,e){return n.type.side-e.type.side}function pS(n,e,t,i){let s=e.locals(n),r=0;if(s.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);i(d,s,e.forChild(r,d),c),r+=d.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let d,u;for(;o<s.length&&s[o].to==r;){let g=s[o++];g.widget&&(d?(u||(u=[d])).push(g):d=g)}if(d)if(u){u.sort(fS);for(let g=0;g<u.length;g++)t(u[g],c,!!l)}else t(d,c,!!l);let h,f;if(l)f=-1,h=l,l=null;else if(c<n.childCount)f=c,h=n.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=r&&a.splice(g--,1);for(;o<s.length&&s[o].from<=r&&s[o].to>r;)a.push(s[o++]);let p=r+h.nodeSize;if(h.isText){let g=p;o<s.length&&s[o].from<g&&(g=s[o].from);for(let y=0;y<a.length;y++)a[y].to<g&&(g=a[y].to);g<p&&(l=h.cut(g-r),h=h.cut(0,g-r),p=g,f=-1)}else for(;o<s.length&&s[o].to<p;)o++;let m=h.isInline&&!h.isLeaf?a.filter(g=>!g.inline):a.slice();i(h,m,e.forChild(r,h),f),r=p}}function mS(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function gS(n,e,t,i){for(let s=0,r=0;s<n.childCount&&r<=i;){let o=n.child(s++),a=r;if(r+=o.nodeSize,!o.isText)continue;let l=o.text;for(;s<n.childCount;){let c=n.child(s++);if(r+=c.nodeSize,!c.isText)break;l+=c.text}if(r>=t){if(r>=i&&l.slice(i-e.length-a,i-a)==e)return i-e.length;let c=a<i?l.lastIndexOf(e,i-a-1):-1;if(c>=0&&c+e.length+a>=t)return a+c;if(t==i&&l.length>=i+e.length-a&&l.slice(i-a,i-a+e.length)==e)return i}}return-1}function ka(n,e,t,i,s){let r=[];for(let o=0,a=0;o<n.length;o++){let l=n[o],c=a,d=a+=l.size;c>=t||d<=e?r.push(l):(c<e&&r.push(l.slice(0,e-c,i)),s&&(r.push(s),s=void 0),d>t&&r.push(l.slice(t-c,l.size,i)))}return r}function il(n,e=null){let t=n.domSelectionRange(),i=n.state.doc;if(!t.focusNode)return null;let s=n.docView.nearestDesc(t.focusNode),r=s&&s.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=i.resolve(o),l,c;if(Xr(t)){for(l=o;s&&!s.node;)s=s.parent;let u=s.node;if(s&&u.isAtom&&L.isSelectable(u)&&s.parent&&!(u.isInline&&Hv(t.focusNode,t.focusOffset,s.dom))){let h=s.posBefore;c=new L(o==h?a:i.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let u=o,h=o;for(let f=0;f<t.rangeCount;f++){let p=t.getRangeAt(f);u=Math.min(u,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(u<0)return null;[l,o]=h==n.state.selection.anchor?[h,u]:[u,h],a=i.resolve(o)}else l=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let d=i.resolve(l);if(!c){let u=e=="pointer"||n.state.selection.head<a.pos&&!r?1:-1;c=sl(n,d,a,u)}return c}function kp(n){return n.editable?n.hasFocus():vp(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function on(n,e=!1){let t=n.state.selection;if(wp(n,t),!!kp(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Ae){let i=n.domSelectionRange(),s=n.domObserver.currentSelection;if(i.anchorNode&&s.anchorNode&&si(i.anchorNode,i.anchorOffset,s.anchorNode,s.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)yS(n);else{let{anchor:i,head:s}=t,r,o;$c&&!(t instanceof $)&&(t.$from.parent.inlineContent||(r=Hc(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=Hc(n,t.to))),n.docView.setSelection(i,s,n,e),$c&&(r&&Vc(r),o&&Vc(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&bS(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const $c=Be||Ae&&lp<63;function Hc(n,e){let{node:t,offset:i}=n.docView.domFromPos(e,0),s=i<t.childNodes.length?t.childNodes[i]:null,r=i?t.childNodes[i-1]:null;if(Be&&s&&s.contentEditable=="false")return Ro(s);if((!s||s.contentEditable=="false")&&(!r||r.contentEditable=="false")){if(s)return Ro(s);if(r)return Ro(r)}}function Ro(n){return n.contentEditable="true",Be&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Vc(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function bS(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),i=t.anchorNode,s=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=i||t.anchorOffset!=s)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!kp(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function yS(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,i=t.nodeName=="IMG";i?e.collapse(t.parentNode,Ne(t)+1):e.collapse(t,0),!i&&!n.state.selection.visible&&Xe&&vn<=11&&(t.disabled=!0,t.disabled=!1)}function wp(n,e){if(e instanceof L){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Yc(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Yc(n)}function Yc(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function sl(n,e,t,i){return n.someProp("createSelectionBetween",s=>s(n,e,t))||$.between(e,t,i)}function qc(n){return n.editable&&!n.hasFocus()?!1:vp(n)}function vp(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function xS(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return si(e.node,e.offset,t.anchorNode,t.anchorOffset)}function wa(n,e){let{$anchor:t,$head:i}=n.selection,s=e>0?t.max(i):t.min(i),r=s.parent.inlineContent?s.depth?n.doc.resolve(e>0?s.after():s.before()):null:s;return r&&q.findFrom(r,e)}function un(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Kc(n,e,t){let i=n.state.selection;if(i instanceof $)if(t.indexOf("s")>-1){let{$head:s}=i,r=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!r||r.isText||!r.isLeaf)return!1;let o=n.state.doc.resolve(s.pos+r.nodeSize*(e<0?-1:1));return un(n,new $(i.$anchor,o))}else if(i.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=wa(n.state,e);return s&&s instanceof L?un(n,s):!1}else if(!(pt&&t.indexOf("m")>-1)){let s=i.$head,r=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!r||r.isText)return!1;let a=e<0?s.pos-r.nodeSize:s.pos;return r.isAtom||(o=n.docView.descAt(a))&&!o.contentDOM?L.isSelectable(r)?un(n,new L(e<0?n.state.doc.resolve(s.pos-r.nodeSize):s)):Ls?un(n,new $(n.state.doc.resolve(e<0?a:a+r.nodeSize))):!1:!1}}else return!1;else{if(i instanceof L&&i.node.isInline)return un(n,new $(e>0?i.$to:i.$from));{let s=wa(n.state,e);return s?un(n,s):!1}}}function Cr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function hs(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function mi(n,e){return e<0?_S(n):kS(n)}function _S(n){let e=n.domSelectionRange(),t=e.focusNode,i=e.focusOffset;if(!t)return;let s,r,o=!1;for(xt&&t.nodeType==1&&i<Cr(t)&&hs(t.childNodes[i],-1)&&(o=!0);;)if(i>0){if(t.nodeType!=1)break;{let a=t.childNodes[i-1];if(hs(a,-1))s=t,r=--i;else if(a.nodeType==3)t=a,i=t.nodeValue.length;else break}}else{if(Sp(t))break;{let a=t.previousSibling;for(;a&&hs(a,-1);)s=t.parentNode,r=Ne(a),a=a.previousSibling;if(a)t=a,i=Cr(t);else{if(t=t.parentNode,t==n.dom)break;i=0}}}o?va(n,t,i):s&&va(n,s,r)}function kS(n){let e=n.domSelectionRange(),t=e.focusNode,i=e.focusOffset;if(!t)return;let s=Cr(t),r,o;for(;;)if(i<s){if(t.nodeType!=1)break;let a=t.childNodes[i];if(hs(a,1))r=t,o=++i;else break}else{if(Sp(t))break;{let a=t.nextSibling;for(;a&&hs(a,1);)r=a.parentNode,o=Ne(a)+1,a=a.nextSibling;if(a)t=a,i=0,s=Cr(t);else{if(t=t.parentNode,t==n.dom)break;i=s=0}}}r&&va(n,r,o)}function Sp(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function wS(n,e){for(;n&&e==n.childNodes.length&&!Bs(n);)e=Ne(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function vS(n,e){for(;n&&!e&&!Bs(n);)e=Ne(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function va(n,e,t){if(e.nodeType!=3){let r,o;(o=wS(e,t))?(e=o,t=0):(r=vS(e,t))&&(e=r,t=r.nodeValue.length)}let i=n.domSelection();if(!i)return;if(Xr(i)){let r=document.createRange();r.setEnd(e,t),r.setStart(e,t),i.removeAllRanges(),i.addRange(r)}else i.extend&&i.extend(e,t);n.domObserver.setCurSelection();let{state:s}=n;setTimeout(()=>{n.state==s&&on(n)},50)}function Uc(n,e){let t=n.state.doc.resolve(e);if(!(Ae||cp)&&t.parent.inlineContent){let s=n.coordsAtPos(e);if(e>t.start()){let r=n.coordsAtPos(e-1),o=(r.top+r.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(r.left-s.left)>1)return r.left<s.left?"ltr":"rtl"}if(e<t.end()){let r=n.coordsAtPos(e+1),o=(r.top+r.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(r.left-s.left)>1)return r.left>s.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Jc(n,e,t){let i=n.state.selection;if(i instanceof $&&!i.empty||t.indexOf("s")>-1||pt&&t.indexOf("m")>-1)return!1;let{$from:s,$to:r}=i;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=wa(n.state,e);if(o&&o instanceof L)return un(n,o)}if(!s.parent.inlineContent){let o=e<0?s:r,a=i instanceof ct?q.near(o,e):q.findFrom(o,e);return a?un(n,a):!1}return!1}function Gc(n,e){if(!(n.state.selection instanceof $))return!0;let{$head:t,$anchor:i,empty:s}=n.state.selection;if(!t.sameParent(i))return!0;if(!s)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let r=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(r&&!r.isText){let o=n.state.tr;return e<0?o.delete(t.pos-r.nodeSize,t.pos):o.delete(t.pos,t.pos+r.nodeSize),n.dispatch(o),!0}return!1}function Xc(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function SS(n){if(!Be||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let i=e.firstChild;Xc(n,i,"true"),setTimeout(()=>Xc(n,i,"false"),20)}return!1}function MS(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function CS(n,e){let t=e.keyCode,i=MS(e);if(t==8||pt&&t==72&&i=="c")return Gc(n,-1)||mi(n,-1);if(t==46&&!e.shiftKey||pt&&t==68&&i=="c")return Gc(n,1)||mi(n,1);if(t==13||t==27)return!0;if(t==37||pt&&t==66&&i=="c"){let s=t==37?Uc(n,n.state.selection.from)=="ltr"?-1:1:-1;return Kc(n,s,i)||mi(n,s)}else if(t==39||pt&&t==70&&i=="c"){let s=t==39?Uc(n,n.state.selection.from)=="ltr"?1:-1:1;return Kc(n,s,i)||mi(n,s)}else{if(t==38||pt&&t==80&&i=="c")return Jc(n,-1,i)||mi(n,-1);if(t==40||pt&&t==78&&i=="c")return SS(n)||Jc(n,1,i)||mi(n,1);if(i==(pt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function rl(n,e){n.someProp("transformCopied",f=>{e=f(e,n)});let t=[],{content:i,openStart:s,openEnd:r}=e;for(;s>1&&r>1&&i.childCount==1&&i.firstChild.childCount==1;){s--,r--;let f=i.firstChild;t.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),i=f.content}let o=n.someProp("clipboardSerializer")||ai.fromSchema(n.state.schema),a=Np(),l=a.createElement("div");l.appendChild(o.serializeFragment(i,{document:a}));let c=l.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=Tp[c.nodeName.toLowerCase()]);){for(let f=d.length-1;f>=0;f--){let p=a.createElement(d[f]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),u++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${r}${u?` -${u}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",f=>f(e,n))||e.content.textBetween(0,e.content.size,`
|
|
7
|
+
|
|
8
|
+
`);return{dom:l,text:h,slice:e}}function Mp(n,e,t,i,s){let r=s.parent.type.spec.code,o,a;if(!t&&!e)return null;let l=!!e&&(i||r||!t);if(l){if(n.someProp("transformPastedText",h=>{e=h(e,r||i,n)}),r)return a=new I(T.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
|
9
|
+
`))),0,0),n.someProp("transformPasted",h=>{a=h(a,n,!0)}),a;let u=n.someProp("clipboardTextParser",h=>h(e,s,i,n));if(u)a=u;else{let h=s.marks(),{schema:f}=n.state,p=ai.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(f.text(m,h)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),o=NS(t),Ls&&ES(o);let c=o&&o.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||wn.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||d),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!OS.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)a=AS(Qc(a,+d[1],+d[2]),d[4]);else if(a=I.maxOpen(DS(a.content,s),!0),a.openStart||a.openEnd){let u=0,h=0;for(let f=a.content.firstChild;u<a.openStart&&!f.type.spec.isolating;u++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=Qc(a,u,h)}return n.someProp("transformPasted",u=>{a=u(a,n,l)}),a}const OS=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function DS(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.index(t)),r,o=[];if(n.forEach(a=>{if(!o)return;let l=s.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&r.length&&Op(l,r,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Dp(o[o.length-1],r.length));let d=Cp(a,l);o.push(d),s=s.matchType(d.type),r=l}}),o)return T.from(o)}return n}function Cp(n,e,t=0){for(let i=e.length-1;i>=t;i--)n=e[i].create(null,T.from(n));return n}function Op(n,e,t,i,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let r=Op(n,e,t,i.lastChild,s+1);if(r)return i.copy(i.content.replaceChild(i.childCount-1,r));if(i.contentMatchAt(i.childCount).matchType(s==n.length-1?t.type:n[s+1]))return i.copy(i.content.append(T.from(Cp(t,n,s+1))))}}function Dp(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Dp(n.lastChild,e-1)),i=n.contentMatchAt(n.childCount).fillBefore(T.empty,!0);return n.copy(t.append(i))}function Sa(n,e,t,i,s,r){let o=e<0?n.firstChild:n.lastChild,a=o.content;return n.childCount>1&&(r=0),s<i-1&&(a=Sa(a,e,t,i,s+1,r)),s>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,r<=s).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(T.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(a))}function Qc(n,e,t){return e<n.openStart&&(n=new I(Sa(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new I(Sa(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Tp={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Zc=null;function Np(){return Zc||(Zc=document.implementation.createHTMLDocument("title"))}let zo=null;function TS(n){let e=window.trustedTypes;return e?(zo||(zo=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),zo.createHTML(n)):n}function NS(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Np().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(n),s;if((s=i&&Tp[i[1].toLowerCase()])&&(n=s.map(r=>"<"+r+">").join("")+n+s.map(r=>"</"+r+">").reverse().join("")),t.innerHTML=TS(n),s)for(let r=0;r<s.length;r++)t=t.querySelector(s[r])||t;return t}function ES(n){let e=n.querySelectorAll(Ae?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let i=e[t];i.childNodes.length==1&&i.textContent==" "&&i.parentNode&&i.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),i)}}function AS(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,i;try{i=JSON.parse(e)}catch{return n}let{content:s,openStart:r,openEnd:o}=n;for(let a=i.length-2;a>=0;a-=2){let l=t.nodes[i[a]];if(!l||l.hasRequiredAttrs())break;s=T.from(l.create(i[a+1],s)),r++,o++}return new I(s,r,o)}const We={},$e={},PS={touchstart:!0,touchmove:!0};class IS{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function RS(n){for(let e in We){let t=We[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=i=>{jS(n,i)&&!ol(n,i)&&(n.editable||!(i.type in $e))&&t(n,i)},PS[e]?{passive:!0}:void 0)}Be&&n.dom.addEventListener("input",()=>null),Ma(n)}function gn(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function zS(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Ma(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=i=>ol(n,i))})}function ol(n,e){return n.someProp("handleDOMEvents",t=>{let i=t[e.type];return i?i(n,e)||e.defaultPrevented:!1})}function jS(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function BS(n,e){!ol(n,e)&&We[e.type]&&(n.editable||!(e.type in $e))&&We[e.type](n,e)}$e.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Ap(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(nn&&Ae&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Ni&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let i=Date.now();n.input.lastIOSEnter=i,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==i&&(n.someProp("handleKeyDown",s=>s(n,$n(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",i=>i(n,t))||CS(n,t)?t.preventDefault():gn(n,"key")};$e.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};$e.keypress=(n,e)=>{let t=e;if(Ap(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||pt&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let i=n.state.selection;if(!(i instanceof $)||!i.$from.sameParent(i.$to)){let s=String.fromCharCode(t.charCode),r=()=>n.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!n.someProp("handleTextInput",o=>o(n,i.$from.pos,i.$to.pos,s,r))&&n.dispatch(r()),t.preventDefault()}};function Zr(n){return{left:n.clientX,top:n.clientY}}function LS(n,e){let t=e.x-n.clientX,i=e.y-n.clientY;return t*t+i*i<100}function al(n,e,t,i,s){if(i==-1)return!1;let r=n.state.doc.resolve(i);for(let o=r.depth+1;o>0;o--)if(n.someProp(e,a=>o>r.depth?a(n,t,r.nodeAfter,r.before(o),s,!0):a(n,t,r.node(o),r.before(o),s,!1)))return!0;return!1}function Si(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let i=n.state.tr.setSelection(e);i.setMeta("pointer",!0),n.dispatch(i)}function FS(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),i=t.nodeAfter;return i&&i.isAtom&&L.isSelectable(i)?(Si(n,new L(t)),!0):!1}function WS(n,e){if(e==-1)return!1;let t=n.state.selection,i,s;t instanceof L&&(i=t.node);let r=n.state.doc.resolve(e);for(let o=r.depth+1;o>0;o--){let a=o>r.depth?r.nodeAfter:r.node(o);if(L.isSelectable(a)){i&&t.$from.depth>0&&o>=t.$from.depth&&r.before(t.$from.depth+1)==t.$from.pos?s=r.before(t.$from.depth):s=r.before(o);break}}return s!=null?(Si(n,L.create(n.state.doc,s)),!0):!1}function $S(n,e,t,i,s){return al(n,"handleClickOn",e,t,i)||n.someProp("handleClick",r=>r(n,e,i))||(s?WS(n,t):FS(n,t))}function HS(n,e,t,i){return al(n,"handleDoubleClickOn",e,t,i)||n.someProp("handleDoubleClick",s=>s(n,e,i))}function VS(n,e,t,i){return al(n,"handleTripleClickOn",e,t,i)||n.someProp("handleTripleClick",s=>s(n,e,i))||YS(n,t,i)}function YS(n,e,t){if(t.button!=0)return!1;let i=n.state.doc;if(e==-1)return i.inlineContent?(Si(n,$.create(i,0,i.content.size)),!0):!1;let s=i.resolve(e);for(let r=s.depth+1;r>0;r--){let o=r>s.depth?s.nodeAfter:s.node(r),a=s.before(r);if(o.inlineContent)Si(n,$.create(i,a+1,a+1+o.content.size));else if(L.isSelectable(o))Si(n,L.create(i,a));else continue;return!0}}function ll(n){return Or(n)}const Ep=pt?"metaKey":"ctrlKey";We.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let i=ll(n),s=Date.now(),r="singleClick";s-n.input.lastClick.time<500&&LS(t,n.input.lastClick)&&!t[Ep]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?r="doubleClick":n.input.lastClick.type=="doubleClick"&&(r="tripleClick")),n.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:r,button:t.button};let o=n.posAtCoords(Zr(t));o&&(r=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new qS(n,o,t,!!i)):(r=="doubleClick"?HS:VS)(n,o.pos,o.inside,t)?t.preventDefault():gn(n,"pointer"))};class qS{constructor(e,t,i,s){this.view=e,this.pos=t,this.event=i,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!i[Ep],this.allowDefault=i.shiftKey;let r,o;if(t.inside>-1)r=e.state.doc.nodeAt(t.inside),o=t.inside;else{let d=e.state.doc.resolve(t.pos);r=d.parent,o=d.depth?d.before():0}const a=s?null:i.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(i.button==0&&r.type.spec.draggable&&r.type.spec.selectable!==!1||c instanceof L&&c.from<=o&&c.to>o)&&(this.mightDrag={node:r,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&xt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),gn(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>on(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Zr(e))),this.updateAllowDefault(e),this.allowDefault||!t?gn(this.view,"pointer"):$S(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Be&&this.mightDrag&&!this.mightDrag.node.isAtom||Ae&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Si(this.view,q.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):gn(this.view,"pointer")}move(e){this.updateAllowDefault(e),gn(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}We.touchstart=n=>{n.input.lastTouch=Date.now(),ll(n),gn(n,"pointer")};We.touchmove=n=>{n.input.lastTouch=Date.now(),gn(n,"pointer")};We.contextmenu=n=>ll(n);function Ap(n,e){return n.composing?!0:Be&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const KS=nn?5e3:-1;$e.compositionstart=$e.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof $&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(i=>i.type.spec.inclusive===!1)||Ae&&cp&&US(n)))n.markCursor=n.state.storedMarks||t.marks(),Or(n,!0),n.markCursor=null;else if(Or(n,!e.selection.empty),xt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let i=n.domSelectionRange();for(let s=i.focusNode,r=i.focusOffset;s&&s.nodeType==1&&r!=0;){let o=r<0?s.lastChild:s.childNodes[r-1];if(!o)break;if(o.nodeType==3){let a=n.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else s=o,r=-1}}n.input.composing=!0}Pp(n,KS)};function US(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let i=e.childNodes[t];return i.nodeType==1&&i.contentEditable=="false"}$e.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Pp(n,20))};function Pp(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Or(n),e))}function Ip(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=GS());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function JS(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Wv(e.focusNode,e.focusOffset),i=$v(e.focusNode,e.focusOffset);if(t&&i&&t!=i){let s=i.pmViewDesc,r=n.domObserver.lastChangedTextNode;if(t==r||i==r)return r;if(!s||!s.isText(i.nodeValue))return i;if(n.input.compositionNode==i){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return i}}return t||i}function GS(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Or(n,e=!1){if(!(nn&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Ip(n),e||n.docView&&n.docView.dirty){let t=il(n),i=n.state.selection;return t&&!t.eq(i)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!i.$from.node(i.$from.sharedDepth(i.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function XS(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let i=getSelection(),s=document.createRange();s.selectNodeContents(e),n.dom.blur(),i.removeAllRanges(),i.addRange(s),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Ss=Xe&&vn<15||Ni&&qv<604;We.copy=$e.cut=(n,e)=>{let t=e,i=n.state.selection,s=t.type=="cut";if(i.empty)return;let r=Ss?null:t.clipboardData,o=i.content(),{dom:a,text:l}=rl(n,o);r?(t.preventDefault(),r.clearData(),r.setData("text/html",a.innerHTML),r.setData("text/plain",l)):XS(n,a),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function QS(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function ZS(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,i=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(i.contentEditable="true"),i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus();let s=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),i.parentNode&&i.parentNode.removeChild(i),t?Ms(n,i.value,null,s,e):Ms(n,i.textContent,i.innerHTML,s,e)},50)}function Ms(n,e,t,i,s){let r=Mp(n,e,t,i,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,s,r||I.empty)))return!0;if(!r)return!1;let o=QS(r),a=o?n.state.tr.replaceSelectionWith(o,i):n.state.tr.replaceSelection(r);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Rp(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}$e.paste=(n,e)=>{let t=e;if(n.composing&&!nn)return;let i=Ss?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;i&&Ms(n,Rp(i),i.getData("text/html"),s,t)?t.preventDefault():ZS(n,t)};class zp{constructor(e,t,i){this.slice=e,this.move=t,this.node=i}}const eM=pt?"altKey":"ctrlKey";function jp(n,e){let t=n.someProp("dragCopies",i=>!i(e));return t??!e[eM]}We.dragstart=(n,e)=>{let t=e,i=n.input.mouseDown;if(i&&i.done(),!t.dataTransfer)return;let s=n.state.selection,r=s.empty?null:n.posAtCoords(Zr(t)),o;if(!(r&&r.pos>=s.from&&r.pos<=(s instanceof L?s.to-1:s.to))){if(i&&i.mightDrag)o=L.create(n.state.doc,i.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(o=L.create(n.state.doc,u.posBefore))}}let a=(o||n.state.selection).content(),{dom:l,text:c,slice:d}=rl(n,a);(!t.dataTransfer.files.length||!Ae||lp>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Ss?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Ss||t.dataTransfer.setData("text/plain",c),n.dragging=new zp(d,jp(n,t),o)};We.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};$e.dragover=$e.dragenter=(n,e)=>e.preventDefault();$e.drop=(n,e)=>{try{tM(n,e,n.dragging)}finally{n.dragging=null}};function tM(n,e,t){if(!e.dataTransfer)return;let i=n.posAtCoords(Zr(e));if(!i)return;let s=n.state.doc.resolve(i.pos),r=t&&t.slice;r?n.someProp("transformPasted",f=>{r=f(r,n,!1)}):r=Mp(n,Rp(e.dataTransfer),Ss?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(t&&jp(n,e));if(n.someProp("handleDrop",f=>f(n,e,r||I.empty,o))){e.preventDefault();return}if(!r)return;e.preventDefault();let a=r?ep(n.state.doc,s.pos,r):s.pos;a==null&&(a=s.pos);let l=n.state.tr;if(o){let{node:f}=t;f?f.replace(l):l.deleteSelection()}let c=l.mapping.map(a),d=r.openStart==0&&r.openEnd==0&&r.content.childCount==1,u=l.doc;if(d?l.replaceRangeWith(c,c,r.content.firstChild):l.replaceRange(c,c,r),l.doc.eq(u))return;let h=l.doc.resolve(c);if(d&&L.isSelectable(r.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(r.content.firstChild))l.setSelection(new L(h));else{let f=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((p,m,g,y)=>f=y),l.setSelection(sl(n,h,l.doc.resolve(f)))}n.focus(),n.dispatch(l.setMeta("uiEvent","drop"))}We.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&on(n)},20))};We.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};We.beforeinput=(n,e)=>{if(Ae&&nn&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:i}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=i||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",r=>r(n,$n(8,"Backspace")))))return;let{$cursor:s}=n.state.selection;s&&s.pos>0&&n.dispatch(n.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let n in $e)We[n]=$e[n];function Cs(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Dr{constructor(e,t){this.toDOM=e,this.spec=t||Xn,this.side=this.spec.side||0}map(e,t,i,s){let{pos:r,deleted:o}=e.mapResult(t.from+s,this.side<0?-1:1);return o?null:new bt(r-i,r-i,this)}valid(){return!0}eq(e){return this==e||e instanceof Dr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Cs(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Mn{constructor(e,t){this.attrs=e,this.spec=t||Xn}map(e,t,i,s){let r=e.map(t.from+s,this.spec.inclusiveStart?-1:1)-i,o=e.map(t.to+s,this.spec.inclusiveEnd?1:-1)-i;return r>=o?null:new bt(r,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Mn&&Cs(this.attrs,e.attrs)&&Cs(this.spec,e.spec)}static is(e){return e.type instanceof Mn}destroy(){}}class cl{constructor(e,t){this.attrs=e,this.spec=t||Xn}map(e,t,i,s){let r=e.mapResult(t.from+s,1);if(r.deleted)return null;let o=e.mapResult(t.to+s,-1);return o.deleted||o.pos<=r.pos?null:new bt(r.pos-i,o.pos-i,this)}valid(e,t){let{index:i,offset:s}=e.content.findIndex(t.from),r;return s==t.from&&!(r=e.child(i)).isText&&s+r.nodeSize==t.to}eq(e){return this==e||e instanceof cl&&Cs(this.attrs,e.attrs)&&Cs(this.spec,e.spec)}destroy(){}}class bt{constructor(e,t,i){this.from=e,this.to=t,this.type=i}copy(e,t){return new bt(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,i){return this.type.map(e,this,t,i)}static widget(e,t,i){return new bt(e,e,new Dr(t,i))}static inline(e,t,i,s){return new bt(e,t,new Mn(i,s))}static node(e,t,i,s){return new bt(e,t,new cl(i,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Mn}get widget(){return this.type instanceof Dr}}const _i=[],Xn={};class xe{constructor(e,t){this.local=e.length?e:_i,this.children=t.length?t:_i}static create(e,t){return t.length?Tr(t,e,0,Xn):Re}find(e,t,i){let s=[];return this.findInner(e??0,t??1e9,s,0,i),s}findInner(e,t,i,s,r){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!r||r(a.spec))&&i.push(a.copy(a.from+s,a.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,i,s+a,r)}}map(e,t,i){return this==Re||e.maps.length==0?this:this.mapInner(e,t,0,0,i||Xn)}mapInner(e,t,i,s,r){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,i,s);l&&l.type.valid(t,l)?(o||(o=[])).push(l):r.onRemove&&r.onRemove(this.local[a].spec)}return this.children.length?nM(this.children,o||[],e,t,i,s,r):o?new xe(o.sort(Qn),_i):Re}add(e,t){return t.length?this==Re?xe.create(e,t):this.addInner(e,t,0):this}addInner(e,t,i){let s,r=0;e.forEach((a,l)=>{let c=l+i,d;if(d=Lp(t,a,c)){for(s||(s=this.children.slice());r<s.length&&s[r]<l;)r+=3;s[r]==l?s[r+2]=s[r+2].addInner(a,d,c+1):s.splice(r,0,l,l+a.nodeSize,Tr(d,a,c+1,Xn)),r+=3}});let o=Bp(r?Fp(t):t,-i);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new xe(o.length?this.local.concat(o).sort(Qn):this.local,s||this.children)}remove(e){return e.length==0||this==Re?this:this.removeInner(e,0)}removeInner(e,t){let i=this.children,s=this.local;for(let r=0;r<i.length;r+=3){let o,a=i[r]+t,l=i[r+1]+t;for(let d=0,u;d<e.length;d++)(u=e[d])&&u.from>a&&u.to<l&&(e[d]=null,(o||(o=[])).push(u));if(!o)continue;i==this.children&&(i=this.children.slice());let c=i[r+2].removeInner(o,a+1);c!=Re?i[r+2]=c:(i.splice(r,3),r-=3)}if(s.length){for(let r=0,o;r<e.length;r++)if(o=e[r])for(let a=0;a<s.length;a++)s[a].eq(o,t)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return i==this.children&&s==this.local?this:s.length||i.length?new xe(s,i):Re}forChild(e,t){if(this==Re)return this;if(t.isLeaf)return xe.empty;let i,s;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(i=this.children[a+2]);break}let r=e+1,o=r+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>r&&l.type instanceof Mn){let c=Math.max(r,l.from)-r,d=Math.min(o,l.to)-r;c<d&&(s||(s=[])).push(l.copy(c,d))}}if(s){let a=new xe(s.sort(Qn),_i);return i?new fn([a,i]):a}return i||Re}eq(e){if(this==e)return!0;if(!(e instanceof xe)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return dl(this.localsInner(e))}localsInner(e){if(this==Re)return _i;if(e.inlineContent||!this.local.some(Mn.is))return this.local;let t=[];for(let i=0;i<this.local.length;i++)this.local[i].type instanceof Mn||t.push(this.local[i]);return t}forEachSet(e){e(this)}}xe.empty=new xe([],[]);xe.removeOverlap=dl;const Re=xe.empty;class fn{constructor(e){this.members=e}map(e,t){const i=this.members.map(s=>s.map(e,t,Xn));return fn.from(i)}forChild(e,t){if(t.isLeaf)return xe.empty;let i=[];for(let s=0;s<this.members.length;s++){let r=this.members[s].forChild(e,t);r!=Re&&(r instanceof fn?i=i.concat(r.members):i.push(r))}return fn.from(i)}eq(e){if(!(e instanceof fn)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,i=!0;for(let s=0;s<this.members.length;s++){let r=this.members[s].localsInner(e);if(r.length)if(!t)t=r;else{i&&(t=t.slice(),i=!1);for(let o=0;o<r.length;o++)t.push(r[o])}}return t?dl(i?t:t.sort(Qn)):_i}static from(e){switch(e.length){case 0:return Re;case 1:return e[0];default:return new fn(e.every(t=>t instanceof xe)?e:e.reduce((t,i)=>t.concat(i instanceof xe?i:i.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function nM(n,e,t,i,s,r,o){let a=n.slice();for(let c=0,d=r;c<t.maps.length;c++){let u=0;t.maps[c].forEach((h,f,p,m)=>{let g=m-p-(f-h);for(let y=0;y<a.length;y+=3){let S=a[y+1];if(S<0||h>S+d-u)continue;let _=a[y]+d-u;f>=_?a[y+1]=h<=_?-2:-1:h>=d&&g&&(a[y]+=g,a[y+1]+=g)}u+=g}),d=t.maps[c].map(d,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let d=t.map(n[c]+r),u=d-s;if(u<0||u>=i.content.size){l=!0;continue}let h=t.map(n[c+1]+r,-1),f=h-s,{index:p,offset:m}=i.content.findIndex(u),g=i.maybeChild(p);if(g&&m==u&&m+g.nodeSize==f){let y=a[c+2].mapInner(t,g,d+1,n[c]+r+1,o);y!=Re?(a[c]=u,a[c+1]=f,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=iM(a,n,e,t,s,r,o),d=Tr(c,i,0,o);e=d.local;for(let u=0;u<a.length;u+=3)a[u+1]<0&&(a.splice(u,3),u-=3);for(let u=0,h=0;u<d.children.length;u+=3){let f=d.children[u];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,d.children[u],d.children[u+1],d.children[u+2])}}return new xe(e.sort(Qn),a)}function Bp(n,e){if(!e||!n.length)return n;let t=[];for(let i=0;i<n.length;i++){let s=n[i];t.push(new bt(s.from+e,s.to+e,s.type))}return t}function iM(n,e,t,i,s,r,o){function a(l,c){for(let d=0;d<l.local.length;d++){let u=l.local[d].map(i,s,c);u?t.push(u):o.onRemove&&o.onRemove(l.local[d].spec)}for(let d=0;d<l.children.length;d+=3)a(l.children[d+2],l.children[d]+c+1)}for(let l=0;l<n.length;l+=3)n[l+1]==-1&&a(n[l+2],e[l]+r+1);return t}function Lp(n,e,t){if(e.isLeaf)return null;let i=t+e.nodeSize,s=null;for(let r=0,o;r<n.length;r++)(o=n[r])&&o.from>t&&o.to<i&&((s||(s=[])).push(o),n[r]=null);return s}function Fp(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Tr(n,e,t,i){let s=[],r=!1;e.forEach((a,l)=>{let c=Lp(n,a,l+t);if(c){r=!0;let d=Tr(c,a,t+l+1,i);d!=Re&&s.push(l,l+a.nodeSize,d)}});let o=Bp(r?Fp(n):n,-t).sort(Qn);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(i.onRemove&&i.onRemove(o[a].spec),o.splice(a--,1));return o.length||s.length?new xe(o,s):Re}function Qn(n,e){return n.from-e.from||n.to-e.to}function dl(n){let e=n;for(let t=0;t<e.length-1;t++){let i=e[t];if(i.from!=i.to)for(let s=t+1;s<e.length;s++){let r=e[s];if(r.from==i.from){r.to!=i.to&&(e==n&&(e=n.slice()),e[s]=r.copy(r.from,i.to),ed(e,s+1,r.copy(i.to,r.to)));continue}else{r.from<i.to&&(e==n&&(e=n.slice()),e[t]=i.copy(i.from,r.from),ed(e,s,i.copy(r.from,i.to)));break}}}return e}function ed(n,e,t){for(;e<n.length&&Qn(t,n[e])>0;)e++;n.splice(e,0,t)}function jo(n){let e=[];return n.someProp("decorations",t=>{let i=t(n.state);i&&i!=Re&&e.push(i)}),n.cursorWrapper&&e.push(xe.create(n.state.doc,[n.cursorWrapper.deco])),fn.from(e)}const sM={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},rM=Xe&&vn<=11;class oM{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class aM{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new oM,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(i=>{for(let s=0;s<i.length;s++)this.queue.push(i[s]);Xe&&vn<=11&&i.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():Be&&e.composing&&i.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),rM&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,sM)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(qc(this.view)){if(this.suppressingSelectionUpdates)return on(this.view);if(Xe&&vn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&si(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,i;for(let r=e.focusNode;r;r=Ti(r))t.add(r);for(let r=e.anchorNode;r;r=Ti(r))if(t.has(r)){i=r;break}let s=i&&this.view.docView.nearestDesc(i);if(s&&s.ignoreMutation({type:"selection",target:i.nodeType==3?i.parentNode:i}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let i=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(i)&&qc(e)&&!this.ignoreSelectionChange(i),r=-1,o=-1,a=!1,l=[];if(e.editable)for(let d=0;d<t.length;d++){let u=this.registerMutation(t[d],l);u&&(r=r<0?u.from:Math.min(u.from,r),o=o<0?u.to:Math.max(u.to,o),u.typeOver&&(a=!0))}if(l.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of l)if(d.nodeName=="BR"&&d.parentNode){let u=d.nextSibling;u&&u.nodeType==1&&u.contentEditable=="false"&&d.parentNode.removeChild(d)}}else if(xt&&l.length){let d=l.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,h]=d;u.parentNode&&u.parentNode.parentNode==h.parentNode?h.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let h of d){let f=h.parentNode;f&&f.nodeName=="LI"&&(!u||dM(e,u)!=f)&&h.remove()}}}let c=null;r<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Xr(i)&&(c=il(e))&&c.eq(q.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,on(e),this.currentSelection.set(i),e.scrollToSelection()):(r>-1||s)&&(r>-1&&(e.docView.markDirty(r,o),lM(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,uM(e,l)),this.handleDOMChange(r,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(i)||on(e),this.currentSelection.set(i))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let i=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(i==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!i||i.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let u=e.addedNodes[d];t.push(u),u.nodeType==3&&(this.lastChangedTextNode=u)}if(i.contentDOM&&i.contentDOM!=i.dom&&!i.contentDOM.contains(e.target))return{from:i.posBefore,to:i.posAfter};let s=e.previousSibling,r=e.nextSibling;if(Xe&&vn<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:u,nextSibling:h}=e.addedNodes[d];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(s=u),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(r=h)}let o=s&&s.parentNode==e.target?Ne(s)+1:0,a=i.localPosFromDOM(e.target,o,-1),l=r&&r.parentNode==e.target?Ne(r):e.target.childNodes.length,c=i.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:i.posAtStart-i.border,to:i.posAtEnd+i.border}:(this.lastChangedTextNode=e.target,{from:i.posAtStart,to:i.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let td=new WeakMap,nd=!1;function lM(n){if(!td.has(n)&&(td.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=xt,nd)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),nd=!0}}function id(n,e){let t=e.startContainer,i=e.startOffset,s=e.endContainer,r=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return si(o.node,o.offset,s,r)&&([t,i,s,r]=[s,r,t,i]),{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}}function cM(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return id(n,s)}let t;function i(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",i,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",i,!0),t?id(n,t):null}function dM(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let i=n.docView.nearestDesc(t,!0);if(i&&i.node.isBlock)return t}return null}function uM(n,e){var t;let{focusNode:i,focusOffset:s}=n.domSelectionRange();for(let r of e)if(((t=r.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let o=r.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(r,a.firstChild),i==r&&n.domSelection().collapse(r,s)}else r.parentNode.removeChild(r)}}function hM(n,e,t){let{node:i,fromOffset:s,toOffset:r,from:o,to:a}=n.docView.parseRange(e,t),l=n.domSelectionRange(),c,d=l.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:l.anchorOffset}],Xr(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Ae&&n.input.lastKeyCode===8)for(let g=r;g>s;g--){let y=i.childNodes[g-1],S=y.pmViewDesc;if(y.nodeName=="BR"&&!S){r=g;break}if(!S||S.size)break}let u=n.state.doc,h=n.someProp("domParser")||wn.fromSchema(n.state.schema),f=u.resolve(o),p=null,m=h.parse(i,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:s,to:r,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:fM,context:f});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),p={anchor:g+o,head:y+o}}return{doc:m,sel:p,from:o,to:a}}function fM(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Be&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||Be&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const pM=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function mM(n,e,t,i,s){let r=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let M=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,C=il(n,M);if(C&&!n.state.selection.eq(C)){if(Ae&&nn&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",D=>D(n,$n(13,"Enter"))))return;let O=n.state.tr.setSelection(C);M=="pointer"?O.setMeta("pointer",!0):M=="key"&&O.scrollIntoView(),r&&O.setMeta("composition",r),n.dispatch(O)}return}let o=n.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=n.state.doc.resolve(t).after(a+1);let l=n.state.selection,c=hM(n,e,t),d=n.state.doc,u=d.slice(c.from,c.to),h,f;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,f="end"):(h=n.state.selection.from,f="start"),n.input.lastKeyCode=null;let p=yM(u.content,c.doc.content,c.from,h,f);if(p&&n.input.domChangeCount++,(Ni&&n.input.lastIOSEnter>Date.now()-225||nn)&&s.some(M=>M.nodeType==1&&!pM.test(M.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",M=>M(n,$n(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(i&&l instanceof $&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let M=sd(n,n.state.doc,c.sel);if(M&&!M.eq(n.state.selection)){let C=n.state.tr.setSelection(M);r&&C.setMeta("composition",r),n.dispatch(C)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof $&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),Xe&&vn<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),y=d.resolve(p.start),S=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA;if((Ni&&n.input.lastIOSEnter>Date.now()-225&&(!S||s.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!S&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(c.doc.textBetween(m.pos,g.pos,"","")))&&n.someProp("handleKeyDown",M=>M(n,$n(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&bM(d,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",M=>M(n,$n(8,"Backspace")))){nn&&Ae&&n.domObserver.suppressSelectionUpdates();return}Ae&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),nn&&!S&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(M){return M(n,$n(13,"Enter"))})},20));let _=p.start,k=p.endA,v=M=>{let C=M||n.state.tr.replace(_,k,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let O=sd(n,C.doc,c.sel);O&&!(Ae&&n.composing&&O.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(O.head==_||O.head==C.mapping.map(k)-1)||Xe&&O.empty&&O.head==_)&&C.setSelection(O)}return r&&C.setMeta("composition",r),C.scrollIntoView()},w;if(S)if(m.pos==g.pos){Xe&&vn<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>on(n),20));let M=v(n.state.tr.delete(_,k)),C=d.resolve(p.start).marksAcross(d.resolve(p.endA));C&&M.ensureMarks(C),n.dispatch(M)}else if(p.endA==p.endB&&(w=gM(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let M=v(n.state.tr);w.type=="add"?M.addMark(_,k,w.mark):M.removeMark(_,k,w.mark),n.dispatch(M)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let M=m.parent.textBetween(m.parentOffset,g.parentOffset),C=()=>v(n.state.tr.insertText(M,_,k));n.someProp("handleTextInput",O=>O(n,_,k,M,C))||n.dispatch(C())}else n.dispatch(v());else n.dispatch(v())}function sd(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:sl(n,e.resolve(t.anchor),e.resolve(t.head))}function gM(n,e){let t=n.firstChild.marks,i=e.firstChild.marks,s=t,r=i,o,a,l;for(let d=0;d<i.length;d++)s=i[d].removeFromSet(s);for(let d=0;d<t.length;d++)r=t[d].removeFromSet(r);if(s.length==1&&r.length==0)a=s[0],o="add",l=d=>d.mark(a.addToSet(d.marks));else if(s.length==0&&r.length==1)a=r[0],o="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(l(e.child(d)));if(T.from(c).eq(n))return{mark:a,type:o}}function bM(n,e,t,i,s){if(t-e<=s.pos-i.pos||Bo(i,!0,!1)<s.pos)return!1;let r=n.resolve(e);if(!i.parent.isTextblock){let a=r.nodeAfter;return a!=null&&t==e+a.nodeSize}if(r.parentOffset<r.parent.content.size||!r.parent.isTextblock)return!1;let o=n.resolve(Bo(r,!0,!0));return!o.parent.isTextblock||o.pos>t||Bo(o,!0,!1)<t?!1:i.parent.content.cut(i.parentOffset).eq(o.parent.content)}function Bo(n,e,t){let i=n.depth,s=e?n.end():n.pos;for(;i>0&&(e||n.indexAfter(i)==n.node(i).childCount);)i--,s++,e=!1;if(t){let r=n.node(i).maybeChild(n.indexAfter(i));for(;r&&!r.isLeaf;)r=r.firstChild,s++}return s}function yM(n,e,t,i,s){let r=n.findDiffStart(e,t);if(r==null)return null;let{a:o,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(s=="end"){let l=Math.max(0,r-Math.min(o,a));i-=o+l-r}if(o<r&&n.size<e.size){let l=i<=r&&i>=o?r-i:0;r-=l,r&&r<e.size&&rd(e.textBetween(r-1,r+1))&&(r+=l?1:-1),a=r+(a-o),o=r}else if(a<r){let l=i<=r&&i>=a?r-i:0;r-=l,r&&r<n.size&&rd(n.textBetween(r-1,r+1))&&(r+=l?1:-1),o=r+(o-a),a=r}return{start:r,endA:o,endB:a}}function rd(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Wp{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new IS,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(dd),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=ld(this),ad(this),this.nodeViews=cd(this),this.docView=Fc(this.state.doc,od(this),jo(this),this.dom,this),this.domObserver=new aM(this,(i,s,r,o)=>mM(this,i,s,r,o)),this.domObserver.start(),RS(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ma(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(dd),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let i in this._props)t[i]=this._props[i];t.state=this.state;for(let i in e)t[i]=e[i];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var i;let s=this.state,r=!1,o=!1;e.storedMarks&&this.composing&&(Ip(this),o=!0),this.state=e;let a=s.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=cd(this);_M(f,this.nodeViews)&&(this.nodeViews=f,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ma(this),this.editable=ld(this),ad(this);let l=jo(this),c=od(this),d=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",u=r||!this.docView.matchesNode(e.doc,c,l);(u||!e.selection.eq(s.selection))&&(o=!0);let h=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Jv(this);if(o){this.domObserver.stop();let f=u&&(Xe||Ae)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&xM(s.selection,e.selection);if(u){let p=Ae?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=JS(this)),(r||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Fc(e.doc,c,l,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&xS(this))?on(this,f):(wp(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((i=this.dragging)===null||i===void 0)&&i.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&Gv(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof L){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Ic(this,t.getBoundingClientRect(),e)}else Ic(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let i=this.directPlugins[t];i.spec.view&&this.pluginViews.push(i.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let i=this.state.plugins[t];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let i=this.pluginViews[t];i.update&&i.update(this,e)}}updateDraggedNode(e,t){let i=e.node,s=-1;if(this.state.doc.nodeAt(i.from)==i.node)s=i.from;else{let r=i.from+(this.state.doc.content.size-t.doc.content.size);(r>0&&this.state.doc.nodeAt(r))==i.node&&(s=r)}this.dragging=new zp(e.slice,e.move,s<0?void 0:L.create(this.state.doc,s))}someProp(e,t){let i=this._props&&this._props[e],s;if(i!=null&&(s=t?t(i):i))return s;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(s=t?t(a):a))return s}let r=this.state.plugins;if(r)for(let o=0;o<r.length;o++){let a=r[o].props[e];if(a!=null&&(s=t?t(a):a))return s}}hasFocus(){if(Xe){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Xv(this.dom),on(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return nS(this,e)}coordsAtPos(e,t=1){return pp(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,i=-1){let s=this.docView.posFromDOM(e,t,i);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,t){return aS(this,t||this.state,e)}pasteHTML(e,t){return Ms(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Ms(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return rl(this,e)}destroy(){this.docView&&(zS(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],jo(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Lv())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return BS(this,e)}domSelectionRange(){let e=this.domSelection();return e?Be&&this.root.nodeType===11&&Vv(this.dom.ownerDocument)==this.dom&&cM(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Wp.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function od(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let i in t)i=="class"?e.class+=" "+t[i]:i=="style"?e.style=(e.style?e.style+";":"")+t[i]:!e[i]&&i!="contenteditable"&&i!="nodeName"&&(e[i]=String(t[i]))}),e.translate||(e.translate="no"),[bt.node(0,n.state.doc.content.size,e)]}function ad(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:bt.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function ld(n){return!n.someProp("editable",e=>e(n.state)===!1)}function xM(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function cd(n){let e=Object.create(null);function t(i){for(let s in i)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=i[s])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function _M(n,e){let t=0,i=0;for(let s in n){if(n[s]!=e[s])return!0;t++}for(let s in e)i++;return t!=i}function dd(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var On={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Nr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},kM=typeof navigator<"u"&&/Mac/.test(navigator.platform),wM=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ee=0;Ee<10;Ee++)On[48+Ee]=On[96+Ee]=String(Ee);for(var Ee=1;Ee<=24;Ee++)On[Ee+111]="F"+Ee;for(var Ee=65;Ee<=90;Ee++)On[Ee]=String.fromCharCode(Ee+32),Nr[Ee]=String.fromCharCode(Ee);for(var Lo in On)Nr.hasOwnProperty(Lo)||(Nr[Lo]=On[Lo]);function vM(n){var e=kM&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||wM&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Nr:On)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const SM=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),MM=typeof navigator<"u"&&/Win/.test(navigator.platform);function CM(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let i,s,r,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))i=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))r=!0;else if(/^mod$/i.test(l))SM?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+l)}return i&&(t="Alt-"+t),s&&(t="Ctrl-"+t),o&&(t="Meta-"+t),r&&(t="Shift-"+t),t}function OM(n){let e=Object.create(null);for(let t in n)e[CM(t)]=n[t];return e}function Fo(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function DM(n){return new Ze({props:{handleKeyDown:$p(n)}})}function $p(n){let e=OM(n);return function(t,i){let s=vM(i),r,o=e[Fo(s,i)];if(o&&o(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(i.shiftKey){let a=e[Fo(s,i,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((i.altKey||i.metaKey||i.ctrlKey)&&!(MM&&i.ctrlKey&&i.altKey)&&(r=On[i.keyCode])&&r!=s){let a=e[Fo(r,i)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}const ul=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Hp(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Vp=(n,e,t)=>{let i=Hp(n,t);if(!i)return!1;let s=hl(i);if(!s){let o=i.blockRange(),a=o&&Bi(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let r=s.nodeBefore;if(Zp(n,s,e,-1))return!0;if(i.parent.content.size==0&&(Ei(r,"end")||L.isSelectable(r)))for(let o=i.depth;;o--){let a=Jr(n.doc,i.before(o),i.after(o),I.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=n.tr.step(a);l.setSelection(Ei(r,"end")?q.findFrom(l.doc.resolve(l.mapping.map(s.pos,-1)),-1):L.create(l.doc,s.pos-r.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||i.node(o-1).childCount>1)break}return r.isAtom&&s.depth==i.depth-1?(e&&e(n.tr.delete(s.pos-r.nodeSize,s.pos).scrollIntoView()),!0):!1},TM=(n,e,t)=>{let i=Hp(n,t);if(!i)return!1;let s=hl(i);return s?Yp(n,s,e):!1},NM=(n,e,t)=>{let i=Kp(n,t);if(!i)return!1;let s=fl(i);return s?Yp(n,s,e):!1};function Yp(n,e,t){let i=e.nodeBefore,s=i,r=e.pos-1;for(;!s.isTextblock;r--){if(s.type.spec.isolating)return!1;let d=s.lastChild;if(!d)return!1;s=d}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let c=Jr(n.doc,r,l,I.empty);if(!c||c.from!=r||c instanceof ve&&c.slice.size>=l-r)return!1;if(t){let d=n.tr.step(c);d.setSelection($.create(d.doc,r)),t(d.scrollIntoView())}return!0}function Ei(n,e,t=!1){for(let i=n;i;i=e=="start"?i.firstChild:i.lastChild){if(i.isTextblock)return!0;if(t&&i.childCount!=1)return!1}return!1}const qp=(n,e,t)=>{let{$head:i,empty:s}=n.selection,r=i;if(!s)return!1;if(i.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):i.parentOffset>0)return!1;r=hl(i)}let o=r&&r.nodeBefore;return!o||!L.isSelectable(o)?!1:(e&&e(n.tr.setSelection(L.create(n.doc,r.pos-o.nodeSize)).scrollIntoView()),!0)};function hl(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Kp(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Up=(n,e,t)=>{let i=Kp(n,t);if(!i)return!1;let s=fl(i);if(!s)return!1;let r=s.nodeAfter;if(Zp(n,s,e,1))return!0;if(i.parent.content.size==0&&(Ei(r,"start")||L.isSelectable(r))){let o=Jr(n.doc,i.before(),i.after(),I.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=n.tr.step(o);a.setSelection(Ei(r,"start")?q.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):L.create(a.doc,a.mapping.map(s.pos))),e(a.scrollIntoView())}return!0}}return r.isAtom&&s.depth==i.depth-1?(e&&e(n.tr.delete(s.pos,s.pos+r.nodeSize).scrollIntoView()),!0):!1},Jp=(n,e,t)=>{let{$head:i,empty:s}=n.selection,r=i;if(!s)return!1;if(i.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):i.parentOffset<i.parent.content.size)return!1;r=fl(i)}let o=r&&r.nodeAfter;return!o||!L.isSelectable(o)?!1:(e&&e(n.tr.setSelection(L.create(n.doc,r.pos)).scrollIntoView()),!0)};function fl(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const EM=(n,e)=>{let t=n.selection,i=t instanceof L,s;if(i){if(t.node.isTextblock||!Nn(n.doc,t.from))return!1;s=t.from}else if(s=Ur(n.doc,t.from,-1),s==null)return!1;if(e){let r=n.tr.join(s);i&&r.setSelection(L.create(r.doc,s-n.doc.resolve(s).nodeBefore.nodeSize)),e(r.scrollIntoView())}return!0},AM=(n,e)=>{let t=n.selection,i;if(t instanceof L){if(t.node.isTextblock||!Nn(n.doc,t.to))return!1;i=t.to}else if(i=Ur(n.doc,t.to,1),i==null)return!1;return e&&e(n.tr.join(i).scrollIntoView()),!0},PM=(n,e)=>{let{$from:t,$to:i}=n.selection,s=t.blockRange(i),r=s&&Bi(s);return r==null?!1:(e&&e(n.tr.lift(s,r).scrollIntoView()),!0)},Gp=(n,e)=>{let{$head:t,$anchor:i}=n.selection;return!t.parent.type.spec.code||!t.sameParent(i)?!1:(e&&e(n.tr.insertText(`
|
|
10
|
+
`).scrollIntoView()),!0)};function pl(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const IM=(n,e)=>{let{$head:t,$anchor:i}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(i))return!1;let s=t.node(-1),r=t.indexAfter(-1),o=pl(s.contentMatchAt(r));if(!o||!s.canReplaceWith(r,r,o))return!1;if(e){let a=t.after(),l=n.tr.replaceWith(a,a,o.createAndFill());l.setSelection(q.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Xp=(n,e)=>{let t=n.selection,{$from:i,$to:s}=t;if(t instanceof ct||i.parent.inlineContent||s.parent.inlineContent)return!1;let r=pl(s.parent.contentMatchAt(s.indexAfter()));if(!r||!r.isTextblock)return!1;if(e){let o=(!i.parentOffset&&s.index()<s.parent.childCount?i:s).pos,a=n.tr.insert(o,r.createAndFill());a.setSelection($.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Qp=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let r=t.before();if(rn(n.doc,r))return e&&e(n.tr.split(r).scrollIntoView()),!0}let i=t.blockRange(),s=i&&Bi(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)};function RM(n){return(e,t)=>{let{$from:i,$to:s}=e.selection;if(e.selection instanceof L&&e.selection.node.isBlock)return!i.parentOffset||!rn(e.doc,i.pos)?!1:(t&&t(e.tr.split(i.pos).scrollIntoView()),!0);if(!i.depth)return!1;let r=[],o,a,l=!1,c=!1;for(let f=i.depth;;f--)if(i.node(f).isBlock){l=i.end(f)==i.pos+(i.depth-f),c=i.start(f)==i.pos-(i.depth-f),a=pl(i.node(f-1).contentMatchAt(i.indexAfter(f-1))),r.unshift(l&&a?{type:a}:null),o=f;break}else{if(f==1)return!1;r.unshift(null)}let d=e.tr;(e.selection instanceof $||e.selection instanceof ct)&&d.deleteSelection();let u=d.mapping.map(i.pos),h=rn(d.doc,u,r.length,r);if(h||(r[0]=a?{type:a}:null,h=rn(d.doc,u,r.length,r)),!h)return!1;if(d.split(u,r.length,r),!l&&c&&i.node(o).type!=a){let f=d.mapping.map(i.before(o)),p=d.doc.resolve(f);a&&i.node(o-1).canReplaceWith(p.index(),p.index()+1,a)&&d.setNodeMarkup(d.mapping.map(i.before(o)),a)}return t&&t(d.scrollIntoView()),!0}}const zM=RM(),jM=(n,e)=>{let{$from:t,to:i}=n.selection,s,r=t.sharedDepth(i);return r==0?!1:(s=t.before(r),e&&e(n.tr.setSelection(L.create(n.doc,s))),!0)};function BM(n,e,t){let i=e.nodeBefore,s=e.nodeAfter,r=e.index();return!i||!s||!i.type.compatibleContent(s.type)?!1:!i.content.size&&e.parent.canReplace(r-1,r)?(t&&t(n.tr.delete(e.pos-i.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(r,r+1)||!(s.isTextblock||Nn(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Zp(n,e,t,i){let s=e.nodeBefore,r=e.nodeAfter,o,a,l=s.type.spec.isolating||r.type.spec.isolating;if(!l&&BM(n,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=s.contentMatchAt(s.childCount)).findWrapping(r.type))&&a.matchType(o[0]||r.type).validEnd){if(t){let f=e.pos+r.nodeSize,p=T.empty;for(let y=o.length-1;y>=0;y--)p=T.from(o[y].create(null,p));p=T.from(s.copy(p));let m=n.tr.step(new Se(e.pos-1,f,e.pos,f,new I(p,1,0),o.length,!0)),g=m.doc.resolve(f+2*o.length);g.nodeAfter&&g.nodeAfter.type==s.type&&Nn(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let d=r.type.spec.isolating||i>0&&l?null:q.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),h=u&&Bi(u);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(u,h).scrollIntoView()),!0;if(c&&Ei(r,"start",!0)&&Ei(s,"end")){let f=s,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let m=r,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(t){let y=T.empty;for(let _=p.length-1;_>=0;_--)y=T.from(p[_].copy(y));let S=n.tr.step(new Se(e.pos-p.length,e.pos+r.nodeSize,e.pos+g,e.pos+r.nodeSize-g,new I(y,p.length,0),0,!0));t(S.scrollIntoView())}return!0}}return!1}function em(n){return function(e,t){let i=e.selection,s=n<0?i.$from:i.$to,r=s.depth;for(;s.node(r).isInline;){if(!r)return!1;r--}return s.node(r).isTextblock?(t&&t(e.tr.setSelection($.create(e.doc,n<0?s.start(r):s.end(r)))),!0):!1}}const LM=em(-1),FM=em(1);function WM(n,e=null){return function(t,i){let{$from:s,$to:r}=t.selection,o=s.blockRange(r),a=o&&el(o,n,e);return a?(i&&i(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function ud(n,e=null){return function(t,i){let s=!1;for(let r=0;r<t.selection.ranges.length&&!s;r++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[r];t.doc.nodesBetween(o,a,(l,c)=>{if(s)return!1;if(!(!l.isTextblock||l.hasMarkup(n,e)))if(l.type==n)s=!0;else{let d=t.doc.resolve(c),u=d.index();s=d.parent.canReplaceWith(u,u+1,n)}})}if(!s)return!1;if(i){let r=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[o];r.setBlockType(a,l,n,e)}i(r.scrollIntoView())}return!0}}function ml(...n){return function(e,t,i){for(let s=0;s<n.length;s++)if(n[s](e,t,i))return!0;return!1}}ml(ul,Vp,qp);ml(ul,Up,Jp);ml(Gp,Xp,Qp,zM);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function $M(n,e=null){return function(t,i){let{$from:s,$to:r}=t.selection,o=s.blockRange(r);if(!o)return!1;let a=i?t.tr:null;return HM(a,o,n,e)?(i&&i(a.scrollIntoView()),!0):!1}}function HM(n,e,t,i=null){let s=!1,r=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);r=new vr(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new vr(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let a=el(r,t,i,e);return a?(n&&VM(n,e,a,s,t),!0):!1}function VM(n,e,t,i,s){let r=T.empty;for(let d=t.length-1;d>=0;d--)r=T.from(t[d].type.create(t[d].attrs,r));n.step(new Se(e.start-(i?2:0),e.end,e.start,e.end,new I(r,0,0),t.length,!0));let o=0;for(let d=0;d<t.length;d++)t[d].type==s&&(o=d+1);let a=t.length-o,l=e.start+t.length-(i?2:0),c=e.parent;for(let d=e.startIndex,u=e.endIndex,h=!0;d<u;d++,h=!1)!h&&rn(n.doc,l,a)&&(n.split(l,a),l+=2*a),l+=c.child(d).nodeSize;return n}function YM(n){return function(e,t){let{$from:i,$to:s}=e.selection,r=i.blockRange(s,o=>o.childCount>0&&o.firstChild.type==n);return r?t?i.node(r.depth-1).type==n?qM(e,t,n,r):KM(e,t,r):!0:!1}}function qM(n,e,t,i){let s=n.tr,r=i.end,o=i.$to.end(i.depth);r<o&&(s.step(new Se(r-1,o,r,o,new I(T.from(t.create(null,i.parent.copy())),1,0),1,!0)),i=new vr(s.doc.resolve(i.$from.pos),s.doc.resolve(o),i.depth));const a=Bi(i);if(a==null)return!1;s.lift(i,a);let l=s.doc.resolve(s.mapping.map(r,-1)-1);return Nn(s.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&s.join(l.pos),e(s.scrollIntoView()),!0}function KM(n,e,t){let i=n.tr,s=t.parent;for(let f=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)f-=s.child(p).nodeSize,i.delete(f-1,f+1);let r=i.doc.resolve(t.start),o=r.nodeAfter;if(i.mapping.map(t.end)!=t.start+r.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==s.childCount,c=r.node(-1),d=r.index(-1);if(!c.canReplace(d+(a?0:1),d+1,o.content.append(l?T.empty:T.from(s))))return!1;let u=r.pos,h=u+o.nodeSize;return i.step(new Se(u-(a?1:0),h+(l?1:0),u+1,h-1,new I((a?T.empty:T.from(s.copy(T.empty))).append(l?T.empty:T.from(s.copy(T.empty))),a?0:1,l?0:1),a?0:1)),e(i.scrollIntoView()),!0}function UM(n){return function(e,t){let{$from:i,$to:s}=e.selection,r=i.blockRange(s,c=>c.childCount>0&&c.firstChild.type==n);if(!r)return!1;let o=r.startIndex;if(o==0)return!1;let a=r.parent,l=a.child(o-1);if(l.type!=n)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,d=T.from(c?n.create():null),u=new I(T.from(n.create(null,T.from(a.type.create(null,d)))),c?3:1,0),h=r.start,f=r.end;t(e.tr.step(new Se(h-(c?3:1),f,h,f,u,1,!0)).scrollIntoView())}return!0}}function eo(n){const{state:e,transaction:t}=n;let{selection:i}=t,{doc:s}=t,{storedMarks:r}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return r},get selection(){return i},get doc(){return s},get tr(){return i=t.selection,s=t.doc,r=t.storedMarks,t}}}class to{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:i}=this,{view:s}=t,{tr:r}=i,o=this.buildProps(r);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...d)=>{const u=l(...d)(o);return!r.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(r),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:i,editor:s,state:r}=this,{view:o}=s,a=[],l=!!e,c=e||r.tr,d=()=>(!l&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),a.every(h=>h===!0)),u={...Object.fromEntries(Object.entries(i).map(([h,f])=>[h,(...m)=>{const g=this.buildProps(c,t),y=f(...m)(g);return a.push(y),u}])),run:d};return u}createCan(e){const{rawCommands:t,state:i}=this,s=!1,r=e||i.tr,o=this.buildProps(r,s);return{...Object.fromEntries(Object.entries(t).map(([l,c])=>[l,(...d)=>c(...d)({...o,dispatch:void 0})])),chain:()=>this.createChain(r,s)}}buildProps(e,t=!0){const{rawCommands:i,editor:s,state:r}=this,{view:o}=s,a={tr:e,editor:s,view:o,state:eo({state:r,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(i).map(([l,c])=>[l,(...d)=>c(...d)(a)]))}};return a}}class JM{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const i=this.callbacks[e];return i&&i.forEach(s=>s.apply(this,t)),this}off(e,t){const i=this.callbacks[e];return i&&(t?this.callbacks[e]=i.filter(s=>s!==t):delete this.callbacks[e]),this}once(e,t){const i=(...s)=>{this.off(e,i),t.apply(this,s)};return this.on(e,i)}removeAllListeners(){this.callbacks={}}}function z(n,e,t){return n.config[e]===void 0&&n.parent?z(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?z(n.parent,e,t):null}):n.config[e]}function no(n){const e=n.filter(s=>s.type==="extension"),t=n.filter(s=>s.type==="node"),i=n.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:i}}function tm(n){const e=[],{nodeExtensions:t,markExtensions:i}=no(n),s=[...t,...i],r={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:s},l=z(o,"addGlobalAttributes",a);if(!l)return;l().forEach(d=>{d.types.forEach(u=>{Object.entries(d.attributes).forEach(([h,f])=>{e.push({type:u,name:h,attribute:{...r,...f}})})})})}),s.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=z(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([d,u])=>{const h={...r,...u};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:o.name,name:d,attribute:h})})}),e}function Oe(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function He(...n){return n.filter(e=>!!e).reduce((e,t)=>{const i={...e};return Object.entries(t).forEach(([s,r])=>{if(!i[s]){i[s]=r;return}if(s==="class"){const a=r?String(r).split(" "):[],l=i[s]?i[s].split(" "):[],c=a.filter(d=>!l.includes(d));i[s]=[...l,...c].join(" ")}else if(s==="style"){const a=r?r.split(";").map(d=>d.trim()).filter(Boolean):[],l=i[s]?i[s].split(";").map(d=>d.trim()).filter(Boolean):[],c=new Map;l.forEach(d=>{const[u,h]=d.split(":").map(f=>f.trim());c.set(u,h)}),a.forEach(d=>{const[u,h]=d.split(":").map(f=>f.trim());c.set(u,h)}),i[s]=Array.from(c.entries()).map(([d,u])=>`${d}: ${u}`).join("; ")}else i[s]=r}),i},{})}function Ca(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,i)=>He(t,i),{})}function nm(n){return typeof n=="function"}function U(n,e=void 0,...t){return nm(n)?e?n.bind(e)(...t):n(...t):n}function GM(n={}){return Object.keys(n).length===0&&n.constructor===Object}function XM(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function hd(n,e){return"style"in n?n:{...n,getAttrs:t=>{const i=n.getAttrs?n.getAttrs(t):n.attrs;if(i===!1)return!1;const s=e.reduce((r,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):XM(t.getAttribute(o.name));return a==null?r:{...r,[o.name]:a}},{});return{...i,...s}}}}function fd(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&GM(t)?!1:t!=null))}function QM(n,e){var t;const i=tm(n),{nodeExtensions:s,markExtensions:r}=no(n),o=(t=s.find(c=>z(c,"topNode")))===null||t===void 0?void 0:t.name,a=Object.fromEntries(s.map(c=>{const d=i.filter(y=>y.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=n.reduce((y,S)=>{const _=z(S,"extendNodeSchema",u);return{...y,..._?_(c):{}}},{}),f=fd({...h,content:U(z(c,"content",u)),marks:U(z(c,"marks",u)),group:U(z(c,"group",u)),inline:U(z(c,"inline",u)),atom:U(z(c,"atom",u)),selectable:U(z(c,"selectable",u)),draggable:U(z(c,"draggable",u)),code:U(z(c,"code",u)),whitespace:U(z(c,"whitespace",u)),linebreakReplacement:U(z(c,"linebreakReplacement",u)),defining:U(z(c,"defining",u)),isolating:U(z(c,"isolating",u)),attrs:Object.fromEntries(d.map(y=>{var S;return[y.name,{default:(S=y?.attribute)===null||S===void 0?void 0:S.default}]}))}),p=U(z(c,"parseHTML",u));p&&(f.parseDOM=p.map(y=>hd(y,d)));const m=z(c,"renderHTML",u);m&&(f.toDOM=y=>m({node:y,HTMLAttributes:Ca(y,d)}));const g=z(c,"renderText",u);return g&&(f.toText=g),[c.name,f]})),l=Object.fromEntries(r.map(c=>{const d=i.filter(g=>g.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=n.reduce((g,y)=>{const S=z(y,"extendMarkSchema",u);return{...g,...S?S(c):{}}},{}),f=fd({...h,inclusive:U(z(c,"inclusive",u)),excludes:U(z(c,"excludes",u)),group:U(z(c,"group",u)),spanning:U(z(c,"spanning",u)),code:U(z(c,"code",u)),attrs:Object.fromEntries(d.map(g=>{var y;return[g.name,{default:(y=g?.attribute)===null||y===void 0?void 0:y.default}]}))}),p=U(z(c,"parseHTML",u));p&&(f.parseDOM=p.map(g=>hd(g,d)));const m=z(c,"renderHTML",u);return m&&(f.toDOM=g=>m({mark:g,HTMLAttributes:Ca(g,d)})),[c.name,f]}));return new Hf({topNode:o,nodes:a,marks:l})}function Wo(n,e){return e.nodes[n]||e.marks[n]||null}function pd(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function gl(n,e){const t=ai.fromSchema(e).serializeFragment(n),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(t),s.innerHTML}const ZM=(n,e=500)=>{let t="";const i=n.parentOffset;return n.parent.nodesBetween(Math.max(0,i-e),i,(s,r,o,a)=>{var l,c;const d=((c=(l=s.type.spec).toText)===null||c===void 0?void 0:c.call(l,{node:s,pos:r,parent:o,index:a}))||s.textContent||"%leaf%";t+=s.isAtom&&!s.isText?d:d.slice(0,Math.max(0,i-r))}),t};function bl(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class io{constructor(e){this.find=e.find,this.handler=e.handler}}const eC=(n,e)=>{if(bl(e))return e.exec(n);const t=e(n);if(!t)return null;const i=[t.text];return i.index=t.index,i.input=n,i.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),i.push(t.replaceWith)),i};function Js(n){var e;const{editor:t,from:i,to:s,text:r,rules:o,plugin:a}=n,{view:l}=t;if(l.composing)return!1;const c=l.state.doc.resolve(i);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(h=>h.type.spec.code))return!1;let d=!1;const u=ZM(c)+r;return o.forEach(h=>{if(d)return;const f=eC(u,h.find);if(!f)return;const p=l.state.tr,m=eo({state:l.state,transaction:p}),g={from:i-(f[0].length-r.length),to:s},{commands:y,chain:S,can:_}=new to({editor:t,state:m});h.handler({state:m,range:g,match:f,commands:y,chain:S,can:_})===null||!p.steps.length||(p.setMeta(a,{transform:p,from:i,to:s,text:r}),l.dispatch(p),d=!0)}),d}function tC(n){const{editor:e,rules:t}=n,i=new Ze({state:{init(){return null},apply(s,r,o){const a=s.getMeta(i);if(a)return a;const l=s.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:d}=l;typeof d=="string"?d=d:d=gl(T.from(d),o.schema);const{from:u}=l,h=u+d.length;Js({editor:e,from:u,to:h,text:d,rules:t,plugin:i})}),s.selectionSet||s.docChanged?null:r}},props:{handleTextInput(s,r,o,a){return Js({editor:e,from:r,to:o,text:a,rules:t,plugin:i})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:r}=s.state.selection;r&&Js({editor:e,from:r.pos,to:r.pos,text:"",rules:t,plugin:i})}),!1)},handleKeyDown(s,r){if(r.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?Js({editor:e,from:o.pos,to:o.pos,text:`
|
|
11
|
+
`,rules:t,plugin:i}):!1}},isInputRules:!0});return i}function nC(n){return Object.prototype.toString.call(n).slice(8,-1)}function Gs(n){return nC(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function so(n,e){const t={...n};return Gs(n)&&Gs(e)&&Object.keys(e).forEach(i=>{Gs(e[i])&&Gs(n[i])?t[i]=so(n[i],e[i]):t[i]=e[i]}),t}class Dn{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=U(z(this,"addOptions",{name:this.name}))),this.storage=U(z(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Dn(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>so(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Dn(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=U(z(t,"addOptions",{name:t.name})),t.storage=U(z(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:i}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(c=>c?.type.name===t.name))return!1;const l=o.find(c=>c?.type.name===t.name);return l&&i.removeStoredMark(l),i.insertText(" ",s.pos),e.view.dispatch(i),!0}return!1}}function iC(n){return typeof n=="number"}class sC{constructor(e){this.find=e.find,this.handler=e.handler}}const rC=(n,e,t)=>{if(bl(e))return[...n.matchAll(e)];const i=e(n,t);return i?i.map(s=>{const r=[s.text];return r.index=s.index,r.input=n,r.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),r.push(s.replaceWith)),r}):[]};function oC(n){const{editor:e,state:t,from:i,to:s,rule:r,pasteEvent:o,dropEvent:a}=n,{commands:l,chain:c,can:d}=new to({editor:e,state:t}),u=[];return t.doc.nodesBetween(i,s,(f,p)=>{if(!f.isTextblock||f.type.spec.code)return;const m=Math.max(i,p),g=Math.min(s,p+f.content.size),y=f.textBetween(m-p,g-p,void 0,"");rC(y,r.find,o).forEach(_=>{if(_.index===void 0)return;const k=m+_.index+1,v=k+_[0].length,w={from:t.tr.mapping.map(k),to:t.tr.mapping.map(v)},M=r.handler({state:t,range:w,match:_,commands:l,chain:c,can:d,pasteEvent:o,dropEvent:a});u.push(M)})}),u.every(f=>f!==null)}let Xs=null;const aC=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function lC(n){const{editor:e,rules:t}=n;let i=null,s=!1,r=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:d,from:u,to:h,rule:f,pasteEvt:p})=>{const m=d.tr,g=eo({state:d,transaction:m});if(!(!oC({editor:e,state:g,from:Math.max(u-1,0),to:h.b-1,rule:f,pasteEvent:p,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return t.map(d=>new Ze({view(u){const h=p=>{var m;i=!((m=u.dom.parentElement)===null||m===void 0)&&m.contains(p.target)?u.dom.parentElement:null,i&&(Xs=e)},f=()=>{Xs&&(Xs=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(u,h)=>{if(r=i===u.dom.parentElement,a=h,!r){const f=Xs;f?.isEditable&&setTimeout(()=>{const p=f.state.selection;p&&f.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(u,h)=>{var f;const p=(f=h.clipboardData)===null||f===void 0?void 0:f.getData("text/html");return o=h,s=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(u,h,f)=>{const p=u[0],m=p.getMeta("uiEvent")==="paste"&&!s,g=p.getMeta("uiEvent")==="drop"&&!r,y=p.getMeta("applyPasteRules"),S=!!y;if(!m&&!g&&!S)return;if(S){let{text:v}=y;typeof v=="string"?v=v:v=gl(T.from(v),f.schema);const{from:w}=y,M=w+v.length,C=aC(v);return l({rule:d,state:f,from:w,to:{b:M},pasteEvt:C})}const _=h.doc.content.findDiffStart(f.doc.content),k=h.doc.content.findDiffEnd(f.doc.content);if(!(!iC(_)||!k||_===k.b))return l({rule:d,state:f,from:_,to:k,pasteEvt:o})}}))}function cC(n){const e=n.filter((t,i)=>n.indexOf(t)!==i);return Array.from(new Set(e))}class wi{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=wi.resolve(e),this.schema=QM(this.extensions,t),this.setupExtensions()}static resolve(e){const t=wi.sort(wi.flatten(e)),i=cC(t.map(s=>s.name));return i.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${i.map(s=>`'${s}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const i={name:t.name,options:t.options,storage:t.storage},s=z(t,"addExtensions",i);return s?[t,...this.flatten(s())]:t}).flat(10)}static sort(e){return e.sort((i,s)=>{const r=z(i,"priority")||100,o=z(s,"priority")||100;return r>o?-1:r<o?1:0})}get commands(){return this.extensions.reduce((e,t)=>{const i={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:Wo(t.name,this.schema)},s=z(t,"addCommands",i);return s?{...e,...s()}:e},{})}get plugins(){const{editor:e}=this,t=wi.sort([...this.extensions].reverse()),i=[],s=[],r=t.map(o=>{const a={name:o.name,options:o.options,storage:o.storage,editor:e,type:Wo(o.name,this.schema)},l=[],c=z(o,"addKeyboardShortcuts",a);let d={};if(o.type==="mark"&&z(o,"exitable",a)&&(d.ArrowRight=()=>Dn.handleExit({editor:e,mark:o})),c){const m=Object.fromEntries(Object.entries(c()).map(([g,y])=>[g,()=>y({editor:e})]));d={...d,...m}}const u=DM(d);l.push(u);const h=z(o,"addInputRules",a);pd(o,e.options.enableInputRules)&&h&&i.push(...h());const f=z(o,"addPasteRules",a);pd(o,e.options.enablePasteRules)&&f&&s.push(...f());const p=z(o,"addProseMirrorPlugins",a);if(p){const m=p();l.push(...m)}return l}).flat();return[tC({editor:e,rules:i}),...lC({editor:e,rules:s}),...r]}get attributes(){return tm(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=no(this.extensions);return Object.fromEntries(t.filter(i=>!!z(i,"addNodeView")).map(i=>{const s=this.attributes.filter(l=>l.type===i.name),r={name:i.name,options:i.options,storage:i.storage,editor:e,type:Oe(i.name,this.schema)},o=z(i,"addNodeView",r);if(!o)return[];const a=(l,c,d,u,h)=>{const f=Ca(l,s);return o()({node:l,view:c,getPos:d,decorations:u,innerDecorations:h,editor:e,extension:i,HTMLAttributes:f})};return[i.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;const i={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Wo(e.name,this.schema)};e.type==="mark"&&(!((t=U(z(e,"keepOnSplit",i)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const s=z(e,"onBeforeCreate",i),r=z(e,"onCreate",i),o=z(e,"onUpdate",i),a=z(e,"onSelectionUpdate",i),l=z(e,"onTransaction",i),c=z(e,"onFocus",i),d=z(e,"onBlur",i),u=z(e,"onDestroy",i);s&&this.editor.on("beforeCreate",s),r&&this.editor.on("create",r),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),u&&this.editor.on("destroy",u)})}}class Ve{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=U(z(this,"addOptions",{name:this.name}))),this.storage=U(z(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ve(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>so(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Ve({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=U(z(t,"addOptions",{name:t.name})),t.storage=U(z(t,"addStorage",{name:t.name,options:t.options})),t}}function im(n,e,t){const{from:i,to:s}=e,{blockSeparator:r=`
|
|
12
|
+
|
|
13
|
+
`,textSerializers:o={}}=t||{};let a="";return n.nodesBetween(i,s,(l,c,d,u)=>{var h;l.isBlock&&c>i&&(a+=r);const f=o?.[l.type.name];if(f)return d&&(a+=f({node:l,pos:c,parent:d,index:u,range:e})),!1;l.isText&&(a+=(h=l?.text)===null||h===void 0?void 0:h.slice(Math.max(i,c)-c,s-c))}),a}function sm(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const dC=Ve.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ze({key:new Vt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:i,selection:s}=e,{ranges:r}=s,o=Math.min(...r.map(d=>d.$from.pos)),a=Math.max(...r.map(d=>d.$to.pos)),l=sm(t);return im(i,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),uC=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),hC=(n=!1)=>({commands:e})=>e.setContent("",n),fC=()=>({state:n,tr:e,dispatch:t})=>{const{selection:i}=e,{ranges:s}=i;return t&&s.forEach(({$from:r,$to:o})=>{n.doc.nodesBetween(r.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:d}=e,u=c.resolve(d.map(l)),h=c.resolve(d.map(l+a.nodeSize)),f=u.blockRange(h);if(!f)return;const p=Bi(f);if(a.type.isTextblock){const{defaultType:m}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(f.start,m)}(p||p===0)&&e.lift(f,p)})}),!0},pC=n=>e=>n(e),mC=()=>({state:n,dispatch:e})=>Xp(n,e),gC=(n,e)=>({editor:t,tr:i})=>{const{state:s}=t,r=s.doc.slice(n.from,n.to);i.deleteRange(n.from,n.to);const o=i.mapping.map(e);return i.insert(o,r.content),i.setSelection(new $(i.doc.resolve(Math.max(o-1,0)))),!0},bC=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,i=t.$anchor.node();if(i.content.size>0)return!1;const s=n.selection.$anchor;for(let r=s.depth;r>0;r-=1)if(s.node(r).type===i.type){if(e){const a=s.before(r),l=s.after(r);n.delete(a,l).scrollIntoView()}return!0}return!1},yC=n=>({tr:e,state:t,dispatch:i})=>{const s=Oe(n,t.schema),r=e.selection.$anchor;for(let o=r.depth;o>0;o-=1)if(r.node(o).type===s){if(i){const l=r.before(o),c=r.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},xC=n=>({tr:e,dispatch:t})=>{const{from:i,to:s}=n;return t&&e.delete(i,s),!0},_C=()=>({state:n,dispatch:e})=>ul(n,e),kC=()=>({commands:n})=>n.keyboardShortcut("Enter"),wC=()=>({state:n,dispatch:e})=>IM(n,e);function Er(n,e,t={strict:!0}){const i=Object.keys(e);return i.length?i.every(s=>t.strict?e[s]===n[s]:bl(e[s])?e[s].test(n[s]):e[s]===n[s]):!0}function rm(n,e,t={}){return n.find(i=>i.type===e&&Er(Object.fromEntries(Object.keys(t).map(s=>[s,i.attrs[s]])),t))}function md(n,e,t={}){return!!rm(n,e,t)}function yl(n,e,t){var i;if(!n||!e)return;let s=n.parent.childAfter(n.parentOffset);if((!s.node||!s.node.marks.some(d=>d.type===e))&&(s=n.parent.childBefore(n.parentOffset)),!s.node||!s.node.marks.some(d=>d.type===e)||(t=t||((i=s.node.marks[0])===null||i===void 0?void 0:i.attrs),!rm([...s.node.marks],e,t)))return;let o=s.index,a=n.start()+s.offset,l=o+1,c=a+s.node.nodeSize;for(;o>0&&md([...n.parent.child(o-1).marks],e,t);)o-=1,a-=n.parent.child(o).nodeSize;for(;l<n.parent.childCount&&md([...n.parent.child(l).marks],e,t);)c+=n.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function An(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}const vC=(n,e={})=>({tr:t,state:i,dispatch:s})=>{const r=An(n,i.schema),{doc:o,selection:a}=t,{$from:l,from:c,to:d}=a;if(s){const u=yl(l,r,e);if(u&&u.from<=c&&u.to>=d){const h=$.create(o,u.from,u.to);t.setSelection(h)}}return!0},SC=n=>e=>{const t=typeof n=="function"?n(e):n;for(let i=0;i<t.length;i+=1)if(t[i](e))return!0;return!1};function om(n){return n instanceof $}function Kn(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function am(n,e=null){if(!e)return null;const t=q.atStart(n),i=q.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return i;const s=t.from,r=i.to;return e==="all"?$.create(n,Kn(0,s,r),Kn(n.content.size,s,r)):$.create(n,Kn(e,s,r),Kn(e,s,r))}function gd(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Ar(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function MC(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const CC=(n=null,e={})=>({editor:t,view:i,tr:s,dispatch:r})=>{e={scrollIntoView:!0,...e};const o=()=>{(Ar()||gd())&&i.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(i.focus(),MC()&&!Ar()&&!gd()&&i.dom.focus({preventScroll:!0}))})};if(i.hasFocus()&&n===null||n===!1)return!0;if(r&&n===null&&!om(t.state.selection))return o(),!0;const a=am(s.doc,n)||t.state.selection,l=t.state.selection.eq(a);return r&&(l||s.setSelection(a),l&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},OC=(n,e)=>t=>n.every((i,s)=>e(i,{...t,index:s})),DC=(n,e)=>({tr:t,commands:i})=>i.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),lm=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const i=e[t];i.nodeType===3&&i.nodeValue&&/^(\n\s\s|\n)$/.test(i.nodeValue)?n.removeChild(i):i.nodeType===1&&lm(i)}return n};function Qs(n){const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return lm(t)}function Os(n,e,t){if(n instanceof kn||n instanceof T)return n;t={slice:!0,parseOptions:{},...t};const i=typeof n=="object"&&n!==null,s=typeof n=="string";if(i)try{if(Array.isArray(n)&&n.length>0)return T.fromArray(n.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(n);return t.errorOnInvalidContent&&o.check(),o}catch(r){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",r),Os("",e,t)}if(s){if(t.errorOnInvalidContent){let o=!1,a="";const l=new Hf({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?wn.fromSchema(l).parseSlice(Qs(n),t.parseOptions):wn.fromSchema(l).parse(Qs(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const r=wn.fromSchema(e);return t.slice?r.parseSlice(Qs(n),t.parseOptions).content:r.parse(Qs(n),t.parseOptions)}return Os("",e,t)}function TC(n,e,t){const i=n.steps.length-1;if(i<e)return;const s=n.steps[i];if(!(s instanceof ve||s instanceof Se))return;const r=n.mapping.maps[i];let o=0;r.forEach((a,l,c,d)=>{o===0&&(o=d)}),n.setSelection(q.near(n.doc.resolve(o),t))}const NC=n=>!("type"in n),EC=(n,e,t)=>({tr:i,dispatch:s,editor:r})=>{var o;if(s){t={parseOptions:r.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const l=g=>{r.emit("contentError",{editor:r,error:g,disableCollaboration:()=>{r.storage.collaboration&&(r.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!r.options.enableContentCheck&&r.options.emitContentError)try{Os(e,r.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){l(g)}try{a=Os(e,r.schema,{parseOptions:c,errorOnInvalidContent:(o=t.errorOnInvalidContent)!==null&&o!==void 0?o:r.options.enableContentCheck})}catch(g){return l(g),!1}let{from:d,to:u}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,f=!0;if((NC(a)?a:[a]).forEach(g=>{g.check(),h=h?g.isText&&g.marks.length===0:!1,f=f?g.isBlock:!1}),d===u&&f){const{parent:g}=i.doc.resolve(d);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(d-=1,u+=1)}let m;if(h){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof T){let g="";e.forEach(y=>{y.text&&(g+=y.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;i.insertText(m,d,u)}else m=a,i.replaceWith(d,u,m);t.updateSelection&&TC(i,i.steps.length-1,-1),t.applyInputRules&&i.setMeta("applyInputRules",{from:d,text:m}),t.applyPasteRules&&i.setMeta("applyPasteRules",{from:d,text:m})}return!0},AC=()=>({state:n,dispatch:e})=>EM(n,e),PC=()=>({state:n,dispatch:e})=>AM(n,e),IC=()=>({state:n,dispatch:e})=>Vp(n,e),RC=()=>({state:n,dispatch:e})=>Up(n,e),zC=()=>({state:n,dispatch:e,tr:t})=>{try{const i=Ur(n.doc,n.selection.$from.pos,-1);return i==null?!1:(t.join(i,2),e&&e(t),!0)}catch{return!1}},jC=()=>({state:n,dispatch:e,tr:t})=>{try{const i=Ur(n.doc,n.selection.$from.pos,1);return i==null?!1:(t.join(i,2),e&&e(t),!0)}catch{return!1}},BC=()=>({state:n,dispatch:e})=>TM(n,e),LC=()=>({state:n,dispatch:e})=>NM(n,e);function cm(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function FC(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let i,s,r,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))i=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))r=!0;else if(/^mod$/i.test(l))Ar()||cm()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return i&&(t=`Alt-${t}`),s&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),r&&(t=`Shift-${t}`),t}const WC=n=>({editor:e,view:t,tr:i,dispatch:s})=>{const r=FC(n).split(/-(?!$)/),o=r.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:r.includes("Alt"),ctrlKey:r.includes("Ctrl"),metaKey:r.includes("Meta"),shiftKey:r.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l?.steps.forEach(c=>{const d=c.map(i.mapping);d&&s&&i.maybeStep(d)}),!0};function Ds(n,e,t={}){const{from:i,to:s,empty:r}=n.selection,o=e?Oe(e,n.schema):null,a=[];n.doc.nodesBetween(i,s,(u,h)=>{if(u.isText)return;const f=Math.max(i,h),p=Math.min(s,h+u.nodeSize);a.push({node:u,from:f,to:p})});const l=s-i,c=a.filter(u=>o?o.name===u.node.type.name:!0).filter(u=>Er(u.node.attrs,t,{strict:!1}));return r?!!c.length:c.reduce((u,h)=>u+h.to-h.from,0)>=l}const $C=(n,e={})=>({state:t,dispatch:i})=>{const s=Oe(n,t.schema);return Ds(t,s,e)?PM(t,i):!1},HC=()=>({state:n,dispatch:e})=>Qp(n,e),VC=n=>({state:e,dispatch:t})=>{const i=Oe(n,e.schema);return YM(i)(e,t)},YC=()=>({state:n,dispatch:e})=>Gp(n,e);function ro(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function bd(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((i,s)=>(t.includes(s)||(i[s]=n[s]),i),{})}const qC=(n,e)=>({tr:t,state:i,dispatch:s})=>{let r=null,o=null;const a=ro(typeof n=="string"?n:n.name,i.schema);return a?(a==="node"&&(r=Oe(n,i.schema)),a==="mark"&&(o=An(n,i.schema)),s&&t.selection.ranges.forEach(l=>{i.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,d)=>{r&&r===c.type&&t.setNodeMarkup(d,void 0,bd(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(u=>{o===u.type&&t.addMark(d,d+c.nodeSize,o.create(bd(u.attrs,e)))})})}),!0):!1},KC=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),UC=()=>({tr:n,dispatch:e})=>{if(e){const t=new ct(n.doc);n.setSelection(t)}return!0},JC=()=>({state:n,dispatch:e})=>qp(n,e),GC=()=>({state:n,dispatch:e})=>Jp(n,e),XC=()=>({state:n,dispatch:e})=>jM(n,e),QC=()=>({state:n,dispatch:e})=>FM(n,e),ZC=()=>({state:n,dispatch:e})=>LM(n,e);function Oa(n,e,t={},i={}){return Os(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:i.errorOnInvalidContent})}const eO=(n,e=!1,t={},i={})=>({editor:s,tr:r,dispatch:o,commands:a})=>{var l,c;const{doc:d}=r;if(t.preserveWhitespace!=="full"){const u=Oa(n,s.schema,t,{errorOnInvalidContent:(l=i.errorOnInvalidContent)!==null&&l!==void 0?l:s.options.enableContentCheck});return o&&r.replaceWith(0,d.content.size,u).setMeta("preventUpdate",!e),!0}return o&&r.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:d.content.size},n,{parseOptions:t,errorOnInvalidContent:(c=i.errorOnInvalidContent)!==null&&c!==void 0?c:s.options.enableContentCheck})};function dm(n,e){const t=An(e,n.schema),{from:i,to:s,empty:r}=n.selection,o=[];r?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(i,s,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function tO(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function nO(n,e){for(let t=n.depth;t>0;t-=1){const i=n.node(t);if(e(i))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:i}}}function xl(n){return e=>nO(e.$from,n)}function iO(n,e){const t={from:0,to:n.content.size};return im(n,t,e)}function sO(n,e){const t=Oe(e,n.schema),{from:i,to:s}=n.selection,r=[];n.doc.nodesBetween(i,s,a=>{r.push(a)});const o=r.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function rO(n,e){const t=ro(typeof e=="string"?e:e.name,n.schema);return t==="node"?sO(n,e):t==="mark"?dm(n,e):{}}function um(n,e,t){const i=[];return n===e?t.resolve(n).marks().forEach(s=>{const r=t.resolve(n),o=yl(r,s.type);o&&i.push({mark:s,...o})}):t.nodesBetween(n,e,(s,r)=>{!s||s?.nodeSize===void 0||i.push(...s.marks.map(o=>({from:r,to:r+s.nodeSize,mark:o})))}),i}function mr(n,e,t){return Object.fromEntries(Object.entries(t).filter(([i])=>{const s=n.find(r=>r.type===e&&r.name===i);return s?s.attribute.keepOnSplit:!1}))}function Da(n,e,t={}){const{empty:i,ranges:s}=n.selection,r=e?An(e,n.schema):null;if(i)return!!(n.storedMarks||n.selection.$from.marks()).filter(u=>r?r.name===u.type.name:!0).find(u=>Er(u.attrs,t,{strict:!1}));let o=0;const a=[];if(s.forEach(({$from:u,$to:h})=>{const f=u.pos,p=h.pos;n.doc.nodesBetween(f,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const y=Math.max(f,g),S=Math.min(p,g+m.nodeSize),_=S-y;o+=_,a.push(...m.marks.map(k=>({mark:k,from:y,to:S})))})}),o===0)return!1;const l=a.filter(u=>r?r.name===u.mark.type.name:!0).filter(u=>Er(u.mark.attrs,t,{strict:!1})).reduce((u,h)=>u+h.to-h.from,0),c=a.filter(u=>r?u.mark.type!==r&&u.mark.type.excludes(r):!0).reduce((u,h)=>u+h.to-h.from,0);return(l>0?l+c:l)>=o}function oO(n,e,t={}){if(!e)return Ds(n,null,t)||Da(n,null,t);const i=ro(e,n.schema);return i==="node"?Ds(n,e,t):i==="mark"?Da(n,e,t):!1}function yd(n,e){const{nodeExtensions:t}=no(e),i=t.find(o=>o.name===n);if(!i)return!1;const s={name:i.name,options:i.options,storage:i.storage},r=U(z(i,"group",s));return typeof r!="string"?!1:r.split(" ").includes("list")}function _l(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var i;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((i=n.text)!==null&&i!==void 0?i:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let s=!0;return n.content.forEach(r=>{s!==!1&&(_l(r,{ignoreWhitespace:t,checkChildren:e})||(s=!1))}),s}return!1}function aO(n){return n instanceof L}function lO(n,e,t){var i;const{selection:s}=e;let r=null;if(om(s)&&(r=s.$cursor),r){const a=(i=n.storedMarks)!==null&&i!==void 0?i:r.marks();return!!t.isInSet(a)||!a.some(l=>l.type.excludes(t))}const{ranges:o}=s;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,l.pos,(d,u,h)=>{if(c)return!1;if(d.isInline){const f=!h||h.type.allowsMarkType(t),p=!!t.isInSet(d.marks)||!d.marks.some(m=>m.type.excludes(t));c=f&&p}return!c}),c})}const cO=(n,e={})=>({tr:t,state:i,dispatch:s})=>{const{selection:r}=t,{empty:o,ranges:a}=r,l=An(n,i.schema);if(s)if(o){const c=dm(i,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;i.doc.nodesBetween(d,u,(h,f)=>{const p=Math.max(f,d),m=Math.min(f+h.nodeSize,u);h.marks.find(y=>y.type===l)?h.marks.forEach(y=>{l===y.type&&t.addMark(p,m,l.create({...y.attrs,...e}))}):t.addMark(p,m,l.create(e))})});return lO(i,t,l)},dO=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),uO=(n,e={})=>({state:t,dispatch:i,chain:s})=>{const r=Oe(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),r.isTextblock?s().command(({commands:a})=>ud(r,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>ud(r,{...o,...e})(a,i)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},hO=n=>({tr:e,dispatch:t})=>{if(t){const{doc:i}=e,s=Kn(n,0,i.content.size),r=L.create(i,s);e.setSelection(r)}return!0},fO=n=>({tr:e,dispatch:t})=>{if(t){const{doc:i}=e,{from:s,to:r}=typeof n=="number"?{from:n,to:n}:n,o=$.atStart(i).from,a=$.atEnd(i).to,l=Kn(s,o,a),c=Kn(r,o,a),d=$.create(i,l,c);e.setSelection(d)}return!0},pO=n=>({state:e,dispatch:t})=>{const i=Oe(n,e.schema);return UM(i)(e,t)};function xd(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const i=t.filter(s=>e?.includes(s.type.name));n.tr.ensureMarks(i)}}const mO=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:i,editor:s})=>{const{selection:r,doc:o}=e,{$from:a,$to:l}=r,c=s.extensionManager.attributes,d=mr(c,a.node().type.name,a.node().attrs);if(r instanceof L&&r.node.isBlock)return!a.parentOffset||!rn(o,a.pos)?!1:(i&&(n&&xd(t,s.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const u=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:tO(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=u&&h?[{type:h,attrs:d}]:void 0,p=rn(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!p&&rn(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(p=!0,f=h?[{type:h,attrs:d}]:void 0),i){if(p&&(r instanceof $&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),h&&!u&&!a.parentOffset&&a.parent.type!==h)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}n&&xd(t,s.extensionManager.splittableMarks),e.scrollIntoView()}return p},gO=(n,e={})=>({tr:t,state:i,dispatch:s,editor:r})=>{var o;const a=Oe(n,i.schema),{$from:l,$to:c}=i.selection,d=i.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==a)return!1;const h=r.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(s){let y=T.empty;const S=l.index(-1)?1:l.index(-2)?2:3;for(let C=l.depth-S;C>=l.depth-3;C-=1)y=T.from(l.node(C).copy(y));const _=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,k={...mr(h,l.node().type.name,l.node().attrs),...e},v=((o=a.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(k))||void 0;y=y.append(T.from(a.createAndFill(null,v)||void 0));const w=l.before(l.depth-(S-1));t.replace(w,l.after(-_),new I(y,4-S,0));let M=-1;t.doc.nodesBetween(w,t.doc.content.size,(C,O)=>{if(M>-1)return!1;C.isTextblock&&C.content.size===0&&(M=O+1)}),M>-1&&t.setSelection($.near(t.doc.resolve(M))),t.scrollIntoView()}return!0}const f=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...mr(h,u.type.name,u.attrs),...e},m={...mr(h,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,c.pos);const g=f?[{type:a,attrs:p},{type:f,attrs:m}]:[{type:a,attrs:p}];if(!rn(t.doc,l.pos,2))return!1;if(s){const{selection:y,storedMarks:S}=i,{splittableMarks:_}=r.extensionManager,k=S||y.$to.parentOffset&&y.$from.marks();if(t.split(l.pos,2,g).scrollIntoView(),!k||!s)return!0;const v=k.filter(w=>_.includes(w.type.name));t.ensureMarks(v)}return!0},$o=(n,e)=>{const t=xl(o=>o.type===e)(n.selection);if(!t)return!0;const i=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(i===void 0)return!0;const s=n.doc.nodeAt(i);return t.node.type===s?.type&&Nn(n.doc,t.pos)&&n.join(t.pos),!0},Ho=(n,e)=>{const t=xl(o=>o.type===e)(n.selection);if(!t)return!0;const i=n.doc.resolve(t.start).after(t.depth);if(i===void 0)return!0;const s=n.doc.nodeAt(i);return t.node.type===s?.type&&Nn(n.doc,i)&&n.join(i),!0},bO=(n,e,t,i={})=>({editor:s,tr:r,state:o,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:u,splittableMarks:h}=s.extensionManager,f=Oe(n,o.schema),p=Oe(e,o.schema),{selection:m,storedMarks:g}=o,{$from:y,$to:S}=m,_=y.blockRange(S),k=g||m.$to.parentOffset&&m.$from.marks();if(!_)return!1;const v=xl(w=>yd(w.type.name,u))(m);if(_.depth>=1&&v&&_.depth-v.depth<=1){if(v.node.type===f)return c.liftListItem(p);if(yd(v.node.type.name,u)&&f.validContent(v.node.content)&&a)return l().command(()=>(r.setNodeMarkup(v.pos,f),!0)).command(()=>$o(r,f)).command(()=>Ho(r,f)).run()}return!t||!k||!a?l().command(()=>d().wrapInList(f,i)?!0:c.clearNodes()).wrapInList(f,i).command(()=>$o(r,f)).command(()=>Ho(r,f)).run():l().command(()=>{const w=d().wrapInList(f,i),M=k.filter(C=>h.includes(C.type.name));return r.ensureMarks(M),w?!0:c.clearNodes()}).wrapInList(f,i).command(()=>$o(r,f)).command(()=>Ho(r,f)).run()},yO=(n,e={},t={})=>({state:i,commands:s})=>{const{extendEmptyMarkRange:r=!1}=t,o=An(n,i.schema);return Da(i,o,e)?s.unsetMark(o,{extendEmptyMarkRange:r}):s.setMark(o,e)},xO=(n,e,t={})=>({state:i,commands:s})=>{const r=Oe(n,i.schema),o=Oe(e,i.schema),a=Ds(i,r,t);let l;return i.selection.$anchor.sameParent(i.selection.$head)&&(l=i.selection.$anchor.parent.attrs),a?s.setNode(o,l):s.setNode(r,{...l,...t})},_O=(n,e={})=>({state:t,commands:i})=>{const s=Oe(n,t.schema);return Ds(t,s,e)?i.lift(s):i.wrapIn(s,e)},kO=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let i=0;i<t.length;i+=1){const s=t[i];let r;if(s.spec.isInputRules&&(r=s.getState(n))){if(e){const o=n.tr,a=r.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(r.text){const l=o.doc.resolve(r.from).marks();o.replaceWith(r.from,r.to,n.schema.text(r.text,l))}else o.delete(r.from,r.to)}return!0}}return!1},wO=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:i,ranges:s}=t;return i||e&&s.forEach(r=>{n.removeMark(r.$from.pos,r.$to.pos)}),!0},vO=(n,e={})=>({tr:t,state:i,dispatch:s})=>{var r;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=An(n,i.schema),{$from:c,empty:d,ranges:u}=a;if(!s)return!0;if(d&&o){let{from:h,to:f}=a;const p=(r=c.marks().find(g=>g.type===l))===null||r===void 0?void 0:r.attrs,m=yl(c,l,p);m&&(h=m.from,f=m.to),t.removeMark(h,f,l)}else u.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,l)});return t.removeStoredMark(l),!0},SO=(n,e={})=>({tr:t,state:i,dispatch:s})=>{let r=null,o=null;const a=ro(typeof n=="string"?n:n.name,i.schema);return a?(a==="node"&&(r=Oe(n,i.schema)),a==="mark"&&(o=An(n,i.schema)),s&&t.selection.ranges.forEach(l=>{const c=l.$from.pos,d=l.$to.pos;let u,h,f,p;t.selection.empty?i.doc.nodesBetween(c,d,(m,g)=>{r&&r===m.type&&(f=Math.max(g,c),p=Math.min(g+m.nodeSize,d),u=g,h=m)}):i.doc.nodesBetween(c,d,(m,g)=>{g<c&&r&&r===m.type&&(f=Math.max(g,c),p=Math.min(g+m.nodeSize,d),u=g,h=m),g>=c&&g<=d&&(r&&r===m.type&&t.setNodeMarkup(g,void 0,{...m.attrs,...e}),o&&m.marks.length&&m.marks.forEach(y=>{if(o===y.type){const S=Math.max(g,c),_=Math.min(g+m.nodeSize,d);t.addMark(S,_,o.create({...y.attrs,...e}))}}))}),h&&(u!==void 0&&t.setNodeMarkup(u,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(m=>{o===m.type&&t.addMark(f,p,o.create({...m.attrs,...e}))}))}),!0):!1},MO=(n,e={})=>({state:t,dispatch:i})=>{const s=Oe(n,t.schema);return WM(s,e)(t,i)},CO=(n,e={})=>({state:t,dispatch:i})=>{const s=Oe(n,t.schema);return $M(s,e)(t,i)};var OO=Object.freeze({__proto__:null,blur:uC,clearContent:hC,clearNodes:fC,command:pC,createParagraphNear:mC,cut:gC,deleteCurrentNode:bC,deleteNode:yC,deleteRange:xC,deleteSelection:_C,enter:kC,exitCode:wC,extendMarkRange:vC,first:SC,focus:CC,forEach:OC,insertContent:DC,insertContentAt:EC,joinBackward:IC,joinDown:PC,joinForward:RC,joinItemBackward:zC,joinItemForward:jC,joinTextblockBackward:BC,joinTextblockForward:LC,joinUp:AC,keyboardShortcut:WC,lift:$C,liftEmptyBlock:HC,liftListItem:VC,newlineInCode:YC,resetAttributes:qC,scrollIntoView:KC,selectAll:UC,selectNodeBackward:JC,selectNodeForward:GC,selectParentNode:XC,selectTextblockEnd:QC,selectTextblockStart:ZC,setContent:eO,setMark:cO,setMeta:dO,setNode:uO,setNodeSelection:hO,setTextSelection:fO,sinkListItem:pO,splitBlock:mO,splitListItem:gO,toggleList:bO,toggleMark:yO,toggleNode:xO,toggleWrap:_O,undoInputRule:kO,unsetAllMarks:wO,unsetMark:vO,updateAttributes:SO,wrapIn:MO,wrapInList:CO});const DO=Ve.create({name:"commands",addCommands(){return{...OO}}}),TO=Ve.create({name:"drop",addProseMirrorPlugins(){return[new Ze({key:new Vt("tiptapDrop"),props:{handleDrop:(n,e,t,i)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:i})}}})]}}),NO=Ve.create({name:"editable",addProseMirrorPlugins(){return[new Ze({key:new Vt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),EO=new Vt("focusEvents"),AO=Ve.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Ze({key:EO,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const i=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(i),!1},blur:(e,t)=>{n.isFocused=!1;const i=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(i),!1}}}})]}}),PO=Ve.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:d,$anchor:u}=l,{pos:h,parent:f}=u,p=u.parent.isTextblock&&h>0?a.doc.resolve(h-1):u,m=p.parent.type.spec.isolating,g=u.pos-u.parentOffset,y=m&&p.parent.childCount===1?g===u.pos:q.atStart(c).from===h;return!d||!f.type.isTextblock||f.textContent.length||!y||y&&u.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),i={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...i},r={...i,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ar()||cm()?r:s},addProseMirrorPlugins(){return[new Ze({key:new Vt("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(m=>m.getMeta("composition")))return;const i=n.some(m=>m.docChanged)&&!e.doc.eq(t.doc),s=n.some(m=>m.getMeta("preventClearDocument"));if(!i||s)return;const{empty:r,from:o,to:a}=e.selection,l=q.atStart(e.doc).from,c=q.atEnd(e.doc).to;if(r||!(o===l&&a===c)||!_l(t.doc))return;const h=t.tr,f=eo({state:t,transaction:h}),{commands:p}=new to({editor:this.editor,state:f});if(p.clearNodes(),!!h.steps.length)return h}})]}}),IO=Ve.create({name:"paste",addProseMirrorPlugins(){return[new Ze({key:new Vt("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),RO=Ve.create({name:"tabindex",addProseMirrorPlugins(){return[new Ze({key:new Vt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Hn{get name(){return this.node.type.name}constructor(e,t,i=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=i,this.resolvedPos=e,this.editor=t,this.currentNode=s}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,i=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,i=this.to-1}this.editor.commands.insertContentAt({from:t,to:i},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Hn(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Hn(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Hn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,i)=>{const s=t.isBlock&&!t.isTextblock,r=t.isAtom&&!t.isText,o=this.pos+i+(r?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(o);if(!s&&a.depth<=this.depth)return;const l=new Hn(a,this.editor,s,s?t:null);s&&(l.actualDepth=this.depth+1),e.push(new Hn(a,this.editor,s,s?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let i=null,s=this.parent;for(;s&&!i;){if(s.node.type.name===e)if(Object.keys(t).length>0){const r=s.node.attrs,o=Object.keys(t);for(let a=0;a<o.length;a+=1){const l=o[a];if(r[l]!==t[l])break}}else i=s;s=s.parent}return i}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},i=!1){let s=[];if(!this.children||this.children.length===0)return s;const r=Object.keys(t);return this.children.forEach(o=>{i&&s.length>0||(o.node.type.name===e&&r.every(l=>t[l]===o.node.attrs[l])&&s.push(o),!(i&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,t,i))))}),s}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}}const zO=`.ProseMirror {
|
|
14
14
|
position: relative;
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -84,12 +84,12 @@ img.ProseMirror-separator {
|
|
|
84
84
|
|
|
85
85
|
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
86
86
|
opacity: 0
|
|
87
|
-
}`;function
|
|
87
|
+
}`;function jO(n,e,t){const i=document.querySelector("style[data-tiptap-style]");if(i!==null)return i;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(s),s}class BO extends JM{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:t,slice:i,moved:s})=>this.options.onDrop(t,i,s)),this.on("paste",({event:t,slice:i})=>this.options.onPaste(t,i)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=jO(zO,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){const i=nm(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],s=this.state.reconfigure({plugins:i});return this.view.updateState(s),s}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let i=t;if([].concat(e).forEach(r=>{const o=typeof r=="string"?`${r}$`:r.key;i=i.filter(a=>!a.key.startsWith(o))}),t.length===i.length)return;const s=this.state.reconfigure({plugins:i});return this.view.updateState(s),s}createExtensionManager(){var e,t;const s=[...this.options.enableCoreExtensions?[NO,dC.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),DO,AO,PO,RO,TO,IO].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r?.type));this.extensionManager=new wi(s,this)}createCommandManager(){this.commandManager=new to({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=Oa(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(o){if(!(o instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(o.message))throw o;this.emit("contentError",{editor:this,error:o,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(a=>a.name!=="collaboration"),this.createExtensionManager()}}),t=Oa(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const i=am(t,this.options.autofocus);this.view=new Wp(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:ki.create({doc:t,selection:i||void 0})});const s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.createNodeViews(),this.prependClass();const r=this.view.dom;r.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(o)});return}const t=this.state.apply(e),i=!this.state.selection.eq(t.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),i&&this.emit("selectionUpdate",{editor:this,transaction:e});const s=e.getMeta("focus"),r=e.getMeta("blur");s&&this.emit("focus",{editor:this,event:s.event,transaction:e}),r&&this.emit("blur",{editor:this,event:r.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return rO(this.state,e)}isActive(e,t){const i=typeof e=="string"?e:null,s=typeof e=="string"?t:e;return oO(this.state,i,s)}getJSON(){return this.state.doc.toJSON()}getHTML(){return gl(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
|
|
88
88
|
|
|
89
|
-
`,textSerializers:s={}}=e||{};return GC(this.state.doc,{blockSeparator:t,textSerializers:{...tm(this.schema),...s}})}get isEmpty(){return bl(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,t){var s;return((s=this.$doc)===null||s===void 0?void 0:s.querySelector(e,t))||null}$nodes(e,t){var s;return((s=this.$doc)===null||s===void 0?void 0:s.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new $n(t,this)}get $doc(){return this.$pos(0)}}function Es(n){return new to({find:n.find,handler:({state:e,range:t,match:s})=>{const i=U(n.getAttributes,void 0,s);if(i===!1||i===null)return null;const{tr:r}=e,o=s[s.length-1],a=s[0];if(o){const l=a.search(/\S/),c=t.from+a.indexOf(o),d=c+o.length;if(lm(t.from,t.to,e.doc).filter(f=>f.mark.type.excluded.find(m=>m===n.type&&m!==f.mark.type)).filter(f=>f.to>c).length)return null;d<t.to&&r.delete(d,t.to),c>t.from&&r.delete(t.from+l,c);const h=t.from+l+o.length;r.addMark(t.from+l,h,n.type.create(i||{})),r.removeStoredMark(n.type)}}})}function AO(n){return new to({find:n.find,handler:({state:e,range:t,match:s})=>{const i=U(n.getAttributes,void 0,s)||{},{tr:r}=e,o=t.from;let a=t.to;const l=n.type.create(i);if(s[1]){const c=s[0].lastIndexOf(s[1]);let d=o+c;d>a?d=a:a=d+s[1].length;const u=s[0][s[0].length-1];r.insertText(u,o+s[0].length-1),r.replaceWith(d,a,l)}else if(s[0]){const c=n.type.isInline?o:o-1;r.insert(c,n.type.create(i)).delete(r.mapping.map(o),r.mapping.map(a))}r.scrollIntoView()}})}function Oa(n){return new to({find:n.find,handler:({state:e,range:t,match:s})=>{const i=e.doc.resolve(t.from),r=U(n.getAttributes,void 0,s)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,r)}})}function Oi(n){return new to({find:n.find,handler:({state:e,range:t,match:s,chain:i})=>{const r=U(n.getAttributes,void 0,s)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),c=l&&Qa(l,n.type,r);if(!c)return null;if(o.wrap(l,c),n.keepMarks&&n.editor){const{selection:u,storedMarks:h}=e,{splittableMarks:f}=n.editor.extensionManager,p=h||u.$to.parentOffset&&u.$from.marks();if(p){const m=p.filter(g=>f.includes(g.type.name));o.ensureMarks(m)}}if(n.keepAttributes){const u=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(u,r).run()}const d=o.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&Tn(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(s,d))&&o.join(t.from-1)}})}class Qe{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=U(z(this,"addOptions",{name:this.name}))),this.storage=U(z(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Qe(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>no(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Qe(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=U(z(t,"addOptions",{name:t.name})),t.storage=U(z(t,"addStorage",{name:t.name,options:t.options})),t}}function As(n){return new XM({find:n.find,handler:({state:e,range:t,match:s,pasteEvent:i})=>{const r=U(n.getAttributes,void 0,s,i);if(r===!1||r===null)return null;const{tr:o}=e,a=s[s.length-1],l=s[0];let c=t.to;if(a){const d=l.search(/\S/),u=t.from+l.indexOf(a),h=u+a.length;if(lm(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>u).length)return null;h<t.to&&o.delete(h,t.to),u>t.from&&o.delete(t.from+d,u),c=t.from+d+a.length,o.addMark(t.from+d,c,n.type.create(r||{})),o.removeStoredMark(n.type)}}})}function PO(n,e){const{selection:t}=n,{$from:s}=t;if(t instanceof L){const r=s.index();return s.parent.canReplaceWith(r,r+1,e)}let i=s.depth;for(;i>=0;){const r=s.index(i);if(s.node(i).contentMatchAt(r).matchType(e))return!0;i-=1}return!1}function IO(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Da={exports:{}},$o={};var bd;function RO(){if(bd)return $o;bd=1;var n=x;function e(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var t=typeof Object.is=="function"?Object.is:e,s=n.useState,i=n.useEffect,r=n.useLayoutEffect,o=n.useDebugValue;function a(u,h){var f=h(),p=s({inst:{value:f,getSnapshot:h}}),m=p[0].inst,g=p[1];return r(function(){m.value=f,m.getSnapshot=h,l(m)&&g({inst:m})},[u,f,h]),i(function(){return l(m)&&g({inst:m}),u(function(){l(m)&&g({inst:m})})},[u]),o(f),f}function l(u){var h=u.getSnapshot;u=u.value;try{var f=h();return!t(u,f)}catch{return!0}}function c(u,h){return h()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return $o.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:d,$o}var Ho={};var xd;function zO(){return xd||(xd=1,process.env.NODE_ENV!=="production"&&(function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=x,e=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function t(_){{for(var k=arguments.length,v=new Array(k>1?k-1:0),w=1;w<k;w++)v[w-1]=arguments[w];s("error",_,v)}}function s(_,k,v){{var w=e.ReactDebugCurrentFrame,M=w.getStackAddendum();M!==""&&(k+="%s",v=v.concat([M]));var C=v.map(function(O){return String(O)});C.unshift("Warning: "+k),Function.prototype.apply.call(console[_],console,C)}}function i(_,k){return _===k&&(_!==0||1/_===1/k)||_!==_&&k!==k}var r=typeof Object.is=="function"?Object.is:i,o=n.useState,a=n.useEffect,l=n.useLayoutEffect,c=n.useDebugValue,d=!1,u=!1;function h(_,k,v){d||n.startTransition!==void 0&&(d=!0,t("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var w=k();if(!u){var M=k();r(w,M)||(t("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}var C=o({inst:{value:w,getSnapshot:k}}),O=C[0].inst,D=C[1];return l(function(){O.value=w,O.getSnapshot=k,f(O)&&D({inst:O})},[_,w,k]),a(function(){f(O)&&D({inst:O});var A=function(){f(O)&&D({inst:O})};return _(A)},[_]),c(w),w}function f(_){var k=_.getSnapshot,v=_.value;try{var w=k();return!r(v,w)}catch{return!0}}function p(_,k,v){return k()}var m=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",g=!m,b=g?p:h,S=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:b;Ho.useSyncExternalStore=S,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)})()),Ho}process.env.NODE_ENV==="production"?Da.exports=RO():Da.exports=zO();var io=Da.exports;const BO=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},jO=({contentComponent:n})=>{const e=io.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return x.createElement(x.Fragment,null,Object.values(e))};function LO(){const n=new Set;let e={};return{subscribe(t){return n.add(t),()=>{n.delete(t)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(t,s){e={...e,[t]:qu.createPortal(s.reactElement,s.element,t)},n.forEach(i=>i())},removeRenderer(t){const s={...e};delete s[t],e=s,n.forEach(i=>i())}}}class FO extends x.Component{constructor(e){var t;super(e),this.editorContentRef=x.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((t=e.editor)===null||t===void 0)&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.options.element.childNodes),e.setOptions({element:t}),e.contentComponent=LO(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(s=>s.hasContentComponentInitialized?s:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;const t=document.createElement("div");t.append(...e.options.element.childNodes),e.setOptions({element:t})}render(){const{editor:e,innerRef:t,...s}=this.props;return x.createElement(x.Fragment,null,x.createElement("div",{ref:BO(t,this.editorContentRef),...s}),e?.contentComponent&&x.createElement(jO,{contentComponent:e.contentComponent}))}}const WO=x.forwardRef((n,e)=>{const t=x.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return x.createElement(FO,{key:t,innerRef:e,...n})}),$O=x.memo(WO);var HO=function n(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var s,i,r;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(i=s;i--!==0;)if(!n(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;for(i of e.entries())if(!n(i[1],t.get(i[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(s=e.length,s!=t.length)return!1;for(i=s;i--!==0;)if(e[i]!==t[i])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(r=Object.keys(e),s=r.length,s!==Object.keys(t).length)return!1;for(i=s;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[i]))return!1;for(i=s;i--!==0;){var o=r[i];if(!(o==="_owner"&&e.$$typeof)&&!n(e[o],t[o]))return!1}return!0}return e!==e&&t!==t},VO=IO(HO),Ta={exports:{}},Vo={};var _d;function YO(){if(_d)return Vo;_d=1;var n=x,e=io;function t(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var s=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,r=n.useRef,o=n.useEffect,a=n.useMemo,l=n.useDebugValue;return Vo.useSyncExternalStoreWithSelector=function(c,d,u,h,f){var p=r(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function b(w){if(!S){if(S=!0,_=w,w=h(w),f!==void 0&&m.hasValue){var M=m.value;if(f(M,w))return k=M}return k=w}if(M=k,s(_,w))return M;var C=h(w);return f!==void 0&&f(M,C)?M:(_=w,k=C)}var S=!1,_,k,v=u===void 0?null:u;return[function(){return b(d())},v===null?void 0:function(){return b(v())}]},[d,u,h,f]);var g=i(c,p[0],p[1]);return o(function(){m.hasValue=!0,m.value=g},[g]),l(g),g},Vo}var Yo={};var kd;function qO(){return kd||(kd=1,process.env.NODE_ENV!=="production"&&(function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=x,e=io;function t(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}var s=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,r=n.useRef,o=n.useEffect,a=n.useMemo,l=n.useDebugValue;function c(d,u,h,f,p){var m=r(null),g;m.current===null?(g={hasValue:!1,value:null},m.current=g):g=m.current;var b=a(function(){var v=!1,w,M,C=function(P){if(!v){v=!0,w=P;var F=f(P);if(p!==void 0&&g.hasValue){var j=g.value;if(p(j,F))return M=j,j}return M=F,F}var H=w,K=M;if(s(H,P))return K;var G=f(P);return p!==void 0&&p(K,G)?K:(w=P,M=G,G)},O=h===void 0?null:h,D=function(){return C(u())},A=O===null?void 0:function(){return C(O())};return[D,A]},[u,h,f,p]),S=b[0],_=b[1],k=i(d,S,_);return o(function(){g.hasValue=!0,g.value=k},[k]),l(k),k}Yo.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)})()),Yo}process.env.NODE_ENV==="production"?Ta.exports=YO():Ta.exports=qO();var KO=Ta.exports;const UO=typeof window<"u"?x.useLayoutEffect:x.useEffect;class JO{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const t=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},s=this.editor;return s.on("transaction",t),()=>{s.off("transaction",t)}}}}function GO(n){var e;const[t]=x.useState(()=>new JO(n.editor)),s=KO.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!==null&&e!==void 0?e:VO);return UO(()=>t.watch(n.editor),[n.editor,t]),x.useDebugValue(s),s}const wd=process.env.NODE_ENV!=="production",Na=typeof window>"u",XO=Na||!!(typeof window<"u"&&window.next);class xl{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(t=>t())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0)return Na||XO?(wd&&console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."),null):this.createEditor();if(this.options.current.immediatelyRender&&Na&&wd)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...s)=>{var i,r;return(r=(i=this.options.current).onBeforeCreate)===null||r===void 0?void 0:r.call(i,...s)},onBlur:(...s)=>{var i,r;return(r=(i=this.options.current).onBlur)===null||r===void 0?void 0:r.call(i,...s)},onCreate:(...s)=>{var i,r;return(r=(i=this.options.current).onCreate)===null||r===void 0?void 0:r.call(i,...s)},onDestroy:(...s)=>{var i,r;return(r=(i=this.options.current).onDestroy)===null||r===void 0?void 0:r.call(i,...s)},onFocus:(...s)=>{var i,r;return(r=(i=this.options.current).onFocus)===null||r===void 0?void 0:r.call(i,...s)},onSelectionUpdate:(...s)=>{var i,r;return(r=(i=this.options.current).onSelectionUpdate)===null||r===void 0?void 0:r.call(i,...s)},onTransaction:(...s)=>{var i,r;return(r=(i=this.options.current).onTransaction)===null||r===void 0?void 0:r.call(i,...s)},onUpdate:(...s)=>{var i,r;return(r=(i=this.options.current).onUpdate)===null||r===void 0?void 0:r.call(i,...s)},onContentError:(...s)=>{var i,r;return(r=(i=this.options.current).onContentError)===null||r===void 0?void 0:r.call(i,...s)},onDrop:(...s)=>{var i,r;return(r=(i=this.options.current).onDrop)===null||r===void 0?void 0:r.call(i,...s)},onPaste:(...s)=>{var i,r;return(r=(i=this.options.current).onPaste)===null||r===void 0?void 0:r.call(i,...s)}};return new EO(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(s=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(s)?!0:s==="extensions"&&e.extensions&&t.extensions?e.extensions.length!==t.extensions.length?!1:e.extensions.every((i,r)=>{var o;return i===((o=t.extensions)===null||o===void 0?void 0:o[r])}):e[s]===t[s])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?xl.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((s,i)=>s===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function QO(n={},e=[]){const t=x.useRef(n);t.current=n;const[s]=x.useState(()=>new xl(t)),i=io.useSyncExternalStore(s.subscribe,s.getEditor,s.getServerSnapshot);return x.useDebugValue(i),x.useEffect(s.onRender(e)),GO({editor:i,selector:({transactionNumber:r})=>n.shouldRerenderOnTransaction===!1?null:n.immediatelyRender&&r===0?0:r+1}),i}const ZO=x.createContext({editor:null});ZO.Consumer;const eD=x.createContext({onDragStart:void 0}),tD=()=>x.useContext(eD);x.forwardRef((n,e)=>{const{onDragStart:t}=tD(),s=n.as||"div";return x.createElement(s,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});const nD=/^\s*>\s$/,sD=Qe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",He(this.options.HTMLAttributes,n),0]},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Oi({find:nD,type:this.type})]}}),iD=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,rD=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,oD=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,aD=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,lD=On.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",He(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Es({find:iD,type:this.type}),Es({find:oD,type:this.type})]},addPasteRules(){return[As({find:rD,type:this.type}),As({find:aD,type:this.type})]}}),cD="listItem",vd="textStyle",Sd=/^\s*([-+*])\s$/,dD=Qe.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",He(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(cD,this.editor.getAttributes(vd)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Oi({find:Sd,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Oi({find:Sd,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(vd),editor:this.editor})),[n]}}),uD=/(^|[^`])`([^`]+)`(?!`)/,hD=/(^|[^`])`([^`]+)`(?!`)/g,fD=On.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",He(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Es({find:uD,type:this.type})]},addPasteRules(){return[As({find:hD,type:this.type})]}}),pD=/^```([a-z]+)?[\s\n]$/,mD=/^~~~([a-z]+)?[\s\n]$/,gD=Qe.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options,r=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return r||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",He(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:s,empty:i}=t;if(!i||s.parent.type!==this.type)return!1;const r=s.parentOffset===s.parent.nodeSize-2,o=s.parent.textContent.endsWith(`
|
|
89
|
+
`,textSerializers:i={}}=e||{};return iO(this.state.doc,{blockSeparator:t,textSerializers:{...sm(this.schema),...i}})}get isEmpty(){return _l(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,t){var i;return((i=this.$doc)===null||i===void 0?void 0:i.querySelector(e,t))||null}$nodes(e,t){var i;return((i=this.$doc)===null||i===void 0?void 0:i.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new Hn(t,this)}get $doc(){return this.$pos(0)}}function Ai(n){return new io({find:n.find,handler:({state:e,range:t,match:i})=>{const s=U(n.getAttributes,void 0,i);if(s===!1||s===null)return null;const{tr:r}=e,o=i[i.length-1],a=i[0];if(o){const l=a.search(/\S/),c=t.from+a.indexOf(o),d=c+o.length;if(um(t.from,t.to,e.doc).filter(f=>f.mark.type.excluded.find(m=>m===n.type&&m!==f.mark.type)).filter(f=>f.to>c).length)return null;d<t.to&&r.delete(d,t.to),c>t.from&&r.delete(t.from+l,c);const h=t.from+l+o.length;r.addMark(t.from+l,h,n.type.create(s||{})),r.removeStoredMark(n.type)}}})}function LO(n){return new io({find:n.find,handler:({state:e,range:t,match:i})=>{const s=U(n.getAttributes,void 0,i)||{},{tr:r}=e,o=t.from;let a=t.to;const l=n.type.create(s);if(i[1]){const c=i[0].lastIndexOf(i[1]);let d=o+c;d>a?d=a:a=d+i[1].length;const u=i[0][i[0].length-1];r.insertText(u,o+i[0].length-1),r.replaceWith(d,a,l)}else if(i[0]){const c=n.type.isInline?o:o-1;r.insert(c,n.type.create(s)).delete(r.mapping.map(o),r.mapping.map(a))}r.scrollIntoView()}})}function Ta(n){return new io({find:n.find,handler:({state:e,range:t,match:i})=>{const s=e.doc.resolve(t.from),r=U(n.getAttributes,void 0,i)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,r)}})}function Ts(n){return new io({find:n.find,handler:({state:e,range:t,match:i,chain:s})=>{const r=U(n.getAttributes,void 0,i)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),c=l&&el(l,n.type,r);if(!c)return null;if(o.wrap(l,c),n.keepMarks&&n.editor){const{selection:u,storedMarks:h}=e,{splittableMarks:f}=n.editor.extensionManager,p=h||u.$to.parentOffset&&u.$from.marks();if(p){const m=p.filter(g=>f.includes(g.type.name));o.ensureMarks(m)}}if(n.keepAttributes){const u=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(u,r).run()}const d=o.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&Nn(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(i,d))&&o.join(t.from-1)}})}class Qe{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=U(z(this,"addOptions",{name:this.name}))),this.storage=U(z(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Qe(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>so(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Qe(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=U(z(t,"addOptions",{name:t.name})),t.storage=U(z(t,"addStorage",{name:t.name,options:t.options})),t}}function Pi(n){return new sC({find:n.find,handler:({state:e,range:t,match:i,pasteEvent:s})=>{const r=U(n.getAttributes,void 0,i,s);if(r===!1||r===null)return null;const{tr:o}=e,a=i[i.length-1],l=i[0];let c=t.to;if(a){const d=l.search(/\S/),u=t.from+l.indexOf(a),h=u+a.length;if(um(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>u).length)return null;h<t.to&&o.delete(h,t.to),u>t.from&&o.delete(t.from+d,u),c=t.from+d+a.length,o.addMark(t.from+d,c,n.type.create(r||{})),o.removeStoredMark(n.type)}}})}function FO(n,e){const{selection:t}=n,{$from:i}=t;if(t instanceof L){const r=i.index();return i.parent.canReplaceWith(r,r+1,e)}let s=i.depth;for(;s>=0;){const r=i.index(s);if(i.node(s).contentMatchAt(r).matchType(e))return!0;s-=1}return!1}function WO(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Na={exports:{}},Vo={};var _d;function $O(){if(_d)return Vo;_d=1;var n=x;function e(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var t=typeof Object.is=="function"?Object.is:e,i=n.useState,s=n.useEffect,r=n.useLayoutEffect,o=n.useDebugValue;function a(u,h){var f=h(),p=i({inst:{value:f,getSnapshot:h}}),m=p[0].inst,g=p[1];return r(function(){m.value=f,m.getSnapshot=h,l(m)&&g({inst:m})},[u,f,h]),s(function(){return l(m)&&g({inst:m}),u(function(){l(m)&&g({inst:m})})},[u]),o(f),f}function l(u){var h=u.getSnapshot;u=u.value;try{var f=h();return!t(u,f)}catch{return!0}}function c(u,h){return h()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return Vo.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:d,Vo}var Yo={};var kd;function HO(){return kd||(kd=1,process.env.NODE_ENV!=="production"&&(function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=x,e=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function t(_){{for(var k=arguments.length,v=new Array(k>1?k-1:0),w=1;w<k;w++)v[w-1]=arguments[w];i("error",_,v)}}function i(_,k,v){{var w=e.ReactDebugCurrentFrame,M=w.getStackAddendum();M!==""&&(k+="%s",v=v.concat([M]));var C=v.map(function(O){return String(O)});C.unshift("Warning: "+k),Function.prototype.apply.call(console[_],console,C)}}function s(_,k){return _===k&&(_!==0||1/_===1/k)||_!==_&&k!==k}var r=typeof Object.is=="function"?Object.is:s,o=n.useState,a=n.useEffect,l=n.useLayoutEffect,c=n.useDebugValue,d=!1,u=!1;function h(_,k,v){d||n.startTransition!==void 0&&(d=!0,t("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var w=k();if(!u){var M=k();r(w,M)||(t("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}var C=o({inst:{value:w,getSnapshot:k}}),O=C[0].inst,D=C[1];return l(function(){O.value=w,O.getSnapshot=k,f(O)&&D({inst:O})},[_,w,k]),a(function(){f(O)&&D({inst:O});var A=function(){f(O)&&D({inst:O})};return _(A)},[_]),c(w),w}function f(_){var k=_.getSnapshot,v=_.value;try{var w=k();return!r(v,w)}catch{return!0}}function p(_,k,v){return k()}var m=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",g=!m,y=g?p:h,S=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:y;Yo.useSyncExternalStore=S,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)})()),Yo}process.env.NODE_ENV==="production"?Na.exports=$O():Na.exports=HO();var oo=Na.exports;const VO=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},YO=({contentComponent:n})=>{const e=oo.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return x.createElement(x.Fragment,null,Object.values(e))};function qO(){const n=new Set;let e={};return{subscribe(t){return n.add(t),()=>{n.delete(t)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(t,i){e={...e,[t]:Uu.createPortal(i.reactElement,i.element,t)},n.forEach(s=>s())},removeRenderer(t){const i={...e};delete i[t],e=i,n.forEach(s=>s())}}}class KO extends x.Component{constructor(e){var t;super(e),this.editorContentRef=x.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((t=e.editor)===null||t===void 0)&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.options.element.childNodes),e.setOptions({element:t}),e.contentComponent=qO(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(i=>i.hasContentComponentInitialized?i:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;const t=document.createElement("div");t.append(...e.options.element.childNodes),e.setOptions({element:t})}render(){const{editor:e,innerRef:t,...i}=this.props;return x.createElement(x.Fragment,null,x.createElement("div",{ref:VO(t,this.editorContentRef),...i}),e?.contentComponent&&x.createElement(YO,{contentComponent:e.contentComponent}))}}const UO=x.forwardRef((n,e)=>{const t=x.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return x.createElement(KO,{key:t,innerRef:e,...n})}),JO=x.memo(UO);var GO=function n(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var i,s,r;if(Array.isArray(e)){if(i=e.length,i!=t.length)return!1;for(s=i;s--!==0;)if(!n(e[s],t[s]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(s of e.entries())if(!t.has(s[0]))return!1;for(s of e.entries())if(!n(s[1],t.get(s[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(s of e.entries())if(!t.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(i=e.length,i!=t.length)return!1;for(s=i;s--!==0;)if(e[s]!==t[s])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(r=Object.keys(e),i=r.length,i!==Object.keys(t).length)return!1;for(s=i;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[s]))return!1;for(s=i;s--!==0;){var o=r[s];if(!(o==="_owner"&&e.$$typeof)&&!n(e[o],t[o]))return!1}return!0}return e!==e&&t!==t},XO=WO(GO),Ea={exports:{}},qo={};var wd;function QO(){if(wd)return qo;wd=1;var n=x,e=oo;function t(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var i=typeof Object.is=="function"?Object.is:t,s=e.useSyncExternalStore,r=n.useRef,o=n.useEffect,a=n.useMemo,l=n.useDebugValue;return qo.useSyncExternalStoreWithSelector=function(c,d,u,h,f){var p=r(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function y(w){if(!S){if(S=!0,_=w,w=h(w),f!==void 0&&m.hasValue){var M=m.value;if(f(M,w))return k=M}return k=w}if(M=k,i(_,w))return M;var C=h(w);return f!==void 0&&f(M,C)?M:(_=w,k=C)}var S=!1,_,k,v=u===void 0?null:u;return[function(){return y(d())},v===null?void 0:function(){return y(v())}]},[d,u,h,f]);var g=s(c,p[0],p[1]);return o(function(){m.hasValue=!0,m.value=g},[g]),l(g),g},qo}var Ko={};var vd;function ZO(){return vd||(vd=1,process.env.NODE_ENV!=="production"&&(function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=x,e=oo;function t(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}var i=typeof Object.is=="function"?Object.is:t,s=e.useSyncExternalStore,r=n.useRef,o=n.useEffect,a=n.useMemo,l=n.useDebugValue;function c(d,u,h,f,p){var m=r(null),g;m.current===null?(g={hasValue:!1,value:null},m.current=g):g=m.current;var y=a(function(){var v=!1,w,M,C=function(P){if(!v){v=!0,w=P;var F=f(P);if(p!==void 0&&g.hasValue){var B=g.value;if(p(B,F))return M=B,B}return M=F,F}var H=w,K=M;if(i(H,P))return K;var G=f(P);return p!==void 0&&p(K,G)?K:(w=P,M=G,G)},O=h===void 0?null:h,D=function(){return C(u())},A=O===null?void 0:function(){return C(O())};return[D,A]},[u,h,f,p]),S=y[0],_=y[1],k=s(d,S,_);return o(function(){g.hasValue=!0,g.value=k},[k]),l(k),k}Ko.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)})()),Ko}process.env.NODE_ENV==="production"?Ea.exports=QO():Ea.exports=ZO();var eD=Ea.exports;const tD=typeof window<"u"?x.useLayoutEffect:x.useEffect;class nD{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const t=()=>{this.transactionNumber+=1,this.subscribers.forEach(s=>s())},i=this.editor;return i.on("transaction",t),()=>{i.off("transaction",t)}}}}function iD(n){var e;const[t]=x.useState(()=>new nD(n.editor)),i=eD.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!==null&&e!==void 0?e:XO);return tD(()=>t.watch(n.editor),[n.editor,t]),x.useDebugValue(i),i}const Sd=process.env.NODE_ENV!=="production",Aa=typeof window>"u",sD=Aa||!!(typeof window<"u"&&window.next);class kl{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(t=>t())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0)return Aa||sD?(Sd&&console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."),null):this.createEditor();if(this.options.current.immediatelyRender&&Aa&&Sd)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...i)=>{var s,r;return(r=(s=this.options.current).onBeforeCreate)===null||r===void 0?void 0:r.call(s,...i)},onBlur:(...i)=>{var s,r;return(r=(s=this.options.current).onBlur)===null||r===void 0?void 0:r.call(s,...i)},onCreate:(...i)=>{var s,r;return(r=(s=this.options.current).onCreate)===null||r===void 0?void 0:r.call(s,...i)},onDestroy:(...i)=>{var s,r;return(r=(s=this.options.current).onDestroy)===null||r===void 0?void 0:r.call(s,...i)},onFocus:(...i)=>{var s,r;return(r=(s=this.options.current).onFocus)===null||r===void 0?void 0:r.call(s,...i)},onSelectionUpdate:(...i)=>{var s,r;return(r=(s=this.options.current).onSelectionUpdate)===null||r===void 0?void 0:r.call(s,...i)},onTransaction:(...i)=>{var s,r;return(r=(s=this.options.current).onTransaction)===null||r===void 0?void 0:r.call(s,...i)},onUpdate:(...i)=>{var s,r;return(r=(s=this.options.current).onUpdate)===null||r===void 0?void 0:r.call(s,...i)},onContentError:(...i)=>{var s,r;return(r=(s=this.options.current).onContentError)===null||r===void 0?void 0:r.call(s,...i)},onDrop:(...i)=>{var s,r;return(r=(s=this.options.current).onDrop)===null||r===void 0?void 0:r.call(s,...i)},onPaste:(...i)=>{var s,r;return(r=(s=this.options.current).onPaste)===null||r===void 0?void 0:r.call(s,...i)}};return new BO(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(i=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(i)?!0:i==="extensions"&&e.extensions&&t.extensions?e.extensions.length!==t.extensions.length?!1:e.extensions.every((s,r)=>{var o;return s===((o=t.extensions)===null||o===void 0?void 0:o[r])}):e[i]===t[i])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?kl.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((i,s)=>i===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function rD(n={},e=[]){const t=x.useRef(n);t.current=n;const[i]=x.useState(()=>new kl(t)),s=oo.useSyncExternalStore(i.subscribe,i.getEditor,i.getServerSnapshot);return x.useDebugValue(s),x.useEffect(i.onRender(e)),iD({editor:s,selector:({transactionNumber:r})=>n.shouldRerenderOnTransaction===!1?null:n.immediatelyRender&&r===0?0:r+1}),s}const oD=x.createContext({editor:null});oD.Consumer;const aD=x.createContext({onDragStart:void 0}),lD=()=>x.useContext(aD);x.forwardRef((n,e)=>{const{onDragStart:t}=lD(),i=n.as||"div";return x.createElement(i,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});const cD=/^\s*>\s$/,dD=Qe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",He(this.options.HTMLAttributes,n),0]},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ts({find:cD,type:this.type})]}}),uD=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,hD=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,fD=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,pD=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,mD=Dn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",He(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ai({find:uD,type:this.type}),Ai({find:fD,type:this.type})]},addPasteRules(){return[Pi({find:hD,type:this.type}),Pi({find:pD,type:this.type})]}}),gD="listItem",Md="textStyle",Cd=/^\s*([-+*])\s$/,bD=Qe.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",He(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(gD,this.editor.getAttributes(Md)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Ts({find:Cd,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Ts({find:Cd,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Md),editor:this.editor})),[n]}}),yD=/(^|[^`])`([^`]+)`(?!`)/,xD=/(^|[^`])`([^`]+)`(?!`)/g,_D=Dn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",He(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ai({find:yD,type:this.type})]},addPasteRules(){return[Pi({find:xD,type:this.type})]}}),kD=/^```([a-z]+)?[\s\n]$/,wD=/^~~~([a-z]+)?[\s\n]$/,vD=Qe.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options,r=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return r||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",He(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:i,empty:s}=t;if(!s||i.parent.type!==this.type)return!1;const r=i.parentOffset===i.parent.nodeSize-2,o=i.parent.textContent.endsWith(`
|
|
90
90
|
|
|
91
|
-
`);return!r||!o?!1:n.chain().command(({tr:a})=>(a.delete(
|
|
92
|
-
`));return o.replaceSelectionWith(this.type.create({language:r},l)),o.selection.$from.parent.type!==this.type&&o.setSelection($.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),
|
|
93
|
-
`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:s})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:r}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=s.extensionManager,l=r||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&l&&o){const u=l.filter(h=>a.includes(h.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),ND=Qe.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,He(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Oa({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Er=200,Me=function(){};Me.prototype.append=function(e){return e.length?(e=Me.from(e),!this.length&&e||e.length<Er&&this.leafAppend(e)||this.length<Er&&e.leafPrepend(this)||this.appendInner(e)):this};Me.prototype.prepend=function(e){return e.length?Me.from(e).append(this):this};Me.prototype.appendInner=function(e){return new ED(this,e)};Me.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Me.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Me.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Me.prototype.forEach=function(e,t,s){t===void 0&&(t=0),s===void 0&&(s=this.length),t<=s?this.forEachInner(e,t,s,0):this.forEachInvertedInner(e,t,s,0)};Me.prototype.map=function(e,t,s){t===void 0&&(t=0),s===void 0&&(s=this.length);var i=[];return this.forEach(function(r,o){return i.push(e(r,o))},t,s),i};Me.from=function(e){return e instanceof Me?e:e&&e.length?new dm(e):Me.empty};var dm=(function(n){function e(s){n.call(this),this.values=s}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,r){return i==0&&r==this.length?this:new e(this.values.slice(i,r))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,r,o,a){for(var l=r;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,r,o,a){for(var l=r-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Er)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Er)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Me);Me.empty=new dm([]);var ED=(function(n){function e(t,s){n.call(this),this.left=t,this.right=s,this.length=t.length+s.length,this.depth=Math.max(t.depth,s.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(s){return s<this.left.length?this.left.get(s):this.right.get(s-this.left.length)},e.prototype.forEachInner=function(s,i,r,o){var a=this.left.length;if(i<a&&this.left.forEachInner(s,i,Math.min(r,a),o)===!1||r>a&&this.right.forEachInner(s,Math.max(i-a,0),Math.min(this.length,r)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,r,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(s,i-a,Math.max(r,a)-a,o+a)===!1||r<a&&this.left.forEachInvertedInner(s,Math.min(i,a),r,o)===!1)return!1},e.prototype.sliceInner=function(s,i){if(s==0&&i==this.length)return this;var r=this.left.length;return i<=r?this.left.slice(s,i):s>=r?this.right.slice(s-r,i-r):this.left.slice(s,r).append(this.right.slice(0,i-r))},e.prototype.leafAppend=function(s){var i=this.right.leafAppend(s);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(s){var i=this.left.leafPrepend(s);if(i)return new e(i,this.right)},e.prototype.appendInner=function(s){return this.left.depth>=Math.max(this.right.depth,s.depth)+1?new e(this.left,new e(this.right,s)):new e(this,s)},e})(Me);const AD=500;class Ct{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}let i,r;t&&(i=this.remapping(s,this.items.length),r=i.maps.length);let o=e.tr,a,l,c=[],d=[];return this.items.forEach((u,h)=>{if(!u.step){i||(i=this.remapping(s,h+1),r=i.maps.length),r--,d.push(u);return}if(i){d.push(new Rt(u.map));let f=u.step.map(i.slice(r)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new Rt(p,void 0,void 0,c.length+d.length))),r--,p&&i.appendMap(p,r)}else o.maybeStep(u.step);if(u.selection)return a=i?u.selection.map(i.slice(r)):u.selection,l=new Ct(this.items.slice(0,s).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,t,s,i){let r=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),h=new Rt(e.mapping.maps[d],u,t),f;(f=l&&l.merge(h))&&(h=f,d?r.pop():a=a.slice(0,a.length-1)),r.push(h),t&&(o++,t=void 0),i||(l=h)}let c=o-s.depth;return c>ID&&(a=PD(a,c),o-=c),new Ct(a.append(r),o)}remapping(e,t){let s=new _i;return this.items.forEach((i,r)=>{let o=i.mirrorOffset!=null&&r-i.mirrorOffset>=e?s.maps.length-i.mirrorOffset:void 0;s.appendMap(i.map,o)},e,t),s}addMaps(e){return this.eventCount==0?this:new Ct(this.items.append(e.map(t=>new Rt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let s=[],i=Math.max(0,this.items.length-t),r=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=t;this.items.forEach(h=>{let f=r.getMirror(--l);if(f==null)return;o=Math.min(o,f);let p=r.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(r.slice(l+1,f));g&&a++,s.push(new Rt(p,m,g))}else s.push(new Rt(p))},i);let c=[];for(let h=t;h<o;h++)c.push(new Rt(r.maps[h]));let d=this.items.slice(0,i).append(c).append(s),u=new Ct(d,a);return u.emptyItemCount()>AD&&(u=u.compress(this.items.length-s.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),s=t.maps.length,i=[],r=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&r++;else if(o.step){let l=o.step.map(t.slice(s)),c=l&&l.getMap();if(s--,c&&t.appendMap(c,s),l){let d=o.selection&&o.selection.map(t.slice(s));d&&r++;let u=new Rt(c.invert(),l,d),h,f=i.length-1;(h=i.length&&i[f].merge(u))?i[f]=h:i.push(u)}}else o.map&&s--},this.items.length,0),new Ct(Me.from(i.reverse()),r)}}Ct.empty=new Ct(Me.empty,0);function PD(n,e){let t;return n.forEach((s,i)=>{if(s.selection&&e--==0)return t=i,!1}),n.slice(t)}class Rt{constructor(e,t,s,i){this.map=e,this.step=t,this.selection=s,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Rt(t.getMap().invert(),t,this.selection)}}}class un{constructor(e,t,s,i,r){this.done=e,this.undone=t,this.prevRanges=s,this.prevTime=i,this.prevComposition=r}}const ID=20;function RD(n,e,t,s){let i=t.getMeta(Qn),r;if(i)return i.historyState;t.getMeta(jD)&&(n=new un(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Qn))return o.getMeta(Qn).redo?new un(n.done.addTransform(t,void 0,s,pr(e)),n.undone,Md(t.mapping.maps),n.prevTime,n.prevComposition):new un(n.done,n.undone.addTransform(t,void 0,s,pr(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=n.prevTime==0||!o&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-s.newGroupDelay||!zD(t,n.prevRanges)),c=o?qo(n.prevRanges,t.mapping):Md(t.mapping.maps);return new un(n.done.addTransform(t,l?e.selection.getBookmark():void 0,s,pr(e)),Ct.empty,c,t.time,a??n.prevComposition)}else return(r=t.getMeta("rebased"))?new un(n.done.rebased(t,r),n.undone.rebased(t,r),qo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new un(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),qo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function zD(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((s,i)=>{for(let r=0;r<e.length;r+=2)s<=e[r+1]&&i>=e[r]&&(t=!0)}),t}function Md(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((s,i,r,o)=>e.push(r,o));return e}function qo(n,e){if(!n)return null;let t=[];for(let s=0;s<n.length;s+=2){let i=e.map(n[s],1),r=e.map(n[s+1],-1);i<=r&&t.push(i,r)}return t}function BD(n,e,t){let s=pr(e),i=Qn.get(e).spec.config,r=(t?n.undone:n.done).popEvent(e,s);if(!r)return null;let o=r.selection.resolve(r.transform.doc),a=(t?n.done:n.undone).addTransform(r.transform,e.selection.getBookmark(),i,s),l=new un(t?a:r.remaining,t?r.remaining:a,null,0,-1);return r.transform.setSelection(o).setMeta(Qn,{redo:t,historyState:l})}let Ko=!1,Cd=null;function pr(n){let e=n.plugins;if(Cd!=e){Ko=!1,Cd=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Ko=!0;break}}return Ko}const Qn=new Ht("history"),jD=new Ht("closeHistory");function LD(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Ze({key:Qn,state:{init(){return new un(Ct.empty,Ct.empty,null,0,-1)},apply(e,t,s){return RD(t,s,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let s=t.inputType,i=s=="historyUndo"?hm:s=="historyRedo"?fm:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function um(n,e){return(t,s)=>{let i=Qn.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(s){let r=BD(i,t,n);r&&s(e?r.scrollIntoView():r)}return!0}}const hm=um(!1,!0),fm=um(!0,!0),FD=Ve.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>hm(n,e),redo:()=>({state:n,dispatch:e})=>fm(n,e)}},addProseMirrorPlugins(){return[LD(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),WD=Qe.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",He(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!PO(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$from:s,$to:i}=t,r=n();return s.parentOffset===0?r.insertContentAt({from:Math.max(s.pos-1,0),to:i.pos},{type:this.name}):eO(t)?r.insertContentAt(i.pos,{type:this.name}):r.insertContent({type:this.name}),r.command(({tr:o,dispatch:a})=>{var l;if(a){const{$to:c}=o.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?o.setSelection($.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(L.create(o.doc,c.pos)):o.setSelection($.create(o.doc,c.pos));else{const u=(l=c.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();u&&(o.insert(d,u),o.setSelection($.create(o.doc,d+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[AO({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),$D=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,HD=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,VD=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,YD=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,qD=On.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",He(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Es({find:$D,type:this.type}),Es({find:VD,type:this.type})]},addPasteRules(){return[As({find:HD,type:this.type}),As({find:YD,type:this.type})]}}),KD=Qe.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",He(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),UD="listItem",Od="textStyle",Dd=/^(\d+)\.\s$/,JD=Qe.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",He(this.options.HTMLAttributes,t),0]:["ol",He(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(UD,this.editor.getAttributes(Od)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Oi({find:Dd,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Oi({find:Dd,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Od)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),GD=Qe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",He(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),XD=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,QD=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,ZD=On.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",He(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Es({find:XD,type:this.type})]},addPasteRules(){return[As({find:QD,type:this.type})]}}),eT=Qe.create({name:"text",group:"inline"}),tT=Ve.create({name:"starterKit",addExtensions(){const n=[];return this.options.bold!==!1&&n.push(lD.configure(this.options.bold)),this.options.blockquote!==!1&&n.push(sD.configure(this.options.blockquote)),this.options.bulletList!==!1&&n.push(dD.configure(this.options.bulletList)),this.options.code!==!1&&n.push(fD.configure(this.options.code)),this.options.codeBlock!==!1&&n.push(gD.configure(this.options.codeBlock)),this.options.document!==!1&&n.push(yD.configure(this.options.document)),this.options.dropcursor!==!1&&n.push(_D.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&n.push(DD.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&n.push(TD.configure(this.options.hardBreak)),this.options.heading!==!1&&n.push(ND.configure(this.options.heading)),this.options.history!==!1&&n.push(FD.configure(this.options.history)),this.options.horizontalRule!==!1&&n.push(WD.configure(this.options.horizontalRule)),this.options.italic!==!1&&n.push(qD.configure(this.options.italic)),this.options.listItem!==!1&&n.push(KD.configure(this.options.listItem)),this.options.orderedList!==!1&&n.push(JD.configure(this.options.orderedList)),this.options.paragraph!==!1&&n.push(GD.configure(this.options.paragraph)),this.options.strike!==!1&&n.push(ZD.configure(this.options.strike)),this.options.text!==!1&&n.push(eT.configure(this.options.text)),n}}),nT="_wrapper_12sud_1",sT="_label_12sud_9",iT="_editor_12sud_16",rT="_error_12sud_30",oT="_disabled_12sud_34",aT="_toolbar_12sud_40",lT="_content_12sud_94",we={wrapper:nT,label:sT,editor:iT,error:rT,disabled:oT,toolbar:aT,"toolbar-group":"_toolbar-group_12sud_50","toolbar-btn":"_toolbar-btn_12sud_56","toolbar-btn-active":"_toolbar-btn-active_12sud_80","toolbar-separator":"_toolbar-separator_12sud_85",content:lT,"size-sm":"_size-sm_12sud_99","size-md":"_size-md_12sud_100","size-lg":"_size-lg_12sud_101","error-text":"_error-text_12sud_159"};function Mt({onClick:n,active:e,disabled:t,title:s,children:i}){return y.jsx("button",{type:"button",title:s,"aria-label":s,"aria-pressed":e,disabled:t,className:N(we["toolbar-btn"],e&&we["toolbar-btn-active"]),onMouseDown:r=>{r.preventDefault(),n()},children:i})}const pm=x.forwardRef(({value:n,defaultValue:e="",placeholder:t="Start typing…",size:s="md",disabled:i=!1,label:r,error:o,minHeight:a,onChange:l,className:c,id:d},u)=>{const h=QO({extensions:[tT],content:n!==void 0?n:e,editable:!i,onUpdate:({editor:C})=>{l?.(C.getHTML())}}),f=x.useCallback(()=>h?.chain().focus().toggleBold().run(),[h]),p=x.useCallback(()=>h?.chain().focus().toggleItalic().run(),[h]),m=x.useCallback(()=>h?.chain().focus().toggleStrike().run(),[h]),g=x.useCallback(()=>h?.chain().focus().toggleCode().run(),[h]),b=x.useCallback(()=>h?.chain().focus().toggleHeading({level:1}).run(),[h]),S=x.useCallback(()=>h?.chain().focus().toggleHeading({level:2}).run(),[h]),_=x.useCallback(()=>h?.chain().focus().toggleBulletList().run(),[h]),k=x.useCallback(()=>h?.chain().focus().toggleOrderedList().run(),[h]),v=x.useCallback(()=>h?.chain().focus().toggleBlockquote().run(),[h]),w=x.useCallback(()=>h?.chain().focus().undo().run(),[h]),M=x.useCallback(()=>h?.chain().focus().redo().run(),[h]);return y.jsxs("div",{ref:u,className:N(we.wrapper,we[`size-${s}`],c),children:[r&&y.jsx("label",{htmlFor:d,className:we.label,children:r}),y.jsxs("div",{className:N(we.editor,o&&we.error,i&&we.disabled),children:[y.jsxs("div",{className:we.toolbar,role:"toolbar","aria-label":"Text formatting",children:[y.jsxs("div",{className:we["toolbar-group"],children:[y.jsx(Mt,{onClick:f,active:h?.isActive("bold"),title:"Bold (Ctrl+B)",children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M3 2h4.5a2.5 2.5 0 010 5H3V2zM3 7h5a2.5 2.5 0 010 5H3V7z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"})})}),y.jsx(Mt,{onClick:p,active:h?.isActive("italic"),title:"Italic (Ctrl+I)",children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M5 2h5M4 12h5M8.5 2l-3 10",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}),y.jsx(Mt,{onClick:m,active:h?.isActive("strike"),title:"Strikethrough",children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M2 7h10M4 4c0-1.1.9-2 2-2h2a2 2 0 010 4H6a2 2 0 000 4h2a2 2 0 002-2",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})})}),y.jsx(Mt,{onClick:g,active:h?.isActive("code"),title:"Inline code",children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:y.jsx("path",{d:"M5 3L2 7l3 4M9 3l3 4-3 4",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),y.jsx("div",{className:we["toolbar-separator"]}),y.jsxs("div",{className:we["toolbar-group"],children:[y.jsx(Mt,{onClick:b,active:h?.isActive("heading",{level:1}),title:"Heading 1",children:y.jsx("span",{style:{fontSize:"0.75rem",fontWeight:600},children:"H1"})}),y.jsx(Mt,{onClick:S,active:h?.isActive("heading",{level:2}),title:"Heading 2",children:y.jsx("span",{style:{fontSize:"0.75rem",fontWeight:600},children:"H2"})})]}),y.jsx("div",{className:we["toolbar-separator"]}),y.jsxs("div",{className:we["toolbar-group"],children:[y.jsx(Mt,{onClick:_,active:h?.isActive("bulletList"),title:"Bullet list",children:y.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[y.jsx("circle",{cx:"2.5",cy:"4",r:"1",fill:"currentColor"}),y.jsx("path",{d:"M5 4h7",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),y.jsx("circle",{cx:"2.5",cy:"7",r:"1",fill:"currentColor"}),y.jsx("path",{d:"M5 7h7",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),y.jsx("circle",{cx:"2.5",cy:"10",r:"1",fill:"currentColor"}),y.jsx("path",{d:"M5 10h7",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}),y.jsx(Mt,{onClick:k,active:h?.isActive("orderedList"),title:"Ordered list",children:y.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[y.jsx("path",{d:"M1.5 2v3M1 5h2",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),y.jsx("path",{d:"M5 4h7",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),y.jsx("path",{d:"M5 7h7",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),y.jsx("path",{d:"M5 10h7",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}),y.jsx(Mt,{onClick:v,active:h?.isActive("blockquote"),title:"Blockquote",children:y.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[y.jsx("path",{d:"M2 4h3v4H2V4zM7 4h3v4H7V4z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),y.jsx("path",{d:"M5 8c0 1.1-.9 2-2 2M10 8c0 1.1-.9 2-2 2",stroke:"currentColor",strokeWidth:"1.2"})]})})]}),y.jsx("div",{className:we["toolbar-separator"]}),y.jsxs("div",{className:we["toolbar-group"],children:[y.jsx(Mt,{onClick:w,title:"Undo (Ctrl+Z)",disabled:!h?.can().undo(),children:y.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[y.jsx("path",{d:"M2 5h5a4 4 0 010 8H2",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),y.jsx("path",{d:"M5 2L2 5l3 3",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]})}),y.jsx(Mt,{onClick:M,title:"Redo (Ctrl+Y)",disabled:!h?.can().redo(),children:y.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[y.jsx("path",{d:"M12 5H7a4 4 0 000 8h5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),y.jsx("path",{d:"M9 2l3 3-3 3",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),y.jsx($O,{editor:h,id:d,className:we.content,style:a?{minHeight:a}:void 0,"aria-placeholder":t,"aria-label":r,"aria-invalid":!!o})]}),o&&y.jsx("p",{className:we["error-text"],role:"alert",children:o})]})});pm.displayName="RichTextEditor";function Li(n){return n+.5|0}const gn=(n,e,t)=>Math.max(Math.min(n,t),e);function ii(n){return gn(Li(n*2.55),0,255)}function Mn(n){return gn(Li(n*255),0,255)}function Xt(n){return gn(Li(n/2.55)/100,0,1)}function Td(n){return gn(Li(n*100),0,100)}const ht={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Ea=[..."0123456789ABCDEF"],cT=n=>Ea[n&15],dT=n=>Ea[(n&240)>>4]+Ea[n&15],Qi=n=>(n&240)>>4===(n&15),uT=n=>Qi(n.r)&&Qi(n.g)&&Qi(n.b)&&Qi(n.a);function hT(n){var e=n.length,t;return n[0]==="#"&&(e===4||e===5?t={r:255&ht[n[1]]*17,g:255&ht[n[2]]*17,b:255&ht[n[3]]*17,a:e===5?ht[n[4]]*17:255}:(e===7||e===9)&&(t={r:ht[n[1]]<<4|ht[n[2]],g:ht[n[3]]<<4|ht[n[4]],b:ht[n[5]]<<4|ht[n[6]],a:e===9?ht[n[7]]<<4|ht[n[8]]:255})),t}const fT=(n,e)=>n<255?e(n):"";function pT(n){var e=uT(n)?cT:dT;return n?"#"+e(n.r)+e(n.g)+e(n.b)+fT(n.a,e):void 0}const mT=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function mm(n,e,t){const s=e*Math.min(t,1-t),i=(r,o=(r+n/30)%12)=>t-s*Math.max(Math.min(o-3,9-o,1),-1);return[i(0),i(8),i(4)]}function gT(n,e,t){const s=(i,r=(i+n/60)%6)=>t-t*e*Math.max(Math.min(r,4-r,1),0);return[s(5),s(3),s(1)]}function yT(n,e,t){const s=mm(n,1,.5);let i;for(e+t>1&&(i=1/(e+t),e*=i,t*=i),i=0;i<3;i++)s[i]*=1-e-t,s[i]+=e;return s}function bT(n,e,t,s,i){return n===i?(e-t)/s+(e<t?6:0):e===i?(t-n)/s+2:(n-e)/s+4}function kl(n){const t=n.r/255,s=n.g/255,i=n.b/255,r=Math.max(t,s,i),o=Math.min(t,s,i),a=(r+o)/2;let l,c,d;return r!==o&&(d=r-o,c=a>.5?d/(2-r-o):d/(r+o),l=bT(t,s,i,d,r),l=l*60+.5),[l|0,c||0,a]}function wl(n,e,t,s){return(Array.isArray(e)?n(e[0],e[1],e[2]):n(e,t,s)).map(Mn)}function vl(n,e,t){return wl(mm,n,e,t)}function xT(n,e,t){return wl(yT,n,e,t)}function _T(n,e,t){return wl(gT,n,e,t)}function gm(n){return(n%360+360)%360}function kT(n){const e=mT.exec(n);let t=255,s;if(!e)return;e[5]!==s&&(t=e[6]?ii(+e[5]):Mn(+e[5]));const i=gm(+e[2]),r=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?s=xT(i,r,o):e[1]==="hsv"?s=_T(i,r,o):s=vl(i,r,o),{r:s[0],g:s[1],b:s[2],a:t}}function wT(n,e){var t=kl(n);t[0]=gm(t[0]+e),t=vl(t),n.r=t[0],n.g=t[1],n.b=t[2]}function vT(n){if(!n)return;const e=kl(n),t=e[0],s=Td(e[1]),i=Td(e[2]);return n.a<255?`hsla(${t}, ${s}%, ${i}%, ${Xt(n.a)})`:`hsl(${t}, ${s}%, ${i}%)`}const Nd={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Ed={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function ST(){const n={},e=Object.keys(Ed),t=Object.keys(Nd);let s,i,r,o,a;for(s=0;s<e.length;s++){for(o=a=e[s],i=0;i<t.length;i++)r=t[i],a=a.replace(r,Nd[r]);r=parseInt(Ed[o],16),n[a]=[r>>16&255,r>>8&255,r&255]}return n}let Zi;function MT(n){Zi||(Zi=ST(),Zi.transparent=[0,0,0,0]);const e=Zi[n.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const CT=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function OT(n){const e=CT.exec(n);let t=255,s,i,r;if(e){if(e[7]!==s){const o=+e[7];t=e[8]?ii(o):gn(o*255,0,255)}return s=+e[1],i=+e[3],r=+e[5],s=255&(e[2]?ii(s):gn(s,0,255)),i=255&(e[4]?ii(i):gn(i,0,255)),r=255&(e[6]?ii(r):gn(r,0,255)),{r:s,g:i,b:r,a:t}}}function DT(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${Xt(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const Uo=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,ms=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function TT(n,e,t){const s=ms(Xt(n.r)),i=ms(Xt(n.g)),r=ms(Xt(n.b));return{r:Mn(Uo(s+t*(ms(Xt(e.r))-s))),g:Mn(Uo(i+t*(ms(Xt(e.g))-i))),b:Mn(Uo(r+t*(ms(Xt(e.b))-r))),a:n.a+t*(e.a-n.a)}}function er(n,e,t){if(n){let s=kl(n);s[e]=Math.max(0,Math.min(s[e]+s[e]*t,e===0?360:1)),s=vl(s),n.r=s[0],n.g=s[1],n.b=s[2]}}function ym(n,e){return n&&Object.assign(e||{},n)}function Ad(n){var e={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(e={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(e.a=Mn(n[3]))):(e=ym(n,{r:0,g:0,b:0,a:1}),e.a=Mn(e.a)),e}function NT(n){return n.charAt(0)==="r"?OT(n):kT(n)}class Di{constructor(e){if(e instanceof Di)return e;const t=typeof e;let s;t==="object"?s=Ad(e):t==="string"&&(s=hT(e)||MT(e)||NT(e)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var e=ym(this._rgb);return e&&(e.a=Xt(e.a)),e}set rgb(e){this._rgb=Ad(e)}rgbString(){return this._valid?DT(this._rgb):void 0}hexString(){return this._valid?pT(this._rgb):void 0}hslString(){return this._valid?vT(this._rgb):void 0}mix(e,t){if(e){const s=this.rgb,i=e.rgb;let r;const o=t===r?.5:t,a=2*o-1,l=s.a-i.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;r=1-c,s.r=255&c*s.r+r*i.r+.5,s.g=255&c*s.g+r*i.g+.5,s.b=255&c*s.b+r*i.b+.5,s.a=o*s.a+(1-o)*i.a,this.rgb=s}return this}interpolate(e,t){return e&&(this._rgb=TT(this._rgb,e._rgb,t)),this}clone(){return new Di(this.rgb)}alpha(e){return this._rgb.a=Mn(e),this}clearer(e){const t=this._rgb;return t.a*=1-e,this}greyscale(){const e=this._rgb,t=Li(e.r*.3+e.g*.59+e.b*.11);return e.r=e.g=e.b=t,this}opaquer(e){const t=this._rgb;return t.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return er(this._rgb,2,e),this}darken(e){return er(this._rgb,2,-e),this}saturate(e){return er(this._rgb,1,e),this}desaturate(e){return er(this._rgb,1,-e),this}rotate(e){return wT(this._rgb,e),this}}function qt(){}const ET=(()=>{let n=0;return()=>n++})();function pe(n){return n==null}function _e(n){if(Array.isArray&&Array.isArray(n))return!0;const e=Object.prototype.toString.call(n);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function X(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function Le(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function At(n,e){return Le(n)?n:e}function J(n,e){return typeof n>"u"?e:n}const AT=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*e:+n;function ue(n,e,t){if(n&&typeof n.call=="function")return n.apply(t,e)}function oe(n,e,t,s){let i,r,o;if(_e(n))for(r=n.length,i=0;i<r;i++)e.call(t,n[i],i);else if(X(n))for(o=Object.keys(n),r=o.length,i=0;i<r;i++)e.call(t,n[o[i]],o[i])}function Ar(n,e){let t,s,i,r;if(!n||!e||n.length!==e.length)return!1;for(t=0,s=n.length;t<s;++t)if(i=n[t],r=e[t],i.datasetIndex!==r.datasetIndex||i.index!==r.index)return!1;return!0}function Pr(n){if(_e(n))return n.map(Pr);if(X(n)){const e=Object.create(null),t=Object.keys(n),s=t.length;let i=0;for(;i<s;++i)e[t[i]]=Pr(n[t[i]]);return e}return n}function bm(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function PT(n,e,t,s){if(!bm(n))return;const i=e[n],r=t[n];X(i)&&X(r)?Ti(i,r,s):e[n]=Pr(r)}function Ti(n,e,t){const s=_e(e)?e:[e],i=s.length;if(!X(n))return n;t=t||{};const r=t.merger||PT;let o;for(let a=0;a<i;++a){if(o=s[a],!X(o))continue;const l=Object.keys(o);for(let c=0,d=l.length;c<d;++c)r(l[c],n,o,t)}return n}function ui(n,e){return Ti(n,e,{merger:IT})}function IT(n,e,t){if(!bm(n))return;const s=e[n],i=t[n];X(s)&&X(i)?ui(s,i):Object.prototype.hasOwnProperty.call(e,n)||(e[n]=Pr(i))}const Pd={"":n=>n,x:n=>n.x,y:n=>n.y};function RT(n){const e=n.split("."),t=[];let s="";for(const i of e)s+=i,s.endsWith("\\")?s=s.slice(0,-1)+".":(t.push(s),s="");return t}function zT(n){const e=RT(n);return t=>{for(const s of e){if(s==="")break;t=t&&t[s]}return t}}function Ir(n,e){return(Pd[e]||(Pd[e]=zT(e)))(n)}function Sl(n){return n.charAt(0).toUpperCase()+n.slice(1)}const Rr=n=>typeof n<"u",Dn=n=>typeof n=="function",Id=(n,e)=>{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0};function BT(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const le=Math.PI,Ce=2*le,jT=Ce+le,zr=Number.POSITIVE_INFINITY,LT=le/180,Pe=le/2,In=le/4,Rd=le*2/3,xm=Math.log10,Ps=Math.sign;function hi(n,e,t){return Math.abs(n-e)<t}function zd(n){const e=Math.round(n);n=hi(n,e,n/1e3)?e:n;const t=Math.pow(10,Math.floor(xm(n))),s=n/t;return(s<=1?1:s<=2?2:s<=5?5:10)*t}function FT(n){const e=[],t=Math.sqrt(n);let s;for(s=1;s<t;s++)n%s===0&&(e.push(s),e.push(n/s));return t===(t|0)&&e.push(t),e.sort((i,r)=>i-r).pop(),e}function WT(n){return typeof n=="symbol"||typeof n=="object"&&n!==null&&!(Symbol.toPrimitive in n||"toString"in n||"valueOf"in n)}function Br(n){return!WT(n)&&!isNaN(parseFloat(n))&&isFinite(n)}function $T(n,e){const t=Math.round(n);return t-e<=n&&t+e>=n}function HT(n,e,t){let s,i,r;for(s=0,i=n.length;s<i;s++)r=n[s][t],isNaN(r)||(e.min=Math.min(e.min,r),e.max=Math.max(e.max,r))}function Kn(n){return n*(le/180)}function VT(n){return n*(180/le)}function Bd(n){if(!Le(n))return;let e=1,t=0;for(;Math.round(n*e)/e!==n;)e*=10,t++;return t}function _m(n,e){const t=e.x-n.x,s=e.y-n.y,i=Math.sqrt(t*t+s*s);let r=Math.atan2(s,t);return r<-.5*le&&(r+=Ce),{angle:r,distance:i}}function Aa(n,e){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function YT(n,e){return(n-e+jT)%Ce-le}function at(n){return(n%Ce+Ce)%Ce}function Ml(n,e,t,s){const i=at(n),r=at(e),o=at(t),a=at(r-i),l=at(o-i),c=at(i-r),d=at(i-o);return i===r||i===o||s&&r===o||a>l&&c<d}function Ge(n,e,t){return Math.max(e,Math.min(t,n))}function qT(n){return Ge(n,-32768,32767)}function nn(n,e,t,s=1e-6){return n>=Math.min(e,t)-s&&n<=Math.max(e,t)+s}function Cl(n,e,t){t=t||(o=>n[o]<e);let s=n.length-1,i=0,r;for(;s-i>1;)r=i+s>>1,t(r)?i=r:s=r;return{lo:i,hi:s}}const Pa=(n,e,t,s)=>Cl(n,t,s?i=>{const r=n[i][e];return r<t||r===t&&n[i+1][e]===t}:i=>n[i][e]<t),KT=(n,e,t)=>Cl(n,t,s=>n[s][e]>=t);function UT(n,e,t){let s=0,i=n.length;for(;s<i&&n[s]<e;)s++;for(;i>s&&n[i-1]>t;)i--;return s>0||i<n.length?n.slice(s,i):n}const km=["push","pop","shift","splice","unshift"];function JT(n,e){if(n._chartjs){n._chartjs.listeners.push(e);return}Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),km.forEach(t=>{const s="_onData"+Sl(t),i=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...r){const o=i.apply(this,r);return n._chartjs.listeners.forEach(a=>{typeof a[s]=="function"&&a[s](...r)}),o}})})}function jd(n,e){const t=n._chartjs;if(!t)return;const s=t.listeners,i=s.indexOf(e);i!==-1&&s.splice(i,1),!(s.length>0)&&(km.forEach(r=>{delete n[r]}),delete n._chartjs)}function GT(n){const e=new Set(n);return e.size===n.length?n:Array.from(e)}const wm=(function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame})();function vm(n,e){let t=[],s=!1;return function(...i){t=i,s||(s=!0,wm.call(window,()=>{s=!1,n.apply(e,t)}))}}function XT(n,e){let t;return function(...s){return e?(clearTimeout(t),t=setTimeout(n,e,s)):n.apply(this,s),e}}const Ol=n=>n==="start"?"left":n==="end"?"right":"center",Ie=(n,e,t)=>n==="start"?e:n==="end"?t:(e+t)/2,QT=(n,e,t,s)=>n===(s?"left":"right")?t:n==="center"?(e+t)/2:e,tr=n=>n===0||n===1,Ld=(n,e,t)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-e)*Ce/t)),Fd=(n,e,t)=>Math.pow(2,-10*n)*Math.sin((n-e)*Ce/t)+1,fi={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*Pe)+1,easeOutSine:n=>Math.sin(n*Pe),easeInOutSine:n=>-.5*(Math.cos(le*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>tr(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>tr(n)?n:Ld(n,.075,.3),easeOutElastic:n=>tr(n)?n:Fd(n,.075,.3),easeInOutElastic(n){return tr(n)?n:n<.5?.5*Ld(n*2,.1125,.45):.5+.5*Fd(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let e=1.70158;return(n/=.5)<1?.5*(n*n*(((e*=1.525)+1)*n-e)):.5*((n-=2)*n*(((e*=1.525)+1)*n+e)+2)},easeInBounce:n=>1-fi.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?fi.easeInBounce(n*2)*.5:fi.easeOutBounce(n*2-1)*.5+.5};function Dl(n){if(n&&typeof n=="object"){const e=n.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function Wd(n){return Dl(n)?n:new Di(n)}function Jo(n){return Dl(n)?n:new Di(n).saturate(.5).darken(.1).hexString()}const ZT=["x","y","borderWidth","radius","tension"],eN=["color","borderColor","backgroundColor"];function tN(n){n.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),n.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>e!=="onProgress"&&e!=="onComplete"&&e!=="fn"}),n.set("animations",{colors:{type:"color",properties:eN},numbers:{type:"number",properties:ZT}}),n.describe("animations",{_fallback:"animation"}),n.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:e=>e|0}}}})}function nN(n){n.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const $d=new Map;function sN(n,e){e=e||{};const t=n+JSON.stringify(e);let s=$d.get(t);return s||(s=new Intl.NumberFormat(n,e),$d.set(t,s)),s}function Sm(n,e,t){return sN(e,t).format(n)}const iN={values(n){return _e(n)?n:""+n},numeric(n,e,t){if(n===0)return"0";const s=this.chart.options.locale;let i,r=n;if(t.length>1){const c=Math.max(Math.abs(t[0].value),Math.abs(t[t.length-1].value));(c<1e-4||c>1e15)&&(i="scientific"),r=rN(n,t)}const o=xm(Math.abs(r)),a=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),l={notation:i,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Sm(n,s,l)}};function rN(n,e){let t=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(t)>=1&&n!==Math.floor(n)&&(t=n-Math.floor(n)),t}var Mm={formatters:iN};function oN(n){n.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,t)=>t.lineWidth,tickColor:(e,t)=>t.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Mm.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),n.route("scale.ticks","color","","color"),n.route("scale.grid","color","","borderColor"),n.route("scale.border","color","","borderColor"),n.route("scale.title","color","","color"),n.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&e!=="callback"&&e!=="parser",_indexable:e=>e!=="borderDash"&&e!=="tickBorderDash"&&e!=="dash"}),n.describe("scales",{_fallback:"scale"}),n.describe("scale.ticks",{_scriptable:e=>e!=="backdropPadding"&&e!=="callback",_indexable:e=>e!=="backdropPadding"})}const rs=Object.create(null),Ia=Object.create(null);function pi(n,e){if(!e)return n;const t=e.split(".");for(let s=0,i=t.length;s<i;++s){const r=t[s];n=n[r]||(n[r]=Object.create(null))}return n}function Go(n,e,t){return typeof e=="string"?Ti(pi(n,e),t):Ti(pi(n,""),e)}class aN{constructor(e,t){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=s=>s.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(s,i)=>Jo(i.backgroundColor),this.hoverBorderColor=(s,i)=>Jo(i.borderColor),this.hoverColor=(s,i)=>Jo(i.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(t)}set(e,t){return Go(this,e,t)}get(e){return pi(this,e)}describe(e,t){return Go(Ia,e,t)}override(e,t){return Go(rs,e,t)}route(e,t,s,i){const r=pi(this,e),o=pi(this,s),a="_"+t;Object.defineProperties(r,{[a]:{value:r[t],writable:!0},[t]:{enumerable:!0,get(){const l=this[a],c=o[i];return X(l)?Object.assign({},c,l):J(l,c)},set(l){this[a]=l}}})}apply(e){e.forEach(t=>t(this))}}var ge=new aN({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[tN,nN,oN]);function lN(n){return!n||pe(n.size)||pe(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function Hd(n,e,t,s,i){let r=e[i];return r||(r=e[i]=n.measureText(i).width,t.push(i)),r>s&&(s=r),s}function Rn(n,e,t){const s=n.currentDevicePixelRatio,i=t!==0?Math.max(t/2,.5):0;return Math.round((e-i)*s)/s+i}function Vd(n,e){!e&&!n||(e=e||n.getContext("2d"),e.save(),e.resetTransform(),e.clearRect(0,0,n.width,n.height),e.restore())}function Ra(n,e,t,s){Cm(n,e,t,s,null)}function Cm(n,e,t,s,i){let r,o,a,l,c,d,u,h;const f=e.pointStyle,p=e.rotation,m=e.radius;let g=(p||0)*LT;if(f&&typeof f=="object"&&(r=f.toString(),r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]")){n.save(),n.translate(t,s),n.rotate(g),n.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),n.restore();return}if(!(isNaN(m)||m<=0)){switch(n.beginPath(),f){default:i?n.ellipse(t,s,i/2,m,0,0,Ce):n.arc(t,s,m,0,Ce),n.closePath();break;case"triangle":d=i?i/2:m,n.moveTo(t+Math.sin(g)*d,s-Math.cos(g)*m),g+=Rd,n.lineTo(t+Math.sin(g)*d,s-Math.cos(g)*m),g+=Rd,n.lineTo(t+Math.sin(g)*d,s-Math.cos(g)*m),n.closePath();break;case"rectRounded":c=m*.516,l=m-c,o=Math.cos(g+In)*l,u=Math.cos(g+In)*(i?i/2-c:l),a=Math.sin(g+In)*l,h=Math.sin(g+In)*(i?i/2-c:l),n.arc(t-u,s-a,c,g-le,g-Pe),n.arc(t+h,s-o,c,g-Pe,g),n.arc(t+u,s+a,c,g,g+Pe),n.arc(t-h,s+o,c,g+Pe,g+le),n.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*m,d=i?i/2:l,n.rect(t-d,s-l,2*d,2*l);break}g+=In;case"rectRot":u=Math.cos(g)*(i?i/2:m),o=Math.cos(g)*m,a=Math.sin(g)*m,h=Math.sin(g)*(i?i/2:m),n.moveTo(t-u,s-a),n.lineTo(t+h,s-o),n.lineTo(t+u,s+a),n.lineTo(t-h,s+o),n.closePath();break;case"crossRot":g+=In;case"cross":u=Math.cos(g)*(i?i/2:m),o=Math.cos(g)*m,a=Math.sin(g)*m,h=Math.sin(g)*(i?i/2:m),n.moveTo(t-u,s-a),n.lineTo(t+u,s+a),n.moveTo(t+h,s-o),n.lineTo(t-h,s+o);break;case"star":u=Math.cos(g)*(i?i/2:m),o=Math.cos(g)*m,a=Math.sin(g)*m,h=Math.sin(g)*(i?i/2:m),n.moveTo(t-u,s-a),n.lineTo(t+u,s+a),n.moveTo(t+h,s-o),n.lineTo(t-h,s+o),g+=In,u=Math.cos(g)*(i?i/2:m),o=Math.cos(g)*m,a=Math.sin(g)*m,h=Math.sin(g)*(i?i/2:m),n.moveTo(t-u,s-a),n.lineTo(t+u,s+a),n.moveTo(t+h,s-o),n.lineTo(t-h,s+o);break;case"line":o=i?i/2:Math.cos(g)*m,a=Math.sin(g)*m,n.moveTo(t-o,s-a),n.lineTo(t+o,s+a);break;case"dash":n.moveTo(t,s),n.lineTo(t+Math.cos(g)*(i?i/2:m),s+Math.sin(g)*m);break;case!1:n.closePath();break}n.fill(),e.borderWidth>0&&n.stroke()}}function Ni(n,e,t){return t=t||.5,!e||n&&n.x>e.left-t&&n.x<e.right+t&&n.y>e.top-t&&n.y<e.bottom+t}function ro(n,e){n.save(),n.beginPath(),n.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),n.clip()}function oo(n){n.restore()}function cN(n,e,t,s,i){if(!e)return n.lineTo(t.x,t.y);if(i==="middle"){const r=(e.x+t.x)/2;n.lineTo(r,e.y),n.lineTo(r,t.y)}else i==="after"!=!!s?n.lineTo(e.x,t.y):n.lineTo(t.x,e.y);n.lineTo(t.x,t.y)}function dN(n,e,t,s){if(!e)return n.lineTo(t.x,t.y);n.bezierCurveTo(s?e.cp1x:e.cp2x,s?e.cp1y:e.cp2y,s?t.cp2x:t.cp1x,s?t.cp2y:t.cp1y,t.x,t.y)}function uN(n,e){e.translation&&n.translate(e.translation[0],e.translation[1]),pe(e.rotation)||n.rotate(e.rotation),e.color&&(n.fillStyle=e.color),e.textAlign&&(n.textAlign=e.textAlign),e.textBaseline&&(n.textBaseline=e.textBaseline)}function hN(n,e,t,s,i){if(i.strikethrough||i.underline){const r=n.measureText(s),o=e-r.actualBoundingBoxLeft,a=e+r.actualBoundingBoxRight,l=t-r.actualBoundingBoxAscent,c=t+r.actualBoundingBoxDescent,d=i.strikethrough?(l+c)/2:c;n.strokeStyle=n.fillStyle,n.beginPath(),n.lineWidth=i.decorationWidth||2,n.moveTo(o,d),n.lineTo(a,d),n.stroke()}}function fN(n,e){const t=n.fillStyle;n.fillStyle=e.color,n.fillRect(e.left,e.top,e.width,e.height),n.fillStyle=t}function Ei(n,e,t,s,i,r={}){const o=_e(e)?e:[e],a=r.strokeWidth>0&&r.strokeColor!=="";let l,c;for(n.save(),n.font=i.string,uN(n,r),l=0;l<o.length;++l)c=o[l],r.backdrop&&fN(n,r.backdrop),a&&(r.strokeColor&&(n.strokeStyle=r.strokeColor),pe(r.strokeWidth)||(n.lineWidth=r.strokeWidth),n.strokeText(c,t,s,r.maxWidth)),n.fillText(c,t,s,r.maxWidth),hN(n,t,s,c,r),s+=Number(i.lineHeight);n.restore()}function jr(n,e){const{x:t,y:s,w:i,h:r,radius:o}=e;n.arc(t+o.topLeft,s+o.topLeft,o.topLeft,1.5*le,le,!0),n.lineTo(t,s+r-o.bottomLeft),n.arc(t+o.bottomLeft,s+r-o.bottomLeft,o.bottomLeft,le,Pe,!0),n.lineTo(t+i-o.bottomRight,s+r),n.arc(t+i-o.bottomRight,s+r-o.bottomRight,o.bottomRight,Pe,0,!0),n.lineTo(t+i,s+o.topRight),n.arc(t+i-o.topRight,s+o.topRight,o.topRight,0,-Pe,!0),n.lineTo(t+o.topLeft,s)}const pN=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,mN=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function gN(n,e){const t=(""+n).match(pN);if(!t||t[1]==="normal")return e*1.2;switch(n=+t[2],t[3]){case"px":return n;case"%":n/=100;break}return e*n}const yN=n=>+n||0;function Tl(n,e){const t={},s=X(e),i=s?Object.keys(e):e,r=X(n)?s?o=>J(n[o],n[e[o]]):o=>n[o]:()=>n;for(const o of i)t[o]=yN(r(o));return t}function Om(n){return Tl(n,{top:"y",right:"x",bottom:"y",left:"x"})}function Ss(n){return Tl(n,["topLeft","topRight","bottomLeft","bottomRight"])}function kt(n){const e=Om(n);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Be(n,e){n=n||{},e=e||ge.font;let t=J(n.size,e.size);typeof t=="string"&&(t=parseInt(t,10));let s=J(n.style,e.style);s&&!(""+s).match(mN)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const i={family:J(n.family,e.family),lineHeight:gN(J(n.lineHeight,e.lineHeight),t),size:t,style:s,weight:J(n.weight,e.weight),string:""};return i.string=lN(i),i}function nr(n,e,t,s){let i,r,o;for(i=0,r=n.length;i<r;++i)if(o=n[i],o!==void 0&&o!==void 0)return o}function bN(n,e,t){const{min:s,max:i}=n,r=AT(e,(i-s)/2),o=(a,l)=>t&&a===0?0:a+l;return{min:o(s,-Math.abs(r)),max:o(i,r)}}function ls(n,e){return Object.assign(Object.create(n),e)}function Nl(n,e=[""],t,s,i=()=>n[0]){const r=t||n;typeof s>"u"&&(s=Em("_fallback",n));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:r,_fallback:s,_getTarget:i,override:a=>Nl([a,...n],e,r,s)};return new Proxy(o,{deleteProperty(a,l){return delete a[l],delete a._keys,delete n[0][l],!0},get(a,l){return Tm(a,l,()=>CN(l,e,n,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(a,l){return qd(a).includes(l)},ownKeys(a){return qd(a)},set(a,l,c){const d=a._storage||(a._storage=i());return a[l]=d[l]=c,delete a._keys,!0}})}function Is(n,e,t,s){const i={_cacheable:!1,_proxy:n,_context:e,_subProxy:t,_stack:new Set,_descriptors:Dm(n,s),setContext:r=>Is(n,r,t,s),override:r=>Is(n.override(r),e,t,s)};return new Proxy(i,{deleteProperty(r,o){return delete r[o],delete n[o],!0},get(r,o,a){return Tm(r,o,()=>_N(r,o,a))},getOwnPropertyDescriptor(r,o){return r._descriptors.allKeys?Reflect.has(n,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,o)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(r,o){return Reflect.has(n,o)},ownKeys(){return Reflect.ownKeys(n)},set(r,o,a){return n[o]=a,delete r[o],!0}})}function Dm(n,e={scriptable:!0,indexable:!0}){const{_scriptable:t=e.scriptable,_indexable:s=e.indexable,_allKeys:i=e.allKeys}=n;return{allKeys:i,scriptable:t,indexable:s,isScriptable:Dn(t)?t:()=>t,isIndexable:Dn(s)?s:()=>s}}const xN=(n,e)=>n?n+Sl(e):e,El=(n,e)=>X(e)&&n!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function Tm(n,e,t){if(Object.prototype.hasOwnProperty.call(n,e)||e==="constructor")return n[e];const s=t();return n[e]=s,s}function _N(n,e,t){const{_proxy:s,_context:i,_subProxy:r,_descriptors:o}=n;let a=s[e];return Dn(a)&&o.isScriptable(e)&&(a=kN(e,a,n,t)),_e(a)&&a.length&&(a=wN(e,a,n,o.isIndexable)),El(e,a)&&(a=Is(a,i,r&&r[e],o)),a}function kN(n,e,t,s){const{_proxy:i,_context:r,_subProxy:o,_stack:a}=t;if(a.has(n))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+n);a.add(n);let l=e(r,o||s);return a.delete(n),El(n,l)&&(l=Al(i._scopes,i,n,l)),l}function wN(n,e,t,s){const{_proxy:i,_context:r,_subProxy:o,_descriptors:a}=t;if(typeof r.index<"u"&&s(n))return e[r.index%e.length];if(X(e[0])){const l=e,c=i._scopes.filter(d=>d!==l);e=[];for(const d of l){const u=Al(c,i,n,d);e.push(Is(u,r,o&&o[n],a))}}return e}function Nm(n,e,t){return Dn(n)?n(e,t):n}const vN=(n,e)=>n===!0?e:typeof n=="string"?Ir(e,n):void 0;function SN(n,e,t,s,i){for(const r of e){const o=vN(t,r);if(o){n.add(o);const a=Nm(o._fallback,t,i);if(typeof a<"u"&&a!==t&&a!==s)return a}else if(o===!1&&typeof s<"u"&&t!==s)return null}return!1}function Al(n,e,t,s){const i=e._rootScopes,r=Nm(e._fallback,t,s),o=[...n,...i],a=new Set;a.add(s);let l=Yd(a,o,t,r||t,s);return l===null||typeof r<"u"&&r!==t&&(l=Yd(a,o,r,l,s),l===null)?!1:Nl(Array.from(a),[""],i,r,()=>MN(e,t,s))}function Yd(n,e,t,s,i){for(;t;)t=SN(n,e,t,s,i);return t}function MN(n,e,t){const s=n._getTarget();e in s||(s[e]={});const i=s[e];return _e(i)&&X(t)?t:i||{}}function CN(n,e,t,s){let i;for(const r of e)if(i=Em(xN(r,n),t),typeof i<"u")return El(n,i)?Al(t,s,n,i):i}function Em(n,e){for(const t of e){if(!t)continue;const s=t[n];if(typeof s<"u")return s}}function qd(n){let e=n._keys;return e||(e=n._keys=ON(n._scopes)),e}function ON(n){const e=new Set;for(const t of n)for(const s of Object.keys(t).filter(i=>!i.startsWith("_")))e.add(s);return Array.from(e)}const DN=Number.EPSILON||1e-14,Rs=(n,e)=>e<n.length&&!n[e].skip&&n[e],Am=n=>n==="x"?"y":"x";function TN(n,e,t,s){const i=n.skip?e:n,r=e,o=t.skip?e:t,a=Aa(r,i),l=Aa(o,r);let c=a/(a+l),d=l/(a+l);c=isNaN(c)?0:c,d=isNaN(d)?0:d;const u=s*c,h=s*d;return{previous:{x:r.x-u*(o.x-i.x),y:r.y-u*(o.y-i.y)},next:{x:r.x+h*(o.x-i.x),y:r.y+h*(o.y-i.y)}}}function NN(n,e,t){const s=n.length;let i,r,o,a,l,c=Rs(n,0);for(let d=0;d<s-1;++d)if(l=c,c=Rs(n,d+1),!(!l||!c)){if(hi(e[d],0,DN)){t[d]=t[d+1]=0;continue}i=t[d]/e[d],r=t[d+1]/e[d],a=Math.pow(i,2)+Math.pow(r,2),!(a<=9)&&(o=3/Math.sqrt(a),t[d]=i*o*e[d],t[d+1]=r*o*e[d])}}function EN(n,e,t="x"){const s=Am(t),i=n.length;let r,o,a,l=Rs(n,0);for(let c=0;c<i;++c){if(o=a,a=l,l=Rs(n,c+1),!a)continue;const d=a[t],u=a[s];o&&(r=(d-o[t])/3,a[`cp1${t}`]=d-r,a[`cp1${s}`]=u-r*e[c]),l&&(r=(l[t]-d)/3,a[`cp2${t}`]=d+r,a[`cp2${s}`]=u+r*e[c])}}function AN(n,e="x"){const t=Am(e),s=n.length,i=Array(s).fill(0),r=Array(s);let o,a,l,c=Rs(n,0);for(o=0;o<s;++o)if(a=l,l=c,c=Rs(n,o+1),!!l){if(c){const d=c[e]-l[e];i[o]=d!==0?(c[t]-l[t])/d:0}r[o]=a?c?Ps(i[o-1])!==Ps(i[o])?0:(i[o-1]+i[o])/2:i[o-1]:i[o]}NN(n,i,r),EN(n,r,e)}function sr(n,e,t){return Math.max(Math.min(n,t),e)}function PN(n,e){let t,s,i,r,o,a=Ni(n[0],e);for(t=0,s=n.length;t<s;++t)o=r,r=a,a=t<s-1&&Ni(n[t+1],e),r&&(i=n[t],o&&(i.cp1x=sr(i.cp1x,e.left,e.right),i.cp1y=sr(i.cp1y,e.top,e.bottom)),a&&(i.cp2x=sr(i.cp2x,e.left,e.right),i.cp2y=sr(i.cp2y,e.top,e.bottom)))}function IN(n,e,t,s,i){let r,o,a,l;if(e.spanGaps&&(n=n.filter(c=>!c.skip)),e.cubicInterpolationMode==="monotone")AN(n,i);else{let c=s?n[n.length-1]:n[0];for(r=0,o=n.length;r<o;++r)a=n[r],l=TN(c,a,n[Math.min(r+1,o-(s?0:1))%o],e.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}e.capBezierPoints&&PN(n,t)}function Pl(){return typeof window<"u"&&typeof document<"u"}function Il(n){let e=n.parentNode;return e&&e.toString()==="[object ShadowRoot]"&&(e=e.host),e}function Lr(n,e,t){let s;return typeof n=="string"?(s=parseInt(n,10),n.indexOf("%")!==-1&&(s=s/100*e.parentNode[t])):s=n,s}const ao=n=>n.ownerDocument.defaultView.getComputedStyle(n,null);function RN(n,e){return ao(n).getPropertyValue(e)}const zN=["top","right","bottom","left"];function Zn(n,e,t){const s={};t=t?"-"+t:"";for(let i=0;i<4;i++){const r=zN[i];s[r]=parseFloat(n[e+"-"+r+t])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const BN=(n,e,t)=>(n>0||e>0)&&(!t||!t.shadowRoot);function jN(n,e){const t=n.touches,s=t&&t.length?t[0]:n,{offsetX:i,offsetY:r}=s;let o=!1,a,l;if(BN(i,r,n.target))a=i,l=r;else{const c=e.getBoundingClientRect();a=s.clientX-c.left,l=s.clientY-c.top,o=!0}return{x:a,y:l,box:o}}function Ln(n,e){if("native"in n)return n;const{canvas:t,currentDevicePixelRatio:s}=e,i=ao(t),r=i.boxSizing==="border-box",o=Zn(i,"padding"),a=Zn(i,"border","width"),{x:l,y:c,box:d}=jN(n,t),u=o.left+(d&&a.left),h=o.top+(d&&a.top);let{width:f,height:p}=e;return r&&(f-=o.width+a.width,p-=o.height+a.height),{x:Math.round((l-u)/f*t.width/s),y:Math.round((c-h)/p*t.height/s)}}function LN(n,e,t){let s,i;if(e===void 0||t===void 0){const r=n&&Il(n);if(!r)e=n.clientWidth,t=n.clientHeight;else{const o=r.getBoundingClientRect(),a=ao(r),l=Zn(a,"border","width"),c=Zn(a,"padding");e=o.width-c.width-l.width,t=o.height-c.height-l.height,s=Lr(a.maxWidth,r,"clientWidth"),i=Lr(a.maxHeight,r,"clientHeight")}}return{width:e,height:t,maxWidth:s||zr,maxHeight:i||zr}}const yn=n=>Math.round(n*10)/10;function FN(n,e,t,s){const i=ao(n),r=Zn(i,"margin"),o=Lr(i.maxWidth,n,"clientWidth")||zr,a=Lr(i.maxHeight,n,"clientHeight")||zr,l=LN(n,e,t);let{width:c,height:d}=l;if(i.boxSizing==="content-box"){const h=Zn(i,"border","width"),f=Zn(i,"padding");c-=f.width+h.width,d-=f.height+h.height}return c=Math.max(0,c-r.width),d=Math.max(0,s?c/s:d-r.height),c=yn(Math.min(c,o,l.maxWidth)),d=yn(Math.min(d,a,l.maxHeight)),c&&!d&&(d=yn(c/2)),(e!==void 0||t!==void 0)&&s&&l.height&&d>l.height&&(d=l.height,c=yn(Math.floor(d*s))),{width:c,height:d}}function Kd(n,e,t){const s=e||1,i=yn(n.height*s),r=yn(n.width*s);n.height=yn(n.height),n.width=yn(n.width);const o=n.canvas;return o.style&&(t||!o.style.height&&!o.style.width)&&(o.style.height=`${n.height}px`,o.style.width=`${n.width}px`),n.currentDevicePixelRatio!==s||o.height!==i||o.width!==r?(n.currentDevicePixelRatio=s,o.height=i,o.width=r,n.ctx.setTransform(s,0,0,s,0,0),!0):!1}const WN=(function(){let n=!1;try{const e={get passive(){return n=!0,!1}};Pl()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return n})();function Ud(n,e){const t=RN(n,e),s=t&&t.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function Fn(n,e,t,s){return{x:n.x+t*(e.x-n.x),y:n.y+t*(e.y-n.y)}}function $N(n,e,t,s){return{x:n.x+t*(e.x-n.x),y:s==="middle"?t<.5?n.y:e.y:s==="after"?t<1?n.y:e.y:t>0?e.y:n.y}}function HN(n,e,t,s){const i={x:n.cp2x,y:n.cp2y},r={x:e.cp1x,y:e.cp1y},o=Fn(n,i,t),a=Fn(i,r,t),l=Fn(r,e,t),c=Fn(o,a,t),d=Fn(a,l,t);return Fn(c,d,t)}const VN=function(n,e){return{x(t){return n+n+e-t},setWidth(t){e=t},textAlign(t){return t==="center"?t:t==="right"?"left":"right"},xPlus(t,s){return t-s},leftForLtr(t,s){return t-s}}},YN=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,e){return n+e},leftForLtr(n,e){return n}}};function Ms(n,e,t){return n?VN(e,t):YN()}function Pm(n,e){let t,s;(e==="ltr"||e==="rtl")&&(t=n.canvas.style,s=[t.getPropertyValue("direction"),t.getPropertyPriority("direction")],t.setProperty("direction",e,"important"),n.prevTextDirection=s)}function Im(n,e){e!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",e[0],e[1]))}function Rm(n){return n==="angle"?{between:Ml,compare:YT,normalize:at}:{between:nn,compare:(e,t)=>e-t,normalize:e=>e}}function Jd({start:n,end:e,count:t,loop:s,style:i}){return{start:n%t,end:e%t,loop:s&&(e-n+1)%t===0,style:i}}function qN(n,e,t){const{property:s,start:i,end:r}=t,{between:o,normalize:a}=Rm(s),l=e.length;let{start:c,end:d,loop:u}=n,h,f;if(u){for(c+=l,d+=l,h=0,f=l;h<f&&o(a(e[c%l][s]),i,r);++h)c--,d--;c%=l,d%=l}return d<c&&(d+=l),{start:c,end:d,loop:u,style:n.style}}function zm(n,e,t){if(!t)return[n];const{property:s,start:i,end:r}=t,o=e.length,{compare:a,between:l,normalize:c}=Rm(s),{start:d,end:u,loop:h,style:f}=qN(n,e,t),p=[];let m=!1,g=null,b,S,_;const k=()=>l(i,_,b)&&a(i,_)!==0,v=()=>a(r,b)===0||l(r,_,b),w=()=>m||k(),M=()=>!m||v();for(let C=d,O=d;C<=u;++C)S=e[C%o],!S.skip&&(b=c(S[s]),b!==_&&(m=l(b,i,r),g===null&&w()&&(g=a(b,i)===0?C:O),g!==null&&M()&&(p.push(Jd({start:g,end:C,loop:h,count:o,style:f})),g=null),O=C,_=b));return g!==null&&p.push(Jd({start:g,end:u,loop:h,count:o,style:f})),p}function Bm(n,e){const t=[],s=n.segments;for(let i=0;i<s.length;i++){const r=zm(s[i],n.points,e);r.length&&t.push(...r)}return t}function KN(n,e,t,s){let i=0,r=e-1;if(t&&!s)for(;i<e&&!n[i].skip;)i++;for(;i<e&&n[i].skip;)i++;for(i%=e,t&&(r+=i);r>i&&n[r%e].skip;)r--;return r%=e,{start:i,end:r}}function UN(n,e,t,s){const i=n.length,r=[];let o=e,a=n[e],l;for(l=e+1;l<=t;++l){const c=n[l%i];c.skip||c.stop?a.skip||(s=!1,r.push({start:e%i,end:(l-1)%i,loop:s}),e=o=c.stop?l:null):(o=l,a.skip&&(e=l)),a=c}return o!==null&&r.push({start:e%i,end:o%i,loop:s}),r}function JN(n,e){const t=n.points,s=n.options.spanGaps,i=t.length;if(!i)return[];const r=!!n._loop,{start:o,end:a}=KN(t,i,r,s);if(s===!0)return Gd(n,[{start:o,end:a,loop:r}],t,e);const l=a<o?a+i:a,c=!!n._fullLoop&&o===0&&a===i-1;return Gd(n,UN(t,o,l,c),t,e)}function Gd(n,e,t,s){return!s||!s.setContext||!t?e:GN(n,e,t,s)}function GN(n,e,t,s){const i=n._chart.getContext(),r=Xd(n.options),{_datasetIndex:o,options:{spanGaps:a}}=n,l=t.length,c=[];let d=r,u=e[0].start,h=u;function f(p,m,g,b){const S=a?-1:1;if(p!==m){for(p+=l;t[p%l].skip;)p-=S;for(;t[m%l].skip;)m+=S;p%l!==m%l&&(c.push({start:p%l,end:m%l,loop:g,style:b}),d=b,u=m%l)}}for(const p of e){u=a?u:p.start;let m=t[u%l],g;for(h=u+1;h<=p.end;h++){const b=t[h%l];g=Xd(s.setContext(ls(i,{type:"segment",p0:m,p1:b,p0DataIndex:(h-1)%l,p1DataIndex:h%l,datasetIndex:o}))),XN(g,d)&&f(u,h-1,p.loop,d),m=b,d=g}u<h-1&&f(u,h-1,p.loop,d)}return c}function Xd(n){return{backgroundColor:n.backgroundColor,borderCapStyle:n.borderCapStyle,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderJoinStyle:n.borderJoinStyle,borderWidth:n.borderWidth,borderColor:n.borderColor}}function XN(n,e){if(!e)return!1;const t=[],s=function(i,r){return Dl(r)?(t.includes(r)||t.push(r),t.indexOf(r)):r};return JSON.stringify(n,s)!==JSON.stringify(e,s)}function ir(n,e,t){return n.options.clip?n[t]:e[t]}function QN(n,e){const{xScale:t,yScale:s}=n;return t&&s?{left:ir(t,e,"left"),right:ir(t,e,"right"),top:ir(s,e,"top"),bottom:ir(s,e,"bottom")}:e}function jm(n,e){const t=e._clip;if(t.disabled)return!1;const s=QN(e,n.chartArea);return{left:t.left===!1?0:s.left-(t.left===!0?0:t.left),right:t.right===!1?n.width:s.right+(t.right===!0?0:t.right),top:t.top===!1?0:s.top-(t.top===!0?0:t.top),bottom:t.bottom===!1?n.height:s.bottom+(t.bottom===!0?0:t.bottom)}}class ZN{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,s,i){const r=t.listeners[i],o=t.duration;r.forEach(a=>a({chart:e,initial:t.initial,numSteps:o,currentStep:Math.min(s-t.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=wm.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((s,i)=>{if(!s.running||!s.items.length)return;const r=s.items;let o=r.length-1,a=!1,l;for(;o>=0;--o)l=r[o],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(e),a=!0):(r[o]=r[r.length-1],r.pop());a&&(i.draw(),this._notify(i,s,e,"progress")),r.length||(s.running=!1,this._notify(i,s,e,"complete"),s.initial=!1),t+=r.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){const t=this._charts;let s=t.get(e);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,s)),s}listen(e,t,s){this._getAnims(e).listeners[t].push(s)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){const t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((s,i)=>Math.max(s,i._duration),0),this._refresh())}running(e){if(!this._running)return!1;const t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){const t=this._charts.get(e);if(!t||!t.items.length)return;const s=t.items;let i=s.length-1;for(;i>=0;--i)s[i].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var Kt=new ZN;const Qd="transparent",eE={boolean(n,e,t){return t>.5?e:n},color(n,e,t){const s=Wd(n||Qd),i=s.valid&&Wd(e||Qd);return i&&i.valid?i.mix(s,t).hexString():e},number(n,e,t){return n+(e-n)*t}};class tE{constructor(e,t,s,i){const r=t[s];i=nr([e.to,i,r,e.from]);const o=nr([e.from,r,i]);this._active=!0,this._fn=e.fn||eE[e.type||typeof o],this._easing=fi[e.easing]||fi.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=s,this._from=o,this._to=i,this._promises=void 0}active(){return this._active}update(e,t,s){if(this._active){this._notify(!1);const i=this._target[this._prop],r=s-this._start,o=this._duration-r;this._start=s,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=r,this._loop=!!e.loop,this._to=nr([e.to,t,i,e.from]),this._from=nr([e.from,i,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const t=e-this._start,s=this._duration,i=this._prop,r=this._from,o=this._loop,a=this._to;let l;if(this._active=r!==a&&(o||t<s),!this._active){this._target[i]=a,this._notify(!0);return}if(t<0){this._target[i]=r;return}l=t/s%2,l=o&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[i]=this._fn(r,a,l)}wait(){const e=this._promises||(this._promises=[]);return new Promise((t,s)=>{e.push({res:t,rej:s})})}_notify(e){const t=e?"res":"rej",s=this._promises||[];for(let i=0;i<s.length;i++)s[i][t]()}}class Lm{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!X(e))return;const t=Object.keys(ge.animation),s=this._properties;Object.getOwnPropertyNames(e).forEach(i=>{const r=e[i];if(!X(r))return;const o={};for(const a of t)o[a]=r[a];(_e(r.properties)&&r.properties||[i]).forEach(a=>{(a===i||!s.has(a))&&s.set(a,o)})})}_animateOptions(e,t){const s=t.options,i=sE(e,s);if(!i)return[];const r=this._createAnimations(i,s);return s.$shared&&nE(e.options.$animations,s).then(()=>{e.options=s},()=>{}),r}_createAnimations(e,t){const s=this._properties,i=[],r=e.$animations||(e.$animations={}),o=Object.keys(t),a=Date.now();let l;for(l=o.length-1;l>=0;--l){const c=o[l];if(c.charAt(0)==="$")continue;if(c==="options"){i.push(...this._animateOptions(e,t));continue}const d=t[c];let u=r[c];const h=s.get(c);if(u)if(h&&u.active()){u.update(h,d,a);continue}else u.cancel();if(!h||!h.duration){e[c]=d;continue}r[c]=u=new tE(h,e,c,d),i.push(u)}return i}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}const s=this._createAnimations(e,t);if(s.length)return Kt.add(this._chart,s),!0}}function nE(n,e){const t=[],s=Object.keys(e);for(let i=0;i<s.length;i++){const r=n[s[i]];r&&r.active()&&t.push(r.wait())}return Promise.all(t)}function sE(n,e){if(!e)return;let t=n.options;if(!t){n.options=e;return}return t.$shared&&(n.options=t=Object.assign({},t,{$shared:!1,$animations:{}})),t}function Zd(n,e){const t=n&&n.options||{},s=t.reverse,i=t.min===void 0?e:0,r=t.max===void 0?e:0;return{start:s?r:i,end:s?i:r}}function iE(n,e,t){if(t===!1)return!1;const s=Zd(n,t),i=Zd(e,t);return{top:i.end,right:s.end,bottom:i.start,left:s.start}}function rE(n){let e,t,s,i;return X(n)?(e=n.top,t=n.right,s=n.bottom,i=n.left):e=t=s=i=n,{top:e,right:t,bottom:s,left:i,disabled:n===!1}}function Fm(n,e){const t=[],s=n._getSortedDatasetMetas(e);let i,r;for(i=0,r=s.length;i<r;++i)t.push(s[i].index);return t}function eu(n,e,t,s={}){const i=n.keys,r=s.mode==="single";let o,a,l,c;if(e===null)return;let d=!1;for(o=0,a=i.length;o<a;++o){if(l=+i[o],l===t){if(d=!0,s.all)continue;break}c=n.values[l],Le(c)&&(r||e===0||Ps(e)===Ps(c))&&(e+=c)}return!d&&!s.all?0:e}function oE(n,e){const{iScale:t,vScale:s}=e,i=t.axis==="x"?"x":"y",r=s.axis==="x"?"x":"y",o=Object.keys(n),a=new Array(o.length);let l,c,d;for(l=0,c=o.length;l<c;++l)d=o[l],a[l]={[i]:d,[r]:n[d]};return a}function Xo(n,e){const t=n&&n.options.stacked;return t||t===void 0&&e.stack!==void 0}function aE(n,e,t){return`${n.id}.${e.id}.${t.stack||t.type}`}function lE(n){const{min:e,max:t,minDefined:s,maxDefined:i}=n.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:i?t:Number.POSITIVE_INFINITY}}function cE(n,e,t){const s=n[e]||(n[e]={});return s[t]||(s[t]={})}function tu(n,e,t,s){for(const i of e.getMatchingVisibleMetas(s).reverse()){const r=n[i.index];if(t&&r>0||!t&&r<0)return i.index}return null}function nu(n,e){const{chart:t,_cachedMeta:s}=n,i=t._stacks||(t._stacks={}),{iScale:r,vScale:o,index:a}=s,l=r.axis,c=o.axis,d=aE(r,o,s),u=e.length;let h;for(let f=0;f<u;++f){const p=e[f],{[l]:m,[c]:g}=p,b=p._stacks||(p._stacks={});h=b[c]=cE(i,d,m),h[a]=g,h._top=tu(h,o,!0,s.type),h._bottom=tu(h,o,!1,s.type);const S=h._visualValues||(h._visualValues={});S[a]=g}}function Qo(n,e){const t=n.scales;return Object.keys(t).filter(s=>t[s].axis===e).shift()}function dE(n,e){return ls(n,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function uE(n,e,t){return ls(n,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:t,index:e,mode:"default",type:"data"})}function Ks(n,e){const t=n.controller.index,s=n.vScale&&n.vScale.axis;if(s){e=e||n._parsed;for(const i of e){const r=i._stacks;if(!r||r[s]===void 0||r[s][t]===void 0)return;delete r[s][t],r[s]._visualValues!==void 0&&r[s]._visualValues[t]!==void 0&&delete r[s]._visualValues[t]}}}const Zo=n=>n==="reset"||n==="none",su=(n,e)=>e?n:Object.assign({},n),hE=(n,e,t)=>n&&!e.hidden&&e._stacked&&{keys:Fm(t,!0),values:null};class fE{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=Xo(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&Ks(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,t=this._cachedMeta,s=this.getDataset(),i=(u,h,f,p)=>u==="x"?h:u==="r"?p:f,r=t.xAxisID=J(s.xAxisID,Qo(e,"x")),o=t.yAxisID=J(s.yAxisID,Qo(e,"y")),a=t.rAxisID=J(s.rAxisID,Qo(e,"r")),l=t.indexAxis,c=t.iAxisID=i(l,r,o,a),d=t.vAxisID=i(l,o,r,a);t.xScale=this.getScaleForId(r),t.yScale=this.getScaleForId(o),t.rScale=this.getScaleForId(a),t.iScale=this.getScaleForId(c),t.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&jd(this._data,this),e._stacked&&Ks(e)}_dataCheck(){const e=this.getDataset(),t=e.data||(e.data=[]),s=this._data;if(X(t)){const i=this._cachedMeta;this._data=oE(t,i)}else if(s!==t){if(s){jd(s,this);const i=this._cachedMeta;Ks(i),i._parsed=[]}t&&Object.isExtensible(t)&&JT(t,this),this._syncList=[],this._data=t}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const t=this._cachedMeta,s=this.getDataset();let i=!1;this._dataCheck();const r=t._stacked;t._stacked=Xo(t.vScale,t),t.stack!==s.stack&&(i=!0,Ks(t),t.stack=s.stack),this._resyncElements(e),(i||r!==t._stacked)&&(nu(this,t._parsed),t._stacked=Xo(t.vScale,t))}configure(){const e=this.chart.config,t=e.datasetScopeKeys(this._type),s=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){const{_cachedMeta:s,_data:i}=this,{iScale:r,_stacked:o}=s,a=r.axis;let l=e===0&&t===i.length?!0:s._sorted,c=e>0&&s._parsed[e-1],d,u,h;if(this._parsing===!1)s._parsed=i,s._sorted=!0,h=i;else{_e(i[e])?h=this.parseArrayData(s,i,e,t):X(i[e])?h=this.parseObjectData(s,i,e,t):h=this.parsePrimitiveData(s,i,e,t);const f=()=>u[a]===null||c&&u[a]<c[a];for(d=0;d<t;++d)s._parsed[d+e]=u=h[d],l&&(f()&&(l=!1),c=u);s._sorted=l}o&&nu(this,h)}parsePrimitiveData(e,t,s,i){const{iScale:r,vScale:o}=e,a=r.axis,l=o.axis,c=r.getLabels(),d=r===o,u=new Array(i);let h,f,p;for(h=0,f=i;h<f;++h)p=h+s,u[h]={[a]:d||r.parse(c[p],p),[l]:o.parse(t[p],p)};return u}parseArrayData(e,t,s,i){const{xScale:r,yScale:o}=e,a=new Array(i);let l,c,d,u;for(l=0,c=i;l<c;++l)d=l+s,u=t[d],a[l]={x:r.parse(u[0],d),y:o.parse(u[1],d)};return a}parseObjectData(e,t,s,i){const{xScale:r,yScale:o}=e,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(i);let d,u,h,f;for(d=0,u=i;d<u;++d)h=d+s,f=t[h],c[d]={x:r.parse(Ir(f,a),h),y:o.parse(Ir(f,l),h)};return c}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,t,s){const i=this.chart,r=this._cachedMeta,o=t[e.axis],a={keys:Fm(i,!0),values:t._stacks[e.axis]._visualValues};return eu(a,o,r.index,{mode:s})}updateRangeFromParsed(e,t,s,i){const r=s[t.axis];let o=r===null?NaN:r;const a=i&&s._stacks[t.axis];i&&a&&(i.values=a,o=eu(i,r,this._cachedMeta.index)),e.min=Math.min(e.min,o),e.max=Math.max(e.max,o)}getMinMax(e,t){const s=this._cachedMeta,i=s._parsed,r=s._sorted&&e===s.iScale,o=i.length,a=this._getOtherScale(e),l=hE(t,s,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:u}=lE(a);let h,f;function p(){f=i[h];const m=f[a.axis];return!Le(f[e.axis])||d>m||u<m}for(h=0;h<o&&!(!p()&&(this.updateRangeFromParsed(c,e,f,l),r));++h);if(r){for(h=o-1;h>=0;--h)if(!p()){this.updateRangeFromParsed(c,e,f,l);break}}return c}getAllParsedValues(e){const t=this._cachedMeta._parsed,s=[];let i,r,o;for(i=0,r=t.length;i<r;++i)o=t[i][e.axis],Le(o)&&s.push(o);return s}getMaxOverflow(){return!1}getLabelAndValue(e){const t=this._cachedMeta,s=t.iScale,i=t.vScale,r=this.getParsed(e);return{label:s?""+s.getLabelForValue(r[s.axis]):"",value:i?""+i.getLabelForValue(r[i.axis]):""}}_update(e){const t=this._cachedMeta;this.update(e||"default"),t._clip=rE(J(this.options.clip,iE(t.xScale,t.yScale,this.getMaxOverflow())))}update(e){}draw(){const e=this._ctx,t=this.chart,s=this._cachedMeta,i=s.data||[],r=t.chartArea,o=[],a=this._drawStart||0,l=this._drawCount||i.length-a,c=this.options.drawActiveElementsOnTop;let d;for(s.dataset&&s.dataset.draw(e,r,a,l),d=a;d<a+l;++d){const u=i[d];u.hidden||(u.active&&c?o.push(u):u.draw(e,r))}for(d=0;d<o.length;++d)o[d].draw(e,r)}getStyle(e,t){const s=t?"active":"default";return e===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(s):this.resolveDataElementOptions(e||0,s)}getContext(e,t,s){const i=this.getDataset();let r;if(e>=0&&e<this._cachedMeta.data.length){const o=this._cachedMeta.data[e];r=o.$context||(o.$context=uE(this.getContext(),e,o)),r.parsed=this.getParsed(e),r.raw=i.data[e],r.index=r.dataIndex=e}else r=this.$context||(this.$context=dE(this.chart.getContext(),this.index)),r.dataset=i,r.index=r.datasetIndex=this.index;return r.active=!!t,r.mode=s,r}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,t){return this._resolveElementOptions(this.dataElementType.id,t,e)}_resolveElementOptions(e,t="default",s){const i=t==="active",r=this._cachedDataOpts,o=e+"-"+t,a=r[o],l=this.enableOptionSharing&&Rr(s);if(a)return su(a,l);const c=this.chart.config,d=c.datasetElementScopeKeys(this._type,e),u=i?[`${e}Hover`,"hover",e,""]:[e,""],h=c.getOptionScopes(this.getDataset(),d),f=Object.keys(ge.elements[e]),p=()=>this.getContext(s,i,t),m=c.resolveNamedOptions(h,f,p,u);return m.$shared&&(m.$shared=l,r[o]=Object.freeze(su(m,l))),m}_resolveAnimations(e,t,s){const i=this.chart,r=this._cachedDataOpts,o=`animation-${t}`,a=r[o];if(a)return a;let l;if(i.options.animation!==!1){const d=this.chart.config,u=d.datasetAnimationScopeKeys(this._type,t),h=d.getOptionScopes(this.getDataset(),u);l=d.createResolver(h,this.getContext(e,s,t))}const c=new Lm(i,l&&l.animations);return l&&l._cacheable&&(r[o]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||Zo(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){const s=this.resolveDataElementOptions(e,t),i=this._sharedOptions,r=this.getSharedOptions(s),o=this.includeOptions(t,r)||r!==i;return this.updateSharedOptions(r,t,s),{sharedOptions:r,includeOptions:o}}updateElement(e,t,s,i){Zo(i)?Object.assign(e,s):this._resolveAnimations(t,i).update(e,s)}updateSharedOptions(e,t,s){e&&!Zo(t)&&this._resolveAnimations(void 0,t).update(e,s)}_setStyle(e,t,s,i){e.active=i;const r=this.getStyle(t,i);this._resolveAnimations(t,s,i).update(e,{options:!i&&this.getSharedOptions(r)||r})}removeHoverStyle(e,t,s){this._setStyle(e,s,"active",!1)}setHoverStyle(e,t,s){this._setStyle(e,s,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const t=this._data,s=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const i=s.length,r=t.length,o=Math.min(r,i);o&&this.parse(0,o),r>i?this._insertElements(i,r-i,e):r<i&&this._removeElements(r,i-r)}_insertElements(e,t,s=!0){const i=this._cachedMeta,r=i.data,o=e+t;let a;const l=c=>{for(c.length+=t,a=c.length-1;a>=o;a--)c[a]=c[a-t]};for(l(r),a=e;a<o;++a)r[a]=new this.dataElementType;this._parsing&&l(i._parsed),this.parse(e,t),s&&this.updateElements(r,e,t,"reset")}updateElements(e,t,s,i){}_removeElements(e,t){const s=this._cachedMeta;if(this._parsing){const i=s._parsed.splice(e,t);s._stacked&&Ks(s,i)}s.data.splice(e,t)}_sync(e){if(this._parsing)this._syncList.push(e);else{const[t,s,i]=e;this[t](s,i)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){const e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,t){t&&this._sync(["_removeElements",e,t]);const s=arguments.length-2;s&&this._sync(["_insertElements",e,s])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function zn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Rl{static override(e){Object.assign(Rl.prototype,e)}options;constructor(e){this.options=e||{}}init(){}formats(){return zn()}parse(){return zn()}format(){return zn()}add(){return zn()}diff(){return zn()}startOf(){return zn()}endOf(){return zn()}}var pE={_date:Rl};function mE(n,e,t,s){const{controller:i,data:r,_sorted:o}=n,a=i._cachedMeta.iScale,l=n.dataset&&n.dataset.options?n.dataset.options.spanGaps:null;if(a&&e===a.axis&&e!=="r"&&o&&r.length){const c=a._reversePixels?KT:Pa;if(s){if(i._sharedOptions){const d=r[0],u=typeof d.getRange=="function"&&d.getRange(e);if(u){const h=c(r,e,t-u),f=c(r,e,t+u);return{lo:h.lo,hi:f.hi}}}}else{const d=c(r,e,t);if(l){const{vScale:u}=i._cachedMeta,{_parsed:h}=n,f=h.slice(0,d.lo+1).reverse().findIndex(m=>!pe(m[u.axis]));d.lo-=Math.max(0,f);const p=h.slice(d.hi).findIndex(m=>!pe(m[u.axis]));d.hi+=Math.max(0,p)}return d}}return{lo:0,hi:r.length-1}}function lo(n,e,t,s,i){const r=n.getSortedVisibleDatasetMetas(),o=t[e];for(let a=0,l=r.length;a<l;++a){const{index:c,data:d}=r[a],{lo:u,hi:h}=mE(r[a],e,o,i);for(let f=u;f<=h;++f){const p=d[f];p.skip||s(p,c,f)}}}function gE(n){const e=n.indexOf("x")!==-1,t=n.indexOf("y")!==-1;return function(s,i){const r=e?Math.abs(s.x-i.x):0,o=t?Math.abs(s.y-i.y):0;return Math.sqrt(Math.pow(r,2)+Math.pow(o,2))}}function ea(n,e,t,s,i){const r=[];return!i&&!n.isPointInArea(e)||lo(n,t,e,function(a,l,c){!i&&!Ni(a,n.chartArea,0)||a.inRange(e.x,e.y,s)&&r.push({element:a,datasetIndex:l,index:c})},!0),r}function yE(n,e,t,s){let i=[];function r(o,a,l){const{startAngle:c,endAngle:d}=o.getProps(["startAngle","endAngle"],s),{angle:u}=_m(o,{x:e.x,y:e.y});Ml(u,c,d)&&i.push({element:o,datasetIndex:a,index:l})}return lo(n,t,e,r),i}function bE(n,e,t,s,i,r){let o=[];const a=gE(t);let l=Number.POSITIVE_INFINITY;function c(d,u,h){const f=d.inRange(e.x,e.y,i);if(s&&!f)return;const p=d.getCenterPoint(i);if(!(!!r||n.isPointInArea(p))&&!f)return;const g=a(e,p);g<l?(o=[{element:d,datasetIndex:u,index:h}],l=g):g===l&&o.push({element:d,datasetIndex:u,index:h})}return lo(n,t,e,c),o}function ta(n,e,t,s,i,r){return!r&&!n.isPointInArea(e)?[]:t==="r"&&!s?yE(n,e,t,i):bE(n,e,t,s,i,r)}function iu(n,e,t,s,i){const r=[],o=t==="x"?"inXRange":"inYRange";let a=!1;return lo(n,t,e,(l,c,d)=>{l[o]&&l[o](e[t],i)&&(r.push({element:l,datasetIndex:c,index:d}),a=a||l.inRange(e.x,e.y,i))}),s&&!a?[]:r}var xE={modes:{index(n,e,t,s){const i=Ln(e,n),r=t.axis||"x",o=t.includeInvisible||!1,a=t.intersect?ea(n,i,r,s,o):ta(n,i,r,!1,s,o),l=[];return a.length?(n.getSortedVisibleDatasetMetas().forEach(c=>{const d=a[0].index,u=c.data[d];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:d})}),l):[]},dataset(n,e,t,s){const i=Ln(e,n),r=t.axis||"xy",o=t.includeInvisible||!1;let a=t.intersect?ea(n,i,r,s,o):ta(n,i,r,!1,s,o);if(a.length>0){const l=a[0].datasetIndex,c=n.getDatasetMeta(l).data;a=[];for(let d=0;d<c.length;++d)a.push({element:c[d],datasetIndex:l,index:d})}return a},point(n,e,t,s){const i=Ln(e,n),r=t.axis||"xy",o=t.includeInvisible||!1;return ea(n,i,r,s,o)},nearest(n,e,t,s){const i=Ln(e,n),r=t.axis||"xy",o=t.includeInvisible||!1;return ta(n,i,r,t.intersect,s,o)},x(n,e,t,s){const i=Ln(e,n);return iu(n,i,"x",t.intersect,s)},y(n,e,t,s){const i=Ln(e,n);return iu(n,i,"y",t.intersect,s)}}};const Wm=["left","top","right","bottom"];function Us(n,e){return n.filter(t=>t.pos===e)}function ru(n,e){return n.filter(t=>Wm.indexOf(t.pos)===-1&&t.box.axis===e)}function Js(n,e){return n.sort((t,s)=>{const i=e?s:t,r=e?t:s;return i.weight===r.weight?i.index-r.index:i.weight-r.weight})}function _E(n){const e=[];let t,s,i,r,o,a;for(t=0,s=(n||[]).length;t<s;++t)i=n[t],{position:r,options:{stack:o,stackWeight:a=1}}=i,e.push({index:t,box:i,pos:r,horizontal:i.isHorizontal(),weight:i.weight,stack:o&&r+o,stackWeight:a});return e}function kE(n){const e={};for(const t of n){const{stack:s,pos:i,stackWeight:r}=t;if(!s||!Wm.includes(i))continue;const o=e[s]||(e[s]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=r}return e}function wE(n,e){const t=kE(n),{vBoxMaxWidth:s,hBoxMaxHeight:i}=e;let r,o,a;for(r=0,o=n.length;r<o;++r){a=n[r];const{fullSize:l}=a.box,c=t[a.stack],d=c&&a.stackWeight/c.weight;a.horizontal?(a.width=d?d*s:l&&e.availableWidth,a.height=i):(a.width=s,a.height=d?d*i:l&&e.availableHeight)}return t}function vE(n){const e=_E(n),t=Js(e.filter(c=>c.box.fullSize),!0),s=Js(Us(e,"left"),!0),i=Js(Us(e,"right")),r=Js(Us(e,"top"),!0),o=Js(Us(e,"bottom")),a=ru(e,"x"),l=ru(e,"y");return{fullSize:t,leftAndTop:s.concat(r),rightAndBottom:i.concat(l).concat(o).concat(a),chartArea:Us(e,"chartArea"),vertical:s.concat(i).concat(l),horizontal:r.concat(o).concat(a)}}function ou(n,e,t,s){return Math.max(n[t],e[t])+Math.max(n[s],e[s])}function $m(n,e){n.top=Math.max(n.top,e.top),n.left=Math.max(n.left,e.left),n.bottom=Math.max(n.bottom,e.bottom),n.right=Math.max(n.right,e.right)}function SE(n,e,t,s){const{pos:i,box:r}=t,o=n.maxPadding;if(!X(i)){t.size&&(n[i]-=t.size);const u=s[t.stack]||{size:0,count:1};u.size=Math.max(u.size,t.horizontal?r.height:r.width),t.size=u.size/u.count,n[i]+=t.size}r.getPadding&&$m(o,r.getPadding());const a=Math.max(0,e.outerWidth-ou(o,n,"left","right")),l=Math.max(0,e.outerHeight-ou(o,n,"top","bottom")),c=a!==n.w,d=l!==n.h;return n.w=a,n.h=l,t.horizontal?{same:c,other:d}:{same:d,other:c}}function ME(n){const e=n.maxPadding;function t(s){const i=Math.max(e[s]-n[s],0);return n[s]+=i,i}n.y+=t("top"),n.x+=t("left"),t("right"),t("bottom")}function CE(n,e){const t=e.maxPadding;function s(i){const r={left:0,top:0,right:0,bottom:0};return i.forEach(o=>{r[o]=Math.max(e[o],t[o])}),r}return s(n?["left","right"]:["top","bottom"])}function ri(n,e,t,s){const i=[];let r,o,a,l,c,d;for(r=0,o=n.length,c=0;r<o;++r){a=n[r],l=a.box,l.update(a.width||e.w,a.height||e.h,CE(a.horizontal,e));const{same:u,other:h}=SE(e,t,a,s);c|=u&&i.length,d=d||h,l.fullSize||i.push(a)}return c&&ri(i,e,t,s)||d}function rr(n,e,t,s,i){n.top=t,n.left=e,n.right=e+s,n.bottom=t+i,n.width=s,n.height=i}function au(n,e,t,s){const i=t.padding;let{x:r,y:o}=e;for(const a of n){const l=a.box,c=s[a.stack]||{placed:0,weight:1},d=a.stackWeight/c.weight||1;if(a.horizontal){const u=e.w*d,h=c.size||l.height;Rr(c.start)&&(o=c.start),l.fullSize?rr(l,i.left,o,t.outerWidth-i.right-i.left,h):rr(l,e.left+c.placed,o,u,h),c.start=o,c.placed+=u,o=l.bottom}else{const u=e.h*d,h=c.size||l.width;Rr(c.start)&&(r=c.start),l.fullSize?rr(l,r,i.top,h,t.outerHeight-i.bottom-i.top):rr(l,r,e.top+c.placed,h,u),c.start=r,c.placed+=u,r=l.right}}e.x=r,e.y=o}var bt={addBox(n,e){n.boxes||(n.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},n.boxes.push(e)},removeBox(n,e){const t=n.boxes?n.boxes.indexOf(e):-1;t!==-1&&n.boxes.splice(t,1)},configure(n,e,t){e.fullSize=t.fullSize,e.position=t.position,e.weight=t.weight},update(n,e,t,s){if(!n)return;const i=kt(n.options.layout.padding),r=Math.max(e-i.width,0),o=Math.max(t-i.height,0),a=vE(n.boxes),l=a.vertical,c=a.horizontal;oe(n.boxes,m=>{typeof m.beforeLayout=="function"&&m.beforeLayout()});const d=l.reduce((m,g)=>g.box.options&&g.box.options.display===!1?m:m+1,0)||1,u=Object.freeze({outerWidth:e,outerHeight:t,padding:i,availableWidth:r,availableHeight:o,vBoxMaxWidth:r/2/d,hBoxMaxHeight:o/2}),h=Object.assign({},i);$m(h,kt(s));const f=Object.assign({maxPadding:h,w:r,h:o,x:i.left,y:i.top},i),p=wE(l.concat(c),u);ri(a.fullSize,f,u,p),ri(l,f,u,p),ri(c,f,u,p)&&ri(l,f,u,p),ME(f),au(a.leftAndTop,f,u,p),f.x+=f.w,f.y+=f.h,au(a.rightAndBottom,f,u,p),n.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},oe(a.chartArea,m=>{const g=m.box;Object.assign(g,n.chartArea),g.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class Hm{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,s){}removeEventListener(e,t,s){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,s,i){return t=Math.max(0,t||e.width),s=s||e.height,{width:t,height:Math.max(0,i?Math.floor(t/i):s)}}isAttached(e){return!0}updateConfig(e){}}class OE extends Hm{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const mr="$chartjs",DE={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},lu=n=>n===null||n==="";function TE(n,e){const t=n.style,s=n.getAttribute("height"),i=n.getAttribute("width");if(n[mr]={initial:{height:s,width:i,style:{display:t.display,height:t.height,width:t.width}}},t.display=t.display||"block",t.boxSizing=t.boxSizing||"border-box",lu(i)){const r=Ud(n,"width");r!==void 0&&(n.width=r)}if(lu(s))if(n.style.height==="")n.height=n.width/(e||2);else{const r=Ud(n,"height");r!==void 0&&(n.height=r)}return n}const Vm=WN?{passive:!0}:!1;function NE(n,e,t){n&&n.addEventListener(e,t,Vm)}function EE(n,e,t){n&&n.canvas&&n.canvas.removeEventListener(e,t,Vm)}function AE(n,e){const t=DE[n.type]||n.type,{x:s,y:i}=Ln(n,e);return{type:t,chart:e,native:n,x:s!==void 0?s:null,y:i!==void 0?i:null}}function Fr(n,e){for(const t of n)if(t===e||t.contains(e))return!0}function PE(n,e,t){const s=n.canvas,i=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||Fr(a.addedNodes,s),o=o&&!Fr(a.removedNodes,s);o&&t()});return i.observe(document,{childList:!0,subtree:!0}),i}function IE(n,e,t){const s=n.canvas,i=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||Fr(a.removedNodes,s),o=o&&!Fr(a.addedNodes,s);o&&t()});return i.observe(document,{childList:!0,subtree:!0}),i}const Ai=new Map;let cu=0;function Ym(){const n=window.devicePixelRatio;n!==cu&&(cu=n,Ai.forEach((e,t)=>{t.currentDevicePixelRatio!==n&&e()}))}function RE(n,e){Ai.size||window.addEventListener("resize",Ym),Ai.set(n,e)}function zE(n){Ai.delete(n),Ai.size||window.removeEventListener("resize",Ym)}function BE(n,e,t){const s=n.canvas,i=s&&Il(s);if(!i)return;const r=vm((a,l)=>{const c=i.clientWidth;t(a,l),c<i.clientWidth&&t()},window),o=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,d=l.contentRect.height;c===0&&d===0||r(c,d)});return o.observe(i),RE(n,r),o}function na(n,e,t){t&&t.disconnect(),e==="resize"&&zE(n)}function jE(n,e,t){const s=n.canvas,i=vm(r=>{n.ctx!==null&&t(AE(r,n))},n);return NE(s,e,i),i}class LE extends Hm{acquireContext(e,t){const s=e&&e.getContext&&e.getContext("2d");return s&&s.canvas===e?(TE(e,t),s):null}releaseContext(e){const t=e.canvas;if(!t[mr])return!1;const s=t[mr].initial;["height","width"].forEach(r=>{const o=s[r];pe(o)?t.removeAttribute(r):t.setAttribute(r,o)});const i=s.style||{};return Object.keys(i).forEach(r=>{t.style[r]=i[r]}),t.width=t.width,delete t[mr],!0}addEventListener(e,t,s){this.removeEventListener(e,t);const i=e.$proxies||(e.$proxies={}),o={attach:PE,detach:IE,resize:BE}[t]||jE;i[t]=o(e,t,s)}removeEventListener(e,t){const s=e.$proxies||(e.$proxies={}),i=s[t];if(!i)return;({attach:na,detach:na,resize:na}[t]||EE)(e,t,i),s[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,s,i){return FN(e,t,s,i)}isAttached(e){const t=e&&Il(e);return!!(t&&t.isConnected)}}function FE(n){return!Pl()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?OE:LE}class on{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(e){const{x:t,y:s}=this.getProps(["x","y"],e);return{x:t,y:s}}hasValue(){return Br(this.x)&&Br(this.y)}getProps(e,t){const s=this.$animations;if(!t||!s)return this;const i={};return e.forEach(r=>{i[r]=s[r]&&s[r].active()?s[r]._to:this[r]}),i}}function WE(n,e){const t=n.options.ticks,s=$E(n),i=Math.min(t.maxTicksLimit||s,s),r=t.major.enabled?VE(e):[],o=r.length,a=r[0],l=r[o-1],c=[];if(o>i)return YE(e,c,r,o/i),c;const d=HE(r,e,i);if(o>0){let u,h;const f=o>1?Math.round((l-a)/(o-1)):null;for(or(e,c,d,pe(f)?0:a-f,a),u=0,h=o-1;u<h;u++)or(e,c,d,r[u],r[u+1]);return or(e,c,d,l,pe(f)?e.length:l+f),c}return or(e,c,d),c}function $E(n){const e=n.options.offset,t=n._tickSize(),s=n._length/t+(e?0:1),i=n._maxLength/t;return Math.floor(Math.min(s,i))}function HE(n,e,t){const s=qE(n),i=e.length/t;if(!s)return Math.max(i,1);const r=FT(s);for(let o=0,a=r.length-1;o<a;o++){const l=r[o];if(l>i)return l}return Math.max(i,1)}function VE(n){const e=[];let t,s;for(t=0,s=n.length;t<s;t++)n[t].major&&e.push(t);return e}function YE(n,e,t,s){let i=0,r=t[0],o;for(s=Math.ceil(s),o=0;o<n.length;o++)o===r&&(e.push(n[o]),i++,r=t[i*s])}function or(n,e,t,s,i){const r=J(s,0),o=Math.min(J(i,n.length),n.length);let a=0,l,c,d;for(t=Math.ceil(t),i&&(l=i-s,t=l/Math.floor(l/t)),d=r;d<0;)a++,d=Math.round(r+a*t);for(c=Math.max(r,0);c<o;c++)c===d&&(e.push(n[c]),a++,d=Math.round(r+a*t))}function qE(n){const e=n.length;let t,s;if(e<2)return!1;for(s=n[0],t=1;t<e;++t)if(n[t]-n[t-1]!==s)return!1;return s}const KE=n=>n==="left"?"right":n==="right"?"left":n,du=(n,e,t)=>e==="top"||e==="left"?n[e]+t:n[e]-t,uu=(n,e)=>Math.min(e||n,n);function hu(n,e){const t=[],s=n.length/e,i=n.length;let r=0;for(;r<i;r+=s)t.push(n[Math.floor(r)]);return t}function UE(n,e,t){const s=n.ticks.length,i=Math.min(e,s-1),r=n._startPixel,o=n._endPixel,a=1e-6;let l=n.getPixelForTick(i),c;if(!(t&&(s===1?c=Math.max(l-r,o-l):e===0?c=(n.getPixelForTick(1)-l)/2:c=(l-n.getPixelForTick(i-1))/2,l+=i<e?c:-c,l<r-a||l>o+a)))return l}function JE(n,e){oe(n,t=>{const s=t.gc,i=s.length/2;let r;if(i>e){for(r=0;r<i;++r)delete t.data[s[r]];s.splice(0,i)}})}function Gs(n){return n.drawTicks?n.tickLength:0}function fu(n,e){if(!n.display)return 0;const t=Be(n.font,e),s=kt(n.padding);return(_e(n.text)?n.text.length:1)*t.lineHeight+s.height}function GE(n,e){return ls(n,{scale:e,type:"scale"})}function XE(n,e,t){return ls(n,{tick:t,index:e,type:"tick"})}function QE(n,e,t){let s=Ol(n);return(t&&e!=="right"||!t&&e==="right")&&(s=KE(s)),s}function ZE(n,e,t,s){const{top:i,left:r,bottom:o,right:a,chart:l}=n,{chartArea:c,scales:d}=l;let u=0,h,f,p;const m=o-i,g=a-r;if(n.isHorizontal()){if(f=Ie(s,r,a),X(t)){const b=Object.keys(t)[0],S=t[b];p=d[b].getPixelForValue(S)+m-e}else t==="center"?p=(c.bottom+c.top)/2+m-e:p=du(n,t,e);h=a-r}else{if(X(t)){const b=Object.keys(t)[0],S=t[b];f=d[b].getPixelForValue(S)-g+e}else t==="center"?f=(c.left+c.right)/2-g+e:f=du(n,t,e);p=Ie(s,o,i),u=t==="left"?-Pe:Pe}return{titleX:f,titleY:p,maxWidth:h,rotation:u}}class js extends on{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,t){return e}getUserBounds(){let{_userMin:e,_userMax:t,_suggestedMin:s,_suggestedMax:i}=this;return e=At(e,Number.POSITIVE_INFINITY),t=At(t,Number.NEGATIVE_INFINITY),s=At(s,Number.POSITIVE_INFINITY),i=At(i,Number.NEGATIVE_INFINITY),{min:At(e,s),max:At(t,i),minDefined:Le(e),maxDefined:Le(t)}}getMinMax(e){let{min:t,max:s,minDefined:i,maxDefined:r}=this.getUserBounds(),o;if(i&&r)return{min:t,max:s};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)o=a[l].controller.getMinMax(this,e),i||(t=Math.min(t,o.min)),r||(s=Math.max(s,o.max));return t=r&&t>s?s:t,s=i&&t>s?t:s,{min:At(t,At(s,t)),max:At(s,At(t,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ue(this.options.beforeUpdate,[this])}update(e,t,s){const{beginAtZero:i,grace:r,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=bN(this,r,i),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?hu(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||o.source==="auto")&&(this.ticks=WE(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,t,s;this.isHorizontal()?(t=this.left,s=this.right):(t=this.top,s=this.bottom,e=!e),this._startPixel=t,this._endPixel=s,this._reversePixels=e,this._length=s-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ue(this.options.afterUpdate,[this])}beforeSetDimensions(){ue(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){ue(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),ue(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ue(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const t=this.options.ticks;let s,i,r;for(s=0,i=e.length;s<i;s++)r=e[s],r.label=ue(t.callback,[r.value,s,e],this)}afterTickToLabelConversion(){ue(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ue(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,t=e.ticks,s=uu(this.ticks.length,e.ticks.maxTicksLimit),i=t.minRotation||0,r=t.maxRotation;let o=i,a,l,c;if(!this._isVisible()||!t.display||i>=r||s<=1||!this.isHorizontal()){this.labelRotation=i;return}const d=this._getLabelSizes(),u=d.widest.width,h=d.highest.height,f=Ge(this.chart.width-u,0,this.maxWidth);a=e.offset?this.maxWidth/s:f/(s-1),u+6>a&&(a=f/(s-(e.offset?.5:1)),l=this.maxHeight-Gs(e.grid)-t.padding-fu(e.title,this.chart.options.font),c=Math.sqrt(u*u+h*h),o=VT(Math.min(Math.asin(Ge((d.highest.height+6)/a,-1,1)),Math.asin(Ge(l/c,-1,1))-Math.asin(Ge(h/c,-1,1)))),o=Math.max(i,Math.min(r,o))),this.labelRotation=o}afterCalculateLabelRotation(){ue(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ue(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:t,options:{ticks:s,title:i,grid:r}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const l=fu(i,t.options.font);if(a?(e.width=this.maxWidth,e.height=Gs(r)+l):(e.height=this.maxHeight,e.width=Gs(r)+l),s.display&&this.ticks.length){const{first:c,last:d,widest:u,highest:h}=this._getLabelSizes(),f=s.padding*2,p=Kn(this.labelRotation),m=Math.cos(p),g=Math.sin(p);if(a){const b=s.mirror?0:g*u.width+m*h.height;e.height=Math.min(this.maxHeight,e.height+b+f)}else{const b=s.mirror?0:m*u.width+g*h.height;e.width=Math.min(this.maxWidth,e.width+b+f)}this._calculatePadding(c,d,g,m)}}this._handleMargins(),a?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,s,i){const{ticks:{align:r,padding:o},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const d=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,f=0;l?c?(h=i*e.width,f=s*t.height):(h=s*e.height,f=i*t.width):r==="start"?f=t.width:r==="end"?h=e.width:r!=="inner"&&(h=e.width/2,f=t.width/2),this.paddingLeft=Math.max((h-d+o)*this.width/(this.width-d),0),this.paddingRight=Math.max((f-u+o)*this.width/(this.width-u),0)}else{let d=t.height/2,u=e.height/2;r==="start"?(d=0,u=e.height):r==="end"&&(d=t.height,u=0),this.paddingTop=d+o,this.paddingBottom=u+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ue(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:t}=this.options;return t==="top"||t==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,s;for(t=0,s=e.length;t<s;t++)pe(e[t].label)&&(e.splice(t,1),s--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const t=this.options.ticks.sampleSize;let s=this.ticks;t<s.length&&(s=hu(s,t)),this._labelSizes=e=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,t,s){const{ctx:i,_longestTextCache:r}=this,o=[],a=[],l=Math.floor(t/uu(t,s));let c=0,d=0,u,h,f,p,m,g,b,S,_,k,v;for(u=0;u<t;u+=l){if(p=e[u].label,m=this._resolveTickFontOptions(u),i.font=g=m.string,b=r[g]=r[g]||{data:{},gc:[]},S=m.lineHeight,_=k=0,!pe(p)&&!_e(p))_=Hd(i,b.data,b.gc,_,p),k=S;else if(_e(p))for(h=0,f=p.length;h<f;++h)v=p[h],!pe(v)&&!_e(v)&&(_=Hd(i,b.data,b.gc,_,v),k+=S);o.push(_),a.push(k),c=Math.max(_,c),d=Math.max(k,d)}JE(r,t);const w=o.indexOf(c),M=a.indexOf(d),C=O=>({width:o[O]||0,height:a[O]||0});return{first:C(0),last:C(t-1),widest:C(w),highest:C(M),widths:o,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const t=this._startPixel+e*this._length;return qT(this._alignToPixels?Rn(this.chart,t,0):t)}getDecimalForPixel(e){const t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){const t=this.ticks||[];if(e>=0&&e<t.length){const s=t[e];return s.$context||(s.$context=XE(this.getContext(),e,s))}return this.$context||(this.$context=GE(this.chart.getContext(),this))}_tickSize(){const e=this.options.ticks,t=Kn(this.labelRotation),s=Math.abs(Math.cos(t)),i=Math.abs(Math.sin(t)),r=this._getLabelSizes(),o=e.autoSkipPadding||0,a=r?r.widest.width+o:0,l=r?r.highest.height+o:0;return this.isHorizontal()?l*s>a*i?a/s:l/i:l*i<a*s?l/s:a/i}_isVisible(){const e=this.options.display;return e!=="auto"?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const t=this.axis,s=this.chart,i=this.options,{grid:r,position:o,border:a}=i,l=r.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),h=Gs(r),f=[],p=a.setContext(this.getContext()),m=p.display?p.width:0,g=m/2,b=function(K){return Rn(s,K,m)};let S,_,k,v,w,M,C,O,D,A,P,F;if(o==="top")S=b(this.bottom),M=this.bottom-h,O=S-g,A=b(e.top)+g,F=e.bottom;else if(o==="bottom")S=b(this.top),A=e.top,F=b(e.bottom)-g,M=S+g,O=this.top+h;else if(o==="left")S=b(this.right),w=this.right-h,C=S-g,D=b(e.left)+g,P=e.right;else if(o==="right")S=b(this.left),D=e.left,P=b(e.right)-g,w=S+g,C=this.left+h;else if(t==="x"){if(o==="center")S=b((e.top+e.bottom)/2+.5);else if(X(o)){const K=Object.keys(o)[0],G=o[K];S=b(this.chart.scales[K].getPixelForValue(G))}A=e.top,F=e.bottom,M=S+g,O=M+h}else if(t==="y"){if(o==="center")S=b((e.left+e.right)/2);else if(X(o)){const K=Object.keys(o)[0],G=o[K];S=b(this.chart.scales[K].getPixelForValue(G))}w=S-g,C=w-h,D=e.left,P=e.right}const j=J(i.ticks.maxTicksLimit,u),H=Math.max(1,Math.ceil(u/j));for(_=0;_<u;_+=H){const K=this.getContext(_),G=r.setContext(K),R=a.setContext(K),E=G.lineWidth,V=G.color,ee=R.dash||[],ke=R.dashOffset,et=G.tickWidth,wt=G.tickColor,Tt=G.tickBorderDash||[],Nt=G.tickBorderDashOffset;k=UE(this,_,l),k!==void 0&&(v=Rn(s,k,E),c?w=C=D=P=v:M=O=A=F=v,f.push({tx1:w,ty1:M,tx2:C,ty2:O,x1:D,y1:A,x2:P,y2:F,width:E,color:V,borderDash:ee,borderDashOffset:ke,tickWidth:et,tickColor:wt,tickBorderDash:Tt,tickBorderDashOffset:Nt}))}return this._ticksLength=u,this._borderValue=S,f}_computeLabelItems(e){const t=this.axis,s=this.options,{position:i,ticks:r}=s,o=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:d,mirror:u}=r,h=Gs(s.grid),f=h+d,p=u?-d:f,m=-Kn(this.labelRotation),g=[];let b,S,_,k,v,w,M,C,O,D,A,P,F="middle";if(i==="top")w=this.bottom-p,M=this._getXAxisLabelAlignment();else if(i==="bottom")w=this.top+p,M=this._getXAxisLabelAlignment();else if(i==="left"){const H=this._getYAxisLabelAlignment(h);M=H.textAlign,v=H.x}else if(i==="right"){const H=this._getYAxisLabelAlignment(h);M=H.textAlign,v=H.x}else if(t==="x"){if(i==="center")w=(e.top+e.bottom)/2+f;else if(X(i)){const H=Object.keys(i)[0],K=i[H];w=this.chart.scales[H].getPixelForValue(K)+f}M=this._getXAxisLabelAlignment()}else if(t==="y"){if(i==="center")v=(e.left+e.right)/2-f;else if(X(i)){const H=Object.keys(i)[0],K=i[H];v=this.chart.scales[H].getPixelForValue(K)}M=this._getYAxisLabelAlignment(h).textAlign}t==="y"&&(l==="start"?F="top":l==="end"&&(F="bottom"));const j=this._getLabelSizes();for(b=0,S=a.length;b<S;++b){_=a[b],k=_.label;const H=r.setContext(this.getContext(b));C=this.getPixelForTick(b)+r.labelOffset,O=this._resolveTickFontOptions(b),D=O.lineHeight,A=_e(k)?k.length:1;const K=A/2,G=H.color,R=H.textStrokeColor,E=H.textStrokeWidth;let V=M;o?(v=C,M==="inner"&&(b===S-1?V=this.options.reverse?"left":"right":b===0?V=this.options.reverse?"right":"left":V="center"),i==="top"?c==="near"||m!==0?P=-A*D+D/2:c==="center"?P=-j.highest.height/2-K*D+D:P=-j.highest.height+D/2:c==="near"||m!==0?P=D/2:c==="center"?P=j.highest.height/2-K*D:P=j.highest.height-A*D,u&&(P*=-1),m!==0&&!H.showLabelBackdrop&&(v+=D/2*Math.sin(m))):(w=C,P=(1-A)*D/2);let ee;if(H.showLabelBackdrop){const ke=kt(H.backdropPadding),et=j.heights[b],wt=j.widths[b];let Tt=P-ke.top,Nt=0-ke.left;switch(F){case"middle":Tt-=et/2;break;case"bottom":Tt-=et;break}switch(M){case"center":Nt-=wt/2;break;case"right":Nt-=wt;break;case"inner":b===S-1?Nt-=wt:b>0&&(Nt-=wt/2);break}ee={left:Nt,top:Tt,width:wt+ke.width,height:et+ke.height,color:H.backdropColor}}g.push({label:k,font:O,textOffset:P,options:{rotation:m,color:G,strokeColor:R,strokeWidth:E,textAlign:V,textBaseline:F,translation:[v,w],backdrop:ee}})}return g}_getXAxisLabelAlignment(){const{position:e,ticks:t}=this.options;if(-Kn(this.labelRotation))return e==="top"?"left":"right";let i="center";return t.align==="start"?i="left":t.align==="end"?i="right":t.align==="inner"&&(i="inner"),i}_getYAxisLabelAlignment(e){const{position:t,ticks:{crossAlign:s,mirror:i,padding:r}}=this.options,o=this._getLabelSizes(),a=e+r,l=o.widest.width;let c,d;return t==="left"?i?(d=this.right+r,s==="near"?c="left":s==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-a,s==="near"?c="right":s==="center"?(c="center",d-=l/2):(c="left",d=this.left)):t==="right"?i?(d=this.left+r,s==="near"?c="right":s==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+a,s==="near"?c="left":s==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,t=this.options.position;if(t==="left"||t==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(t==="top"||t==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:t},left:s,top:i,width:r,height:o}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(s,i,r,o),e.restore())}getLineWidthForValue(e){const t=this.options.grid;if(!this._isVisible()||!t.display)return 0;const i=this.ticks.findIndex(r=>r.value===e);return i>=0?t.setContext(this.getContext(i)).lineWidth:0}drawGrid(e){const t=this.options.grid,s=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let r,o;const a=(l,c,d)=>{!d.width||!d.color||(s.save(),s.lineWidth=d.width,s.strokeStyle=d.color,s.setLineDash(d.borderDash||[]),s.lineDashOffset=d.borderDashOffset,s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.stroke(),s.restore())};if(t.display)for(r=0,o=i.length;r<o;++r){const l=i[r];t.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),t.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:e,ctx:t,options:{border:s,grid:i}}=this,r=s.setContext(this.getContext()),o=s.display?r.width:0;if(!o)return;const a=i.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,d,u,h;this.isHorizontal()?(c=Rn(e,this.left,o)-o/2,d=Rn(e,this.right,a)+a/2,u=h=l):(u=Rn(e,this.top,o)-o/2,h=Rn(e,this.bottom,a)+a/2,c=d=l),t.save(),t.lineWidth=r.width,t.strokeStyle=r.color,t.beginPath(),t.moveTo(c,u),t.lineTo(d,h),t.stroke(),t.restore()}drawLabels(e){if(!this.options.ticks.display)return;const s=this.ctx,i=this._computeLabelArea();i&&ro(s,i);const r=this.getLabelItems(e);for(const o of r){const a=o.options,l=o.font,c=o.label,d=o.textOffset;Ei(s,c,0,d,l,a)}i&&oo(s)}drawTitle(){const{ctx:e,options:{position:t,title:s,reverse:i}}=this;if(!s.display)return;const r=Be(s.font),o=kt(s.padding),a=s.align;let l=r.lineHeight/2;t==="bottom"||t==="center"||X(t)?(l+=o.bottom,_e(s.text)&&(l+=r.lineHeight*(s.text.length-1))):l+=o.top;const{titleX:c,titleY:d,maxWidth:u,rotation:h}=ZE(this,l,t,a);Ei(e,s.text,0,0,r,{color:s.color,maxWidth:u,rotation:h,textAlign:QE(a,t,i),textBaseline:"middle",translation:[c,d]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,t=e.ticks&&e.ticks.z||0,s=J(e.grid&&e.grid.z,-1),i=J(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==js.prototype.draw?[{z:t,draw:r=>{this.draw(r)}}]:[{z:s,draw:r=>{this.drawBackground(),this.drawGrid(r),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:t,draw:r=>{this.drawLabels(r)}}]}getMatchingVisibleMetas(e){const t=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",i=[];let r,o;for(r=0,o=t.length;r<o;++r){const a=t[r];a[s]===this.id&&(!e||a.type===e)&&i.push(a)}return i}_resolveTickFontOptions(e){const t=this.options.ticks.setContext(this.getContext(e));return Be(t.font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class ar{constructor(e,t,s){this.type=e,this.scope=t,this.override=s,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){const t=Object.getPrototypeOf(e);let s;nA(t)&&(s=this.register(t));const i=this.items,r=e.id,o=this.scope+"."+r;if(!r)throw new Error("class does not have id: "+e);return r in i||(i[r]=e,eA(e,o,s),this.override&&ge.override(e.id,e.overrides)),o}get(e){return this.items[e]}unregister(e){const t=this.items,s=e.id,i=this.scope;s in t&&delete t[s],i&&s in ge[i]&&(delete ge[i][s],this.override&&delete rs[s])}}function eA(n,e,t){const s=Ti(Object.create(null),[t?ge.get(t):{},ge.get(e),n.defaults]);ge.set(e,s),n.defaultRoutes&&tA(e,n.defaultRoutes),n.descriptors&&ge.describe(e,n.descriptors)}function tA(n,e){Object.keys(e).forEach(t=>{const s=t.split("."),i=s.pop(),r=[n].concat(s).join("."),o=e[t].split("."),a=o.pop(),l=o.join(".");ge.route(r,i,l,a)})}function nA(n){return"id"in n&&"defaults"in n}class sA{constructor(){this.controllers=new ar(fE,"datasets",!0),this.elements=new ar(on,"elements"),this.plugins=new ar(Object,"plugins"),this.scales=new ar(js,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,t,s){[...t].forEach(i=>{const r=s||this._getRegistryForType(i);s||r.isForType(i)||r===this.plugins&&i.id?this._exec(e,r,i):oe(i,o=>{const a=s||this._getRegistryForType(o);this._exec(e,a,o)})})}_exec(e,t,s){const i=Sl(e);ue(s["before"+i],[],s),t[e](s),ue(s["after"+i],[],s)}_getRegistryForType(e){for(let t=0;t<this._typedRegistries.length;t++){const s=this._typedRegistries[t];if(s.isForType(e))return s}return this.plugins}_get(e,t,s){const i=t.get(e);if(i===void 0)throw new Error('"'+e+'" is not a registered '+s+".");return i}}var zt=new sA;class iA{constructor(){this._init=void 0}notify(e,t,s,i){if(t==="beforeInit"&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install")),this._init===void 0)return;const r=i?this._descriptors(e).filter(i):this._descriptors(e),o=this._notify(r,e,t,s);return t==="afterDestroy"&&(this._notify(r,e,"stop"),this._notify(this._init,e,"uninstall"),this._init=void 0),o}_notify(e,t,s,i){i=i||{};for(const r of e){const o=r.plugin,a=o[s],l=[t,i,r.options];if(ue(a,l,o)===!1&&i.cancelable)return!1}return!0}invalidate(){pe(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const t=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),t}_createDescriptors(e,t){const s=e&&e.config,i=J(s.options&&s.options.plugins,{}),r=rA(s);return i===!1&&!t?[]:aA(e,r,i,t)}_notifyStateChanges(e){const t=this._oldCache||[],s=this._cache,i=(r,o)=>r.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(i(t,s),e,"stop"),this._notify(i(s,t),e,"start")}}function rA(n){const e={},t=[],s=Object.keys(zt.plugins.items);for(let r=0;r<s.length;r++)t.push(zt.getPlugin(s[r]));const i=n.plugins||[];for(let r=0;r<i.length;r++){const o=i[r];t.indexOf(o)===-1&&(t.push(o),e[o.id]=!0)}return{plugins:t,localIds:e}}function oA(n,e){return!e&&n===!1?null:n===!0?{}:n}function aA(n,{plugins:e,localIds:t},s,i){const r=[],o=n.getContext();for(const a of e){const l=a.id,c=oA(s[l],i);c!==null&&r.push({plugin:a,options:lA(n.config,{plugin:a,local:t[l]},c,o)})}return r}function lA(n,{plugin:e,local:t},s,i){const r=n.pluginScopeKeys(e),o=n.getOptionScopes(s,r);return t&&e.defaults&&o.push(e.defaults),n.createResolver(o,i,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function za(n,e){const t=ge.datasets[n]||{};return((e.datasets||{})[n]||{}).indexAxis||e.indexAxis||t.indexAxis||"x"}function cA(n,e){let t=n;return n==="_index_"?t=e:n==="_value_"&&(t=e==="x"?"y":"x"),t}function dA(n,e){return n===e?"_index_":"_value_"}function pu(n){if(n==="x"||n==="y"||n==="r")return n}function uA(n){if(n==="top"||n==="bottom")return"x";if(n==="left"||n==="right")return"y"}function Ba(n,...e){if(pu(n))return n;for(const t of e){const s=t.axis||uA(t.position)||n.length>1&&pu(n[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function mu(n,e,t){if(t[e+"AxisID"]===n)return{axis:e}}function hA(n,e){if(e.data&&e.data.datasets){const t=e.data.datasets.filter(s=>s.xAxisID===n||s.yAxisID===n);if(t.length)return mu(n,"x",t[0])||mu(n,"y",t[0])}return{}}function fA(n,e){const t=rs[n.type]||{scales:{}},s=e.scales||{},i=za(n.type,e),r=Object.create(null);return Object.keys(s).forEach(o=>{const a=s[o];if(!X(a))return console.error(`Invalid scale configuration for scale: ${o}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);const l=Ba(o,a,hA(o,n),ge.scales[a.type]),c=dA(l,i),d=t.scales||{};r[o]=ui(Object.create(null),[{axis:l},a,d[l],d[c]])}),n.data.datasets.forEach(o=>{const a=o.type||n.type,l=o.indexAxis||za(a,e),d=(rs[a]||{}).scales||{};Object.keys(d).forEach(u=>{const h=cA(u,l),f=o[h+"AxisID"]||h;r[f]=r[f]||Object.create(null),ui(r[f],[{axis:h},s[f],d[u]])})}),Object.keys(r).forEach(o=>{const a=r[o];ui(a,[ge.scales[a.type],ge.scale])}),r}function qm(n){const e=n.options||(n.options={});e.plugins=J(e.plugins,{}),e.scales=fA(n,e)}function Km(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function pA(n){return n=n||{},n.data=Km(n.data),qm(n),n}const gu=new Map,Um=new Set;function lr(n,e){let t=gu.get(n);return t||(t=e(),gu.set(n,t),Um.add(t)),t}const Xs=(n,e,t)=>{const s=Ir(e,t);s!==void 0&&n.add(s)};class mA{constructor(e){this._config=pA(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=Km(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),qm(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return lr(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,t){return lr(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,t){return lr(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]])}pluginScopeKeys(e){const t=e.id,s=this.type;return lr(`${s}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){const s=this._scopeCache;let i=s.get(e);return(!i||t)&&(i=new Map,s.set(e,i)),i}getOptionScopes(e,t,s){const{options:i,type:r}=this,o=this._cachedScopes(e,s),a=o.get(t);if(a)return a;const l=new Set;t.forEach(d=>{e&&(l.add(e),d.forEach(u=>Xs(l,e,u))),d.forEach(u=>Xs(l,i,u)),d.forEach(u=>Xs(l,rs[r]||{},u)),d.forEach(u=>Xs(l,ge,u)),d.forEach(u=>Xs(l,Ia,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Um.has(t)&&o.set(t,c),c}chartOptionScopes(){const{options:e,type:t}=this;return[e,rs[t]||{},ge.datasets[t]||{},{type:t},ge,Ia]}resolveNamedOptions(e,t,s,i=[""]){const r={$shared:!0},{resolver:o,subPrefixes:a}=yu(this._resolverCache,e,i);let l=o;if(yA(o,t)){r.$shared=!1,s=Dn(s)?s():s;const c=this.createResolver(e,s,a);l=Is(o,s,c)}for(const c of t)r[c]=l[c];return r}createResolver(e,t,s=[""],i){const{resolver:r}=yu(this._resolverCache,e,s);return X(t)?Is(r,t,void 0,i):r}}function yu(n,e,t){let s=n.get(e);s||(s=new Map,n.set(e,s));const i=t.join();let r=s.get(i);return r||(r={resolver:Nl(e,t),subPrefixes:t.filter(a=>!a.toLowerCase().includes("hover"))},s.set(i,r)),r}const gA=n=>X(n)&&Object.getOwnPropertyNames(n).some(e=>Dn(n[e]));function yA(n,e){const{isScriptable:t,isIndexable:s}=Dm(n);for(const i of e){const r=t(i),o=s(i),a=(o||r)&&n[i];if(r&&(Dn(a)||gA(a))||o&&_e(a))return!0}return!1}var bA="4.5.1";const xA=["top","bottom","left","right","chartArea"];function bu(n,e){return n==="top"||n==="bottom"||xA.indexOf(n)===-1&&e==="x"}function xu(n,e){return function(t,s){return t[n]===s[n]?t[e]-s[e]:t[n]-s[n]}}function _u(n){const e=n.chart,t=e.options.animation;e.notifyPlugins("afterRender"),ue(t&&t.onComplete,[n],e)}function _A(n){const e=n.chart,t=e.options.animation;ue(t&&t.onProgress,[n],e)}function Jm(n){return Pl()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const gr={},ku=n=>{const e=Jm(n);return Object.values(gr).filter(t=>t.canvas===e).pop()};function kA(n,e,t){const s=Object.keys(n);for(const i of s){const r=+i;if(r>=e){const o=n[i];delete n[i],(t>0||r>e)&&(n[r+t]=o)}}}function wA(n,e,t,s){return!t||n.type==="mouseout"?null:s?e:n}let zl=class{static defaults=ge;static instances=gr;static overrides=rs;static registry=zt;static version=bA;static getChart=ku;static register(...e){zt.add(...e),wu()}static unregister(...e){zt.remove(...e),wu()}constructor(e,t){const s=this.config=new mA(t),i=Jm(e),r=ku(i);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const o=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||FE(i)),this.platform.updateConfig(s);const a=this.platform.acquireContext(i,o.aspectRatio),l=a&&a.canvas,c=l&&l.height,d=l&&l.width;if(this.id=ET(),this.ctx=a,this.canvas=l,this.width=d,this.height=c,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new iA,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=XT(u=>this.update(u),o.resizeDelay||0),this._dataChanges=[],gr[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Kt.listen(this,"complete",_u),Kt.listen(this,"progress",_A),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:t},width:s,height:i,_aspectRatio:r}=this;return pe(e)?t&&r?r:i?s/i:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return zt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Kd(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Vd(this.canvas,this.ctx),this}stop(){return Kt.stop(this),this}resize(e,t){Kt.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){const s=this.options,i=this.canvas,r=s.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(i,e,t,r),a=s.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,Kd(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),ue(s.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const t=this.options.scales||{};oe(t,(s,i)=>{s.id=i})}buildOrUpdateScales(){const e=this.options,t=e.scales,s=this.scales,i=Object.keys(s).reduce((o,a)=>(o[a]=!1,o),{});let r=[];t&&(r=r.concat(Object.keys(t).map(o=>{const a=t[o],l=Ba(o,a),c=l==="r",d=l==="x";return{options:a,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),oe(r,o=>{const a=o.options,l=a.id,c=Ba(l,a),d=J(a.type,o.dtype);(a.position===void 0||bu(a.position,c)!==bu(o.dposition))&&(a.position=o.dposition),i[l]=!0;let u=null;if(l in s&&s[l].type===d)u=s[l];else{const h=zt.getScale(d);u=new h({id:l,type:d,ctx:this.ctx,chart:this}),s[u.id]=u}u.init(a,e)}),oe(i,(o,a)=>{o||delete s[a]}),oe(s,o=>{bt.configure(this,o,o.options),bt.addBox(this,o)})}_updateMetasets(){const e=this._metasets,t=this.data.datasets.length,s=e.length;if(e.sort((i,r)=>i.index-r.index),s>t){for(let i=t;i<s;++i)this._destroyDatasetMeta(i);e.splice(t,s-t)}this._sortedMetasets=e.slice(0).sort(xu("order","index"))}_removeUnreferencedMetasets(){const{_metasets:e,data:{datasets:t}}=this;e.length>t.length&&delete this._stacks,e.forEach((s,i)=>{t.filter(r=>r===s._dataset).length===0&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){const e=[],t=this.data.datasets;let s,i;for(this._removeUnreferencedMetasets(),s=0,i=t.length;s<i;s++){const r=t[s];let o=this.getDatasetMeta(s);const a=r.type||this.config.type;if(o.type&&o.type!==a&&(this._destroyDatasetMeta(s),o=this.getDatasetMeta(s)),o.type=a,o.indexAxis=r.indexAxis||za(a,this.options),o.order=r.order||0,o.index=s,o.label=""+r.label,o.visible=this.isDatasetVisible(s),o.controller)o.controller.updateIndex(s),o.controller.linkScales();else{const l=zt.getController(a),{datasetElementType:c,dataElementType:d}=ge.datasets[a];Object.assign(l,{dataElementType:zt.getElement(d),datasetElementType:c&&zt.getElement(c)}),o.controller=new l(this,s),e.push(o.controller)}}return this._updateMetasets(),e}_resetElements(){oe(this.data.datasets,(e,t)=>{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const t=this.config;t.update();const s=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),i=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let c=0,d=this.data.datasets.length;c<d;c++){const{controller:u}=this.getDatasetMeta(c),h=!i&&r.indexOf(u)===-1;u.buildOrUpdateElements(h),o=Math.max(+u.getMaxOverflow(),o)}o=this._minPadding=s.layout.autoPadding?o:0,this._updateLayout(o),i||oe(r,c=>{c.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(xu("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){oe(this.scales,e=>{bt.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,t=new Set(Object.keys(this._listeners)),s=new Set(e.events);(!Id(t,s)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(const{method:s,start:i,count:r}of t){const o=s==="_removeElements"?-r:r;kA(e,i,o)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const t=this.data.datasets.length,s=r=>new Set(e.filter(o=>o[0]===r).map((o,a)=>a+","+o.splice(1).join(","))),i=s(0);for(let r=1;r<t;r++)if(!Id(i,s(r)))return;return Array.from(i).map(r=>r.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;bt.update(this,this.width,this.height,e);const t=this.chartArea,s=t.width<=0||t.height<=0;this._layers=[],oe(this.boxes,i=>{s&&i.position==="chartArea"||(i.configure&&i.configure(),this._layers.push(...i._layers()))},this),this._layers.forEach((i,r)=>{i._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let t=0,s=this.data.datasets.length;t<s;++t)this.getDatasetMeta(t).controller.configure();for(let t=0,s=this.data.datasets.length;t<s;++t)this._updateDataset(t,Dn(e)?e({datasetIndex:t}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,t){const s=this.getDatasetMeta(e),i={meta:s,index:e,mode:t,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",i)!==!1&&(s.controller._update(t),i.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",i))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Kt.has(this)?this.attached&&!Kt.running(this)&&Kt.start(this):(this.draw(),_u({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){const{width:s,height:i}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(s,i)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const t=this._layers;for(e=0;e<t.length&&t[e].z<=0;++e)t[e].draw(this.chartArea);for(this._drawDatasets();e<t.length;++e)t[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){const t=this._sortedMetasets,s=[];let i,r;for(i=0,r=t.length;i<r;++i){const o=t[i];(!e||o.visible)&&s.push(o)}return s}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const e=this.getSortedVisibleDatasetMetas();for(let t=e.length-1;t>=0;--t)this._drawDataset(e[t]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const t=this.ctx,s={meta:e,index:e.index,cancelable:!0},i=jm(this,e);this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(i&&ro(t,i),e.controller.draw(),i&&oo(t),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(e){return Ni(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,s,i){const r=xE.modes[t];return typeof r=="function"?r(this,e,s,i):[]}getDatasetMeta(e){const t=this.data.datasets[e],s=this._metasets;let i=s.filter(r=>r&&r._dataset===t).pop();return i||(i={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},s.push(i)),i}getContext(){return this.$context||(this.$context=ls(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const t=this.data.datasets[e];if(!t)return!1;const s=this.getDatasetMeta(e);return typeof s.hidden=="boolean"?!s.hidden:!t.hidden}setDatasetVisibility(e,t){const s=this.getDatasetMeta(e);s.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,s){const i=s?"show":"hide",r=this.getDatasetMeta(e),o=r.controller._resolveAnimations(void 0,i);Rr(t)?(r.data[t].hidden=!s,this.update()):(this.setDatasetVisibility(e,s),o.update(r,{visible:s}),this.update(a=>a.datasetIndex===e?i:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){const t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),Kt.remove(this),e=0,t=this.data.datasets.length;e<t;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:e,ctx:t}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),Vd(e,t),this.platform.releaseContext(t),this.canvas=null,this.ctx=null),delete gr[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const e=this._listeners,t=this.platform,s=(r,o)=>{t.addEventListener(this,r,o),e[r]=o},i=(r,o,a)=>{r.offsetX=o,r.offsetY=a,this._eventHandler(r)};oe(this.options.events,r=>s(r,i))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,t=this.platform,s=(l,c)=>{t.addEventListener(this,l,c),e[l]=c},i=(l,c)=>{e[l]&&(t.removeEventListener(this,l,c),delete e[l])},r=(l,c)=>{this.canvas&&this.resize(l,c)};let o;const a=()=>{i("attach",a),this.attached=!0,this.resize(),s("resize",r),s("detach",o)};o=()=>{this.attached=!1,i("resize",r),this._stop(),this._resize(0,0),s("attach",a)},t.isAttached(this.canvas)?a():o()}unbindEvents(){oe(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},oe(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,s){const i=s?"set":"remove";let r,o,a,l;for(t==="dataset"&&(r=this.getDatasetMeta(e[0].datasetIndex),r.controller["_"+i+"DatasetHoverStyle"]()),a=0,l=e.length;a<l;++a){o=e[a];const c=o&&this.getDatasetMeta(o.datasetIndex).controller;c&&c[i+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){const t=this._active||[],s=e.map(({datasetIndex:r,index:o})=>{const a=this.getDatasetMeta(r);if(!a)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:a.data[o],index:o}});!Ar(s,t)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,t))}notifyPlugins(e,t,s){return this._plugins.notify(this,e,t,s)}isPluginEnabled(e){return this._plugins._cache.filter(t=>t.plugin.id===e).length===1}_updateHoverStyles(e,t,s){const i=this.options.hover,r=(l,c)=>l.filter(d=>!c.some(u=>d.datasetIndex===u.datasetIndex&&d.index===u.index)),o=r(t,e),a=s?e:r(e,t);o.length&&this.updateHoverStyle(o,i.mode,!1),a.length&&i.mode&&this.updateHoverStyle(a,i.mode,!0)}_eventHandler(e,t){const s={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},i=o=>(o.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",s,i)===!1)return;const r=this._handleEvent(e,t,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,i),(r||s.changed)&&this.render(),this}_handleEvent(e,t,s){const{_active:i=[],options:r}=this,o=t,a=this._getActiveElements(e,i,s,o),l=BT(e),c=wA(e,this._lastEvent,s,l);s&&(this._lastEvent=null,ue(r.onHover,[e,a,this],this),l&&ue(r.onClick,[e,a,this],this));const d=!Ar(a,i);return(d||t)&&(this._active=a,this._updateHoverStyles(a,i,t)),this._lastEvent=c,d}_getActiveElements(e,t,s,i){if(e.type==="mouseout")return[];if(!s)return t;const r=this.options.hover;return this.getElementsAtEventForMode(e,r.mode,r,i)}};function wu(){return oe(zl.instances,n=>n._plugins.invalidate())}function vA(n,e,t){const{startAngle:s,x:i,y:r,outerRadius:o,innerRadius:a,options:l}=e,{borderWidth:c,borderJoinStyle:d}=l,u=Math.min(c/o,at(s-t));if(n.beginPath(),n.arc(i,r,o-c/2,s+u/2,t-u/2),a>0){const h=Math.min(c/a,at(s-t));n.arc(i,r,a+c/2,t-h/2,s+h/2,!0)}else{const h=Math.min(c/2,o*at(s-t));if(d==="round")n.arc(i,r,h,t-le/2,s+le/2,!0);else if(d==="bevel"){const f=2*h*h,p=-f*Math.cos(t+le/2)+i,m=-f*Math.sin(t+le/2)+r,g=f*Math.cos(s+le/2)+i,b=f*Math.sin(s+le/2)+r;n.lineTo(p,m),n.lineTo(g,b)}}n.closePath(),n.moveTo(0,0),n.rect(0,0,n.canvas.width,n.canvas.height),n.clip("evenodd")}function SA(n,e,t){const{startAngle:s,pixelMargin:i,x:r,y:o,outerRadius:a,innerRadius:l}=e;let c=i/a;n.beginPath(),n.arc(r,o,a,s-c,t+c),l>i?(c=i/l,n.arc(r,o,l,t+c,s-c,!0)):n.arc(r,o,i,t+Pe,s-Pe),n.closePath(),n.clip()}function MA(n){return Tl(n,["outerStart","outerEnd","innerStart","innerEnd"])}function CA(n,e,t,s){const i=MA(n.options.borderRadius),r=(t-e)/2,o=Math.min(r,s*e/2),a=l=>{const c=(t-Math.min(r,l))*s/2;return Ge(l,0,Math.min(r,c))};return{outerStart:a(i.outerStart),outerEnd:a(i.outerEnd),innerStart:Ge(i.innerStart,0,o),innerEnd:Ge(i.innerEnd,0,o)}}function gs(n,e,t,s){return{x:t+n*Math.cos(e),y:s+n*Math.sin(e)}}function Wr(n,e,t,s,i,r){const{x:o,y:a,startAngle:l,pixelMargin:c,innerRadius:d}=e,u=Math.max(e.outerRadius+s+t-c,0),h=d>0?d+s+t+c:0;let f=0;const p=i-l;if(s){const H=d>0?d-s:0,K=u>0?u-s:0,G=(H+K)/2,R=G!==0?p*G/(G+s):p;f=(p-R)/2}const m=Math.max(.001,p*u-t/le)/u,g=(p-m)/2,b=l+g+f,S=i-g-f,{outerStart:_,outerEnd:k,innerStart:v,innerEnd:w}=CA(e,h,u,S-b),M=u-_,C=u-k,O=b+_/M,D=S-k/C,A=h+v,P=h+w,F=b+v/A,j=S-w/P;if(n.beginPath(),r){const H=(O+D)/2;if(n.arc(o,a,u,O,H),n.arc(o,a,u,H,D),k>0){const E=gs(C,D,o,a);n.arc(E.x,E.y,k,D,S+Pe)}const K=gs(P,S,o,a);if(n.lineTo(K.x,K.y),w>0){const E=gs(P,j,o,a);n.arc(E.x,E.y,w,S+Pe,j+Math.PI)}const G=(S-w/h+(b+v/h))/2;if(n.arc(o,a,h,S-w/h,G,!0),n.arc(o,a,h,G,b+v/h,!0),v>0){const E=gs(A,F,o,a);n.arc(E.x,E.y,v,F+Math.PI,b-Pe)}const R=gs(M,b,o,a);if(n.lineTo(R.x,R.y),_>0){const E=gs(M,O,o,a);n.arc(E.x,E.y,_,b-Pe,O)}}else{n.moveTo(o,a);const H=Math.cos(O)*u+o,K=Math.sin(O)*u+a;n.lineTo(H,K);const G=Math.cos(D)*u+o,R=Math.sin(D)*u+a;n.lineTo(G,R)}n.closePath()}function OA(n,e,t,s,i){const{fullCircles:r,startAngle:o,circumference:a}=e;let l=e.endAngle;if(r){Wr(n,e,t,s,l,i);for(let c=0;c<r;++c)n.fill();isNaN(a)||(l=o+(a%Ce||Ce))}return Wr(n,e,t,s,l,i),n.fill(),l}function DA(n,e,t,s,i){const{fullCircles:r,startAngle:o,circumference:a,options:l}=e,{borderWidth:c,borderJoinStyle:d,borderDash:u,borderDashOffset:h,borderRadius:f}=l,p=l.borderAlign==="inner";if(!c)return;n.setLineDash(u||[]),n.lineDashOffset=h,p?(n.lineWidth=c*2,n.lineJoin=d||"round"):(n.lineWidth=c,n.lineJoin=d||"bevel");let m=e.endAngle;if(r){Wr(n,e,t,s,m,i);for(let g=0;g<r;++g)n.stroke();isNaN(a)||(m=o+(a%Ce||Ce))}p&&SA(n,e,m),l.selfJoin&&m-o>=le&&f===0&&d!=="miter"&&vA(n,e,m),r||(Wr(n,e,t,s,m,i),n.stroke())}class TA extends on{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:e=>e!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(e){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,t,s){const i=this.getProps(["x","y"],s),{angle:r,distance:o}=_m(i,{x:e,y:t}),{startAngle:a,endAngle:l,innerRadius:c,outerRadius:d,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),h=(this.options.spacing+this.options.borderWidth)/2,f=J(u,l-a),p=Ml(r,a,l)&&a!==l,m=f>=Ce||p,g=nn(o,c+h,d+h);return m&&g}getCenterPoint(e){const{x:t,y:s,startAngle:i,endAngle:r,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:l,spacing:c}=this.options,d=(i+r)/2,u=(o+a+c+l)/2;return{x:t+Math.cos(d)*u,y:s+Math.sin(d)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:t,circumference:s}=this,i=(t.offset||0)/4,r=(t.spacing||0)/2,o=t.circular;if(this.pixelMargin=t.borderAlign==="inner"?.33:0,this.fullCircles=s>Ce?Math.floor(s/Ce):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const a=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(a)*i,Math.sin(a)*i);const l=1-Math.sin(Math.min(le,s||0)),c=i*l;e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor,OA(e,this,c,r,o),DA(e,this,c,r,o),e.restore()}}function Gm(n,e,t=e){n.lineCap=J(t.borderCapStyle,e.borderCapStyle),n.setLineDash(J(t.borderDash,e.borderDash)),n.lineDashOffset=J(t.borderDashOffset,e.borderDashOffset),n.lineJoin=J(t.borderJoinStyle,e.borderJoinStyle),n.lineWidth=J(t.borderWidth,e.borderWidth),n.strokeStyle=J(t.borderColor,e.borderColor)}function NA(n,e,t){n.lineTo(t.x,t.y)}function EA(n){return n.stepped?cN:n.tension||n.cubicInterpolationMode==="monotone"?dN:NA}function Xm(n,e,t={}){const s=n.length,{start:i=0,end:r=s-1}=t,{start:o,end:a}=e,l=Math.max(i,o),c=Math.min(r,a),d=i<o&&r<o||i>a&&r>a;return{count:s,start:l,loop:e.loop,ilen:c<l&&!d?s+c-l:c-l}}function AA(n,e,t,s){const{points:i,options:r}=e,{count:o,start:a,loop:l,ilen:c}=Xm(i,t,s),d=EA(r);let{move:u=!0,reverse:h}=s||{},f,p,m;for(f=0;f<=c;++f)p=i[(a+(h?c-f:f))%o],!p.skip&&(u?(n.moveTo(p.x,p.y),u=!1):d(n,m,p,h,r.stepped),m=p);return l&&(p=i[(a+(h?c:0))%o],d(n,m,p,h,r.stepped)),!!l}function PA(n,e,t,s){const i=e.points,{count:r,start:o,ilen:a}=Xm(i,t,s),{move:l=!0,reverse:c}=s||{};let d=0,u=0,h,f,p,m,g,b;const S=k=>(o+(c?a-k:k))%r,_=()=>{m!==g&&(n.lineTo(d,g),n.lineTo(d,m),n.lineTo(d,b))};for(l&&(f=i[S(0)],n.moveTo(f.x,f.y)),h=0;h<=a;++h){if(f=i[S(h)],f.skip)continue;const k=f.x,v=f.y,w=k|0;w===p?(v<m?m=v:v>g&&(g=v),d=(u*d+k)/++u):(_(),n.lineTo(k,v),p=w,u=0,m=g=v),b=v}_()}function ja(n){const e=n.options,t=e.borderDash&&e.borderDash.length;return!n._decimated&&!n._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!t?PA:AA}function IA(n){return n.stepped?$N:n.tension||n.cubicInterpolationMode==="monotone"?HN:Fn}function RA(n,e,t,s){let i=e._path;i||(i=e._path=new Path2D,e.path(i,t,s)&&i.closePath()),Gm(n,e.options),n.stroke(i)}function zA(n,e,t,s){const{segments:i,options:r}=e,o=ja(e);for(const a of i)Gm(n,r,a.style),n.beginPath(),o(n,e,a,{start:t,end:t+s-1})&&n.closePath(),n.stroke()}const BA=typeof Path2D=="function";function jA(n,e,t,s){BA&&!e.options.segment?RA(n,e,t,s):zA(n,e,t,s)}class co extends on{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:e=>e!=="borderDash"&&e!=="fill"};constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,t){const s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){const i=s.spanGaps?this._loop:this._fullLoop;IN(this._points,s,e,i,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=JN(this,this.options.segment))}first(){const e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){const e=this.segments,t=this.points,s=e.length;return s&&t[e[s-1].end]}interpolate(e,t){const s=this.options,i=e[t],r=this.points,o=Bm(this,{property:t,start:i,end:i});if(!o.length)return;const a=[],l=IA(s);let c,d;for(c=0,d=o.length;c<d;++c){const{start:u,end:h}=o[c],f=r[u],p=r[h];if(f===p){a.push(f);continue}const m=Math.abs((i-f[t])/(p[t]-f[t])),g=l(f,p,m,s.stepped);g[t]=e[t],a.push(g)}return a.length===1?a[0]:a}pathSegment(e,t,s){return ja(this)(e,this,t,s)}path(e,t,s){const i=this.segments,r=ja(this);let o=this._loop;t=t||0,s=s||this.points.length-t;for(const a of i)o&=r(e,this,a,{start:t,end:t+s-1});return!!o}draw(e,t,s,i){const r=this.options||{};(this.points||[]).length&&r.borderWidth&&(e.save(),jA(e,this,s,i),e.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function vu(n,e,t,s){const i=n.options,{[t]:r}=n.getProps([t],s);return Math.abs(e-r)<i.radius+i.hitRadius}class LA extends on{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(e){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,t,s){const i=this.options,{x:r,y:o}=this.getProps(["x","y"],s);return Math.pow(e-r,2)+Math.pow(t-o,2)<Math.pow(i.hitRadius+i.radius,2)}inXRange(e,t){return vu(this,e,"x",t)}inYRange(e,t){return vu(this,e,"y",t)}getCenterPoint(e){const{x:t,y:s}=this.getProps(["x","y"],e);return{x:t,y:s}}size(e){e=e||this.options||{};let t=e.radius||0;t=Math.max(t,t&&e.hoverRadius||0);const s=t&&e.borderWidth||0;return(t+s)*2}draw(e,t){const s=this.options;this.skip||s.radius<.1||!Ni(this,t,this.size(s)/2)||(e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.fillStyle=s.backgroundColor,Ra(e,s,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}}function Qm(n,e){const{x:t,y:s,base:i,width:r,height:o}=n.getProps(["x","y","base","width","height"],e);let a,l,c,d,u;return n.horizontal?(u=o/2,a=Math.min(t,i),l=Math.max(t,i),c=s-u,d=s+u):(u=r/2,a=t-u,l=t+u,c=Math.min(s,i),d=Math.max(s,i)),{left:a,top:c,right:l,bottom:d}}function bn(n,e,t,s){return n?0:Ge(e,t,s)}function FA(n,e,t){const s=n.options.borderWidth,i=n.borderSkipped,r=Om(s);return{t:bn(i.top,r.top,0,t),r:bn(i.right,r.right,0,e),b:bn(i.bottom,r.bottom,0,t),l:bn(i.left,r.left,0,e)}}function WA(n,e,t){const{enableBorderRadius:s}=n.getProps(["enableBorderRadius"]),i=n.options.borderRadius,r=Ss(i),o=Math.min(e,t),a=n.borderSkipped,l=s||X(i);return{topLeft:bn(!l||a.top||a.left,r.topLeft,0,o),topRight:bn(!l||a.top||a.right,r.topRight,0,o),bottomLeft:bn(!l||a.bottom||a.left,r.bottomLeft,0,o),bottomRight:bn(!l||a.bottom||a.right,r.bottomRight,0,o)}}function $A(n){const e=Qm(n),t=e.right-e.left,s=e.bottom-e.top,i=FA(n,t/2,s/2),r=WA(n,t/2,s/2);return{outer:{x:e.left,y:e.top,w:t,h:s,radius:r},inner:{x:e.left+i.l,y:e.top+i.t,w:t-i.l-i.r,h:s-i.t-i.b,radius:{topLeft:Math.max(0,r.topLeft-Math.max(i.t,i.l)),topRight:Math.max(0,r.topRight-Math.max(i.t,i.r)),bottomLeft:Math.max(0,r.bottomLeft-Math.max(i.b,i.l)),bottomRight:Math.max(0,r.bottomRight-Math.max(i.b,i.r))}}}}function sa(n,e,t,s){const i=e===null,r=t===null,a=n&&!(i&&r)&&Qm(n,s);return a&&(i||nn(e,a.left,a.right))&&(r||nn(t,a.top,a.bottom))}function HA(n){return n.topLeft||n.topRight||n.bottomLeft||n.bottomRight}function VA(n,e){n.rect(e.x,e.y,e.w,e.h)}function ia(n,e,t={}){const s=n.x!==t.x?-e:0,i=n.y!==t.y?-e:0,r=(n.x+n.w!==t.x+t.w?e:0)-s,o=(n.y+n.h!==t.y+t.h?e:0)-i;return{x:n.x+s,y:n.y+i,w:n.w+r,h:n.h+o,radius:n.radius}}class YA extends on{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,e&&Object.assign(this,e)}draw(e){const{inflateAmount:t,options:{borderColor:s,backgroundColor:i}}=this,{inner:r,outer:o}=$A(this),a=HA(o.radius)?jr:VA;e.save(),(o.w!==r.w||o.h!==r.h)&&(e.beginPath(),a(e,ia(o,t,r)),e.clip(),a(e,ia(r,-t,o)),e.fillStyle=s,e.fill("evenodd")),e.beginPath(),a(e,ia(r,t)),e.fillStyle=i,e.fill(),e.restore()}inRange(e,t,s){return sa(this,e,t,s)}inXRange(e,t){return sa(this,e,null,t)}inYRange(e,t){return sa(this,null,e,t)}getCenterPoint(e){const{x:t,y:s,base:i,horizontal:r}=this.getProps(["x","y","base","horizontal"],e);return{x:r?(t+i)/2:t,y:r?s:(s+i)/2}}getRange(e){return e==="x"?this.width/2:this.height/2}}function qA(n,e,t){const s=n.segments,i=n.points,r=e.points,o=[];for(const a of s){let{start:l,end:c}=a;c=uo(l,c,i);const d=La(t,i[l],i[c],a.loop);if(!e.segments){o.push({source:a,target:d,start:i[l],end:i[c]});continue}const u=Bm(e,d);for(const h of u){const f=La(t,r[h.start],r[h.end],h.loop),p=zm(a,i,f);for(const m of p)o.push({source:m,target:h,start:{[t]:Su(d,f,"start",Math.max)},end:{[t]:Su(d,f,"end",Math.min)}})}}return o}function La(n,e,t,s){if(s)return;let i=e[n],r=t[n];return n==="angle"&&(i=at(i),r=at(r)),{property:n,start:i,end:r}}function KA(n,e){const{x:t=null,y:s=null}=n||{},i=e.points,r=[];return e.segments.forEach(({start:o,end:a})=>{a=uo(o,a,i);const l=i[o],c=i[a];s!==null?(r.push({x:l.x,y:s}),r.push({x:c.x,y:s})):t!==null&&(r.push({x:t,y:l.y}),r.push({x:t,y:c.y}))}),r}function uo(n,e,t){for(;e>n;e--){const s=t[e];if(!isNaN(s.x)&&!isNaN(s.y))break}return e}function Su(n,e,t,s){return n&&e?s(n[t],e[t]):n?n[t]:e?e[t]:0}function Zm(n,e){let t=[],s=!1;return _e(n)?(s=!0,t=n):t=KA(n,e),t.length?new co({points:t,options:{tension:0},_loop:s,_fullLoop:s}):null}function Mu(n){return n&&n.fill!==!1}function UA(n,e,t){let i=n[e].fill;const r=[e];let o;if(!t)return i;for(;i!==!1&&r.indexOf(i)===-1;){if(!Le(i))return i;if(o=n[i],!o)return!1;if(o.visible)return i;r.push(i),i=o.fill}return!1}function JA(n,e,t){const s=ZA(n);if(X(s))return isNaN(s.value)?!1:s;let i=parseFloat(s);return Le(i)&&Math.floor(i)===i?GA(s[0],e,i,t):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function GA(n,e,t,s){return(n==="-"||n==="+")&&(t=e+t),t===e||t<0||t>=s?!1:t}function XA(n,e){let t=null;return n==="start"?t=e.bottom:n==="end"?t=e.top:X(n)?t=e.getPixelForValue(n.value):e.getBasePixel&&(t=e.getBasePixel()),t}function QA(n,e,t){let s;return n==="start"?s=t:n==="end"?s=e.options.reverse?e.min:e.max:X(n)?s=n.value:s=e.getBaseValue(),s}function ZA(n){const e=n.options,t=e.fill;let s=J(t&&t.target,t);return s===void 0&&(s=!!e.backgroundColor),s===!1||s===null?!1:s===!0?"origin":s}function eP(n){const{scale:e,index:t,line:s}=n,i=[],r=s.segments,o=s.points,a=tP(e,t);a.push(Zm({x:null,y:e.bottom},s));for(let l=0;l<r.length;l++){const c=r[l];for(let d=c.start;d<=c.end;d++)nP(i,o[d],a)}return new co({points:i,options:{}})}function tP(n,e){const t=[],s=n.getMatchingVisibleMetas("line");for(let i=0;i<s.length;i++){const r=s[i];if(r.index===e)break;r.hidden||t.unshift(r.dataset)}return t}function nP(n,e,t){const s=[];for(let i=0;i<t.length;i++){const r=t[i],{first:o,last:a,point:l}=sP(r,e,"x");if(!(!l||o&&a)){if(o)s.unshift(l);else if(n.push(l),!a)break}}n.push(...s)}function sP(n,e,t){const s=n.interpolate(e,t);if(!s)return{};const i=s[t],r=n.segments,o=n.points;let a=!1,l=!1;for(let c=0;c<r.length;c++){const d=r[c],u=o[d.start][t],h=o[d.end][t];if(nn(i,u,h)){a=i===u,l=i===h;break}}return{first:a,last:l,point:s}}class eg{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius}pathSegment(e,t,s){const{x:i,y:r,radius:o}=this;return t=t||{start:0,end:Ce},e.arc(i,r,o,t.end,t.start,!0),!s.bounds}interpolate(e){const{x:t,y:s,radius:i}=this,r=e.angle;return{x:t+Math.cos(r)*i,y:s+Math.sin(r)*i,angle:r}}}function iP(n){const{chart:e,fill:t,line:s}=n;if(Le(t))return rP(e,t);if(t==="stack")return eP(n);if(t==="shape")return!0;const i=oP(n);return i instanceof eg?i:Zm(i,s)}function rP(n,e){const t=n.getDatasetMeta(e);return t&&n.isDatasetVisible(e)?t.dataset:null}function oP(n){return(n.scale||{}).getPointPositionForValue?lP(n):aP(n)}function aP(n){const{scale:e={},fill:t}=n,s=XA(t,e);if(Le(s)){const i=e.isHorizontal();return{x:i?s:null,y:i?null:s}}return null}function lP(n){const{scale:e,fill:t}=n,s=e.options,i=e.getLabels().length,r=s.reverse?e.max:e.min,o=QA(t,e,r),a=[];if(s.grid.circular){const l=e.getPointPositionForValue(0,r);return new eg({x:l.x,y:l.y,radius:e.getDistanceFromCenterForValue(o)})}for(let l=0;l<i;++l)a.push(e.getPointPositionForValue(l,o));return a}function ra(n,e,t){const s=iP(e),{chart:i,index:r,line:o,scale:a,axis:l}=e,c=o.options,d=c.fill,u=c.backgroundColor,{above:h=u,below:f=u}=d||{},p=i.getDatasetMeta(r),m=jm(i,p);s&&o.points.length&&(ro(n,t),cP(n,{line:o,target:s,above:h,below:f,area:t,scale:a,axis:l,clip:m}),oo(n))}function cP(n,e){const{line:t,target:s,above:i,below:r,area:o,scale:a,clip:l}=e,c=t._loop?"angle":e.axis;n.save();let d=r;r!==i&&(c==="x"?(Cu(n,s,o.top),oa(n,{line:t,target:s,color:i,scale:a,property:c,clip:l}),n.restore(),n.save(),Cu(n,s,o.bottom)):c==="y"&&(Ou(n,s,o.left),oa(n,{line:t,target:s,color:r,scale:a,property:c,clip:l}),n.restore(),n.save(),Ou(n,s,o.right),d=i)),oa(n,{line:t,target:s,color:d,scale:a,property:c,clip:l}),n.restore()}function Cu(n,e,t){const{segments:s,points:i}=e;let r=!0,o=!1;n.beginPath();for(const a of s){const{start:l,end:c}=a,d=i[l],u=i[uo(l,c,i)];r?(n.moveTo(d.x,d.y),r=!1):(n.lineTo(d.x,t),n.lineTo(d.x,d.y)),o=!!e.pathSegment(n,a,{move:o}),o?n.closePath():n.lineTo(u.x,t)}n.lineTo(e.first().x,t),n.closePath(),n.clip()}function Ou(n,e,t){const{segments:s,points:i}=e;let r=!0,o=!1;n.beginPath();for(const a of s){const{start:l,end:c}=a,d=i[l],u=i[uo(l,c,i)];r?(n.moveTo(d.x,d.y),r=!1):(n.lineTo(t,d.y),n.lineTo(d.x,d.y)),o=!!e.pathSegment(n,a,{move:o}),o?n.closePath():n.lineTo(t,u.y)}n.lineTo(t,e.first().y),n.closePath(),n.clip()}function oa(n,e){const{line:t,target:s,property:i,color:r,scale:o,clip:a}=e,l=qA(t,s,i);for(const{source:c,target:d,start:u,end:h}of l){const{style:{backgroundColor:f=r}={}}=c,p=s!==!0;n.save(),n.fillStyle=f,dP(n,o,a,p&&La(i,u,h)),n.beginPath();const m=!!t.pathSegment(n,c);let g;if(p){m?n.closePath():Du(n,s,h,i);const b=!!s.pathSegment(n,d,{move:m,reverse:!0});g=m&&b,g||Du(n,s,u,i)}n.closePath(),n.fill(g?"evenodd":"nonzero"),n.restore()}}function dP(n,e,t,s){const i=e.chart.chartArea,{property:r,start:o,end:a}=s||{};if(r==="x"||r==="y"){let l,c,d,u;r==="x"?(l=o,c=i.top,d=a,u=i.bottom):(l=i.left,c=o,d=i.right,u=a),n.beginPath(),t&&(l=Math.max(l,t.left),d=Math.min(d,t.right),c=Math.max(c,t.top),u=Math.min(u,t.bottom)),n.rect(l,c,d-l,u-c),n.clip()}}function Du(n,e,t,s){const i=e.interpolate(t,s);i&&n.lineTo(i.x,i.y)}var uP={id:"filler",afterDatasetsUpdate(n,e,t){const s=(n.data.datasets||[]).length,i=[];let r,o,a,l;for(o=0;o<s;++o)r=n.getDatasetMeta(o),a=r.dataset,l=null,a&&a.options&&a instanceof co&&(l={visible:n.isDatasetVisible(o),index:o,fill:JA(a,o,s),chart:n,axis:r.controller.options.indexAxis,scale:r.vScale,line:a}),r.$filler=l,i.push(l);for(o=0;o<s;++o)l=i[o],!(!l||l.fill===!1)&&(l.fill=UA(i,o,t.propagate))},beforeDraw(n,e,t){const s=t.drawTime==="beforeDraw",i=n.getSortedVisibleDatasetMetas(),r=n.chartArea;for(let o=i.length-1;o>=0;--o){const a=i[o].$filler;a&&(a.line.updateControlPoints(r,a.axis),s&&a.fill&&ra(n.ctx,a,r))}},beforeDatasetsDraw(n,e,t){if(t.drawTime!=="beforeDatasetsDraw")return;const s=n.getSortedVisibleDatasetMetas();for(let i=s.length-1;i>=0;--i){const r=s[i].$filler;Mu(r)&&ra(n.ctx,r,n.chartArea)}},beforeDatasetDraw(n,e,t){const s=e.meta.$filler;!Mu(s)||t.drawTime!=="beforeDatasetDraw"||ra(n.ctx,s,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Tu=(n,e)=>{let{boxHeight:t=e,boxWidth:s=e}=n;return n.usePointStyle&&(t=Math.min(t,e),s=n.pointStyleWidth||Math.min(s,e)),{boxWidth:s,boxHeight:t,itemHeight:Math.max(e,t)}},hP=(n,e)=>n!==null&&e!==null&&n.datasetIndex===e.datasetIndex&&n.index===e.index;class Nu extends on{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t,s){this.maxWidth=e,this.maxHeight=t,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const e=this.options.labels||{};let t=ue(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter(s=>e.filter(s,this.chart.data))),e.sort&&(t=t.sort((s,i)=>e.sort(s,i,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){const{options:e,ctx:t}=this;if(!e.display){this.width=this.height=0;return}const s=e.labels,i=Be(s.font),r=i.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Tu(s,r);let c,d;t.font=i.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(o,r,a,l)+10):(d=this.maxHeight,c=this._fitCols(o,i,a,l)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(d,e.maxHeight||this.maxHeight)}_fitRows(e,t,s,i){const{ctx:r,maxWidth:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],d=i+a;let u=e;r.textAlign="left",r.textBaseline="middle";let h=-1,f=-d;return this.legendItems.forEach((p,m)=>{const g=s+t/2+r.measureText(p.text).width;(m===0||c[c.length-1]+g+2*a>o)&&(u+=d,c[c.length-(m>0?0:1)]=0,f+=d,h++),l[m]={left:0,top:f,row:h,width:g,height:i},c[c.length-1]+=g+a}),u}_fitCols(e,t,s,i){const{ctx:r,maxHeight:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],d=o-e;let u=a,h=0,f=0,p=0,m=0;return this.legendItems.forEach((g,b)=>{const{itemWidth:S,itemHeight:_}=fP(s,t,r,g,i);b>0&&f+_+2*a>d&&(u+=h+a,c.push({width:h,height:f}),p+=h+a,m++,h=f=0),l[b]={left:p,top:f,col:m,width:S,height:_},h=Math.max(h,S),f+=_+a}),u+=h,c.push({width:h,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:s,labels:{padding:i},rtl:r}}=this,o=Ms(r,this.left,this.width);if(this.isHorizontal()){let a=0,l=Ie(s,this.left+i,this.right-this.lineWidths[a]);for(const c of t)a!==c.row&&(a=c.row,l=Ie(s,this.left+i,this.right-this.lineWidths[a])),c.top+=this.top+e+i,c.left=o.leftForLtr(o.x(l),c.width),l+=c.width+i}else{let a=0,l=Ie(s,this.top+e+i,this.bottom-this.columnSizes[a].height);for(const c of t)c.col!==a&&(a=c.col,l=Ie(s,this.top+e+i,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+i,c.left=o.leftForLtr(o.x(c.left),c.width),l+=c.height+i}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const e=this.ctx;ro(e,this),this._draw(),oo(e)}}_draw(){const{options:e,columnSizes:t,lineWidths:s,ctx:i}=this,{align:r,labels:o}=e,a=ge.color,l=Ms(e.rtl,this.left,this.width),c=Be(o.font),{padding:d}=o,u=c.size,h=u/2;let f;this.drawTitle(),i.textAlign=l.textAlign("left"),i.textBaseline="middle",i.lineWidth=.5,i.font=c.string;const{boxWidth:p,boxHeight:m,itemHeight:g}=Tu(o,u),b=function(w,M,C){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;i.save();const O=J(C.lineWidth,1);if(i.fillStyle=J(C.fillStyle,a),i.lineCap=J(C.lineCap,"butt"),i.lineDashOffset=J(C.lineDashOffset,0),i.lineJoin=J(C.lineJoin,"miter"),i.lineWidth=O,i.strokeStyle=J(C.strokeStyle,a),i.setLineDash(J(C.lineDash,[])),o.usePointStyle){const D={radius:m*Math.SQRT2/2,pointStyle:C.pointStyle,rotation:C.rotation,borderWidth:O},A=l.xPlus(w,p/2),P=M+h;Cm(i,D,A,P,o.pointStyleWidth&&p)}else{const D=M+Math.max((u-m)/2,0),A=l.leftForLtr(w,p),P=Ss(C.borderRadius);i.beginPath(),Object.values(P).some(F=>F!==0)?jr(i,{x:A,y:D,w:p,h:m,radius:P}):i.rect(A,D,p,m),i.fill(),O!==0&&i.stroke()}i.restore()},S=function(w,M,C){Ei(i,C.text,w,M+g/2,c,{strikethrough:C.hidden,textAlign:l.textAlign(C.textAlign)})},_=this.isHorizontal(),k=this._computeTitleHeight();_?f={x:Ie(r,this.left+d,this.right-s[0]),y:this.top+d+k,line:0}:f={x:this.left+d,y:Ie(r,this.top+k+d,this.bottom-t[0].height),line:0},Pm(this.ctx,e.textDirection);const v=g+d;this.legendItems.forEach((w,M)=>{i.strokeStyle=w.fontColor,i.fillStyle=w.fontColor;const C=i.measureText(w.text).width,O=l.textAlign(w.textAlign||(w.textAlign=o.textAlign)),D=p+h+C;let A=f.x,P=f.y;l.setWidth(this.width),_?M>0&&A+D+d>this.right&&(P=f.y+=v,f.line++,A=f.x=Ie(r,this.left+d,this.right-s[f.line])):M>0&&P+v>this.bottom&&(A=f.x=A+t[f.line].width+d,f.line++,P=f.y=Ie(r,this.top+k+d,this.bottom-t[f.line].height));const F=l.x(A);if(b(F,P,w),A=QT(O,A+p+h,_?A+D:this.right,e.rtl),S(l.x(A),P,w),_)f.x+=D+d;else if(typeof w.text!="string"){const j=c.lineHeight;f.y+=tg(w,j)+d}else f.y+=v}),Im(this.ctx,e.textDirection)}drawTitle(){const e=this.options,t=e.title,s=Be(t.font),i=kt(t.padding);if(!t.display)return;const r=Ms(e.rtl,this.left,this.width),o=this.ctx,a=t.position,l=s.size/2,c=i.top+l;let d,u=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),d=this.top+c,u=Ie(e.align,u,this.right-h);else{const p=this.columnSizes.reduce((m,g)=>Math.max(m,g.height),0);d=c+Ie(e.align,this.top,this.bottom-p-e.labels.padding-this._computeTitleHeight())}const f=Ie(a,u,u+h);o.textAlign=r.textAlign(Ol(a)),o.textBaseline="middle",o.strokeStyle=t.color,o.fillStyle=t.color,o.font=s.string,Ei(o,t.text,f,d,s)}_computeTitleHeight(){const e=this.options.title,t=Be(e.font),s=kt(e.padding);return e.display?t.lineHeight+s.height:0}_getLegendItemAt(e,t){let s,i,r;if(nn(e,this.left,this.right)&&nn(t,this.top,this.bottom)){for(r=this.legendHitBoxes,s=0;s<r.length;++s)if(i=r[s],nn(e,i.left,i.left+i.width)&&nn(t,i.top,i.top+i.height))return this.legendItems[s]}return null}handleEvent(e){const t=this.options;if(!gP(e.type,t))return;const s=this._getLegendItemAt(e.x,e.y);if(e.type==="mousemove"||e.type==="mouseout"){const i=this._hoveredItem,r=hP(i,s);i&&!r&&ue(t.onLeave,[e,i,this],this),this._hoveredItem=s,s&&!r&&ue(t.onHover,[e,s,this],this)}else s&&ue(t.onClick,[e,s,this],this)}}function fP(n,e,t,s,i){const r=pP(s,n,e,t),o=mP(i,s,e.lineHeight);return{itemWidth:r,itemHeight:o}}function pP(n,e,t,s){let i=n.text;return i&&typeof i!="string"&&(i=i.reduce((r,o)=>r.length>o.length?r:o)),e+t.size/2+s.measureText(i).width}function mP(n,e,t){let s=n;return typeof e.text!="string"&&(s=tg(e,t)),s}function tg(n,e){const t=n.text?n.text.length:0;return e*t}function gP(n,e){return!!((n==="mousemove"||n==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(n==="click"||n==="mouseup"))}var yP={id:"legend",_element:Nu,start(n,e,t){const s=n.legend=new Nu({ctx:n.ctx,options:t,chart:n});bt.configure(n,s,t),bt.addBox(n,s)},stop(n){bt.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,e,t){const s=n.legend;bt.configure(n,s,t),s.options=t},afterUpdate(n){const e=n.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(n,e){e.replay||n.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,e,t){const s=e.datasetIndex,i=t.chart;i.isDatasetVisible(s)?(i.hide(s),e.hidden=!0):(i.show(s),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){const e=n.data.datasets,{labels:{usePointStyle:t,pointStyle:s,textAlign:i,color:r,useBorderRadius:o,borderRadius:a}}=n.legend.options;return n._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(t?0:void 0),d=kt(c.borderWidth);return{text:e[l.index].label,fillStyle:c.backgroundColor,fontColor:r,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:o&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}};class ng extends on{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t){const s=this.options;if(this.left=0,this.top=0,!s.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=t;const i=_e(s.text)?s.text.length:1;this._padding=kt(s.padding);const r=i*Be(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=r:this.width=r}isHorizontal(){const e=this.options.position;return e==="top"||e==="bottom"}_drawArgs(e){const{top:t,left:s,bottom:i,right:r,options:o}=this,a=o.align;let l=0,c,d,u;return this.isHorizontal()?(d=Ie(a,s,r),u=t+e,c=r-s):(o.position==="left"?(d=s+e,u=Ie(a,i,t),l=le*-.5):(d=r-e,u=Ie(a,t,i),l=le*.5),c=i-t),{titleX:d,titleY:u,maxWidth:c,rotation:l}}draw(){const e=this.ctx,t=this.options;if(!t.display)return;const s=Be(t.font),r=s.lineHeight/2+this._padding.top,{titleX:o,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(r);Ei(e,t.text,0,0,s,{color:t.color,maxWidth:l,rotation:c,textAlign:Ol(t.align),textBaseline:"middle",translation:[o,a]})}}function bP(n,e){const t=new ng({ctx:n.ctx,options:e,chart:n});bt.configure(n,t,e),bt.addBox(n,t),n.titleBlock=t}var xP={id:"title",_element:ng,start(n,e,t){bP(n,t)},stop(n){const e=n.titleBlock;bt.removeBox(n,e),delete n.titleBlock},beforeUpdate(n,e,t){const s=n.titleBlock;bt.configure(n,s,t),s.options=t},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const oi={average(n){if(!n.length)return!1;let e,t,s=new Set,i=0,r=0;for(e=0,t=n.length;e<t;++e){const a=n[e].element;if(a&&a.hasValue()){const l=a.tooltipPosition();s.add(l.x),i+=l.y,++r}}return r===0||s.size===0?!1:{x:[...s].reduce((a,l)=>a+l)/s.size,y:i/r}},nearest(n,e){if(!n.length)return!1;let t=e.x,s=e.y,i=Number.POSITIVE_INFINITY,r,o,a;for(r=0,o=n.length;r<o;++r){const l=n[r].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),d=Aa(e,c);d<i&&(i=d,a=l)}}if(a){const l=a.tooltipPosition();t=l.x,s=l.y}return{x:t,y:s}}};function Pt(n,e){return e&&(_e(e)?Array.prototype.push.apply(n,e):n.push(e)),n}function Ut(n){return(typeof n=="string"||n instanceof String)&&n.indexOf(`
|
|
91
|
+
`);return!r||!o?!1:n.chain().command(({tr:a})=>(a.delete(i.pos-2,i.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:i}=e,{$from:s,empty:r}=t;if(!r||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const a=s.after();return a===void 0?!1:i.nodeAt(a)?n.commands.command(({tr:c})=>(c.setSelection(q.near(i.resolve(a))),!0)):n.commands.exitCode()}}},addInputRules(){return[Ta({find:kD,type:this.type,getAttributes:n=>({language:n[1]})}),Ta({find:wD,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Ze({key:new Vt("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),i=e.clipboardData.getData("vscode-editor-data"),s=i?JSON.parse(i):void 0,r=s?.mode;if(!t||!r)return!1;const{tr:o,schema:a}=n.state,l=a.text(t.replace(/\r\n?/g,`
|
|
92
|
+
`));return o.replaceSelectionWith(this.type.create({language:r},l)),o.selection.$from.parent.type!==this.type&&o.setSelection($.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),SD=Qe.create({name:"doc",topNode:!0,content:"block+"});function MD(n={}){return new Ze({view(e){return new CD(e,n)}})}class CD{constructor(e,t){var i;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(i=t.width)!==null&&i!==void 0?i:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let r=o=>{this[s](o)};return e.dom.addEventListener(s,r),{name:s,handler:r}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,i,s=this.editorView.dom,r=s.getBoundingClientRect(),o=r.width/s.offsetWidth,a=r.height/s.offsetHeight;if(t){let u=e.nodeBefore,h=e.nodeAfter;if(u||h){let f=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(f){let p=f.getBoundingClientRect(),m=u?p.bottom:p.top;u&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;i={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!i){let u=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;i={left:u.left-h,right:u.left+h,top:u.top,bottom:u.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,d;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=l.getBoundingClientRect(),h=u.width/l.offsetWidth,f=u.height/l.offsetHeight;c=u.left-l.scrollLeft*h,d=u.top-l.scrollTop*f}this.element.style.left=(i.left-c)/o+"px",this.element.style.top=(i.top-d)/a+"px",this.element.style.width=(i.right-i.left)/o+"px",this.element.style.height=(i.bottom-i.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),i=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),s=i&&i.type.spec.disableDropCursor,r=typeof s=="function"?s(this.editorView,t,e):s;if(t&&!r){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=ep(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const OD=Ve.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[MD(this.options)]}});class me extends q{constructor(e){super(e,e)}map(e,t){let i=e.resolve(t.map(this.head));return me.valid(i)?new me(i):q.near(i)}content(){return I.empty}eq(e){return e instanceof me&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new me(e.resolve(t.pos))}getBookmark(){return new wl(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!DD(e)||!TD(e))return!1;let i=t.type.spec.allowGapCursor;if(i!=null)return i;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,i=!1){e:for(;;){if(!i&&me.valid(e))return e;let s=e.pos,r=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)<a.childCount:e.index(o)>0){r=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=t;let l=e.doc.resolve(s);if(me.valid(l))return l}for(;;){let o=t>0?r.firstChild:r.lastChild;if(!o){if(r.isAtom&&!r.isText&&!L.isSelectable(r)){e=e.doc.resolve(s+r.nodeSize*t),i=!1;continue e}break}r=o,s+=t;let a=e.doc.resolve(s);if(me.valid(a))return a}return null}}}me.prototype.visible=!1;me.findFrom=me.findGapCursorFrom;q.jsonID("gapcursor",me);class wl{constructor(e){this.pos=e}map(e){return new wl(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return me.valid(t)?new me(t):q.near(t)}}function hm(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function DD(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),i=n.node(e);if(t==0){if(i.type.spec.isolating)return!0;continue}for(let s=i.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||hm(s.type))return!0;if(s.inlineContent)return!1}}return!0}function TD(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),i=n.node(e);if(t==i.childCount){if(i.type.spec.isolating)return!0;continue}for(let s=i.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||hm(s.type))return!0;if(s.inlineContent)return!1}}return!0}function ND(){return new Ze({props:{decorations:ID,createSelectionBetween(n,e,t){return e.pos==t.pos&&me.valid(t)?new me(t):null},handleClick:AD,handleKeyDown:ED,handleDOMEvents:{beforeinput:PD}}})}const ED=$p({ArrowLeft:Zs("horiz",-1),ArrowRight:Zs("horiz",1),ArrowUp:Zs("vert",-1),ArrowDown:Zs("vert",1)});function Zs(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(i,s,r){let o=i.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof $){if(!r.endOfTextblock(t)||a.depth==0)return!1;l=!1,a=i.doc.resolve(e>0?a.after():a.before())}let c=me.findGapCursorFrom(a,e,l);return c?(s&&s(i.tr.setSelection(new me(c))),!0):!1}}function AD(n,e,t){if(!n||!n.editable)return!1;let i=n.state.doc.resolve(e);if(!me.valid(i))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&L.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new me(i))),!0)}function PD(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof me))return!1;let{$from:t}=n.state.selection,i=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!i)return!1;let s=T.empty;for(let o=i.length-1;o>=0;o--)s=T.from(i[o].createAndFill(null,s));let r=n.state.tr.replace(t.pos,t.pos,new I(s,0,0));return r.setSelection($.near(r.doc.resolve(t.pos+1))),n.dispatch(r),!1}function ID(n){if(!(n.selection instanceof me))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",xe.create(n.doc,[bt.widget(n.selection.head,e,{key:"gapcursor"})])}const RD=Ve.create({name:"gapCursor",addProseMirrorPlugins(){return[ND()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=U(z(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),zD=Qe.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",He(this.options.HTMLAttributes,n)]},renderText(){return`
|
|
93
|
+
`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:i})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:s,storedMarks:r}=t;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=i.extensionManager,l=r||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&l&&o){const u=l.filter(h=>a.includes(h.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),jD=Qe.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,He(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Ta({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Pr=200,Me=function(){};Me.prototype.append=function(e){return e.length?(e=Me.from(e),!this.length&&e||e.length<Pr&&this.leafAppend(e)||this.length<Pr&&e.leafPrepend(this)||this.appendInner(e)):this};Me.prototype.prepend=function(e){return e.length?Me.from(e).append(this):this};Me.prototype.appendInner=function(e){return new BD(this,e)};Me.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Me.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Me.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Me.prototype.forEach=function(e,t,i){t===void 0&&(t=0),i===void 0&&(i=this.length),t<=i?this.forEachInner(e,t,i,0):this.forEachInvertedInner(e,t,i,0)};Me.prototype.map=function(e,t,i){t===void 0&&(t=0),i===void 0&&(i=this.length);var s=[];return this.forEach(function(r,o){return s.push(e(r,o))},t,i),s};Me.from=function(e){return e instanceof Me?e:e&&e.length?new fm(e):Me.empty};var fm=(function(n){function e(i){n.call(this),this.values=i}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,r){return s==0&&r==this.length?this:new e(this.values.slice(s,r))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,r,o,a){for(var l=r;l<o;l++)if(s(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,r,o,a){for(var l=r-1;l>=o;l--)if(s(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Pr)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Pr)return new e(s.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Me);Me.empty=new fm([]);var BD=(function(n){function e(t,i){n.call(this),this.left=t,this.right=i,this.length=t.length+i.length,this.depth=Math.max(t.depth,i.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(i){return i<this.left.length?this.left.get(i):this.right.get(i-this.left.length)},e.prototype.forEachInner=function(i,s,r,o){var a=this.left.length;if(s<a&&this.left.forEachInner(i,s,Math.min(r,a),o)===!1||r>a&&this.right.forEachInner(i,Math.max(s-a,0),Math.min(this.length,r)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,r,o){var a=this.left.length;if(s>a&&this.right.forEachInvertedInner(i,s-a,Math.max(r,a)-a,o+a)===!1||r<a&&this.left.forEachInvertedInner(i,Math.min(s,a),r,o)===!1)return!1},e.prototype.sliceInner=function(i,s){if(i==0&&s==this.length)return this;var r=this.left.length;return s<=r?this.left.slice(i,s):i>=r?this.right.slice(i-r,s-r):this.left.slice(i,r).append(this.right.slice(0,s-r))},e.prototype.leafAppend=function(i){var s=this.right.leafAppend(i);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(i){var s=this.left.leafPrepend(i);if(s)return new e(s,this.right)},e.prototype.appendInner=function(i){return this.left.depth>=Math.max(this.right.depth,i.depth)+1?new e(this.left,new e(this.right,i)):new e(this,i)},e})(Me);const LD=500;class Ot{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}let s,r;t&&(s=this.remapping(i,this.items.length),r=s.maps.length);let o=e.tr,a,l,c=[],d=[];return this.items.forEach((u,h)=>{if(!u.step){s||(s=this.remapping(i,h+1),r=s.maps.length),r--,d.push(u);return}if(s){d.push(new zt(u.map));let f=u.step.map(s.slice(r)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new zt(p,void 0,void 0,c.length+d.length))),r--,p&&s.appendMap(p,r)}else o.maybeStep(u.step);if(u.selection)return a=s?u.selection.map(s.slice(r)):u.selection,l=new Ot(this.items.slice(0,i).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,t,i,s){let r=[],o=this.eventCount,a=this.items,l=!s&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),h=new zt(e.mapping.maps[d],u,t),f;(f=l&&l.merge(h))&&(h=f,d?r.pop():a=a.slice(0,a.length-1)),r.push(h),t&&(o++,t=void 0),s||(l=h)}let c=o-i.depth;return c>WD&&(a=FD(a,c),o-=c),new Ot(a.append(r),o)}remapping(e,t){let i=new ws;return this.items.forEach((s,r)=>{let o=s.mirrorOffset!=null&&r-s.mirrorOffset>=e?i.maps.length-s.mirrorOffset:void 0;i.appendMap(s.map,o)},e,t),i}addMaps(e){return this.eventCount==0?this:new Ot(this.items.append(e.map(t=>new zt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let i=[],s=Math.max(0,this.items.length-t),r=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},s);let l=t;this.items.forEach(h=>{let f=r.getMirror(--l);if(f==null)return;o=Math.min(o,f);let p=r.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(r.slice(l+1,f));g&&a++,i.push(new zt(p,m,g))}else i.push(new zt(p))},s);let c=[];for(let h=t;h<o;h++)c.push(new zt(r.maps[h]));let d=this.items.slice(0,s).append(c).append(i),u=new Ot(d,a);return u.emptyItemCount()>LD&&(u=u.compress(this.items.length-i.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),i=t.maps.length,s=[],r=0;return this.items.forEach((o,a)=>{if(a>=e)s.push(o),o.selection&&r++;else if(o.step){let l=o.step.map(t.slice(i)),c=l&&l.getMap();if(i--,c&&t.appendMap(c,i),l){let d=o.selection&&o.selection.map(t.slice(i));d&&r++;let u=new zt(c.invert(),l,d),h,f=s.length-1;(h=s.length&&s[f].merge(u))?s[f]=h:s.push(u)}}else o.map&&i--},this.items.length,0),new Ot(Me.from(s.reverse()),r)}}Ot.empty=new Ot(Me.empty,0);function FD(n,e){let t;return n.forEach((i,s)=>{if(i.selection&&e--==0)return t=s,!1}),n.slice(t)}class zt{constructor(e,t,i,s){this.map=e,this.step=t,this.selection=i,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new zt(t.getMap().invert(),t,this.selection)}}}class hn{constructor(e,t,i,s,r){this.done=e,this.undone=t,this.prevRanges=i,this.prevTime=s,this.prevComposition=r}}const WD=20;function $D(n,e,t,i){let s=t.getMeta(Zn),r;if(s)return s.historyState;t.getMeta(YD)&&(n=new hn(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Zn))return o.getMeta(Zn).redo?new hn(n.done.addTransform(t,void 0,i,gr(e)),n.undone,Od(t.mapping.maps),n.prevTime,n.prevComposition):new hn(n.done,n.undone.addTransform(t,void 0,i,gr(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=n.prevTime==0||!o&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-i.newGroupDelay||!HD(t,n.prevRanges)),c=o?Uo(n.prevRanges,t.mapping):Od(t.mapping.maps);return new hn(n.done.addTransform(t,l?e.selection.getBookmark():void 0,i,gr(e)),Ot.empty,c,t.time,a??n.prevComposition)}else return(r=t.getMeta("rebased"))?new hn(n.done.rebased(t,r),n.undone.rebased(t,r),Uo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new hn(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Uo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function HD(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((i,s)=>{for(let r=0;r<e.length;r+=2)i<=e[r+1]&&s>=e[r]&&(t=!0)}),t}function Od(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((i,s,r,o)=>e.push(r,o));return e}function Uo(n,e){if(!n)return null;let t=[];for(let i=0;i<n.length;i+=2){let s=e.map(n[i],1),r=e.map(n[i+1],-1);s<=r&&t.push(s,r)}return t}function VD(n,e,t){let i=gr(e),s=Zn.get(e).spec.config,r=(t?n.undone:n.done).popEvent(e,i);if(!r)return null;let o=r.selection.resolve(r.transform.doc),a=(t?n.done:n.undone).addTransform(r.transform,e.selection.getBookmark(),s,i),l=new hn(t?a:r.remaining,t?r.remaining:a,null,0,-1);return r.transform.setSelection(o).setMeta(Zn,{redo:t,historyState:l})}let Jo=!1,Dd=null;function gr(n){let e=n.plugins;if(Dd!=e){Jo=!1,Dd=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Jo=!0;break}}return Jo}const Zn=new Vt("history"),YD=new Vt("closeHistory");function qD(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Ze({key:Zn,state:{init(){return new hn(Ot.empty,Ot.empty,null,0,-1)},apply(e,t,i){return $D(t,i,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let i=t.inputType,s=i=="historyUndo"?mm:i=="historyRedo"?gm:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function pm(n,e){return(t,i)=>{let s=Zn.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(i){let r=VD(s,t,n);r&&i(e?r.scrollIntoView():r)}return!0}}const mm=pm(!1,!0),gm=pm(!0,!0),KD=Ve.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>mm(n,e),redo:()=>({state:n,dispatch:e})=>gm(n,e)}},addProseMirrorPlugins(){return[qD(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),UD=Qe.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",He(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!FO(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$from:i,$to:s}=t,r=n();return i.parentOffset===0?r.insertContentAt({from:Math.max(i.pos-1,0),to:s.pos},{type:this.name}):aO(t)?r.insertContentAt(s.pos,{type:this.name}):r.insertContent({type:this.name}),r.command(({tr:o,dispatch:a})=>{var l;if(a){const{$to:c}=o.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?o.setSelection($.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(L.create(o.doc,c.pos)):o.setSelection($.create(o.doc,c.pos));else{const u=(l=c.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();u&&(o.insert(d,u),o.setSelection($.create(o.doc,d+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[LO({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),JD=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,GD=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,XD=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,QD=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,ZD=Dn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",He(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ai({find:JD,type:this.type}),Ai({find:XD,type:this.type})]},addPasteRules(){return[Pi({find:GD,type:this.type}),Pi({find:QD,type:this.type})]}}),eT=Qe.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",He(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),tT="listItem",Td="textStyle",Nd=/^(\d+)\.\s$/,nT=Qe.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",He(this.options.HTMLAttributes,t),0]:["ol",He(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(tT,this.editor.getAttributes(Td)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Ts({find:Nd,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Ts({find:Nd,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Td)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),iT=Qe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",He(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),sT=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,rT=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,oT=Dn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",He(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ai({find:sT,type:this.type})]},addPasteRules(){return[Pi({find:rT,type:this.type})]}}),aT=Qe.create({name:"text",group:"inline"}),lT=Ve.create({name:"starterKit",addExtensions(){const n=[];return this.options.bold!==!1&&n.push(mD.configure(this.options.bold)),this.options.blockquote!==!1&&n.push(dD.configure(this.options.blockquote)),this.options.bulletList!==!1&&n.push(bD.configure(this.options.bulletList)),this.options.code!==!1&&n.push(_D.configure(this.options.code)),this.options.codeBlock!==!1&&n.push(vD.configure(this.options.codeBlock)),this.options.document!==!1&&n.push(SD.configure(this.options.document)),this.options.dropcursor!==!1&&n.push(OD.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&n.push(RD.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&n.push(zD.configure(this.options.hardBreak)),this.options.heading!==!1&&n.push(jD.configure(this.options.heading)),this.options.history!==!1&&n.push(KD.configure(this.options.history)),this.options.horizontalRule!==!1&&n.push(UD.configure(this.options.horizontalRule)),this.options.italic!==!1&&n.push(ZD.configure(this.options.italic)),this.options.listItem!==!1&&n.push(eT.configure(this.options.listItem)),this.options.orderedList!==!1&&n.push(nT.configure(this.options.orderedList)),this.options.paragraph!==!1&&n.push(iT.configure(this.options.paragraph)),this.options.strike!==!1&&n.push(oT.configure(this.options.strike)),this.options.text!==!1&&n.push(aT.configure(this.options.text)),n}}),cT="_wrapper_1gzb6_1",dT="_label_1gzb6_9",uT="_editor_1gzb6_16",hT="_error_1gzb6_30",fT="_disabled_1gzb6_34",pT="_toolbar_1gzb6_40",mT="_content_1gzb6_94",we={wrapper:cT,label:dT,editor:uT,error:hT,disabled:fT,toolbar:pT,"toolbar-group":"_toolbar-group_1gzb6_50","toolbar-btn":"_toolbar-btn_1gzb6_56","toolbar-btn-active":"_toolbar-btn-active_1gzb6_80","toolbar-separator":"_toolbar-separator_1gzb6_85",content:mT,"size-sm":"_size-sm_1gzb6_99","size-md":"_size-md_1gzb6_100","size-lg":"_size-lg_1gzb6_101","error-text":"_error-text_1gzb6_159"};function Mt({onClick:n,active:e,disabled:t,title:i,children:s}){return b.jsx("button",{type:"button",title:i,"aria-label":i,"aria-pressed":e,disabled:t,className:N(we["toolbar-btn"],e&&we["toolbar-btn-active"]),onMouseDown:r=>{r.preventDefault(),n()},children:s})}const bm=x.forwardRef(({value:n,defaultValue:e="",placeholder:t="Start typing…",size:i="md",disabled:s=!1,label:r,error:o,minHeight:a,onChange:l,className:c,id:d},u)=>{const h=rD({extensions:[lT],content:n!==void 0?n:e,editable:!s,onUpdate:({editor:C})=>{l?.(C.getHTML())}}),f=x.useCallback(()=>h?.chain().focus().toggleBold().run(),[h]),p=x.useCallback(()=>h?.chain().focus().toggleItalic().run(),[h]),m=x.useCallback(()=>h?.chain().focus().toggleStrike().run(),[h]),g=x.useCallback(()=>h?.chain().focus().toggleCode().run(),[h]),y=x.useCallback(()=>h?.chain().focus().toggleHeading({level:1}).run(),[h]),S=x.useCallback(()=>h?.chain().focus().toggleHeading({level:2}).run(),[h]),_=x.useCallback(()=>h?.chain().focus().toggleBulletList().run(),[h]),k=x.useCallback(()=>h?.chain().focus().toggleOrderedList().run(),[h]),v=x.useCallback(()=>h?.chain().focus().toggleBlockquote().run(),[h]),w=x.useCallback(()=>h?.chain().focus().undo().run(),[h]),M=x.useCallback(()=>h?.chain().focus().redo().run(),[h]);return b.jsxs("div",{ref:u,className:N(we.wrapper,we[`size-${i}`],c),children:[r&&b.jsx("label",{htmlFor:d,className:we.label,children:r}),b.jsxs("div",{className:N(we.editor,o&&we.error,s&&we.disabled),children:[b.jsxs("div",{className:we.toolbar,role:"toolbar","aria-label":"Text formatting",children:[b.jsxs("div",{className:we["toolbar-group"],children:[b.jsx(Mt,{onClick:f,active:h?.isActive("bold"),title:"Bold (Ctrl+B)",children:b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M3 2h4.5a2.5 2.5 0 010 5H3V2zM3 7h5a2.5 2.5 0 010 5H3V7z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"})})}),b.jsx(Mt,{onClick:p,active:h?.isActive("italic"),title:"Italic (Ctrl+I)",children:b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M5 2h5M4 12h5M8.5 2l-3 10",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}),b.jsx(Mt,{onClick:m,active:h?.isActive("strike"),title:"Strikethrough",children:b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M2 7h10M4 4c0-1.1.9-2 2-2h2a2 2 0 010 4H6a2 2 0 000 4h2a2 2 0 002-2",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})})}),b.jsx(Mt,{onClick:g,active:h?.isActive("code"),title:"Inline code",children:b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M5 3L2 7l3 4M9 3l3 4-3 4",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),b.jsx("div",{className:we["toolbar-separator"]}),b.jsxs("div",{className:we["toolbar-group"],children:[b.jsx(Mt,{onClick:y,active:h?.isActive("heading",{level:1}),title:"Heading 1",children:b.jsx("span",{style:{fontSize:"0.75rem",fontWeight:600},children:"H1"})}),b.jsx(Mt,{onClick:S,active:h?.isActive("heading",{level:2}),title:"Heading 2",children:b.jsx("span",{style:{fontSize:"0.75rem",fontWeight:600},children:"H2"})})]}),b.jsx("div",{className:we["toolbar-separator"]}),b.jsxs("div",{className:we["toolbar-group"],children:[b.jsx(Mt,{onClick:_,active:h?.isActive("bulletList"),title:"Bullet list",children:b.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[b.jsx("circle",{cx:"2.5",cy:"4",r:"1",fill:"currentColor"}),b.jsx("path",{d:"M5 4h7",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),b.jsx("circle",{cx:"2.5",cy:"7",r:"1",fill:"currentColor"}),b.jsx("path",{d:"M5 7h7",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),b.jsx("circle",{cx:"2.5",cy:"10",r:"1",fill:"currentColor"}),b.jsx("path",{d:"M5 10h7",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}),b.jsx(Mt,{onClick:k,active:h?.isActive("orderedList"),title:"Ordered list",children:b.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[b.jsx("path",{d:"M1.5 2v3M1 5h2",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),b.jsx("path",{d:"M5 4h7",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),b.jsx("path",{d:"M5 7h7",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),b.jsx("path",{d:"M5 10h7",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}),b.jsx(Mt,{onClick:v,active:h?.isActive("blockquote"),title:"Blockquote",children:b.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[b.jsx("path",{d:"M2 4h3v4H2V4zM7 4h3v4H7V4z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),b.jsx("path",{d:"M5 8c0 1.1-.9 2-2 2M10 8c0 1.1-.9 2-2 2",stroke:"currentColor",strokeWidth:"1.2"})]})})]}),b.jsx("div",{className:we["toolbar-separator"]}),b.jsxs("div",{className:we["toolbar-group"],children:[b.jsx(Mt,{onClick:w,title:"Undo (Ctrl+Z)",disabled:!h?.can().undo(),children:b.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[b.jsx("path",{d:"M2 5h5a4 4 0 010 8H2",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),b.jsx("path",{d:"M5 2L2 5l3 3",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]})}),b.jsx(Mt,{onClick:M,title:"Redo (Ctrl+Y)",disabled:!h?.can().redo(),children:b.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[b.jsx("path",{d:"M12 5H7a4 4 0 000 8h5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),b.jsx("path",{d:"M9 2l3 3-3 3",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),b.jsx(JO,{editor:h,id:d,className:we.content,style:a?{minHeight:a}:void 0,"aria-placeholder":t,"aria-label":r,"aria-invalid":!!o})]}),o&&b.jsx("p",{className:we["error-text"],role:"alert",children:o})]})});bm.displayName="RichTextEditor";function Ws(n){return n+.5|0}const bn=(n,e,t)=>Math.max(Math.min(n,t),e);function rs(n){return bn(Ws(n*2.55),0,255)}function Cn(n){return bn(Ws(n*255),0,255)}function Qt(n){return bn(Ws(n/2.55)/100,0,1)}function Ed(n){return bn(Ws(n*100),0,100)}const ht={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Pa=[..."0123456789ABCDEF"],gT=n=>Pa[n&15],bT=n=>Pa[(n&240)>>4]+Pa[n&15],er=n=>(n&240)>>4===(n&15),yT=n=>er(n.r)&&er(n.g)&&er(n.b)&&er(n.a);function xT(n){var e=n.length,t;return n[0]==="#"&&(e===4||e===5?t={r:255&ht[n[1]]*17,g:255&ht[n[2]]*17,b:255&ht[n[3]]*17,a:e===5?ht[n[4]]*17:255}:(e===7||e===9)&&(t={r:ht[n[1]]<<4|ht[n[2]],g:ht[n[3]]<<4|ht[n[4]],b:ht[n[5]]<<4|ht[n[6]],a:e===9?ht[n[7]]<<4|ht[n[8]]:255})),t}const _T=(n,e)=>n<255?e(n):"";function kT(n){var e=yT(n)?gT:bT;return n?"#"+e(n.r)+e(n.g)+e(n.b)+_T(n.a,e):void 0}const wT=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function ym(n,e,t){const i=e*Math.min(t,1-t),s=(r,o=(r+n/30)%12)=>t-i*Math.max(Math.min(o-3,9-o,1),-1);return[s(0),s(8),s(4)]}function vT(n,e,t){const i=(s,r=(s+n/60)%6)=>t-t*e*Math.max(Math.min(r,4-r,1),0);return[i(5),i(3),i(1)]}function ST(n,e,t){const i=ym(n,1,.5);let s;for(e+t>1&&(s=1/(e+t),e*=s,t*=s),s=0;s<3;s++)i[s]*=1-e-t,i[s]+=e;return i}function MT(n,e,t,i,s){return n===s?(e-t)/i+(e<t?6:0):e===s?(t-n)/i+2:(n-e)/i+4}function vl(n){const t=n.r/255,i=n.g/255,s=n.b/255,r=Math.max(t,i,s),o=Math.min(t,i,s),a=(r+o)/2;let l,c,d;return r!==o&&(d=r-o,c=a>.5?d/(2-r-o):d/(r+o),l=MT(t,i,s,d,r),l=l*60+.5),[l|0,c||0,a]}function Sl(n,e,t,i){return(Array.isArray(e)?n(e[0],e[1],e[2]):n(e,t,i)).map(Cn)}function Ml(n,e,t){return Sl(ym,n,e,t)}function CT(n,e,t){return Sl(ST,n,e,t)}function OT(n,e,t){return Sl(vT,n,e,t)}function xm(n){return(n%360+360)%360}function DT(n){const e=wT.exec(n);let t=255,i;if(!e)return;e[5]!==i&&(t=e[6]?rs(+e[5]):Cn(+e[5]));const s=xm(+e[2]),r=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?i=CT(s,r,o):e[1]==="hsv"?i=OT(s,r,o):i=Ml(s,r,o),{r:i[0],g:i[1],b:i[2],a:t}}function TT(n,e){var t=vl(n);t[0]=xm(t[0]+e),t=Ml(t),n.r=t[0],n.g=t[1],n.b=t[2]}function NT(n){if(!n)return;const e=vl(n),t=e[0],i=Ed(e[1]),s=Ed(e[2]);return n.a<255?`hsla(${t}, ${i}%, ${s}%, ${Qt(n.a)})`:`hsl(${t}, ${i}%, ${s}%)`}const Ad={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Pd={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function ET(){const n={},e=Object.keys(Pd),t=Object.keys(Ad);let i,s,r,o,a;for(i=0;i<e.length;i++){for(o=a=e[i],s=0;s<t.length;s++)r=t[s],a=a.replace(r,Ad[r]);r=parseInt(Pd[o],16),n[a]=[r>>16&255,r>>8&255,r&255]}return n}let tr;function AT(n){tr||(tr=ET(),tr.transparent=[0,0,0,0]);const e=tr[n.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const PT=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function IT(n){const e=PT.exec(n);let t=255,i,s,r;if(e){if(e[7]!==i){const o=+e[7];t=e[8]?rs(o):bn(o*255,0,255)}return i=+e[1],s=+e[3],r=+e[5],i=255&(e[2]?rs(i):bn(i,0,255)),s=255&(e[4]?rs(s):bn(s,0,255)),r=255&(e[6]?rs(r):bn(r,0,255)),{r:i,g:s,b:r,a:t}}}function RT(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${Qt(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const Go=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,gi=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function zT(n,e,t){const i=gi(Qt(n.r)),s=gi(Qt(n.g)),r=gi(Qt(n.b));return{r:Cn(Go(i+t*(gi(Qt(e.r))-i))),g:Cn(Go(s+t*(gi(Qt(e.g))-s))),b:Cn(Go(r+t*(gi(Qt(e.b))-r))),a:n.a+t*(e.a-n.a)}}function nr(n,e,t){if(n){let i=vl(n);i[e]=Math.max(0,Math.min(i[e]+i[e]*t,e===0?360:1)),i=Ml(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function _m(n,e){return n&&Object.assign(e||{},n)}function Id(n){var e={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(e={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(e.a=Cn(n[3]))):(e=_m(n,{r:0,g:0,b:0,a:1}),e.a=Cn(e.a)),e}function jT(n){return n.charAt(0)==="r"?IT(n):DT(n)}class Ns{constructor(e){if(e instanceof Ns)return e;const t=typeof e;let i;t==="object"?i=Id(e):t==="string"&&(i=xT(e)||AT(e)||jT(e)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var e=_m(this._rgb);return e&&(e.a=Qt(e.a)),e}set rgb(e){this._rgb=Id(e)}rgbString(){return this._valid?RT(this._rgb):void 0}hexString(){return this._valid?kT(this._rgb):void 0}hslString(){return this._valid?NT(this._rgb):void 0}mix(e,t){if(e){const i=this.rgb,s=e.rgb;let r;const o=t===r?.5:t,a=2*o-1,l=i.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;r=1-c,i.r=255&c*i.r+r*s.r+.5,i.g=255&c*i.g+r*s.g+.5,i.b=255&c*i.b+r*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(e,t){return e&&(this._rgb=zT(this._rgb,e._rgb,t)),this}clone(){return new Ns(this.rgb)}alpha(e){return this._rgb.a=Cn(e),this}clearer(e){const t=this._rgb;return t.a*=1-e,this}greyscale(){const e=this._rgb,t=Ws(e.r*.3+e.g*.59+e.b*.11);return e.r=e.g=e.b=t,this}opaquer(e){const t=this._rgb;return t.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return nr(this._rgb,2,e),this}darken(e){return nr(this._rgb,2,-e),this}saturate(e){return nr(this._rgb,1,e),this}desaturate(e){return nr(this._rgb,1,-e),this}rotate(e){return TT(this._rgb,e),this}}function Kt(){}const BT=(()=>{let n=0;return()=>n++})();function pe(n){return n==null}function _e(n){if(Array.isArray&&Array.isArray(n))return!0;const e=Object.prototype.toString.call(n);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function X(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function Le(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function Pt(n,e){return Le(n)?n:e}function J(n,e){return typeof n>"u"?e:n}const LT=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*e:+n;function ue(n,e,t){if(n&&typeof n.call=="function")return n.apply(t,e)}function re(n,e,t,i){let s,r,o;if(_e(n))for(r=n.length,s=0;s<r;s++)e.call(t,n[s],s);else if(X(n))for(o=Object.keys(n),r=o.length,s=0;s<r;s++)e.call(t,n[o[s]],o[s])}function Ir(n,e){let t,i,s,r;if(!n||!e||n.length!==e.length)return!1;for(t=0,i=n.length;t<i;++t)if(s=n[t],r=e[t],s.datasetIndex!==r.datasetIndex||s.index!==r.index)return!1;return!0}function Rr(n){if(_e(n))return n.map(Rr);if(X(n)){const e=Object.create(null),t=Object.keys(n),i=t.length;let s=0;for(;s<i;++s)e[t[s]]=Rr(n[t[s]]);return e}return n}function km(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function FT(n,e,t,i){if(!km(n))return;const s=e[n],r=t[n];X(s)&&X(r)?Es(s,r,i):e[n]=Rr(r)}function Es(n,e,t){const i=_e(e)?e:[e],s=i.length;if(!X(n))return n;t=t||{};const r=t.merger||FT;let o;for(let a=0;a<s;++a){if(o=i[a],!X(o))continue;const l=Object.keys(o);for(let c=0,d=l.length;c<d;++c)r(l[c],n,o,t)}return n}function fs(n,e){return Es(n,e,{merger:WT})}function WT(n,e,t){if(!km(n))return;const i=e[n],s=t[n];X(i)&&X(s)?fs(i,s):Object.prototype.hasOwnProperty.call(e,n)||(e[n]=Rr(s))}const Rd={"":n=>n,x:n=>n.x,y:n=>n.y};function $T(n){const e=n.split("."),t=[];let i="";for(const s of e)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(t.push(i),i="");return t}function HT(n){const e=$T(n);return t=>{for(const i of e){if(i==="")break;t=t&&t[i]}return t}}function zr(n,e){return(Rd[e]||(Rd[e]=HT(e)))(n)}function Cl(n){return n.charAt(0).toUpperCase()+n.slice(1)}const jr=n=>typeof n<"u",Tn=n=>typeof n=="function",zd=(n,e)=>{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0};function VT(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const ae=Math.PI,Ce=2*ae,YT=Ce+ae,Br=Number.POSITIVE_INFINITY,qT=ae/180,Pe=ae/2,Rn=ae/4,jd=ae*2/3,wm=Math.log10,Ii=Math.sign;function ps(n,e,t){return Math.abs(n-e)<t}function Bd(n){const e=Math.round(n);n=ps(n,e,n/1e3)?e:n;const t=Math.pow(10,Math.floor(wm(n))),i=n/t;return(i<=1?1:i<=2?2:i<=5?5:10)*t}function KT(n){const e=[],t=Math.sqrt(n);let i;for(i=1;i<t;i++)n%i===0&&(e.push(i),e.push(n/i));return t===(t|0)&&e.push(t),e.sort((s,r)=>s-r).pop(),e}function UT(n){return typeof n=="symbol"||typeof n=="object"&&n!==null&&!(Symbol.toPrimitive in n||"toString"in n||"valueOf"in n)}function Lr(n){return!UT(n)&&!isNaN(parseFloat(n))&&isFinite(n)}function JT(n,e){const t=Math.round(n);return t-e<=n&&t+e>=n}function GT(n,e,t){let i,s,r;for(i=0,s=n.length;i<s;i++)r=n[i][t],isNaN(r)||(e.min=Math.min(e.min,r),e.max=Math.max(e.max,r))}function Un(n){return n*(ae/180)}function XT(n){return n*(180/ae)}function Ld(n){if(!Le(n))return;let e=1,t=0;for(;Math.round(n*e)/e!==n;)e*=10,t++;return t}function vm(n,e){const t=e.x-n.x,i=e.y-n.y,s=Math.sqrt(t*t+i*i);let r=Math.atan2(i,t);return r<-.5*ae&&(r+=Ce),{angle:r,distance:s}}function Ia(n,e){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function QT(n,e){return(n-e+YT)%Ce-ae}function at(n){return(n%Ce+Ce)%Ce}function Ol(n,e,t,i){const s=at(n),r=at(e),o=at(t),a=at(r-s),l=at(o-s),c=at(s-r),d=at(s-o);return s===r||s===o||i&&r===o||a>l&&c<d}function Ge(n,e,t){return Math.max(e,Math.min(t,n))}function ZT(n){return Ge(n,-32768,32767)}function sn(n,e,t,i=1e-6){return n>=Math.min(e,t)-i&&n<=Math.max(e,t)+i}function Dl(n,e,t){t=t||(o=>n[o]<e);let i=n.length-1,s=0,r;for(;i-s>1;)r=s+i>>1,t(r)?s=r:i=r;return{lo:s,hi:i}}const Ra=(n,e,t,i)=>Dl(n,t,i?s=>{const r=n[s][e];return r<t||r===t&&n[s+1][e]===t}:s=>n[s][e]<t),eN=(n,e,t)=>Dl(n,t,i=>n[i][e]>=t);function tN(n,e,t){let i=0,s=n.length;for(;i<s&&n[i]<e;)i++;for(;s>i&&n[s-1]>t;)s--;return i>0||s<n.length?n.slice(i,s):n}const Sm=["push","pop","shift","splice","unshift"];function nN(n,e){if(n._chartjs){n._chartjs.listeners.push(e);return}Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),Sm.forEach(t=>{const i="_onData"+Cl(t),s=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...r){const o=s.apply(this,r);return n._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...r)}),o}})})}function Fd(n,e){const t=n._chartjs;if(!t)return;const i=t.listeners,s=i.indexOf(e);s!==-1&&i.splice(s,1),!(i.length>0)&&(Sm.forEach(r=>{delete n[r]}),delete n._chartjs)}function iN(n){const e=new Set(n);return e.size===n.length?n:Array.from(e)}const Mm=(function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame})();function Cm(n,e){let t=[],i=!1;return function(...s){t=s,i||(i=!0,Mm.call(window,()=>{i=!1,n.apply(e,t)}))}}function sN(n,e){let t;return function(...i){return e?(clearTimeout(t),t=setTimeout(n,e,i)):n.apply(this,i),e}}const Tl=n=>n==="start"?"left":n==="end"?"right":"center",Ie=(n,e,t)=>n==="start"?e:n==="end"?t:(e+t)/2,rN=(n,e,t,i)=>n===(i?"left":"right")?t:n==="center"?(e+t)/2:e,ir=n=>n===0||n===1,Wd=(n,e,t)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-e)*Ce/t)),$d=(n,e,t)=>Math.pow(2,-10*n)*Math.sin((n-e)*Ce/t)+1,ms={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*Pe)+1,easeOutSine:n=>Math.sin(n*Pe),easeInOutSine:n=>-.5*(Math.cos(ae*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>ir(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>ir(n)?n:Wd(n,.075,.3),easeOutElastic:n=>ir(n)?n:$d(n,.075,.3),easeInOutElastic(n){return ir(n)?n:n<.5?.5*Wd(n*2,.1125,.45):.5+.5*$d(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let e=1.70158;return(n/=.5)<1?.5*(n*n*(((e*=1.525)+1)*n-e)):.5*((n-=2)*n*(((e*=1.525)+1)*n+e)+2)},easeInBounce:n=>1-ms.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?ms.easeInBounce(n*2)*.5:ms.easeOutBounce(n*2-1)*.5+.5};function Nl(n){if(n&&typeof n=="object"){const e=n.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function Hd(n){return Nl(n)?n:new Ns(n)}function Xo(n){return Nl(n)?n:new Ns(n).saturate(.5).darken(.1).hexString()}const oN=["x","y","borderWidth","radius","tension"],aN=["color","borderColor","backgroundColor"];function lN(n){n.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),n.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>e!=="onProgress"&&e!=="onComplete"&&e!=="fn"}),n.set("animations",{colors:{type:"color",properties:aN},numbers:{type:"number",properties:oN}}),n.describe("animations",{_fallback:"animation"}),n.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:e=>e|0}}}})}function cN(n){n.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Vd=new Map;function dN(n,e){e=e||{};const t=n+JSON.stringify(e);let i=Vd.get(t);return i||(i=new Intl.NumberFormat(n,e),Vd.set(t,i)),i}function Om(n,e,t){return dN(e,t).format(n)}const uN={values(n){return _e(n)?n:""+n},numeric(n,e,t){if(n===0)return"0";const i=this.chart.options.locale;let s,r=n;if(t.length>1){const c=Math.max(Math.abs(t[0].value),Math.abs(t[t.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),r=hN(n,t)}const o=wm(Math.abs(r)),a=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Om(n,i,l)}};function hN(n,e){let t=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(t)>=1&&n!==Math.floor(n)&&(t=n-Math.floor(n)),t}var Dm={formatters:uN};function fN(n){n.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,t)=>t.lineWidth,tickColor:(e,t)=>t.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Dm.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),n.route("scale.ticks","color","","color"),n.route("scale.grid","color","","borderColor"),n.route("scale.border","color","","borderColor"),n.route("scale.title","color","","color"),n.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&e!=="callback"&&e!=="parser",_indexable:e=>e!=="borderDash"&&e!=="tickBorderDash"&&e!=="dash"}),n.describe("scales",{_fallback:"scale"}),n.describe("scale.ticks",{_scriptable:e=>e!=="backdropPadding"&&e!=="callback",_indexable:e=>e!=="backdropPadding"})}const oi=Object.create(null),za=Object.create(null);function gs(n,e){if(!e)return n;const t=e.split(".");for(let i=0,s=t.length;i<s;++i){const r=t[i];n=n[r]||(n[r]=Object.create(null))}return n}function Qo(n,e,t){return typeof e=="string"?Es(gs(n,e),t):Es(gs(n,""),e)}class pN{constructor(e,t){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>Xo(s.backgroundColor),this.hoverBorderColor=(i,s)=>Xo(s.borderColor),this.hoverColor=(i,s)=>Xo(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(t)}set(e,t){return Qo(this,e,t)}get(e){return gs(this,e)}describe(e,t){return Qo(za,e,t)}override(e,t){return Qo(oi,e,t)}route(e,t,i,s){const r=gs(this,e),o=gs(this,i),a="_"+t;Object.defineProperties(r,{[a]:{value:r[t],writable:!0},[t]:{enumerable:!0,get(){const l=this[a],c=o[s];return X(l)?Object.assign({},c,l):J(l,c)},set(l){this[a]=l}}})}apply(e){e.forEach(t=>t(this))}}var ge=new pN({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[lN,cN,fN]);function mN(n){return!n||pe(n.size)||pe(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function Yd(n,e,t,i,s){let r=e[s];return r||(r=e[s]=n.measureText(s).width,t.push(s)),r>i&&(i=r),i}function zn(n,e,t){const i=n.currentDevicePixelRatio,s=t!==0?Math.max(t/2,.5):0;return Math.round((e-s)*i)/i+s}function qd(n,e){!e&&!n||(e=e||n.getContext("2d"),e.save(),e.resetTransform(),e.clearRect(0,0,n.width,n.height),e.restore())}function ja(n,e,t,i){Tm(n,e,t,i,null)}function Tm(n,e,t,i,s){let r,o,a,l,c,d,u,h;const f=e.pointStyle,p=e.rotation,m=e.radius;let g=(p||0)*qT;if(f&&typeof f=="object"&&(r=f.toString(),r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]")){n.save(),n.translate(t,i),n.rotate(g),n.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),n.restore();return}if(!(isNaN(m)||m<=0)){switch(n.beginPath(),f){default:s?n.ellipse(t,i,s/2,m,0,0,Ce):n.arc(t,i,m,0,Ce),n.closePath();break;case"triangle":d=s?s/2:m,n.moveTo(t+Math.sin(g)*d,i-Math.cos(g)*m),g+=jd,n.lineTo(t+Math.sin(g)*d,i-Math.cos(g)*m),g+=jd,n.lineTo(t+Math.sin(g)*d,i-Math.cos(g)*m),n.closePath();break;case"rectRounded":c=m*.516,l=m-c,o=Math.cos(g+Rn)*l,u=Math.cos(g+Rn)*(s?s/2-c:l),a=Math.sin(g+Rn)*l,h=Math.sin(g+Rn)*(s?s/2-c:l),n.arc(t-u,i-a,c,g-ae,g-Pe),n.arc(t+h,i-o,c,g-Pe,g),n.arc(t+u,i+a,c,g,g+Pe),n.arc(t-h,i+o,c,g+Pe,g+ae),n.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*m,d=s?s/2:l,n.rect(t-d,i-l,2*d,2*l);break}g+=Rn;case"rectRot":u=Math.cos(g)*(s?s/2:m),o=Math.cos(g)*m,a=Math.sin(g)*m,h=Math.sin(g)*(s?s/2:m),n.moveTo(t-u,i-a),n.lineTo(t+h,i-o),n.lineTo(t+u,i+a),n.lineTo(t-h,i+o),n.closePath();break;case"crossRot":g+=Rn;case"cross":u=Math.cos(g)*(s?s/2:m),o=Math.cos(g)*m,a=Math.sin(g)*m,h=Math.sin(g)*(s?s/2:m),n.moveTo(t-u,i-a),n.lineTo(t+u,i+a),n.moveTo(t+h,i-o),n.lineTo(t-h,i+o);break;case"star":u=Math.cos(g)*(s?s/2:m),o=Math.cos(g)*m,a=Math.sin(g)*m,h=Math.sin(g)*(s?s/2:m),n.moveTo(t-u,i-a),n.lineTo(t+u,i+a),n.moveTo(t+h,i-o),n.lineTo(t-h,i+o),g+=Rn,u=Math.cos(g)*(s?s/2:m),o=Math.cos(g)*m,a=Math.sin(g)*m,h=Math.sin(g)*(s?s/2:m),n.moveTo(t-u,i-a),n.lineTo(t+u,i+a),n.moveTo(t+h,i-o),n.lineTo(t-h,i+o);break;case"line":o=s?s/2:Math.cos(g)*m,a=Math.sin(g)*m,n.moveTo(t-o,i-a),n.lineTo(t+o,i+a);break;case"dash":n.moveTo(t,i),n.lineTo(t+Math.cos(g)*(s?s/2:m),i+Math.sin(g)*m);break;case!1:n.closePath();break}n.fill(),e.borderWidth>0&&n.stroke()}}function As(n,e,t){return t=t||.5,!e||n&&n.x>e.left-t&&n.x<e.right+t&&n.y>e.top-t&&n.y<e.bottom+t}function ao(n,e){n.save(),n.beginPath(),n.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),n.clip()}function lo(n){n.restore()}function gN(n,e,t,i,s){if(!e)return n.lineTo(t.x,t.y);if(s==="middle"){const r=(e.x+t.x)/2;n.lineTo(r,e.y),n.lineTo(r,t.y)}else s==="after"!=!!i?n.lineTo(e.x,t.y):n.lineTo(t.x,e.y);n.lineTo(t.x,t.y)}function bN(n,e,t,i){if(!e)return n.lineTo(t.x,t.y);n.bezierCurveTo(i?e.cp1x:e.cp2x,i?e.cp1y:e.cp2y,i?t.cp2x:t.cp1x,i?t.cp2y:t.cp1y,t.x,t.y)}function yN(n,e){e.translation&&n.translate(e.translation[0],e.translation[1]),pe(e.rotation)||n.rotate(e.rotation),e.color&&(n.fillStyle=e.color),e.textAlign&&(n.textAlign=e.textAlign),e.textBaseline&&(n.textBaseline=e.textBaseline)}function xN(n,e,t,i,s){if(s.strikethrough||s.underline){const r=n.measureText(i),o=e-r.actualBoundingBoxLeft,a=e+r.actualBoundingBoxRight,l=t-r.actualBoundingBoxAscent,c=t+r.actualBoundingBoxDescent,d=s.strikethrough?(l+c)/2:c;n.strokeStyle=n.fillStyle,n.beginPath(),n.lineWidth=s.decorationWidth||2,n.moveTo(o,d),n.lineTo(a,d),n.stroke()}}function _N(n,e){const t=n.fillStyle;n.fillStyle=e.color,n.fillRect(e.left,e.top,e.width,e.height),n.fillStyle=t}function Ps(n,e,t,i,s,r={}){const o=_e(e)?e:[e],a=r.strokeWidth>0&&r.strokeColor!=="";let l,c;for(n.save(),n.font=s.string,yN(n,r),l=0;l<o.length;++l)c=o[l],r.backdrop&&_N(n,r.backdrop),a&&(r.strokeColor&&(n.strokeStyle=r.strokeColor),pe(r.strokeWidth)||(n.lineWidth=r.strokeWidth),n.strokeText(c,t,i,r.maxWidth)),n.fillText(c,t,i,r.maxWidth),xN(n,t,i,c,r),i+=Number(s.lineHeight);n.restore()}function Fr(n,e){const{x:t,y:i,w:s,h:r,radius:o}=e;n.arc(t+o.topLeft,i+o.topLeft,o.topLeft,1.5*ae,ae,!0),n.lineTo(t,i+r-o.bottomLeft),n.arc(t+o.bottomLeft,i+r-o.bottomLeft,o.bottomLeft,ae,Pe,!0),n.lineTo(t+s-o.bottomRight,i+r),n.arc(t+s-o.bottomRight,i+r-o.bottomRight,o.bottomRight,Pe,0,!0),n.lineTo(t+s,i+o.topRight),n.arc(t+s-o.topRight,i+o.topRight,o.topRight,0,-Pe,!0),n.lineTo(t+o.topLeft,i)}const kN=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,wN=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function vN(n,e){const t=(""+n).match(kN);if(!t||t[1]==="normal")return e*1.2;switch(n=+t[2],t[3]){case"px":return n;case"%":n/=100;break}return e*n}const SN=n=>+n||0;function El(n,e){const t={},i=X(e),s=i?Object.keys(e):e,r=X(n)?i?o=>J(n[o],n[e[o]]):o=>n[o]:()=>n;for(const o of s)t[o]=SN(r(o));return t}function Nm(n){return El(n,{top:"y",right:"x",bottom:"y",left:"x"})}function Mi(n){return El(n,["topLeft","topRight","bottomLeft","bottomRight"])}function kt(n){const e=Nm(n);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function je(n,e){n=n||{},e=e||ge.font;let t=J(n.size,e.size);typeof t=="string"&&(t=parseInt(t,10));let i=J(n.style,e.style);i&&!(""+i).match(wN)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:J(n.family,e.family),lineHeight:vN(J(n.lineHeight,e.lineHeight),t),size:t,style:i,weight:J(n.weight,e.weight),string:""};return s.string=mN(s),s}function sr(n,e,t,i){let s,r,o;for(s=0,r=n.length;s<r;++s)if(o=n[s],o!==void 0&&o!==void 0)return o}function MN(n,e,t){const{min:i,max:s}=n,r=LT(e,(s-i)/2),o=(a,l)=>t&&a===0?0:a+l;return{min:o(i,-Math.abs(r)),max:o(s,r)}}function li(n,e){return Object.assign(Object.create(n),e)}function Al(n,e=[""],t,i,s=()=>n[0]){const r=t||n;typeof i>"u"&&(i=Im("_fallback",n));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:r,_fallback:i,_getTarget:s,override:a=>Al([a,...n],e,r,i)};return new Proxy(o,{deleteProperty(a,l){return delete a[l],delete a._keys,delete n[0][l],!0},get(a,l){return Am(a,l,()=>PN(l,e,n,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(a,l){return Ud(a).includes(l)},ownKeys(a){return Ud(a)},set(a,l,c){const d=a._storage||(a._storage=s());return a[l]=d[l]=c,delete a._keys,!0}})}function Ri(n,e,t,i){const s={_cacheable:!1,_proxy:n,_context:e,_subProxy:t,_stack:new Set,_descriptors:Em(n,i),setContext:r=>Ri(n,r,t,i),override:r=>Ri(n.override(r),e,t,i)};return new Proxy(s,{deleteProperty(r,o){return delete r[o],delete n[o],!0},get(r,o,a){return Am(r,o,()=>ON(r,o,a))},getOwnPropertyDescriptor(r,o){return r._descriptors.allKeys?Reflect.has(n,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,o)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(r,o){return Reflect.has(n,o)},ownKeys(){return Reflect.ownKeys(n)},set(r,o,a){return n[o]=a,delete r[o],!0}})}function Em(n,e={scriptable:!0,indexable:!0}){const{_scriptable:t=e.scriptable,_indexable:i=e.indexable,_allKeys:s=e.allKeys}=n;return{allKeys:s,scriptable:t,indexable:i,isScriptable:Tn(t)?t:()=>t,isIndexable:Tn(i)?i:()=>i}}const CN=(n,e)=>n?n+Cl(e):e,Pl=(n,e)=>X(e)&&n!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function Am(n,e,t){if(Object.prototype.hasOwnProperty.call(n,e)||e==="constructor")return n[e];const i=t();return n[e]=i,i}function ON(n,e,t){const{_proxy:i,_context:s,_subProxy:r,_descriptors:o}=n;let a=i[e];return Tn(a)&&o.isScriptable(e)&&(a=DN(e,a,n,t)),_e(a)&&a.length&&(a=TN(e,a,n,o.isIndexable)),Pl(e,a)&&(a=Ri(a,s,r&&r[e],o)),a}function DN(n,e,t,i){const{_proxy:s,_context:r,_subProxy:o,_stack:a}=t;if(a.has(n))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+n);a.add(n);let l=e(r,o||i);return a.delete(n),Pl(n,l)&&(l=Il(s._scopes,s,n,l)),l}function TN(n,e,t,i){const{_proxy:s,_context:r,_subProxy:o,_descriptors:a}=t;if(typeof r.index<"u"&&i(n))return e[r.index%e.length];if(X(e[0])){const l=e,c=s._scopes.filter(d=>d!==l);e=[];for(const d of l){const u=Il(c,s,n,d);e.push(Ri(u,r,o&&o[n],a))}}return e}function Pm(n,e,t){return Tn(n)?n(e,t):n}const NN=(n,e)=>n===!0?e:typeof n=="string"?zr(e,n):void 0;function EN(n,e,t,i,s){for(const r of e){const o=NN(t,r);if(o){n.add(o);const a=Pm(o._fallback,t,s);if(typeof a<"u"&&a!==t&&a!==i)return a}else if(o===!1&&typeof i<"u"&&t!==i)return null}return!1}function Il(n,e,t,i){const s=e._rootScopes,r=Pm(e._fallback,t,i),o=[...n,...s],a=new Set;a.add(i);let l=Kd(a,o,t,r||t,i);return l===null||typeof r<"u"&&r!==t&&(l=Kd(a,o,r,l,i),l===null)?!1:Al(Array.from(a),[""],s,r,()=>AN(e,t,i))}function Kd(n,e,t,i,s){for(;t;)t=EN(n,e,t,i,s);return t}function AN(n,e,t){const i=n._getTarget();e in i||(i[e]={});const s=i[e];return _e(s)&&X(t)?t:s||{}}function PN(n,e,t,i){let s;for(const r of e)if(s=Im(CN(r,n),t),typeof s<"u")return Pl(n,s)?Il(t,i,n,s):s}function Im(n,e){for(const t of e){if(!t)continue;const i=t[n];if(typeof i<"u")return i}}function Ud(n){let e=n._keys;return e||(e=n._keys=IN(n._scopes)),e}function IN(n){const e=new Set;for(const t of n)for(const i of Object.keys(t).filter(s=>!s.startsWith("_")))e.add(i);return Array.from(e)}const RN=Number.EPSILON||1e-14,zi=(n,e)=>e<n.length&&!n[e].skip&&n[e],Rm=n=>n==="x"?"y":"x";function zN(n,e,t,i){const s=n.skip?e:n,r=e,o=t.skip?e:t,a=Ia(r,s),l=Ia(o,r);let c=a/(a+l),d=l/(a+l);c=isNaN(c)?0:c,d=isNaN(d)?0:d;const u=i*c,h=i*d;return{previous:{x:r.x-u*(o.x-s.x),y:r.y-u*(o.y-s.y)},next:{x:r.x+h*(o.x-s.x),y:r.y+h*(o.y-s.y)}}}function jN(n,e,t){const i=n.length;let s,r,o,a,l,c=zi(n,0);for(let d=0;d<i-1;++d)if(l=c,c=zi(n,d+1),!(!l||!c)){if(ps(e[d],0,RN)){t[d]=t[d+1]=0;continue}s=t[d]/e[d],r=t[d+1]/e[d],a=Math.pow(s,2)+Math.pow(r,2),!(a<=9)&&(o=3/Math.sqrt(a),t[d]=s*o*e[d],t[d+1]=r*o*e[d])}}function BN(n,e,t="x"){const i=Rm(t),s=n.length;let r,o,a,l=zi(n,0);for(let c=0;c<s;++c){if(o=a,a=l,l=zi(n,c+1),!a)continue;const d=a[t],u=a[i];o&&(r=(d-o[t])/3,a[`cp1${t}`]=d-r,a[`cp1${i}`]=u-r*e[c]),l&&(r=(l[t]-d)/3,a[`cp2${t}`]=d+r,a[`cp2${i}`]=u+r*e[c])}}function LN(n,e="x"){const t=Rm(e),i=n.length,s=Array(i).fill(0),r=Array(i);let o,a,l,c=zi(n,0);for(o=0;o<i;++o)if(a=l,l=c,c=zi(n,o+1),!!l){if(c){const d=c[e]-l[e];s[o]=d!==0?(c[t]-l[t])/d:0}r[o]=a?c?Ii(s[o-1])!==Ii(s[o])?0:(s[o-1]+s[o])/2:s[o-1]:s[o]}jN(n,s,r),BN(n,r,e)}function rr(n,e,t){return Math.max(Math.min(n,t),e)}function FN(n,e){let t,i,s,r,o,a=As(n[0],e);for(t=0,i=n.length;t<i;++t)o=r,r=a,a=t<i-1&&As(n[t+1],e),r&&(s=n[t],o&&(s.cp1x=rr(s.cp1x,e.left,e.right),s.cp1y=rr(s.cp1y,e.top,e.bottom)),a&&(s.cp2x=rr(s.cp2x,e.left,e.right),s.cp2y=rr(s.cp2y,e.top,e.bottom)))}function WN(n,e,t,i,s){let r,o,a,l;if(e.spanGaps&&(n=n.filter(c=>!c.skip)),e.cubicInterpolationMode==="monotone")LN(n,s);else{let c=i?n[n.length-1]:n[0];for(r=0,o=n.length;r<o;++r)a=n[r],l=zN(c,a,n[Math.min(r+1,o-(i?0:1))%o],e.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}e.capBezierPoints&&FN(n,t)}function Rl(){return typeof window<"u"&&typeof document<"u"}function zl(n){let e=n.parentNode;return e&&e.toString()==="[object ShadowRoot]"&&(e=e.host),e}function Wr(n,e,t){let i;return typeof n=="string"?(i=parseInt(n,10),n.indexOf("%")!==-1&&(i=i/100*e.parentNode[t])):i=n,i}const co=n=>n.ownerDocument.defaultView.getComputedStyle(n,null);function $N(n,e){return co(n).getPropertyValue(e)}const HN=["top","right","bottom","left"];function ei(n,e,t){const i={};t=t?"-"+t:"";for(let s=0;s<4;s++){const r=HN[s];i[r]=parseFloat(n[e+"-"+r+t])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const VN=(n,e,t)=>(n>0||e>0)&&(!t||!t.shadowRoot);function YN(n,e){const t=n.touches,i=t&&t.length?t[0]:n,{offsetX:s,offsetY:r}=i;let o=!1,a,l;if(VN(s,r,n.target))a=s,l=r;else{const c=e.getBoundingClientRect();a=i.clientX-c.left,l=i.clientY-c.top,o=!0}return{x:a,y:l,box:o}}function Fn(n,e){if("native"in n)return n;const{canvas:t,currentDevicePixelRatio:i}=e,s=co(t),r=s.boxSizing==="border-box",o=ei(s,"padding"),a=ei(s,"border","width"),{x:l,y:c,box:d}=YN(n,t),u=o.left+(d&&a.left),h=o.top+(d&&a.top);let{width:f,height:p}=e;return r&&(f-=o.width+a.width,p-=o.height+a.height),{x:Math.round((l-u)/f*t.width/i),y:Math.round((c-h)/p*t.height/i)}}function qN(n,e,t){let i,s;if(e===void 0||t===void 0){const r=n&&zl(n);if(!r)e=n.clientWidth,t=n.clientHeight;else{const o=r.getBoundingClientRect(),a=co(r),l=ei(a,"border","width"),c=ei(a,"padding");e=o.width-c.width-l.width,t=o.height-c.height-l.height,i=Wr(a.maxWidth,r,"clientWidth"),s=Wr(a.maxHeight,r,"clientHeight")}}return{width:e,height:t,maxWidth:i||Br,maxHeight:s||Br}}const yn=n=>Math.round(n*10)/10;function KN(n,e,t,i){const s=co(n),r=ei(s,"margin"),o=Wr(s.maxWidth,n,"clientWidth")||Br,a=Wr(s.maxHeight,n,"clientHeight")||Br,l=qN(n,e,t);let{width:c,height:d}=l;if(s.boxSizing==="content-box"){const h=ei(s,"border","width"),f=ei(s,"padding");c-=f.width+h.width,d-=f.height+h.height}return c=Math.max(0,c-r.width),d=Math.max(0,i?c/i:d-r.height),c=yn(Math.min(c,o,l.maxWidth)),d=yn(Math.min(d,a,l.maxHeight)),c&&!d&&(d=yn(c/2)),(e!==void 0||t!==void 0)&&i&&l.height&&d>l.height&&(d=l.height,c=yn(Math.floor(d*i))),{width:c,height:d}}function Jd(n,e,t){const i=e||1,s=yn(n.height*i),r=yn(n.width*i);n.height=yn(n.height),n.width=yn(n.width);const o=n.canvas;return o.style&&(t||!o.style.height&&!o.style.width)&&(o.style.height=`${n.height}px`,o.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||o.height!==s||o.width!==r?(n.currentDevicePixelRatio=i,o.height=s,o.width=r,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const UN=(function(){let n=!1;try{const e={get passive(){return n=!0,!1}};Rl()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return n})();function Gd(n,e){const t=$N(n,e),i=t&&t.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Wn(n,e,t,i){return{x:n.x+t*(e.x-n.x),y:n.y+t*(e.y-n.y)}}function JN(n,e,t,i){return{x:n.x+t*(e.x-n.x),y:i==="middle"?t<.5?n.y:e.y:i==="after"?t<1?n.y:e.y:t>0?e.y:n.y}}function GN(n,e,t,i){const s={x:n.cp2x,y:n.cp2y},r={x:e.cp1x,y:e.cp1y},o=Wn(n,s,t),a=Wn(s,r,t),l=Wn(r,e,t),c=Wn(o,a,t),d=Wn(a,l,t);return Wn(c,d,t)}const XN=function(n,e){return{x(t){return n+n+e-t},setWidth(t){e=t},textAlign(t){return t==="center"?t:t==="right"?"left":"right"},xPlus(t,i){return t-i},leftForLtr(t,i){return t-i}}},QN=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,e){return n+e},leftForLtr(n,e){return n}}};function Ci(n,e,t){return n?XN(e,t):QN()}function zm(n,e){let t,i;(e==="ltr"||e==="rtl")&&(t=n.canvas.style,i=[t.getPropertyValue("direction"),t.getPropertyPriority("direction")],t.setProperty("direction",e,"important"),n.prevTextDirection=i)}function jm(n,e){e!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",e[0],e[1]))}function Bm(n){return n==="angle"?{between:Ol,compare:QT,normalize:at}:{between:sn,compare:(e,t)=>e-t,normalize:e=>e}}function Xd({start:n,end:e,count:t,loop:i,style:s}){return{start:n%t,end:e%t,loop:i&&(e-n+1)%t===0,style:s}}function ZN(n,e,t){const{property:i,start:s,end:r}=t,{between:o,normalize:a}=Bm(i),l=e.length;let{start:c,end:d,loop:u}=n,h,f;if(u){for(c+=l,d+=l,h=0,f=l;h<f&&o(a(e[c%l][i]),s,r);++h)c--,d--;c%=l,d%=l}return d<c&&(d+=l),{start:c,end:d,loop:u,style:n.style}}function Lm(n,e,t){if(!t)return[n];const{property:i,start:s,end:r}=t,o=e.length,{compare:a,between:l,normalize:c}=Bm(i),{start:d,end:u,loop:h,style:f}=ZN(n,e,t),p=[];let m=!1,g=null,y,S,_;const k=()=>l(s,_,y)&&a(s,_)!==0,v=()=>a(r,y)===0||l(r,_,y),w=()=>m||k(),M=()=>!m||v();for(let C=d,O=d;C<=u;++C)S=e[C%o],!S.skip&&(y=c(S[i]),y!==_&&(m=l(y,s,r),g===null&&w()&&(g=a(y,s)===0?C:O),g!==null&&M()&&(p.push(Xd({start:g,end:C,loop:h,count:o,style:f})),g=null),O=C,_=y));return g!==null&&p.push(Xd({start:g,end:u,loop:h,count:o,style:f})),p}function Fm(n,e){const t=[],i=n.segments;for(let s=0;s<i.length;s++){const r=Lm(i[s],n.points,e);r.length&&t.push(...r)}return t}function eE(n,e,t,i){let s=0,r=e-1;if(t&&!i)for(;s<e&&!n[s].skip;)s++;for(;s<e&&n[s].skip;)s++;for(s%=e,t&&(r+=s);r>s&&n[r%e].skip;)r--;return r%=e,{start:s,end:r}}function tE(n,e,t,i){const s=n.length,r=[];let o=e,a=n[e],l;for(l=e+1;l<=t;++l){const c=n[l%s];c.skip||c.stop?a.skip||(i=!1,r.push({start:e%s,end:(l-1)%s,loop:i}),e=o=c.stop?l:null):(o=l,a.skip&&(e=l)),a=c}return o!==null&&r.push({start:e%s,end:o%s,loop:i}),r}function nE(n,e){const t=n.points,i=n.options.spanGaps,s=t.length;if(!s)return[];const r=!!n._loop,{start:o,end:a}=eE(t,s,r,i);if(i===!0)return Qd(n,[{start:o,end:a,loop:r}],t,e);const l=a<o?a+s:a,c=!!n._fullLoop&&o===0&&a===s-1;return Qd(n,tE(t,o,l,c),t,e)}function Qd(n,e,t,i){return!i||!i.setContext||!t?e:iE(n,e,t,i)}function iE(n,e,t,i){const s=n._chart.getContext(),r=Zd(n.options),{_datasetIndex:o,options:{spanGaps:a}}=n,l=t.length,c=[];let d=r,u=e[0].start,h=u;function f(p,m,g,y){const S=a?-1:1;if(p!==m){for(p+=l;t[p%l].skip;)p-=S;for(;t[m%l].skip;)m+=S;p%l!==m%l&&(c.push({start:p%l,end:m%l,loop:g,style:y}),d=y,u=m%l)}}for(const p of e){u=a?u:p.start;let m=t[u%l],g;for(h=u+1;h<=p.end;h++){const y=t[h%l];g=Zd(i.setContext(li(s,{type:"segment",p0:m,p1:y,p0DataIndex:(h-1)%l,p1DataIndex:h%l,datasetIndex:o}))),sE(g,d)&&f(u,h-1,p.loop,d),m=y,d=g}u<h-1&&f(u,h-1,p.loop,d)}return c}function Zd(n){return{backgroundColor:n.backgroundColor,borderCapStyle:n.borderCapStyle,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderJoinStyle:n.borderJoinStyle,borderWidth:n.borderWidth,borderColor:n.borderColor}}function sE(n,e){if(!e)return!1;const t=[],i=function(s,r){return Nl(r)?(t.includes(r)||t.push(r),t.indexOf(r)):r};return JSON.stringify(n,i)!==JSON.stringify(e,i)}function or(n,e,t){return n.options.clip?n[t]:e[t]}function rE(n,e){const{xScale:t,yScale:i}=n;return t&&i?{left:or(t,e,"left"),right:or(t,e,"right"),top:or(i,e,"top"),bottom:or(i,e,"bottom")}:e}function Wm(n,e){const t=e._clip;if(t.disabled)return!1;const i=rE(e,n.chartArea);return{left:t.left===!1?0:i.left-(t.left===!0?0:t.left),right:t.right===!1?n.width:i.right+(t.right===!0?0:t.right),top:t.top===!1?0:i.top-(t.top===!0?0:t.top),bottom:t.bottom===!1?n.height:i.bottom+(t.bottom===!0?0:t.bottom)}}class oE{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,i,s){const r=t.listeners[s],o=t.duration;r.forEach(a=>a({chart:e,initial:t.initial,numSteps:o,currentStep:Math.min(i-t.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=Mm.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const r=i.items;let o=r.length-1,a=!1,l;for(;o>=0;--o)l=r[o],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(e),a=!0):(r[o]=r[r.length-1],r.pop());a&&(s.draw(),this._notify(s,i,e,"progress")),r.length||(i.running=!1,this._notify(s,i,e,"complete"),i.initial=!1),t+=r.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){const t=this._charts;let i=t.get(e);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,i)),i}listen(e,t,i){this._getAnims(e).listeners[t].push(i)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){const t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(e){if(!this._running)return!1;const t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){const t=this._charts.get(e);if(!t||!t.items.length)return;const i=t.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var Ut=new oE;const eu="transparent",aE={boolean(n,e,t){return t>.5?e:n},color(n,e,t){const i=Hd(n||eu),s=i.valid&&Hd(e||eu);return s&&s.valid?s.mix(i,t).hexString():e},number(n,e,t){return n+(e-n)*t}};class lE{constructor(e,t,i,s){const r=t[i];s=sr([e.to,s,r,e.from]);const o=sr([e.from,r,s]);this._active=!0,this._fn=e.fn||aE[e.type||typeof o],this._easing=ms[e.easing]||ms.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(e,t,i){if(this._active){this._notify(!1);const s=this._target[this._prop],r=i-this._start,o=this._duration-r;this._start=i,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=r,this._loop=!!e.loop,this._to=sr([e.to,t,s,e.from]),this._from=sr([e.from,s,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const t=e-this._start,i=this._duration,s=this._prop,r=this._from,o=this._loop,a=this._to;let l;if(this._active=r!==a&&(o||t<i),!this._active){this._target[s]=a,this._notify(!0);return}if(t<0){this._target[s]=r;return}l=t/i%2,l=o&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(r,a,l)}wait(){const e=this._promises||(this._promises=[]);return new Promise((t,i)=>{e.push({res:t,rej:i})})}_notify(e){const t=e?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][t]()}}class $m{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!X(e))return;const t=Object.keys(ge.animation),i=this._properties;Object.getOwnPropertyNames(e).forEach(s=>{const r=e[s];if(!X(r))return;const o={};for(const a of t)o[a]=r[a];(_e(r.properties)&&r.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,o)})})}_animateOptions(e,t){const i=t.options,s=dE(e,i);if(!s)return[];const r=this._createAnimations(s,i);return i.$shared&&cE(e.options.$animations,i).then(()=>{e.options=i},()=>{}),r}_createAnimations(e,t){const i=this._properties,s=[],r=e.$animations||(e.$animations={}),o=Object.keys(t),a=Date.now();let l;for(l=o.length-1;l>=0;--l){const c=o[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(e,t));continue}const d=t[c];let u=r[c];const h=i.get(c);if(u)if(h&&u.active()){u.update(h,d,a);continue}else u.cancel();if(!h||!h.duration){e[c]=d;continue}r[c]=u=new lE(h,e,c,d),s.push(u)}return s}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}const i=this._createAnimations(e,t);if(i.length)return Ut.add(this._chart,i),!0}}function cE(n,e){const t=[],i=Object.keys(e);for(let s=0;s<i.length;s++){const r=n[i[s]];r&&r.active()&&t.push(r.wait())}return Promise.all(t)}function dE(n,e){if(!e)return;let t=n.options;if(!t){n.options=e;return}return t.$shared&&(n.options=t=Object.assign({},t,{$shared:!1,$animations:{}})),t}function tu(n,e){const t=n&&n.options||{},i=t.reverse,s=t.min===void 0?e:0,r=t.max===void 0?e:0;return{start:i?r:s,end:i?s:r}}function uE(n,e,t){if(t===!1)return!1;const i=tu(n,t),s=tu(e,t);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function hE(n){let e,t,i,s;return X(n)?(e=n.top,t=n.right,i=n.bottom,s=n.left):e=t=i=s=n,{top:e,right:t,bottom:i,left:s,disabled:n===!1}}function Hm(n,e){const t=[],i=n._getSortedDatasetMetas(e);let s,r;for(s=0,r=i.length;s<r;++s)t.push(i[s].index);return t}function nu(n,e,t,i={}){const s=n.keys,r=i.mode==="single";let o,a,l,c;if(e===null)return;let d=!1;for(o=0,a=s.length;o<a;++o){if(l=+s[o],l===t){if(d=!0,i.all)continue;break}c=n.values[l],Le(c)&&(r||e===0||Ii(e)===Ii(c))&&(e+=c)}return!d&&!i.all?0:e}function fE(n,e){const{iScale:t,vScale:i}=e,s=t.axis==="x"?"x":"y",r=i.axis==="x"?"x":"y",o=Object.keys(n),a=new Array(o.length);let l,c,d;for(l=0,c=o.length;l<c;++l)d=o[l],a[l]={[s]:d,[r]:n[d]};return a}function Zo(n,e){const t=n&&n.options.stacked;return t||t===void 0&&e.stack!==void 0}function pE(n,e,t){return`${n.id}.${e.id}.${t.stack||t.type}`}function mE(n){const{min:e,max:t,minDefined:i,maxDefined:s}=n.getUserBounds();return{min:i?e:Number.NEGATIVE_INFINITY,max:s?t:Number.POSITIVE_INFINITY}}function gE(n,e,t){const i=n[e]||(n[e]={});return i[t]||(i[t]={})}function iu(n,e,t,i){for(const s of e.getMatchingVisibleMetas(i).reverse()){const r=n[s.index];if(t&&r>0||!t&&r<0)return s.index}return null}function su(n,e){const{chart:t,_cachedMeta:i}=n,s=t._stacks||(t._stacks={}),{iScale:r,vScale:o,index:a}=i,l=r.axis,c=o.axis,d=pE(r,o,i),u=e.length;let h;for(let f=0;f<u;++f){const p=e[f],{[l]:m,[c]:g}=p,y=p._stacks||(p._stacks={});h=y[c]=gE(s,d,m),h[a]=g,h._top=iu(h,o,!0,i.type),h._bottom=iu(h,o,!1,i.type);const S=h._visualValues||(h._visualValues={});S[a]=g}}function ea(n,e){const t=n.scales;return Object.keys(t).filter(i=>t[i].axis===e).shift()}function bE(n,e){return li(n,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function yE(n,e,t){return li(n,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:t,index:e,mode:"default",type:"data"})}function Ui(n,e){const t=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){e=e||n._parsed;for(const s of e){const r=s._stacks;if(!r||r[i]===void 0||r[i][t]===void 0)return;delete r[i][t],r[i]._visualValues!==void 0&&r[i]._visualValues[t]!==void 0&&delete r[i]._visualValues[t]}}}const ta=n=>n==="reset"||n==="none",ru=(n,e)=>e?n:Object.assign({},n),xE=(n,e,t)=>n&&!e.hidden&&e._stacked&&{keys:Hm(t,!0),values:null};class _E{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=Zo(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&Ui(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,t=this._cachedMeta,i=this.getDataset(),s=(u,h,f,p)=>u==="x"?h:u==="r"?p:f,r=t.xAxisID=J(i.xAxisID,ea(e,"x")),o=t.yAxisID=J(i.yAxisID,ea(e,"y")),a=t.rAxisID=J(i.rAxisID,ea(e,"r")),l=t.indexAxis,c=t.iAxisID=s(l,r,o,a),d=t.vAxisID=s(l,o,r,a);t.xScale=this.getScaleForId(r),t.yScale=this.getScaleForId(o),t.rScale=this.getScaleForId(a),t.iScale=this.getScaleForId(c),t.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&Fd(this._data,this),e._stacked&&Ui(e)}_dataCheck(){const e=this.getDataset(),t=e.data||(e.data=[]),i=this._data;if(X(t)){const s=this._cachedMeta;this._data=fE(t,s)}else if(i!==t){if(i){Fd(i,this);const s=this._cachedMeta;Ui(s),s._parsed=[]}t&&Object.isExtensible(t)&&nN(t,this),this._syncList=[],this._data=t}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const t=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const r=t._stacked;t._stacked=Zo(t.vScale,t),t.stack!==i.stack&&(s=!0,Ui(t),t.stack=i.stack),this._resyncElements(e),(s||r!==t._stacked)&&(su(this,t._parsed),t._stacked=Zo(t.vScale,t))}configure(){const e=this.chart.config,t=e.datasetScopeKeys(this._type),i=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){const{_cachedMeta:i,_data:s}=this,{iScale:r,_stacked:o}=i,a=r.axis;let l=e===0&&t===s.length?!0:i._sorted,c=e>0&&i._parsed[e-1],d,u,h;if(this._parsing===!1)i._parsed=s,i._sorted=!0,h=s;else{_e(s[e])?h=this.parseArrayData(i,s,e,t):X(s[e])?h=this.parseObjectData(i,s,e,t):h=this.parsePrimitiveData(i,s,e,t);const f=()=>u[a]===null||c&&u[a]<c[a];for(d=0;d<t;++d)i._parsed[d+e]=u=h[d],l&&(f()&&(l=!1),c=u);i._sorted=l}o&&su(this,h)}parsePrimitiveData(e,t,i,s){const{iScale:r,vScale:o}=e,a=r.axis,l=o.axis,c=r.getLabels(),d=r===o,u=new Array(s);let h,f,p;for(h=0,f=s;h<f;++h)p=h+i,u[h]={[a]:d||r.parse(c[p],p),[l]:o.parse(t[p],p)};return u}parseArrayData(e,t,i,s){const{xScale:r,yScale:o}=e,a=new Array(s);let l,c,d,u;for(l=0,c=s;l<c;++l)d=l+i,u=t[d],a[l]={x:r.parse(u[0],d),y:o.parse(u[1],d)};return a}parseObjectData(e,t,i,s){const{xScale:r,yScale:o}=e,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let d,u,h,f;for(d=0,u=s;d<u;++d)h=d+i,f=t[h],c[d]={x:r.parse(zr(f,a),h),y:o.parse(zr(f,l),h)};return c}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,t,i){const s=this.chart,r=this._cachedMeta,o=t[e.axis],a={keys:Hm(s,!0),values:t._stacks[e.axis]._visualValues};return nu(a,o,r.index,{mode:i})}updateRangeFromParsed(e,t,i,s){const r=i[t.axis];let o=r===null?NaN:r;const a=s&&i._stacks[t.axis];s&&a&&(s.values=a,o=nu(s,r,this._cachedMeta.index)),e.min=Math.min(e.min,o),e.max=Math.max(e.max,o)}getMinMax(e,t){const i=this._cachedMeta,s=i._parsed,r=i._sorted&&e===i.iScale,o=s.length,a=this._getOtherScale(e),l=xE(t,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:u}=mE(a);let h,f;function p(){f=s[h];const m=f[a.axis];return!Le(f[e.axis])||d>m||u<m}for(h=0;h<o&&!(!p()&&(this.updateRangeFromParsed(c,e,f,l),r));++h);if(r){for(h=o-1;h>=0;--h)if(!p()){this.updateRangeFromParsed(c,e,f,l);break}}return c}getAllParsedValues(e){const t=this._cachedMeta._parsed,i=[];let s,r,o;for(s=0,r=t.length;s<r;++s)o=t[s][e.axis],Le(o)&&i.push(o);return i}getMaxOverflow(){return!1}getLabelAndValue(e){const t=this._cachedMeta,i=t.iScale,s=t.vScale,r=this.getParsed(e);return{label:i?""+i.getLabelForValue(r[i.axis]):"",value:s?""+s.getLabelForValue(r[s.axis]):""}}_update(e){const t=this._cachedMeta;this.update(e||"default"),t._clip=hE(J(this.options.clip,uE(t.xScale,t.yScale,this.getMaxOverflow())))}update(e){}draw(){const e=this._ctx,t=this.chart,i=this._cachedMeta,s=i.data||[],r=t.chartArea,o=[],a=this._drawStart||0,l=this._drawCount||s.length-a,c=this.options.drawActiveElementsOnTop;let d;for(i.dataset&&i.dataset.draw(e,r,a,l),d=a;d<a+l;++d){const u=s[d];u.hidden||(u.active&&c?o.push(u):u.draw(e,r))}for(d=0;d<o.length;++d)o[d].draw(e,r)}getStyle(e,t){const i=t?"active":"default";return e===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(e||0,i)}getContext(e,t,i){const s=this.getDataset();let r;if(e>=0&&e<this._cachedMeta.data.length){const o=this._cachedMeta.data[e];r=o.$context||(o.$context=yE(this.getContext(),e,o)),r.parsed=this.getParsed(e),r.raw=s.data[e],r.index=r.dataIndex=e}else r=this.$context||(this.$context=bE(this.chart.getContext(),this.index)),r.dataset=s,r.index=r.datasetIndex=this.index;return r.active=!!t,r.mode=i,r}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,t){return this._resolveElementOptions(this.dataElementType.id,t,e)}_resolveElementOptions(e,t="default",i){const s=t==="active",r=this._cachedDataOpts,o=e+"-"+t,a=r[o],l=this.enableOptionSharing&&jr(i);if(a)return ru(a,l);const c=this.chart.config,d=c.datasetElementScopeKeys(this._type,e),u=s?[`${e}Hover`,"hover",e,""]:[e,""],h=c.getOptionScopes(this.getDataset(),d),f=Object.keys(ge.elements[e]),p=()=>this.getContext(i,s,t),m=c.resolveNamedOptions(h,f,p,u);return m.$shared&&(m.$shared=l,r[o]=Object.freeze(ru(m,l))),m}_resolveAnimations(e,t,i){const s=this.chart,r=this._cachedDataOpts,o=`animation-${t}`,a=r[o];if(a)return a;let l;if(s.options.animation!==!1){const d=this.chart.config,u=d.datasetAnimationScopeKeys(this._type,t),h=d.getOptionScopes(this.getDataset(),u);l=d.createResolver(h,this.getContext(e,i,t))}const c=new $m(s,l&&l.animations);return l&&l._cacheable&&(r[o]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||ta(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){const i=this.resolveDataElementOptions(e,t),s=this._sharedOptions,r=this.getSharedOptions(i),o=this.includeOptions(t,r)||r!==s;return this.updateSharedOptions(r,t,i),{sharedOptions:r,includeOptions:o}}updateElement(e,t,i,s){ta(s)?Object.assign(e,i):this._resolveAnimations(t,s).update(e,i)}updateSharedOptions(e,t,i){e&&!ta(t)&&this._resolveAnimations(void 0,t).update(e,i)}_setStyle(e,t,i,s){e.active=s;const r=this.getStyle(t,s);this._resolveAnimations(t,i,s).update(e,{options:!s&&this.getSharedOptions(r)||r})}removeHoverStyle(e,t,i){this._setStyle(e,i,"active",!1)}setHoverStyle(e,t,i){this._setStyle(e,i,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const t=this._data,i=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=i.length,r=t.length,o=Math.min(r,s);o&&this.parse(0,o),r>s?this._insertElements(s,r-s,e):r<s&&this._removeElements(r,s-r)}_insertElements(e,t,i=!0){const s=this._cachedMeta,r=s.data,o=e+t;let a;const l=c=>{for(c.length+=t,a=c.length-1;a>=o;a--)c[a]=c[a-t]};for(l(r),a=e;a<o;++a)r[a]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(e,t),i&&this.updateElements(r,e,t,"reset")}updateElements(e,t,i,s){}_removeElements(e,t){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(e,t);i._stacked&&Ui(i,s)}i.data.splice(e,t)}_sync(e){if(this._parsing)this._syncList.push(e);else{const[t,i,s]=e;this[t](i,s)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){const e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,t){t&&this._sync(["_removeElements",e,t]);const i=arguments.length-2;i&&this._sync(["_insertElements",e,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function jn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class jl{static override(e){Object.assign(jl.prototype,e)}options;constructor(e){this.options=e||{}}init(){}formats(){return jn()}parse(){return jn()}format(){return jn()}add(){return jn()}diff(){return jn()}startOf(){return jn()}endOf(){return jn()}}var kE={_date:jl};function wE(n,e,t,i){const{controller:s,data:r,_sorted:o}=n,a=s._cachedMeta.iScale,l=n.dataset&&n.dataset.options?n.dataset.options.spanGaps:null;if(a&&e===a.axis&&e!=="r"&&o&&r.length){const c=a._reversePixels?eN:Ra;if(i){if(s._sharedOptions){const d=r[0],u=typeof d.getRange=="function"&&d.getRange(e);if(u){const h=c(r,e,t-u),f=c(r,e,t+u);return{lo:h.lo,hi:f.hi}}}}else{const d=c(r,e,t);if(l){const{vScale:u}=s._cachedMeta,{_parsed:h}=n,f=h.slice(0,d.lo+1).reverse().findIndex(m=>!pe(m[u.axis]));d.lo-=Math.max(0,f);const p=h.slice(d.hi).findIndex(m=>!pe(m[u.axis]));d.hi+=Math.max(0,p)}return d}}return{lo:0,hi:r.length-1}}function uo(n,e,t,i,s){const r=n.getSortedVisibleDatasetMetas(),o=t[e];for(let a=0,l=r.length;a<l;++a){const{index:c,data:d}=r[a],{lo:u,hi:h}=wE(r[a],e,o,s);for(let f=u;f<=h;++f){const p=d[f];p.skip||i(p,c,f)}}}function vE(n){const e=n.indexOf("x")!==-1,t=n.indexOf("y")!==-1;return function(i,s){const r=e?Math.abs(i.x-s.x):0,o=t?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(r,2)+Math.pow(o,2))}}function na(n,e,t,i,s){const r=[];return!s&&!n.isPointInArea(e)||uo(n,t,e,function(a,l,c){!s&&!As(a,n.chartArea,0)||a.inRange(e.x,e.y,i)&&r.push({element:a,datasetIndex:l,index:c})},!0),r}function SE(n,e,t,i){let s=[];function r(o,a,l){const{startAngle:c,endAngle:d}=o.getProps(["startAngle","endAngle"],i),{angle:u}=vm(o,{x:e.x,y:e.y});Ol(u,c,d)&&s.push({element:o,datasetIndex:a,index:l})}return uo(n,t,e,r),s}function ME(n,e,t,i,s,r){let o=[];const a=vE(t);let l=Number.POSITIVE_INFINITY;function c(d,u,h){const f=d.inRange(e.x,e.y,s);if(i&&!f)return;const p=d.getCenterPoint(s);if(!(!!r||n.isPointInArea(p))&&!f)return;const g=a(e,p);g<l?(o=[{element:d,datasetIndex:u,index:h}],l=g):g===l&&o.push({element:d,datasetIndex:u,index:h})}return uo(n,t,e,c),o}function ia(n,e,t,i,s,r){return!r&&!n.isPointInArea(e)?[]:t==="r"&&!i?SE(n,e,t,s):ME(n,e,t,i,s,r)}function ou(n,e,t,i,s){const r=[],o=t==="x"?"inXRange":"inYRange";let a=!1;return uo(n,t,e,(l,c,d)=>{l[o]&&l[o](e[t],s)&&(r.push({element:l,datasetIndex:c,index:d}),a=a||l.inRange(e.x,e.y,s))}),i&&!a?[]:r}var CE={modes:{index(n,e,t,i){const s=Fn(e,n),r=t.axis||"x",o=t.includeInvisible||!1,a=t.intersect?na(n,s,r,i,o):ia(n,s,r,!1,i,o),l=[];return a.length?(n.getSortedVisibleDatasetMetas().forEach(c=>{const d=a[0].index,u=c.data[d];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:d})}),l):[]},dataset(n,e,t,i){const s=Fn(e,n),r=t.axis||"xy",o=t.includeInvisible||!1;let a=t.intersect?na(n,s,r,i,o):ia(n,s,r,!1,i,o);if(a.length>0){const l=a[0].datasetIndex,c=n.getDatasetMeta(l).data;a=[];for(let d=0;d<c.length;++d)a.push({element:c[d],datasetIndex:l,index:d})}return a},point(n,e,t,i){const s=Fn(e,n),r=t.axis||"xy",o=t.includeInvisible||!1;return na(n,s,r,i,o)},nearest(n,e,t,i){const s=Fn(e,n),r=t.axis||"xy",o=t.includeInvisible||!1;return ia(n,s,r,t.intersect,i,o)},x(n,e,t,i){const s=Fn(e,n);return ou(n,s,"x",t.intersect,i)},y(n,e,t,i){const s=Fn(e,n);return ou(n,s,"y",t.intersect,i)}}};const Vm=["left","top","right","bottom"];function Ji(n,e){return n.filter(t=>t.pos===e)}function au(n,e){return n.filter(t=>Vm.indexOf(t.pos)===-1&&t.box.axis===e)}function Gi(n,e){return n.sort((t,i)=>{const s=e?i:t,r=e?t:i;return s.weight===r.weight?s.index-r.index:s.weight-r.weight})}function OE(n){const e=[];let t,i,s,r,o,a;for(t=0,i=(n||[]).length;t<i;++t)s=n[t],{position:r,options:{stack:o,stackWeight:a=1}}=s,e.push({index:t,box:s,pos:r,horizontal:s.isHorizontal(),weight:s.weight,stack:o&&r+o,stackWeight:a});return e}function DE(n){const e={};for(const t of n){const{stack:i,pos:s,stackWeight:r}=t;if(!i||!Vm.includes(s))continue;const o=e[i]||(e[i]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=r}return e}function TE(n,e){const t=DE(n),{vBoxMaxWidth:i,hBoxMaxHeight:s}=e;let r,o,a;for(r=0,o=n.length;r<o;++r){a=n[r];const{fullSize:l}=a.box,c=t[a.stack],d=c&&a.stackWeight/c.weight;a.horizontal?(a.width=d?d*i:l&&e.availableWidth,a.height=s):(a.width=i,a.height=d?d*s:l&&e.availableHeight)}return t}function NE(n){const e=OE(n),t=Gi(e.filter(c=>c.box.fullSize),!0),i=Gi(Ji(e,"left"),!0),s=Gi(Ji(e,"right")),r=Gi(Ji(e,"top"),!0),o=Gi(Ji(e,"bottom")),a=au(e,"x"),l=au(e,"y");return{fullSize:t,leftAndTop:i.concat(r),rightAndBottom:s.concat(l).concat(o).concat(a),chartArea:Ji(e,"chartArea"),vertical:i.concat(s).concat(l),horizontal:r.concat(o).concat(a)}}function lu(n,e,t,i){return Math.max(n[t],e[t])+Math.max(n[i],e[i])}function Ym(n,e){n.top=Math.max(n.top,e.top),n.left=Math.max(n.left,e.left),n.bottom=Math.max(n.bottom,e.bottom),n.right=Math.max(n.right,e.right)}function EE(n,e,t,i){const{pos:s,box:r}=t,o=n.maxPadding;if(!X(s)){t.size&&(n[s]-=t.size);const u=i[t.stack]||{size:0,count:1};u.size=Math.max(u.size,t.horizontal?r.height:r.width),t.size=u.size/u.count,n[s]+=t.size}r.getPadding&&Ym(o,r.getPadding());const a=Math.max(0,e.outerWidth-lu(o,n,"left","right")),l=Math.max(0,e.outerHeight-lu(o,n,"top","bottom")),c=a!==n.w,d=l!==n.h;return n.w=a,n.h=l,t.horizontal?{same:c,other:d}:{same:d,other:c}}function AE(n){const e=n.maxPadding;function t(i){const s=Math.max(e[i]-n[i],0);return n[i]+=s,s}n.y+=t("top"),n.x+=t("left"),t("right"),t("bottom")}function PE(n,e){const t=e.maxPadding;function i(s){const r={left:0,top:0,right:0,bottom:0};return s.forEach(o=>{r[o]=Math.max(e[o],t[o])}),r}return i(n?["left","right"]:["top","bottom"])}function as(n,e,t,i){const s=[];let r,o,a,l,c,d;for(r=0,o=n.length,c=0;r<o;++r){a=n[r],l=a.box,l.update(a.width||e.w,a.height||e.h,PE(a.horizontal,e));const{same:u,other:h}=EE(e,t,a,i);c|=u&&s.length,d=d||h,l.fullSize||s.push(a)}return c&&as(s,e,t,i)||d}function ar(n,e,t,i,s){n.top=t,n.left=e,n.right=e+i,n.bottom=t+s,n.width=i,n.height=s}function cu(n,e,t,i){const s=t.padding;let{x:r,y:o}=e;for(const a of n){const l=a.box,c=i[a.stack]||{placed:0,weight:1},d=a.stackWeight/c.weight||1;if(a.horizontal){const u=e.w*d,h=c.size||l.height;jr(c.start)&&(o=c.start),l.fullSize?ar(l,s.left,o,t.outerWidth-s.right-s.left,h):ar(l,e.left+c.placed,o,u,h),c.start=o,c.placed+=u,o=l.bottom}else{const u=e.h*d,h=c.size||l.width;jr(c.start)&&(r=c.start),l.fullSize?ar(l,r,s.top,h,t.outerHeight-s.bottom-s.top):ar(l,r,e.top+c.placed,h,u),c.start=r,c.placed+=u,r=l.right}}e.x=r,e.y=o}var yt={addBox(n,e){n.boxes||(n.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},n.boxes.push(e)},removeBox(n,e){const t=n.boxes?n.boxes.indexOf(e):-1;t!==-1&&n.boxes.splice(t,1)},configure(n,e,t){e.fullSize=t.fullSize,e.position=t.position,e.weight=t.weight},update(n,e,t,i){if(!n)return;const s=kt(n.options.layout.padding),r=Math.max(e-s.width,0),o=Math.max(t-s.height,0),a=NE(n.boxes),l=a.vertical,c=a.horizontal;re(n.boxes,m=>{typeof m.beforeLayout=="function"&&m.beforeLayout()});const d=l.reduce((m,g)=>g.box.options&&g.box.options.display===!1?m:m+1,0)||1,u=Object.freeze({outerWidth:e,outerHeight:t,padding:s,availableWidth:r,availableHeight:o,vBoxMaxWidth:r/2/d,hBoxMaxHeight:o/2}),h=Object.assign({},s);Ym(h,kt(i));const f=Object.assign({maxPadding:h,w:r,h:o,x:s.left,y:s.top},s),p=TE(l.concat(c),u);as(a.fullSize,f,u,p),as(l,f,u,p),as(c,f,u,p)&&as(l,f,u,p),AE(f),cu(a.leftAndTop,f,u,p),f.x+=f.w,f.y+=f.h,cu(a.rightAndBottom,f,u,p),n.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},re(a.chartArea,m=>{const g=m.box;Object.assign(g,n.chartArea),g.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class qm{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,i){}removeEventListener(e,t,i){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,i,s){return t=Math.max(0,t||e.width),i=i||e.height,{width:t,height:Math.max(0,s?Math.floor(t/s):i)}}isAttached(e){return!0}updateConfig(e){}}class IE extends qm{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const br="$chartjs",RE={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},du=n=>n===null||n==="";function zE(n,e){const t=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[br]={initial:{height:i,width:s,style:{display:t.display,height:t.height,width:t.width}}},t.display=t.display||"block",t.boxSizing=t.boxSizing||"border-box",du(s)){const r=Gd(n,"width");r!==void 0&&(n.width=r)}if(du(i))if(n.style.height==="")n.height=n.width/(e||2);else{const r=Gd(n,"height");r!==void 0&&(n.height=r)}return n}const Km=UN?{passive:!0}:!1;function jE(n,e,t){n&&n.addEventListener(e,t,Km)}function BE(n,e,t){n&&n.canvas&&n.canvas.removeEventListener(e,t,Km)}function LE(n,e){const t=RE[n.type]||n.type,{x:i,y:s}=Fn(n,e);return{type:t,chart:e,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function $r(n,e){for(const t of n)if(t===e||t.contains(e))return!0}function FE(n,e,t){const i=n.canvas,s=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||$r(a.addedNodes,i),o=o&&!$r(a.removedNodes,i);o&&t()});return s.observe(document,{childList:!0,subtree:!0}),s}function WE(n,e,t){const i=n.canvas,s=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||$r(a.removedNodes,i),o=o&&!$r(a.addedNodes,i);o&&t()});return s.observe(document,{childList:!0,subtree:!0}),s}const Is=new Map;let uu=0;function Um(){const n=window.devicePixelRatio;n!==uu&&(uu=n,Is.forEach((e,t)=>{t.currentDevicePixelRatio!==n&&e()}))}function $E(n,e){Is.size||window.addEventListener("resize",Um),Is.set(n,e)}function HE(n){Is.delete(n),Is.size||window.removeEventListener("resize",Um)}function VE(n,e,t){const i=n.canvas,s=i&&zl(i);if(!s)return;const r=Cm((a,l)=>{const c=s.clientWidth;t(a,l),c<s.clientWidth&&t()},window),o=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,d=l.contentRect.height;c===0&&d===0||r(c,d)});return o.observe(s),$E(n,r),o}function sa(n,e,t){t&&t.disconnect(),e==="resize"&&HE(n)}function YE(n,e,t){const i=n.canvas,s=Cm(r=>{n.ctx!==null&&t(LE(r,n))},n);return jE(i,e,s),s}class qE extends qm{acquireContext(e,t){const i=e&&e.getContext&&e.getContext("2d");return i&&i.canvas===e?(zE(e,t),i):null}releaseContext(e){const t=e.canvas;if(!t[br])return!1;const i=t[br].initial;["height","width"].forEach(r=>{const o=i[r];pe(o)?t.removeAttribute(r):t.setAttribute(r,o)});const s=i.style||{};return Object.keys(s).forEach(r=>{t.style[r]=s[r]}),t.width=t.width,delete t[br],!0}addEventListener(e,t,i){this.removeEventListener(e,t);const s=e.$proxies||(e.$proxies={}),o={attach:FE,detach:WE,resize:VE}[t]||YE;s[t]=o(e,t,i)}removeEventListener(e,t){const i=e.$proxies||(e.$proxies={}),s=i[t];if(!s)return;({attach:sa,detach:sa,resize:sa}[t]||BE)(e,t,s),i[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,i,s){return KN(e,t,i,s)}isAttached(e){const t=e&&zl(e);return!!(t&&t.isConnected)}}function KE(n){return!Rl()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?IE:qE}class an{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(e){const{x:t,y:i}=this.getProps(["x","y"],e);return{x:t,y:i}}hasValue(){return Lr(this.x)&&Lr(this.y)}getProps(e,t){const i=this.$animations;if(!t||!i)return this;const s={};return e.forEach(r=>{s[r]=i[r]&&i[r].active()?i[r]._to:this[r]}),s}}function UE(n,e){const t=n.options.ticks,i=JE(n),s=Math.min(t.maxTicksLimit||i,i),r=t.major.enabled?XE(e):[],o=r.length,a=r[0],l=r[o-1],c=[];if(o>s)return QE(e,c,r,o/s),c;const d=GE(r,e,s);if(o>0){let u,h;const f=o>1?Math.round((l-a)/(o-1)):null;for(lr(e,c,d,pe(f)?0:a-f,a),u=0,h=o-1;u<h;u++)lr(e,c,d,r[u],r[u+1]);return lr(e,c,d,l,pe(f)?e.length:l+f),c}return lr(e,c,d),c}function JE(n){const e=n.options.offset,t=n._tickSize(),i=n._length/t+(e?0:1),s=n._maxLength/t;return Math.floor(Math.min(i,s))}function GE(n,e,t){const i=ZE(n),s=e.length/t;if(!i)return Math.max(s,1);const r=KT(i);for(let o=0,a=r.length-1;o<a;o++){const l=r[o];if(l>s)return l}return Math.max(s,1)}function XE(n){const e=[];let t,i;for(t=0,i=n.length;t<i;t++)n[t].major&&e.push(t);return e}function QE(n,e,t,i){let s=0,r=t[0],o;for(i=Math.ceil(i),o=0;o<n.length;o++)o===r&&(e.push(n[o]),s++,r=t[s*i])}function lr(n,e,t,i,s){const r=J(i,0),o=Math.min(J(s,n.length),n.length);let a=0,l,c,d;for(t=Math.ceil(t),s&&(l=s-i,t=l/Math.floor(l/t)),d=r;d<0;)a++,d=Math.round(r+a*t);for(c=Math.max(r,0);c<o;c++)c===d&&(e.push(n[c]),a++,d=Math.round(r+a*t))}function ZE(n){const e=n.length;let t,i;if(e<2)return!1;for(i=n[0],t=1;t<e;++t)if(n[t]-n[t-1]!==i)return!1;return i}const eA=n=>n==="left"?"right":n==="right"?"left":n,hu=(n,e,t)=>e==="top"||e==="left"?n[e]+t:n[e]-t,fu=(n,e)=>Math.min(e||n,n);function pu(n,e){const t=[],i=n.length/e,s=n.length;let r=0;for(;r<s;r+=i)t.push(n[Math.floor(r)]);return t}function tA(n,e,t){const i=n.ticks.length,s=Math.min(e,i-1),r=n._startPixel,o=n._endPixel,a=1e-6;let l=n.getPixelForTick(s),c;if(!(t&&(i===1?c=Math.max(l-r,o-l):e===0?c=(n.getPixelForTick(1)-l)/2:c=(l-n.getPixelForTick(s-1))/2,l+=s<e?c:-c,l<r-a||l>o+a)))return l}function nA(n,e){re(n,t=>{const i=t.gc,s=i.length/2;let r;if(s>e){for(r=0;r<s;++r)delete t.data[i[r]];i.splice(0,s)}})}function Xi(n){return n.drawTicks?n.tickLength:0}function mu(n,e){if(!n.display)return 0;const t=je(n.font,e),i=kt(n.padding);return(_e(n.text)?n.text.length:1)*t.lineHeight+i.height}function iA(n,e){return li(n,{scale:e,type:"scale"})}function sA(n,e,t){return li(n,{tick:t,index:e,type:"tick"})}function rA(n,e,t){let i=Tl(n);return(t&&e!=="right"||!t&&e==="right")&&(i=eA(i)),i}function oA(n,e,t,i){const{top:s,left:r,bottom:o,right:a,chart:l}=n,{chartArea:c,scales:d}=l;let u=0,h,f,p;const m=o-s,g=a-r;if(n.isHorizontal()){if(f=Ie(i,r,a),X(t)){const y=Object.keys(t)[0],S=t[y];p=d[y].getPixelForValue(S)+m-e}else t==="center"?p=(c.bottom+c.top)/2+m-e:p=hu(n,t,e);h=a-r}else{if(X(t)){const y=Object.keys(t)[0],S=t[y];f=d[y].getPixelForValue(S)-g+e}else t==="center"?f=(c.left+c.right)/2-g+e:f=hu(n,t,e);p=Ie(i,o,s),u=t==="left"?-Pe:Pe}return{titleX:f,titleY:p,maxWidth:h,rotation:u}}class Li extends an{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,t){return e}getUserBounds(){let{_userMin:e,_userMax:t,_suggestedMin:i,_suggestedMax:s}=this;return e=Pt(e,Number.POSITIVE_INFINITY),t=Pt(t,Number.NEGATIVE_INFINITY),i=Pt(i,Number.POSITIVE_INFINITY),s=Pt(s,Number.NEGATIVE_INFINITY),{min:Pt(e,i),max:Pt(t,s),minDefined:Le(e),maxDefined:Le(t)}}getMinMax(e){let{min:t,max:i,minDefined:s,maxDefined:r}=this.getUserBounds(),o;if(s&&r)return{min:t,max:i};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)o=a[l].controller.getMinMax(this,e),s||(t=Math.min(t,o.min)),r||(i=Math.max(i,o.max));return t=r&&t>i?i:t,i=s&&t>i?t:i,{min:Pt(t,Pt(i,t)),max:Pt(i,Pt(t,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ue(this.options.beforeUpdate,[this])}update(e,t,i){const{beginAtZero:s,grace:r,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=MN(this,r,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?pu(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||o.source==="auto")&&(this.ticks=UE(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,t,i;this.isHorizontal()?(t=this.left,i=this.right):(t=this.top,i=this.bottom,e=!e),this._startPixel=t,this._endPixel=i,this._reversePixels=e,this._length=i-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ue(this.options.afterUpdate,[this])}beforeSetDimensions(){ue(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){ue(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),ue(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ue(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const t=this.options.ticks;let i,s,r;for(i=0,s=e.length;i<s;i++)r=e[i],r.label=ue(t.callback,[r.value,i,e],this)}afterTickToLabelConversion(){ue(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ue(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,t=e.ticks,i=fu(this.ticks.length,e.ticks.maxTicksLimit),s=t.minRotation||0,r=t.maxRotation;let o=s,a,l,c;if(!this._isVisible()||!t.display||s>=r||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const d=this._getLabelSizes(),u=d.widest.width,h=d.highest.height,f=Ge(this.chart.width-u,0,this.maxWidth);a=e.offset?this.maxWidth/i:f/(i-1),u+6>a&&(a=f/(i-(e.offset?.5:1)),l=this.maxHeight-Xi(e.grid)-t.padding-mu(e.title,this.chart.options.font),c=Math.sqrt(u*u+h*h),o=XT(Math.min(Math.asin(Ge((d.highest.height+6)/a,-1,1)),Math.asin(Ge(l/c,-1,1))-Math.asin(Ge(h/c,-1,1)))),o=Math.max(s,Math.min(r,o))),this.labelRotation=o}afterCalculateLabelRotation(){ue(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ue(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:t,options:{ticks:i,title:s,grid:r}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const l=mu(s,t.options.font);if(a?(e.width=this.maxWidth,e.height=Xi(r)+l):(e.height=this.maxHeight,e.width=Xi(r)+l),i.display&&this.ticks.length){const{first:c,last:d,widest:u,highest:h}=this._getLabelSizes(),f=i.padding*2,p=Un(this.labelRotation),m=Math.cos(p),g=Math.sin(p);if(a){const y=i.mirror?0:g*u.width+m*h.height;e.height=Math.min(this.maxHeight,e.height+y+f)}else{const y=i.mirror?0:m*u.width+g*h.height;e.width=Math.min(this.maxWidth,e.width+y+f)}this._calculatePadding(c,d,g,m)}}this._handleMargins(),a?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,i,s){const{ticks:{align:r,padding:o},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const d=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,f=0;l?c?(h=s*e.width,f=i*t.height):(h=i*e.height,f=s*t.width):r==="start"?f=t.width:r==="end"?h=e.width:r!=="inner"&&(h=e.width/2,f=t.width/2),this.paddingLeft=Math.max((h-d+o)*this.width/(this.width-d),0),this.paddingRight=Math.max((f-u+o)*this.width/(this.width-u),0)}else{let d=t.height/2,u=e.height/2;r==="start"?(d=0,u=e.height):r==="end"&&(d=t.height,u=0),this.paddingTop=d+o,this.paddingBottom=u+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ue(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:t}=this.options;return t==="top"||t==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,i;for(t=0,i=e.length;t<i;t++)pe(e[t].label)&&(e.splice(t,1),i--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const t=this.options.ticks.sampleSize;let i=this.ticks;t<i.length&&(i=pu(i,t)),this._labelSizes=e=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,t,i){const{ctx:s,_longestTextCache:r}=this,o=[],a=[],l=Math.floor(t/fu(t,i));let c=0,d=0,u,h,f,p,m,g,y,S,_,k,v;for(u=0;u<t;u+=l){if(p=e[u].label,m=this._resolveTickFontOptions(u),s.font=g=m.string,y=r[g]=r[g]||{data:{},gc:[]},S=m.lineHeight,_=k=0,!pe(p)&&!_e(p))_=Yd(s,y.data,y.gc,_,p),k=S;else if(_e(p))for(h=0,f=p.length;h<f;++h)v=p[h],!pe(v)&&!_e(v)&&(_=Yd(s,y.data,y.gc,_,v),k+=S);o.push(_),a.push(k),c=Math.max(_,c),d=Math.max(k,d)}nA(r,t);const w=o.indexOf(c),M=a.indexOf(d),C=O=>({width:o[O]||0,height:a[O]||0});return{first:C(0),last:C(t-1),widest:C(w),highest:C(M),widths:o,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const t=this._startPixel+e*this._length;return ZT(this._alignToPixels?zn(this.chart,t,0):t)}getDecimalForPixel(e){const t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){const t=this.ticks||[];if(e>=0&&e<t.length){const i=t[e];return i.$context||(i.$context=sA(this.getContext(),e,i))}return this.$context||(this.$context=iA(this.chart.getContext(),this))}_tickSize(){const e=this.options.ticks,t=Un(this.labelRotation),i=Math.abs(Math.cos(t)),s=Math.abs(Math.sin(t)),r=this._getLabelSizes(),o=e.autoSkipPadding||0,a=r?r.widest.width+o:0,l=r?r.highest.height+o:0;return this.isHorizontal()?l*i>a*s?a/i:l/s:l*s<a*i?l/i:a/s}_isVisible(){const e=this.options.display;return e!=="auto"?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const t=this.axis,i=this.chart,s=this.options,{grid:r,position:o,border:a}=s,l=r.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),h=Xi(r),f=[],p=a.setContext(this.getContext()),m=p.display?p.width:0,g=m/2,y=function(K){return zn(i,K,m)};let S,_,k,v,w,M,C,O,D,A,P,F;if(o==="top")S=y(this.bottom),M=this.bottom-h,O=S-g,A=y(e.top)+g,F=e.bottom;else if(o==="bottom")S=y(this.top),A=e.top,F=y(e.bottom)-g,M=S+g,O=this.top+h;else if(o==="left")S=y(this.right),w=this.right-h,C=S-g,D=y(e.left)+g,P=e.right;else if(o==="right")S=y(this.left),D=e.left,P=y(e.right)-g,w=S+g,C=this.left+h;else if(t==="x"){if(o==="center")S=y((e.top+e.bottom)/2+.5);else if(X(o)){const K=Object.keys(o)[0],G=o[K];S=y(this.chart.scales[K].getPixelForValue(G))}A=e.top,F=e.bottom,M=S+g,O=M+h}else if(t==="y"){if(o==="center")S=y((e.left+e.right)/2);else if(X(o)){const K=Object.keys(o)[0],G=o[K];S=y(this.chart.scales[K].getPixelForValue(G))}w=S-g,C=w-h,D=e.left,P=e.right}const B=J(s.ticks.maxTicksLimit,u),H=Math.max(1,Math.ceil(u/B));for(_=0;_<u;_+=H){const K=this.getContext(_),G=r.setContext(K),R=a.setContext(K),E=G.lineWidth,V=G.color,ee=R.dash||[],ke=R.dashOffset,et=G.tickWidth,wt=G.tickColor,Nt=G.tickBorderDash||[],Et=G.tickBorderDashOffset;k=tA(this,_,l),k!==void 0&&(v=zn(i,k,E),c?w=C=D=P=v:M=O=A=F=v,f.push({tx1:w,ty1:M,tx2:C,ty2:O,x1:D,y1:A,x2:P,y2:F,width:E,color:V,borderDash:ee,borderDashOffset:ke,tickWidth:et,tickColor:wt,tickBorderDash:Nt,tickBorderDashOffset:Et}))}return this._ticksLength=u,this._borderValue=S,f}_computeLabelItems(e){const t=this.axis,i=this.options,{position:s,ticks:r}=i,o=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:d,mirror:u}=r,h=Xi(i.grid),f=h+d,p=u?-d:f,m=-Un(this.labelRotation),g=[];let y,S,_,k,v,w,M,C,O,D,A,P,F="middle";if(s==="top")w=this.bottom-p,M=this._getXAxisLabelAlignment();else if(s==="bottom")w=this.top+p,M=this._getXAxisLabelAlignment();else if(s==="left"){const H=this._getYAxisLabelAlignment(h);M=H.textAlign,v=H.x}else if(s==="right"){const H=this._getYAxisLabelAlignment(h);M=H.textAlign,v=H.x}else if(t==="x"){if(s==="center")w=(e.top+e.bottom)/2+f;else if(X(s)){const H=Object.keys(s)[0],K=s[H];w=this.chart.scales[H].getPixelForValue(K)+f}M=this._getXAxisLabelAlignment()}else if(t==="y"){if(s==="center")v=(e.left+e.right)/2-f;else if(X(s)){const H=Object.keys(s)[0],K=s[H];v=this.chart.scales[H].getPixelForValue(K)}M=this._getYAxisLabelAlignment(h).textAlign}t==="y"&&(l==="start"?F="top":l==="end"&&(F="bottom"));const B=this._getLabelSizes();for(y=0,S=a.length;y<S;++y){_=a[y],k=_.label;const H=r.setContext(this.getContext(y));C=this.getPixelForTick(y)+r.labelOffset,O=this._resolveTickFontOptions(y),D=O.lineHeight,A=_e(k)?k.length:1;const K=A/2,G=H.color,R=H.textStrokeColor,E=H.textStrokeWidth;let V=M;o?(v=C,M==="inner"&&(y===S-1?V=this.options.reverse?"left":"right":y===0?V=this.options.reverse?"right":"left":V="center"),s==="top"?c==="near"||m!==0?P=-A*D+D/2:c==="center"?P=-B.highest.height/2-K*D+D:P=-B.highest.height+D/2:c==="near"||m!==0?P=D/2:c==="center"?P=B.highest.height/2-K*D:P=B.highest.height-A*D,u&&(P*=-1),m!==0&&!H.showLabelBackdrop&&(v+=D/2*Math.sin(m))):(w=C,P=(1-A)*D/2);let ee;if(H.showLabelBackdrop){const ke=kt(H.backdropPadding),et=B.heights[y],wt=B.widths[y];let Nt=P-ke.top,Et=0-ke.left;switch(F){case"middle":Nt-=et/2;break;case"bottom":Nt-=et;break}switch(M){case"center":Et-=wt/2;break;case"right":Et-=wt;break;case"inner":y===S-1?Et-=wt:y>0&&(Et-=wt/2);break}ee={left:Et,top:Nt,width:wt+ke.width,height:et+ke.height,color:H.backdropColor}}g.push({label:k,font:O,textOffset:P,options:{rotation:m,color:G,strokeColor:R,strokeWidth:E,textAlign:V,textBaseline:F,translation:[v,w],backdrop:ee}})}return g}_getXAxisLabelAlignment(){const{position:e,ticks:t}=this.options;if(-Un(this.labelRotation))return e==="top"?"left":"right";let s="center";return t.align==="start"?s="left":t.align==="end"?s="right":t.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(e){const{position:t,ticks:{crossAlign:i,mirror:s,padding:r}}=this.options,o=this._getLabelSizes(),a=e+r,l=o.widest.width;let c,d;return t==="left"?s?(d=this.right+r,i==="near"?c="left":i==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-a,i==="near"?c="right":i==="center"?(c="center",d-=l/2):(c="left",d=this.left)):t==="right"?s?(d=this.left+r,i==="near"?c="right":i==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+a,i==="near"?c="left":i==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,t=this.options.position;if(t==="left"||t==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(t==="top"||t==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:t},left:i,top:s,width:r,height:o}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(i,s,r,o),e.restore())}getLineWidthForValue(e){const t=this.options.grid;if(!this._isVisible()||!t.display)return 0;const s=this.ticks.findIndex(r=>r.value===e);return s>=0?t.setContext(this.getContext(s)).lineWidth:0}drawGrid(e){const t=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let r,o;const a=(l,c,d)=>{!d.width||!d.color||(i.save(),i.lineWidth=d.width,i.strokeStyle=d.color,i.setLineDash(d.borderDash||[]),i.lineDashOffset=d.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(t.display)for(r=0,o=s.length;r<o;++r){const l=s[r];t.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),t.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:e,ctx:t,options:{border:i,grid:s}}=this,r=i.setContext(this.getContext()),o=i.display?r.width:0;if(!o)return;const a=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,d,u,h;this.isHorizontal()?(c=zn(e,this.left,o)-o/2,d=zn(e,this.right,a)+a/2,u=h=l):(u=zn(e,this.top,o)-o/2,h=zn(e,this.bottom,a)+a/2,c=d=l),t.save(),t.lineWidth=r.width,t.strokeStyle=r.color,t.beginPath(),t.moveTo(c,u),t.lineTo(d,h),t.stroke(),t.restore()}drawLabels(e){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&ao(i,s);const r=this.getLabelItems(e);for(const o of r){const a=o.options,l=o.font,c=o.label,d=o.textOffset;Ps(i,c,0,d,l,a)}s&&lo(i)}drawTitle(){const{ctx:e,options:{position:t,title:i,reverse:s}}=this;if(!i.display)return;const r=je(i.font),o=kt(i.padding),a=i.align;let l=r.lineHeight/2;t==="bottom"||t==="center"||X(t)?(l+=o.bottom,_e(i.text)&&(l+=r.lineHeight*(i.text.length-1))):l+=o.top;const{titleX:c,titleY:d,maxWidth:u,rotation:h}=oA(this,l,t,a);Ps(e,i.text,0,0,r,{color:i.color,maxWidth:u,rotation:h,textAlign:rA(a,t,s),textBaseline:"middle",translation:[c,d]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,t=e.ticks&&e.ticks.z||0,i=J(e.grid&&e.grid.z,-1),s=J(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==Li.prototype.draw?[{z:t,draw:r=>{this.draw(r)}}]:[{z:i,draw:r=>{this.drawBackground(),this.drawGrid(r),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:t,draw:r=>{this.drawLabels(r)}}]}getMatchingVisibleMetas(e){const t=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let r,o;for(r=0,o=t.length;r<o;++r){const a=t[r];a[i]===this.id&&(!e||a.type===e)&&s.push(a)}return s}_resolveTickFontOptions(e){const t=this.options.ticks.setContext(this.getContext(e));return je(t.font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class cr{constructor(e,t,i){this.type=e,this.scope=t,this.override=i,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){const t=Object.getPrototypeOf(e);let i;cA(t)&&(i=this.register(t));const s=this.items,r=e.id,o=this.scope+"."+r;if(!r)throw new Error("class does not have id: "+e);return r in s||(s[r]=e,aA(e,o,i),this.override&&ge.override(e.id,e.overrides)),o}get(e){return this.items[e]}unregister(e){const t=this.items,i=e.id,s=this.scope;i in t&&delete t[i],s&&i in ge[s]&&(delete ge[s][i],this.override&&delete oi[i])}}function aA(n,e,t){const i=Es(Object.create(null),[t?ge.get(t):{},ge.get(e),n.defaults]);ge.set(e,i),n.defaultRoutes&&lA(e,n.defaultRoutes),n.descriptors&&ge.describe(e,n.descriptors)}function lA(n,e){Object.keys(e).forEach(t=>{const i=t.split("."),s=i.pop(),r=[n].concat(i).join("."),o=e[t].split("."),a=o.pop(),l=o.join(".");ge.route(r,s,l,a)})}function cA(n){return"id"in n&&"defaults"in n}class dA{constructor(){this.controllers=new cr(_E,"datasets",!0),this.elements=new cr(an,"elements"),this.plugins=new cr(Object,"plugins"),this.scales=new cr(Li,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,t,i){[...t].forEach(s=>{const r=i||this._getRegistryForType(s);i||r.isForType(s)||r===this.plugins&&s.id?this._exec(e,r,s):re(s,o=>{const a=i||this._getRegistryForType(o);this._exec(e,a,o)})})}_exec(e,t,i){const s=Cl(e);ue(i["before"+s],[],i),t[e](i),ue(i["after"+s],[],i)}_getRegistryForType(e){for(let t=0;t<this._typedRegistries.length;t++){const i=this._typedRegistries[t];if(i.isForType(e))return i}return this.plugins}_get(e,t,i){const s=t.get(e);if(s===void 0)throw new Error('"'+e+'" is not a registered '+i+".");return s}}var jt=new dA;class uA{constructor(){this._init=void 0}notify(e,t,i,s){if(t==="beforeInit"&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install")),this._init===void 0)return;const r=s?this._descriptors(e).filter(s):this._descriptors(e),o=this._notify(r,e,t,i);return t==="afterDestroy"&&(this._notify(r,e,"stop"),this._notify(this._init,e,"uninstall"),this._init=void 0),o}_notify(e,t,i,s){s=s||{};for(const r of e){const o=r.plugin,a=o[i],l=[t,s,r.options];if(ue(a,l,o)===!1&&s.cancelable)return!1}return!0}invalidate(){pe(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const t=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),t}_createDescriptors(e,t){const i=e&&e.config,s=J(i.options&&i.options.plugins,{}),r=hA(i);return s===!1&&!t?[]:pA(e,r,s,t)}_notifyStateChanges(e){const t=this._oldCache||[],i=this._cache,s=(r,o)=>r.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(s(t,i),e,"stop"),this._notify(s(i,t),e,"start")}}function hA(n){const e={},t=[],i=Object.keys(jt.plugins.items);for(let r=0;r<i.length;r++)t.push(jt.getPlugin(i[r]));const s=n.plugins||[];for(let r=0;r<s.length;r++){const o=s[r];t.indexOf(o)===-1&&(t.push(o),e[o.id]=!0)}return{plugins:t,localIds:e}}function fA(n,e){return!e&&n===!1?null:n===!0?{}:n}function pA(n,{plugins:e,localIds:t},i,s){const r=[],o=n.getContext();for(const a of e){const l=a.id,c=fA(i[l],s);c!==null&&r.push({plugin:a,options:mA(n.config,{plugin:a,local:t[l]},c,o)})}return r}function mA(n,{plugin:e,local:t},i,s){const r=n.pluginScopeKeys(e),o=n.getOptionScopes(i,r);return t&&e.defaults&&o.push(e.defaults),n.createResolver(o,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Ba(n,e){const t=ge.datasets[n]||{};return((e.datasets||{})[n]||{}).indexAxis||e.indexAxis||t.indexAxis||"x"}function gA(n,e){let t=n;return n==="_index_"?t=e:n==="_value_"&&(t=e==="x"?"y":"x"),t}function bA(n,e){return n===e?"_index_":"_value_"}function gu(n){if(n==="x"||n==="y"||n==="r")return n}function yA(n){if(n==="top"||n==="bottom")return"x";if(n==="left"||n==="right")return"y"}function La(n,...e){if(gu(n))return n;for(const t of e){const i=t.axis||yA(t.position)||n.length>1&&gu(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function bu(n,e,t){if(t[e+"AxisID"]===n)return{axis:e}}function xA(n,e){if(e.data&&e.data.datasets){const t=e.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(t.length)return bu(n,"x",t[0])||bu(n,"y",t[0])}return{}}function _A(n,e){const t=oi[n.type]||{scales:{}},i=e.scales||{},s=Ba(n.type,e),r=Object.create(null);return Object.keys(i).forEach(o=>{const a=i[o];if(!X(a))return console.error(`Invalid scale configuration for scale: ${o}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);const l=La(o,a,xA(o,n),ge.scales[a.type]),c=bA(l,s),d=t.scales||{};r[o]=fs(Object.create(null),[{axis:l},a,d[l],d[c]])}),n.data.datasets.forEach(o=>{const a=o.type||n.type,l=o.indexAxis||Ba(a,e),d=(oi[a]||{}).scales||{};Object.keys(d).forEach(u=>{const h=gA(u,l),f=o[h+"AxisID"]||h;r[f]=r[f]||Object.create(null),fs(r[f],[{axis:h},i[f],d[u]])})}),Object.keys(r).forEach(o=>{const a=r[o];fs(a,[ge.scales[a.type],ge.scale])}),r}function Jm(n){const e=n.options||(n.options={});e.plugins=J(e.plugins,{}),e.scales=_A(n,e)}function Gm(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function kA(n){return n=n||{},n.data=Gm(n.data),Jm(n),n}const yu=new Map,Xm=new Set;function dr(n,e){let t=yu.get(n);return t||(t=e(),yu.set(n,t),Xm.add(t)),t}const Qi=(n,e,t)=>{const i=zr(e,t);i!==void 0&&n.add(i)};class wA{constructor(e){this._config=kA(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=Gm(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),Jm(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return dr(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,t){return dr(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,t){return dr(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]])}pluginScopeKeys(e){const t=e.id,i=this.type;return dr(`${i}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){const i=this._scopeCache;let s=i.get(e);return(!s||t)&&(s=new Map,i.set(e,s)),s}getOptionScopes(e,t,i){const{options:s,type:r}=this,o=this._cachedScopes(e,i),a=o.get(t);if(a)return a;const l=new Set;t.forEach(d=>{e&&(l.add(e),d.forEach(u=>Qi(l,e,u))),d.forEach(u=>Qi(l,s,u)),d.forEach(u=>Qi(l,oi[r]||{},u)),d.forEach(u=>Qi(l,ge,u)),d.forEach(u=>Qi(l,za,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Xm.has(t)&&o.set(t,c),c}chartOptionScopes(){const{options:e,type:t}=this;return[e,oi[t]||{},ge.datasets[t]||{},{type:t},ge,za]}resolveNamedOptions(e,t,i,s=[""]){const r={$shared:!0},{resolver:o,subPrefixes:a}=xu(this._resolverCache,e,s);let l=o;if(SA(o,t)){r.$shared=!1,i=Tn(i)?i():i;const c=this.createResolver(e,i,a);l=Ri(o,i,c)}for(const c of t)r[c]=l[c];return r}createResolver(e,t,i=[""],s){const{resolver:r}=xu(this._resolverCache,e,i);return X(t)?Ri(r,t,void 0,s):r}}function xu(n,e,t){let i=n.get(e);i||(i=new Map,n.set(e,i));const s=t.join();let r=i.get(s);return r||(r={resolver:Al(e,t),subPrefixes:t.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,r)),r}const vA=n=>X(n)&&Object.getOwnPropertyNames(n).some(e=>Tn(n[e]));function SA(n,e){const{isScriptable:t,isIndexable:i}=Em(n);for(const s of e){const r=t(s),o=i(s),a=(o||r)&&n[s];if(r&&(Tn(a)||vA(a))||o&&_e(a))return!0}return!1}var MA="4.5.1";const CA=["top","bottom","left","right","chartArea"];function _u(n,e){return n==="top"||n==="bottom"||CA.indexOf(n)===-1&&e==="x"}function ku(n,e){return function(t,i){return t[n]===i[n]?t[e]-i[e]:t[n]-i[n]}}function wu(n){const e=n.chart,t=e.options.animation;e.notifyPlugins("afterRender"),ue(t&&t.onComplete,[n],e)}function OA(n){const e=n.chart,t=e.options.animation;ue(t&&t.onProgress,[n],e)}function Qm(n){return Rl()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const yr={},vu=n=>{const e=Qm(n);return Object.values(yr).filter(t=>t.canvas===e).pop()};function DA(n,e,t){const i=Object.keys(n);for(const s of i){const r=+s;if(r>=e){const o=n[s];delete n[s],(t>0||r>e)&&(n[r+t]=o)}}}function TA(n,e,t,i){return!t||n.type==="mouseout"?null:i?e:n}let Bl=class{static defaults=ge;static instances=yr;static overrides=oi;static registry=jt;static version=MA;static getChart=vu;static register(...e){jt.add(...e),Su()}static unregister(...e){jt.remove(...e),Su()}constructor(e,t){const i=this.config=new wA(t),s=Qm(e),r=vu(s);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||KE(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,o.aspectRatio),l=a&&a.canvas,c=l&&l.height,d=l&&l.width;if(this.id=BT(),this.ctx=a,this.canvas=l,this.width=d,this.height=c,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new uA,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=sN(u=>this.update(u),o.resizeDelay||0),this._dataChanges=[],yr[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Ut.listen(this,"complete",wu),Ut.listen(this,"progress",OA),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:t},width:i,height:s,_aspectRatio:r}=this;return pe(e)?t&&r?r:s?i/s:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return jt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Jd(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return qd(this.canvas,this.ctx),this}stop(){return Ut.stop(this),this}resize(e,t){Ut.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){const i=this.options,s=this.canvas,r=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,e,t,r),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,Jd(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),ue(i.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const t=this.options.scales||{};re(t,(i,s)=>{i.id=s})}buildOrUpdateScales(){const e=this.options,t=e.scales,i=this.scales,s=Object.keys(i).reduce((o,a)=>(o[a]=!1,o),{});let r=[];t&&(r=r.concat(Object.keys(t).map(o=>{const a=t[o],l=La(o,a),c=l==="r",d=l==="x";return{options:a,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),re(r,o=>{const a=o.options,l=a.id,c=La(l,a),d=J(a.type,o.dtype);(a.position===void 0||_u(a.position,c)!==_u(o.dposition))&&(a.position=o.dposition),s[l]=!0;let u=null;if(l in i&&i[l].type===d)u=i[l];else{const h=jt.getScale(d);u=new h({id:l,type:d,ctx:this.ctx,chart:this}),i[u.id]=u}u.init(a,e)}),re(s,(o,a)=>{o||delete i[a]}),re(i,o=>{yt.configure(this,o,o.options),yt.addBox(this,o)})}_updateMetasets(){const e=this._metasets,t=this.data.datasets.length,i=e.length;if(e.sort((s,r)=>s.index-r.index),i>t){for(let s=t;s<i;++s)this._destroyDatasetMeta(s);e.splice(t,i-t)}this._sortedMetasets=e.slice(0).sort(ku("order","index"))}_removeUnreferencedMetasets(){const{_metasets:e,data:{datasets:t}}=this;e.length>t.length&&delete this._stacks,e.forEach((i,s)=>{t.filter(r=>r===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const e=[],t=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=t.length;i<s;i++){const r=t[i];let o=this.getDatasetMeta(i);const a=r.type||this.config.type;if(o.type&&o.type!==a&&(this._destroyDatasetMeta(i),o=this.getDatasetMeta(i)),o.type=a,o.indexAxis=r.indexAxis||Ba(a,this.options),o.order=r.order||0,o.index=i,o.label=""+r.label,o.visible=this.isDatasetVisible(i),o.controller)o.controller.updateIndex(i),o.controller.linkScales();else{const l=jt.getController(a),{datasetElementType:c,dataElementType:d}=ge.datasets[a];Object.assign(l,{dataElementType:jt.getElement(d),datasetElementType:c&&jt.getElement(c)}),o.controller=new l(this,i),e.push(o.controller)}}return this._updateMetasets(),e}_resetElements(){re(this.data.datasets,(e,t)=>{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const t=this.config;t.update();const i=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let c=0,d=this.data.datasets.length;c<d;c++){const{controller:u}=this.getDatasetMeta(c),h=!s&&r.indexOf(u)===-1;u.buildOrUpdateElements(h),o=Math.max(+u.getMaxOverflow(),o)}o=this._minPadding=i.layout.autoPadding?o:0,this._updateLayout(o),s||re(r,c=>{c.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(ku("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){re(this.scales,e=>{yt.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,t=new Set(Object.keys(this._listeners)),i=new Set(e.events);(!zd(t,i)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:r}of t){const o=i==="_removeElements"?-r:r;DA(e,s,o)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const t=this.data.datasets.length,i=r=>new Set(e.filter(o=>o[0]===r).map((o,a)=>a+","+o.splice(1).join(","))),s=i(0);for(let r=1;r<t;r++)if(!zd(s,i(r)))return;return Array.from(s).map(r=>r.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;yt.update(this,this.width,this.height,e);const t=this.chartArea,i=t.width<=0||t.height<=0;this._layers=[],re(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,r)=>{s._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let t=0,i=this.data.datasets.length;t<i;++t)this.getDatasetMeta(t).controller.configure();for(let t=0,i=this.data.datasets.length;t<i;++t)this._updateDataset(t,Tn(e)?e({datasetIndex:t}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,t){const i=this.getDatasetMeta(e),s={meta:i,index:e,mode:t,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(t),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Ut.has(this)?this.attached&&!Ut.running(this)&&Ut.start(this):(this.draw(),wu({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){const{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const t=this._layers;for(e=0;e<t.length&&t[e].z<=0;++e)t[e].draw(this.chartArea);for(this._drawDatasets();e<t.length;++e)t[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){const t=this._sortedMetasets,i=[];let s,r;for(s=0,r=t.length;s<r;++s){const o=t[s];(!e||o.visible)&&i.push(o)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const e=this.getSortedVisibleDatasetMetas();for(let t=e.length-1;t>=0;--t)this._drawDataset(e[t]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const t=this.ctx,i={meta:e,index:e.index,cancelable:!0},s=Wm(this,e);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&ao(t,s),e.controller.draw(),s&&lo(t),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(e){return As(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,i,s){const r=CE.modes[t];return typeof r=="function"?r(this,e,i,s):[]}getDatasetMeta(e){const t=this.data.datasets[e],i=this._metasets;let s=i.filter(r=>r&&r._dataset===t).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=li(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const t=this.data.datasets[e];if(!t)return!1;const i=this.getDatasetMeta(e);return typeof i.hidden=="boolean"?!i.hidden:!t.hidden}setDatasetVisibility(e,t){const i=this.getDatasetMeta(e);i.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,i){const s=i?"show":"hide",r=this.getDatasetMeta(e),o=r.controller._resolveAnimations(void 0,s);jr(t)?(r.data[t].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),o.update(r,{visible:i}),this.update(a=>a.datasetIndex===e?s:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){const t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),Ut.remove(this),e=0,t=this.data.datasets.length;e<t;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:e,ctx:t}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),qd(e,t),this.platform.releaseContext(t),this.canvas=null,this.ctx=null),delete yr[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const e=this._listeners,t=this.platform,i=(r,o)=>{t.addEventListener(this,r,o),e[r]=o},s=(r,o,a)=>{r.offsetX=o,r.offsetY=a,this._eventHandler(r)};re(this.options.events,r=>i(r,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,t=this.platform,i=(l,c)=>{t.addEventListener(this,l,c),e[l]=c},s=(l,c)=>{e[l]&&(t.removeEventListener(this,l,c),delete e[l])},r=(l,c)=>{this.canvas&&this.resize(l,c)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",r),i("detach",o)};o=()=>{this.attached=!1,s("resize",r),this._stop(),this._resize(0,0),i("attach",a)},t.isAttached(this.canvas)?a():o()}unbindEvents(){re(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},re(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,i){const s=i?"set":"remove";let r,o,a,l;for(t==="dataset"&&(r=this.getDatasetMeta(e[0].datasetIndex),r.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=e.length;a<l;++a){o=e[a];const c=o&&this.getDatasetMeta(o.datasetIndex).controller;c&&c[s+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){const t=this._active||[],i=e.map(({datasetIndex:r,index:o})=>{const a=this.getDatasetMeta(r);if(!a)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:a.data[o],index:o}});!Ir(i,t)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,t))}notifyPlugins(e,t,i){return this._plugins.notify(this,e,t,i)}isPluginEnabled(e){return this._plugins._cache.filter(t=>t.plugin.id===e).length===1}_updateHoverStyles(e,t,i){const s=this.options.hover,r=(l,c)=>l.filter(d=>!c.some(u=>d.datasetIndex===u.datasetIndex&&d.index===u.index)),o=r(t,e),a=i?e:r(e,t);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(e,t){const i={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},s=o=>(o.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const r=this._handleEvent(e,t,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(r||i.changed)&&this.render(),this}_handleEvent(e,t,i){const{_active:s=[],options:r}=this,o=t,a=this._getActiveElements(e,s,i,o),l=VT(e),c=TA(e,this._lastEvent,i,l);i&&(this._lastEvent=null,ue(r.onHover,[e,a,this],this),l&&ue(r.onClick,[e,a,this],this));const d=!Ir(a,s);return(d||t)&&(this._active=a,this._updateHoverStyles(a,s,t)),this._lastEvent=c,d}_getActiveElements(e,t,i,s){if(e.type==="mouseout")return[];if(!i)return t;const r=this.options.hover;return this.getElementsAtEventForMode(e,r.mode,r,s)}};function Su(){return re(Bl.instances,n=>n._plugins.invalidate())}function NA(n,e,t){const{startAngle:i,x:s,y:r,outerRadius:o,innerRadius:a,options:l}=e,{borderWidth:c,borderJoinStyle:d}=l,u=Math.min(c/o,at(i-t));if(n.beginPath(),n.arc(s,r,o-c/2,i+u/2,t-u/2),a>0){const h=Math.min(c/a,at(i-t));n.arc(s,r,a+c/2,t-h/2,i+h/2,!0)}else{const h=Math.min(c/2,o*at(i-t));if(d==="round")n.arc(s,r,h,t-ae/2,i+ae/2,!0);else if(d==="bevel"){const f=2*h*h,p=-f*Math.cos(t+ae/2)+s,m=-f*Math.sin(t+ae/2)+r,g=f*Math.cos(i+ae/2)+s,y=f*Math.sin(i+ae/2)+r;n.lineTo(p,m),n.lineTo(g,y)}}n.closePath(),n.moveTo(0,0),n.rect(0,0,n.canvas.width,n.canvas.height),n.clip("evenodd")}function EA(n,e,t){const{startAngle:i,pixelMargin:s,x:r,y:o,outerRadius:a,innerRadius:l}=e;let c=s/a;n.beginPath(),n.arc(r,o,a,i-c,t+c),l>s?(c=s/l,n.arc(r,o,l,t+c,i-c,!0)):n.arc(r,o,s,t+Pe,i-Pe),n.closePath(),n.clip()}function AA(n){return El(n,["outerStart","outerEnd","innerStart","innerEnd"])}function PA(n,e,t,i){const s=AA(n.options.borderRadius),r=(t-e)/2,o=Math.min(r,i*e/2),a=l=>{const c=(t-Math.min(r,l))*i/2;return Ge(l,0,Math.min(r,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:Ge(s.innerStart,0,o),innerEnd:Ge(s.innerEnd,0,o)}}function bi(n,e,t,i){return{x:t+n*Math.cos(e),y:i+n*Math.sin(e)}}function Hr(n,e,t,i,s,r){const{x:o,y:a,startAngle:l,pixelMargin:c,innerRadius:d}=e,u=Math.max(e.outerRadius+i+t-c,0),h=d>0?d+i+t+c:0;let f=0;const p=s-l;if(i){const H=d>0?d-i:0,K=u>0?u-i:0,G=(H+K)/2,R=G!==0?p*G/(G+i):p;f=(p-R)/2}const m=Math.max(.001,p*u-t/ae)/u,g=(p-m)/2,y=l+g+f,S=s-g-f,{outerStart:_,outerEnd:k,innerStart:v,innerEnd:w}=PA(e,h,u,S-y),M=u-_,C=u-k,O=y+_/M,D=S-k/C,A=h+v,P=h+w,F=y+v/A,B=S-w/P;if(n.beginPath(),r){const H=(O+D)/2;if(n.arc(o,a,u,O,H),n.arc(o,a,u,H,D),k>0){const E=bi(C,D,o,a);n.arc(E.x,E.y,k,D,S+Pe)}const K=bi(P,S,o,a);if(n.lineTo(K.x,K.y),w>0){const E=bi(P,B,o,a);n.arc(E.x,E.y,w,S+Pe,B+Math.PI)}const G=(S-w/h+(y+v/h))/2;if(n.arc(o,a,h,S-w/h,G,!0),n.arc(o,a,h,G,y+v/h,!0),v>0){const E=bi(A,F,o,a);n.arc(E.x,E.y,v,F+Math.PI,y-Pe)}const R=bi(M,y,o,a);if(n.lineTo(R.x,R.y),_>0){const E=bi(M,O,o,a);n.arc(E.x,E.y,_,y-Pe,O)}}else{n.moveTo(o,a);const H=Math.cos(O)*u+o,K=Math.sin(O)*u+a;n.lineTo(H,K);const G=Math.cos(D)*u+o,R=Math.sin(D)*u+a;n.lineTo(G,R)}n.closePath()}function IA(n,e,t,i,s){const{fullCircles:r,startAngle:o,circumference:a}=e;let l=e.endAngle;if(r){Hr(n,e,t,i,l,s);for(let c=0;c<r;++c)n.fill();isNaN(a)||(l=o+(a%Ce||Ce))}return Hr(n,e,t,i,l,s),n.fill(),l}function RA(n,e,t,i,s){const{fullCircles:r,startAngle:o,circumference:a,options:l}=e,{borderWidth:c,borderJoinStyle:d,borderDash:u,borderDashOffset:h,borderRadius:f}=l,p=l.borderAlign==="inner";if(!c)return;n.setLineDash(u||[]),n.lineDashOffset=h,p?(n.lineWidth=c*2,n.lineJoin=d||"round"):(n.lineWidth=c,n.lineJoin=d||"bevel");let m=e.endAngle;if(r){Hr(n,e,t,i,m,s);for(let g=0;g<r;++g)n.stroke();isNaN(a)||(m=o+(a%Ce||Ce))}p&&EA(n,e,m),l.selfJoin&&m-o>=ae&&f===0&&d!=="miter"&&NA(n,e,m),r||(Hr(n,e,t,i,m,s),n.stroke())}class zA extends an{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:e=>e!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(e){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,t,i){const s=this.getProps(["x","y"],i),{angle:r,distance:o}=vm(s,{x:e,y:t}),{startAngle:a,endAngle:l,innerRadius:c,outerRadius:d,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),h=(this.options.spacing+this.options.borderWidth)/2,f=J(u,l-a),p=Ol(r,a,l)&&a!==l,m=f>=Ce||p,g=sn(o,c+h,d+h);return m&&g}getCenterPoint(e){const{x:t,y:i,startAngle:s,endAngle:r,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:l,spacing:c}=this.options,d=(s+r)/2,u=(o+a+c+l)/2;return{x:t+Math.cos(d)*u,y:i+Math.sin(d)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:t,circumference:i}=this,s=(t.offset||0)/4,r=(t.spacing||0)/2,o=t.circular;if(this.pixelMargin=t.borderAlign==="inner"?.33:0,this.fullCircles=i>Ce?Math.floor(i/Ce):0,i===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const a=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(a)*s,Math.sin(a)*s);const l=1-Math.sin(Math.min(ae,i||0)),c=s*l;e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor,IA(e,this,c,r,o),RA(e,this,c,r,o),e.restore()}}function Zm(n,e,t=e){n.lineCap=J(t.borderCapStyle,e.borderCapStyle),n.setLineDash(J(t.borderDash,e.borderDash)),n.lineDashOffset=J(t.borderDashOffset,e.borderDashOffset),n.lineJoin=J(t.borderJoinStyle,e.borderJoinStyle),n.lineWidth=J(t.borderWidth,e.borderWidth),n.strokeStyle=J(t.borderColor,e.borderColor)}function jA(n,e,t){n.lineTo(t.x,t.y)}function BA(n){return n.stepped?gN:n.tension||n.cubicInterpolationMode==="monotone"?bN:jA}function eg(n,e,t={}){const i=n.length,{start:s=0,end:r=i-1}=t,{start:o,end:a}=e,l=Math.max(s,o),c=Math.min(r,a),d=s<o&&r<o||s>a&&r>a;return{count:i,start:l,loop:e.loop,ilen:c<l&&!d?i+c-l:c-l}}function LA(n,e,t,i){const{points:s,options:r}=e,{count:o,start:a,loop:l,ilen:c}=eg(s,t,i),d=BA(r);let{move:u=!0,reverse:h}=i||{},f,p,m;for(f=0;f<=c;++f)p=s[(a+(h?c-f:f))%o],!p.skip&&(u?(n.moveTo(p.x,p.y),u=!1):d(n,m,p,h,r.stepped),m=p);return l&&(p=s[(a+(h?c:0))%o],d(n,m,p,h,r.stepped)),!!l}function FA(n,e,t,i){const s=e.points,{count:r,start:o,ilen:a}=eg(s,t,i),{move:l=!0,reverse:c}=i||{};let d=0,u=0,h,f,p,m,g,y;const S=k=>(o+(c?a-k:k))%r,_=()=>{m!==g&&(n.lineTo(d,g),n.lineTo(d,m),n.lineTo(d,y))};for(l&&(f=s[S(0)],n.moveTo(f.x,f.y)),h=0;h<=a;++h){if(f=s[S(h)],f.skip)continue;const k=f.x,v=f.y,w=k|0;w===p?(v<m?m=v:v>g&&(g=v),d=(u*d+k)/++u):(_(),n.lineTo(k,v),p=w,u=0,m=g=v),y=v}_()}function Fa(n){const e=n.options,t=e.borderDash&&e.borderDash.length;return!n._decimated&&!n._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!t?FA:LA}function WA(n){return n.stepped?JN:n.tension||n.cubicInterpolationMode==="monotone"?GN:Wn}function $A(n,e,t,i){let s=e._path;s||(s=e._path=new Path2D,e.path(s,t,i)&&s.closePath()),Zm(n,e.options),n.stroke(s)}function HA(n,e,t,i){const{segments:s,options:r}=e,o=Fa(e);for(const a of s)Zm(n,r,a.style),n.beginPath(),o(n,e,a,{start:t,end:t+i-1})&&n.closePath(),n.stroke()}const VA=typeof Path2D=="function";function YA(n,e,t,i){VA&&!e.options.segment?$A(n,e,t,i):HA(n,e,t,i)}class ho extends an{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:e=>e!=="borderDash"&&e!=="fill"};constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,t){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;WN(this._points,i,e,s,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=nE(this,this.options.segment))}first(){const e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){const e=this.segments,t=this.points,i=e.length;return i&&t[e[i-1].end]}interpolate(e,t){const i=this.options,s=e[t],r=this.points,o=Fm(this,{property:t,start:s,end:s});if(!o.length)return;const a=[],l=WA(i);let c,d;for(c=0,d=o.length;c<d;++c){const{start:u,end:h}=o[c],f=r[u],p=r[h];if(f===p){a.push(f);continue}const m=Math.abs((s-f[t])/(p[t]-f[t])),g=l(f,p,m,i.stepped);g[t]=e[t],a.push(g)}return a.length===1?a[0]:a}pathSegment(e,t,i){return Fa(this)(e,this,t,i)}path(e,t,i){const s=this.segments,r=Fa(this);let o=this._loop;t=t||0,i=i||this.points.length-t;for(const a of s)o&=r(e,this,a,{start:t,end:t+i-1});return!!o}draw(e,t,i,s){const r=this.options||{};(this.points||[]).length&&r.borderWidth&&(e.save(),YA(e,this,i,s),e.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function Mu(n,e,t,i){const s=n.options,{[t]:r}=n.getProps([t],i);return Math.abs(e-r)<s.radius+s.hitRadius}class qA extends an{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(e){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,t,i){const s=this.options,{x:r,y:o}=this.getProps(["x","y"],i);return Math.pow(e-r,2)+Math.pow(t-o,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(e,t){return Mu(this,e,"x",t)}inYRange(e,t){return Mu(this,e,"y",t)}getCenterPoint(e){const{x:t,y:i}=this.getProps(["x","y"],e);return{x:t,y:i}}size(e){e=e||this.options||{};let t=e.radius||0;t=Math.max(t,t&&e.hoverRadius||0);const i=t&&e.borderWidth||0;return(t+i)*2}draw(e,t){const i=this.options;this.skip||i.radius<.1||!As(this,t,this.size(i)/2)||(e.strokeStyle=i.borderColor,e.lineWidth=i.borderWidth,e.fillStyle=i.backgroundColor,ja(e,i,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}}function tg(n,e){const{x:t,y:i,base:s,width:r,height:o}=n.getProps(["x","y","base","width","height"],e);let a,l,c,d,u;return n.horizontal?(u=o/2,a=Math.min(t,s),l=Math.max(t,s),c=i-u,d=i+u):(u=r/2,a=t-u,l=t+u,c=Math.min(i,s),d=Math.max(i,s)),{left:a,top:c,right:l,bottom:d}}function xn(n,e,t,i){return n?0:Ge(e,t,i)}function KA(n,e,t){const i=n.options.borderWidth,s=n.borderSkipped,r=Nm(i);return{t:xn(s.top,r.top,0,t),r:xn(s.right,r.right,0,e),b:xn(s.bottom,r.bottom,0,t),l:xn(s.left,r.left,0,e)}}function UA(n,e,t){const{enableBorderRadius:i}=n.getProps(["enableBorderRadius"]),s=n.options.borderRadius,r=Mi(s),o=Math.min(e,t),a=n.borderSkipped,l=i||X(s);return{topLeft:xn(!l||a.top||a.left,r.topLeft,0,o),topRight:xn(!l||a.top||a.right,r.topRight,0,o),bottomLeft:xn(!l||a.bottom||a.left,r.bottomLeft,0,o),bottomRight:xn(!l||a.bottom||a.right,r.bottomRight,0,o)}}function JA(n){const e=tg(n),t=e.right-e.left,i=e.bottom-e.top,s=KA(n,t/2,i/2),r=UA(n,t/2,i/2);return{outer:{x:e.left,y:e.top,w:t,h:i,radius:r},inner:{x:e.left+s.l,y:e.top+s.t,w:t-s.l-s.r,h:i-s.t-s.b,radius:{topLeft:Math.max(0,r.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,r.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,r.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,r.bottomRight-Math.max(s.b,s.r))}}}}function ra(n,e,t,i){const s=e===null,r=t===null,a=n&&!(s&&r)&&tg(n,i);return a&&(s||sn(e,a.left,a.right))&&(r||sn(t,a.top,a.bottom))}function GA(n){return n.topLeft||n.topRight||n.bottomLeft||n.bottomRight}function XA(n,e){n.rect(e.x,e.y,e.w,e.h)}function oa(n,e,t={}){const i=n.x!==t.x?-e:0,s=n.y!==t.y?-e:0,r=(n.x+n.w!==t.x+t.w?e:0)-i,o=(n.y+n.h!==t.y+t.h?e:0)-s;return{x:n.x+i,y:n.y+s,w:n.w+r,h:n.h+o,radius:n.radius}}class QA extends an{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,e&&Object.assign(this,e)}draw(e){const{inflateAmount:t,options:{borderColor:i,backgroundColor:s}}=this,{inner:r,outer:o}=JA(this),a=GA(o.radius)?Fr:XA;e.save(),(o.w!==r.w||o.h!==r.h)&&(e.beginPath(),a(e,oa(o,t,r)),e.clip(),a(e,oa(r,-t,o)),e.fillStyle=i,e.fill("evenodd")),e.beginPath(),a(e,oa(r,t)),e.fillStyle=s,e.fill(),e.restore()}inRange(e,t,i){return ra(this,e,t,i)}inXRange(e,t){return ra(this,e,null,t)}inYRange(e,t){return ra(this,null,e,t)}getCenterPoint(e){const{x:t,y:i,base:s,horizontal:r}=this.getProps(["x","y","base","horizontal"],e);return{x:r?(t+s)/2:t,y:r?i:(i+s)/2}}getRange(e){return e==="x"?this.width/2:this.height/2}}function ZA(n,e,t){const i=n.segments,s=n.points,r=e.points,o=[];for(const a of i){let{start:l,end:c}=a;c=fo(l,c,s);const d=Wa(t,s[l],s[c],a.loop);if(!e.segments){o.push({source:a,target:d,start:s[l],end:s[c]});continue}const u=Fm(e,d);for(const h of u){const f=Wa(t,r[h.start],r[h.end],h.loop),p=Lm(a,s,f);for(const m of p)o.push({source:m,target:h,start:{[t]:Cu(d,f,"start",Math.max)},end:{[t]:Cu(d,f,"end",Math.min)}})}}return o}function Wa(n,e,t,i){if(i)return;let s=e[n],r=t[n];return n==="angle"&&(s=at(s),r=at(r)),{property:n,start:s,end:r}}function eP(n,e){const{x:t=null,y:i=null}=n||{},s=e.points,r=[];return e.segments.forEach(({start:o,end:a})=>{a=fo(o,a,s);const l=s[o],c=s[a];i!==null?(r.push({x:l.x,y:i}),r.push({x:c.x,y:i})):t!==null&&(r.push({x:t,y:l.y}),r.push({x:t,y:c.y}))}),r}function fo(n,e,t){for(;e>n;e--){const i=t[e];if(!isNaN(i.x)&&!isNaN(i.y))break}return e}function Cu(n,e,t,i){return n&&e?i(n[t],e[t]):n?n[t]:e?e[t]:0}function ng(n,e){let t=[],i=!1;return _e(n)?(i=!0,t=n):t=eP(n,e),t.length?new ho({points:t,options:{tension:0},_loop:i,_fullLoop:i}):null}function Ou(n){return n&&n.fill!==!1}function tP(n,e,t){let s=n[e].fill;const r=[e];let o;if(!t)return s;for(;s!==!1&&r.indexOf(s)===-1;){if(!Le(s))return s;if(o=n[s],!o)return!1;if(o.visible)return s;r.push(s),s=o.fill}return!1}function nP(n,e,t){const i=oP(n);if(X(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return Le(s)&&Math.floor(s)===s?iP(i[0],e,s,t):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function iP(n,e,t,i){return(n==="-"||n==="+")&&(t=e+t),t===e||t<0||t>=i?!1:t}function sP(n,e){let t=null;return n==="start"?t=e.bottom:n==="end"?t=e.top:X(n)?t=e.getPixelForValue(n.value):e.getBasePixel&&(t=e.getBasePixel()),t}function rP(n,e,t){let i;return n==="start"?i=t:n==="end"?i=e.options.reverse?e.min:e.max:X(n)?i=n.value:i=e.getBaseValue(),i}function oP(n){const e=n.options,t=e.fill;let i=J(t&&t.target,t);return i===void 0&&(i=!!e.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function aP(n){const{scale:e,index:t,line:i}=n,s=[],r=i.segments,o=i.points,a=lP(e,t);a.push(ng({x:null,y:e.bottom},i));for(let l=0;l<r.length;l++){const c=r[l];for(let d=c.start;d<=c.end;d++)cP(s,o[d],a)}return new ho({points:s,options:{}})}function lP(n,e){const t=[],i=n.getMatchingVisibleMetas("line");for(let s=0;s<i.length;s++){const r=i[s];if(r.index===e)break;r.hidden||t.unshift(r.dataset)}return t}function cP(n,e,t){const i=[];for(let s=0;s<t.length;s++){const r=t[s],{first:o,last:a,point:l}=dP(r,e,"x");if(!(!l||o&&a)){if(o)i.unshift(l);else if(n.push(l),!a)break}}n.push(...i)}function dP(n,e,t){const i=n.interpolate(e,t);if(!i)return{};const s=i[t],r=n.segments,o=n.points;let a=!1,l=!1;for(let c=0;c<r.length;c++){const d=r[c],u=o[d.start][t],h=o[d.end][t];if(sn(s,u,h)){a=s===u,l=s===h;break}}return{first:a,last:l,point:i}}class ig{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius}pathSegment(e,t,i){const{x:s,y:r,radius:o}=this;return t=t||{start:0,end:Ce},e.arc(s,r,o,t.end,t.start,!0),!i.bounds}interpolate(e){const{x:t,y:i,radius:s}=this,r=e.angle;return{x:t+Math.cos(r)*s,y:i+Math.sin(r)*s,angle:r}}}function uP(n){const{chart:e,fill:t,line:i}=n;if(Le(t))return hP(e,t);if(t==="stack")return aP(n);if(t==="shape")return!0;const s=fP(n);return s instanceof ig?s:ng(s,i)}function hP(n,e){const t=n.getDatasetMeta(e);return t&&n.isDatasetVisible(e)?t.dataset:null}function fP(n){return(n.scale||{}).getPointPositionForValue?mP(n):pP(n)}function pP(n){const{scale:e={},fill:t}=n,i=sP(t,e);if(Le(i)){const s=e.isHorizontal();return{x:s?i:null,y:s?null:i}}return null}function mP(n){const{scale:e,fill:t}=n,i=e.options,s=e.getLabels().length,r=i.reverse?e.max:e.min,o=rP(t,e,r),a=[];if(i.grid.circular){const l=e.getPointPositionForValue(0,r);return new ig({x:l.x,y:l.y,radius:e.getDistanceFromCenterForValue(o)})}for(let l=0;l<s;++l)a.push(e.getPointPositionForValue(l,o));return a}function aa(n,e,t){const i=uP(e),{chart:s,index:r,line:o,scale:a,axis:l}=e,c=o.options,d=c.fill,u=c.backgroundColor,{above:h=u,below:f=u}=d||{},p=s.getDatasetMeta(r),m=Wm(s,p);i&&o.points.length&&(ao(n,t),gP(n,{line:o,target:i,above:h,below:f,area:t,scale:a,axis:l,clip:m}),lo(n))}function gP(n,e){const{line:t,target:i,above:s,below:r,area:o,scale:a,clip:l}=e,c=t._loop?"angle":e.axis;n.save();let d=r;r!==s&&(c==="x"?(Du(n,i,o.top),la(n,{line:t,target:i,color:s,scale:a,property:c,clip:l}),n.restore(),n.save(),Du(n,i,o.bottom)):c==="y"&&(Tu(n,i,o.left),la(n,{line:t,target:i,color:r,scale:a,property:c,clip:l}),n.restore(),n.save(),Tu(n,i,o.right),d=s)),la(n,{line:t,target:i,color:d,scale:a,property:c,clip:l}),n.restore()}function Du(n,e,t){const{segments:i,points:s}=e;let r=!0,o=!1;n.beginPath();for(const a of i){const{start:l,end:c}=a,d=s[l],u=s[fo(l,c,s)];r?(n.moveTo(d.x,d.y),r=!1):(n.lineTo(d.x,t),n.lineTo(d.x,d.y)),o=!!e.pathSegment(n,a,{move:o}),o?n.closePath():n.lineTo(u.x,t)}n.lineTo(e.first().x,t),n.closePath(),n.clip()}function Tu(n,e,t){const{segments:i,points:s}=e;let r=!0,o=!1;n.beginPath();for(const a of i){const{start:l,end:c}=a,d=s[l],u=s[fo(l,c,s)];r?(n.moveTo(d.x,d.y),r=!1):(n.lineTo(t,d.y),n.lineTo(d.x,d.y)),o=!!e.pathSegment(n,a,{move:o}),o?n.closePath():n.lineTo(t,u.y)}n.lineTo(t,e.first().y),n.closePath(),n.clip()}function la(n,e){const{line:t,target:i,property:s,color:r,scale:o,clip:a}=e,l=ZA(t,i,s);for(const{source:c,target:d,start:u,end:h}of l){const{style:{backgroundColor:f=r}={}}=c,p=i!==!0;n.save(),n.fillStyle=f,bP(n,o,a,p&&Wa(s,u,h)),n.beginPath();const m=!!t.pathSegment(n,c);let g;if(p){m?n.closePath():Nu(n,i,h,s);const y=!!i.pathSegment(n,d,{move:m,reverse:!0});g=m&&y,g||Nu(n,i,u,s)}n.closePath(),n.fill(g?"evenodd":"nonzero"),n.restore()}}function bP(n,e,t,i){const s=e.chart.chartArea,{property:r,start:o,end:a}=i||{};if(r==="x"||r==="y"){let l,c,d,u;r==="x"?(l=o,c=s.top,d=a,u=s.bottom):(l=s.left,c=o,d=s.right,u=a),n.beginPath(),t&&(l=Math.max(l,t.left),d=Math.min(d,t.right),c=Math.max(c,t.top),u=Math.min(u,t.bottom)),n.rect(l,c,d-l,u-c),n.clip()}}function Nu(n,e,t,i){const s=e.interpolate(t,i);s&&n.lineTo(s.x,s.y)}var yP={id:"filler",afterDatasetsUpdate(n,e,t){const i=(n.data.datasets||[]).length,s=[];let r,o,a,l;for(o=0;o<i;++o)r=n.getDatasetMeta(o),a=r.dataset,l=null,a&&a.options&&a instanceof ho&&(l={visible:n.isDatasetVisible(o),index:o,fill:nP(a,o,i),chart:n,axis:r.controller.options.indexAxis,scale:r.vScale,line:a}),r.$filler=l,s.push(l);for(o=0;o<i;++o)l=s[o],!(!l||l.fill===!1)&&(l.fill=tP(s,o,t.propagate))},beforeDraw(n,e,t){const i=t.drawTime==="beforeDraw",s=n.getSortedVisibleDatasetMetas(),r=n.chartArea;for(let o=s.length-1;o>=0;--o){const a=s[o].$filler;a&&(a.line.updateControlPoints(r,a.axis),i&&a.fill&&aa(n.ctx,a,r))}},beforeDatasetsDraw(n,e,t){if(t.drawTime!=="beforeDatasetsDraw")return;const i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const r=i[s].$filler;Ou(r)&&aa(n.ctx,r,n.chartArea)}},beforeDatasetDraw(n,e,t){const i=e.meta.$filler;!Ou(i)||t.drawTime!=="beforeDatasetDraw"||aa(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Eu=(n,e)=>{let{boxHeight:t=e,boxWidth:i=e}=n;return n.usePointStyle&&(t=Math.min(t,e),i=n.pointStyleWidth||Math.min(i,e)),{boxWidth:i,boxHeight:t,itemHeight:Math.max(e,t)}},xP=(n,e)=>n!==null&&e!==null&&n.datasetIndex===e.datasetIndex&&n.index===e.index;class Au extends an{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t,i){this.maxWidth=e,this.maxHeight=t,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const e=this.options.labels||{};let t=ue(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter(i=>e.filter(i,this.chart.data))),e.sort&&(t=t.sort((i,s)=>e.sort(i,s,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){const{options:e,ctx:t}=this;if(!e.display){this.width=this.height=0;return}const i=e.labels,s=je(i.font),r=s.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Eu(i,r);let c,d;t.font=s.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(o,r,a,l)+10):(d=this.maxHeight,c=this._fitCols(o,s,a,l)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(d,e.maxHeight||this.maxHeight)}_fitRows(e,t,i,s){const{ctx:r,maxWidth:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],d=s+a;let u=e;r.textAlign="left",r.textBaseline="middle";let h=-1,f=-d;return this.legendItems.forEach((p,m)=>{const g=i+t/2+r.measureText(p.text).width;(m===0||c[c.length-1]+g+2*a>o)&&(u+=d,c[c.length-(m>0?0:1)]=0,f+=d,h++),l[m]={left:0,top:f,row:h,width:g,height:s},c[c.length-1]+=g+a}),u}_fitCols(e,t,i,s){const{ctx:r,maxHeight:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],d=o-e;let u=a,h=0,f=0,p=0,m=0;return this.legendItems.forEach((g,y)=>{const{itemWidth:S,itemHeight:_}=_P(i,t,r,g,s);y>0&&f+_+2*a>d&&(u+=h+a,c.push({width:h,height:f}),p+=h+a,m++,h=f=0),l[y]={left:p,top:f,col:m,width:S,height:_},h=Math.max(h,S),f+=_+a}),u+=h,c.push({width:h,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:i,labels:{padding:s},rtl:r}}=this,o=Ci(r,this.left,this.width);if(this.isHorizontal()){let a=0,l=Ie(i,this.left+s,this.right-this.lineWidths[a]);for(const c of t)a!==c.row&&(a=c.row,l=Ie(i,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+e+s,c.left=o.leftForLtr(o.x(l),c.width),l+=c.width+s}else{let a=0,l=Ie(i,this.top+e+s,this.bottom-this.columnSizes[a].height);for(const c of t)c.col!==a&&(a=c.col,l=Ie(i,this.top+e+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=o.leftForLtr(o.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const e=this.ctx;ao(e,this),this._draw(),lo(e)}}_draw(){const{options:e,columnSizes:t,lineWidths:i,ctx:s}=this,{align:r,labels:o}=e,a=ge.color,l=Ci(e.rtl,this.left,this.width),c=je(o.font),{padding:d}=o,u=c.size,h=u/2;let f;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:p,boxHeight:m,itemHeight:g}=Eu(o,u),y=function(w,M,C){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;s.save();const O=J(C.lineWidth,1);if(s.fillStyle=J(C.fillStyle,a),s.lineCap=J(C.lineCap,"butt"),s.lineDashOffset=J(C.lineDashOffset,0),s.lineJoin=J(C.lineJoin,"miter"),s.lineWidth=O,s.strokeStyle=J(C.strokeStyle,a),s.setLineDash(J(C.lineDash,[])),o.usePointStyle){const D={radius:m*Math.SQRT2/2,pointStyle:C.pointStyle,rotation:C.rotation,borderWidth:O},A=l.xPlus(w,p/2),P=M+h;Tm(s,D,A,P,o.pointStyleWidth&&p)}else{const D=M+Math.max((u-m)/2,0),A=l.leftForLtr(w,p),P=Mi(C.borderRadius);s.beginPath(),Object.values(P).some(F=>F!==0)?Fr(s,{x:A,y:D,w:p,h:m,radius:P}):s.rect(A,D,p,m),s.fill(),O!==0&&s.stroke()}s.restore()},S=function(w,M,C){Ps(s,C.text,w,M+g/2,c,{strikethrough:C.hidden,textAlign:l.textAlign(C.textAlign)})},_=this.isHorizontal(),k=this._computeTitleHeight();_?f={x:Ie(r,this.left+d,this.right-i[0]),y:this.top+d+k,line:0}:f={x:this.left+d,y:Ie(r,this.top+k+d,this.bottom-t[0].height),line:0},zm(this.ctx,e.textDirection);const v=g+d;this.legendItems.forEach((w,M)=>{s.strokeStyle=w.fontColor,s.fillStyle=w.fontColor;const C=s.measureText(w.text).width,O=l.textAlign(w.textAlign||(w.textAlign=o.textAlign)),D=p+h+C;let A=f.x,P=f.y;l.setWidth(this.width),_?M>0&&A+D+d>this.right&&(P=f.y+=v,f.line++,A=f.x=Ie(r,this.left+d,this.right-i[f.line])):M>0&&P+v>this.bottom&&(A=f.x=A+t[f.line].width+d,f.line++,P=f.y=Ie(r,this.top+k+d,this.bottom-t[f.line].height));const F=l.x(A);if(y(F,P,w),A=rN(O,A+p+h,_?A+D:this.right,e.rtl),S(l.x(A),P,w),_)f.x+=D+d;else if(typeof w.text!="string"){const B=c.lineHeight;f.y+=sg(w,B)+d}else f.y+=v}),jm(this.ctx,e.textDirection)}drawTitle(){const e=this.options,t=e.title,i=je(t.font),s=kt(t.padding);if(!t.display)return;const r=Ci(e.rtl,this.left,this.width),o=this.ctx,a=t.position,l=i.size/2,c=s.top+l;let d,u=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),d=this.top+c,u=Ie(e.align,u,this.right-h);else{const p=this.columnSizes.reduce((m,g)=>Math.max(m,g.height),0);d=c+Ie(e.align,this.top,this.bottom-p-e.labels.padding-this._computeTitleHeight())}const f=Ie(a,u,u+h);o.textAlign=r.textAlign(Tl(a)),o.textBaseline="middle",o.strokeStyle=t.color,o.fillStyle=t.color,o.font=i.string,Ps(o,t.text,f,d,i)}_computeTitleHeight(){const e=this.options.title,t=je(e.font),i=kt(e.padding);return e.display?t.lineHeight+i.height:0}_getLegendItemAt(e,t){let i,s,r;if(sn(e,this.left,this.right)&&sn(t,this.top,this.bottom)){for(r=this.legendHitBoxes,i=0;i<r.length;++i)if(s=r[i],sn(e,s.left,s.left+s.width)&&sn(t,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(e){const t=this.options;if(!vP(e.type,t))return;const i=this._getLegendItemAt(e.x,e.y);if(e.type==="mousemove"||e.type==="mouseout"){const s=this._hoveredItem,r=xP(s,i);s&&!r&&ue(t.onLeave,[e,s,this],this),this._hoveredItem=i,i&&!r&&ue(t.onHover,[e,i,this],this)}else i&&ue(t.onClick,[e,i,this],this)}}function _P(n,e,t,i,s){const r=kP(i,n,e,t),o=wP(s,i,e.lineHeight);return{itemWidth:r,itemHeight:o}}function kP(n,e,t,i){let s=n.text;return s&&typeof s!="string"&&(s=s.reduce((r,o)=>r.length>o.length?r:o)),e+t.size/2+i.measureText(s).width}function wP(n,e,t){let i=n;return typeof e.text!="string"&&(i=sg(e,t)),i}function sg(n,e){const t=n.text?n.text.length:0;return e*t}function vP(n,e){return!!((n==="mousemove"||n==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(n==="click"||n==="mouseup"))}var SP={id:"legend",_element:Au,start(n,e,t){const i=n.legend=new Au({ctx:n.ctx,options:t,chart:n});yt.configure(n,i,t),yt.addBox(n,i)},stop(n){yt.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,e,t){const i=n.legend;yt.configure(n,i,t),i.options=t},afterUpdate(n){const e=n.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(n,e){e.replay||n.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,e,t){const i=e.datasetIndex,s=t.chart;s.isDatasetVisible(i)?(s.hide(i),e.hidden=!0):(s.show(i),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){const e=n.data.datasets,{labels:{usePointStyle:t,pointStyle:i,textAlign:s,color:r,useBorderRadius:o,borderRadius:a}}=n.legend.options;return n._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(t?0:void 0),d=kt(c.borderWidth);return{text:e[l.index].label,fillStyle:c.backgroundColor,fontColor:r,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:o&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}};class rg extends an{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=t;const s=_e(i.text)?i.text.length:1;this._padding=kt(i.padding);const r=s*je(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=r:this.width=r}isHorizontal(){const e=this.options.position;return e==="top"||e==="bottom"}_drawArgs(e){const{top:t,left:i,bottom:s,right:r,options:o}=this,a=o.align;let l=0,c,d,u;return this.isHorizontal()?(d=Ie(a,i,r),u=t+e,c=r-i):(o.position==="left"?(d=i+e,u=Ie(a,s,t),l=ae*-.5):(d=r-e,u=Ie(a,t,s),l=ae*.5),c=s-t),{titleX:d,titleY:u,maxWidth:c,rotation:l}}draw(){const e=this.ctx,t=this.options;if(!t.display)return;const i=je(t.font),r=i.lineHeight/2+this._padding.top,{titleX:o,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(r);Ps(e,t.text,0,0,i,{color:t.color,maxWidth:l,rotation:c,textAlign:Tl(t.align),textBaseline:"middle",translation:[o,a]})}}function MP(n,e){const t=new rg({ctx:n.ctx,options:e,chart:n});yt.configure(n,t,e),yt.addBox(n,t),n.titleBlock=t}var CP={id:"title",_element:rg,start(n,e,t){MP(n,t)},stop(n){const e=n.titleBlock;yt.removeBox(n,e),delete n.titleBlock},beforeUpdate(n,e,t){const i=n.titleBlock;yt.configure(n,i,t),i.options=t},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const ls={average(n){if(!n.length)return!1;let e,t,i=new Set,s=0,r=0;for(e=0,t=n.length;e<t;++e){const a=n[e].element;if(a&&a.hasValue()){const l=a.tooltipPosition();i.add(l.x),s+=l.y,++r}}return r===0||i.size===0?!1:{x:[...i].reduce((a,l)=>a+l)/i.size,y:s/r}},nearest(n,e){if(!n.length)return!1;let t=e.x,i=e.y,s=Number.POSITIVE_INFINITY,r,o,a;for(r=0,o=n.length;r<o;++r){const l=n[r].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),d=Ia(e,c);d<s&&(s=d,a=l)}}if(a){const l=a.tooltipPosition();t=l.x,i=l.y}return{x:t,y:i}}};function It(n,e){return e&&(_e(e)?Array.prototype.push.apply(n,e):n.push(e)),n}function Jt(n){return(typeof n=="string"||n instanceof String)&&n.indexOf(`
|
|
94
94
|
`)>-1?n.split(`
|
|
95
|
-
`):n}function _P(n,e){const{element:t,datasetIndex:s,index:i}=e,r=n.getDatasetMeta(s).controller,{label:o,value:a}=r.getLabelAndValue(i);return{chart:n,label:o,parsed:r.getParsed(i),raw:n.data.datasets[s].data[i],formattedValue:a,dataset:r.getDataset(),dataIndex:i,datasetIndex:s,element:t}}function Eu(n,e){const t=n.chart.ctx,{body:s,footer:i,title:r}=n,{boxWidth:o,boxHeight:a}=e,l=Be(e.bodyFont),c=Be(e.titleFont),d=Be(e.footerFont),u=r.length,h=i.length,f=s.length,p=kt(e.padding);let m=p.height,g=0,b=s.reduce((k,v)=>k+v.before.length+v.lines.length+v.after.length,0);if(b+=n.beforeBody.length+n.afterBody.length,u&&(m+=u*c.lineHeight+(u-1)*e.titleSpacing+e.titleMarginBottom),b){const k=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;m+=f*k+(b-f)*l.lineHeight+(b-1)*e.bodySpacing}h&&(m+=e.footerMarginTop+h*d.lineHeight+(h-1)*e.footerSpacing);let S=0;const _=function(k){g=Math.max(g,t.measureText(k).width+S)};return t.save(),t.font=c.string,oe(n.title,_),t.font=l.string,oe(n.beforeBody.concat(n.afterBody),_),S=e.displayColors?o+2+e.boxPadding:0,oe(s,k=>{oe(k.before,_),oe(k.lines,_),oe(k.after,_)}),S=0,t.font=d.string,oe(n.footer,_),t.restore(),g+=p.width,{width:g,height:m}}function kP(n,e){const{y:t,height:s}=e;return t<s/2?"top":t>n.height-s/2?"bottom":"center"}function wP(n,e,t,s){const{x:i,width:r}=s,o=t.caretSize+t.caretPadding;if(n==="left"&&i+r+o>e.width||n==="right"&&i-r-o<0)return!0}function vP(n,e,t,s){const{x:i,width:r}=t,{width:o,chartArea:{left:a,right:l}}=n;let c="center";return s==="center"?c=i<=(a+l)/2?"left":"right":i<=r/2?c="left":i>=o-r/2&&(c="right"),wP(c,n,e,t)&&(c="center"),c}function Au(n,e,t){const s=t.yAlign||e.yAlign||kP(n,t);return{xAlign:t.xAlign||e.xAlign||vP(n,e,t,s),yAlign:s}}function SP(n,e){let{x:t,width:s}=n;return e==="right"?t-=s:e==="center"&&(t-=s/2),t}function MP(n,e,t){let{y:s,height:i}=n;return e==="top"?s+=t:e==="bottom"?s-=i+t:s-=i/2,s}function Pu(n,e,t,s){const{caretSize:i,caretPadding:r,cornerRadius:o}=n,{xAlign:a,yAlign:l}=t,c=i+r,{topLeft:d,topRight:u,bottomLeft:h,bottomRight:f}=Ss(o);let p=SP(e,a);const m=MP(e,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(d,h)+i:a==="right"&&(p+=Math.max(u,f)+i),{x:Ge(p,0,s.width-e.width),y:Ge(m,0,s.height-e.height)}}function cr(n,e,t){const s=kt(t.padding);return e==="center"?n.x+n.width/2:e==="right"?n.x+n.width-s.right:n.x+s.left}function Iu(n){return Pt([],Ut(n))}function CP(n,e,t){return ls(n,{tooltip:e,tooltipItems:t,type:"tooltip"})}function Ru(n,e){const t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?n.override(t):n}const sg={beforeTitle:qt,title(n){if(n.length>0){const e=n[0],t=e.chart.data.labels,s=t?t.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex<s)return t[e.dataIndex]}return""},afterTitle:qt,beforeBody:qt,beforeLabel:qt,label(n){if(this&&this.options&&this.options.mode==="dataset")return n.label+": "+n.formattedValue||n.formattedValue;let e=n.dataset.label||"";e&&(e+=": ");const t=n.formattedValue;return pe(t)||(e+=t),e},labelColor(n){const t=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(n){const t=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:qt,afterBody:qt,beforeFooter:qt,footer:qt,afterFooter:qt};function Ue(n,e,t,s){const i=n[e].call(t,s);return typeof i>"u"?sg[e].call(t,s):i}class zu extends on{static positioners=oi;constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,s=this.options.setContext(this.getContext()),i=s.enabled&&t.options.animation&&s.animations,r=new Lm(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=CP(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,t){const{callbacks:s}=t,i=Ue(s,"beforeTitle",this,e),r=Ue(s,"title",this,e),o=Ue(s,"afterTitle",this,e);let a=[];return a=Pt(a,Ut(i)),a=Pt(a,Ut(r)),a=Pt(a,Ut(o)),a}getBeforeBody(e,t){return Iu(Ue(t.callbacks,"beforeBody",this,e))}getBody(e,t){const{callbacks:s}=t,i=[];return oe(e,r=>{const o={before:[],lines:[],after:[]},a=Ru(s,r);Pt(o.before,Ut(Ue(a,"beforeLabel",this,r))),Pt(o.lines,Ue(a,"label",this,r)),Pt(o.after,Ut(Ue(a,"afterLabel",this,r))),i.push(o)}),i}getAfterBody(e,t){return Iu(Ue(t.callbacks,"afterBody",this,e))}getFooter(e,t){const{callbacks:s}=t,i=Ue(s,"beforeFooter",this,e),r=Ue(s,"footer",this,e),o=Ue(s,"afterFooter",this,e);let a=[];return a=Pt(a,Ut(i)),a=Pt(a,Ut(r)),a=Pt(a,Ut(o)),a}_createItems(e){const t=this._active,s=this.chart.data,i=[],r=[],o=[];let a=[],l,c;for(l=0,c=t.length;l<c;++l)a.push(_P(this.chart,t[l]));return e.filter&&(a=a.filter((d,u,h)=>e.filter(d,u,h,s))),e.itemSort&&(a=a.sort((d,u)=>e.itemSort(d,u,s))),oe(a,d=>{const u=Ru(e.callbacks,d);i.push(Ue(u,"labelColor",this,d)),r.push(Ue(u,"labelPointStyle",this,d)),o.push(Ue(u,"labelTextColor",this,d))}),this.labelColors=i,this.labelPointStyles=r,this.labelTextColors=o,this.dataPoints=a,a}update(e,t){const s=this.options.setContext(this.getContext()),i=this._active;let r,o=[];if(!i.length)this.opacity!==0&&(r={opacity:0});else{const a=oi[s.position].call(this,i,this._eventPosition);o=this._createItems(s),this.title=this.getTitle(o,s),this.beforeBody=this.getBeforeBody(o,s),this.body=this.getBody(o,s),this.afterBody=this.getAfterBody(o,s),this.footer=this.getFooter(o,s);const l=this._size=Eu(this,s),c=Object.assign({},a,l),d=Au(this.chart,s,c),u=Pu(s,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,r={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,r&&this._resolveAnimations().update(this,r),e&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,s,i){const r=this.getCaretPosition(e,s,i);t.lineTo(r.x1,r.y1),t.lineTo(r.x2,r.y2),t.lineTo(r.x3,r.y3)}getCaretPosition(e,t,s){const{xAlign:i,yAlign:r}=this,{caretSize:o,cornerRadius:a}=s,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:u}=Ss(a),{x:h,y:f}=e,{width:p,height:m}=t;let g,b,S,_,k,v;return r==="center"?(k=f+m/2,i==="left"?(g=h,b=g-o,_=k+o,v=k-o):(g=h+p,b=g+o,_=k-o,v=k+o),S=g):(i==="left"?b=h+Math.max(l,d)+o:i==="right"?b=h+p-Math.max(c,u)-o:b=this.caretX,r==="top"?(_=f,k=_-o,g=b-o,S=b+o):(_=f+m,k=_+o,g=b+o,S=b-o),v=_),{x1:g,x2:b,x3:S,y1:_,y2:k,y3:v}}drawTitle(e,t,s){const i=this.title,r=i.length;let o,a,l;if(r){const c=Ms(s.rtl,this.x,this.width);for(e.x=cr(this,s.titleAlign,s),t.textAlign=c.textAlign(s.titleAlign),t.textBaseline="middle",o=Be(s.titleFont),a=s.titleSpacing,t.fillStyle=s.titleColor,t.font=o.string,l=0;l<r;++l)t.fillText(i[l],c.x(e.x),e.y+o.lineHeight/2),e.y+=o.lineHeight+a,l+1===r&&(e.y+=s.titleMarginBottom-a)}}_drawColorBox(e,t,s,i,r){const o=this.labelColors[s],a=this.labelPointStyles[s],{boxHeight:l,boxWidth:c}=r,d=Be(r.bodyFont),u=cr(this,"left",r),h=i.x(u),f=l<d.lineHeight?(d.lineHeight-l)/2:0,p=t.y+f;if(r.usePointStyle){const m={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},g=i.leftForLtr(h,c)+c/2,b=p+l/2;e.strokeStyle=r.multiKeyBackground,e.fillStyle=r.multiKeyBackground,Ra(e,m,g,b),e.strokeStyle=o.borderColor,e.fillStyle=o.backgroundColor,Ra(e,m,g,b)}else{e.lineWidth=X(o.borderWidth)?Math.max(...Object.values(o.borderWidth)):o.borderWidth||1,e.strokeStyle=o.borderColor,e.setLineDash(o.borderDash||[]),e.lineDashOffset=o.borderDashOffset||0;const m=i.leftForLtr(h,c),g=i.leftForLtr(i.xPlus(h,1),c-2),b=Ss(o.borderRadius);Object.values(b).some(S=>S!==0)?(e.beginPath(),e.fillStyle=r.multiKeyBackground,jr(e,{x:m,y:p,w:c,h:l,radius:b}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),jr(e,{x:g,y:p+1,w:c-2,h:l-2,radius:b}),e.fill()):(e.fillStyle=r.multiKeyBackground,e.fillRect(m,p,c,l),e.strokeRect(m,p,c,l),e.fillStyle=o.backgroundColor,e.fillRect(g,p+1,c-2,l-2))}e.fillStyle=this.labelTextColors[s]}drawBody(e,t,s){const{body:i}=this,{bodySpacing:r,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:d}=s,u=Be(s.bodyFont);let h=u.lineHeight,f=0;const p=Ms(s.rtl,this.x,this.width),m=function(C){t.fillText(C,p.x(e.x+f),e.y+h/2),e.y+=h+r},g=p.textAlign(o);let b,S,_,k,v,w,M;for(t.textAlign=o,t.textBaseline="middle",t.font=u.string,e.x=cr(this,g,s),t.fillStyle=s.bodyColor,oe(this.beforeBody,m),f=a&&g!=="right"?o==="center"?c/2+d:c+2+d:0,k=0,w=i.length;k<w;++k){for(b=i[k],S=this.labelTextColors[k],t.fillStyle=S,oe(b.before,m),_=b.lines,a&&_.length&&(this._drawColorBox(t,e,k,p,s),h=Math.max(u.lineHeight,l)),v=0,M=_.length;v<M;++v)m(_[v]),h=u.lineHeight;oe(b.after,m)}f=0,h=u.lineHeight,oe(this.afterBody,m),e.y-=r}drawFooter(e,t,s){const i=this.footer,r=i.length;let o,a;if(r){const l=Ms(s.rtl,this.x,this.width);for(e.x=cr(this,s.footerAlign,s),e.y+=s.footerMarginTop,t.textAlign=l.textAlign(s.footerAlign),t.textBaseline="middle",o=Be(s.footerFont),t.fillStyle=s.footerColor,t.font=o.string,a=0;a<r;++a)t.fillText(i[a],l.x(e.x),e.y+o.lineHeight/2),e.y+=o.lineHeight+s.footerSpacing}}drawBackground(e,t,s,i){const{xAlign:r,yAlign:o}=this,{x:a,y:l}=e,{width:c,height:d}=s,{topLeft:u,topRight:h,bottomLeft:f,bottomRight:p}=Ss(i.cornerRadius);t.fillStyle=i.backgroundColor,t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.beginPath(),t.moveTo(a+u,l),o==="top"&&this.drawCaret(e,t,s,i),t.lineTo(a+c-h,l),t.quadraticCurveTo(a+c,l,a+c,l+h),o==="center"&&r==="right"&&this.drawCaret(e,t,s,i),t.lineTo(a+c,l+d-p),t.quadraticCurveTo(a+c,l+d,a+c-p,l+d),o==="bottom"&&this.drawCaret(e,t,s,i),t.lineTo(a+f,l+d),t.quadraticCurveTo(a,l+d,a,l+d-f),o==="center"&&r==="left"&&this.drawCaret(e,t,s,i),t.lineTo(a,l+u),t.quadraticCurveTo(a,l,a+u,l),t.closePath(),t.fill(),i.borderWidth>0&&t.stroke()}_updateAnimationTarget(e){const t=this.chart,s=this.$animations,i=s&&s.x,r=s&&s.y;if(i||r){const o=oi[e.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=Eu(this,e),l=Object.assign({},o,this._size),c=Au(t,e,l),d=Pu(e,l,c,t);(i._to!==d.x||r._to!==d.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(e){const t=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(t);const i={width:this.width,height:this.height},r={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const o=kt(t.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&a&&(e.save(),e.globalAlpha=s,this.drawBackground(r,e,i,t),Pm(e,t.textDirection),r.y+=o.top,this.drawTitle(r,e,t),this.drawBody(r,e,t),this.drawFooter(r,e,t),Im(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const s=this._active,i=e.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),r=!Ar(s,i),o=this._positionChanged(i,t);(r||o)&&(this._active=i,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,s=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,r=this._active||[],o=this._getActiveElements(e,r,t,s),a=this._positionChanged(o,e),l=t||!Ar(o,r)||a;return l&&(this._active=o,(i.enabled||i.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),l}_getActiveElements(e,t,s,i){const r=this.options;if(e.type==="mouseout")return[];if(!i)return t.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const o=this.chart.getElementsAtEventForMode(e,r.mode,r,s);return r.reverse&&o.reverse(),o}_positionChanged(e,t){const{caretX:s,caretY:i,options:r}=this,o=oi[r.position].call(this,e,t);return o!==!1&&(s!==o.x||i!==o.y)}}var OP={id:"tooltip",_element:zu,positioners:oi,afterInit(n,e,t){t&&(n.tooltip=new zu({chart:n,options:t}))},beforeUpdate(n,e,t){n.tooltip&&n.tooltip.initialize(t)},reset(n,e,t){n.tooltip&&n.tooltip.initialize(t)},afterDraw(n){const e=n.tooltip;if(e&&e._willRender()){const t={tooltip:e};if(n.notifyPlugins("beforeTooltipDraw",{...t,cancelable:!0})===!1)return;e.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",t)}},afterEvent(n,e){if(n.tooltip){const t=e.replay;n.tooltip.handleEvent(e.event,t,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,e)=>e.bodyFont.size,boxWidth:(n,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:sg},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const DP=(n,e,t,s)=>(typeof e=="string"?(t=n.push(e)-1,s.unshift({index:t,label:e})):isNaN(e)&&(t=null),t);function TP(n,e,t,s){const i=n.indexOf(e);if(i===-1)return DP(n,e,t,s);const r=n.lastIndexOf(e);return i!==r?t:i}const NP=(n,e)=>n===null?null:Ge(Math.round(n),0,e);function Bu(n){const e=this.getLabels();return n>=0&&n<e.length?e[n]:n}class EP extends js{static id="category";static defaults={ticks:{callback:Bu}};constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const t=this._addedLabels;if(t.length){const s=this.getLabels();for(const{index:i,label:r}of t)s[i]===r&&s.splice(i,1);this._addedLabels=[]}super.init(e)}parse(e,t){if(pe(e))return null;const s=this.getLabels();return t=isFinite(t)&&s[t]===e?t:TP(s,e,J(t,e),this._addedLabels),NP(t,s.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let{min:s,max:i}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(s=0),t||(i=this.getLabels().length-1)),this.min=s,this.max=i}buildTicks(){const e=this.min,t=this.max,s=this.options.offset,i=[];let r=this.getLabels();r=e===0&&t===r.length-1?r:r.slice(e,t+1),this._valueRange=Math.max(r.length-(s?0:1),1),this._startValue=this.min-(s?.5:0);for(let o=e;o<=t;o++)i.push({value:o});return i}getLabelForValue(e){return Bu.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!="number"&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}function AP(n,e){const t=[],{bounds:i,step:r,min:o,max:a,precision:l,count:c,maxTicks:d,maxDigits:u,includeBounds:h}=n,f=r||1,p=d-1,{min:m,max:g}=e,b=!pe(o),S=!pe(a),_=!pe(c),k=(g-m)/(u+1);let v=zd((g-m)/p/f)*f,w,M,C,O;if(v<1e-14&&!b&&!S)return[{value:m},{value:g}];O=Math.ceil(g/v)-Math.floor(m/v),O>p&&(v=zd(O*v/p/f)*f),pe(l)||(w=Math.pow(10,l),v=Math.ceil(v*w)/w),i==="ticks"?(M=Math.floor(m/v)*v,C=Math.ceil(g/v)*v):(M=m,C=g),b&&S&&r&&$T((a-o)/r,v/1e3)?(O=Math.round(Math.min((a-o)/v,d)),v=(a-o)/O,M=o,C=a):_?(M=b?o:M,C=S?a:C,O=c-1,v=(C-M)/O):(O=(C-M)/v,hi(O,Math.round(O),v/1e3)?O=Math.round(O):O=Math.ceil(O));const D=Math.max(Bd(v),Bd(M));w=Math.pow(10,pe(l)?D:l),M=Math.round(M*w)/w,C=Math.round(C*w)/w;let A=0;for(b&&(h&&M!==o?(t.push({value:o}),M<o&&A++,hi(Math.round((M+A*v)*w)/w,o,ju(o,k,n))&&A++):M<o&&A++);A<O;++A){const P=Math.round((M+A*v)*w)/w;if(S&&P>a)break;t.push({value:P})}return S&&h&&C!==a?t.length&&hi(t[t.length-1].value,a,ju(a,k,n))?t[t.length-1].value=a:t.push({value:a}):(!S||C===a)&&t.push({value:C}),t}function ju(n,e,{horizontal:t,minRotation:s}){const i=Kn(s),r=(t?Math.sin(i):Math.cos(i))||.001,o=.75*e*(""+n).length;return Math.min(e/r,o)}class PP extends js{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return pe(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:t,maxDefined:s}=this.getUserBounds();let{min:i,max:r}=this;const o=l=>i=t?i:l,a=l=>r=s?r:l;if(e){const l=Ps(i),c=Ps(r);l<0&&c<0?a(0):l>0&&c>0&&o(0)}if(i===r){let l=r===0?1:Math.abs(r*.05);a(r+l),e||o(i-l)}this.min=i,this.max=r}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:t,stepSize:s}=e,i;return s?(i=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),t=t||11),t&&(i=Math.min(t,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,t=e.ticks;let s=this.getTickLimit();s=Math.max(2,s);const i={maxTicks:s,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},r=this._range||this,o=AP(i,r);return e.bounds==="ticks"&&HT(o,this,"value"),e.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const e=this.ticks;let t=this.min,s=this.max;if(super.configure(),this.options.offset&&e.length){const i=(s-t)/Math.max(e.length-1,1)/2;t-=i,s+=i}this._startValue=t,this._endValue=s,this._valueRange=s-t}getLabelForValue(e){return Sm(e,this.chart.options.locale,this.options.ticks.format)}}class IP extends PP{static id="linear";static defaults={ticks:{callback:Mm.formatters.numeric}};determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=Le(e)?e:0,this.max=Le(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),t=e?this.width:this.height,s=Kn(this.options.ticks.minRotation),i=(e?Math.sin(s):Math.cos(s))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,r.lineHeight/i))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}const ho={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Je=Object.keys(ho);function Lu(n,e){return n-e}function Fu(n,e){if(pe(e))return null;const t=n._adapter,{parser:s,round:i,isoWeekday:r}=n._parseOpts;let o=e;return typeof s=="function"&&(o=s(o)),Le(o)||(o=typeof s=="string"?t.parse(o,s):t.parse(o)),o===null?null:(i&&(o=i==="week"&&(Br(r)||r===!0)?t.startOf(o,"isoWeek",r):t.startOf(o,i)),+o)}function Wu(n,e,t,s){const i=Je.length;for(let r=Je.indexOf(n);r<i-1;++r){const o=ho[Je[r]],a=o.steps?o.steps:Number.MAX_SAFE_INTEGER;if(o.common&&Math.ceil((t-e)/(a*o.size))<=s)return Je[r]}return Je[i-1]}function RP(n,e,t,s,i){for(let r=Je.length-1;r>=Je.indexOf(t);r--){const o=Je[r];if(ho[o].common&&n._adapter.diff(i,s,o)>=e-1)return o}return Je[t?Je.indexOf(t):0]}function zP(n){for(let e=Je.indexOf(n)+1,t=Je.length;e<t;++e)if(ho[Je[e]].common)return Je[e]}function $u(n,e,t){if(!t)n[e]=!0;else if(t.length){const{lo:s,hi:i}=Cl(t,e),r=t[s]>=e?t[s]:t[i];n[r]=!0}}function BP(n,e,t,s){const i=n._adapter,r=+i.startOf(e[0].value,s),o=e[e.length-1].value;let a,l;for(a=r;a<=o;a=+i.add(a,1,s))l=t[a],l>=0&&(e[l].major=!0);return e}function Hu(n,e,t){const s=[],i={},r=e.length;let o,a;for(o=0;o<r;++o)a=e[o],i[a]=o,s.push({value:a,major:!1});return r===0||!t?s:BP(n,s,i,t)}class Vu extends js{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,t={}){const s=e.time||(e.time={}),i=this._adapter=new pE._date(e.adapters.date);i.init(t),ui(s.displayFormats,i.formats()),this._parseOpts={parser:s.parser,round:s.round,isoWeekday:s.isoWeekday},super.init(e),this._normalized=t.normalized}parse(e,t){return e===void 0?null:Fu(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,t=this._adapter,s=e.time.unit||"day";let{min:i,max:r,minDefined:o,maxDefined:a}=this.getUserBounds();function l(c){!o&&!isNaN(c.min)&&(i=Math.min(i,c.min)),!a&&!isNaN(c.max)&&(r=Math.max(r,c.max))}(!o||!a)&&(l(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&l(this.getMinMax(!1))),i=Le(i)&&!isNaN(i)?i:+t.startOf(Date.now(),s),r=Le(r)&&!isNaN(r)?r:+t.endOf(Date.now(),s)+1,this.min=Math.min(i,r-1),this.max=Math.max(i+1,r)}_getLabelBounds(){const e=this.getLabelTimestamps();let t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;return e.length&&(t=e[0],s=e[e.length-1]),{min:t,max:s}}buildTicks(){const e=this.options,t=e.time,s=e.ticks,i=s.source==="labels"?this.getLabelTimestamps():this._generate();e.bounds==="ticks"&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);const r=this.min,o=this.max,a=UT(i,r,o);return this._unit=t.unit||(s.autoSkip?Wu(t.minUnit,this.min,this.max,this._getLabelCapacity(r)):RP(this,a.length,t.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:zP(this._unit),this.initOffsets(i),e.reverse&&a.reverse(),Hu(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let t=0,s=0,i,r;this.options.offset&&e.length&&(i=this.getDecimalForValue(e[0]),e.length===1?t=1-i:t=(this.getDecimalForValue(e[1])-i)/2,r=this.getDecimalForValue(e[e.length-1]),e.length===1?s=r:s=(r-this.getDecimalForValue(e[e.length-2]))/2);const o=e.length<3?.5:.25;t=Ge(t,0,o),s=Ge(s,0,o),this._offsets={start:t,end:s,factor:1/(t+1+s)}}_generate(){const e=this._adapter,t=this.min,s=this.max,i=this.options,r=i.time,o=r.unit||Wu(r.minUnit,t,s,this._getLabelCapacity(t)),a=J(i.ticks.stepSize,1),l=o==="week"?r.isoWeekday:!1,c=Br(l)||l===!0,d={};let u=t,h,f;if(c&&(u=+e.startOf(u,"isoWeek",l)),u=+e.startOf(u,c?"day":o),e.diff(s,t,o)>1e5*a)throw new Error(t+" and "+s+" are too far apart with stepSize of "+a+" "+o);const p=i.ticks.source==="data"&&this.getDataTimestamps();for(h=u,f=0;h<s;h=+e.add(h,a,o),f++)$u(d,h,p);return(h===s||i.bounds==="ticks"||f===1)&&$u(d,h,p),Object.keys(d).sort(Lu).map(m=>+m)}getLabelForValue(e){const t=this._adapter,s=this.options.time;return s.tooltipFormat?t.format(e,s.tooltipFormat):t.format(e,s.displayFormats.datetime)}format(e,t){const i=this.options.time.displayFormats,r=this._unit,o=t||i[r];return this._adapter.format(e,o)}_tickFormatFunction(e,t,s,i){const r=this.options,o=r.ticks.callback;if(o)return ue(o,[e,t,s],this);const a=r.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&a[l],u=c&&a[c],h=s[t],f=c&&u&&h&&h.major;return this._adapter.format(e,i||(f?u:d))}generateTickLabels(e){let t,s,i;for(t=0,s=e.length;t<s;++t)i=e[t],i.label=this._tickFormatFunction(i.value,t,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const t=this._offsets,s=this.getDecimalForValue(e);return this.getPixelForDecimal((t.start+s)*t.factor)}getValueForPixel(e){const t=this._offsets,s=this.getDecimalForPixel(e)/t.factor-t.end;return this.min+s*(this.max-this.min)}_getLabelSize(e){const t=this.options.ticks,s=this.ctx.measureText(e).width,i=Kn(this.isHorizontal()?t.maxRotation:t.minRotation),r=Math.cos(i),o=Math.sin(i),a=this._resolveTickFontOptions(0).size;return{w:s*r+a*o,h:s*o+a*r}}_getLabelCapacity(e){const t=this.options.time,s=t.displayFormats,i=s[t.unit]||s.millisecond,r=this._tickFormatFunction(e,0,Hu(this,[e],this._majorUnit),i),o=this._getLabelSize(r),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let e=this._cache.data||[],t,s;if(e.length)return e;const i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(t=0,s=i.length;t<s;++t)e=e.concat(i[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){const e=this._cache.labels||[];let t,s;if(e.length)return e;const i=this.getLabels();for(t=0,s=i.length;t<s;++t)e.push(Fu(this,i[t]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return GT(e.sort(Lu))}}function dr(n,e,t){let s=0,i=n.length-1,r,o,a,l;t?(e>=n[s].pos&&e<=n[i].pos&&({lo:s,hi:i}=Pa(n,"pos",e)),{pos:r,time:a}=n[s],{pos:o,time:l}=n[i]):(e>=n[s].time&&e<=n[i].time&&({lo:s,hi:i}=Pa(n,"time",e)),{time:r,pos:a}=n[s],{time:o,pos:l}=n[i]);const c=o-r;return c?a+(l-a)*(e-r)/c:a}class UP extends Vu{static id="timeseries";static defaults=Vu.defaults;constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=dr(t,this.min),this._tableRange=dr(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:t,max:s}=this,i=[],r=[];let o,a,l,c,d;for(o=0,a=e.length;o<a;++o)c=e[o],c>=t&&c<=s&&i.push(c);if(i.length<2)return[{time:t,pos:0},{time:s,pos:1}];for(o=0,a=i.length;o<a;++o)d=i[o+1],l=i[o-1],c=i[o],Math.round((d+l)/2)!==c&&r.push({time:c,pos:o/(a-1)});return r}_generate(){const e=this.min,t=this.max;let s=super.getDataTimestamps();return(!s.includes(e)||!s.length)&&s.splice(0,0,e),(!s.includes(t)||s.length===1)&&s.push(t),s.sort((i,r)=>i-r)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const t=this.getDataTimestamps(),s=this.getLabelTimestamps();return t.length&&s.length?e=this.normalize(t.concat(s)):e=t.length?t:s,e=this._cache.all=e,e}getDecimalForValue(e){return(dr(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const t=this._offsets,s=this.getDecimalForPixel(e)/t.factor-t.end;return dr(this._table,s*this._tableRange+this._minPos,!0)}}const ig="label";function Yu(n,e){typeof n=="function"?n(e):n&&(n.current=e)}function jP(n,e){const t=n.options;t&&e&&Object.assign(t,e)}function rg(n,e){n.labels=e}function og(n,e,t=ig){const s=[];n.datasets=e.map(i=>{const r=n.datasets.find(o=>o[t]===i[t]);return!r||!i.data||s.includes(r)?{...i}:(s.push(r),Object.assign(r,i),r)})}function LP(n,e=ig){const t={labels:[],datasets:[]};return rg(t,n.labels),og(t,n.datasets,e),t}function FP(n,e){const{height:t=150,width:s=300,redraw:i=!1,datasetIdKey:r,type:o,data:a,options:l,plugins:c=[],fallbackContent:d,updateMode:u,...h}=n,f=x.useRef(null),p=x.useRef(null),m=()=>{f.current&&(p.current=new zl(f.current,{type:o,data:LP(a,r),options:l&&{...l},plugins:c}),Yu(e,p.current))},g=()=>{Yu(e,null),p.current&&(p.current.destroy(),p.current=null)};return x.useEffect(()=>{!i&&p.current&&l&&jP(p.current,l)},[i,l]),x.useEffect(()=>{!i&&p.current&&rg(p.current.config.data,a.labels)},[i,a.labels]),x.useEffect(()=>{!i&&p.current&&a.datasets&&og(p.current.config.data,a.datasets,r)},[i,a.datasets]),x.useEffect(()=>{p.current&&(i?(g(),setTimeout(m)):p.current.update(u))},[i,l,a.labels,a.datasets,u]),x.useEffect(()=>{p.current&&(g(),setTimeout(m))},[o]),x.useEffect(()=>(m(),()=>g()),[]),y.jsx("canvas",{ref:f,role:"img",height:t,width:s,...h,children:d})}const WP=x.forwardRef(FP),$P="_chart_1ndua_1",HP="_header_1ndua_9",VP="_title_1ndua_15",YP="_description_1ndua_23",qP="_canvas_1ndua_30",Qs={chart:$P,header:HP,title:VP,description:YP,canvas:qP};zl.register(EP,IP,LA,co,YA,TA,xP,OP,yP,uP);const ag=x.forwardRef(({type:n,data:e,options:t,title:s,description:i,height:r,width:o,className:a,id:l},c)=>{const d={responsive:!0,maintainAspectRatio:r===void 0,plugins:{legend:{position:"bottom",labels:{font:{family:"var(--font-family-sans, inherit)",size:12},color:"var(--color-text-secondary)",padding:16,usePointStyle:!0,pointStyleWidth:8}},tooltip:{backgroundColor:"var(--color-background-bg-primary, #fff)",borderColor:"var(--color-neutral-200)",borderWidth:1,titleColor:"var(--color-text-primary)",bodyColor:"var(--color-text-secondary)",padding:12,cornerRadius:8}},scales:n==="pie"||n==="doughnut"?{}:{x:{grid:{color:"var(--color-neutral-100)"},ticks:{color:"var(--color-text-secondary)",font:{family:"var(--font-family-sans, inherit)",size:12}},border:{color:"var(--color-neutral-200)"}},y:{grid:{color:"var(--color-neutral-100)"},ticks:{color:"var(--color-text-secondary)",font:{family:"var(--font-family-sans, inherit)",size:12}},border:{color:"var(--color-neutral-200)"}}},...t};return y.jsxs("div",{ref:c,id:l,className:N(Qs.chart,a),style:{height:r?`${r}px`:void 0,width:o?`${o}px`:void 0},children:[(s||i)&&y.jsxs("div",{className:Qs.header,children:[s&&y.jsx("p",{className:Qs.title,children:s}),i&&y.jsx("p",{className:Qs.description,children:i})]}),y.jsx("div",{className:Qs.canvas,children:y.jsx(WP,{type:n,data:e,options:d,"aria-label":s??"Chart",role:"img"})})]})});ag.displayName="Chart";exports.Accordion=Mh;exports.AccordionContent=Dh;exports.AccordionItem=Ch;exports.AccordionTrigger=Oh;exports.Alert=nh;exports.Avatar=oh;exports.AvatarGroup=ah;exports.Badge=th;exports.Breadcrumbs=Nh;exports.Button=Uu;exports.Card=fh;exports.CardBody=mh;exports.CardFooter=gh;exports.CardHeader=ph;exports.CardImage=yh;exports.Carousel=Wh;exports.Chart=ag;exports.Checkbox=Qu;exports.DatePicker=Sf;exports.EmptyState=Lh;exports.FileUpload=Fh;exports.FormField=eh;exports.IconButton=Ju;exports.Input=Gu;exports.List=jh;exports.ListItem=Bh;exports.Modal=xh;exports.ModalActions=_h;exports.MultiSelect=zh;exports.Notification=Wa;exports.NotificationProvider=Nb;exports.Pagination=bh;exports.ProgressBar=Ah;exports.RichTextEditor=pm;exports.Select=Rh;exports.Skeleton=ih;exports.Slider=Ph;exports.Spinner=sh;exports.Stepper=Eh;exports.Switch=Zu;exports.Tab=uh;exports.TabList=dh;exports.TabPanel=hh;exports.Table=Vb;exports.Tabs=ch;exports.Tag=Ih;exports.Textarea=Xu;exports.Tooltip=rh;exports.useNotification=Db;
|
|
95
|
+
`):n}function OP(n,e){const{element:t,datasetIndex:i,index:s}=e,r=n.getDatasetMeta(i).controller,{label:o,value:a}=r.getLabelAndValue(s);return{chart:n,label:o,parsed:r.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:a,dataset:r.getDataset(),dataIndex:s,datasetIndex:i,element:t}}function Pu(n,e){const t=n.chart.ctx,{body:i,footer:s,title:r}=n,{boxWidth:o,boxHeight:a}=e,l=je(e.bodyFont),c=je(e.titleFont),d=je(e.footerFont),u=r.length,h=s.length,f=i.length,p=kt(e.padding);let m=p.height,g=0,y=i.reduce((k,v)=>k+v.before.length+v.lines.length+v.after.length,0);if(y+=n.beforeBody.length+n.afterBody.length,u&&(m+=u*c.lineHeight+(u-1)*e.titleSpacing+e.titleMarginBottom),y){const k=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;m+=f*k+(y-f)*l.lineHeight+(y-1)*e.bodySpacing}h&&(m+=e.footerMarginTop+h*d.lineHeight+(h-1)*e.footerSpacing);let S=0;const _=function(k){g=Math.max(g,t.measureText(k).width+S)};return t.save(),t.font=c.string,re(n.title,_),t.font=l.string,re(n.beforeBody.concat(n.afterBody),_),S=e.displayColors?o+2+e.boxPadding:0,re(i,k=>{re(k.before,_),re(k.lines,_),re(k.after,_)}),S=0,t.font=d.string,re(n.footer,_),t.restore(),g+=p.width,{width:g,height:m}}function DP(n,e){const{y:t,height:i}=e;return t<i/2?"top":t>n.height-i/2?"bottom":"center"}function TP(n,e,t,i){const{x:s,width:r}=i,o=t.caretSize+t.caretPadding;if(n==="left"&&s+r+o>e.width||n==="right"&&s-r-o<0)return!0}function NP(n,e,t,i){const{x:s,width:r}=t,{width:o,chartArea:{left:a,right:l}}=n;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=r/2?c="left":s>=o-r/2&&(c="right"),TP(c,n,e,t)&&(c="center"),c}function Iu(n,e,t){const i=t.yAlign||e.yAlign||DP(n,t);return{xAlign:t.xAlign||e.xAlign||NP(n,e,t,i),yAlign:i}}function EP(n,e){let{x:t,width:i}=n;return e==="right"?t-=i:e==="center"&&(t-=i/2),t}function AP(n,e,t){let{y:i,height:s}=n;return e==="top"?i+=t:e==="bottom"?i-=s+t:i-=s/2,i}function Ru(n,e,t,i){const{caretSize:s,caretPadding:r,cornerRadius:o}=n,{xAlign:a,yAlign:l}=t,c=s+r,{topLeft:d,topRight:u,bottomLeft:h,bottomRight:f}=Mi(o);let p=EP(e,a);const m=AP(e,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(d,h)+s:a==="right"&&(p+=Math.max(u,f)+s),{x:Ge(p,0,i.width-e.width),y:Ge(m,0,i.height-e.height)}}function ur(n,e,t){const i=kt(t.padding);return e==="center"?n.x+n.width/2:e==="right"?n.x+n.width-i.right:n.x+i.left}function zu(n){return It([],Jt(n))}function PP(n,e,t){return li(n,{tooltip:e,tooltipItems:t,type:"tooltip"})}function ju(n,e){const t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?n.override(t):n}const og={beforeTitle:Kt,title(n){if(n.length>0){const e=n[0],t=e.chart.data.labels,i=t?t.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(i>0&&e.dataIndex<i)return t[e.dataIndex]}return""},afterTitle:Kt,beforeBody:Kt,beforeLabel:Kt,label(n){if(this&&this.options&&this.options.mode==="dataset")return n.label+": "+n.formattedValue||n.formattedValue;let e=n.dataset.label||"";e&&(e+=": ");const t=n.formattedValue;return pe(t)||(e+=t),e},labelColor(n){const t=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(n){const t=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:Kt,afterBody:Kt,beforeFooter:Kt,footer:Kt,afterFooter:Kt};function Ue(n,e,t,i){const s=n[e].call(t,i);return typeof s>"u"?og[e].call(t,i):s}class Bu extends an{static positioners=ls;constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&t.options.animation&&i.animations,r=new $m(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=PP(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,t){const{callbacks:i}=t,s=Ue(i,"beforeTitle",this,e),r=Ue(i,"title",this,e),o=Ue(i,"afterTitle",this,e);let a=[];return a=It(a,Jt(s)),a=It(a,Jt(r)),a=It(a,Jt(o)),a}getBeforeBody(e,t){return zu(Ue(t.callbacks,"beforeBody",this,e))}getBody(e,t){const{callbacks:i}=t,s=[];return re(e,r=>{const o={before:[],lines:[],after:[]},a=ju(i,r);It(o.before,Jt(Ue(a,"beforeLabel",this,r))),It(o.lines,Ue(a,"label",this,r)),It(o.after,Jt(Ue(a,"afterLabel",this,r))),s.push(o)}),s}getAfterBody(e,t){return zu(Ue(t.callbacks,"afterBody",this,e))}getFooter(e,t){const{callbacks:i}=t,s=Ue(i,"beforeFooter",this,e),r=Ue(i,"footer",this,e),o=Ue(i,"afterFooter",this,e);let a=[];return a=It(a,Jt(s)),a=It(a,Jt(r)),a=It(a,Jt(o)),a}_createItems(e){const t=this._active,i=this.chart.data,s=[],r=[],o=[];let a=[],l,c;for(l=0,c=t.length;l<c;++l)a.push(OP(this.chart,t[l]));return e.filter&&(a=a.filter((d,u,h)=>e.filter(d,u,h,i))),e.itemSort&&(a=a.sort((d,u)=>e.itemSort(d,u,i))),re(a,d=>{const u=ju(e.callbacks,d);s.push(Ue(u,"labelColor",this,d)),r.push(Ue(u,"labelPointStyle",this,d)),o.push(Ue(u,"labelTextColor",this,d))}),this.labelColors=s,this.labelPointStyles=r,this.labelTextColors=o,this.dataPoints=a,a}update(e,t){const i=this.options.setContext(this.getContext()),s=this._active;let r,o=[];if(!s.length)this.opacity!==0&&(r={opacity:0});else{const a=ls[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const l=this._size=Pu(this,i),c=Object.assign({},a,l),d=Iu(this.chart,i,c),u=Ru(i,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,r={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,r&&this._resolveAnimations().update(this,r),e&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,i,s){const r=this.getCaretPosition(e,i,s);t.lineTo(r.x1,r.y1),t.lineTo(r.x2,r.y2),t.lineTo(r.x3,r.y3)}getCaretPosition(e,t,i){const{xAlign:s,yAlign:r}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:u}=Mi(a),{x:h,y:f}=e,{width:p,height:m}=t;let g,y,S,_,k,v;return r==="center"?(k=f+m/2,s==="left"?(g=h,y=g-o,_=k+o,v=k-o):(g=h+p,y=g+o,_=k-o,v=k+o),S=g):(s==="left"?y=h+Math.max(l,d)+o:s==="right"?y=h+p-Math.max(c,u)-o:y=this.caretX,r==="top"?(_=f,k=_-o,g=y-o,S=y+o):(_=f+m,k=_+o,g=y+o,S=y-o),v=_),{x1:g,x2:y,x3:S,y1:_,y2:k,y3:v}}drawTitle(e,t,i){const s=this.title,r=s.length;let o,a,l;if(r){const c=Ci(i.rtl,this.x,this.width);for(e.x=ur(this,i.titleAlign,i),t.textAlign=c.textAlign(i.titleAlign),t.textBaseline="middle",o=je(i.titleFont),a=i.titleSpacing,t.fillStyle=i.titleColor,t.font=o.string,l=0;l<r;++l)t.fillText(s[l],c.x(e.x),e.y+o.lineHeight/2),e.y+=o.lineHeight+a,l+1===r&&(e.y+=i.titleMarginBottom-a)}}_drawColorBox(e,t,i,s,r){const o=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=r,d=je(r.bodyFont),u=ur(this,"left",r),h=s.x(u),f=l<d.lineHeight?(d.lineHeight-l)/2:0,p=t.y+f;if(r.usePointStyle){const m={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},g=s.leftForLtr(h,c)+c/2,y=p+l/2;e.strokeStyle=r.multiKeyBackground,e.fillStyle=r.multiKeyBackground,ja(e,m,g,y),e.strokeStyle=o.borderColor,e.fillStyle=o.backgroundColor,ja(e,m,g,y)}else{e.lineWidth=X(o.borderWidth)?Math.max(...Object.values(o.borderWidth)):o.borderWidth||1,e.strokeStyle=o.borderColor,e.setLineDash(o.borderDash||[]),e.lineDashOffset=o.borderDashOffset||0;const m=s.leftForLtr(h,c),g=s.leftForLtr(s.xPlus(h,1),c-2),y=Mi(o.borderRadius);Object.values(y).some(S=>S!==0)?(e.beginPath(),e.fillStyle=r.multiKeyBackground,Fr(e,{x:m,y:p,w:c,h:l,radius:y}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),Fr(e,{x:g,y:p+1,w:c-2,h:l-2,radius:y}),e.fill()):(e.fillStyle=r.multiKeyBackground,e.fillRect(m,p,c,l),e.strokeRect(m,p,c,l),e.fillStyle=o.backgroundColor,e.fillRect(g,p+1,c-2,l-2))}e.fillStyle=this.labelTextColors[i]}drawBody(e,t,i){const{body:s}=this,{bodySpacing:r,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:d}=i,u=je(i.bodyFont);let h=u.lineHeight,f=0;const p=Ci(i.rtl,this.x,this.width),m=function(C){t.fillText(C,p.x(e.x+f),e.y+h/2),e.y+=h+r},g=p.textAlign(o);let y,S,_,k,v,w,M;for(t.textAlign=o,t.textBaseline="middle",t.font=u.string,e.x=ur(this,g,i),t.fillStyle=i.bodyColor,re(this.beforeBody,m),f=a&&g!=="right"?o==="center"?c/2+d:c+2+d:0,k=0,w=s.length;k<w;++k){for(y=s[k],S=this.labelTextColors[k],t.fillStyle=S,re(y.before,m),_=y.lines,a&&_.length&&(this._drawColorBox(t,e,k,p,i),h=Math.max(u.lineHeight,l)),v=0,M=_.length;v<M;++v)m(_[v]),h=u.lineHeight;re(y.after,m)}f=0,h=u.lineHeight,re(this.afterBody,m),e.y-=r}drawFooter(e,t,i){const s=this.footer,r=s.length;let o,a;if(r){const l=Ci(i.rtl,this.x,this.width);for(e.x=ur(this,i.footerAlign,i),e.y+=i.footerMarginTop,t.textAlign=l.textAlign(i.footerAlign),t.textBaseline="middle",o=je(i.footerFont),t.fillStyle=i.footerColor,t.font=o.string,a=0;a<r;++a)t.fillText(s[a],l.x(e.x),e.y+o.lineHeight/2),e.y+=o.lineHeight+i.footerSpacing}}drawBackground(e,t,i,s){const{xAlign:r,yAlign:o}=this,{x:a,y:l}=e,{width:c,height:d}=i,{topLeft:u,topRight:h,bottomLeft:f,bottomRight:p}=Mi(s.cornerRadius);t.fillStyle=s.backgroundColor,t.strokeStyle=s.borderColor,t.lineWidth=s.borderWidth,t.beginPath(),t.moveTo(a+u,l),o==="top"&&this.drawCaret(e,t,i,s),t.lineTo(a+c-h,l),t.quadraticCurveTo(a+c,l,a+c,l+h),o==="center"&&r==="right"&&this.drawCaret(e,t,i,s),t.lineTo(a+c,l+d-p),t.quadraticCurveTo(a+c,l+d,a+c-p,l+d),o==="bottom"&&this.drawCaret(e,t,i,s),t.lineTo(a+f,l+d),t.quadraticCurveTo(a,l+d,a,l+d-f),o==="center"&&r==="left"&&this.drawCaret(e,t,i,s),t.lineTo(a,l+u),t.quadraticCurveTo(a,l,a+u,l),t.closePath(),t.fill(),s.borderWidth>0&&t.stroke()}_updateAnimationTarget(e){const t=this.chart,i=this.$animations,s=i&&i.x,r=i&&i.y;if(s||r){const o=ls[e.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=Pu(this,e),l=Object.assign({},o,this._size),c=Iu(t,e,l),d=Ru(e,l,c,t);(s._to!==d.x||r._to!==d.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(e){const t=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(t);const s={width:this.width,height:this.height},r={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=kt(t.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&a&&(e.save(),e.globalAlpha=i,this.drawBackground(r,e,s,t),zm(e,t.textDirection),r.y+=o.top,this.drawTitle(r,e,t),this.drawBody(r,e,t),this.drawFooter(r,e,t),jm(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const i=this._active,s=e.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),r=!Ir(i,s),o=this._positionChanged(s,t);(r||o)&&(this._active=s,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,i=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,r=this._active||[],o=this._getActiveElements(e,r,t,i),a=this._positionChanged(o,e),l=t||!Ir(o,r)||a;return l&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),l}_getActiveElements(e,t,i,s){const r=this.options;if(e.type==="mouseout")return[];if(!s)return t.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const o=this.chart.getElementsAtEventForMode(e,r.mode,r,i);return r.reverse&&o.reverse(),o}_positionChanged(e,t){const{caretX:i,caretY:s,options:r}=this,o=ls[r.position].call(this,e,t);return o!==!1&&(i!==o.x||s!==o.y)}}var IP={id:"tooltip",_element:Bu,positioners:ls,afterInit(n,e,t){t&&(n.tooltip=new Bu({chart:n,options:t}))},beforeUpdate(n,e,t){n.tooltip&&n.tooltip.initialize(t)},reset(n,e,t){n.tooltip&&n.tooltip.initialize(t)},afterDraw(n){const e=n.tooltip;if(e&&e._willRender()){const t={tooltip:e};if(n.notifyPlugins("beforeTooltipDraw",{...t,cancelable:!0})===!1)return;e.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",t)}},afterEvent(n,e){if(n.tooltip){const t=e.replay;n.tooltip.handleEvent(e.event,t,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,e)=>e.bodyFont.size,boxWidth:(n,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:og},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const RP=(n,e,t,i)=>(typeof e=="string"?(t=n.push(e)-1,i.unshift({index:t,label:e})):isNaN(e)&&(t=null),t);function zP(n,e,t,i){const s=n.indexOf(e);if(s===-1)return RP(n,e,t,i);const r=n.lastIndexOf(e);return s!==r?t:s}const jP=(n,e)=>n===null?null:Ge(Math.round(n),0,e);function Lu(n){const e=this.getLabels();return n>=0&&n<e.length?e[n]:n}class BP extends Li{static id="category";static defaults={ticks:{callback:Lu}};constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const t=this._addedLabels;if(t.length){const i=this.getLabels();for(const{index:s,label:r}of t)i[s]===r&&i.splice(s,1);this._addedLabels=[]}super.init(e)}parse(e,t){if(pe(e))return null;const i=this.getLabels();return t=isFinite(t)&&i[t]===e?t:zP(i,e,J(t,e),this._addedLabels),jP(t,i.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(i=0),t||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const e=this.min,t=this.max,i=this.options.offset,s=[];let r=this.getLabels();r=e===0&&t===r.length-1?r:r.slice(e,t+1),this._valueRange=Math.max(r.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let o=e;o<=t;o++)s.push({value:o});return s}getLabelForValue(e){return Lu.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!="number"&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}function LP(n,e){const t=[],{bounds:s,step:r,min:o,max:a,precision:l,count:c,maxTicks:d,maxDigits:u,includeBounds:h}=n,f=r||1,p=d-1,{min:m,max:g}=e,y=!pe(o),S=!pe(a),_=!pe(c),k=(g-m)/(u+1);let v=Bd((g-m)/p/f)*f,w,M,C,O;if(v<1e-14&&!y&&!S)return[{value:m},{value:g}];O=Math.ceil(g/v)-Math.floor(m/v),O>p&&(v=Bd(O*v/p/f)*f),pe(l)||(w=Math.pow(10,l),v=Math.ceil(v*w)/w),s==="ticks"?(M=Math.floor(m/v)*v,C=Math.ceil(g/v)*v):(M=m,C=g),y&&S&&r&&JT((a-o)/r,v/1e3)?(O=Math.round(Math.min((a-o)/v,d)),v=(a-o)/O,M=o,C=a):_?(M=y?o:M,C=S?a:C,O=c-1,v=(C-M)/O):(O=(C-M)/v,ps(O,Math.round(O),v/1e3)?O=Math.round(O):O=Math.ceil(O));const D=Math.max(Ld(v),Ld(M));w=Math.pow(10,pe(l)?D:l),M=Math.round(M*w)/w,C=Math.round(C*w)/w;let A=0;for(y&&(h&&M!==o?(t.push({value:o}),M<o&&A++,ps(Math.round((M+A*v)*w)/w,o,Fu(o,k,n))&&A++):M<o&&A++);A<O;++A){const P=Math.round((M+A*v)*w)/w;if(S&&P>a)break;t.push({value:P})}return S&&h&&C!==a?t.length&&ps(t[t.length-1].value,a,Fu(a,k,n))?t[t.length-1].value=a:t.push({value:a}):(!S||C===a)&&t.push({value:C}),t}function Fu(n,e,{horizontal:t,minRotation:i}){const s=Un(i),r=(t?Math.sin(s):Math.cos(s))||.001,o=.75*e*(""+n).length;return Math.min(e/r,o)}class FP extends Li{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return pe(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:t,maxDefined:i}=this.getUserBounds();let{min:s,max:r}=this;const o=l=>s=t?s:l,a=l=>r=i?r:l;if(e){const l=Ii(s),c=Ii(r);l<0&&c<0?a(0):l>0&&c>0&&o(0)}if(s===r){let l=r===0?1:Math.abs(r*.05);a(r+l),e||o(s-l)}this.min=s,this.max=r}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:t,stepSize:i}=e,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),t=t||11),t&&(s=Math.min(t,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,t=e.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},r=this._range||this,o=LP(s,r);return e.bounds==="ticks"&>(o,this,"value"),e.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const e=this.ticks;let t=this.min,i=this.max;if(super.configure(),this.options.offset&&e.length){const s=(i-t)/Math.max(e.length-1,1)/2;t-=s,i+=s}this._startValue=t,this._endValue=i,this._valueRange=i-t}getLabelForValue(e){return Om(e,this.chart.options.locale,this.options.ticks.format)}}class WP extends FP{static id="linear";static defaults={ticks:{callback:Dm.formatters.numeric}};determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=Le(e)?e:0,this.max=Le(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),t=e?this.width:this.height,i=Un(this.options.ticks.minRotation),s=(e?Math.sin(i):Math.cos(i))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,r.lineHeight/s))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}const po={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Je=Object.keys(po);function Wu(n,e){return n-e}function $u(n,e){if(pe(e))return null;const t=n._adapter,{parser:i,round:s,isoWeekday:r}=n._parseOpts;let o=e;return typeof i=="function"&&(o=i(o)),Le(o)||(o=typeof i=="string"?t.parse(o,i):t.parse(o)),o===null?null:(s&&(o=s==="week"&&(Lr(r)||r===!0)?t.startOf(o,"isoWeek",r):t.startOf(o,s)),+o)}function Hu(n,e,t,i){const s=Je.length;for(let r=Je.indexOf(n);r<s-1;++r){const o=po[Je[r]],a=o.steps?o.steps:Number.MAX_SAFE_INTEGER;if(o.common&&Math.ceil((t-e)/(a*o.size))<=i)return Je[r]}return Je[s-1]}function $P(n,e,t,i,s){for(let r=Je.length-1;r>=Je.indexOf(t);r--){const o=Je[r];if(po[o].common&&n._adapter.diff(s,i,o)>=e-1)return o}return Je[t?Je.indexOf(t):0]}function HP(n){for(let e=Je.indexOf(n)+1,t=Je.length;e<t;++e)if(po[Je[e]].common)return Je[e]}function Vu(n,e,t){if(!t)n[e]=!0;else if(t.length){const{lo:i,hi:s}=Dl(t,e),r=t[i]>=e?t[i]:t[s];n[r]=!0}}function VP(n,e,t,i){const s=n._adapter,r=+s.startOf(e[0].value,i),o=e[e.length-1].value;let a,l;for(a=r;a<=o;a=+s.add(a,1,i))l=t[a],l>=0&&(e[l].major=!0);return e}function Yu(n,e,t){const i=[],s={},r=e.length;let o,a;for(o=0;o<r;++o)a=e[o],s[a]=o,i.push({value:a,major:!1});return r===0||!t?i:VP(n,i,s,t)}class qu extends Li{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,t={}){const i=e.time||(e.time={}),s=this._adapter=new kE._date(e.adapters.date);s.init(t),fs(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(e),this._normalized=t.normalized}parse(e,t){return e===void 0?null:$u(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,t=this._adapter,i=e.time.unit||"day";let{min:s,max:r,minDefined:o,maxDefined:a}=this.getUserBounds();function l(c){!o&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!a&&!isNaN(c.max)&&(r=Math.max(r,c.max))}(!o||!a)&&(l(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=Le(s)&&!isNaN(s)?s:+t.startOf(Date.now(),i),r=Le(r)&&!isNaN(r)?r:+t.endOf(Date.now(),i)+1,this.min=Math.min(s,r-1),this.max=Math.max(s+1,r)}_getLabelBounds(){const e=this.getLabelTimestamps();let t=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return e.length&&(t=e[0],i=e[e.length-1]),{min:t,max:i}}buildTicks(){const e=this.options,t=e.time,i=e.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();e.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const r=this.min,o=this.max,a=tN(s,r,o);return this._unit=t.unit||(i.autoSkip?Hu(t.minUnit,this.min,this.max,this._getLabelCapacity(r)):$P(this,a.length,t.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:HP(this._unit),this.initOffsets(s),e.reverse&&a.reverse(),Yu(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let t=0,i=0,s,r;this.options.offset&&e.length&&(s=this.getDecimalForValue(e[0]),e.length===1?t=1-s:t=(this.getDecimalForValue(e[1])-s)/2,r=this.getDecimalForValue(e[e.length-1]),e.length===1?i=r:i=(r-this.getDecimalForValue(e[e.length-2]))/2);const o=e.length<3?.5:.25;t=Ge(t,0,o),i=Ge(i,0,o),this._offsets={start:t,end:i,factor:1/(t+1+i)}}_generate(){const e=this._adapter,t=this.min,i=this.max,s=this.options,r=s.time,o=r.unit||Hu(r.minUnit,t,i,this._getLabelCapacity(t)),a=J(s.ticks.stepSize,1),l=o==="week"?r.isoWeekday:!1,c=Lr(l)||l===!0,d={};let u=t,h,f;if(c&&(u=+e.startOf(u,"isoWeek",l)),u=+e.startOf(u,c?"day":o),e.diff(i,t,o)>1e5*a)throw new Error(t+" and "+i+" are too far apart with stepSize of "+a+" "+o);const p=s.ticks.source==="data"&&this.getDataTimestamps();for(h=u,f=0;h<i;h=+e.add(h,a,o),f++)Vu(d,h,p);return(h===i||s.bounds==="ticks"||f===1)&&Vu(d,h,p),Object.keys(d).sort(Wu).map(m=>+m)}getLabelForValue(e){const t=this._adapter,i=this.options.time;return i.tooltipFormat?t.format(e,i.tooltipFormat):t.format(e,i.displayFormats.datetime)}format(e,t){const s=this.options.time.displayFormats,r=this._unit,o=t||s[r];return this._adapter.format(e,o)}_tickFormatFunction(e,t,i,s){const r=this.options,o=r.ticks.callback;if(o)return ue(o,[e,t,i],this);const a=r.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&a[l],u=c&&a[c],h=i[t],f=c&&u&&h&&h.major;return this._adapter.format(e,s||(f?u:d))}generateTickLabels(e){let t,i,s;for(t=0,i=e.length;t<i;++t)s=e[t],s.label=this._tickFormatFunction(s.value,t,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const t=this._offsets,i=this.getDecimalForValue(e);return this.getPixelForDecimal((t.start+i)*t.factor)}getValueForPixel(e){const t=this._offsets,i=this.getDecimalForPixel(e)/t.factor-t.end;return this.min+i*(this.max-this.min)}_getLabelSize(e){const t=this.options.ticks,i=this.ctx.measureText(e).width,s=Un(this.isHorizontal()?t.maxRotation:t.minRotation),r=Math.cos(s),o=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*r+a*o,h:i*o+a*r}}_getLabelCapacity(e){const t=this.options.time,i=t.displayFormats,s=i[t.unit]||i.millisecond,r=this._tickFormatFunction(e,0,Yu(this,[e],this._majorUnit),s),o=this._getLabelSize(r),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let e=this._cache.data||[],t,i;if(e.length)return e;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,i=s.length;t<i;++t)e=e.concat(s[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){const e=this._cache.labels||[];let t,i;if(e.length)return e;const s=this.getLabels();for(t=0,i=s.length;t<i;++t)e.push($u(this,s[t]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return iN(e.sort(Wu))}}function hr(n,e,t){let i=0,s=n.length-1,r,o,a,l;t?(e>=n[i].pos&&e<=n[s].pos&&({lo:i,hi:s}=Ra(n,"pos",e)),{pos:r,time:a}=n[i],{pos:o,time:l}=n[s]):(e>=n[i].time&&e<=n[s].time&&({lo:i,hi:s}=Ra(n,"time",e)),{time:r,pos:a}=n[i],{time:o,pos:l}=n[s]);const c=o-r;return c?a+(l-a)*(e-r)/c:a}class tI extends qu{static id="timeseries";static defaults=qu.defaults;constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=hr(t,this.min),this._tableRange=hr(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:t,max:i}=this,s=[],r=[];let o,a,l,c,d;for(o=0,a=e.length;o<a;++o)c=e[o],c>=t&&c<=i&&s.push(c);if(s.length<2)return[{time:t,pos:0},{time:i,pos:1}];for(o=0,a=s.length;o<a;++o)d=s[o+1],l=s[o-1],c=s[o],Math.round((d+l)/2)!==c&&r.push({time:c,pos:o/(a-1)});return r}_generate(){const e=this.min,t=this.max;let i=super.getDataTimestamps();return(!i.includes(e)||!i.length)&&i.splice(0,0,e),(!i.includes(t)||i.length===1)&&i.push(t),i.sort((s,r)=>s-r)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const t=this.getDataTimestamps(),i=this.getLabelTimestamps();return t.length&&i.length?e=this.normalize(t.concat(i)):e=t.length?t:i,e=this._cache.all=e,e}getDecimalForValue(e){return(hr(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const t=this._offsets,i=this.getDecimalForPixel(e)/t.factor-t.end;return hr(this._table,i*this._tableRange+this._minPos,!0)}}const ag="label";function Ku(n,e){typeof n=="function"?n(e):n&&(n.current=e)}function YP(n,e){const t=n.options;t&&e&&Object.assign(t,e)}function lg(n,e){n.labels=e}function cg(n,e,t=ag){const i=[];n.datasets=e.map(s=>{const r=n.datasets.find(o=>o[t]===s[t]);return!r||!s.data||i.includes(r)?{...s}:(i.push(r),Object.assign(r,s),r)})}function qP(n,e=ag){const t={labels:[],datasets:[]};return lg(t,n.labels),cg(t,n.datasets,e),t}function KP(n,e){const{height:t=150,width:i=300,redraw:s=!1,datasetIdKey:r,type:o,data:a,options:l,plugins:c=[],fallbackContent:d,updateMode:u,...h}=n,f=x.useRef(null),p=x.useRef(null),m=()=>{f.current&&(p.current=new Bl(f.current,{type:o,data:qP(a,r),options:l&&{...l},plugins:c}),Ku(e,p.current))},g=()=>{Ku(e,null),p.current&&(p.current.destroy(),p.current=null)};return x.useEffect(()=>{!s&&p.current&&l&&YP(p.current,l)},[s,l]),x.useEffect(()=>{!s&&p.current&&lg(p.current.config.data,a.labels)},[s,a.labels]),x.useEffect(()=>{!s&&p.current&&a.datasets&&cg(p.current.config.data,a.datasets,r)},[s,a.datasets]),x.useEffect(()=>{p.current&&(s?(g(),setTimeout(m)):p.current.update(u))},[s,l,a.labels,a.datasets,u]),x.useEffect(()=>{p.current&&(g(),setTimeout(m))},[o]),x.useEffect(()=>(m(),()=>g()),[]),b.jsx("canvas",{ref:f,role:"img",height:t,width:i,...h,children:d})}const UP=x.forwardRef(KP),JP="_chart_lq28t_1",GP="_header_lq28t_9",XP="_title_lq28t_15",QP="_description_lq28t_23",ZP="_canvas_lq28t_30",Zi={chart:JP,header:GP,title:XP,description:QP,canvas:ZP};Bl.register(BP,WP,qA,ho,QA,zA,CP,IP,SP,yP);const Ct={gridLine:"#f0f0f3",border:"#d5d7da",textPrimary:"#181d27",textSecondary:"#717680",tooltipBg:"#ffffff"},dg=x.forwardRef(({type:n,data:e,options:t,title:i,description:s,height:r,width:o,className:a,id:l},c)=>{const d=n==="pie"||n==="doughnut",u={responsive:!0,maintainAspectRatio:r===void 0,plugins:{legend:{position:"bottom",labels:{font:{family:"inherit",size:12},color:Ct.textSecondary,padding:16,usePointStyle:!0,pointStyle:"circle",boxWidth:8,boxHeight:8}},tooltip:{backgroundColor:Ct.tooltipBg,borderColor:Ct.border,borderWidth:1,titleColor:Ct.textPrimary,bodyColor:Ct.textSecondary,padding:12,cornerRadius:8}},scales:d?{}:{x:{grid:{color:Ct.gridLine},ticks:{color:Ct.textSecondary,font:{family:"inherit",size:12}},border:{color:Ct.border}},y:{grid:{color:Ct.gridLine},ticks:{color:Ct.textSecondary,font:{family:"inherit",size:12}},border:{color:Ct.border}}},...t};return b.jsxs("div",{ref:c,id:l,className:N(Zi.chart,a),style:{width:o?`${o}px`:"100%",height:r?`${r}px`:void 0},children:[(i||s)&&b.jsxs("div",{className:Zi.header,children:[i&&b.jsx("p",{className:Zi.title,children:i}),s&&b.jsx("p",{className:Zi.description,children:s})]}),b.jsx("div",{className:Zi.canvas,children:b.jsx(UP,{type:n,data:e,options:u,"aria-label":i??"Chart",role:"img"})})]})});dg.displayName="Chart";exports.Accordion=Dh;exports.AccordionContent=Eh;exports.AccordionItem=Th;exports.AccordionTrigger=Nh;exports.Alert=rh;exports.Avatar=ch;exports.AvatarGroup=dh;exports.Badge=sh;exports.Breadcrumbs=Ph;exports.Button=Gu;exports.Card=gh;exports.CardBody=yh;exports.CardFooter=xh;exports.CardHeader=bh;exports.CardImage=_h;exports.Carousel=Vh;exports.Chart=dg;exports.Checkbox=th;exports.DangerButton=Xu;exports.DatePicker=Of;exports.EmptyState=$h;exports.FileUpload=Hh;exports.FormField=ih;exports.IconButton=Qu;exports.Input=Zu;exports.List=Wh;exports.ListItem=Fh;exports.Modal=wh;exports.ModalActions=vh;exports.MultiSelect=Lh;exports.Notification=Ha;exports.NotificationProvider=jy;exports.Pagination=kh;exports.ProgressBar=Rh;exports.RichTextEditor=bm;exports.Select=Bh;exports.Skeleton=ah;exports.Slider=zh;exports.Spinner=oh;exports.Stepper=Ih;exports.Switch=nh;exports.Tab=ph;exports.TabList=fh;exports.TabPanel=mh;exports.Table=Xy;exports.Tabs=hh;exports.Tag=jh;exports.Textarea=eh;exports.Tooltip=lh;exports.useNotification=Ry;
|