Sid Gifari File Manager
🏠 Root
/
home
/
genremedia08
/
musicjukebox.overlookedtracks.com
/
public
/
build
/
assets
/
Editing: admin-routes-ee547daf.js
import{u as fe,j as n,c as T,C as Fu,T as d,a as D,r as j,N as zu,I as N,s as Ru,O as hr,b as Ge,D as z,d as Zs,$ as Ks,e as Va,m as g,f as _u,g as ft,R as _,h as Bu,S as Mn,i as v,k as Ki,A as xs,l as Vu,n as $u,K as mr,o as js,p as P,F as G,q as C,t as te,v as ne,w as re,x as ie,y as X,z as ce,B as Ji,E as w,G as Qt,H as pr,J as le,L as Es,M as it,P as gn,Q as bl,U as Js,V as $,W as F,X as H,Y as oe,Z as O,_ as lt,a0 as fr,a1 as gr,a2 as ge,a3 as Y,a4 as Gn,a5 as fi,a6 as he,a7 as We,a8 as Qe,a9 as Yt,aa as gt,ab as Hu,ac as yl,ad as vl,ae as qu,af as Nn,ag as I,ah as Gi,ai as Qi,aj as Cl,ak as kl,al as Uu,am as Wu,an as Zu,ao as Xt,ap as Yi,aq as Ku,ar as Ju,as as wl,at as ks,au as Gs,av as Xi,aw as _e,ax as xe,ay as Sl,az as ea,aA as Qs,aB as Ot,aC as xr,aD as Ln,aE as Tn,aF as Ml,aG as cn,aH as Gu,aI as Qu,aJ as ta,aK as Yu,aL as Xu,aM as eh,aN as th,aO as sh,aP as nh,aQ as es,aR as rh,aS as ih,aT as ah,aU as oh,aV as lh,aW as sa,aX as ch,aY as dh,aZ as Nl,a_ as na,a$ as uh,b0 as hh,b1 as An,b2 as In,b3 as mh,b4 as ph,b5 as fh,b6 as gh,b7 as xh,b8 as Ll,b9 as jh,ba as bh,bb as yh,bc as vh,bd as Ch,be as kh,bf as Tl,bg as wh,bh as je,bi as Sh}from"./main-1406e08c.js";import{D as Mh,a as Nh,b as Lh,c as Th,h as Ah,d as Qn,N as mt,u as Ih,F as Eh,s as Dh,U as Pt,M as Al,e as Xe,f as Oh,I as Il,P as Ph,T as Ys,C as El,g as ra,i as Fh,j as zh,k as Rh,E as _h,G as Bh,l as Vh,m as $h,n as Hh,o as qh,p as Uh,q as Wh}from"./TrendingUp-bcf21998.js";import{u as Zh,D as Kh,a as Jh,b as Gh,c as $a,A as Qh,d as ia,F as aa,e as En,f as Dl,g as Yh,h as Ol,i as ee,j as gi,k as Pl,C as Xh,l as em,m as ts,n as tm,I as Fl,o as jr,p as sm,q as nm,r as rm,s as im,t as _n,B as am,L as om,P as lm,G as cm,R as dm,v as um,w as hm,U as mm,x as pm,y as fm,z as gm,E as xm,H as jm,J as bm,K as ym,M as vm,N as Cm}from"./backstage-track-insights-d08cc66a.js";import{K as oa,a as br,F as kt,A as zl,T as Rl,b as at,c as E,C as km,S as xi,$ as _l,u as la,d as Ha,t as wm,D as Bl,m as Sm,e as yr,f as vr,g as Tt,h as Cr,i as At,j as Xs,k as kr,G as ca,l as Mm,n as Vl,o as $l,p as Hl,q as Nm,r as Lm,s as ql,U as Ul}from"./play-arrow-filled-8e87b0ae.js";import{E as Ee}from"./Edit-4fa321e0.js";import{B as Tm,a as qa,C as Am,u as Wl,b as Im}from"./use-resume-subscription-b3c8abe5.js";function Em({className:t,isCompactMode:e}){const{version:s}=fe();return n.jsxs("div",{className:T(t,"text-sm pt-26 px-12 pb-16 text-muted font-medium bg-alt flex flex-col gap-20 border-r overflow-y-auto relative"),children:[n.jsx(Fu,{matchDescendants:r=>r==="/admin",menu:"admin-sidebar",orientation:"vertical",onlyShowIcons:e,itemClassName:({isActive:r})=>T("block w-full rounded py-12 px-16 border-l-4",r?"bg-primary/hover border-l-primary":"border-l-transparent hover:bg-hover"),gap:"gap-8"}),!e&&n.jsx("div",{className:"mt-auto gap-14 px-16 text-xs",children:n.jsx(d,{message:"Version: :number",values:{number:s}})})]})}const Dm=D(n.jsx("path",{d:"M3 18h13v-2H3v2zm0-5h10v-2H3v2zm0-7v2h13V6H3zm18 9.59L17.42 12 21 8.41 19.59 7l-5 5 5 5L21 15.59z"}),"MenuOpenOutlined");function Om({children:t,className:e,hideToggleButton:s,...r}){const{isMobileMode:i,leftSidenavStatus:a,setLeftSidenavStatus:o,name:l,leftSidenavCanBeCompact:c}=j.useContext(Mh),u=c&&!i,h=!s&&(i||c),m=()=>{o(a==="open"?"closed":"open")},p=()=>{const f=a==="compact"?"open":"compact";Ru(`${l}.sidenav.compact`,f==="compact"),o(f)};return n.jsx(zu,{className:T("dashboard-grid-navbar",e),border:"border-b",size:"sm",color:"primary",darkModeColor:"bg-alt",toggleButton:h?n.jsx(N,{size:"md",onClick:()=>{u?p():m()},children:n.jsx(Dm,{})}):void 0,...r,children:t})}function Pm(){return n.jsxs(Nh,{name:"admin",leftSidenavCanBeCompact:!0,children:[n.jsx(Om,{size:"sm",color:"primary",menuPosition:"admin-navbar"}),n.jsx(Lh,{position:"left",size:"sm",children:n.jsx(Em,{})}),n.jsx(Th,{children:n.jsx("div",{className:"bg dark:bg-alt",children:n.jsx(hr,{})})})]})}var V=(t=>(t.Select="select",t.DateRangePicker="dateRangePicker",t.SelectModel="selectModel",t.Input="input",t.BooleanToggle="booleanToggle",t.ChipField="chipField",t.Custom="custom",t))(V||{}),q=(t=>(t.eq="=",t.ne="!=",t.gt=">",t.gte=">=",t.lt="<",t.lte="<=",t.has="has",t.hasAll="hasAll",t.doesntHave="doesntHave",t.between="between",t))(q||{});const Rs=["=","!=",">",">=","<","<="];function Fm(t){var p,f;const{granularity:e,closeDialogOnSelection:s,...r}=t,i=Zh(t),a=j.useRef(null),l=Ge()&&e!=="day",c=n.jsx(z,{offset:8,placement:"bottom-start",isOpen:i.calendarIsOpen,onOpenChange:i.setCalendarIsOpen,type:"popover",triggerRef:a,returnFocusToTrigger:!1,moveFocusToDialog:!1,children:n.jsx(Kh,{state:i})}),u={onClick:x=>{x.stopPropagation(),x.preventDefault(),zm(x)?i.setCalendarIsOpen(!1):i.setCalendarIsOpen(!0)}},h=i.selectedValue,m=i.setSelectedValue;return n.jsxs(j.Fragment,{children:[n.jsxs(Jh,{ref:a,wrapperProps:u,endAdornment:l?void 0:n.jsx(Gh,{}),...r,children:[n.jsx($a,{isPlaceholder:(p=i.isPlaceholder)==null?void 0:p.start,state:i,segmentProps:u,value:h.start,onChange:x=>{m({start:x,end:h.end})}}),n.jsx(Qh,{className:"block flex-shrink-0 text-muted",size:"md"}),n.jsx($a,{isPlaceholder:(f=i.isPlaceholder)==null?void 0:f.end,state:i,segmentProps:u,value:h.end,onChange:x=>{m({start:h.start,end:x})}})]}),c]})}function zm(t){return["hour","minute","dayPeriod"].includes(t.currentTarget.ariaLabel||"")}function Rm(t){const{field:{onChange:e,onBlur:s,value:r,ref:i},fieldState:{invalid:a,error:o}}=Zs({name:t.name}),l={onChange:c=>{e(c?Zl(c):null)},onBlur:s,value:_m(r),invalid:a,errorMessage:o==null?void 0:o.message,inputRef:i};return n.jsx(Fm,{...Ks(l,t)})}function _m(t){const{start:e,end:s,preset:r}=t||{},i={preset:r};try{e&&(i.start=typeof e=="string"?Va(e):e),s&&(i.end=typeof s=="string"?Va(s):s)}catch{}return i}function Zl({start:t,end:e,preset:s}={}){const r={preset:s};return t&&(r.start=t.toAbsoluteString()),e&&(r.end=e.toAbsoluteString()),r}function da(t){var e;return{...t,defaultOperator:q.between,control:{type:V.DateRangePicker,defaultValue:((e=t.control)==null?void 0:e.defaultValue)||Zl(ia[3].getRangeValue())}}}function Be(t){return da({key:"created_at",label:g("Date created"),...t})}function Ve(t){return da({key:"updated_at",label:g("Last updated"),...t})}const Bm=[{key:"email_verified_at",label:g("Email"),description:g("Email verification status"),defaultOperator:q.ne,control:{type:V.Select,defaultValue:"01",options:[{key:"01",label:g("is confirmed"),value:{value:null,operator:q.ne}},{key:"02",label:g("is not confirmed"),value:{value:null,operator:q.eq}}]}},Be({description:g("Date user registered or was created")}),Ve({description:g("Date user was last updated")}),{key:"subscriptions",label:g("Subscription"),description:g("Whether user is subscribed or not"),defaultOperator:q.eq,control:{type:V.Select,defaultValue:"01",options:[{key:"01",label:g("is subscribed"),value:{value:"*",operator:q.has}},{key:"02",label:g("is not subscribed"),value:{value:"*",operator:q.doesntHave}}]}}],Wn="filters";function Vm(t){if(!t)return[];let e=[];try{e=JSON.parse(atob(decodeURIComponent(t))),e.map(s=>(s.valueKey!=null&&(s.value=s.valueKey),s))}catch{}return e}function $m(t,e){return!t||(t=e?t.filter(s=>s.value!=="").map(s=>Hm(s,e)):t,t=t.filter(s=>!s.isInactive),!t.length)?"":encodeURIComponent(btoa(JSON.stringify(t)))}function Hm(t,e){var r;const s=e.find(i=>i.key===t.key);if((s==null?void 0:s.control.type)==="select"){const i=(s.control.options||[]).find(a=>a.key===t.value);if(i)return{...t,value:i.value,valueKey:i.key}}return(r=s==null?void 0:s.extraFilters)!=null&&r.length&&(t.extraFilters=s.extraFilters),t}function Dn(t,e){const[s]=_u(),r=ft(),i=s.get(Wn),a=j.useMemo(()=>{if(!t)return[];const h=Vm(i);return(e||[]).forEach(m=>{if(!h.find(p=>p.key===m)){const p=t.find(f=>f.key===m);h.push({key:m,value:p.control.defaultValue,operator:p.defaultOperator,isInactive:!0})}}),h.sort((m,p)=>t.findIndex(f=>f.key===m.key)-t.findIndex(f=>f.key===p.key)),h},[i,e,t]),o=j.useCallback(h=>{const m=[...a];return h.forEach(p=>{const f=typeof p=="object"?p.key:p,x=m.findIndex(b=>b.key===f);x>-1&&m.splice(x,1)}),m},[a]),l=j.useCallback(h=>{const m=$m(h,t);m?s.set(Wn,m):s.delete(Wn),r({search:`?${s}`},{replace:!0})},[t,r,s]),c=j.useCallback(h=>{const p=[...o(h),...h];l(p)},[o,l]),u=j.useCallback(h=>l(o([h])),[o,l]);return{add:c,remove:u,replaceAll:l,decodedFilters:a,encodedFilters:i}}const Kl=_.createContext(null);function ua(){return j.useContext(Kl)}const qm=15,Um=[{key:10},{key:15},{key:20},{key:50},{key:100}];function Jl({query:t,onPerPageChange:e,onPageChange:s,className:r}){var c;const i=Ge(),a=Bu(),o=(c=t.data)==null?void 0:c.pagination;if(!o)return null;const l=n.jsx(Mn,{minWidth:"min-w-auto",selectionMode:"single",disabled:t.isLoading,labelPosition:"side",size:"xs",label:n.jsx(d,{message:"Items per page"}),selectedValue:o.per_page||qm,onSelectionChange:u=>{e==null||e(u)},children:Um.map(u=>n.jsx(v,{value:u.key,children:u.key},u.key))});return n.jsxs("div",{className:T("flex items-center justify-end gap-20 px-20 h-54 select-none",r),children:[!i&&l,o.from&&o.to&&"total"in o&&n.jsx("div",{className:"text-sm",children:n.jsx(d,{message:":from - :to of :total",values:{from:o.from,to:o.to,total:a.format(o.total)}})}),n.jsxs("div",{className:"text-muted",children:[n.jsx(N,{disabled:t.isFetching||o.current_page<2,onClick:()=>{s==null||s((o==null?void 0:o.current_page)-1)},children:n.jsx(oa,{})}),n.jsx(N,{disabled:t.isFetching||!Ah(o),onClick:()=>{s==null||s((o==null?void 0:o.current_page)+1)},children:n.jsx(br,{})})]})]})}const Wm=D(n.jsx("path",{d:"M7 6h10l-5.01 6.3L7 6zm-2.75-.39C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39c.51-.66.04-1.61-.79-1.61H5.04c-.83 0-1.3.95-.79 1.61z"}),"FilterAltOutlined"),ss=_.forwardRef(({variant:t="default",mode:e="single",children:s,className:r,isLazy:i,...a},o)=>{const[l,c]=Ki(a.expandedValues,a.defaultExpandedValues||[],a.onExpandedChange);return n.jsx("div",{className:T(t==="outline"&&"space-y-10",r),ref:o,role:"presentation",children:n.jsx(xs,{children:n.jsx(Vu,{children:_.Children.map(s,(u,h)=>j.isValidElement(u)?j.cloneElement(u,{key:u.key||h,value:u.props.value||h,mode:e,variant:t,expandedValues:l,setExpandedValues:c,isLazy:i}):null)})})})});function nt({children:t,label:e,disabled:s,bodyClassName:r,labelClassName:i,startIcon:a,description:o,endAppend:l,chevronPosition:c="right",dataTestId:u,...h}){const{expandedValues:m,setExpandedValues:p,variant:f,value:x,mode:b,isLazy:y}=h,k=j.useRef(null),M=!s&&m.includes(x),R=j.useRef(!1);M&&(R.current=!0);const Q=$u(),W=j.useId(),pe=`${W}-button`,de=`${W}-panel`,U=Rn=>{switch(Rn.key){case"ArrowDown":Q.focusNext();break;case"ArrowUp":Q.focusPrevious();break;case"Home":Q.focusFirst();break;case"End":Q.focusLast();break}},qe={open:{height:"auto",visibility:"visible",transitionEnd:{overflow:"auto"}},closed:{height:0,overflow:"hidden",transitionEnd:{visibility:"hidden"}}},zt=()=>{const Rn=m.indexOf(x);if(Rn>-1){const Ba=[...m];Ba.splice(Rn,1),p(Ba)}else p(b==="single"?[x]:[...m,x])},Ye=n.jsx("div",{className:T(f==="minimal"&&""),children:n.jsx(mr,{"aria-hidden":"true",size:"md",className:T(s?"text-disabled":"text-muted",M&&"rotate-180 transition-transform")})});return n.jsxs("div",{className:T(f==="default"&&"border-b",f==="outline"&&"border rounded",s&&"text-disabled"),children:[n.jsxs("h3",{className:T("flex items-center text-sm justify-between w-full",s&&"pointer-events-none",M&&f!=="minimal"?"border-b":"border-b border-b-transparent",f==="outline"?M?"rounded-t":"rounded":void 0),children:[n.jsxs("button",{"data-testid":u,disabled:s,"aria-expanded":M,id:pe,"aria-controls":de,type:"button",ref:k,onKeyDown:U,onClick:()=>{s||zt()},className:"flex items-center text-left gap-10 flex-auto py-10 outline-none pl-14 pr-10 hover:bg-hover focus-visible:bg-primary/focus",children:[c==="left"&&Ye,a&&j.cloneElement(a,{size:"md",className:T(a.props.className,s?"text-disabled":"text-muted")}),n.jsxs("div",{className:"flex-auto overflow-hidden overflow-ellipsis",children:[n.jsx("div",{className:i,"data-testid":"accordion-label",children:e}),o&&n.jsx("div",{className:"text-muted text-xs",children:o})]}),c==="right"&&Ye]}),l&&n.jsx("div",{className:"flex-shrink-0 text-sm text-muted px-4",children:l})]}),n.jsx(js.div,{"aria-labelledby":W,role:"region",variants:qe,transition:{type:"tween",duration:.2},initial:!1,animate:M?"open":"closed",children:n.jsx("div",{className:T("p-16",r),children:!y||R?t:null})})]})}function Gl({filter:t}){const{trans:e}=P();return n.jsx(G,{size:"sm",name:`${t.key}.value`,selectionMode:"single",showSearchField:t.control.showSearchField,placeholder:t.control.placeholder?e(t.control.placeholder):void 0,searchPlaceholder:t.control.searchPlaceholder?e(t.control.searchPlaceholder):void 0,children:t.control.options.map(s=>n.jsx(v,{value:s.key,children:n.jsx(d,{...s.label})},s.key))})}function Ql({filter:t}){return n.jsx(Rm,{min:t.control.min,max:t.control.max,size:"sm",name:`${t.key}.value`,granularity:"day",closeDialogOnSelection:!0})}function Yl({filter:t}){return n.jsx(aa,{name:`${t.key}.value`,modelType:t.control.model,openMenuOnFocus:!0})}const Xl={"=":g("is"),"!=":g("is not"),">":g("is greater than"),">=":g("is greater than or equal to"),"<":g("is less than"),"<=":g("is less than or equal to"),has:g("Include"),doesntHave:g("Do not include"),between:g("Is between"),hasAll:g("Include all")};function ec({filter:t}){var s;const e=t.control;return n.jsxs(j.Fragment,{children:[n.jsx(G,{selectionMode:"single",name:`${t.key}.operator`,className:"mb-14",size:"sm",required:!0,children:(s=t.operators)==null?void 0:s.map(r=>n.jsx(v,{value:r,children:n.jsx(d,{...Xl[r]})},r))}),n.jsx(C,{size:"sm",name:`${t.key}.value`,type:t.control.inputType,min:"minValue"in e?e.minValue:void 0,max:"maxValue"in e?e.maxValue:void 0,minLength:"minLength"in e?e.minLength:void 0,maxLength:"maxLength"in e?e.maxLength:void 0,required:!0})]})}function Zm({filter:t}){return null}function tc({filter:t}){const{trans:e}=P();return n.jsx(En,{size:"sm",name:`${t.key}.value`,valueKey:"id",allowCustomValue:!1,showDropdownArrow:!0,placeholder:t.control.placeholder?e(t.control.placeholder):void 0,displayWith:s=>{var r;return(r=t.control.options.find(i=>i.key===s.id))==null?void 0:r.label.message},suggestions:t.control.options.map(s=>({id:s.key,name:s.label.message})),children:s=>n.jsx(v,{value:s.id,children:n.jsx(d,{message:s.name})},s.id)})}function Km({filters:t}){const{decodedFilters:e}=Dn(t),{formId:s}=te(),[r,i]=j.useState(()=>e.map(l=>l.key)),a=n.jsx(w,{size:"xs",variant:"outline",className:"mr-auto",onClick:()=>{i([])},children:n.jsx(d,{message:"Clear"})}),o=n.jsx(w,{size:"xs",variant:"flat",color:"primary",className:"ml-auto",type:"submit",form:s,children:n.jsx(d,{message:"Apply"})});return n.jsxs(ne,{className:"min-w-[300px]",maxWidth:"max-w-400",size:"auto",children:[n.jsx(re,{padding:"px-14 py-10",leftAdornment:a,rightAdornment:o,children:n.jsx(d,{message:"Filter"})}),n.jsx(ie,{padding:"p-0",children:n.jsx(Jm,{filters:t,expandedFilters:r,setExpandedFilters:i})})]})}function Jm({filters:t,expandedFilters:e,setExpandedFilters:s}){const{decodedFilters:r,replaceAll:i}=Dn(t),a={};t.forEach(u=>{const h=r.find(m=>m.key===u.key);a[u.key]=(h==null?void 0:h.value)!==void 0?h:{value:u.control.defaultValue,operator:u.defaultOperator}});const o=X({defaultValues:a}),{formId:l,close:c}=te();return n.jsx(ce,{form:o,id:l,onSubmit:u=>{const h=Object.entries(u).filter(([m,p])=>e.includes(m)&&p!==void 0).map(([m,p])=>({key:m,...p}));i(h),c()},children:n.jsx(ss,{mode:"multiple",expandedValues:e,onExpandedChange:s,children:t.map(u=>n.jsxs(nt,{dataTestId:`filter-${u.key}-toggle`,startIcon:n.jsx(Ji,{checked:e.includes(u.key)}),value:u.key,label:n.jsx(d,{...u.label}),bodyClassName:"max-h-288 overflow-y-auto compact-scrollbar",children:[u.description&&n.jsx("div",{className:T("text-muted text-xs",u.control.type!==V.BooleanToggle&&"mb-14"),children:n.jsx(d,{...u.description})}),n.jsx(Gm,{filter:u})]},u.key))})})}function Gm({filter:t}){switch(t.control.type){case V.Select:return n.jsx(Gl,{filter:t});case V.ChipField:return n.jsx(tc,{filter:t});case V.DateRangePicker:return n.jsx(Ql,{filter:t});case V.SelectModel:return n.jsx(Yl,{filter:t});case V.Input:return n.jsx(ec,{filter:t});case V.BooleanToggle:return n.jsx(Zm,{filter:t});case"custom":const e=t.control.panel;return n.jsx(e,{filter:t});default:return null}}function Qm({filters:t,icon:e=n.jsx(Wm,{}),color:s="primary",variant:r="outline",size:i="sm",disabled:a}){const o=Ge(),l=n.jsx(w,{variant:r,color:s,startIcon:e,disabled:a,size:i,children:n.jsx(d,{message:"Filter"})}),c=n.jsx(N,{color:s,size:"sm",variant:r,disabled:a,radius:"rounded",children:e});return n.jsxs(z,{type:"popover",children:[o?c:l,n.jsx(Km,{filters:t})]})}function sc({actions:t,filters:e,filtersLoading:s,searchPlaceholder:r=g("Type to search..."),searchValue:i="",onSearchChange:a}){const{trans:o}=P();return n.jsxs(nc,{children:[n.jsx(Qt,{inputTestId:"datatable-search",className:"flex-auto max-w-440 mr-auto",inputWrapperClassName:"mr-24 md:mr-0",placeholder:o(r),startAdornment:n.jsx(pr,{}),value:i,onChange:l=>{a(l.target.value)}}),e&&n.jsx(Qm,{filters:e,disabled:s}),t]})}function nc({children:t,...e}){return n.jsx("div",{className:"mb-24 flex items-center gap-8 md:gap-12 text-muted relative h-42",...e,children:t})}const rc=j.forwardRef((t,e)=>{const{isInactive:s,filter:r,...i}=t;return s?n.jsx(Ym,{filter:r,...i,ref:e}):n.jsx(Xm,{filter:r,...i,ref:e})}),Ym=j.forwardRef(({filter:t,...e},s)=>n.jsx(w,{variant:"outline",size:"xs",color:"paper",radius:"rounded-md",border:"border",ref:s,endIcon:n.jsx(mr,{}),...e,children:n.jsx(d,{...t.label})})),Xm=j.forwardRef(({filter:t,children:e,...s},r)=>{const i=t.control.type===V.BooleanToggle;return n.jsxs(w,{variant:"outline",size:"xs",color:"primary",radius:"rounded-r-md",border:"border-y border-r",endIcon:!i&&n.jsx(mr,{}),ref:r,...s,children:[n.jsx("span",{className:T(!i&&"border-r border-r-primary-light mr-8 pr-8"),children:n.jsx(d,{...t.label})}),e]})});function On(t){const{onValueChange:e,isInactive:s,filter:r,label:i}=t;return n.jsxs(z,{offset:10,type:"popover",onClose:a=>{a!==void 0&&e(a)},children:[n.jsx(rc,{isInactive:s,filter:r,children:i}),n.jsx(ep,{...t})]})}function ep({filter:t,panel:e,value:s,operator:r}){const i=X({defaultValues:{[t.key]:{value:s,operator:r}}}),{close:a,formId:o}=te();return n.jsxs(ne,{size:"xs",children:[n.jsx(re,{children:n.jsx(d,{...t.label})}),n.jsx(ie,{padding:"px-14 pt-14 pb-4 max-h-288",children:n.jsxs(ce,{form:i,id:o,onSubmit:l=>{a(l[t.key])},children:[t.description&&n.jsx("div",{className:"text-muted text-xs mb-14",children:n.jsx(d,{...t.description})}),e]})}),n.jsx(le,{children:n.jsx(w,{form:o,type:"submit",variant:"flat",color:"primary",size:"xs",children:n.jsx(d,{message:"Apply"})})})]})}function tp(t){switch(t.filter.control.type){case V.DateRangePicker:return n.jsx(sp,{...t});case V.BooleanToggle:return n.jsx(np,{...t});case V.Select:return n.jsx(rp,{...t});case V.ChipField:return n.jsx(ip,{...t});case V.Input:return n.jsx(op,{...t});case V.SelectModel:return n.jsx(lp,{...t});case V.Custom:const e=t.filter.control.listItem;return n.jsx(e,{...t});default:return null}}function sp(t){const{value:e,filter:s}=t;let r;return e.preset!==void 0?r=n.jsx(d,{...ia[e.preset].label}):r=n.jsx(Dl,{start:new Date(e.start),end:new Date(e.end),options:{dateStyle:"medium"}}),n.jsx(On,{...t,label:r,panel:n.jsx(Ql,{filter:s})})}function np({filter:t,isInactive:e,onValueChange:s}){return n.jsx(rc,{onClick:()=>{s({value:t.control.defaultValue})},filter:t,isInactive:e})}function rp(t){const{filter:e,value:s}=t,r=e.control.options.find(i=>i.key===s);return n.jsx(On,{...t,label:r?n.jsx(d,{...r.label}):null,panel:n.jsx(Gl,{filter:e})})}function ip(t){return n.jsx(On,{...t,label:n.jsx(ap,{...t}),panel:n.jsx(tc,{filter:t.filter})})}function ap(t){const{trans:e}=P(),{filter:s,value:r}=t,i=r.map(c=>s.control.options.find(u=>u.key===c)),a=3,o=r.length-a,l=n.jsx(j.Fragment,{children:i.filter(Boolean).slice(0,a).map((c,u)=>{let h="";return u!==0&&(h+=", "),h+=e(c.label),h})});return o>0?n.jsx(d,{message:":names + :count more",values:{names:l,count:o}}):l}function op(t){const{filter:e,value:s,operator:r}=t,i=r?n.jsx(d,{...Xl[r]}):null,a=e.control.inputType==="number"?n.jsx(kt,{value:s}):s;return n.jsx(On,{...t,label:n.jsxs(j.Fragment,{children:[i," ",a]}),panel:n.jsx(ec,{filter:e})})}function lp(t){const{value:e,filter:s}=t,{isLoading:r,data:i}=Yh(s.control.model,e),a=n.jsxs(j.Fragment,{children:[n.jsx(Es,{variant:"avatar",size:"w-18 h-18 mr-6"}),n.jsx(Es,{variant:"rect",size:"w-50"})]}),o=n.jsxs(j.Fragment,{children:[n.jsx(zl,{size:"xs",src:i==null?void 0:i.model.image,className:"mr-6"}),i==null?void 0:i.model.name]}),l=r||!i?a:o;return n.jsx(On,{...t,label:l,panel:n.jsx(Yl,{filter:s})})}function ic({filters:t,pinnedFilters:e,className:s}){const{decodedFilters:r,remove:i,replaceAll:a}=Dn(t,e);return r.length?n.jsx("div",{className:T("flex items-center gap-6 overflow-x-auto",s),children:r.map((o,l)=>{const c=t.find(h=>h.key===o.key);if(!c)return null;const u=h=>{const m=[...r];m.splice(l,1,{key:c.key,value:h.value,isInactive:!1,operator:h.operator||c.defaultOperator}),a(m)};return n.jsxs("div",{children:[!o.isInactive&&n.jsx(N,{variant:"outline",color:"primary",size:"xs",radius:"rounded-l-md",onClick:()=>{i(o.key)},children:n.jsx(it,{})}),n.jsx(tp,{filter:c,isInactive:o.isInactive,value:o.valueKey!=null?o.valueKey:o.value,operator:o.operator,onValueChange:u})]},o.key)})}):null}function ac({actions:t,selectedItemsCount:e}){return n.jsxs(nc,{"data-testid":"datatable-selected-header",children:[n.jsx("div",{className:"mr-auto",children:n.jsx(d,{message:"[one 1 item|other :count items] selected",values:{count:e}})}),t]})}function cp(){return n.jsxs(js.div,{className:"flex items-center gap-6 h-30",...gn,children:[n.jsx(Es,{variant:"rect",size:"h-full w-144",radius:"rounded-md"}),n.jsx(Es,{variant:"rect",size:"h-full w-112",radius:"rounded-md"}),n.jsx(Es,{variant:"rect",size:"h-full w-172",radius:"rounded-md"})]},"filter-list-skeleton")}function oc({filters:t,filtersLoading:e,columns:s,searchPlaceholder:r,queryParams:i,endpoint:a,actions:o,selectedActions:l,emptyStateMessage:c,tableDomProps:u,onRowAction:h,enableSelection:m=!0,selectionStyle:p="checkbox",children:f,cellHeight:x,collapseTableOnMobile:b=!0}){var zt;const y=Ge(),{trans:k}=P(),{encodedFilters:M}=Dn(t),[R,Q]=j.useState({perPage:15}),[W,pe]=j.useState([]),de=Ol(a,{...R,...i,[Wn]:M},{onSuccess:()=>{pe([])}}),U=!!(R.query||R.filters||M),qe=(zt=de.data)==null?void 0:zt.pagination;return n.jsxs(Kl.Provider,{value:{selectedRows:W,setSelectedRows:pe,endpoint:a,params:R,setParams:Q,query:de},children:[f,n.jsx(xs,{initial:!1,mode:"wait",children:W.length?n.jsx(ac,{selectedItemsCount:W.length,actions:l},"selected"):n.jsx(sc,{searchPlaceholder:r,searchValue:R.query,onSearchChange:Ye=>Q({...R,query:Ye}),actions:o,filters:t,filtersLoading:e},"default")}),t&&n.jsx("div",{className:"mb-14",children:n.jsx(xs,{initial:!1,mode:"wait",children:e&&M?n.jsx(cp,{}):n.jsx(js.div,{...gn,children:n.jsx(ic,{filters:t})},"filter-list")})}),n.jsxs("div",{className:T("relative rounded",(!y||!b)&&"border"),children:[de.isFetching&&n.jsx(bl,{isIndeterminate:!0,className:"absolute top-0 left-0 w-full z-10","aria-label":k({message:"Loading"}),size:"xs"}),n.jsx("div",{className:"relative overflow-x-auto md:overflow-hidden",children:n.jsx(Rl,{...u,columns:s,data:(qe==null?void 0:qe.data)||[],sortDescriptor:R,onSortChange:Ye=>{Q({...R,...Ye})},selectedRows:W,enableSelection:m,selectionStyle:p,onSelectionChange:pe,onAction:h,collapseOnMobile:b,cellHeight:x})}),(de.isFetched||de.isPreviousData)&&!(qe!=null&&qe.data.length)?n.jsx("div",{className:"pt-50",children:j.cloneElement(c,{isFiltering:U})}):void 0,n.jsx(Jl,{query:de,onPageChange:Ye=>Q({...R,page:Ye}),onPerPageChange:Ye=>Q({...R,perPage:Ye})})]})]})}function De({title:t,headerContent:e,headerItemsAlign:s="items-end",...r}){const i=j.useId();return n.jsxs("div",{className:"p-12 md:p-24",children:[t&&n.jsxs("div",{className:T("mb-16",e&&`flex ${s} gap-4`),children:[n.jsx(Js,{children:t}),n.jsx("h1",{className:"text-3xl font-light capitalize",id:i,children:t}),e]}),n.jsx(oc,{...r,tableDomProps:{"aria-labelledby":t?i:void 0}})]})}function dp(){const{endpoint:t,selectedRows:e,setSelectedRows:s}=ua();return $(()=>up(t,e),{onSuccess:async()=>{await F.invalidateQueries(ee(t)),H(g("Deleted [one 1 record|other :count records]",{values:{count:e.length}})),s([])},onError:r=>oe(r,g("Could not delete records"))})}function up(t,e){return O.delete(`${t}/${e.join(",")}`).then(s=>s.data)}function $e(){return n.jsxs(z,{type:"modal",children:[n.jsx(w,{variant:"flat",color:"danger",className:"ml-auto",children:n.jsx(d,{message:"Delete"})}),n.jsx(hp,{})]})}function hp(){const t=dp(),{selectedRows:e}=ua(),{close:s}=te();return n.jsx(lt,{isLoading:t.isLoading,title:n.jsx(d,{message:"Delete [one 1 item|other :count items]?",values:{count:e.length}}),body:n.jsx(d,{message:"This will permanently remove the items and cannot be undone."}),confirm:n.jsx(d,{message:"Delete"}),isDanger:!0,onConfirm:()=>{t.mutate(void 0,{onSuccess:()=>s()})}})}function ve({isFiltering:t,title:e,filteringTitle:s,image:r,className:i}){const a=Ge();return n.jsx(fr,{className:i,size:a?"sm":"md",image:n.jsx(gr,{src:r}),title:t&&s?s:e,description:t&&s?n.jsx(d,{message:"Try another search query or different filters"}):void 0})}const xn=""+new URL("team-de984127.svg",import.meta.url).href,Ze=_.forwardRef(({children:t,to:e,elementType:s,onClick:r},i)=>Ge()?n.jsx(N,{ref:i,variant:"flat",color:"primary",radius:"rounded",className:"flex-shrink-0",size:"sm",to:e,elementType:s,onClick:r,children:n.jsx(at,{})}):n.jsx(w,{ref:i,startIcon:n.jsx(at,{}),variant:"flat",color:"primary",size:"sm",to:e,elementType:s,onClick:r,children:t})),ji=D(n.jsx("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z"}),"FileDownloadOutlined");function mp(t){return $(e=>pp(t,e),{onError:e=>oe(e)})}function pp(t,e){return O.post(t,e).then(s=>s.data)}function fp(){const{close:t}=te();return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Csv export"})}),n.jsx(ie,{children:n.jsx(d,{message:`Your request is being processed. We'll email you when the report is ready to download. In certain cases, it might take a little longer, depending on the number of items beings exported and the volume of activity.`})}),n.jsx(le,{children:n.jsx(w,{variant:"flat",color:"primary",onClick:t,children:n.jsx(d,{message:"Got it"})})})]})}function lc({endpoint:t,payload:e}){const[s,r]=j.useState(!1),i=mp(t);return n.jsxs(j.Fragment,{children:[n.jsx(N,{variant:"outline",color:"primary",radius:"rounded",size:"sm",className:"flex-shrink-0",disabled:i.isLoading,onClick:()=>{i.mutate(e,{onSuccess:a=>{a.downloadPath?Qn(a.downloadPath):r(!0)}})},children:n.jsx(ji,{})}),n.jsx(z,{type:"modal",isOpen:s,onOpenChange:r,children:n.jsx(fp,{})})]})}function gp(t,e){return $(s=>xp(e,s),{onSuccess:()=>{H(g("User suspended")),F.invalidateQueries(["users"])},onError:s=>ge(s,t)})}function xp(t,e){return O.post(`users/${t}/ban`,e).then(s=>s.data)}function jp({user:t}){const{trans:e}=P(),{close:s,formId:r}=te(),i=X({defaultValues:{permanent:!0}}),a=i.watch("permanent"),o=gp(i,t.id);return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Suspend “:name“",values:{name:t.display_name}})}),n.jsx(ie,{children:n.jsxs(ce,{id:r,form:i,onSubmit:l=>o.mutate(l,{onSuccess:()=>s()}),children:[n.jsx(gi,{name:"ban_until",label:n.jsx(d,{message:"Suspend until"}),disabled:a}),n.jsx(E,{name:"permanent",className:"mt-12",children:n.jsx(d,{message:"Permanent"})}),n.jsx(C,{className:"mt-24",name:"comment",inputElementType:"textarea",maxLength:250,label:n.jsx(d,{message:"Reason"}),placeholder:e(g("Optional"))})]})}),n.jsxs(le,{children:[n.jsx(w,{onClick:()=>s(),children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{form:r,variant:"flat",color:"primary",type:"submit",disabled:o.isLoading,children:n.jsx(d,{message:"Suspend"})})]})]})}const cc=D(n.jsx("path",{d:"m20 17.17-3.37-3.38c.64.22 1.23.48 1.77.76.97.51 1.58 1.52 1.6 2.62zm1.19 4.02-1.41 1.41-2.61-2.6H4v-2.78c0-1.12.61-2.15 1.61-2.66 1.29-.66 2.87-1.22 4.67-1.45L1.39 4.22 2.8 2.81l18.39 18.38zM15.17 18l-3-3H12c-2.37 0-4.29.73-5.48 1.34-.32.16-.52.5-.52.88V18h9.17zM12 6c1.1 0 2 .9 2 2 0 .86-.54 1.59-1.3 1.87l1.48 1.48C15.28 10.64 16 9.4 16 8c0-2.21-1.79-4-4-4-1.4 0-2.64.72-3.35 1.82l1.48 1.48C10.41 6.54 11.14 6 12 6z"}),"PersonOffOutlined");function bp(t){return $(()=>yp(t),{onSuccess:()=>{H(g("User unsuspended")),F.invalidateQueries(["users"])},onError:e=>oe(e)})}function yp(t){return O.delete(`users/${t}/unban`).then(e=>e.data)}const Ua=[{key:"name",allowsSorting:!0,sortingKey:"email",width:"flex-3 min-w-200",visibleInMode:"all",header:()=>n.jsx(d,{message:"User"}),body:t=>n.jsx(mt,{image:t.avatar,label:t.display_name,description:t.email})},{key:"subscribed",header:()=>n.jsx(d,{message:"Subscribed"}),width:"w-96",body:t=>{var e;return(e=t.subscriptions)!=null&&e.length?n.jsx(Gn,{className:"icon-md text-positive"}):n.jsx(it,{className:"icon-md text-danger"})}},{key:"roles",header:()=>n.jsx(d,{message:"Roles"}),body:t=>n.jsx(km,{radius:"rounded",size:"xs",children:t.roles.map(e=>n.jsx(fi,{selectable:!0,children:n.jsx(Y,{className:T("capitalize"),target:"_blank",to:`/admin/roles/${e.id}/edit`,children:n.jsx(d,{message:e.name})})},e.id))})},{key:"firstName",allowsSorting:!0,header:()=>n.jsx(d,{message:"First name"}),body:t=>t.first_name},{key:"lastName",allowsSorting:!0,header:()=>n.jsx(d,{message:"Last name"}),body:t=>t.last_name},{key:"createdAt",allowsSorting:!0,width:"w-96",header:()=>n.jsx(d,{message:"Created at"}),body:t=>n.jsx("time",{children:n.jsx(he,{date:t.created_at})})},{key:"actions",header:()=>n.jsx(d,{message:"Actions"}),width:"w-84 flex-shrink-0",hideHeader:!0,align:"end",visibleInMode:"all",body:t=>n.jsxs("div",{className:"text-muted",children:[n.jsx(Y,{to:`${t.id}/edit`,children:n.jsx(We,{label:n.jsx(d,{message:"Edit user"}),children:n.jsx(N,{size:"md",children:n.jsx(Ee,{})})})}),t.banned_at?n.jsx(kp,{user:t}):n.jsxs(z,{type:"modal",children:[n.jsx(We,{label:n.jsx(d,{message:"Suspend user"}),children:n.jsx(N,{size:"md",children:n.jsx(cc,{})})}),n.jsx(jp,{user:t})]})]})}];function vp(){const{billing:t}=fe(),e=t.enable?Ua:Ua.filter(s=>s.key!=="subscribed");return n.jsx(j.Fragment,{children:n.jsx(De,{endpoint:"users",title:n.jsx(d,{message:"Users"}),filters:Bm,columns:e,actions:n.jsx(Cp,{}),queryParams:{with:"subscriptions,bans"},selectedActions:n.jsx($e,{}),emptyStateMessage:n.jsx(ve,{image:xn,title:n.jsx(d,{message:"No users have been created yet"}),filteringTitle:n.jsx(d,{message:"No matching users"})})})})}function Cp(){return n.jsxs(j.Fragment,{children:[n.jsx(lc,{endpoint:"users/csv/export"}),n.jsx(Ze,{elementType:Y,to:"new",children:n.jsx(d,{message:"Add new user"})})]})}function kp({user:t}){const e=bp(t.id);return n.jsxs(z,{type:"modal",onClose:s=>{s&&e.mutate()},children:[n.jsx(We,{label:n.jsx(d,{message:"Remove suspension"}),children:n.jsx(N,{size:"md",color:"danger",children:n.jsx(cc,{})})}),n.jsx(lt,{isDanger:!0,title:n.jsx(d,{message:"Suspend “:name“",values:{name:t.display_name}}),body:n.jsx(d,{message:"Are you sure you want to remove suspension from this user?"}),confirm:n.jsx(d,{message:"Unsuspend"})})]})}function wp(t,e){return t.reduce((s,r,i)=>{const a=Math.floor(i/e);return s[a]||(s[a]=[]),s[a].push(r),s},[])}const Sp={preview:{defaultRoute:"/",navigationRoutes:[]},sections:{general:{label:g("General"),position:1,buildBreadcrumb:()=>[{label:g("General"),location:"general"}]},themes:{label:g("Themes"),position:2,buildBreadcrumb:(t,e)=>{var a;const s=t.split("/").filter(o=>!!o),[,,,r]=s,i=[{label:g("Themes"),location:"themes"}];return r!=null&&i.push({label:(a=e.appearance.themes.all[+r])==null?void 0:a.name,location:`themes/${r}`}),i}},menus:{label:g("Menus"),position:3,buildBreadcrumb:(t,e)=>{const s=t.split("/").filter(o=>!!o),[,,...r]=s,i=[{label:g("Menus"),location:"menus"}],a=wp(r,2);return a.forEach(([o,l],c)=>{var u,h;if(o==="menus"&&l!=null)i.push({label:(u=e.settings.menus[+l])==null?void 0:u.name,location:`menus/${l}`});else if(o==="items"&&l!=null){const[,m]=a[c-1];i.push({label:(h=e.settings.menus[+m].items[+l])==null?void 0:h.label,location:`menus/${m}/${l}`})}}),i},config:{availableRoutes:["/login","/register","/contact","/billing/pricing","/account-settings","/admin","/admin/appearance","/admin/settings","/admin/plans","/admin/subscriptions","/admin/users","/admin/roles","/admin/pages","/admin/tags","/admin/files","/admin/localizations","/admin/ads","/admin/settings/authentication","/admin/settings/branding","/admin/settings/cache","/admin/settings/providers","/api-routes"],positions:["admin-navbar","admin-sidebar","custom-page-navbar","auth-page-footer","auth-dropdown","account-settings-page","billing-page","checkout-page-navbar","checkout-page-footer","pricing-table-page","contact-us-page","notifications-page","footer","footer-secondary"]}},"custom-code":{label:g("Custom Code"),position:4,buildBreadcrumb:()=>[{label:g("Custom code"),location:"custom-code"}]},"seo-settings":{label:g("SEO Settings"),position:5,buildBreadcrumb:()=>[{label:g("SEO"),location:"seo"}]}}};function Mp(){const{fields:t,remove:e,append:s}=Qe({name:"settings.homepage.appearance.primaryFeatures"}),[r,i]=j.useState([0]);return n.jsxs("div",{children:[n.jsx(ss,{variant:"outline",expandedValues:r,onExpandedChange:a=>{i(a),a.length&&se().preview.setHighlight(`[data-testid="primary-root-${a[0]}"]`)},children:t.map((a,o)=>n.jsxs(nt,{value:o,label:n.jsx(d,{message:`Primary feature ${o+1}`}),children:[n.jsx(Np,{index:o}),n.jsx("div",{className:"text-right",children:n.jsx(w,{size:"xs",variant:"outline",color:"danger",onClick:()=>{e(o)},children:n.jsx(d,{message:"Remove"})})})]},a.id))}),n.jsx("div",{className:"mt-20 text-right",children:n.jsx(w,{size:"xs",variant:"outline",color:"primary",startIcon:n.jsx(at,{}),onClick:()=>{s({}),i([t.length])},children:n.jsx(d,{message:"Add feature"})})})]})}function Np({index:t}){const e=ws(s=>{var r,i,a;return(a=(i=(r=s.defaults)==null?void 0:r.settings.homepage.appearance)==null?void 0:i.primaryFeatures[t])==null?void 0:a.image});return n.jsxs(n.Fragment,{children:[n.jsx(Yt,{name:`settings.homepage.appearance.primaryFeatures.${t}.image`,className:"mb-30",label:n.jsx(d,{message:"Image"}),defaultValue:e,diskPrefix:"homepage"}),n.jsx(C,{name:`settings.homepage.appearance.primaryFeatures.${t}.title`,label:n.jsx(d,{message:"Title"}),className:"mb-20",onFocus:()=>{se().preview.setHighlight(`[data-testid="primary-title-${t}"]`)}}),n.jsx(C,{name:`settings.homepage.appearance.primaryFeatures.${t}.subtitle`,label:n.jsx(d,{message:"Subtitle"}),className:"mb-20",inputElementType:"textarea",rows:4,onFocus:()=>{se().preview.setHighlight(`[data-testid="primary-subtitle-${t}"]`)}})]})}function dc(t){return t&&t.charAt(0).toUpperCase()+t.slice(1)}const Lp=_.forwardRef(({valueListKey:t="permissions",...e},s)=>{const{data:r}=gt([t]),i=(r==null?void 0:r.permissions)||(r==null?void 0:r.workspacePermissions),[a,o]=Ki(e.value,[],e.onChange),[l,c]=j.useState(!1);if(!i)return null;const u=uc(i,a,l),h=m=>{const p=[...a],f=p.findIndex(x=>x.id===m.id);f>-1&&p.splice(f,1,m),o(p)};return n.jsxs(j.Fragment,{children:[n.jsx(ss,{variant:"outline",ref:s,children:u.map(({groupName:m,items:p,anyChecked:f})=>n.jsx(nt,{label:n.jsx(d,{message:ma(m)}),startIcon:f?n.jsx(Hu,{size:"sm"}):void 0,children:n.jsx(yl,{children:p.map(x=>{const b=a.findIndex(k=>k.id===x.id),y=b>-1;return n.jsxs("div",{children:[n.jsx(vl,{onSelected:()=>{if(y){const k=[...a];k.splice(b,1),o(k)}else o([...a,x])},endSection:n.jsx(xi,{tabIndex:-1,checked:y,onChange:()=>{}}),description:n.jsx(d,{message:x.description}),children:n.jsx(d,{message:x.display_name||x.name})}),y&&n.jsx(Tp,{permission:x,onChange:h})]},x.id)})})},m))}),n.jsx(xi,{className:"mt-30",checked:l,onChange:m=>{c(m.target.checked)},children:n.jsx(d,{message:"Show advanced permissions"})})]})});function Tp({permission:t,onChange:e}){var r;if(!((r=t==null?void 0:t.restrictions)!=null&&r.length))return null;const s=(i,a)=>{const o=qu(t,l=>{const c=l.restrictions.find(u=>u.name===i);c&&(c.value=a)});e==null||e(o)};return n.jsx("div",{className:"px-40 py-20",children:t.restrictions.map((i,a)=>{const o=a===t.restrictions.length-1,l=n.jsx(d,{message:ma(i.name)}),c=i.description?n.jsx(d,{message:i.description}):void 0;return i.type==="bool"?n.jsx(xi,{description:c,className:T(!o&&"mb-30"),checked:!!i.value,onChange:u=>{s(i.name,u.target.checked)},children:l},i.name):n.jsx(Qt,{size:"sm",label:l,description:c,type:"number",className:T(!o&&"mb-30"),value:i.value||"",onChange:u=>{s(i.name,u.target.value===""?void 0:parseInt(u.target.value))}},i.name)})})}function ha(t){const{field:{onChange:e,value:s=[],ref:r}}=Zs({name:t.name}),i={onChange:e,value:s};return n.jsx(Lp,{ref:r,...Ks(i,t)})}const ma=t=>dc(t.replace("_"," "));function uc(t,e,s){const r=[];return t.forEach(i=>{const a=e.findIndex(l=>l.id===i.id);if(!s&&i.advanced)return;let o=r.find(l=>l.groupName===i.group);if(o||(o={groupName:i.group,anyChecked:!1,items:[]},r.push(o)),a>-1){const l={...i,restrictions:Ap(i.restrictions,e[a].restrictions)};o.anyChecked=!0,o.items.push(l)}else o.items.push(i)}),r}function Ap(t,e){return t==null?void 0:t.map(s=>{const r=e.find(i=>i.name===s.name);return r?{...s,value:r.value}:s})}function hc(){const t=jc.sections.menus.config;return t?t.availableRoutes.map(e=>({id:e,label:e,action:e,type:"route",target:"_self"})):[]}const Br={grid:"flex flex-wrap gap-24",button:"flex flex-col items-center rounded hover:bg-hover h-90 aspect-square"},Ip=[...Array(60).keys()],Ep=_.lazy(()=>Nn(()=>import("./icon-list-1b271b71.js"),["./icon-list-1b271b71.js","./main-1406e08c.js","./main-f52edbcd.css","./play-arrow-filled-8e87b0ae.js","./History-20a46571.js","./backstage-track-insights-d08cc66a.js","./Edit-4fa321e0.js","./OpenInNew-14ffde19.js","./use-resume-subscription-b3c8abe5.js","./MoreHoriz-16b2a1fa.js","./TrendingUp-bcf21998.js","./TaskAlt-abcaec6b.js"],import.meta.url));function Dp({onIconSelected:t}){const{trans:e}=P(),[s,r]=_.useState("");return n.jsxs("div",{className:"py-4",children:[n.jsx(Qt,{className:"mb-20",value:s,onChange:i=>{r(i.target.value)},placeholder:e({message:"Search icons..."})}),n.jsx(xs,{mode:"wait",children:n.jsx(j.Suspense,{fallback:n.jsx(js.div,{...gn,className:Br.grid,children:Ip.map((i,a)=>n.jsx("div",{className:Br.button,children:n.jsx(Es,{variant:"rect"})},a))}),children:n.jsx(js.div,{...gn,className:Br.grid,children:n.jsx(Ep,{searchQuery:s,onIconSelected:t})})})})]})}function Op(){return n.jsxs(ne,{size:"w-850",className:"min-h-dialog",children:[n.jsx(re,{children:n.jsx(d,{message:"Select icon"})}),n.jsx(ie,{children:n.jsx(Pp,{})})]})}function Pp(){const{close:t}=te();return n.jsx(Dp,{onIconSelected:e=>{t(e)}})}function Ds({formPathPrefix:t,hideRoleAndPermissionFields:e}){const{trans:s}=P(),r=i=>t?`${t}.${i}`:i;return n.jsxs(j.Fragment,{children:[n.jsx(C,{className:"mb-20",name:r("label"),label:n.jsx(d,{message:"Label"}),placeholder:s(g("No label...")),startAppend:n.jsx(Fp,{prefixName:r})}),n.jsx(zp,{prefixName:r}),!e&&n.jsxs(j.Fragment,{children:[n.jsx(Rp,{prefixName:r}),n.jsx(_p,{prefixName:r})]}),n.jsx(Bp,{prefixName:r})]})}function Fp({prefixName:t,...e}){const{watch:s,setValue:r}=I(),i=t("icon"),a=s(i),o=a&&Gi(a);return n.jsxs(z,{type:"modal",onClose:l=>{(l||l===null)&&r(i,l,{shouldDirty:!0})},children:[n.jsx(N,{className:"text-muted icon-sm",variant:"outline",size:"md",...e,children:o?n.jsx(o,{}):n.jsx(Ee,{})}),n.jsx(Op,{})]})}function zp({prefixName:t}){const e=I(),s=e.watch(t("type")),r=Ih(s),{data:i}=gt(["menuItemCategories"]),a=(i==null?void 0:i.menuItemCategories)||[],o=a.find(u=>u.type===s),{trans:l}=P(),c=hc();return j.useEffect(()=>{r&&r!==s&&e.setValue(t("action"),"")},[s,r,e,t]),n.jsxs(j.Fragment,{children:[n.jsxs(G,{className:"mb-20",name:t("type"),selectionMode:"single",label:n.jsx(d,{message:"Type"}),children:[n.jsx(v,{value:"link",children:n.jsx(d,{message:"Custom link"})}),n.jsx(v,{value:"route",children:n.jsx(d,{message:"Site page"})}),a.map(u=>n.jsx(v,{value:u.type,children:u.name},u.type))]}),s==="link"&&n.jsx(C,{className:"mb-20",required:!0,type:"url",name:t("action"),placeholder:l({message:"Enter a url..."}),label:n.jsx(d,{message:"Url"})}),s==="route"&&n.jsx(G,{className:"mb-20",required:!0,items:c,name:t("action"),label:n.jsx(d,{message:"Page"}),searchPlaceholder:l(g("Search pages")),showSearchField:!0,selectionMode:"single",children:u=>n.jsx(v,{value:u.id,children:u.label},u.id)}),o&&n.jsx(G,{className:"mb-20",required:!0,items:o.items,name:t("action"),showSearchField:!0,searchPlaceholder:l(g("Search...")),selectionMode:"single",label:n.jsx(d,{message:o.name}),children:u=>n.jsx(v,{value:u.action,children:n.jsx(d,{message:u.label})})})]})}function Rp({prefixName:t}){const{data:e}=gt(["roles","permissions"]),s=(e==null?void 0:e.roles)||[],{trans:r}=P();return n.jsx(En,{className:"mb-20",placeholder:r({message:"Add role..."}),label:n.jsx(d,{message:"Only show if user has role"}),name:t("roles"),chipSize:"sm",suggestions:s,valueKey:"id",displayWith:i=>{var a;return(a=s.find(o=>o.id===i.id))==null?void 0:a.name},children:i=>n.jsx(v,{value:i.id,capitalizeFirst:!0,children:n.jsx(d,{message:i.name})},i.id)})}function _p({prefixName:t}){const{data:e}=gt(["roles","permissions"]),{trans:s}=P(),r=j.useMemo(()=>uc((e==null?void 0:e.permissions)||[],[],!1),[e==null?void 0:e.permissions]);return n.jsx(En,{label:n.jsx(d,{message:"Only show if user has permissions"}),placeholder:s({message:"Add permission..."}),chipSize:"sm",suggestions:r,name:t("permissions"),valueKey:"name",children:({groupName:i,items:a})=>n.jsx(Qi,{label:ma(i),children:a.map(o=>n.jsx(v,{value:o.name,description:n.jsx(d,{message:o.description}),children:n.jsx(d,{message:o.display_name||o.name})},o.name))},i)})}function Bp({prefixName:t}){return I().watch(t("type"))!=="link"?null:n.jsxs(G,{className:"mt-20",selectionMode:"single",name:t("target"),label:n.jsx(d,{message:"Open link in"}),children:[n.jsx(v,{value:"_self",children:n.jsx(d,{message:"Same window"})}),n.jsx(v,{value:"_blank",children:n.jsx(d,{message:"New window"})})]})}function Vp(){const[t,e]=j.useState(["cta1"]);return n.jsxs(ss,{variant:"outline",expandedValues:t,onExpandedChange:s=>{e(s),s.length&&se().preview.setHighlight(`[data-testid="${s[0]}"]`)},children:[n.jsx(nt,{value:"cta1",label:n.jsx(d,{message:"Header button 1"}),children:n.jsx(Ds,{formPathPrefix:"settings.homepage.appearance.actions.cta1"})}),n.jsx(nt,{value:"ct2",label:n.jsx(d,{message:"Header button 2"}),children:n.jsx(Ds,{formPathPrefix:"settings.homepage.appearance.actions.cta2"})}),n.jsx(nt,{value:"cta3",label:n.jsx(d,{message:"Footer button"}),children:n.jsx(Ds,{formPathPrefix:"settings.homepage.appearance.actions.cta3"})})]})}const wt=j.forwardRef(({startIcon:t,children:e,className:s,...r},i)=>n.jsxs(Cl,{ref:i,className:T("flex items-center gap-10 w-full rounded border text-sm h-54 px-14 mb-10 bg relative hover:bg-hover",s),variant:null,...r,children:[t,n.jsx("div",{children:e}),n.jsx(br,{className:"icon-sm text-muted ml-auto"})]})),mc=D(n.jsx("path",{stroke:"#E0E0E0",d:"M24,44c-7.168,0-13-5.816-13-12.971C11,24,24,4,24,4s13,20,13,27.029C37,38.184,31.168,44,24,44z"}));function en(){return(en=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(t[r]=s[r])}return t}).apply(this,arguments)}function wr(t,e){if(t==null)return{};var s,r,i={},a=Object.keys(t);for(r=0;r<a.length;r++)e.indexOf(s=a[r])>=0||(i[s]=t[s]);return i}function jn(t){var e=j.useRef(t),s=j.useRef(function(r){e.current&&e.current(r)});return e.current=t,s.current}var bn=function(t,e,s){return e===void 0&&(e=0),s===void 0&&(s=1),t>s?s:t<e?e:t},dn=function(t){return"touches"in t},bi=function(t){return t&&t.ownerDocument.defaultView||self},Wa=function(t,e,s){var r=t.getBoundingClientRect(),i=dn(e)?function(a,o){for(var l=0;l<a.length;l++)if(a[l].identifier===o)return a[l];return a[0]}(e.touches,s):e;return{left:bn((i.pageX-(r.left+bi(t).pageXOffset))/r.width),top:bn((i.pageY-(r.top+bi(t).pageYOffset))/r.height)}},Za=function(t){!dn(t)&&t.preventDefault()},pc=_.memo(function(t){var e=t.onMove,s=t.onKey,r=wr(t,["onMove","onKey"]),i=j.useRef(null),a=jn(e),o=jn(s),l=j.useRef(null),c=j.useRef(!1),u=j.useMemo(function(){var f=function(y){Za(y),(dn(y)?y.touches.length>0:y.buttons>0)&&i.current?a(Wa(i.current,y,l.current)):b(!1)},x=function(){return b(!1)};function b(y){var k=c.current,M=bi(i.current),R=y?M.addEventListener:M.removeEventListener;R(k?"touchmove":"mousemove",f),R(k?"touchend":"mouseup",x)}return[function(y){var k=y.nativeEvent,M=i.current;if(M&&(Za(k),!function(Q,W){return W&&!dn(Q)}(k,c.current)&&M)){if(dn(k)){c.current=!0;var R=k.changedTouches||[];R.length&&(l.current=R[0].identifier)}M.focus(),a(Wa(M,k,l.current)),b(!0)}},function(y){var k=y.which||y.keyCode;k<37||k>40||(y.preventDefault(),o({left:k===39?.05:k===37?-.05:0,top:k===40?.05:k===38?-.05:0}))},b]},[o,a]),h=u[0],m=u[1],p=u[2];return j.useEffect(function(){return p},[p]),_.createElement("div",en({},r,{onTouchStart:h,onMouseDown:h,className:"react-colorful__interactive",ref:i,onKeyDown:m,tabIndex:0,role:"slider"}))}),pa=function(t){return t.filter(Boolean).join(" ")},fc=function(t){var e=t.color,s=t.left,r=t.top,i=r===void 0?.5:r,a=pa(["react-colorful__pointer",t.className]);return _.createElement("div",{className:a,style:{top:100*i+"%",left:100*s+"%"}},_.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},Me=function(t,e,s){return e===void 0&&(e=0),s===void 0&&(s=Math.pow(10,e)),Math.round(s*t)/s},$p=function(t){return Zp(yi(t))},yi=function(t){return t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?Me(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?Me(parseInt(t.substring(6,8),16)/255,2):1}},Hp=function(t){return Wp(Up(t))},qp=function(t){var e=t.s,s=t.v,r=t.a,i=(200-e)*s/100;return{h:Me(t.h),s:Me(i>0&&i<200?e*s/100/(i<=100?i:200-i)*100:0),l:Me(i/2),a:Me(r,2)}},vi=function(t){var e=qp(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},Up=function(t){var e=t.h,s=t.s,r=t.v,i=t.a;e=e/360*6,s/=100,r/=100;var a=Math.floor(e),o=r*(1-s),l=r*(1-(e-a)*s),c=r*(1-(1-e+a)*s),u=a%6;return{r:Me(255*[r,l,o,o,c,r][u]),g:Me(255*[c,r,r,l,o,o][u]),b:Me(255*[o,o,c,r,r,l][u]),a:Me(i,2)}},Bn=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},Wp=function(t){var e=t.r,s=t.g,r=t.b,i=t.a,a=i<1?Bn(Me(255*i)):"";return"#"+Bn(e)+Bn(s)+Bn(r)+a},Zp=function(t){var e=t.r,s=t.g,r=t.b,i=t.a,a=Math.max(e,s,r),o=a-Math.min(e,s,r),l=o?a===e?(s-r)/o:a===s?2+(r-e)/o:4+(e-s)/o:0;return{h:Me(60*(l<0?l+6:l)),s:Me(a?o/a*100:0),v:Me(a/255*100),a:i}},Kp=_.memo(function(t){var e=t.hue,s=t.onChange,r=pa(["react-colorful__hue",t.className]);return _.createElement("div",{className:r},_.createElement(pc,{onMove:function(i){s({h:360*i.left})},onKey:function(i){s({h:bn(e+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":Me(e),"aria-valuemax":"360","aria-valuemin":"0"},_.createElement(fc,{className:"react-colorful__hue-pointer",left:e/360,color:vi({h:e,s:100,v:100,a:1})})))}),Jp=_.memo(function(t){var e=t.hsva,s=t.onChange,r={backgroundColor:vi({h:e.h,s:100,v:100,a:1})};return _.createElement("div",{className:"react-colorful__saturation",style:r},_.createElement(pc,{onMove:function(i){s({s:100*i.left,v:100-100*i.top})},onKey:function(i){s({s:bn(e.s+100*i.left,0,100),v:bn(e.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Me(e.s)+"%, Brightness "+Me(e.v)+"%"},_.createElement(fc,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:vi(e)})))}),gc=function(t,e){if(t===e)return!0;for(var s in t)if(t[s]!==e[s])return!1;return!0},Gp=function(t,e){return t.toLowerCase()===e.toLowerCase()||gc(yi(t),yi(e))};function Qp(t,e,s){var r=jn(s),i=j.useState(function(){return t.toHsva(e)}),a=i[0],o=i[1],l=j.useRef({color:e,hsva:a});j.useEffect(function(){if(!t.equal(e,l.current.color)){var u=t.toHsva(e);l.current={hsva:u,color:e},o(u)}},[e,t]),j.useEffect(function(){var u;gc(a,l.current.hsva)||t.equal(u=t.fromHsva(a),l.current.color)||(l.current={hsva:a,color:u},r(u))},[a,t,r]);var c=j.useCallback(function(u){o(function(h){return Object.assign({},h,u)})},[]);return[a,c]}var Yp=typeof window<"u"?j.useLayoutEffect:j.useEffect,Xp=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Ka=new Map,ef=function(t){Yp(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!Ka.has(e)){var s=e.createElement("style");s.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,Ka.set(e,s);var r=Xp();r&&s.setAttribute("nonce",r),e.head.appendChild(s)}},[])},tf=function(t){var e=t.className,s=t.colorModel,r=t.color,i=r===void 0?s.defaultColor:r,a=t.onChange,o=wr(t,["className","colorModel","color","onChange"]),l=j.useRef(null);ef(l);var c=Qp(s,i,a),u=c[0],h=c[1],m=pa(["react-colorful",e]);return _.createElement("div",en({},o,{ref:l,className:m}),_.createElement(Jp,{hsva:u,onChange:h}),_.createElement(Kp,{hue:u.h,onChange:h,className:"react-colorful__last-control"}))},sf={defaultColor:"000",toHsva:$p,fromHsva:function(t){return Hp({h:t.h,s:t.s,v:t.v,a:1})},equal:Gp},nf=function(t){return _.createElement(tf,en({},t,{colorModel:sf}))},rf=/^#?([0-9A-F]{3,8})$/i,af=function(t){var e=t.color,s=e===void 0?"":e,r=t.onChange,i=t.onBlur,a=t.escape,o=t.validate,l=t.format,c=t.process,u=wr(t,["color","onChange","onBlur","escape","validate","format","process"]),h=j.useState(function(){return a(s)}),m=h[0],p=h[1],f=jn(r),x=jn(i),b=j.useCallback(function(k){var M=a(k.target.value);p(M),o(M)&&f(c?c(M):M)},[a,c,o,f]),y=j.useCallback(function(k){o(k.target.value)||p(a(s)),x(k)},[s,a,o,x]);return j.useEffect(function(){p(a(s))},[s,a]),_.createElement("input",en({},u,{value:l?l(m):m,spellCheck:"false",onChange:b,onBlur:y}))},Ja=function(t){return"#"+t},of=function(t){var e=t.prefixed,s=t.alpha,r=wr(t,["prefixed","alpha"]),i=j.useCallback(function(o){return o.replace(/([^0-9A-F]+)/gi,"").substring(0,s?8:6)},[s]),a=j.useCallback(function(o){return function(l,c){var u=rf.exec(l),h=u?u[1].length:0;return h===3||h===6||!!c&&h===4||!!c&&h===8}(o,s)},[s]);return _.createElement(af,en({},r,{escape:i,format:e?Ja:void 0,process:Ja,validate:a}))};function lf({onChange:t,value:e,colors:s}){const r=s.map(i=>{const a=e===i;return n.jsx(Cl,{onClick:()=>{t==null||t(i)},className:T("relative block flex-shrink-0 w-26 h-26 border rounded",a&&"shadow-md"),style:{backgroundColor:i},children:a&&n.jsx("span",{className:"absolute inset-0 m-auto rounded-full w-8 h-8 bg-white"})},i)});return n.jsx("div",{className:"flex flex-wrap gap-6",children:r})}const cf=[{color:"rgb(255, 255, 255)",name:g("White")},{color:"rgb(239,245,245)",name:g("Solitude")},{color:"rgb(245,213,174)",name:g("Wheat")},{color:"rgb(253,227,167)",name:g("Cape Honey")},{color:"rgb(242,222,186)",name:g("Milk punch")},{color:"rgb(97,118,75)",name:g("Dingy"),foreground:"rgb(255, 255, 255)"},{color:"rgb(4, 147, 114)",name:g("Aquamarine"),foreground:"rgb(255, 255, 255)"},{color:"rgb(222,245,229)",name:g("Cosmic Latte")},{color:"rgb(233,119,119)",name:g("Geraldine"),foreground:"rgb(90,14,14)"},{color:"rgb(247,164,164)",name:g("Sundown")},{color:"rgb(30,139,195)",name:g("Pelorous"),foreground:"rgb(255, 255, 255)"},{color:"rgb(142,68,173)",name:g("Deep Lilac"),foreground:"rgb(255, 255, 255)"},{color:"rgb(108,74,182)",name:g("Blue marguerite"),foreground:"rgb(255, 255, 255)"},{color:"rgb(139,126,116)",name:g("Americano"),foreground:"rgb(255, 255, 255)"},{color:"rgb(0,0,0)",name:g("Black"),foreground:"rgb(255, 255, 255)"},{color:"rgb(64,66,88)",name:g("Blue zodiac"),foreground:"rgb(255, 255, 255)"},{color:"rgb(101,100,124)",name:g("Comet"),foreground:"rgb(255, 255, 255)"}],df=cf.map(({color:t})=>t).slice(0,14);function uf({defaultValue:t,onChange:e,colorPresets:s,showInput:r}){const[i,a]=j.useState(t),o=s||df,l=kl({size:"sm"});return n.jsxs("div",{children:[n.jsx(nf,{className:"!w-auto",color:i,onChange:c=>{e==null||e(c),a(c)}}),n.jsxs("div",{className:"py-20 px-12",children:[o&&n.jsx(lf,{colors:o,onChange:c=>{if(c){const u=_l(c).toString("hex");e==null||e(u),a(u)}},value:i}),r&&n.jsx("div",{className:"pt-20",children:n.jsx(of,{autoComplete:"off",role:"textbox",autoCorrect:"off",spellCheck:"false",required:!0,"aria-label":"Hex color",prefixed:!0,className:l.input,color:i,onChange:c=>{e==null||e(c),a(c)}})})]})]})}function fa({defaultValue:t,onChange:e,hideFooter:s=!1,showInput:r=!0}){const{close:i}=te(),[a,o]=j.useState(t||"");return n.jsxs(ne,{size:"2xs",children:[n.jsx(uf,{showInput:r,defaultValue:a,onChange:l=>{o(l),e==null||e(l)}}),!s&&n.jsxs(le,{dividerTop:!0,children:[n.jsx(w,{variant:"text",size:"xs",onClick:()=>{i()},children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{variant:"flat",color:"primary",size:"xs",onClick:()=>{i(a)},children:n.jsx(d,{message:"Apply"})})]})]})}function hf(){return n.jsxs(j.Fragment,{children:[n.jsx(mf,{}),n.jsxs("div",{className:"my-24 py-24 border-y",children:[n.jsx(wt,{to:"action-buttons",elementType:Y,className:"mb-20",children:n.jsx(d,{message:"Action buttons"})}),n.jsx(wt,{to:"primary-features",elementType:Y,children:n.jsx(d,{message:"Primary features"})}),n.jsx(wt,{to:"secondary-features",elementType:Y,children:n.jsx(d,{message:"Secondary features"})})]}),n.jsx(pf,{}),n.jsx(ff,{})]})}function mf(){const t=ws(e=>{var s,r;return(r=(s=e.defaults)==null?void 0:s.settings.homepage.appearance)==null?void 0:r.headerImage});return n.jsxs(j.Fragment,{children:[n.jsx(C,{label:n.jsx(d,{message:"Header title"}),className:"mb-20",name:"settings.homepage.appearance.headerTitle",onFocus:()=>{se().preview.setHighlight('[data-testid="headerTitle"]')}}),n.jsx(C,{label:n.jsx(d,{message:"Header subtitle"}),className:"mb-30",inputElementType:"textarea",rows:4,name:"settings.homepage.appearance.headerSubtitle",onFocus:()=>{se().preview.setHighlight('[data-testid="headerSubtitle"]')}}),n.jsx(Yt,{name:"settings.homepage.appearance.headerImage",className:"mb-30",label:n.jsx(d,{message:"Header image"}),defaultValue:t,diskPrefix:"homepage"}),n.jsx(Eh,{name:"settings.homepage.appearance.headerImageOpacity",label:n.jsx(d,{message:"Header image opacity"}),minValue:0,step:.1,maxValue:1,formatOptions:{style:"percent"}}),n.jsx("div",{className:"text-muted text-xs mb-20",children:n.jsx(d,{message:"In order for overlay colors to appear, header image opacity will need to be less then 100%"})}),n.jsx(Ga,{formKey:"settings.homepage.appearance.headerOverlayColor1",label:n.jsx(d,{message:"Header overlay color 1"})}),n.jsx(Ga,{formKey:"settings.homepage.appearance.headerOverlayColor2",label:n.jsx(d,{message:"Header overlay color 2"})})]})}function pf(){const t=ws(e=>{var s,r;return(r=(s=e.defaults)==null?void 0:s.settings.homepage.appearance)==null?void 0:r.footerImage});return n.jsxs(j.Fragment,{children:[n.jsx(E,{className:"mb-24",name:"settings.homepage.trending",children:n.jsx(d,{message:"Show trending artists"})}),n.jsx(C,{label:n.jsx(d,{message:"Footer title"}),className:"mb-20",name:"settings.homepage.appearance.footerTitle",onFocus:()=>{se().preview.setHighlight('[data-testid="footerTitle"]')}}),n.jsx(C,{label:n.jsx(d,{message:"Footer subtitle"}),className:"mb-20",name:"settings.homepage.appearance.footerSubtitle",onFocus:()=>{se().preview.setHighlight('[data-testid="footerSubtitle"]')}}),n.jsx(Yt,{name:"settings.homepage.appearance.footerImage",className:"mb-30",label:n.jsx(d,{message:"Footer background image"}),defaultValue:t,diskPrefix:"homepage"})]})}function ff(){return n.jsxs("div",{className:"mt-24 pt-24 border-t",children:[n.jsx(C,{label:n.jsx(d,{message:"Pricing title"}),className:"mb-20",name:"settings.homepage.appearance.pricingTitle",onFocus:()=>{se().preview.setHighlight('[data-testid="pricingTitle"]')}}),n.jsx(C,{label:n.jsx(d,{message:"Pricing subtitle"}),className:"mb-20",name:"settings.homepage.appearance.pricingSubtitle",onFocus:()=>{se().preview.setHighlight('[data-testid="pricingSubtitle"]')}}),n.jsx(E,{className:"mb-24",name:"settings.homepage.pricing",children:n.jsx(d,{message:"Show pricing table"})})]})}function Ga({label:t,formKey:e}){const s=e,{watch:r,setValue:i}=I(),a=r(s),o=l=>{i(e,l,{shouldDirty:!0})};return n.jsxs(z,{currentValue:a,type:"popover",onClose:l=>{o(l)},children:[n.jsx(wt,{className:"capitalize",startIcon:n.jsx(mc,{viewBox:"0 0 48 48",className:"icon-lg",style:{fill:a}}),children:t}),n.jsx(fa,{defaultValue:a,onChange:l=>{o(l)}})]})}function gf(){const{fields:t,remove:e,append:s}=Qe({name:"settings.homepage.appearance.secondaryFeatures"}),[r,i]=j.useState([0]);return n.jsxs("div",{children:[n.jsx(ss,{variant:"outline",expandedValues:r,onExpandedChange:a=>{i(a),a.length&&se().preview.setHighlight(`[data-testid="secondary-root-${a[0]}"]`)},children:t.map((a,o)=>n.jsxs(nt,{value:o,label:n.jsx(d,{message:`Secondary feature ${o+1}`}),children:[n.jsx(xf,{index:o}),n.jsx("div",{className:"text-right",children:n.jsx(w,{size:"xs",variant:"outline",color:"danger",onClick:()=>{e(o)},children:n.jsx(d,{message:"Remove"})})})]},a.id))}),n.jsx("div",{className:"mt-20 text-right",children:n.jsx(w,{size:"xs",variant:"outline",color:"primary",startIcon:n.jsx(at,{}),onClick:()=>{s({}),i([t.length])},children:n.jsx(d,{message:"Add feature"})})})]})}function xf({index:t}){return n.jsxs(n.Fragment,{children:[n.jsx(Yt,{name:`settings.homepage.appearance.secondaryFeatures.${t}.image`,className:"mb-30",label:n.jsx(d,{message:"Image"}),defaultValue:jf(t),diskPrefix:"homepage"}),n.jsx(C,{name:`settings.homepage.appearance.secondaryFeatures.${t}.title`,label:n.jsx(d,{message:"Title"}),className:"mb-20",onFocus:()=>{se().preview.setHighlight(`[data-testid="secondary-title-${t}"]`)}}),n.jsx(C,{name:`settings.homepage.appearance.secondaryFeatures.${t}.subtitle`,label:n.jsx(d,{message:"Subtitle"}),className:"mb-20",inputElementType:"textarea",rows:4,onFocus:()=>{se().preview.setHighlight(`[data-testid="secondary-subtitle-${t}"]`)}}),n.jsx(C,{name:`settings.homepage.appearance.secondaryFeatures.${t}.description`,label:n.jsx(d,{message:"Description"}),className:"mb-20",inputElementType:"textarea",rows:4,onFocus:()=>{se().preview.setHighlight(`[data-testid="secondary-description-${t}"]`)}})]})}function jf(t){var e,s;return(s=(e=se().defaults)==null?void 0:e.settings.homepage.appearance.secondaryFeatures[t])==null?void 0:s.image}const xc={preview:{defaultRoute:"dashboard",navigationRoutes:["dashboard"]},sections:{"landing-page":{label:g("Landing Page"),position:1,previewRoute:"/",routes:[{path:"landing-page",element:n.jsx(hf,{})},{path:"landing-page/action-buttons",element:n.jsx(Vp,{})},{path:"landing-page/primary-features",element:n.jsx(Mp,{})},{path:"landing-page/secondary-features",element:n.jsx(gf,{})}],buildBreadcrumb:t=>{const s=t.split("/").filter(i=>!!i).pop(),r=[{label:g("Landing page"),location:"landing-page"}];return s==="action-buttons"&&r.push({label:g("Action buttons"),location:"landing-page/action-buttons"}),s==="primary-features"&&r.push({label:g("Primary features"),location:"landing-page/primary-features"}),s==="secondary-features"&&r.push({label:g("Secondary features"),location:"landing-page/secondary-features"}),r}},menus:{config:{positions:["sidebar-primary","sidebar-secondary","mobile-bottom","landing-page-navbar"],availableRoutes:["/upload","/library/songs","/library/albums","/library/artists","/library/history","/admin/upload","/admin/channels","/admin/artists","/admin/albums","/admin/tracks","/admin/genres","/admin/lyrics","/admin/playlists","/admin/backstage-requests","/admin/comments","/backstage/requests"]}}}},jc=Uu.all([Sp,xc]),ws=Wu()(Dh(Zu((t,e)=>({defaults:null,iframeWindow:null,config:jc,setDefaults:s=>{t(r=>{r.defaults={...s}})},setIframeWindow:s=>{t(()=>({iframeWindow:s}))},preview:{navigate:s=>{var o;const r=(o=e().config)==null?void 0:o.sections[s],i=(r==null?void 0:r.previewRoute)||"/",a=e().iframeWindow;i&&sn(a,{type:"navigate",to:i})},setValues:s=>{const r=e().iframeWindow;sn(r,{type:"setValues",values:s})},setThemeColor:(s,r)=>{const i=e().iframeWindow;sn(i,{type:"setThemeColor",name:s,value:r})},setActiveTheme:s=>{const r=e().iframeWindow;sn(r,{type:"setActiveTheme",themeId:s})},setCustomCode:(s,r)=>{const i=e().iframeWindow;sn(i,{type:"setCustomCode",mode:s,value:r})},setHighlight:s=>{t(()=>{var a;let r=null;const i=(a=e().iframeWindow)==null?void 0:a.document;i&&s&&(r=i.querySelector(s)),r&&requestAnimationFrame(()=>{r&&r.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})})})}}}))));function sn(t,e){t&&t.postMessage({source:"be-appearance-editor",...e},"*")}function se(){return ws.getState()}function bf(t){return O.post("admin/appearance",{changes:t}).then(e=>e.data)}function yf(){return $(t=>bf(t),{onSuccess:()=>{H(g("Changes saved"))},onError:t=>oe(t)})}function vf(){return Xt(["admin/appearance/values"],()=>Cf(),{staleTime:1/0})}function Cf(){return O.get("admin/appearance/values").then(t=>t.data)}function kf(){const{pathname:t}=Yi(),{getValues:e}=I(),[s,r]=j.useState(null);return j.useEffect(()=>{var a;const[,,i]=t.split("/").filter(o=>!!o);if(i){const o=(a=se().config)==null?void 0:a.sections[i];if(o){r([{label:g("Appearance"),location:""},...o.buildBreadcrumb(t,e())]);return}}r(null)},[t,e]),!s||s.length<2?null:n.jsxs("div",{className:"flex items-center border-b h-60 flex-shrink-0",children:[n.jsx(N,{iconSize:"md",radius:"rounded-none",className:"text-muted h-full w-50 flex-shrink-0",elementType:Y,to:`/admin/appearance/${s[s.length-2].location}`,children:n.jsx(oa,{})}),n.jsxs("div",{className:"border-l p-10 min-w-0",children:[n.jsx("div",{className:"text-xs text-muted",children:n.jsx(d,{message:"Customizing"})}),n.jsx("div",{className:"flex items-center gap-4 text-sm mt-2",children:s.map((i,a)=>{const o=s.length-1===a,l=a===0,c=n.jsx(Ku,{value:i.label});return l?null:n.jsxs(j.Fragment,{children:[n.jsx("div",{className:T("whitespace-nowrap overflow-hidden overflow-ellipsis min-w-0",o&&"text-primary",o?"flex-shrink-0":"flex-auto"),children:c}),!o&&n.jsx(br,{className:"icon-sm text-muted flex-shrink-0"})]},a)})})]})]})}function wf(){const{isAppearanceEditorActive:t}=Ju(),{data:e}=vf(),{base_url:s}=fe(),r=j.useRef(null),{pathname:i}=Yi(),a=Ge();return j.useEffect(()=>{e!=null&&e.defaults&&!se().defaults&&se().setDefaults(e.defaults)},[e]),j.useEffect(()=>{r.current&&se().setIframeWindow(r.current.contentWindow)},[]),j.useEffect(()=>{const o=i.split("/")[3];se().preview.navigate(o)},[i]),t?n.jsx(wl,{to:"/admin"}):n.jsxs("div",{className:"md:flex items-center h-full",children:[n.jsx(Js,{children:n.jsx(d,{message:"Appearance"})}),n.jsx(Sf,{values:e==null?void 0:e.values}),n.jsx("div",{className:"flex-auto h-full relative",children:n.jsx("iframe",{ref:r,className:T("w-full h-full",a&&"hidden"),src:`${s}?appearanceEditor=true`})})]})}function Sf({values:t}){const e=n.jsx("div",{className:"flex items-center justify-center flex-auto h-full",children:n.jsx(Gs,{isIndeterminate:!0,"aria-label":"Loading editor"})});return n.jsx(j.Fragment,{children:n.jsx("div",{className:"bg relative w-full md:w-320 shadow-lg border-r h-full z-10",children:t?n.jsx(Mf,{defaultValues:t}):e})})}function Mf({defaultValues:t}){const e=X({defaultValues:t}),{watch:s,reset:r}=e,i=yf();return j.useEffect(()=>{const a=s(o=>{se().preview.setValues(o)});return()=>a.unsubscribe()},[s]),n.jsxs(ce,{className:"h-full flex flex-col",form:e,onSubmit:a=>{i.mutate(a,{onSuccess:()=>r(a)})},children:[n.jsx(Nf,{isLoading:i.isLoading}),n.jsx(kf,{}),n.jsx("div",{className:"px-14 py-20 flex-auto overflow-y-auto",children:n.jsx(ks,{children:n.jsx(hr,{})})})]})}function Nf({isLoading:t}){const{formState:{dirtyFields:e}}=I(),s=Object.keys(e).length;return n.jsxs("div",{className:"border-b flex items-center h-50 pr-10 flex-shrink-0",children:[n.jsx(N,{border:"border-r",className:"text-muted",elementType:Y,to:"..",children:n.jsx(it,{})}),n.jsx("div",{className:"pl-10",children:n.jsx(d,{message:"Appearance editor"})}),n.jsx(w,{variant:"flat",color:"primary",className:"block ml-auto",disabled:!s||t,type:"submit",children:s?n.jsx(d,{message:"Save"}):n.jsx(d,{message:"Saved"})})]})}function Lf(){const t=ft(),{trans:e}=P(),{fields:s,append:r}=Qe({name:"settings.menus",keyName:"key"});return n.jsxs(j.Fragment,{children:[n.jsx("div",{children:s.map((i,a)=>n.jsx(wt,{to:`${a}`,elementType:Y,children:i.name},i.key))}),n.jsx("div",{className:"text-right",children:n.jsx(w,{variant:"outline",color:"primary",startIcon:n.jsx(at,{}),size:"xs",onClick:()=>{const i=Xi(10);r({name:e(g("New menu :number",{values:{number:s.length+1}})),id:i,positions:[],items:[]}),t(`${s.length}`)},children:n.jsx(d,{message:"Create menu"})})})]})}function bc({title:t=n.jsx(d,{message:"Add menu item"})}){const{data:e}=gt(["menuItemCategories"]),s=(e==null?void 0:e.menuItemCategories)||[],r=hc();return n.jsxs(ne,{size:"sm",children:[n.jsx(re,{children:t}),n.jsx(ie,{children:n.jsxs(ss,{variant:"outline",children:[n.jsx(nt,{label:n.jsx(d,{message:"Link"}),bodyClassName:"max-h-240 overflow-y-auto",children:n.jsx(Tf,{})}),n.jsx(nt,{label:n.jsx(d,{message:"Route"}),bodyClassName:"max-h-240 overflow-y-auto",children:n.jsx(Qa,{items:r})}),s.map(i=>n.jsx(nt,{label:n.jsx(d,{message:i.name}),children:n.jsx(Qa,{items:i.items})},i.name))]})})]})}function Tf(){const t=X({defaultValues:{id:Xi(6),type:"link",target:"_blank"}}),{close:e}=te();return n.jsxs(ce,{form:t,onSubmit:s=>{e(s)},children:[n.jsx(C,{required:!0,name:"label",label:n.jsx(d,{message:"Label"}),className:"mb-20"}),n.jsx(C,{required:!0,type:"url",name:"action",placeholder:"https://",label:n.jsx(d,{message:"Url"}),className:"mb-20"}),n.jsx("div",{className:"text-right",children:n.jsx(w,{type:"submit",variant:"flat",color:"primary",size:"xs",children:n.jsx(d,{message:"Add to menu"})})})]})}function Qa({items:t}){const{close:e}=te();return n.jsx(yl,{children:t.map(s=>n.jsx(vl,{startIcon:n.jsx(at,{size:"sm"}),onSelected:()=>{if(s.label){const r=s.label.split("/").pop();s.label=r?dc(r):s.label,s.id=Xi(6)}e(s)},children:s.label},s.id))})}const Af=D(n.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"DragIndicatorOutlined"),Sr=D(n.jsx("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}),"DeleteOutlined"),If=""+new URL("dropdown-menu-c9b3bd6a.svg",import.meta.url).href;function Ef(){const{menuIndex:t}=_e(),e=ft(),{getValues:s}=I(),r=`settings.menus.${t}`,i=s(r);return j.useEffect(()=>{i?se().preview.setHighlight(`[data-menu-id="${i.id}"]`):e("/admin/appearance/menus")},[e,i]),i?n.jsx(Df,{formPath:r}):null}function Df({formPath:t}){const{site:{has_mobile_app:e}}=fe(),s=ws(a=>{var o;return(o=a.config)==null?void 0:o.sections.menus.config}),r=j.useMemo(()=>{const a=[...s==null?void 0:s.positions];return e&&a.push("mobile-app-about"),a.map(o=>({key:o,name:o.replaceAll("-"," ")}))},[s,e]),i=Qe({name:`${t}.items`,keyName:"key"});return n.jsxs(j.Fragment,{children:[n.jsxs("div",{className:"mb-30 pb-30 border-b",children:[n.jsx(C,{name:`${t}.name`,label:n.jsx(d,{message:"Menu name"}),className:"mb-20",autoFocus:!0}),n.jsx(En,{chipSize:"sm",name:`${t}.positions`,valueKey:"id",label:n.jsx(d,{message:"Menu positions"}),description:n.jsx(d,{message:"Where should this menu appear on the site"}),children:r.map(a=>n.jsx(v,{value:a.key,capitalizeFirst:!0,children:a.name},a.key))})]}),n.jsx(Of,{fieldArray:i}),n.jsx("div",{className:"text-right",children:n.jsx(Pf,{})})]})}function Of({fieldArray:{append:t,fields:e,move:s}}){const r=ft();return n.jsxs(j.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-16 justify-between flex-shrink-0",children:[n.jsx(d,{message:"Menu items"}),n.jsxs(z,{type:"popover",placement:"right",offset:20,onClose:i=>{i&&(t({...i}),r(`items/${e.length}`))},children:[n.jsx(w,{variant:"outline",color:"primary",size:"xs",startIcon:n.jsx(at,{}),children:n.jsx(d,{message:"Add"})}),n.jsx(bc,{})]})]}),n.jsxs("div",{className:"mt-20 flex-shrink-0",children:[e.map((i,a)=>n.jsx(Ff,{item:i,items:e,index:a,onSortEnd:(o,l)=>{s(o,l)}},i.key)),e.length?null:n.jsx(fr,{size:"xs",className:"my-40",image:n.jsx(gr,{src:If}),title:n.jsx(d,{message:"No menu items yet"}),description:n.jsx(d,{message:"Click “add“ button to start adding links, pages, routes and other items to this menu. "})})]})]})}function Pf(){const t=ft(),{menuIndex:e}=_e(),{fields:s,remove:r}=Qe({name:"settings.menus",keyName:"key"});if(!e)return null;const i=s[+e];return n.jsxs(z,{type:"modal",onClose:a=>{if(a){const o=s.findIndex(l=>l.id===i.id);r(o),t("/admin/appearance/menus")}},children:[n.jsx(w,{variant:"outline",color:"danger",size:"xs",startIcon:n.jsx(Sr,{}),children:n.jsx(d,{message:"Delete menu"})}),n.jsx(lt,{isDanger:!0,title:n.jsx(d,{message:"Delete menu"}),body:n.jsx(d,{message:"Are you sure you want to delete “:name“?",values:{name:i.name}}),confirm:n.jsx(d,{message:"Delete"})})]})}function Ff({item:t,items:e,index:s,onSortEnd:r}){const i=j.useRef(null),{sortableProps:a,dragHandleRef:o}=la({item:t,items:e,type:"menuEditorSortable",ref:i,onSortEnd:r,previewVariant:"liveSort"}),l=t.icon&&Gi(t.icon),c=n.jsxs("div",{className:"text-muted flex items-center gap-4 text-xs",children:[l&&n.jsx(l,{size:"sm"}),"(",n.jsx(d,{message:"No label..."}),")"]});return n.jsx(j.Fragment,{children:n.jsx(wt,{elementType:Y,to:`items/${s}`,ref:i,...a,children:n.jsxs("div",{className:"flex items-center gap-10",children:[n.jsx(N,{ref:o,size:"sm",children:n.jsx(Af,{className:"text-muted hover:cursor-move"})}),n.jsx("div",{children:t.label||c})]})})})}function zf(){const{menuIndex:t,menuItemIndex:e}=_e(),s=xe(),{getValues:r}=I(),i=`settings.menus.${t}.items.${e}`,a=r(i);return j.useEffect(()=>{a&&se().preview.setHighlight(`[data-menu-item-id="${a.id}"]`)},[s,a]),!a||e==null?null:n.jsx(Rf,{formPath:i})}function Rf({formPath:t}){return n.jsxs(j.Fragment,{children:[n.jsx(Ds,{formPathPrefix:t}),n.jsx("div",{className:"text-right mt-40",children:n.jsx(_f,{})})]})}function _f(){const t=xe(),{menuIndex:e,menuItemIndex:s}=_e(),{fields:r,remove:i}=Qe({name:`settings.menus.${+e}.items`});if(!s)return null;const a=r[+s];return n.jsxs(z,{type:"modal",onClose:o=>{o&&s&&(i(+s),t(`/admin/appearance/menus/${e}`))},children:[n.jsx(w,{variant:"outline",color:"danger",size:"xs",startIcon:n.jsx(Sr,{}),children:n.jsx(d,{message:"Delete this item"})}),n.jsx(lt,{isDanger:!0,title:n.jsx(d,{message:"Delete menu item"}),body:n.jsx(d,{message:"Are you sure you want to delete “:name“?",values:{name:a.label}}),confirm:n.jsx(d,{message:"Delete"})})]})}function Bf(){return n.jsxs(j.Fragment,{children:[n.jsx(nn,{label:n.jsx(d,{message:"Favicon"}),description:n.jsx(d,{message:"This will generate different size favicons. Image should be at least 512x512 in size."}),type:"favicon"}),n.jsx(nn,{label:n.jsx(d,{message:"Light logo"}),description:n.jsx(d,{message:"Will be used on dark backgrounds."}),type:"logo_light"}),n.jsx(nn,{label:n.jsx(d,{message:"Dark logo"}),description:n.jsx(d,{message:"Will be used on light backgrounds. Will default to light logo if left empty."}),type:"logo_dark"}),n.jsx(nn,{label:n.jsx(d,{message:"Mobile light logo"}),description:n.jsx(d,{message:"Will be used on light backgrounds on mobile. Will default to desktop logo if left empty."}),type:"logo_light_mobile"}),n.jsx(nn,{label:n.jsx(d,{message:"Mobile dark logo"}),description:n.jsx(d,{message:"Will be used on dark backgrounds on mobile. Will default to desktop if left empty."}),type:"logo_dark_mobile"}),n.jsx(Vf,{}),n.jsx($f,{})]})}function nn({label:t,description:e,type:s}){const r=ws(i=>{var a;return(a=i.defaults)==null?void 0:a.settings.branding[s]});return n.jsx(Yt,{name:`settings.branding.${s}`,className:"border-b pb-30 mb-30",label:t,description:e,diskPrefix:"branding_media",defaultValue:r,onChange:()=>{se().preview.setHighlight('[data-logo="navbar"]')}})}function Vf(){return n.jsx(C,{name:"appearance.env.app_name",required:!0,className:"mt-20",label:n.jsx(d,{message:"Site name"})})}function $f(){return n.jsx(C,{name:"settings.branding.site_description",className:"mt-20",inputElementType:"textarea",rows:4,label:n.jsx(d,{message:"Site description"})})}function Hf(t=1,e=1e4){const s=new Uint32Array(1);window.crypto.getRandomValues(s);const r=s[0]/(4294967295+1);return t=Math.ceil(t),e=Math.floor(e),Math.floor(r*(e-t+1))+t}function qf(){const{trans:t}=P(),e=ft(),{data:{themes:s}}=Sl(),{fields:r,append:i}=Qe({name:"appearance.themes.all",keyName:"key"});return j.useEffect(()=>{s.selectedThemeId&&se().preview.setActiveTheme(s.selectedThemeId)},[s.selectedThemeId]),n.jsxs(j.Fragment,{children:[n.jsx("div",{className:"mb-20",children:n.jsx(w,{size:"xs",variant:"outline",color:"primary",startIcon:n.jsx(at,{}),onClick:()=>{var o;const a=(o=se().defaults)==null?void 0:o.appearance.themes.light;i({id:Hf(),name:t(g("New theme")),colors:a}),e(`${r.length+1}`)},children:n.jsx(d,{message:"New theme"})})}),r.map((a,o)=>n.jsx(wt,{to:`${o}`,elementType:ea,children:a.name},a.key))]})}function Uf(){const{fields:t}=Qe({name:"appearance.seo"});return n.jsx(j.Fragment,{children:t.map((e,s)=>n.jsx(C,{className:"mb-20",name:`appearance.seo.${s}.value`,label:n.jsx(d,{message:e.name}),placeholder:e.defaultValue,inputElementType:"textarea",rows:3},e.id))})}const Wf=_.lazy(()=>Nn(()=>import("./ace-editor-74b87ff0.js"),["./ace-editor-74b87ff0.js","./main-1406e08c.js","./main-f52edbcd.css","./index-4d501b15.js"],import.meta.url));function yc({defaultValue:t,mode:e="html",title:s}){const[r,i]=j.useState(t),[a,o]=j.useState(!0);return n.jsxs(ne,{size:"fullscreen",className:"h-full w-full",children:[n.jsx(re,{children:s}),n.jsx(ie,{className:"relative flex-auto",padding:"p-0",children:n.jsx(j.Suspense,{fallback:n.jsx("div",{className:"flex items-center justify-center w-full h-400",children:n.jsx(Gs,{"aria-label":"Loading editor...",isIndeterminate:!0,size:"md"})}),children:n.jsx(Wf,{mode:e,onChange:l=>{i(l)},defaultValue:r||"",onIsValidChange:o})})}),n.jsx(Zf,{isValid:a,value:r})]})}function Zf({isValid:t,value:e}){const{close:s}=te();return n.jsxs(le,{dividerTop:!0,children:[n.jsx(w,{onClick:()=>s(),children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{disabled:!t,variant:"flat",color:"primary",onClick:()=>{s(e)},children:n.jsx(d,{message:"Save"})})]})}function Kf(){return n.jsxs(j.Fragment,{children:[n.jsx(Ya,{mode:"css"}),n.jsx(Ya,{mode:"html"})]})}function Ya({mode:t}){const{getValues:e}=I(),{setValue:s}=I(),r=t==="html"?n.jsx(d,{message:"Custom HTML & JavaScript"}):n.jsx(d,{message:"Custom CSS"});return n.jsxs(z,{type:"modal",onClose:i=>{i!=null&&(s(`appearance.custom_code.${t}`,i,{shouldDirty:!0}),se().preview.setCustomCode(t,i))},children:[n.jsx(wt,{children:r}),n.jsx(yc,{title:r,defaultValue:e(`appearance.custom_code.${t}`)||"",mode:t})]})}const Jf=""+new URL("articles-8bfd9f17.svg",import.meta.url).href,Gf=t=>{const e=t.customPages.types.length>1?[{control:{type:V.Select,defaultValue:"default",options:t.customPages.types.map(s=>({value:s.type,label:s.label,key:s.type}))},key:"type",label:g("Type"),description:g("Type of the page"),defaultOperator:q.eq}]:[];return[{key:"user_id",label:g("User"),description:g("User page was created by"),defaultOperator:q.eq,control:{type:V.SelectModel,model:Pt}},...e,Be({description:g("Date page was created")}),Ve({description:g("Date page was last updated")})]},Qf=[{key:"slug",allowsSorting:!0,width:"flex-2 min-w-200",visibleInMode:"all",header:()=>n.jsx(d,{message:"Slug"}),body:t=>n.jsx(Y,{target:"_blank",to:`/pages/${t.slug}`,className:Qs,children:t.slug})},{key:"user_id",allowsSorting:!0,width:"flex-2 min-w-140",header:()=>n.jsx(d,{message:"Owner"}),body:t=>t.user&&n.jsx(mt,{image:t.user.avatar,label:t.user.display_name,description:t.user.email})},{key:"type",maxWidth:"max-w-100",header:()=>n.jsx(d,{message:"Type"}),body:t=>n.jsx(d,{message:t.type})},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>n.jsx(d,{message:"Last updated"}),body:t=>n.jsx(he,{date:t.updated_at})},{key:"actions",header:()=>n.jsx(d,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-84 flex-shrink-0",visibleInMode:"all",body:t=>n.jsx(N,{size:"md",className:"text-muted",elementType:Y,to:`${t.id}/edit`,children:n.jsx(Ee,{})})}];function Yf(){const t=j.useContext(Ot),e=j.useMemo(()=>Gf(t),[t]);return n.jsx(De,{endpoint:"custom-pages",title:n.jsx(d,{message:"Custom pages"}),filters:e,columns:Qf,queryParams:{with:"user"},actions:n.jsx(Xf,{}),selectedActions:n.jsx($e,{}),emptyStateMessage:n.jsx(ve,{image:Jf,title:n.jsx(d,{message:"No pages have been created yet"}),filteringTitle:n.jsx(d,{message:"No matching pages"})})})}function Xf(){return n.jsx(Ze,{elementType:Y,to:"new",children:n.jsx(d,{message:"New page"})})}const eg=[{label:g("Local search"),to:"search"},{label:g("Automation"),to:"providers"},{label:g("Player"),to:"player"}],vc=[{label:g("General"),to:"general"},...eg,{label:g("Subscriptions"),to:"subscriptions"},{label:g("Localization"),to:"localization"},{label:g("Authentication"),to:"authentication"},{label:g("Uploading"),to:"uploading"},{label:g("Mail"),to:"mail"},{label:g("Cache"),to:"cache"},{label:g("Analytics"),to:"analytics"},{label:g("Logging"),to:"logging"},{label:g("Queue"),to:"queue"},{label:g("Recaptcha"),to:"recaptcha"},{label:g("GDPR"),to:"gdpr"},{label:g("Menus"),to:"/admin/appearance/menus"},{label:g("Seo"),to:"/admin/appearance/seo-settings"},{label:g("Themes"),to:"/admin/appearance/themes"}];function tg({className:t}){const e=Ge();return n.jsxs("div",{className:T(t,"md:flex gap-30 min-h-full items-start p-24 container mx-auto"),children:[n.jsx(Js,{children:n.jsx(d,{message:"Settings"})}),e?n.jsx(sg,{}):n.jsx(ng,{}),n.jsx("div",{className:"md:px-30 flex-auto relative max-w-500",children:n.jsx(hr,{})})]})}function sg(){const{pathname:t}=Yi(),e=ft(),s=t.split("/").pop();return n.jsx(Mn,{minWidth:"min-w-none",className:"w-full bg-paper mb-24",selectionMode:"single",selectedValue:s,onSelectionChange:r=>{e(r)},children:vc.map(r=>n.jsx(v,{value:r.to,children:n.jsx(d,{...r.label})},r.to))})}function ng(){return n.jsx("div",{className:"w-240 sticky top-24 flex-shrink-0",children:vc.map(t=>n.jsx(ea,{to:t.to,className:({isActive:e})=>T("block p-14 whitespace-nowrap mb-8 rounded border-l-4 text-sm transition-bg-color",e?"bg-primary/selected border-l-primary font-medium":"border-l-transparent hover:bg-hover"),children:n.jsx(d,{...t.label})},t.to))})}function Pn(){return Xt(["fetchAdminSettings"],()=>rg(),{staleTime:1/0})}function rg(){return O.get("settings").then(t=>t.data)}function ig(){return O.post("sitemap/generate").then(t=>t.data)}function ag(){return $(()=>ig(),{onSuccess:()=>{H(g("Sitemap generated"))},onError:t=>oe(t)})}const Vr=t=>t instanceof Date,og=t=>Object.keys(t).length===0,Ci=t=>t!=null&&typeof t=="object",Xa=(t,...e)=>Object.prototype.hasOwnProperty.call(t,...e),$r=t=>Ci(t)&&og(t),lg=()=>Object.create(null),ki=(t,e)=>{if(t===e)return{};if(!Ci(t)||!Ci(e))return e;const s=Object.keys(t).reduce((r,i)=>(Xa(e,i)||(r[i]=void 0),r),lg());return Vr(t)||Vr(e)?t.valueOf()==e.valueOf()?{}:e:Object.keys(e).reduce((r,i)=>{if(!Xa(t,i))return r[i]=e[i],r;const a=ki(t[i],e[i]);return $r(a)&&!Vr(a)&&($r(t[i])||!$r(e[i]))||(r[i]=a),r},s)};function Cc(t){const{data:e}=Pn();return $(s=>{var a,o,l,c,u,h;(o=(a=s.client)==null?void 0:a.cookie_notice)!=null&&o.button&&(s.client.cookie_notice.button=JSON.stringify(s.client.cookie_notice.button)),(c=(l=s.client)==null?void 0:l.registration)!=null&&c.policies&&(s.client.registration.policies=JSON.stringify(s.client.registration.policies)),(h=(u=s.client)==null?void 0:u.artistPage)!=null&&h.tabs&&(s.client.artistPage.tabs=JSON.stringify(s.client.artistPage.tabs));const r=s.client?ki(e.client,s.client):null,i=s.server?ki(e.server,s.server):null;return cg({client:r,server:i,files:s.files})},{onSuccess:()=>{H(g("Settings updated"),{position:"bottom-right"}),F.invalidateQueries(["fetchAdminSettings"])},onError:s=>ge(s,t)})}function cg({client:t,server:e,files:s}){const r=new FormData;return t&&r.set("client",JSON.stringify(Ha.dot(t))),e&&r.set("server",JSON.stringify(Ha.dot(e))),Object.entries(s||{}).forEach(([i,a])=>{r.set(i,a)}),O.post("settings",r,{headers:{"Content-Type":"multipart/form-data"}}).then(i=>i.data)}function He({title:t,description:e,children:s}){const{data:r}=Pn();return n.jsxs("section",{children:[n.jsxs("div",{className:"mb-40",children:[n.jsx("h2",{className:"text-xl mb-4",children:t}),n.jsx("div",{className:"text-sm text-muted",children:e})]}),r?n.jsx(dg,{defaultValues:r,children:s}):n.jsx(Gs,{isIndeterminate:!0,"aria-label":"Loading settings..."})]})}function dg({children:t,defaultValues:e}){const s=X({defaultValues:e}),r=Cc(s);return n.jsxs(j.Fragment,{children:[n.jsxs(ce,{form:s,onBeforeSubmit:()=>{const i=s.formState.errors,a=Object.keys(i).filter(o=>o.endsWith("_group"));s.clearErrors(a)},onSubmit:i=>{r.mutate(i)},children:[t,n.jsx("div",{className:"mt-40",children:n.jsx(w,{type:"submit",variant:"flat",color:"primary",disabled:r.isLoading,children:n.jsx(d,{message:"Update"})})})]}),r.isLoading&&n.jsx(bl,{size:"xs",className:"absolute -bottom-14 left-30 w-full",isIndeterminate:!0,"aria-label":"Saving settings..."})]})}function It(){return n.jsx("div",{className:"h-1 bg-divider my-30"})}const ga=D(n.jsx("path",{d:"M17 7h-4v2h4c1.65 0 3 1.35 3 3s-1.35 3-3 3h-4v2h4c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-6 8H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-2zm-3-4h8v2H8z"}),"LinkOutlined");function Kt({link:t,className:e}){const{site:s}=fe();return s.hide_docs_button?null:n.jsxs("div",{className:T("flex items-center gap-8",e),children:[n.jsx(ga,{size:"sm"}),n.jsx(xr,{href:t,children:n.jsx(d,{message:"Learn more"})})]})}function ug(){return n.jsxs(He,{title:n.jsx(d,{message:"General"}),description:n.jsx(d,{message:"Configure site url, homepage, theme and other general settings."}),children:[n.jsx(hg,{}),n.jsx(It,{}),n.jsx(mg,{}),n.jsx(It,{}),n.jsx(pg,{}),n.jsx(It,{}),n.jsx(fg,{})]})}function hg(){const{data:t}=Pn();if(!t)return null;let e=null;const s=t.server,r=s.newAppUrl&&s.newAppUrl!==s.app_url;return r&&(e=n.jsx("div",{className:"text-sm text-danger mt-20",children:n.jsx(d,{values:{baseUrl:s.app_url,currentUrl:s.newAppUrl,b:i=>n.jsx("b",{children:i})},message:"Base site url is set as <b>:baseUrl</b> in configuration, but current url is <b>:currentUrl</b>. It is recommended to set the primary url you want to use in configuration file and then redirect all other url versions to this primary version via cpanel or .htaccess file."})})),n.jsxs(j.Fragment,{children:[n.jsx(C,{invalid:!!r,name:"server.app_url",label:n.jsx(d,{message:"Primary site url"}),description:n.jsx(Kt,{link:"https://support.vebto.com/help-center/articles/35/primary-site-url"})}),e]})}function mg(){var i,a;const{watch:t}=I(),{homepage:e}=j.useContext(Ot),{data:s}=gt(["menuItemCategories"]),r=t("client.homepage.type");return n.jsxs("div",{children:[n.jsxs(G,{name:"client.homepage.type",selectionMode:"single",label:n.jsx(d,{message:"Site home page"}),description:n.jsx(d,{message:"Which page should be used as site homepage."}),children:[e.options.map(o=>n.jsx(v,{value:o.value,children:n.jsx(d,{...o.label})},o.value)),(i=s==null?void 0:s.menuItemCategories)==null?void 0:i.map(o=>n.jsx(v,{value:o.type,children:o.name},o.type))]}),(a=s==null?void 0:s.menuItemCategories)==null?void 0:a.map(o=>r===o.type?n.jsx(G,{className:"mt-24",name:"client.homepage.value",selectionMode:"single",label:n.jsx(d,{message:"Homepage :name",values:{name:o.name}}),children:o.items.map(l=>n.jsx(v,{value:l.model_id,children:l.label},l.label))},o.name):null)]})}function pg(){const{data:{themes:t}}=Sl();return n.jsxs(j.Fragment,{children:[n.jsxs(G,{className:"mb-20",name:"client.themes.default_id",selectionMode:"single",label:n.jsx(d,{message:"Default site theme"}),description:n.jsx(d,{message:"Which theme to use for users that have not chosen a theme manually."}),children:[n.jsx(v,{value:0,children:n.jsx(d,{message:"System"})}),t.all.map(e=>n.jsx(v,{value:e.id,children:e.name},e.id))]}),n.jsx(E,{name:"client.themes.user_change",description:n.jsx(d,{message:"Allow users to manually change site theme."}),children:n.jsx(d,{message:"Allow theme change"})})]})}function fg(){const t=ag(),{base_url:e}=fe(),s=`${e}/storage/sitemaps/sitemap-index.xml`,r=n.jsx(xr,{href:s,children:s});return n.jsxs(n.Fragment,{children:[n.jsx(w,{variant:"outline",size:"xs",color:"primary",disabled:t.isLoading,onClick:()=>{t.mutate()},children:n.jsx(d,{message:"Generate sitemap"})}),n.jsx("div",{className:"text-sm text-muted mt-14",children:n.jsx(d,{message:"Once generated, sitemap url will be: :url",values:{url:r}})})]})}function gg(t){return _l(t).toString("rgb").replace("rgb(","").replace(")","").replace(/, ?/g," ")}const xg=D(n.jsx("path",{d:"M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"}),"TuneOutlined");function jg(){const{getValues:t,setValue:e}=I(),{themeIndex:s}=_e(),r=t(`appearance.themes.all.${+s}`);return n.jsxs(z,{type:"modal",onClose:i=>{i&&t("appearance.themes.all").forEach((a,o)=>{if(a.id===i.id){e(`appearance.themes.all.${o}`,i,{shouldDirty:!0});return}if(i.default_light){e(`appearance.themes.all.${o}`,{...a,default_light:!1},{shouldDirty:!0});return}if(i.default_dark){e(`appearance.themes.all.${o}`,{...a,default_dark:!1},{shouldDirty:!0});return}})},children:[n.jsx(w,{size:"xs",variant:"outline",color:"primary",startIcon:n.jsx(xg,{}),children:n.jsx(d,{message:"Settings"})}),n.jsx(bg,{theme:r})]})}function bg({theme:t}){const e=X({defaultValues:t}),{close:s,formId:r}=te();return j.useEffect(()=>{const i=e.watch((a,{name:o})=>{o==="default_light"&&a.default_light&&e.setValue("default_dark",!1),o==="default_dark"&&a.default_dark&&e.setValue("default_light",!1)});return()=>i.unsubscribe()},[e]),n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Update settings"})}),n.jsx(ie,{children:n.jsxs(ce,{form:e,id:r,onSubmit:i=>{s(i)},children:[n.jsx(C,{name:"name",label:n.jsx(d,{message:"Name"}),className:"mb-30",autoFocus:!0}),n.jsx(E,{name:"is_dark",className:"mb-20 pb-20 border-b",description:n.jsx(d,{message:"Whether this theme has light text on dark background."}),children:n.jsx(d,{message:"Dark theme"})}),n.jsx(E,{name:"default_light",className:"mb-30",description:n.jsx(d,{message:"When light mode is selected, this theme will be used."}),children:n.jsx(d,{message:"Default for light mode"})}),n.jsx(E,{name:"default_dark",description:n.jsx(d,{message:"When dark mode is selected, this theme will be used."}),children:n.jsx(d,{message:"Default for dark mode"})})]})}),n.jsxs(le,{children:[n.jsx(w,{onClick:()=>{s()},children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{variant:"flat",color:"primary",type:"submit",form:r,disabled:!e.formState.isDirty,children:n.jsx(d,{message:"Save"})})]})]})}const yg=D(n.jsx("path",{d:"M6 13c0-1.65.67-3.15 1.76-4.24L6.34 7.34C4.9 8.79 4 10.79 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91zm14 0c0-4.42-3.58-8-8-8-.06 0-.12.01-.18.01l1.09-1.09L11.5 2.5 8 6l3.5 3.5 1.41-1.41-1.08-1.08c.06 0 .12-.01.17-.01 3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93z"}),"RestartAltOutlined");function vg(){const t=xe(),{themeIndex:e}=_e(),[s,r]=j.useState(!1),{setValue:i,getValues:a}=I(),{fields:o,remove:l}=Qe({name:"appearance.themes.all"}),c=()=>{if(o.length<=1){H.danger(g("At least one theme is required"));return}e&&(t("/admin/appearance/themes"),l(+e),i("appearance.themes.selectedThemeId",null))};return n.jsxs(j.Fragment,{children:[n.jsxs(Ln,{onItemSelected:u=>{if(u==="delete")r(!0);else if(u==="reset"){const h=`appearance.themes.all.${+e}`,m=a(`${h}.is_dark`)?se().defaults.appearance.themes.dark:se().defaults.appearance.themes.light;Object.entries(m).forEach(([p,f])=>{se().preview.setThemeColor(p,f)}),i(`${h}.colors`,m,{shouldDirty:!0})}},children:[n.jsx(N,{size:"md",className:"text-muted",children:n.jsx(Al,{})}),n.jsxs(Tn,{children:[n.jsx(v,{value:"reset",startIcon:n.jsx(yg,{}),children:n.jsx(d,{message:"Reset colors"})}),n.jsx(v,{value:"delete",startIcon:n.jsx(Sr,{}),children:n.jsx(d,{message:"Delete"})})]})]}),n.jsx(z,{type:"modal",isOpen:s,onClose:u=>{u&&c(),r(!1)},children:n.jsx(lt,{isDanger:!0,title:n.jsx(d,{message:"Delete theme"}),body:n.jsx(d,{message:"Are you sure you want to delete this theme?"}),confirm:n.jsx(d,{message:"Delete"})})})]})}function Cg(){const t=ft(),{themeIndex:e}=_e(),{getValues:s}=I(),r=s(`appearance.themes.all.${+e}`);return j.useEffect(()=>{r||t("/admin/appearance/themes")},[t,r]),j.useEffect(()=>{r!=null&&r.id&&se().preview.setActiveTheme(r.id)},[r==null?void 0:r.id]),r?n.jsxs(j.Fragment,{children:[n.jsxs("div",{className:"mb-20 flex items-center gap-10 justify-between",children:[n.jsx(jg,{}),n.jsx(vg,{})]}),n.jsx("div",{children:Object.entries(r.colors).filter(([i])=>!i.endsWith("opacity")).map(([i,a])=>n.jsx(kg,{colorName:i,initialThemeValue:a,theme:r},i))})]}):null}function kg({theme:t,colorName:e,initialThemeValue:s}){const{setValue:r}=I(),{themeIndex:i}=_e(),[a,o]=j.useState(s),l=u=>{o(u),se().preview.setThemeColor(e,u)};j.useEffect(()=>{o(s)},[s]);const c=wm(s);return n.jsxs(z,{currentValue:c,type:"popover",placement:"right",offset:10,onClose:u=>{u&&u!==c?(r(`appearance.themes.all.${+i}.colors.${e}`,a,{shouldDirty:!0}),r("appearance.themes.selectedThemeId",t.id)):l(s)},children:[n.jsx(wt,{className:"capitalize",startIcon:n.jsx(mc,{viewBox:"0 0 48 48",className:"icon-lg",style:{fill:`rgb(${a})`}}),children:e.replace("--be-","").replace("-"," ")}),n.jsx(fa,{defaultValue:c,onChange:u=>{l(gg(u))}})]})}function St({title:t,description:e,actions:s,color:r="primary",className:i}){return n.jsxs("div",{className:T(i,"p-10 rounded",r==="positive"&&"bg-positive/focus border-l-positive border-l-4",r==="warning"&&"bg-warning/focus border-l-warning border-l-4",r==="danger"&&"bg-danger/focus border-l-danger border-l-4",r==="primary"&&"bg-primary/focus border-l-primary border-l-4",r==="neutral"&&"bg-paper border"),children:[t&&n.jsx("div",{className:"text-sm mb-4 font-medium",children:t}),e&&n.jsx("div",{className:"text-sm",children:e}),s&&n.jsx("div",{className:"mt-14",children:s})]})}function Oe({children:t,name:e,separatorBottom:s=!0,separatorTop:r=!0}){const{formState:{errors:i}}=I(),a=j.useRef(null),o=i[e];return j.useEffect(()=>{var l;o&&((l=a.current)==null||l.scrollIntoView({behavior:"smooth"}))},[o]),n.jsxs("div",{className:T(s&&"border-b mb-20 pb-20",r&&"border-t mt-20 pt-20",o&&"border-y-error"),ref:a,children:[t(!!o),o&&n.jsx("div",{className:"text-danger text-sm mt-20",dangerouslySetInnerHTML:{__html:o.message}})]})}function wg(){return Xt(["search-models"],()=>Sg())}function Sg(){return O.get("admin/search/models").then(t=>t.data)}function Mg(){const{trans:t}=P();return $(e=>Ng(e),{onSuccess:()=>{H(t(g("Imported search models")))},onError:e=>oe(e)})}function Ng(t){return O.post("admin/search/import",t).then(e=>e.data)}function Lg(){return n.jsxs(He,{title:n.jsx(d,{message:"Search"}),description:n.jsx(d,{message:"Configure search method used on the site as well as related 3rd party integrations."}),children:[n.jsx(Tg,{}),n.jsx(Og,{})]})}function Tg(){const{watch:t}=I(),e=t("server.scout_driver");return n.jsx(Oe,{name:"search_group",separatorBottom:!1,children:s=>n.jsxs(j.Fragment,{children:[n.jsxs(G,{invalid:s,name:"server.scout_driver",selectionMode:"single",label:n.jsx(d,{message:"Search method"}),description:n.jsx(d,{message:"Which method should be used for search related functionality across the site."}),children:[n.jsx(v,{value:"mysql",children:"Mysql"}),n.jsx(v,{value:"meilisearch",children:"Meilisearch"}),n.jsx(v,{value:"tntsearch",children:"TNTSearch"}),n.jsx(v,{value:"Matchish\\ScoutElasticSearch\\Engines\\ElasticSearchEngine",children:"Elasticsearch"}),n.jsx(v,{value:"algolia",children:"Algolia"})]}),e==="mysql"&&n.jsx(Ag,{}),e==="meilisearch"&&n.jsx(Ig,{}),e==="algolia"&&n.jsx(Dg,{}),e==="Matchish\\ScoutElasticSearch\\Engines\\ElasticSearchEngine"&&n.jsx(Eg,{})]})})}function Ag(){const{clearErrors:t}=I();return n.jsxs(G,{className:"mt-24",name:"server.scout_mysql_mode",selectionMode:"single",label:n.jsx(d,{message:"MySQL mode"}),onSelectionChange:()=>{t()},children:[n.jsx(v,{value:"basic",children:n.jsx(d,{message:"Basic"})}),n.jsx(v,{value:"extended",children:n.jsx(d,{message:"Extended"})}),n.jsx(v,{value:"fulltext",children:n.jsx(d,{message:"Fulltext"})})]})}function Ig(){return n.jsx(St,{className:"mt-24",color:"warning",title:n.jsx(d,{message:"Important!"}),description:n.jsx(d,{message:"<a>Meilisearch</a> needs to be installed and running for this method to work.",values:{a:t=>n.jsx("a",{href:"https://www.meilisearch.com",target:"_blank",rel:"noreferrer",children:t})}})})}function Eg(){return n.jsx(St,{className:"mt-24",color:"warning",title:n.jsx(d,{message:"Important!"}),description:n.jsx(d,{message:"<a>Elasticsearch</a> needs to be installed and running for this method to work.",values:{a:t=>n.jsx("a",{href:"https://www.elastic.co",target:"_blank",rel:"noreferrer",children:t})}})})}function Dg(){return n.jsxs(j.Fragment,{children:[n.jsx(C,{className:"mt-24",name:"server.algolia_app_id",label:n.jsx(d,{message:"Algolia app ID"}),required:!0}),n.jsx(C,{className:"mt-24",name:"server.algolia_secret",label:n.jsx(d,{message:"Algolia app secret"}),required:!0})]})}function Og(){const{getValues:t}=I(),{data:e}=wg(),s=Mg(),[r,i]=j.useState("*");return n.jsx(St,{className:"mt-34",color:"neutral",title:n.jsx(d,{message:"Import records"}),description:n.jsxs("span",{children:[n.jsx(d,{message:"Whenever a new search method is enabled, records that already exist in database need to be imported into the index. All records created after search method is enabled will be imported automatically."}),n.jsx("br",{}),n.jsx("br",{}),n.jsx(d,{message:"Depending on number of records in database, importing could take some time. Don't close this window while it is in progress."})]}),actions:n.jsxs("div",{className:"pt-14 mt-10 border-t",children:[n.jsxs(Mn,{selectionMode:"single",label:n.jsx(d,{message:"What to import?"}),selectedValue:r,onSelectionChange:a=>{i(a)},children:[n.jsx(v,{value:"*",children:n.jsx(d,{message:"Everything"})}),e==null?void 0:e.models.map(a=>n.jsx(v,{value:a.model,children:n.jsx(d,{message:a.name})},a.model))]}),n.jsx(w,{variant:"flat",color:"primary",className:"mt-24 mb-8",disabled:s.isLoading,onClick:()=>{s.mutate({model:r,driver:t("server.scout_driver")})},children:n.jsx(d,{message:"Import now"})})]})})}function Pg(){return n.jsxs(He,{title:n.jsx(d,{message:"Content automation"}),description:n.jsx(d,{message:"Select and configure providers that will be used to automatically import artist, album, track and other content."}),children:[n.jsxs("div",{className:"border-b mb-20",children:[n.jsx(E,{className:"mb-24",name:"client.artist_provider",value:"spotify",description:n.jsx(d,{message:"This will automatically import, and periodically update, all metadata available on spotify about the artist when user visits that artist's page."}),children:n.jsx(d,{message:"Artist automation"})}),n.jsx(Fg,{})]}),n.jsx(E,{className:"mb-24",name:"client.album_provider",value:"spotify",description:n.jsx(d,{message:"This will automatically import, and periodically update, all metadata available on spotify about an when user visits that album's page."}),children:n.jsx(d,{message:"Album automation"})}),n.jsxs(G,{className:"mb-24",name:"client.search_provider",selectionMode:"single",label:n.jsx(d,{message:"Search method"}),description:n.jsx(d,{message:"Which method should be used for user facing search in the web player."}),children:[n.jsx(v,{value:"spotify",description:n.jsx(d,{message:"Search on the site will directly connect to, and search spotify. Any artist, album and track available on spotify will be discoverable via search, without needing to import or create it first."}),children:n.jsx(d,{message:"Spotify"})}),n.jsx(v,{value:"local",description:n.jsx(d,{message:"Will only search content that was created or imported from backstage or admin area. This can be further configured from 'Local search' settings page."}),children:n.jsx(d,{message:"Local"})}),n.jsx(v,{value:"localAndSpotify",description:n.jsx(d,{message:"Will combine search results from both 'local' and 'spotify' methods. If there are identical matches, local results will be preferred."}),children:n.jsx(d,{message:"Local and spotify"})})]}),n.jsx(zg,{}),n.jsx(E,{className:"mb-24",name:"client.player.lyrics_automate",value:"spotify",description:n.jsx(d,{message:"Try to automatically find and import lyrics based on song and artist name. Lyrics can still be added manually, if this is disabled."}),children:n.jsx(d,{message:"Lyrics automation"})})]})}function Fg(){const{watch:t}=I();return n.jsxs(j.Fragment,{children:[n.jsxs(G,{className:"mb-24",name:"client.artist_bio_provider",selectionMode:"single",label:n.jsx(d,{message:"Artist biography provider"}),description:n.jsx(d,{message:"Which method should be used for user facing search in the web player."}),children:[n.jsx(v,{value:"wikipedia",description:n.jsx(d,{message:"Will import artist biography from wikipedia in the selected language."}),children:n.jsx(d,{message:"Wikipedia"})}),n.jsx(v,{value:"local",description:n.jsx(d,{message:"Will only show artist biography that was manually added from admin area or backstage."}),children:n.jsx(d,{message:"Local"})})]}),t("client.artist_bio_provider")==="wikipedia"&&n.jsx(C,{className:"mb-24",minLength:2,maxLength:2,name:"client.wikipedia_language",label:n.jsx(d,{message:"Wikipedia language"}),description:n.jsx(d,{message:"ISO 639-1 (two letter) language code."})})]})}function zg(){const{watch:t}=I();return[t("client.artist_provider"),t("client.album_provider"),t("client.search_provider")].some(s=>`${s}`.toLowerCase().includes("spotify"))?n.jsxs(j.Fragment,{children:[n.jsx(Oe,{name:"spotify_group",children:s=>n.jsxs(j.Fragment,{children:[n.jsx(C,{invalid:s,name:"server.spotify_id",label:n.jsx(d,{message:"Spotify ID"}),className:"mb-24",required:!0}),n.jsx(C,{invalid:s,name:"server.spotify_secret",label:n.jsx(d,{message:"Spotify secret"}),required:!0,description:n.jsx(Kt,{link:"https://support.vebto.com/help-center/articles/28/34/165/spotify-credentials"})})]})}),n.jsx(C,{className:"mb-24",name:"server.lastfm_api_key",label:n.jsx(d,{message:"LastFM Api Key"}),description:n.jsx(Kt,{link:"https://support.vebto.com/help-center/articles/28/34/166/lastfm-credentials"})})]}):null}function Rg(){const{watch:t}=I(),e=t("client.artistPage.tabs")||[];return n.jsxs("div",{children:[n.jsxs("div",{className:"text-sm mb-14",children:[n.jsx(d,{message:"Artist page tabs"}),n.jsx("div",{className:"text-xs text-muted",children:n.jsx(d,{message:"Select which tabs should appear on artist page and in which order."})})]}),e.map(s=>n.jsx(j.Fragment,{children:_g(s.id)},s.id)),n.jsxs(G,{className:"my-24",name:"client.player.default_artist_view",selectionMode:"single",label:n.jsx(d,{message:"Default albums layout"}),description:n.jsx(d,{message:"How should albums on main artist page be displayed by default."}),children:[n.jsx(v,{value:"list",children:n.jsx(d,{message:"List"})}),n.jsx(v,{value:"grid",children:n.jsx(d,{message:"Grid"})})]}),n.jsx(E,{name:"client.artistPage.showDescription",description:n.jsx(d,{message:"Whether short artist biography be shown in main artist page header."}),children:n.jsx(d,{message:"Show description"})})]})}function _g(t){switch(t){case Xe.tracks:return n.jsx(Ss,{id:Xe.tracks,title:n.jsx(d,{message:"Tracks"}),description:n.jsx(d,{message:"Show all artist tracks in a list view."})});case Xe.albums:return n.jsx(Ss,{id:Xe.albums,title:n.jsx(d,{message:"Albums"}),description:n.jsx(d,{message:"Show all artist albums in a list view."})});case Xe.followers:return n.jsx(Ss,{id:Xe.followers,title:n.jsx(d,{message:"Followers"}),description:n.jsx(d,{message:"Shows all users that are currently following an artist."})});case Xe.similar:return n.jsx(Ss,{id:Xe.similar,title:n.jsx(d,{message:"Similar artists"}),description:n.jsx(d,{message:"Shows similar artists."})});case Xe.about:return n.jsx(Ss,{id:Xe.about,title:n.jsx(d,{message:"About"}),description:n.jsx(d,{message:"Shows artist biography/description as well as extra images"})});case Xe.discography:return n.jsx(Ss,{id:Xe.discography,title:n.jsx(d,{message:"Discography"}),description:n.jsx(d,{message:"Shows all artist albums in grid or list view."})})}}function Ss({title:t,description:e,id:s}){var f;const r=j.useRef(null),i=j.useRef(null),{watch:a,setValue:o}=I(),l=a("client.artistPage.tabs")||[],c=l.map(x=>x.id),u=(f=l.find(x=>x.id===s))==null?void 0:f.active,h=c[0]===s,{sortableProps:m,dragHandleRef:p}=la({ref:r,item:s,items:c,type:"artistPageTabs",preview:i,previewVariant:"line",onSortEnd:(x,b)=>{o("client.artistPage.tabs",Sm(l,x,b))}});return n.jsxs(j.Fragment,{children:[n.jsxs("div",{className:T("flex items-center gap-8 py-6 border-b w-full",h&&"border-t border-t-transparent"),ref:r,...m,children:[n.jsx(N,{ref:p,children:n.jsx(Pl,{})}),n.jsxs("div",{className:"flex-auto",children:[n.jsx("div",{className:"text-sm",children:t}),n.jsx("div",{className:"text-xs",children:e})]}),n.jsx(Ji,{checked:u,onChange:()=>{const x=l.map(b=>b.id===s?{...b,active:!b.active}:b);o("client.artistPage.tabs",x)}})]}),n.jsx(Bg,{title:t,ref:i})]})}const Bg=_.forwardRef(({title:t},e)=>n.jsx(Bl,{ref:e,children:()=>n.jsx("div",{className:"p-8 rounded shadow bg-chip text-sm",children:t})}));function Vg(){return n.jsx(He,{title:n.jsx(d,{message:"Player"}),description:n.jsx(d,{message:"Configure web player interface and functionality."}),children:n.jsxs(yr,{isLazy:!0,children:[n.jsxs(vr,{children:[n.jsx(Tt,{children:n.jsx(d,{message:"General"})}),n.jsx(Tt,{children:n.jsx(d,{message:"Controls"})}),n.jsx(Tt,{children:n.jsx(d,{message:"Artist page"})})]}),n.jsxs(Cr,{className:"pt-20",children:[n.jsx(At,{children:n.jsx($g,{})}),n.jsx(At,{children:n.jsx(Hg,{})}),n.jsx(At,{children:n.jsx(Rg,{})})]})]})})}function $g(){const{spotify_is_setup:t}=fe();return n.jsxs(j.Fragment,{children:[t&&n.jsxs(G,{className:"mb-24",name:"client.player.sort_method",selectionMode:"single",label:n.jsx(d,{message:"Content popularity"}),description:n.jsx(d,{message:"When content is sorted by popularity (eg. In track table), should it be sorted based on how popular that content is on spotify or by number of plays on the site."}),children:[n.jsx(v,{value:"external",children:n.jsx(d,{message:"Spotify popularity"})}),n.jsx(v,{value:"local",children:n.jsx(d,{message:"Local plays"})})]}),n.jsxs(G,{className:"mb-24",name:"client.player.seekbar_type",selectionMode:"single",label:n.jsx(d,{message:"Track seekbar type"}),description:n.jsx(d,{message:"Waveform is generated when uploading audio or video file and will default to 'simple' for auto-imported tracks."}),children:[n.jsx(v,{value:"waveform",children:n.jsx(d,{message:"Waveform"})}),n.jsx(v,{value:"line",children:n.jsx(d,{message:"Simple"})})]}),n.jsx(E,{className:"mb-24",name:"client.player.hide_queue",description:n.jsx(d,{message:"Whether player queue (right sidebar) should be shown by default. It can still be toggled via queue button, even if this is disabled."}),children:n.jsx(d,{message:"Hide queue sidebar"})}),n.jsx(E,{className:"mb-24",name:"client.player.hide_radio_button",description:n.jsx(d,{message:"Whether 'Go to radio' buttons should be shown."}),children:n.jsx(d,{message:"Hide radio buttons"})}),n.jsx(E,{className:"mb-24",name:"client.player.enable_repost",description:n.jsx(d,{message:"Enable reposting functionality for albums and tracks."}),children:n.jsx(d,{message:"Enable reposts"})}),n.jsx(E,{className:"mb-24",name:"client.player.track_comments",description:n.jsx(d,{message:"Enable commenting functionality for albums and tracks."}),children:n.jsx(d,{message:"Enable commenting"})}),n.jsx(E,{className:"mb-24",name:"client.player.show_upload_btn",description:n.jsx(d,{message:"Whether upload button should be shown in left sidebar (if user has permissions to upload tracks)."}),children:n.jsx(d,{message:"Upload button"})}),n.jsx(E,{className:"mb-24",name:"client.player.show_become_artist_btn",description:n.jsx(d,{message:"Whether become artist menu item should be shown (if user is not yet an artist)."}),children:n.jsx(d,{message:"Become artist menu item"})}),n.jsx(E,{name:"client.uploads.autoMatch",description:n.jsx(d,{message:"When uploading audio or video file, this will autofill track and album form with existing album and artist based on file metadata, or create a new album and artist if they do not yet exist."}),children:n.jsx(d,{message:"Metadata matching"})})]})}function Hg(){return n.jsxs(j.Fragment,{children:[n.jsx(C,{className:"mb-24",name:"client.player.default_volume",label:n.jsx(d,{message:"Default player volume"}),type:"number",min:1,max:100}),n.jsx(E,{className:"mb-24",name:"client.player.hide_lyrics",description:n.jsx(d,{message:"Whether lyrics button should be shown in player controls."}),children:n.jsx(d,{message:"Hide lyrics button"})}),n.jsx(E,{className:"mb-24",name:"client.player.enable_download",description:n.jsx(d,{message:"Whether download track button should be shown in player controls. It will only appear if track has an audio or video file uploaded."}),children:n.jsx(d,{message:"Download button"})}),n.jsx(E,{className:"mb-24",name:"client.player.hide_video_button",description:n.jsx(d,{message:"Whether toggle video button should be shown in player controls."}),children:n.jsx(d,{message:"Hide video button"})}),n.jsx(E,{className:"mb-24",name:"client.player.hide_video",description:n.jsx(d,{message:"Should small video in the bottom right corner be hidden by default. Note that this might cause issues with background playback for youtube embed, especially on mobile."}),children:n.jsx(d,{message:"Hide video"})}),n.jsx(E,{name:"client.player.mobile.auto_open_overlay",description:n.jsx(d,{message:"Should fullscreen video overlay be opened automatically on mobile when user starts playback. This will only apply when streaming from youtube."}),children:n.jsx(d,{message:"Automatically open overlay on mobile"})})]})}const qg=[{path:"search",element:n.jsx(Lg,{})},{path:"providers",element:n.jsx(Pg,{})},{path:"player",element:n.jsx(Vg,{})}];function wi({children:t,...e}){const{field:{onChange:s,onBlur:r,value:i=[],ref:a},fieldState:{invalid:o,error:l}}=Zs({name:e.name}),c=j.useMemo(()=>{const h=i;return typeof h=="string"?JSON.parse(h):h},[i]),u={onChange:h=>{const m=JSON.stringify(h.map(p=>p.name));s(m)},onBlur:r,value:c,invalid:o,errorMessage:l==null?void 0:l.message};return n.jsx(Xh,{ref:a,...Ks(u,e)})}function Ug(){const{trans:t}=P();return n.jsx(He,{title:n.jsx(d,{message:"Subscriptions"}),description:n.jsx(d,{message:"Configure gateway integration, accepted cards, invoices and other related settings."}),children:n.jsxs(yr,{children:[n.jsxs(vr,{children:[n.jsx(Tt,{children:n.jsx(d,{message:"General"})}),n.jsx(Tt,{children:n.jsx(d,{message:"Invoices"})})]}),n.jsxs(Cr,{className:"pt-30",children:[n.jsxs(At,{children:[n.jsx(E,{name:"client.billing.enable",description:n.jsx(d,{message:"Enable or disable all subscription related functionality across the site."}),children:n.jsx(d,{message:"Enable subscriptions"})}),n.jsx(It,{}),n.jsx(Wg,{}),n.jsx(Zg,{}),n.jsx(It,{}),n.jsx(wi,{name:"client.billing.accepted_cards",placeholder:t({message:"Add new card..."})})]}),n.jsxs(At,{children:[n.jsx(C,{inputElementType:"textarea",rows:5,label:n.jsx(d,{message:"Invoice address"}),name:"client.billing.invoice.address",className:"mb-30"}),n.jsx(C,{inputElementType:"textarea",rows:5,label:n.jsx(d,{message:"Invoice notes"}),description:n.jsx(d,{message:"Default notes to show under `notes` section of user invoice. Optional."}),name:"client.billing.invoice.notes"})]})]})]})})}function Wg(){const{watch:t}=I(),e=t("client.billing.paypal.enable");return n.jsxs("div",{className:"mb-30",children:[n.jsx(E,{name:"client.billing.paypal.enable",description:n.jsxs("div",{children:[n.jsx(d,{message:"Enable PayPal payment gateway integration."}),n.jsx(Kt,{className:"mt-6",link:"https://support.vebto.com/help-center/articles/147/configuring-paypal"})]}),children:n.jsx(d,{message:"PayPal gateway"})}),e?n.jsx(Oe,{name:"paypal_group",children:s=>n.jsxs(j.Fragment,{children:[n.jsx(C,{name:"server.paypal_client_id",label:n.jsx(d,{message:"PayPal Client ID"}),required:!0,invalid:s,className:"mb-20"}),n.jsx(C,{name:"server.paypal_secret",label:n.jsx(d,{message:"PayPal Secret"}),required:!0,invalid:s,className:"mb-20"}),n.jsx(C,{name:"server.paypal_webhook_id",label:n.jsx(d,{message:"PayPal Webhook ID"}),required:!0,invalid:s,className:"mb-20"}),n.jsx(E,{name:"client.billing.paypal_test_mode",invalid:s,description:n.jsx("div",{children:n.jsx(d,{message:"Allows testing PayPal payments with sandbox accounts."})}),children:n.jsx(d,{message:"PayPal test mode"})})]})}):null]})}function Zg(){const{watch:t}=I(),e=t("client.billing.stripe.enable");return n.jsxs(j.Fragment,{children:[n.jsx(E,{name:"client.billing.stripe.enable",description:n.jsxs("div",{children:[n.jsx(d,{message:"Enable Stripe payment gateway integration."}),n.jsx(Kt,{className:"mt-6",link:"https://support.vebto.com/help-center/articles/148/configuring-stripe"})]}),children:n.jsx(d,{message:"Stripe gateway"})}),e?n.jsx(Oe,{name:"stripe_group",separatorBottom:!1,children:s=>n.jsxs(j.Fragment,{children:[n.jsx(C,{name:"server.stripe_key",label:n.jsx(d,{message:"Stripe publishable key"}),required:!0,className:"mb-20",invalid:s}),n.jsx(C,{name:"server.stripe_secret",label:n.jsx(d,{message:"Stripe secret key"}),required:!0,className:"mb-20",invalid:s}),n.jsx(C,{name:"server.stripe_webhook_secret",label:n.jsx(d,{message:"Stripe webhook signing secret"}),className:"mb-20",invalid:s})]})}):null]})}function Kg(){const{data:t}=gt(["timezones","localizations"]),e=em(),{trans:s}=P();return n.jsxs(He,{title:n.jsx(d,{message:"Localization"}),description:n.jsx(d,{message:"Configure global date, time and language settings."}),children:[n.jsxs(G,{className:"mb-30",required:!0,name:"client.dates.default_timezone",showSearchField:!0,selectionMode:"single",label:n.jsx(d,{message:"Default timezone"}),searchPlaceholder:s(g("Search timezones")),description:n.jsx(d,{message:"Which timezone should be selected by default for new users and guests."}),children:[n.jsx(v,{value:"auto",children:n.jsx(d,{message:"Auto"})},"auto"),Object.entries((t==null?void 0:t.timezones)||{}).map(([r,i])=>n.jsx(Qi,{label:r,children:i.map(a=>n.jsx(v,{value:a.value,children:a.text},a.value))},r))]}),n.jsxs(G,{name:"client.locale.default",className:"mb-30",selectionMode:"single",label:n.jsx(d,{message:"Default language"}),description:n.jsx(d,{message:"Which localization should be selected by default for new users and guests."}),children:[n.jsx(v,{value:"auto",children:n.jsx(d,{message:"Auto"})},"auto"),((t==null?void 0:t.localizations)||[]).map(r=>n.jsx(v,{value:r.language,capitalizeFirst:!0,children:r.name},r.language))]}),n.jsxs(Ml,{required:!0,className:"mb-30",size:"sm",name:"client.dates.format",orientation:"vertical",label:n.jsx(d,{message:"Date verbosity"}),description:n.jsx(d,{message:"Default verbosity for all dates displayed across the site. Month/day order and separators will be adjusted automatically, based on user's locale."}),children:[n.jsx(cn,{value:"auto",children:n.jsx(d,{message:"Auto"})},"auto"),Object.entries(Gu).map(([r,i])=>n.jsx(cn,{value:r,children:n.jsx(he,{date:e,options:i})},r))]}),n.jsx(E,{name:"client.i18n.enable",description:n.jsx(d,{message:"If disabled, site will always be shown in default language and user will not be able to change their locale."}),children:n.jsx(d,{message:"Enable translations"})})]})}function Jg(){return n.jsxs(He,{title:n.jsx(d,{message:"Authentication"}),description:n.jsx(d,{message:"Configure registration, social login and related 3rd party integrations."}),children:[n.jsx(Gg,{}),n.jsx(E,{className:"mb-24",name:"client.registration.disable",description:n.jsx(d,{message:"All registration related functionality (including social login) will be disabled."}),children:n.jsx(d,{message:"Disable registration"})}),n.jsx(E,{className:"mb-24",name:"client.single_device_login",description:n.jsx(d,{message:"Only allow one device to be logged into user account at the same time."}),children:n.jsx(d,{message:"Single device login"})}),n.jsx(E,{name:"client.social.compact_buttons",description:n.jsx(d,{message:"Use compact design for social login buttons."}),children:n.jsx(d,{message:"Compact buttons"})}),n.jsx(Qg,{}),n.jsx(Yg,{}),n.jsx(Xg,{}),n.jsx(ex,{}),n.jsx(It,{}),n.jsx(C,{inputElementType:"textarea",rows:3,className:"mt-24",name:"client.auth.domain_blacklist",label:n.jsx(d,{message:"Domain blacklist"}),description:n.jsx(d,{message:"Comma separated list of domains. Users will not be able to register or login using any email adress from specified domains."})})]})}function Gg(){const{watch:t}=I(),e=t("server.mail_setup");return n.jsx(E,{className:"mb-30",name:"client.require_email_confirmation",description:n.jsxs(j.Fragment,{children:[n.jsx(d,{message:"Require newly registered users to validate their email address before being able to login."}),!e&&n.jsx("p",{className:"mt-10 text-danger",children:n.jsx(d,{message:"Outgoing mail method needs to be setup before enabling this setting. <a>Fix now</a>",values:{a:s=>n.jsx(Y,{className:"font-bold block underline",to:"/admin/settings/mail#outgoing-emails",children:s})}})})]}),children:n.jsx(d,{message:"Require email confirmation"})})}function Qg(){const{watch:t}=I(),{envato:e}=fe(),s=t("client.social.envato.enable");return e!=null&&e.enable?n.jsx(Oe,{separatorBottom:!1,name:"envato_group",children:r=>n.jsxs(n.Fragment,{children:[n.jsx(E,{invalid:r,name:"client.social.envato.enable",description:n.jsx(d,{message:"Enable logging into the site via envato."}),children:n.jsx(d,{message:"Envato login"})}),s&&n.jsxs(n.Fragment,{children:[n.jsx(C,{invalid:r,className:"mt-30",name:"server.envato_id",label:n.jsx(d,{message:"Envato ID"}),required:!0}),n.jsx(C,{invalid:r,className:"mt-30",name:"server.envato_secret",label:n.jsx(d,{message:"Envato secret"}),required:!0}),n.jsx(C,{invalid:r,className:"mt-30",name:"server.envato_personal_token",label:n.jsx(d,{message:"Envato personal token"}),required:!0})]})]})}):null}function Yg(){const{watch:t}=I(),e=t("client.social.google.enable");return n.jsx(Oe,{name:"google_group",children:s=>n.jsxs(n.Fragment,{children:[n.jsx(E,{invalid:s,name:"client.social.google.enable",description:n.jsx(d,{message:"Enable logging into the site via google."}),children:n.jsx(d,{message:"Google login"})}),e&&n.jsxs(n.Fragment,{children:[n.jsx(C,{invalid:s,className:"mt-30",name:"server.google_id",label:n.jsx(d,{message:"Google client ID"}),required:!0}),n.jsx(C,{className:"mt-30",name:"server.google_secret",label:n.jsx(d,{message:"Google client secret"}),required:!0})]})]})})}function Xg(){const{watch:t}=I(),e=t("client.social.facebook.enable");return n.jsx(Oe,{name:"facebook_group",separatorTop:!1,children:s=>n.jsxs(n.Fragment,{children:[n.jsx(E,{invalid:s,name:"client.social.facebook.enable",description:n.jsx(d,{message:"Enable logging into the site via facebook."}),children:n.jsx(d,{message:"Facebook login"})}),e&&n.jsxs(n.Fragment,{children:[n.jsx(C,{invalid:s,className:"mt-30",name:"server.facebook_id",label:n.jsx(d,{message:"Facebook app ID"}),required:!0}),n.jsx(C,{invalid:s,className:"mt-30",name:"server.facebook_secret",label:n.jsx(d,{message:"Facebook app secret"}),required:!0})]})]})})}function ex(){const{watch:t}=I(),e=t("client.social.twitter.enable");return n.jsx(Oe,{name:"twitter_group",separatorTop:!1,separatorBottom:!1,children:s=>n.jsxs(n.Fragment,{children:[n.jsx(E,{invalid:s,name:"client.social.twitter.enable",description:n.jsx(d,{message:"Enable logging into the site via twitter."}),children:n.jsx(d,{message:"Twitter login"})}),e&&n.jsxs(n.Fragment,{children:[n.jsx(C,{invalid:s,className:"mt-30",name:"server.twitter_id",label:n.jsx(d,{message:"Twitter ID"}),required:!0}),n.jsx(C,{invalid:s,className:"mt-30",name:"server.twitter_secret",label:n.jsx(d,{message:"Twitter secret"}),required:!0})]})]})})}function tx(){return O.get("uploads/server-max-file-size").then(t=>t.data)}function sx(){return Xt(["MaxServerUploadSize"],()=>tx())}const nx=["B","KB","MB","GB","TB","PB"];function eo(t,e){if(t==null)return 0;switch(e){case"KB":return t*1024;case"MB":return t*1024**2;case"GB":return t*1024**3;case"TB":return t*1024**4;case"PB":return t*1024**5;default:return t}}const rx=0x630000000000,un=_.forwardRef(({name:t,...e},s)=>{const{field:{onChange:r,onBlur:i,value:a="",ref:o},fieldState:{invalid:l,error:c}}=Zs({name:t}),[u,h]=j.useState(""),[m,p]=j.useState("MB");j.useEffect(()=>{if(a==null||a===""){h("");return}const{amount:b,unit:y}=ix({bytes:Math.min(a,rx)});p(y||"MB"),h(Number.isNaN(b)?"":b)},[a,m]);const f={onChange:b=>{const y=parseInt(b.target.value);if(Number.isNaN(y))r(y);else{const k=eo(parseInt(b.target.value),m);r(k)}},onBlur:i,value:u,invalid:l,errorMessage:c==null?void 0:c.message,inputRef:o},x=n.jsx(Mn,{minWidth:"min-w-80",selectionMode:"single",selectedValue:m,disabled:!a,onSelectionChange:b=>{const y=eo(u||0,b);r(y)},children:nx.slice(0,5).map(b=>n.jsx(v,{value:b,children:b==="B"?"Bytes":b},b))});return n.jsx(Qt,{...Ks(f,e),type:"number",ref:s,endAppend:x})}),ix=Qu(({bytes:t})=>{const e=ta(t);if(!e)return{amount:"",unit:"MB"};let s=parseInt(e.split(" ")[0]);return s=Math.round(s),{amount:s,unit:e.split(" ")[1]}});function ax(){const{trans:t}=P();return $(()=>ox(),{onSuccess:()=>{H(t(g("CORS file updated"))),F.invalidateQueries(["Query Key"])},onError:e=>oe(e)})}function ox(){return O.post("s3/cors/upload").then(t=>t.data)}function lx(){return $(t=>cx(t),{onError:t=>oe(t)})}function cx(t){return O.post("settings/uploading/dropbox-refresh-token",t).then(e=>e.data)}function dx({isInvalid:t}){const{watch:e,setValue:s}=I(),r=e("server.storage_dropbox_app_key"),i=e("server.storage_dropbox_app_secret");return n.jsxs(j.Fragment,{children:[n.jsx(C,{invalid:t,className:"mb-20",name:"server.storage_dropbox_app_key",label:n.jsx(d,{message:"Dropbox application key"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-20",name:"server.storage_dropbox_app_secret",label:n.jsx(d,{message:"Dropbox application secret"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-20",name:"server.storage_dropbox_refresh_token",label:n.jsx(d,{message:"Dropbox refresh token"}),required:!0}),n.jsxs(z,{type:"modal",onClose:a=>{a&&s("server.storage_dropbox_refresh_token",a)},children:[n.jsx(w,{variant:"outline",color:"primary",size:"xs",disabled:!r||!i,children:n.jsx(d,{message:"Get dropbox refresh token"})}),n.jsx(ux,{appKey:r,appSecret:i})]})]})}function ux({appKey:t,appSecret:e}){const s=X(),{formId:r,close:i}=te(),a=lx();return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Connected dropbox account"})}),n.jsx(ie,{children:n.jsxs(ce,{id:r,form:s,onSubmit:o=>{a.mutate({app_key:t,app_secret:e,access_code:o.accessCode},{onSuccess:l=>{i(l.refreshToken)}})},children:[n.jsxs("div",{className:"mb-20 pb-20 border-b",children:[n.jsx("div",{className:"text-muted text-sm mb-10",children:n.jsx(d,{message:"Click the 'get access code' button to get dropbox access code, then paste it into the field below."})}),n.jsx(w,{variant:"outline",color:"primary",size:"xs",elementType:"a",target:"_blank",href:`https://www.dropbox.com/oauth2/authorize?client_id=${t}&token_access_type=offline&response_type=code`,children:n.jsx(d,{message:"Get access code"})})]}),n.jsx(C,{name:"accessCode",label:n.jsx(d,{message:"Dropbox access code"}),required:!0})]})}),n.jsxs(le,{children:[n.jsx(w,{onClick:()=>{i()},children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{variant:"flat",color:"primary",form:r,type:"submit",disabled:!t||!e||a.isLoading,children:n.jsx(d,{message:"Connect"})})]})]})}function hx(){const{trans:t}=P();return n.jsxs(He,{title:n.jsx(d,{message:"Uploading"}),description:n.jsx(d,{message:"Configure size and type of files that users are able to upload. This will affect all uploads across the site."}),children:[n.jsx(px,{}),n.jsx(fx,{}),n.jsx(gx,{}),n.jsx(Oe,{name:"static_delivery_group",children:e=>n.jsxs(Ml,{invalid:e,size:"sm",name:"server.static_file_delivery",orientation:"vertical",label:n.jsx(d,{message:"File delivery optimization"}),description:n.jsx(d,{message:"Both X-Sendfile and X-Accel need to be enabled on the server first. When enabled, it will reduce server memory and CPU usage when previewing or downloading files, especially for large files."}),children:[n.jsx(cn,{value:"",children:n.jsx(d,{message:"None"})}),n.jsx(cn,{value:"xsendfile",children:n.jsx(d,{message:"X-Sendfile (Apache)"})}),n.jsx(cn,{value:"xaccel",children:n.jsx(d,{message:"X-Accel (Nginx)"})})]})}),n.jsx(un,{className:"mb-30",name:"client.uploads.chunk_size",min:1,label:n.jsx(d,{message:"Chunk size"}),placeholder:"Infinity",description:n.jsx(d,{message:"Size (in bytes) for each file chunk. It should only be changed if there is a maximum upload size on your server or proxy (for example cloudflare). If chunk size is larger then limit on the server, uploads will fail."})}),n.jsx(mx,{}),n.jsx(It,{}),n.jsx(un,{min:1,name:"client.uploads.max_size",className:"mb-30",label:n.jsx(d,{message:"Maximum file size"}),description:n.jsx(d,{message:"Maximum size (in bytes) for a single file user can upload."})}),n.jsx(un,{min:1,name:"client.uploads.available_space",className:"mb-30",label:n.jsx(d,{message:"Available space"}),description:n.jsx(d,{message:"Disk space (in bytes) each user uploads are allowed to take up. This can be overridden per user."})}),n.jsx(wi,{name:"client.uploads.allowed_extensions",className:"mb-30",label:n.jsx(d,{message:"Allowed extensions"}),placeholder:t(g("Add extension...")),description:n.jsx(d,{message:"List of allowed file types (jpg, mp3, pdf etc.). Leave empty to allow all file types."})}),n.jsx(wi,{name:"client.uploads.blocked_extensions",label:n.jsx(d,{message:"Blocked extensions"}),placeholder:t(g("Add extension...")),description:n.jsx(d,{message:"Prevent uploading of these file types, even if they are allowed above."})})]})}function mx(){const{data:t}=sx();return n.jsx(St,{color:"warning",description:n.jsx(d,{message:"Maximum upload size on your server currently is set to <b>:size</b>",values:{size:t==null?void 0:t.maxSize,b:e=>n.jsx("b",{children:e})}})})}function px(){const{watch:t,clearErrors:e}=I();return t("server.uploads_disk_driver")?n.jsxs(G,{className:"mb-30",selectionMode:"single",name:"server.uploads_disk_driver",label:n.jsx(d,{message:"User Uploads Storage Method"}),description:n.jsx(d,{message:"Where should user private file uploads be stored."}),onSelectionChange:()=>{e()},children:[n.jsx(v,{value:"local",children:n.jsx(d,{message:"Local Disk (Default)"})}),n.jsx(v,{value:"ftp",children:"FTP"}),n.jsx(v,{value:"digitalocean_s3",children:"DigitalOcean Spaces"}),n.jsx(v,{value:"backblaze_s3",children:"Backblaze"}),n.jsx(v,{value:"s3",children:"Amazon S3 (Or compatible service)"}),n.jsx(v,{value:"dropbox",children:"Dropbox"}),n.jsx(v,{value:"rackspace",children:"Rackspace"})]}):null}function fx(){const{watch:t,clearErrors:e}=I();return t("server.public_disk_driver")?n.jsxs(G,{label:n.jsx(d,{message:"Public Uploads Storage Method"}),selectionMode:"single",name:"server.public_disk_driver",description:n.jsx(d,{message:"Where should user public uploads (like avatars) be stored."}),onSelectionChange:()=>{e()},children:[n.jsx(v,{value:"local",children:n.jsx(d,{message:"Local Disk (Default)"})}),n.jsx(v,{value:"s3",children:"Amazon S3"}),n.jsx(v,{value:"ftp",children:"FTP"}),n.jsx(v,{value:"digitalocean_s3",children:"DigitalOcean Spaces"}),n.jsx(v,{value:"backblaze_s3",children:"Backblaze"})]}):null}function gx(){const{watch:t}=I(),e=[t("server.uploads_disk_driver"),t("server.public_disk_driver")];return e[0]==="local"&&e[1]==="local"?null:n.jsx(Oe,{separatorBottom:!1,name:"storage_group",children:s=>{if(e.includes("s3"))return n.jsx(xx,{isInvalid:s});if(e.includes("ftp"))return n.jsx(yx,{isInvalid:s});if(e.includes("dropbox"))return n.jsx(dx,{isInvalid:s});if(e.includes("digitalocean_s3"))return n.jsx(jx,{isInvalid:s});if(e.includes("backblaze_s3"))return n.jsx(bx,{isInvalid:s})}})}function xx({isInvalid:t}){return n.jsxs(j.Fragment,{children:[n.jsx(C,{invalid:t,className:"mb-30",name:"server.storage_s3_key",label:n.jsx(d,{message:"Amazon S3 key"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.storage_s3_secret",label:n.jsx(d,{message:"Amazon S3 secret"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.storage_s3_region",label:n.jsx(d,{message:"Amazon S3 region"}),pattern:"[a-z1-9\\-]+",placeholder:"us-east-1"}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.storage_s3_bucket",label:n.jsx(d,{message:"Amazon S3 bucket"}),required:!0}),n.jsx(C,{invalid:t,name:"server.storage_s3_endpoint",label:n.jsx(d,{message:"Amazon S3 endpoint"}),description:n.jsx(d,{message:"Only change endpoint if you are using another S3 compatible storage service."})}),n.jsx(xa,{invalid:t})]})}function jx({isInvalid:t}){return n.jsxs(j.Fragment,{children:[n.jsx(C,{invalid:t,className:"mb-30",name:"server.storage_digitalocean_key",label:n.jsx(d,{message:"DigitalOcean key"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.storage_digitalocean_secret",label:n.jsx(d,{message:"DigitalOcean secret"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.storage_digitalocean_region",label:n.jsx(d,{message:"DigitalOcean region"}),pattern:"[a-z0-9\\-]+",placeholder:"us-east-1",required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.storage_digitalocean_bucket",label:n.jsx(d,{message:"DigitalOcean bucket"}),required:!0}),n.jsx(xa,{invalid:t})]})}function bx({isInvalid:t}){return n.jsxs(j.Fragment,{children:[n.jsx(C,{invalid:t,className:"mb-30",name:"server.storage_backblaze_key",label:n.jsx(d,{message:"Backblaze KeyID"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.storage_backblaze_secret",label:n.jsx(d,{message:"Backblaze applicationKey"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.storage_backblaze_region",label:n.jsx(d,{message:"Backblaze Region"}),pattern:"[a-z0-9\\-]+",placeholder:"us-west-002",required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.storage_backblaze_bucket",label:n.jsx(d,{message:"Backblaze bucket name"}),required:!0}),n.jsx(xa,{invalid:t})]})}function xa({invalid:t}){var i,a;const e=ax(),{data:s}=Pn(),r=((i=s==null?void 0:s.server.uploads_disk_driver)==null?void 0:i.endsWith("s3"))||((a=s==null?void 0:s.server.public_disk_driver)==null?void 0:a.endsWith("s3"));return n.jsxs(j.Fragment,{children:[n.jsx(E,{className:"mt-30",invalid:t,name:"client.uploads.s3_direct_upload",description:n.jsxs("div",{children:[n.jsx("p",{children:n.jsx(d,{message:"Upload files directly from the browser to s3 without going through the server. It will save on server bandwidth and should result in faster upload times. This should be enabled, unless storage provider does not support multipart uploads."})}),n.jsx("p",{className:"mt-10",children:n.jsx(d,{message:"If s3 provider is not configured to allow uploads from browser, this can be done automatically via CORS button below, when valid credentials are saved."})})]}),children:n.jsx(d,{message:"Direct upload"})}),n.jsx(w,{variant:"flat",color:"primary",size:"xs",className:"mt-20",onClick:()=>{e.mutate()},disabled:!r||e.isLoading,children:n.jsx(d,{message:"Configure CORS"})})]})}function yx({isInvalid:t}){return n.jsxs(n.Fragment,{children:[n.jsx(C,{invalid:t,className:"mb-30",name:"server.storage_ftp_host",label:n.jsx(d,{message:"FTP hostname"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.storage_ftp_username",label:n.jsx(d,{message:"FTP username"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.storage_ftp_password",label:n.jsx(d,{message:"FTP password"}),type:"password",required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.storage_ftp_root",label:n.jsx(d,{message:"FTP directory"}),placeholder:"/"}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.storage_ftp_port",label:n.jsx(d,{message:"FTP port"}),type:"number",min:0,placeholder:"21"}),n.jsx(E,{invalid:t,name:"server.storage_ftp_passive",className:"mb-30",children:n.jsx(d,{message:"Passive"})}),n.jsx(E,{invalid:t,name:"server.storage_ftp_ssl",children:n.jsx(d,{message:"SSL"})})]})}function vx({isInvalid:t}){return n.jsxs(j.Fragment,{children:[n.jsx(C,{invalid:t,className:"mb-30",name:"server.mailgun_domain",label:n.jsx(d,{message:"Mailgun domain"}),description:n.jsx(d,{message:"Usually the domain of your site (site.com)"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.mailgun_secret",label:n.jsx(d,{message:"Mailgun API key"}),description:n.jsx(d,{message:"Should start with `key-`"}),required:!0}),n.jsx(C,{invalid:t,name:"server.mailgun_endpoint",label:n.jsx(d,{message:"Mailgun endpoint"}),description:n.jsx(d,{message:"Can be left empty, if your mailgun account is in the US region."}),placeholder:"api.eu.mailgun.net"})]})}function Cx({isInvalid:t}){return n.jsxs(n.Fragment,{children:[n.jsx(C,{invalid:t,className:"mb-30",name:"server.mail_host",label:n.jsx(d,{message:"SMTP host"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.mail_username",label:n.jsx(d,{message:"SMTP username"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-30",type:"password",name:"server.mail_password",label:n.jsx(d,{message:"SMTP password"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-30",type:"number",name:"server.mail_port",label:n.jsx(d,{message:"SMTP port"})}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.mail_encryption",label:n.jsx(d,{message:"SMTP encryption"})})]})}function kx({isInvalid:t}){return n.jsxs(j.Fragment,{children:[n.jsx(C,{invalid:t,className:"mb-30",name:"server.ses_key",label:n.jsx(d,{message:"SES key"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.ses_secret",label:n.jsx(d,{message:"SES secret"}),required:!0}),n.jsx(C,{invalid:t,name:"server.ses_region",label:n.jsx(d,{message:"SES region"}),placeholder:"us-east-1",required:!0})]})}function wx({isInvalid:t}){return n.jsx(C,{invalid:t,name:"server.postmark_token",label:n.jsx(d,{message:"Postmark token"}),required:!0})}const to=D([n.jsx("path",{fill:"#4caf50",d:"M45,16.2l-5,2.75l-5,4.75L35,40h7c1.657,0,3-1.343,3-3V16.2z"},"0"),n.jsx("path",{fill:"#1e88e5",d:"M3,16.2l3.614,1.71L13,23.7V40H6c-1.657,0-3-1.343-3-3V16.2z"},"1"),n.jsx("polygon",{fill:"#e53935",points:"35,11.2 24,19.45 13,11.2 12,17 13,23.7 24,31.95 35,23.7 36,17"},"2"),n.jsx("path",{fill:"#c62828",d:"M3,12.298V16.2l10,7.5V11.2L9.876,8.859C9.132,8.301,8.228,8,7.298,8h0C4.924,8,3,9.924,3,12.298z"},"3"),n.jsx("path",{fill:"#fbc02d",d:"M45,12.298V16.2l-10,7.5V11.2l3.124-2.341C38.868,8.301,39.772,8,40.702,8h0 C43.076,8,45,9.924,45,12.298z"},"4")],"Gmail","0 0 48 48");function Sx(){const{watch:t,setValue:e}=I(),{connectSocial:s}=Yu(),r=t("server.connectedGmailAccount"),i=t("client.mail.handler")==="gmailApi",a=async()=>{const c=await s("secure/settings/mail/gmail/connect");if((c==null?void 0:c.status)==="SUCCESS"){const u=c.callbackData.profile.email;e("server.connectedGmailAccount",u),H(g("Connected gmail account: :email",{values:{email:u}}))}},o=n.jsx(w,{variant:"outline",color:"primary",startIcon:n.jsx(to,{}),onClick:()=>{a()},children:n.jsx(d,{message:"Connect gmail account"})}),l=n.jsxs("div",{className:"px-14 py-6 rounded bg-alt border flex items-center gap-14 text-sm",children:[n.jsx(to,{size:"lg"}),r,n.jsx(w,{variant:"text",color:"primary",className:"ml-auto",onClick:()=>{a()},children:n.jsx(d,{message:"Reconnect"})})]});return n.jsxs(j.Fragment,{children:[i&&n.jsx(C,{name:"client.gmail.incoming.topicName",minLength:10,required:!0,label:n.jsx(d,{message:"Gmail topic name"}),description:n.jsx(d,{message:"Google cloud Pub/Sub topic name."}),className:"mb-30"}),n.jsx("div",{className:"text-sm mb-12",children:n.jsx(d,{message:"Gmail account"})}),r?l:o]})}function Mx(){const{watch:t,clearErrors:e}=I(),s=[t("server.mail_driver"),t("client.mail.handler")],r=[];return s.includes("mailgun")&&r.push(vx),s.includes("smtp")&&r.push(Cx),s.includes("ses")&&r.push(kx),s.includes("postmark")&&r.push(wx),s.includes("gmailApi")&&r.push(Sx),n.jsx(Oe,{separatorTop:!1,separatorBottom:!1,name:"mail_group",children:i=>n.jsxs(j.Fragment,{children:[n.jsxs(G,{onSelectionChange:()=>{e()},invalid:i,selectionMode:"single",name:"server.mail_driver",label:n.jsx(d,{message:"Outgoing mail method"}),description:n.jsxs("div",{children:[n.jsx(d,{message:"Which method should be used for sending outgoing application emails (like registration confirmation)"}),n.jsx(Kt,{className:"mt-8",link:"https://support.vebto.com/help-center/articles/42/44/155/incoming-emails"})]}),children:[n.jsx(v,{value:"mailgun",children:"Mailgun"}),n.jsx(v,{value:"gmailApi",children:"Gmail Api"}),n.jsx(v,{value:"smtp",children:"SMTP"}),n.jsx(v,{value:"postmark",children:"Postmark"}),n.jsx(v,{value:"ses",children:"Ses (Amazon Simple Email Service)"}),n.jsx(v,{value:"sendmail",children:"SendMail"}),n.jsx(v,{value:"log",children:"Log (Email will be saved to error log)"})]}),r.length?n.jsx("div",{className:"mt-30",children:r.map((a,o)=>n.jsx(a,{isInvalid:i},o))}):null]})})}function Nx(){const{clearErrors:t}=I(),{settings:e}=j.useContext(Ot);return e!=null&&e.showIncomingMailMethod?n.jsxs(G,{onSelectionChange:()=>{t()},className:"my-30",selectionMode:"single",name:"client.mail_handler",label:n.jsx(d,{message:"Incoming mail method"}),description:n.jsxs("div",{children:[n.jsx(d,{message:"Which method should be used to handle incoming application emails."}),n.jsx(Kt,{className:"mt-8",link:"https://support.vebto.com/help-center/articles/76/configuring-email-provider"})]}),children:[n.jsx(v,{value:"mailgun",children:"Mailgun"}),n.jsx(v,{value:"gmailApi",children:"Gmail Api"}),n.jsx(v,{value:"null",children:"Rest API (Send emails via http API)"}),n.jsx(v,{value:"pipe",children:"Pipe (Pipe emails directly)"})]}):null}function Lx(){return n.jsxs(He,{title:n.jsx(d,{message:"Mail settings"}),description:n.jsx(d,{message:"Change incoming and outgoing email handlers, email credentials and other related settings."}),children:[n.jsx(C,{id:"outgoing-emails",className:"mb-30",type:"email",name:"server.mail_from_address",label:n.jsx(d,{message:"From address"}),description:n.jsx(d,{message:"All outgoing application emails will be sent from this email address."}),required:!0}),n.jsx(Tx,{}),n.jsx(C,{className:"mb-30",name:"server.mail_from_name",label:n.jsx(d,{message:"From name"}),description:n.jsx(d,{message:"All outgoing application emails will be sent using this name."}),required:!0}),n.jsx(St,{color:"warning",description:n.jsx(d,{message:"Your selected mail method must be authorized to send emails using this address and name."})}),n.jsx(It,{}),n.jsx(Nx,{}),n.jsx(Mx,{})]})}function Tx(){const{base_url:t}=fe(),e=`${t}/contact`,s=n.jsx(xr,{href:e,children:e});return n.jsx(C,{className:"mb-30",type:"email",name:"client.mail.contact_page_address",label:n.jsx(d,{message:"Contact page address"}),description:n.jsx(d,{values:{contactPageUrl:s},message:"Where emails from :contactPageUrl page should be sent to."})})}function Ax(){return O.post("cache/flush").then(t=>t.data)}function Ix(){return $(()=>Ax(),{onSuccess:()=>{H(g("Cache cleared"))},onError:t=>oe(t)})}function Ex(){const t=Ix();return n.jsxs(He,{title:n.jsx(d,{message:"Cache settings"}),description:n.jsx(d,{message:"Select cache provider and manually clear cache."}),children:[n.jsx(Dx,{}),n.jsx(w,{type:"button",variant:"outline",size:"xs",color:"primary",disabled:t.isLoading,onClick:()=>{t.mutate()},children:n.jsx(d,{message:"Clear cache"})}),n.jsx(St,{color:"warning",className:"mt-30",description:n.jsx(d,{message:'"File" is the best option for most cases and should not be changed, unless you are familiar with another cache method and have it set up on the server already.'})})]})}function Dx(){const{watch:t,clearErrors:e}=I(),s=t("server.cache_driver");let r=null;return s==="memcached"&&(r=Ox),n.jsx(Oe,{separatorTop:!1,name:"cache_group",children:i=>n.jsxs(n.Fragment,{children:[n.jsxs(G,{invalid:i,onSelectionChange:()=>{e()},selectionMode:"single",name:"server.cache_driver",label:n.jsx(d,{message:"Cache method"}),description:n.jsx(d,{message:"Which method should be used for storing and retrieving cached items."}),children:[n.jsx(v,{value:"file",children:n.jsx(d,{message:"File (Default)"})}),n.jsx(v,{value:"array",children:n.jsx(d,{message:"None"})}),n.jsx(v,{value:"apc",children:"APC"}),n.jsx(v,{value:"memcached",children:"Memcached"}),n.jsx(v,{value:"redis",children:"Redis"})]}),r&&n.jsx("div",{className:"mt-30",children:n.jsx(r,{isInvalid:i})})]})})}function Ox({isInvalid:t}){return n.jsxs(n.Fragment,{children:[n.jsx(C,{invalid:t,className:"mb-30",name:"server.memcached_host",label:n.jsx(d,{message:"Memcached host"}),required:!0}),n.jsx(C,{invalid:t,type:"number",name:"server.memcached_port",label:n.jsx(d,{message:"Memcached port"}),required:!0})]})}function Px(){return n.jsxs(He,{title:n.jsx(d,{message:"Error logging"}),description:n.jsx(d,{message:"Configure site error logging and related 3rd party integrations."}),children:[n.jsx(Fx,{}),n.jsx(St,{className:"mt-30",color:"positive",description:n.jsx(d,{values:{a:t=>n.jsx(xr,{href:"https://sentry.io",children:t})},message:"<a>Sentry</a> integration provides real-time error tracking and helps identify and fix issues when site is in production."})})]})}function Fx(){const{clearErrors:t}=I();return n.jsx(Oe,{separatorTop:!1,separatorBottom:!1,name:"logging_group",children:e=>n.jsx(C,{onChange:()=>{t()},invalid:e,name:"server.sentry_dsn",type:"url",minLength:30,required:!0,label:n.jsx(d,{message:"Sentry DSN"})})})}function zx(){return n.jsxs(He,{title:n.jsx(d,{message:"Queue"}),description:n.jsx(d,{message:"Select active queue method and enter related 3rd party API keys."}),children:[n.jsx(St,{color:"positive",className:"mb-30",description:n.jsx(d,{message:"Queues allow to defer time consuming tasks, such as sending an email, until a later time. Deferring these tasks can speed up web requests to the application."})}),n.jsx(St,{color:"warning",className:"mb-30",description:n.jsx(d,{message:"All methods except sync require additional setup, which should be performed before changing the queue method. Consult documentation for more information."})}),n.jsx(Rx,{})]})}function Rx(){const{watch:t,clearErrors:e}=I(),s=t("server.queue_driver");let r=null;return s==="sqs"&&(r=_x),n.jsx(Oe,{separatorTop:!1,separatorBottom:!1,name:"queue_group",children:i=>n.jsxs(n.Fragment,{children:[n.jsxs(G,{invalid:i,onSelectionChange:()=>{e()},selectionMode:"single",name:"server.queue_driver",label:n.jsx(d,{message:"Queue method"}),required:!0,children:[n.jsx(v,{value:"sync",children:n.jsx(d,{message:"Sync (Default)"})}),n.jsx(v,{value:"beanstalkd",children:"Beanstalkd"}),n.jsx(v,{value:"database",children:n.jsx(d,{message:"Database"})}),n.jsx(v,{value:"sqs",children:n.jsx(d,{message:"SQS (Amazon simple queue service)"})}),n.jsx(v,{value:"redis",children:"Redis"})]}),r&&n.jsx("div",{className:"mt-30",children:n.jsx(r,{isInvalid:i})})]})})}function _x({isInvalid:t}){return n.jsxs(n.Fragment,{children:[n.jsx(C,{invalid:t,className:"mb-30",name:"server.sqs_queue_key",label:n.jsx(d,{message:"SQS queue key"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.sqs_queue_secret",label:n.jsx(d,{message:"SQS queue secret"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.sqs_queue_prefix",label:n.jsx(d,{message:"SQS queue prefix"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.sqs_queue_name",label:n.jsx(d,{message:"SQS queue name"}),required:!0}),n.jsx(C,{invalid:t,className:"mb-30",name:"server.sqs_queue_region",label:n.jsx(d,{message:"SQS queue region"}),required:!0})]})}function Bx(){const{settings:t}=j.useContext(Ot);return n.jsxs(He,{title:n.jsx(d,{message:"Recaptcha"}),description:n.jsx(d,{message:"Configure google recaptcha integration and credentials."}),children:[(t==null?void 0:t.showRecaptchaLinkSwitch)&&n.jsx(E,{className:"mb-30",name:"client.recaptcha.enable.link_creation",description:n.jsx(d,{message:"Enable recaptcha integration when creating links from homepage or user dashboard."}),children:n.jsx(d,{message:"Link creation"})}),n.jsx(E,{className:"mb-30",name:"client.recaptcha.enable.contact",description:n.jsx(d,{message:'Enable recaptcha integration for "contact us" page.'}),children:n.jsx(d,{message:"Contact page"})}),n.jsx(E,{className:"mb-30",name:"client.recaptcha.enable.register",description:n.jsx(d,{message:"Enable recaptcha integration for registration page."}),children:n.jsx(d,{message:"Registration page"})}),n.jsx(Vx,{})]})}function Vx(){const{clearErrors:t}=I();return n.jsx(Oe,{separatorTop:!1,separatorBottom:!1,name:"recaptcha_group",children:e=>n.jsxs(n.Fragment,{children:[n.jsx(C,{className:"mb-30",onChange:()=>{t()},invalid:e,name:"client.recaptcha.site_key",label:n.jsx(d,{message:"Recaptcha v3 site key"})}),n.jsx(C,{onChange:()=>{t()},invalid:e,name:"client.recaptcha.secret_key",label:n.jsx(d,{message:"Recaptcha v3 secret key"})})]})})}const $x=_.forwardRef((t,e)=>{const s=Xu(e),{fieldProps:r,inputProps:i}=eh({...t,focusRef:s}),a=kl(t);return n.jsx(th,{ref:e,fieldClassNames:a,...r,children:n.jsx("input",{type:"file",ref:s,...i,className:T(a.input,"py-8","file:bg-primary file:text-on-primary file:border-none file:rounded file:text-sm file:font-semibold file:px-10 file:h-24 file:mr-10")})})});function Hx({name:t,...e}){const{field:{onChange:s,onBlur:r,ref:i},fieldState:{invalid:a,error:o}}=Zs({name:t}),[l,c]=_.useState(""),u={onChange:h=>{var m;s((m=h.target.files)==null?void 0:m[0]),c(h.target.value)},onBlur:r,value:l,invalid:a,errorMessage:o==null?void 0:o.message};return n.jsx($x,{ref:i,...Ks(u,e)})}function qx(){return n.jsx(He,{title:n.jsx(d,{message:"Analytics"}),description:n.jsx(d,{message:"Configure google analytics integration and credentials."}),children:n.jsx(Ux,{})})}function Ux(){const{clearErrors:t}=I();return n.jsx(Oe,{separatorTop:!1,separatorBottom:!1,name:"analytics_group",children:e=>n.jsxs(j.Fragment,{children:[n.jsx(Hx,{className:"mb-30",onChange:()=>{t()},invalid:e,name:"files.certificate",accept:".json",label:n.jsx(d,{message:"Google service account key file (.json)"})}),n.jsx(C,{className:"mb-30",onChange:()=>{t()},invalid:e,name:"server.analytics_property_id",type:"number",label:n.jsx(d,{message:"Google analytics property ID"})}),n.jsx(C,{className:"mb-30",onChange:()=>{t()},invalid:e,name:"client.analytics.tracking_code",placeholder:"G-******",min:"1",max:"20",description:n.jsx(d,{message:"Google analytics measurement ID only, not the whole javascript snippet."}),label:n.jsx(d,{message:"Google tag manager measurement ID"})}),n.jsx(C,{name:"client.analytics.gchart_api_key",label:n.jsx(d,{message:"Google maps javascript API key"}),description:n.jsx(d,{message:"Only required in order to show world geochart on integrated analytics pages."})})]})})}function Wx(t){const e=xe();return $(s=>Zx(s),{onSuccess:(s,r)=>{H(g("User updated")),F.invalidateQueries(["users"]),e("/admin/users")},onError:s=>ge(s,t)})}function Zx({id:t,...e}){return e.roles&&(e.roles=e.roles.map(s=>s.id)),O.put(`users/${t}`,e).then(s=>s.data)}function kc({onSubmit:t,form:e,title:s,isLoading:r,avatarManager:i,resendEmailButton:a,children:o}){const{require_email_confirmation:l}=fe(),{data:c}=gt(["roles","permissions"]);return n.jsxs(ts,{onSubmit:t,form:e,title:s,isLoading:r,children:[n.jsxs("div",{className:"flex items-start gap-40 md:gap-80 mb-40",children:[i,n.jsxs("div",{className:"flex-auto",children:[o,n.jsx(C,{className:"mb-30",name:"first_name",label:n.jsx(d,{message:"First name"})}),n.jsx(C,{name:"last_name",label:n.jsx(d,{message:"Last name"})})]})]}),n.jsxs("div",{className:"border-t border-b mb-30 pb-30 pt-30",children:[n.jsx(E,{className:T(a&&"mb-30"),disabled:!l,name:"email_verified_at",description:n.jsx(d,{message:"Whether email address has been confirmed. User will not be able to login until address is confirmed, unless confirmation is disabled from settings page."}),children:n.jsx(d,{message:"Email confirmed"})}),a]}),n.jsx(un,{className:"mb-30",name:"available_space",label:n.jsx(d,{message:"Allowed storage space"}),description:n.jsx(d,{values:{a:u=>n.jsx(Y,{className:Qs,target:"_blank",to:"/admin/settings/uploading",children:u})},message:"Total storage space all user uploads are allowed to take up. If left empty, this value will be inherited from any roles or subscriptions user has, or from 'Available space' setting in <a>Uploading</a> settings page."})}),n.jsx(En,{className:"mb-30",name:"roles",label:n.jsx(d,{message:"Roles"}),suggestions:c==null?void 0:c.roles,children:u=>n.jsx(v,{value:u.id,children:u.name},u.id)}),n.jsxs("div",{className:"mt-30 pt-30 border-t",children:[n.jsx("div",{className:"text-sm mb-10",children:n.jsx(d,{message:"Permissions"})}),n.jsx(ha,{name:"permissions"})]})]})}function Kx(){var c;const t=X(),{require_email_confirmation:e}=fe(),{userId:s}=_e(),r=Wx(t),i=sh(),{data:a,isLoading:o}=nh(s,{with:["subscriptions","roles","permissions"]});if(j.useEffect(()=>{a!=null&&a.user&&!t.getValues().id&&t.reset({first_name:a.user.first_name,last_name:a.user.last_name,roles:a.user.roles,permissions:a.user.permissions,id:a.user.id,email_verified_at:!!a.user.email_verified_at,available_space:a.user.available_space,avatar:a.user.avatar})},[a==null?void 0:a.user,t]),o)return n.jsx(es,{});const l=n.jsx(w,{size:"xs",variant:"outline",color:"primary",disabled:!e||i.isLoading||((c=a==null?void 0:a.user)==null?void 0:c.email_verified_at)!=null,onClick:()=>{i.mutate({email:a.user.email})},children:n.jsx(d,{message:"Resend email"})});return n.jsx(kc,{onSubmit:u=>{r.mutate(u)},form:t,title:n.jsx(d,{values:{email:a==null?void 0:a.user.email},message:"Edit “:email“"}),isLoading:r.isLoading,avatarManager:n.jsx(Jx,{user:a.user,onChange:()=>{F.invalidateQueries(["users"])}}),resendEmailButton:l,children:n.jsx(C,{className:"mb-30",name:"password",type:"password",label:n.jsx(d,{message:"New password"})})})}function Jx({user:t,onChange:e}){const s=rh({user:t}),r=ih({user:t});return n.jsx(ks,{children:n.jsx(Yt,{name:"avatar",diskPrefix:"avatars",variant:"avatar",stretchPreview:!0,label:n.jsx(d,{message:"Profile image"}),previewSize:"w-90 h-90",showRemoveButton:!0,onChange:i=>{i?s.mutate({url:i}):r.mutate(),e()}})})}function Gx(t){const e=xe();return $(s=>Qx(s),{onSuccess:()=>{H(g("User created")),F.invalidateQueries(ee("users")),e("/admin/users")},onError:s=>ge(s,t)})}function Qx(t){return t.roles&&(t.roles=t.roles.map(e=>e.id)),O.post("users",t).then(e=>e.data)}function Yx(){const t=X(),e=Gx(t),s=n.jsx(ks,{children:n.jsx(Yt,{name:"avatar",diskPrefix:"avatars",variant:"avatar",stretchPreview:!0,label:n.jsx(d,{message:"Profile image"}),previewSize:"w-90 h-90",showRemoveButton:!0})});return n.jsxs(kc,{onSubmit:r=>{e.mutate(r)},form:t,title:n.jsx(d,{message:"Add new user"}),isLoading:e.isLoading,avatarManager:s,children:[n.jsx(C,{className:"mb-30",name:"email",type:"email",label:n.jsx(d,{message:"Email"})}),n.jsx(C,{className:"mb-30",name:"password",type:"password",label:n.jsx(d,{message:"Password"})})]})}const Xx=D(n.jsx("path",{d:"m12.87 15.07-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7 1.62-4.33L19.12 17h-3.24z"}),"TranslateOutlined"),wc=t=>{const e=["getLocaleWithLines"];return t!=null&&e.push(t),e};function e1(t){return Xt(wc(t),()=>t1(t),{staleTime:1/0})}function t1(t){return O.get(`localizations/${t}`).then(e=>e.data)}function s1({id:t,...e}){return O.put(`localizations/${t}`,e).then(s=>s.data)}function Sc(t){return $(e=>s1(e),{onSuccess:()=>{H(g("Localization updated")),F.invalidateQueries(ee("localizations")),F.invalidateQueries(wc())},onError:e=>t?ge(e,t):oe(e)})}function n1({localization:t}){const{trans:e}=P(),{formId:s,close:r}=te(),i=X({defaultValues:{id:t.id,name:t.name,language:t.language}}),{data:a}=gt(["languages"]),o=(a==null?void 0:a.languages)||[],l=Sc(i);return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Update localization"})}),n.jsx(ie,{children:n.jsxs(ce,{form:i,id:s,onSubmit:c=>{l.mutate(c,{onSuccess:r})},children:[n.jsx(C,{name:"name",label:n.jsx(d,{message:"Name"}),className:"mb-30",required:!0}),n.jsx(G,{required:!0,name:"language",label:n.jsx(d,{message:"Language"}),selectionMode:"single",showSearchField:!0,searchPlaceholder:e(g("Search languages")),children:o.map(c=>n.jsx(v,{value:c.code,children:c.name},c.code))})]})}),n.jsxs(le,{children:[n.jsx(w,{onClick:r,children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{variant:"flat",color:"primary",type:"submit",form:s,disabled:l.isLoading,children:n.jsx(d,{message:"Save"})})]})]})}function r1(t){return O.post("localizations",t).then(e=>e.data)}function i1(t){return $(e=>r1(e),{onSuccess:()=>{H(g("Localization created")),F.invalidateQueries(ee("localizations"))},onError:e=>ge(e,t)})}function a1(){const{trans:t}=P(),{formId:e,close:s}=te(),r=X({defaultValues:{language:"en"}}),{data:i}=gt(["languages"]),a=(i==null?void 0:i.languages)||[],o=i1(r);return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Create localization"})}),n.jsx(ie,{children:n.jsxs(ce,{form:r,id:e,onSubmit:l=>{o.mutate(l,{onSuccess:s})},children:[n.jsx(C,{autoFocus:!0,name:"name",label:n.jsx(d,{message:"Name"}),className:"mb-30",required:!0}),n.jsx(G,{required:!0,name:"language",label:n.jsx(d,{message:"Language"}),selectionMode:"single",showSearchField:!0,searchPlaceholder:t(g("Search languages")),children:a.map(l=>n.jsx(v,{value:l.code,children:l.name},l.code))})]})}),n.jsxs(le,{children:[n.jsx(w,{onClick:s,children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{variant:"flat",color:"primary",type:"submit",form:e,disabled:o.isLoading,children:n.jsx(d,{message:"Save"})})]})]})}const o1=""+new URL("around-the-world-df9b11c5.svg",import.meta.url).href,l1=[{key:"name",allowsSorting:!0,sortingKey:"name",visibleInMode:"all",width:"flex-3 min-w-200",header:()=>n.jsx(d,{message:"Name"}),body:t=>t.name},{key:"language",allowsSorting:!0,sortingKey:"language",header:()=>n.jsx(d,{message:"Language code"}),body:t=>t.language},{key:"updatedAt",allowsSorting:!0,width:"w-100",header:()=>n.jsx(d,{message:"Last updated"}),body:t=>n.jsx(he,{date:t.updated_at})},{key:"actions",header:()=>n.jsx(d,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-84 flex-shrink-0",visibleInMode:"all",body:t=>n.jsxs("div",{className:"text-muted",children:[n.jsx(Y,{to:`${t.id}/translate`,children:n.jsx(We,{label:n.jsx(d,{message:"Translate"}),children:n.jsx(N,{size:"md",children:n.jsx(Xx,{})})})}),n.jsxs(z,{type:"modal",children:[n.jsx(We,{label:n.jsx(d,{message:"Edit"}),children:n.jsx(N,{children:n.jsx(Ee,{})})}),n.jsx(n1,{localization:t})]})]})}];function c1(){return n.jsx(De,{endpoint:"localizations",title:n.jsx(d,{message:"Localizations"}),columns:l1,actions:n.jsx(d1,{}),selectedActions:n.jsx($e,{}),emptyStateMessage:n.jsx(ve,{image:o1,title:n.jsx(d,{message:"No localizations have been created yet"}),filteringTitle:n.jsx(d,{message:"No matching localizations"})})})}function d1(){return n.jsx(j.Fragment,{children:n.jsxs(z,{type:"modal",children:[n.jsx(Ze,{children:n.jsx(d,{message:"Add new localization"})}),n.jsx(a1,{})]})})}function u1(){const{formId:t,close:e}=te(),s=X();return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Add translation"})}),n.jsx(ie,{children:n.jsxs(ce,{form:s,id:t,onSubmit:r=>{e(r)},children:[n.jsx(St,{className:"mb-30",title:n.jsx(d,{message:"Add a new translation, if it does not exist already."}),description:n.jsx(d,{message:"This should only need to be done for things like custom menu items."})}),n.jsx(C,{inputElementType:"textarea",rows:2,autoFocus:!0,name:"key",label:n.jsx(d,{message:"Translation key"}),className:"mb-30",required:!0}),n.jsx(C,{inputElementType:"textarea",rows:2,name:"value",label:n.jsx(d,{message:"Translation value"}),required:!0})]})}),n.jsxs(le,{children:[n.jsx(w,{onClick:e,children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{variant:"flat",color:"primary",type:"submit",form:t,children:n.jsx(d,{message:"Add"})})]})]})}function h1(){const{localeId:t}=_e(),{data:e,isLoading:s}=e1(t),r=e==null?void 0:e.localization;return s||!r?n.jsx(es,{}):n.jsx(m1,{localization:r})}function m1({localization:t}){const[e,s]=j.useState(t.lines||{}),r=xe(),i=Sc(),[a,o]=j.useState("");return n.jsxs("form",{className:"p-14 md:p-24 flex flex-col h-full",onSubmit:l=>{l.preventDefault(),i.mutate({id:t.id,lines:e},{onSuccess:()=>{r("/admin/localizations")}})},children:[n.jsx(p1,{localization:t,setLines:s,lines:e,searchQuery:a,setSearchQuery:o,isLoading:i.isLoading}),n.jsx(f1,{lines:e,setLines:s,searchQuery:a})]})}function p1({localization:t,searchQuery:e,setSearchQuery:s,isLoading:r,lines:i,setLines:a}){const o=xe(),l=Ge(),{trans:c}=P();return n.jsxs("div",{className:"flex-shrink-0",children:[n.jsxs(Tm,{size:"lg",className:"mb-16",children:[n.jsx(qa,{onSelected:()=>{o("/admin/localizations")},children:n.jsx(d,{message:"Localizations"})}),n.jsx(qa,{children:n.jsx(d,{message:":locale translations",values:{locale:t.name}})})]}),n.jsxs("div",{className:"mb-24 flex items-center gap-32 md:gap-12",children:[n.jsx("div",{className:"max-w-440 flex-auto",children:n.jsx(Qt,{value:e,onChange:u=>s(u.target.value),startAdornment:n.jsx(pr,{}),placeholder:c({message:"Type to search..."})})}),n.jsxs(z,{type:"modal",onClose:u=>{if(u){const h={...i};h[u.key]=u.value,a(h)}},children:[!l&&n.jsx(w,{className:"ml-auto",variant:"outline",color:"primary",startIcon:n.jsx(at,{}),children:n.jsx(d,{message:"Add new"})}),n.jsx(u1,{})]}),n.jsx(w,{variant:"flat",color:"primary",type:"submit",disabled:r,children:l?n.jsx(d,{message:"Save"}):n.jsx(d,{message:"Save translations"})})]})]})}function f1({searchQuery:t,lines:e,setLines:s}){const r=j.useMemo(()=>Object.entries(e).filter(([o,l])=>{const c=t==null?void 0:t.toLowerCase();return!c||(o==null?void 0:o.toLowerCase().includes(c))||(l==null?void 0:l.toLowerCase().includes(c))}),[e,t]),i=j.useRef(null),a=Oh({count:r.length,getScrollElement:()=>i.current,estimateSize:()=>123});return n.jsx("div",{className:"flex-auto overflow-y-auto",ref:i,children:n.jsx("div",{className:"relative w-full",style:{height:`${a.getTotalSize()}px`},children:a.getVirtualItems().map(o=>{const[l,c]=r[o.index];return n.jsx("div",{className:"w-full absolute top-0 left-0",style:{height:`${o.size}px`,transform:`translateY(${o.start}px)`},children:n.jsxs("div",{className:"rounded border mb-10 md:mr-10",children:[n.jsxs("div",{className:"flex items-center gap-24 justify-between px-10 py-2 border-b",children:[n.jsx("label",{className:"text-xs font-semibold flex-auto",htmlFor:l,children:l}),n.jsx(N,{size:"xs",className:"text-muted",onClick:()=>{const u={...e};delete u[l],s(u)},children:n.jsx(it,{})})]}),n.jsx("div",{children:n.jsx("textarea",{id:l,name:l,defaultValue:c,className:"w-full bg-inherit block rounded resize-none outline-none focus-visible:ring-2 p-10 text-sm",rows:2,onChange:u=>{const h={...e};h[l]=u.target.value,s(h)}})})]})},l)})})})}function g1(){var e;const t=Pn();return n.jsxs("div",{className:"container mx-auto p-12 md:p-24",children:[n.jsx(Js,{children:n.jsx(d,{message:"Ads"})}),n.jsx("h1",{className:"font-light text-2xl md:text-3xl mb-20 md:mb-40",children:n.jsx(d,{message:"Predefined Ad slots"})}),t.isLoading?n.jsx(Gs,{isIndeterminate:!0}):n.jsx(x1,{defaultValues:((e=t.data)==null?void 0:e.client.ads)||{}})]})}function x1({defaultValues:t}){const{admin:{ads:e}}=j.useContext(Ot),s=X({defaultValues:{client:{ads:t}}}),r=Cc(s);return n.jsxs(ce,{form:s,onSubmit:i=>{r.mutate(i)},children:[e.map(i=>n.jsx(j1,{adConfig:i},i.slot)),n.jsx(E,{name:"client.ads.disable",className:"mb-30",description:n.jsx(d,{message:"Disable all add related functionality across the site."}),children:n.jsx(d,{message:"Disable ads"})}),n.jsx(w,{type:"submit",variant:"flat",color:"primary",disabled:r.isLoading,children:n.jsx(d,{message:"Save"})})]})}function j1({adConfig:t}){const e=Ge();return n.jsxs("div",{className:"flex items-center gap-24",children:[n.jsx(C,{className:"mb-30 flex-auto",name:`client.${t.slot}`,inputElementType:"textarea",rows:8,label:n.jsx(d,{...t.description})}),!e&&n.jsxs(z,{type:"modal",children:[n.jsx("button",{type:"button",className:"outline-none focus-visible:ring cursor-zoom-in rounded overflow-hidden hover:scale-105 transition",children:n.jsx("img",{src:t.image,className:"w-auto h-[186px] border",alt:"Ad slot example"})}),n.jsx(Il,{image:t.image})]})]})}function b1(){const t=ws(s=>{var r;return(r=s.config)==null?void 0:r.sections}),e=j.useMemo(()=>t?Object.entries(t||[]).map(([s,r])=>({...r,key:s})).sort((s,r)=>((s==null?void 0:s.position)||1)-((r==null?void 0:r.position)||1)):[],[t]);return n.jsx(j.Fragment,{children:e.map(s=>n.jsx(wt,{to:s.key,elementType:ea,children:n.jsx(d,{...s.label})},s.key))})}const y1=[{key:"type",label:g("Type"),description:g("Type of the role"),defaultOperator:q.ne,control:{type:V.Select,defaultValue:"01",options:[{key:"01",label:g("Sitewide"),value:"sitewide"},{key:"02",label:g("Workspace"),value:"workspace"}]}},Be({description:g("Date role was created")}),Ve({description:g("Date role was last updated")})],v1=[{key:"name",allowsSorting:!0,visibleInMode:"all",header:()=>n.jsx(d,{message:"Role"}),body:t=>n.jsxs("div",{children:[n.jsx("div",{children:n.jsx(d,{message:t.name})}),n.jsx("div",{className:"text-muted text-xs overflow-x-hidden overflow-ellipsis",children:t.description?n.jsx(d,{message:t.description}):void 0})]})},{key:"type",maxWidth:"max-w-100",allowsSorting:!0,header:()=>n.jsx(d,{message:"Type"}),body:t=>n.jsx(d,{message:t.type})},{key:"updated_at",maxWidth:"max-w-100",allowsSorting:!0,header:()=>n.jsx(d,{message:"Last updated"}),body:t=>n.jsx(he,{date:t.updated_at})},{key:"actions",header:()=>n.jsx(d,{message:"Actions"}),hideHeader:!0,visibleInMode:"all",align:"end",width:"w-42 flex-shrink-0",body:t=>n.jsx(Y,{to:`${t.id}/edit`,children:n.jsx(N,{size:"md",className:"text-muted",children:n.jsx(Ee,{})})})}];function C1(){return n.jsx(De,{endpoint:"roles",title:n.jsx(d,{message:"Roles"}),columns:v1,filters:y1,actions:n.jsx(k1,{}),selectedActions:n.jsx($e,{}),emptyStateMessage:n.jsx(ve,{image:xn,title:n.jsx(d,{message:"No roles have been created yet"}),filteringTitle:n.jsx(d,{message:"No matching roles"})})})}function k1(){return n.jsxs(j.Fragment,{children:[n.jsx(lc,{endpoint:"roles/csv/export"}),n.jsx(Ze,{elementType:Y,to:"new",children:n.jsx(d,{message:"Add new role"})})]})}const Mc=t=>`roles/${t}`;function w1(t){return O.get(Mc(t)).then(e=>e.data)}function S1(){const{roleId:t}=_e();return Xt([Mc(t)],()=>w1(t))}const Nc=t=>`roles/${t}`;function M1(){const{trans:t}=P(),e=xe();return $(s=>N1(s),{onSuccess:s=>{H(t(g("Role updated"))),F.invalidateQueries([Nc(s.role.id)]),F.invalidateQueries(ee("roles")),e("/admin/roles")},onError:s=>oe(s)})}function N1({id:t,...e}){return O.put(Nc(t),e).then(s=>s.data)}function Lc({isInternal:t=!1}){const{trans:e}=P(),{workspaces:s}=fe(),{watch:r}=I(),i=r("type");return n.jsxs(n.Fragment,{children:[n.jsx(C,{label:n.jsx(d,{message:"Name"}),name:"name",className:"mb-20",required:!0}),n.jsx(C,{label:n.jsx(d,{message:"Description"}),name:"description",inputElementType:"textarea",placeholder:e(g("Role description...")),rows:4,className:"mb-20"}),s.integrated&&n.jsxs(G,{label:n.jsx(d,{message:"Type"}),name:"type",selectionMode:"single",className:"mb-20",description:n.jsx(d,{message:"Whether this role will be assigned to users globally on the site or only within workspaces."}),children:[n.jsx(v,{value:"sitewide",children:n.jsx(d,{message:"Sitewide"})}),n.jsx(v,{value:"workspace",children:n.jsx(d,{message:"Workspace"})})]}),!t&&n.jsxs(n.Fragment,{children:[n.jsx(E,{name:"default",className:"mb-20",description:n.jsx(d,{message:"Assign this role to new users automatically."}),children:n.jsx(d,{message:"Default"})}),i==="sitewide"&&n.jsx(E,{name:"guests",description:n.jsx(d,{message:"Assign this role to guests (not logged in users)."}),children:n.jsx(d,{message:"Guests"})})]}),n.jsx("h2",{className:"mb-10 mt-30 text-lg",children:n.jsx(d,{message:"Permissions"})}),n.jsx(ha,{name:"permissions",valueListKey:i==="sitewide"?"permissions":"workspacePermissions"})]})}function L1({onUserSelected:t}){var u;const{close:e}=te(),[s,r]=j.useState(""),{trans:i}=P(),a=tm(Pt,{query:s,perPage:14}),o=((u=a.data)==null?void 0:u.results)||[],l=n.jsx(fr,{className:"pt-20",size:"sm",title:n.jsx(d,{message:"No matching users"}),description:n.jsx(d,{message:"Try another search query"}),image:n.jsx(gr,{src:xn})}),c=h=>{e(),t(h)};return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Select a user"})}),n.jsxs(ie,{children:[n.jsx(Qt,{autoFocus:!0,className:"mb-20",startAdornment:n.jsx(pr,{}),placeholder:i(g("Search for user by name or email")),value:s,onChange:h=>{r(h.target.value)}}),!a.isLoading&&!o.length&&l,n.jsx("div",{className:"grid grid-cols-2 gap-x-10",children:o.map(h=>n.jsx(T1,{user:h,onUserSelected:c},h.id))})]})]})}function T1({user:t,onUserSelected:e}){return n.jsxs("div",{className:"flex items-center gap-10 outline-none focus-visible:ring ring-offset-4 hover:bg-hover p-10 rounded",role:"button",tabIndex:0,onClick:()=>{e(t)},onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),e(t))},children:[n.jsx(zl,{src:t.image}),n.jsxs("div",{className:"overflow-hidden",children:[n.jsx("div",{className:"text-ellipsis overflow-hidden",children:t.name}),n.jsx("div",{className:"text-muted text-ellipsis overflow-hidden",children:t.description})]})]},t.id)}function A1(t){return $(({userIds:e})=>I1({userIds:e,roleId:t.id}),{onSuccess:(e,s)=>{H(g("Removed [one 1 user|other :count users] from “{role}“",{values:{count:s.userIds.length,role:t.name}}))},onError:e=>oe(e)})}function I1({roleId:t,userIds:e}){return O.post(`roles/${t}/remove-users`,{userIds:e}).then(s=>s.data)}function E1(t){return $(({userIds:e})=>D1({userIds:e,roleId:t.id}),{onSuccess:(e,s)=>{H(g("Assigned [one 1 user|other :count users] to {role}",{values:{count:s.userIds.length,role:t.name}}))},onError:e=>oe(e)})}function D1({roleId:t,userIds:e}){return O.post(`roles/${t}/add-users`,{userIds:e}).then(s=>s.data)}const Tc={key:"name",allowsSorting:!0,sortingKey:"email",header:()=>n.jsx(d,{message:"User"}),body:t=>n.jsx(mt,{image:t.avatar,label:t.display_name,description:t.email}),width:"col-w-3"},O1=[Tc,{key:"first_name",allowsSorting:!0,header:()=>n.jsx(d,{message:"First name"}),body:t=>t.first_name},{key:"last_name",allowsSorting:!0,header:()=>n.jsx(d,{message:"Last name"}),body:t=>t.last_name},{key:"created_at",allowsSorting:!0,header:()=>n.jsx(d,{message:"Assigned at"}),body:t=>n.jsx(he,{date:t.created_at})}],P1=[Tc];function F1({role:t}){const e=Ge();return t.guests||t.type==="workspace"?n.jsx("div",{className:"pt-30 pb-10",children:n.jsx(ve,{image:xn,title:n.jsx(d,{message:"Users can't be assigned to this role"})})}):n.jsx(oc,{endpoint:"users",columns:e?P1:O1,queryParams:{roleId:`${t.id}`},actions:n.jsx(z1,{role:t}),selectedActions:n.jsx(R1,{role:t}),emptyStateMessage:n.jsx(ve,{image:xn,title:n.jsx(d,{message:"No users have been assigned to this role yet"}),filteringTitle:n.jsx(d,{message:"No matching users"})})})}function z1({role:t}){const e=E1(t);return n.jsxs(z,{type:"modal",children:[n.jsx(w,{variant:"flat",color:"primary",disabled:e.isLoading,children:n.jsx(d,{message:"Assign user"})}),n.jsx(L1,{onUserSelected:s=>{e.mutate({userIds:[s.id]},{onSuccess:()=>{F.invalidateQueries(ee("users",{roleId:`${t.id}`}))}})}})]})}function R1({role:t}){const e=A1(t),{selectedRows:s}=ua();return n.jsxs(z,{type:"modal",onClose:r=>{r&&e.mutate({userIds:s},{onSuccess:()=>{F.invalidateQueries(ee("users",{roleId:`${t.id}`}))}})},children:[n.jsx(w,{variant:"flat",color:"danger",disabled:e.isLoading,children:n.jsx(d,{message:"Remove users"})}),n.jsx(lt,{title:n.jsx(d,{message:"Remove [one 1 user|other :count users] from “:name“ role?",values:{count:s.length,name:t.name}}),body:n.jsx(d,{message:"This will permanently remove the users."}),confirm:n.jsx(d,{message:"Remove"}),isDanger:!0})]})}function _1(){const t=S1();return t.status!=="success"?n.jsx(es,{}):n.jsx(B1,{role:t.data.role})}function B1({role:t}){const e=X({defaultValues:t}),s=M1();return n.jsx(ts,{form:e,onSubmit:r=>{s.mutate(r)},title:n.jsx(d,{message:"Edit “:name“ role",values:{name:t.name}}),isLoading:s.isLoading,children:n.jsxs(yr,{isLazy:!0,children:[n.jsxs(vr,{children:[n.jsx(Tt,{children:n.jsx(d,{message:"Settings"})}),n.jsx(Tt,{children:n.jsx(d,{message:"Users"})})]}),n.jsxs(Cr,{className:"pt-20",children:[n.jsx(At,{children:n.jsx(Lc,{isInternal:t.internal})}),n.jsx(At,{children:n.jsx(F1,{role:t})})]})]})})}const V1="roles";function $1(t){const{trans:e}=P();return $(s=>H1(s),{onSuccess:()=>{H(e(g("Created new role"))),F.invalidateQueries(ee("roles"))},onError:s=>ge(s,t)})}function H1({id:t,...e}){return O.post(V1,e).then(s=>s.data)}function q1(){const t=X({defaultValues:{type:"sitewide"}}),e=$1(t),s=xe();return n.jsx(ts,{form:t,onSubmit:r=>{e.mutate(r,{onSuccess:i=>{s(`/admin/roles/${i.role.id}/edit`)}})},title:n.jsx(d,{message:"Add new role"}),isLoading:e.isLoading,children:n.jsx(Lc,{})})}const U1=t=>[{key:"type",label:g("Type"),description:g("Type of the tag"),defaultOperator:q.ne,control:{type:V.Select,defaultValue:t[0].name,options:t.map(e=>({key:e.name,label:g(e.name),value:e.name}))}},Be({description:g("Date tag was created")}),Ve({description:g("Date tag was last updated")})],Ac=""+new URL("software-engineer-ba026106.svg",import.meta.url).href;function Ic({form:t,onSubmit:e,formId:s}){const{tags:{types:r}}=j.useContext(Ot),i=t.watch("type"),a=!!r.find(o=>o.name===i&&o.system);return n.jsxs(ce,{id:s,form:t,onSubmit:e,children:[n.jsx(C,{name:"name",label:n.jsx(d,{message:"Name"}),description:n.jsx(d,{message:"Unique tag identifier."}),className:"mb-20",required:!0,autoFocus:!0}),n.jsx(C,{name:"display_name",label:n.jsx(d,{message:"Display name"}),description:n.jsx(d,{message:"User friendly tag name."}),className:"mb-20"}),n.jsx(G,{name:"type",selectionMode:"single",disabled:a,children:r.filter(o=>!o.system).map(o=>n.jsx(v,{value:o.name,children:n.jsx(d,{message:o.name})},o.name))})]})}function W1(t){const{trans:e}=P();return $(s=>Z1(s),{onSuccess:()=>{H(e(g("Tag created"))),F.invalidateQueries(ee("tags"))},onError:s=>ge(s,t)})}function Z1(t){return O.post("tags",t).then(e=>e.data)}function K1(){const{close:t,formId:e}=te(),{tags:{types:s}}=j.useContext(Ot),r=X({defaultValues:{type:s[0].name}}),i=W1(r);return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Add new tag"})}),n.jsx(ie,{children:n.jsx(Ic,{formId:e,form:r,onSubmit:a=>{i.mutate(a,{onSuccess:()=>{t()}})}})}),n.jsxs(le,{children:[n.jsx(w,{onClick:()=>{t()},children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{form:e,disabled:i.isLoading,variant:"flat",color:"primary",type:"submit",children:n.jsx(d,{message:"Save"})})]})]})}function J1(t){const{trans:e}=P();return $(s=>G1(s),{onSuccess:()=>{H(e(g("Tag updated"))),F.invalidateQueries(ee("tags"))},onError:s=>ge(s,t)})}function G1({id:t,...e}){return O.put(`tags/${t}`,e).then(s=>s.data)}function Q1({tag:t}){const{close:e,formId:s}=te(),r=X({defaultValues:{id:t.id,name:t.name,display_name:t.display_name,type:t.type}}),i=J1(r);return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Update “:name“ tag",values:{name:t.name}})}),n.jsx(ie,{children:n.jsx(Ic,{formId:s,form:r,onSubmit:a=>{i.mutate(a,{onSuccess:()=>{e()}})}})}),n.jsxs(le,{children:[n.jsx(w,{onClick:()=>{e()},children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{form:s,disabled:i.isLoading,variant:"flat",color:"primary",type:"submit",children:n.jsx(d,{message:"Save"})})]})]})}const Y1=[{key:"name",allowsSorting:!0,visibleInMode:"all",width:"flex-3 min-w-200",header:()=>n.jsx(d,{message:"Name"}),body:t=>t.name},{key:"type",allowsSorting:!0,header:()=>n.jsx(d,{message:"Type"}),body:t=>t.type},{key:"display_name",allowsSorting:!0,header:()=>n.jsx(d,{message:"Display name"}),body:t=>t.display_name},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>n.jsx(d,{message:"Last updated"}),body:t=>n.jsx(he,{date:t.updated_at})},{key:"actions",header:()=>n.jsx(d,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-42 flex-shrink-0",visibleInMode:"all",body:t=>n.jsxs(z,{type:"modal",children:[n.jsx(N,{size:"md",className:"text-muted",children:n.jsx(Ee,{})}),n.jsx(Q1,{tag:t})]})}];function X1(){const{tags:t}=j.useContext(Ot),e=j.useMemo(()=>U1(t.types),[t.types]);return n.jsx(De,{endpoint:"tags",title:n.jsx(d,{message:"Tags"}),columns:Y1,filters:e,actions:n.jsx(e5,{}),selectedActions:n.jsx($e,{}),emptyStateMessage:n.jsx(ve,{image:Ac,title:n.jsx(d,{message:"No tags have been created yet"}),filteringTitle:n.jsx(d,{message:"No matching tags"})})})}function e5(){return n.jsx(n.Fragment,{children:n.jsxs(z,{type:"modal",children:[n.jsx(Ze,{children:n.jsx(d,{message:"Add new tag"})}),n.jsx(K1,{})]})})}const Ec=j.memo(({bytes:t})=>n.jsx(j.Fragment,{children:ta(t)})),t5=D(n.jsx("path",{d:"M12 6c3.79 0 7.17 2.13 8.82 5.5C19.17 14.87 15.79 17 12 17s-7.17-2.13-8.82-5.5C4.83 8.13 8.21 6 12 6m0-2C7 4 2.73 7.11 1 11.5 2.73 15.89 7 19 12 19s9.27-3.11 11-7.5C21.27 7.11 17 4 12 4zm0 5c1.38 0 2.5 1.12 2.5 2.5S13.38 14 12 14s-2.5-1.12-2.5-2.5S10.62 9 12 9m0-2c-2.48 0-4.5 2.02-4.5 4.5S9.52 16 12 16s4.5-2.02 4.5-4.5S14.48 7 12 7z"}),"VisibilityOutlined"),s5=""+new URL("upload-cabfc914.svg",import.meta.url).href,n5=_.createContext(null);function Ft(t,e){const{base_url:s}=fe(),r=j.useContext(n5);return j.useMemo(()=>{if(!t)return{};let i;t.url&&(i=ah(t.url)?t.url:`${s}/${t.url}`);const a={previewUrl:i,downloadUrl:`${s}/api/v1/file-entries/download/${(e==null?void 0:e.downloadHashes)||t.hash}`};return r&&(a.previewUrl&&(a.previewUrl=so(a.previewUrl,{...r,thumbnail:e!=null&&e.thumbnail?"true":""},s)),a.downloadUrl=so(a.downloadUrl,r,s)),a},[s,t,e==null?void 0:e.downloadHashes,e==null?void 0:e.thumbnail,r])}function so(t,e,s){const r=new URL(t,s);return Object.entries(e).forEach(([i,a])=>{r.searchParams.append(i,a)}),r.toString()}const ja=_.createContext(null);function Dt({message:t,className:e,allowDownload:s}){const{entries:r,activeIndex:i}=j.useContext(ja),a=r[i],o=t||n.jsx(d,{message:"No file preview available"}),{downloadUrl:l}=Ft(a);return n.jsxs("div",{className:T(e,"shadow bg-paper max-w-400 w-[calc(100%-40px)] text-center p-40 rounded"),children:[n.jsx("div",{className:"text-lg",children:o}),s&&n.jsx("div",{className:"block mt-20 text-center",children:n.jsx(w,{variant:"flat",color:"primary",onClick:()=>{l&&Qn(l)},children:n.jsx(d,{message:"Download"})})})]})}function r5(t){const{entry:e,className:s}=t,{trans:r}=P(),{previewUrl:i}=Ft(e);return i?n.jsx("img",{className:T(s,"shadow"),src:i,alt:r({message:"Preview for :name",values:{name:e.name}})}):n.jsx(Dt,{...t})}const i5=5242880;function a5(t){const{entry:e,className:s}=t,{trans:r}=P(),[i,a]=j.useState(!1),[o,l]=j.useState(!0),[c,u]=j.useState(!1),[h,m]=j.useState(null),{previewUrl:p}=Ft(e);return j.useEffect(()=>{e&&(p?e.file_size>=i5?(a(!0),l(!1)):o5(p).then(f=>{m(f.data)}).catch(()=>{u(!0)}).finally(()=>{l(!1)}):u(!0))},[e,p]),o?n.jsx(Gs,{isIndeterminate:!0,"aria-label":r({message:"Loading file contents"})}):i?n.jsx(Dt,{...t,message:n.jsx(d,{message:"This file is too large to preview."})}):c?n.jsx(Dt,{...t,message:n.jsx(d,{message:"There was an issue previewing this file"})}):n.jsx("pre",{className:T("rounded bg-paper p-20 text-sm whitespace-pre-wrap break-words h-full overflow-y-auto w-full",s),children:n.jsx("div",{className:"container mx-auto",children:`${h}`})})}function o5(t){return O.get(t,{responseType:"text",withCredentials:!1,headers:{Accept:"text/plain"}})}function l5(t){const{entry:e,className:s}=t,{previewUrl:r}=Ft(e),i=j.useRef(null),[a,o]=j.useState(!1);return j.useEffect(()=>{var l;o(!((l=i.current)!=null&&l.canPlayType(e.mime)))},[e]),a||!r?n.jsx(Dt,{...t}):n.jsx("video",{className:s,ref:i,controls:!0,controlsList:"nodownload noremoteplayback",playsInline:!0,autoPlay:!0,children:n.jsx("source",{src:r,type:e.mime,onError:()=>{o(!0)}})})}function c5(t){const{entry:e,className:s}=t,{previewUrl:r}=Ft(e),i=j.useRef(null),[a,o]=j.useState(!1);return j.useEffect(()=>{var l;o(!((l=i.current)!=null&&l.canPlayType(e.mime)))},[e]),a||!r?n.jsx(Dt,{...t}):n.jsx("audio",{className:s,ref:i,controls:!0,controlsList:"nodownload noremoteplayback",autoPlay:!0,children:n.jsx("source",{src:r,type:e.mime,onError:()=>{o(!0)}})})}function d5(t){const{entry:e,className:s}=t,{trans:r}=P(),{previewUrl:i}=Ft(e);return i?n.jsx("iframe",{title:r({message:"Preview for :name",values:{name:e.name}}),className:T(s,"w-full h-full"),src:`${i}#toolbar=0`}):n.jsx(Dt,{...t})}function Hr(t){const{entry:e,className:s}=t,{trans:r}=P(),i=j.useRef(null),[a,o]=j.useState(!1),l=j.useRef(),[c,u]=j.useState(!1),{previewUrl:h}=Ft(e);return j.useEffect(()=>{h?e.file_size&&e.file_size>25e6?o(!0):i.current&&(i.current.onload=()=>{clearTimeout(l.current),u(!1)},u5(h,e).then(m=>{i.current&&(i.current.src=m)}),l.current=setTimeout(()=>{o(!0)},5e3)):o(!0)},[e,h]),a?n.jsx(Dt,{...t}):n.jsxs("div",{className:T(s,"w-full h-full"),children:[c&&n.jsx(Gs,{}),n.jsx("iframe",{ref:i,title:r({message:"Preview for :name",values:{name:e.name}}),className:T("w-full h-full",c&&"hidden")})]})}async function u5(t,e){const s=new URL(t);if(!s.searchParams.has("shareable_link")){const{data:r}=await O.post(`file-entries/${e.id}/add-preview-token`);s.searchParams.append("preview_token",r.preview_token)}return h5(s)}function h5(t){return`https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(t.toString())}`}const no={text:a5,video:l5,audio:c5,image:r5,pdf:d5,spreadsheet:Hr,powerPoint:Hr,word:Hr,"text/rtf":Dt};function m5(t){const e=t==null?void 0:t.mime,s=t==null?void 0:t.type;return no[e]||no[s]||Dt}const p5=D(n.jsx("path",{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12l4.58-4.59z"}),"ChevronLeftOutlined"),f5=D(n.jsx("g",{children:n.jsx("path",{d:"M 23.65625 4 C 22.320313 4 21.066406 4.519531 20.121094 5.464844 L 11.464844 14.121094 C 10.519531 15.066406 10 16.320313 10 17.65625 L 10 57 C 10 58.652344 11.347656 60 13 60 L 53 60 C 54.652344 60 56 58.652344 56 57 L 56 7 C 56 5.347656 54.652344 4 53 4 Z M 24 6 L 53 6 C 53.550781 6 54 6.449219 54 7 L 54 57 C 54 57.550781 53.550781 58 53 58 L 13 58 C 12.449219 58 12 57.550781 12 57 L 12 18 L 21 18 C 22.652344 18 24 16.652344 24 15 Z M 22 6.5 L 22 15 C 22 15.550781 21.550781 16 21 16 L 12.5 16 C 12.605469 15.835938 12.734375 15.679688 12.878906 15.535156 L 21.535156 6.878906 C 21.679688 6.738281 21.835938 6.613281 22 6.5 Z M 21 22 C 20.449219 22 20 22.449219 20 23 C 20 23.550781 20.449219 24 21 24 L 37 24 C 37.550781 24 38 23.550781 38 23 C 38 22.449219 37.550781 22 37 22 Z M 41 22 C 40.449219 22 40 22.449219 40 23 C 40 23.550781 40.449219 24 41 24 L 45 24 C 45.550781 24 46 23.550781 46 23 C 46 22.449219 45.550781 22 45 22 Z M 21 26 C 20.449219 26 20 26.449219 20 27 C 20 27.550781 20.449219 28 21 28 L 41 28 C 41.550781 28 42 27.550781 42 27 C 42 26.449219 41.550781 26 41 26 Z M 21 32 C 20.449219 32 20 32.449219 20 33 C 20 33.550781 20.449219 34 21 34 L 43 34 C 43.550781 34 44 33.550781 44 33 C 44 32.449219 43.550781 32 43 32 Z M 21 36 C 20.449219 36 20 36.449219 20 37 C 20 37.550781 20.449219 38 21 38 L 33 38 C 33.550781 38 34 37.550781 34 37 C 34 36.449219 33.550781 36 33 36 Z M 15 50 C 14.449219 50 14 50.449219 14 51 L 14 53 C 14 53.550781 14.449219 54 15 54 C 15.550781 54 16 53.550781 16 53 L 16 51 C 16 50.449219 15.550781 50 15 50 Z M 20 50 C 19.449219 50 19 50.449219 19 51 L 19 53 C 19 53.550781 19.449219 54 20 54 C 20.550781 54 21 53.550781 21 53 L 21 51 C 21 50.449219 20.550781 50 20 50 Z M 25 50 C 24.449219 50 24 50.449219 24 51 L 24 53 C 24 53.550781 24.449219 54 25 54 C 25.550781 54 26 53.550781 26 53 L 26 51 C 26 50.449219 25.550781 50 25 50 Z M 30 50 C 29.449219 50 29 50.449219 29 51 L 29 53 C 29 53.550781 29.449219 54 30 54 C 30.550781 54 31 53.550781 31 53 L 31 51 C 31 50.449219 30.550781 50 30 50 Z M 35 50 C 34.449219 50 34 50.449219 34 51 L 34 53 C 34 53.550781 34.449219 54 35 54 C 35.550781 54 36 53.550781 36 53 L 36 51 C 36 50.449219 35.550781 50 35 50 Z M 40 50 C 39.449219 50 39 50.449219 39 51 L 39 53 C 39 53.550781 39.449219 54 40 54 C 40.550781 54 41 53.550781 41 53 L 41 51 C 41 50.449219 40.550781 50 40 50 Z M 45 50 C 44.449219 50 44 50.449219 44 51 L 44 53 C 44 53.550781 44.449219 54 45 54 C 45.550781 54 46 53.550781 46 53 L 46 51 C 46 50.449219 45.550781 50 45 50 Z M 50 50 C 49.449219 50 49 50.449219 49 51 L 49 53 C 49 53.550781 49.449219 54 50 54 C 50.550781 54 51 53.550781 51 53 L 51 51 C 51 50.449219 50.550781 50 50 50 Z "})})),g5=D(n.jsx("g",{children:n.jsx("path",{d:"M 21.65625 4 C 20.320313 4 19.0625 4.519531 18.121094 5.464844 L 9.464844 14.121094 C 8.519531 15.066406 8 16.320313 8 17.65625 L 8 57 C 8 58.652344 9.347656 60 11 60 L 51 60 C 52.652344 60 54 58.652344 54 57 L 54 7 C 54 5.347656 52.652344 4 51 4 Z M 22 6 L 51 6 C 51.550781 6 52 6.449219 52 7 L 52 57 C 52 57.550781 51.550781 58 51 58 L 11 58 C 10.449219 58 10 57.550781 10 57 L 10 18 L 19 18 C 20.652344 18 22 16.652344 22 15 Z M 20 6.5 L 20 15 C 20 15.550781 19.550781 16 19 16 L 10.5 16 C 10.609375 15.835938 10.734375 15.679688 10.878906 15.535156 L 19.535156 6.878906 C 19.679688 6.734375 19.835938 6.609375 20 6.5 Z M 42.78125 18.023438 L 24.78125 22.023438 C 24.328125 22.125 24 22.53125 24 23 L 24 37 C 20.691406 37 18 39.242188 18 42 C 18 44.757813 20.691406 47 24 47 C 27.308594 47 30 44.757813 30 42 L 30 29.910156 L 38 28.136719 L 38 33 C 34.691406 33 32 35.242188 32 38 C 32 40.757813 34.691406 43 38 43 C 41.308594 43 44 40.757813 44 38 L 44 19 C 44 18.695313 43.863281 18.410156 43.625 18.21875 C 43.390625 18.03125 43.082031 17.960938 42.78125 18.023438 Z M 42 20.246094 L 42 38 C 42 39.652344 40.207031 41 38 41 C 35.792969 41 34 39.652344 34 38 C 34 36.347656 35.792969 35 38 35 C 38.28125 35 38.5625 35.023438 38.839844 35.066406 C 39.128906 35.117188 39.421875 35.03125 39.648438 34.84375 C 39.871094 34.652344 40 34.375 40 34.078125 L 40 26.890625 C 40 26.585938 39.863281 26.300781 39.625 26.109375 C 39.390625 25.921875 39.078125 25.847656 38.78125 25.910156 L 28.78125 28.136719 C 28.328125 28.238281 28 28.644531 28 29.109375 L 28 42 C 28 43.652344 26.207031 45 24 45 C 21.792969 45 20 43.652344 20 42 C 20 40.347656 21.792969 39 24 39 C 24.28125 39 24.5625 39.023438 24.839844 39.066406 C 25.128906 39.117188 25.425781 39.03125 25.648438 38.84375 C 25.871094 38.652344 26 38.375 26 38.078125 L 26 23.800781 Z M 13 52 C 12.449219 52 12 52.445313 12 53 L 12 55 C 12 55.554688 12.449219 56 13 56 C 13.550781 56 14 55.554688 14 55 L 14 53 C 14 52.445313 13.550781 52 13 52 Z M 18 52 C 17.449219 52 17 52.445313 17 53 L 17 55 C 17 55.554688 17.449219 56 18 56 C 18.550781 56 19 55.554688 19 55 L 19 53 C 19 52.445313 18.550781 52 18 52 Z M 23 52 C 22.449219 52 22 52.445313 22 53 L 22 55 C 22 55.554688 22.449219 56 23 56 C 23.550781 56 24 55.554688 24 55 L 24 53 C 24 52.445313 23.550781 52 23 52 Z M 28 52 C 27.449219 52 27 52.445313 27 53 L 27 55 C 27 55.554688 27.449219 56 28 56 C 28.550781 56 29 55.554688 29 55 L 29 53 C 29 52.445313 28.550781 52 28 52 Z M 33 52 C 32.449219 52 32 52.445313 32 53 L 32 55 C 32 55.554688 32.449219 56 33 56 C 33.550781 56 34 55.554688 34 55 L 34 53 C 34 52.445313 33.550781 52 33 52 Z M 38 52 C 37.449219 52 37 52.445313 37 53 L 37 55 C 37 55.554688 37.449219 56 38 56 C 38.550781 56 39 55.554688 39 55 L 39 53 C 39 52.445313 38.550781 52 38 52 Z M 43 52 C 42.449219 52 42 52.445313 42 53 L 42 55 C 42 55.554688 42.449219 56 43 56 C 43.550781 56 44 55.554688 44 55 L 44 53 C 44 52.445313 43.550781 52 43 52 Z M 48 52 C 47.449219 52 47 52.445313 47 53 L 47 55 C 47 55.554688 47.449219 56 48 56 C 48.550781 56 49 55.554688 49 55 L 49 53 C 49 52.445313 48.550781 52 48 52 Z "})})),x5=D(n.jsx("g",{children:n.jsx("path",{d:"M 23.65625 4 C 22.320313 4 21.0625 4.519531 20.121094 5.464844 L 11.464844 14.121094 C 10.519531 15.066406 10 16.320313 10 17.65625 L 10 57 C 10 58.652344 11.347656 60 13 60 L 53 60 C 54.652344 60 56 58.652344 56 57 L 56 7 C 56 5.347656 54.652344 4 53 4 Z M 24 6 L 53 6 C 53.550781 6 54 6.449219 54 7 L 54 57 C 54 57.550781 53.550781 58 53 58 L 13 58 C 12.449219 58 12 57.550781 12 57 L 12 18 L 21 18 C 22.652344 18 24 16.652344 24 15 Z M 22 6.5 L 22 15 C 22 15.550781 21.550781 16 21 16 L 12.5 16 C 12.613281 15.835938 12.738281 15.675781 12.878906 15.535156 L 21.535156 6.878906 C 21.679688 6.734375 21.835938 6.609375 22 6.5 Z M 28.023438 21.816406 C 27.671875 21.808594 27.316406 21.890625 26.996094 22.0625 C 26.355469 22.417969 25.964844 23.085938 25.964844 23.816406 L 25.964844 42.183594 C 25.964844 42.910156 26.355469 43.582031 26.996094 43.933594 C 27.296875 44.097656 27.632813 44.183594 27.964844 44.183594 C 28.335938 44.183594 28.707031 44.078125 29.03125 43.871094 L 43.53125 34.6875 C 44.113281 34.320313 44.464844 33.6875 44.464844 33 C 44.464844 32.308594 44.113281 31.679688 43.53125 31.3125 L 29.03125 22.125 C 28.722656 21.933594 28.375 21.828125 28.023438 21.816406 Z M 27.964844 23.816406 L 42.464844 33 L 27.964844 42.1875 Z M 15 52 C 14.449219 52 14 52.449219 14 53 L 14 55 C 14 55.550781 14.449219 56 15 56 C 15.550781 56 16 55.550781 16 55 L 16 53 C 16 52.449219 15.550781 52 15 52 Z M 20 52 C 19.449219 52 19 52.449219 19 53 L 19 55 C 19 55.550781 19.449219 56 20 56 C 20.550781 56 21 55.550781 21 55 L 21 53 C 21 52.449219 20.550781 52 20 52 Z M 25 52 C 24.449219 52 24 52.449219 24 53 L 24 55 C 24 55.550781 24.449219 56 25 56 C 25.550781 56 26 55.550781 26 55 L 26 53 C 26 52.449219 25.550781 52 25 52 Z M 30 52 C 29.449219 52 29 52.449219 29 53 L 29 55 C 29 55.550781 29.449219 56 30 56 C 30.550781 56 31 55.550781 31 55 L 31 53 C 31 52.449219 30.550781 52 30 52 Z M 35 52 C 34.449219 52 34 52.449219 34 53 L 34 55 C 34 55.550781 34.449219 56 35 56 C 35.550781 56 36 55.550781 36 55 L 36 53 C 36 52.449219 35.550781 52 35 52 Z M 40 52 C 39.449219 52 39 52.449219 39 53 L 39 55 C 39 55.550781 39.449219 56 40 56 C 40.550781 56 41 55.550781 41 55 L 41 53 C 41 52.449219 40.550781 52 40 52 Z M 45 52 C 44.449219 52 44 52.449219 44 53 L 44 55 C 44 55.550781 44.449219 56 45 56 C 45.550781 56 46 55.550781 46 55 L 46 53 C 46 52.449219 45.550781 52 45 52 Z M 50 52 C 49.449219 52 49 52.449219 49 53 L 49 55 C 49 55.550781 49.449219 56 50 56 C 50.550781 56 51 55.550781 51 55 L 51 53 C 51 52.449219 50.550781 52 50 52 Z "})})),j5=D(n.jsx("g",{children:n.jsx("path",{d:"M 17.660156 4 C 16.320313 4 15.058594 4.519531 14.121094 5.460938 L 5.460938 14.121094 C 4.519531 15.070313 4 16.320313 4 17.660156 L 4 57 C 4 58.648438 5.351563 60 7 60 L 47 60 C 48.648438 60 50 58.648438 50 57 L 50 46 L 58 46 C 59.101563 46 60 45.101563 60 44 L 60 24 C 60 22.898438 59.101563 22 58 22 L 50 22 L 50 7 C 50 5.351563 48.648438 4 47 4 Z M 18 6 L 47 6 C 47.550781 6 48 6.449219 48 7 L 48 22 L 16 22 C 14.898438 22 14 22.898438 14 24 L 14 44 C 14 45.101563 14.898438 46 16 46 L 48 46 L 48 57 C 48 57.550781 47.550781 58 47 58 L 7 58 C 6.449219 58 6 57.550781 6 57 L 6 18 L 15 18 C 16.652344 18 18 16.652344 18 15 Z M 16 6.5 L 16 15 C 16 15.550781 15.550781 16 15 16 L 6.5 16 C 6.613281 15.835938 6.738281 15.679688 6.882813 15.539063 L 15.539063 6.882813 C 15.679688 6.738281 15.835938 6.609375 16 6.5 Z M 16 24 L 58 24 L 58 44 L 16 44 Z M 24 28 C 23.449219 28 23 28.445313 23 29 C 23 29.554688 23.449219 30 24 30 L 26 30 L 26 39 C 26 39.554688 26.449219 40 27 40 C 27.550781 40 28 39.554688 28 39 L 28 30 L 30 30 C 30.550781 30 31 29.554688 31 29 C 31 28.445313 30.550781 28 30 28 Z M 44 28 C 43.449219 28 43 28.445313 43 29 C 43 29.554688 43.449219 30 44 30 L 46 30 L 46 39 C 46 39.554688 46.449219 40 47 40 C 47.550781 40 48 39.554688 48 39 L 48 30 L 50 30 C 50.550781 30 51 29.554688 51 29 C 51 28.445313 50.550781 28 50 28 Z M 33.859375 28.011719 C 33.730469 28.027344 33.601563 28.070313 33.484375 28.140625 C 33.011719 28.425781 32.859375 29.039063 33.140625 29.515625 L 35.832031 34 L 33.140625 38.484375 C 32.859375 38.957031 33.011719 39.574219 33.484375 39.859375 C 33.644531 39.953125 33.824219 40 34 40 C 34.339844 40 34.671875 39.828125 34.859375 39.515625 L 37 35.941406 L 39.140625 39.515625 C 39.328125 39.828125 39.660156 40 40 40 C 40.175781 40 40.355469 39.953125 40.515625 39.859375 C 40.988281 39.574219 41.140625 38.957031 40.859375 38.484375 L 38.167969 34 L 40.859375 29.515625 C 41.140625 29.042969 40.988281 28.425781 40.515625 28.140625 C 40.042969 27.859375 39.425781 28.011719 39.140625 28.484375 L 37 32.058594 L 34.859375 28.484375 C 34.644531 28.128906 34.246094 27.957031 33.859375 28.011719 Z M 9 52 C 8.449219 52 8 52.445313 8 53 L 8 55 C 8 55.554688 8.449219 56 9 56 C 9.550781 56 10 55.554688 10 55 L 10 53 C 10 52.445313 9.550781 52 9 52 Z M 14 52 C 13.449219 52 13 52.445313 13 53 L 13 55 C 13 55.554688 13.449219 56 14 56 C 14.550781 56 15 55.554688 15 55 L 15 53 C 15 52.445313 14.550781 52 14 52 Z M 19 52 C 18.449219 52 18 52.445313 18 53 L 18 55 C 18 55.554688 18.449219 56 19 56 C 19.550781 56 20 55.554688 20 55 L 20 53 C 20 52.445313 19.550781 52 19 52 Z M 24 52 C 23.449219 52 23 52.445313 23 53 L 23 55 C 23 55.554688 23.449219 56 24 56 C 24.550781 56 25 55.554688 25 55 L 25 53 C 25 52.445313 24.550781 52 24 52 Z M 29 52 C 28.449219 52 28 52.445313 28 53 L 28 55 C 28 55.554688 28.449219 56 29 56 C 29.550781 56 30 55.554688 30 55 L 30 53 C 30 52.445313 29.550781 52 29 52 Z M 34 52 C 33.449219 52 33 52.445313 33 53 L 33 55 C 33 55.554688 33.449219 56 34 56 C 34.550781 56 35 55.554688 35 55 L 35 53 C 35 52.445313 34.550781 52 34 52 Z M 39 52 C 38.449219 52 38 52.445313 38 53 L 38 55 C 38 55.554688 38.449219 56 39 56 C 39.550781 56 40 55.554688 40 55 L 40 53 C 40 52.445313 39.550781 52 39 52 Z M 44 52 C 43.449219 52 43 52.445313 43 53 L 43 55 C 43 55.554688 43.449219 56 44 56 C 44.550781 56 45 55.554688 45 55 L 45 53 C 45 52.445313 44.550781 52 44 52 Z "})})),b5=D(n.jsx("g",{children:n.jsx("path",{d:"M 17.65625 4 C 16.320313 4 15.066406 4.519531 14.121094 5.464844 L 5.464844 14.121094 C 4.519531 15.066406 4 16.320313 4 17.65625 L 4 57 C 4 58.652344 5.347656 60 7 60 L 47 60 C 48.652344 60 50 58.652344 50 57 L 50 46 L 58 46 C 59.101563 46 60 45.101563 60 44 L 60 24 C 60 22.898438 59.101563 22 58 22 L 50 22 L 50 7 C 50 5.347656 48.652344 4 47 4 Z M 18 6 L 47 6 C 47.550781 6 48 6.449219 48 7 L 48 22 L 16 22 C 14.898438 22 14 22.898438 14 24 L 14 44 C 14 45.101563 14.898438 46 16 46 L 48 46 L 48 57 C 48 57.550781 47.550781 58 47 58 L 7 58 C 6.449219 58 6 57.550781 6 57 L 6 18 L 15 18 C 16.652344 18 18 16.652344 18 15 Z M 16 6.5 L 16 15 C 16 15.550781 15.550781 16 15 16 L 6.5 16 C 6.609375 15.835938 6.734375 15.679688 6.878906 15.535156 L 15.535156 6.878906 C 15.679688 6.734375 15.835938 6.609375 16 6.5 Z M 16 24 L 58 24 L 58 44 L 16 44 Z M 25 28 C 24.445313 28 24 28.449219 24 29 L 24 39 C 24 39.550781 24.445313 40 25 40 C 25.554688 40 26 39.550781 26 39 L 26 36 L 29 36 C 30.652344 36 32 34.652344 32 33 L 32 31 C 32 29.347656 30.652344 28 29 28 Z M 35 28 C 34.445313 28 34 28.449219 34 29 L 34 39 C 34 39.550781 34.445313 40 35 40 L 38 40 C 40.207031 40 42 38.207031 42 36 L 42 32 C 42 29.792969 40.207031 28 38 28 Z M 45 28 C 44.445313 28 44 28.449219 44 29 L 44 39 C 44 39.550781 44.445313 40 45 40 C 45.554688 40 46 39.550781 46 39 L 46 36 L 49 36 C 49.554688 36 50 35.550781 50 35 C 50 34.449219 49.554688 34 49 34 L 46 34 L 46 30 L 50 30 C 50.554688 30 51 29.550781 51 29 C 51 28.449219 50.554688 28 50 28 Z M 26 30 L 29 30 C 29.550781 30 30 30.449219 30 31 L 30 33 C 30 33.550781 29.550781 34 29 34 L 26 34 Z M 36 30 L 38 30 C 39.101563 30 40 30.898438 40 32 L 40 36 C 40 37.101563 39.101563 38 38 38 L 36 38 Z M 9 52 C 8.445313 52 8 52.449219 8 53 L 8 55 C 8 55.550781 8.445313 56 9 56 C 9.554688 56 10 55.550781 10 55 L 10 53 C 10 52.449219 9.554688 52 9 52 Z M 14 52 C 13.445313 52 13 52.449219 13 53 L 13 55 C 13 55.550781 13.445313 56 14 56 C 14.554688 56 15 55.550781 15 55 L 15 53 C 15 52.449219 14.554688 52 14 52 Z M 19 52 C 18.445313 52 18 52.449219 18 53 L 18 55 C 18 55.550781 18.445313 56 19 56 C 19.554688 56 20 55.550781 20 55 L 20 53 C 20 52.449219 19.554688 52 19 52 Z M 24 52 C 23.445313 52 23 52.449219 23 53 L 23 55 C 23 55.550781 23.445313 56 24 56 C 24.554688 56 25 55.550781 25 55 L 25 53 C 25 52.449219 24.554688 52 24 52 Z M 29 52 C 28.445313 52 28 52.449219 28 53 L 28 55 C 28 55.550781 28.445313 56 29 56 C 29.554688 56 30 55.550781 30 55 L 30 53 C 30 52.449219 29.554688 52 29 52 Z M 34 52 C 33.445313 52 33 52.449219 33 53 L 33 55 C 33 55.550781 33.445313 56 34 56 C 34.554688 56 35 55.550781 35 55 L 35 53 C 35 52.449219 34.554688 52 34 52 Z M 39 52 C 38.445313 52 38 52.449219 38 53 L 38 55 C 38 55.550781 38.445313 56 39 56 C 39.554688 56 40 55.550781 40 55 L 40 53 C 40 52.449219 39.554688 52 39 52 Z M 44 52 C 43.445313 52 43 52.449219 43 53 L 43 55 C 43 55.550781 43.445313 56 44 56 C 44.554688 56 45 55.550781 45 55 L 45 53 C 45 52.449219 44.554688 52 44 52 Z "})})),y5=D(n.jsx("g",{children:n.jsx("path",{d:"M 21.65625 4 C 20.320313 4 19.066406 4.519531 18.121094 5.464844 L 9.464844 14.121094 C 8.519531 15.066406 8 16.320313 8 17.65625 L 8 57 C 8 58.652344 9.347656 60 11 60 L 51 60 C 52.652344 60 54 58.652344 54 57 L 54 7 C 54 5.347656 52.652344 4 51 4 Z M 22 6 L 36 6 L 36 27.59375 C 35.144531 27.222656 34.210938 27 33.226563 27 L 32.773438 27 C 31.789063 27 30.859375 27.222656 30 27.59375 L 30 9 C 30 8.449219 29.554688 8 29 8 C 28.449219 8 28 8.449219 28 9 L 28 28.902344 C 27.015625 29.824219 26.277344 31.023438 25.953125 32.425781 L 24.875 37.097656 C 24.597656 38.292969 24.878906 39.53125 25.640625 40.488281 C 26.40625 41.449219 27.546875 42 28.769531 42 L 37.230469 42 C 38.457031 42 39.59375 41.449219 40.359375 40.488281 C 41.121094 39.53125 41.402344 38.292969 41.125 37.097656 L 40.046875 32.425781 C 39.726563 31.023438 38.984375 29.824219 38 28.902344 L 38 6 L 51 6 C 51.550781 6 52 6.449219 52 7 L 52 57 C 52 57.550781 51.550781 58 51 58 L 11 58 C 10.449219 58 10 57.550781 10 57 L 10 18 L 19 18 C 20.652344 18 22 16.652344 22 15 Z M 20 6.5 L 20 15 C 20 15.550781 19.550781 16 19 16 L 10.5 16 C 10.609375 15.835938 10.734375 15.679688 10.878906 15.535156 L 19.535156 6.878906 C 19.679688 6.738281 19.835938 6.609375 20 6.5 Z M 32 8 C 31.449219 8 31 8.445313 31 9 C 31 9.554688 31.449219 10 32 10 L 34 10 C 34.550781 10 35 9.554688 35 9 C 35 8.445313 34.550781 8 34 8 Z M 32 13 C 31.449219 13 31 13.445313 31 14 C 31 14.554688 31.449219 15 32 15 L 34 15 C 34.550781 15 35 14.554688 35 14 C 35 13.445313 34.550781 13 34 13 Z M 32 18 C 31.449219 18 31 18.445313 31 19 C 31 19.554688 31.449219 20 32 20 L 34 20 C 34.550781 20 35 19.554688 35 19 C 35 18.445313 34.550781 18 34 18 Z M 32 23 C 31.449219 23 31 23.445313 31 24 C 31 24.554688 31.449219 25 32 25 L 34 25 C 34.550781 25 35 24.554688 35 24 C 35 23.445313 34.550781 23 34 23 Z M 32.773438 29 L 33.226563 29 C 35.570313 29 37.574219 30.59375 38.097656 32.875 L 39.175781 37.550781 C 39.316406 38.148438 39.175781 38.765625 38.796875 39.246094 C 38.414063 39.722656 37.839844 40 37.230469 40 L 28.769531 40 C 28.160156 40 27.589844 39.722656 27.207031 39.246094 C 26.824219 38.765625 26.683594 38.148438 26.824219 37.550781 L 27.902344 32.875 C 28.429688 30.59375 30.429688 29 32.773438 29 Z M 31 34 C 30.449219 34 30 34.445313 30 35 C 30 35.554688 30.449219 36 31 36 L 35 36 C 35.550781 36 36 35.554688 36 35 C 36 34.445313 35.550781 34 35 34 Z M 13 52 C 12.449219 52 12 52.445313 12 53 C 12 53.554688 12.449219 54 13 54 L 17 54 C 17.550781 54 18 53.554688 18 53 C 18 52.445313 17.550781 52 17 52 Z M 21 52 C 20.449219 52 20 52.445313 20 53 C 20 53.554688 20.449219 54 21 54 L 49 54 C 49.550781 54 50 53.554688 50 53 C 50 52.445313 49.550781 52 49 52 Z "})})),v5=D(n.jsx("g",{children:n.jsx("path",{d:"M 5 10 C 3.300781 10 2 11.300781 2 13 L 2 52 C 2 54.199219 3.800781 56 6 56 L 60 56 C 62.199219 56 64 54.199219 64 52 L 64 23 C 64 21.300781 62.699219 20 61 20 L 58 20 L 58 19 C 58 17.300781 56.699219 16 55 16 L 29.699219 16 C 28.898438 16 28.199219 15.699219 27.597656 15.097656 L 23.902344 11.402344 C 23 10.5 21.699219 10 20.402344 10 Z M 5 12 L 20.402344 12 C 21.199219 12 21.898438 12.300781 22.5 12.902344 L 26.199219 16.597656 C 27.097656 17.5 28.398438 18 29.699219 18 L 55 18 C 55.601563 18 56 18.398438 56 19 L 56 52 C 56 52.601563 56.199219 53.300781 56.597656 54 L 6 54 C 4.898438 54 4 53.101563 4 52 L 4 46 L 45 46 C 45.601563 46 46 45.601563 46 45 C 46 44.398438 45.601563 44 45 44 L 4 44 L 4 13 C 4 12.398438 4.398438 12 5 12 Z M 58 22 L 61 22 C 61.601563 22 62 22.398438 62 23 L 62 52 C 62 53.101563 61.101563 54 60 54 C 58.800781 54 58 52.601563 58 52 Z M 11 24 C 10.398438 24 10 24.398438 10 25 C 10 25.601563 10.398438 26 11 26 L 21 26 C 21.601563 26 22 25.601563 22 25 C 22 24.398438 21.601563 24 21 24 Z M 25 24 C 24.398438 24 24 24.398438 24 25 C 24 25.601563 24.398438 26 25 26 L 31 26 C 31.601563 26 32 25.601563 32 25 C 32 24.398438 31.601563 24 31 24 Z M 11 28 C 10.398438 28 10 28.398438 10 29 C 10 29.601563 10.398438 30 11 30 L 15 30 C 15.601563 30 16 29.601563 16 29 C 16 28.398438 15.601563 28 15 28 Z M 19 28 C 18.398438 28 18 28.398438 18 29 C 18 29.601563 18.398438 30 19 30 L 26 30 C 26.601563 30 27 29.601563 27 29 C 27 28.398438 26.601563 28 26 28 Z M 49 44 C 48.398438 44 48 44.398438 48 45 C 48 45.601563 48.398438 46 49 46 L 53 46 C 53.601563 46 54 45.601563 54 45 C 54 44.398438 53.601563 44 53 44 Z M 7 48 C 6.398438 48 6 48.398438 6 49 L 6 51 C 6 51.601563 6.398438 52 7 52 C 7.601563 52 8 51.601563 8 51 L 8 49 C 8 48.398438 7.601563 48 7 48 Z M 12 48 C 11.398438 48 11 48.398438 11 49 L 11 51 C 11 51.601563 11.398438 52 12 52 C 12.601563 52 13 51.601563 13 51 L 13 49 C 13 48.398438 12.601563 48 12 48 Z M 17 48 C 16.398438 48 16 48.398438 16 49 L 16 51 C 16 51.601563 16.398438 52 17 52 C 17.601563 52 18 51.601563 18 51 L 18 49 C 18 48.398438 17.601563 48 17 48 Z M 22 48 C 21.398438 48 21 48.398438 21 49 L 21 51 C 21 51.601563 21.398438 52 22 52 C 22.601563 52 23 51.601563 23 51 L 23 49 C 23 48.398438 22.601563 48 22 48 Z M 27 48 C 26.398438 48 26 48.398438 26 49 L 26 51 C 26 51.601563 26.398438 52 27 52 C 27.601563 52 28 51.601563 28 51 L 28 49 C 28 48.398438 27.601563 48 27 48 Z M 32 48 C 31.398438 48 31 48.398438 31 49 L 31 51 C 31 51.601563 31.398438 52 32 52 C 32.601563 52 33 51.601563 33 51 L 33 49 C 33 48.398438 32.601563 48 32 48 Z M 37 48 C 36.398438 48 36 48.398438 36 49 L 36 51 C 36 51.601563 36.398438 52 37 52 C 37.601563 52 38 51.601563 38 51 L 38 49 C 38 48.398438 37.601563 48 37 48 Z M 42 48 C 41.398438 48 41 48.398438 41 49 L 41 51 C 41 51.601563 41.398438 52 42 52 C 42.601563 52 43 51.601563 43 51 L 43 49 C 43 48.398438 42.601563 48 42 48 Z M 47 48 C 46.398438 48 46 48.398438 46 49 L 46 51 C 46 51.601563 46.398438 52 47 52 C 47.601563 52 48 51.601563 48 51 L 48 49 C 48 48.398438 47.601563 48 47 48 Z M 52 48 C 51.398438 48 51 48.398438 51 49 L 51 51 C 51 51.601563 51.398438 52 52 52 C 52.601563 52 53 51.601563 53 51 L 53 49 C 53 48.398438 52.601563 48 52 48 Z "})})),C5=D(n.jsx("g",{children:n.jsx("path",{d:"M 21.65625 4 C 20.320313 4 19.066406 4.519531 18.121094 5.464844 L 9.464844 14.121094 C 8.519531 15.066406 8 16.320313 8 17.65625 L 8 57 C 8 58.652344 9.347656 60 11 60 L 51 60 C 52.652344 60 54 58.652344 54 57 L 54 7 C 54 5.347656 52.652344 4 51 4 Z M 22 6 L 51 6 C 51.550781 6 52 6.449219 52 7 L 52 57 C 52 57.550781 51.550781 58 51 58 L 11 58 C 10.449219 58 10 57.550781 10 57 L 10 18 L 19 18 C 20.652344 18 22 16.652344 22 15 Z M 20 6.5 L 20 15 C 20 15.550781 19.550781 16 19 16 L 10.5 16 C 10.605469 15.835938 10.734375 15.679688 10.878906 15.535156 L 19.535156 6.878906 C 19.679688 6.738281 19.835938 6.613281 20 6.5 Z M 20 24 C 17.792969 24 16 25.792969 16 28 C 16 30.207031 17.792969 32 20 32 C 22.207031 32 24 30.207031 24 28 C 24 25.792969 22.207031 24 20 24 Z M 20 25.75 C 21.242188 25.75 22.25 26.757813 22.25 28 C 22.25 29.242188 21.242188 30.25 20 30.25 C 18.757813 30.25 17.75 29.242188 17.75 28 C 17.75 26.757813 18.757813 25.75 20 25.75 Z M 37 30.414063 C 36.488281 30.414063 35.976563 30.609375 35.585938 31 L 29 37.585938 L 26.414063 35 C 25.632813 34.21875 24.363281 34.21875 23.585938 35 L 14.585938 44 L 13.042969 44 C 12.417969 44 12 44.398438 12 45 C 12 45.601563 12.523438 46 13.042969 46 L 48.980469 46 C 49.5 46 50.023438 45.601563 50.023438 45 C 50.023438 44.398438 49.5 44 48.980469 44 L 25.414063 44 L 37 32.414063 L 45.292969 40.707031 C 45.683594 41.097656 46.316406 41.097656 46.707031 40.707031 C 47.097656 40.316406 47.097656 39.683594 46.707031 39.292969 L 38.414063 31 C 38.023438 30.609375 37.511719 30.414063 37 30.414063 Z M 25 36.414063 L 27.585938 39 L 22.585938 44 L 17.414063 44 Z M 13 52 C 12.449219 52 12 52.449219 12 53 L 12 55 C 12 55.550781 12.449219 56 13 56 C 13.550781 56 14 55.550781 14 55 L 14 53 C 14 52.449219 13.550781 52 13 52 Z M 18 52 C 17.449219 52 17 52.449219 17 53 L 17 55 C 17 55.550781 17.449219 56 18 56 C 18.550781 56 19 55.550781 19 55 L 19 53 C 19 52.449219 18.550781 52 18 52 Z M 23 52 C 22.449219 52 22 52.449219 22 53 L 22 55 C 22 55.550781 22.449219 56 23 56 C 23.550781 56 24 55.550781 24 55 L 24 53 C 24 52.449219 23.550781 52 23 52 Z M 28 52 C 27.449219 52 27 52.449219 27 53 L 27 55 C 27 55.550781 27.449219 56 28 56 C 28.550781 56 29 55.550781 29 55 L 29 53 C 29 52.449219 28.550781 52 28 52 Z M 33 52 C 32.449219 52 32 52.449219 32 53 L 32 55 C 32 55.550781 32.449219 56 33 56 C 33.550781 56 34 55.550781 34 55 L 34 53 C 34 52.449219 33.550781 52 33 52 Z M 38 52 C 37.449219 52 37 52.449219 37 53 L 37 55 C 37 55.550781 37.449219 56 38 56 C 38.550781 56 39 55.550781 39 55 L 39 53 C 39 52.449219 38.550781 52 38 52 Z M 43 52 C 42.449219 52 42 52.449219 42 53 L 42 55 C 42 55.550781 42.449219 56 43 56 C 43.550781 56 44 55.550781 44 55 L 44 53 C 44 52.449219 43.550781 52 43 52 Z M 48 52 C 47.449219 52 47 52.449219 47 53 L 47 55 C 47 55.550781 47.449219 56 48 56 C 48.550781 56 49 55.550781 49 55 L 49 53 C 49 52.449219 48.550781 52 48 52 Z "})})),k5=D(n.jsx("g",{children:n.jsx("path",{d:"M 35.136719 2.386719 C 34.917969 2.378906 34.699219 2.390625 34.480469 2.429688 L 5.304688 7.578125 C 3.390625 7.917969 2 9.574219 2 11.515625 L 2 50.484375 C 2 52.429688 3.390625 54.085938 5.304688 54.421875 L 34.480469 59.570313 C 34.652344 59.601563 34.828125 59.613281 35 59.613281 C 35.703125 59.613281 36.382813 59.371094 36.925781 58.914063 C 37.609375 58.34375 38 57.503906 38 56.613281 L 38 52 L 57 52 C 58.652344 52 60 50.652344 60 49 L 60 13 C 60 11.347656 58.652344 10 57 10 L 38 10 L 38 5.382813 C 38 4.496094 37.609375 3.65625 36.925781 3.085938 C 36.417969 2.65625 35.789063 2.414063 35.136719 2.386719 Z M 35.105469 4.390625 C 35.359375 4.414063 35.542969 4.535156 35.640625 4.617188 C 35.777344 4.730469 36 4.980469 36 5.382813 L 36 56.613281 C 36 57.019531 35.777344 57.269531 35.640625 57.382813 C 35.507813 57.496094 35.226563 57.667969 34.828125 57.601563 L 5.652344 52.453125 C 4.695313 52.285156 4 51.457031 4 50.484375 L 4 11.515625 C 4 10.542969 4.695313 9.714844 5.652344 9.546875 L 34.824219 4.398438 C 34.925781 4.382813 35.019531 4.378906 35.105469 4.390625 Z M 38 12 L 57 12 C 57.550781 12 58 12.449219 58 13 L 58 49 C 58 49.550781 57.550781 50 57 50 L 38 50 L 38 45.949219 L 52.949219 45.949219 C 53.5 45.949219 53.949219 45.554688 53.949219 45 C 53.949219 44.445313 53.5 44 52.949219 44 L 50 44 L 50 41 C 50 40.445313 49.550781 40 49 40 L 46 40 L 46 37 C 46 36.445313 45.550781 36 45 36 L 41 36 C 40.449219 36 40 36.445313 40 37 L 40 39 L 38 39 L 38 32.46875 C 39.46875 33.449219 41.203125 34 43 34 C 47.960938 34 52 29.964844 52 25 C 52 20.035156 47.960938 16 43 16 C 41.1875 16 39.464844 16.535156 38 17.519531 Z M 42 18.078125 L 42 24.832031 C 42 25.027344 42.070313 25.203125 42.171875 25.359375 C 42.21875 25.492188 42.289063 25.617188 42.394531 25.726563 L 47.234375 30.5625 C 46.054688 31.460938 44.589844 32 43 32 C 41.113281 32 39.316406 31.230469 38 29.886719 L 38 20.105469 C 39.089844 18.992188 40.484375 18.292969 42 18.078125 Z M 44 18.078125 C 47.386719 18.566406 50 21.480469 50 25 C 50 26.546875 49.488281 27.976563 48.636719 29.136719 L 44 24.5 Z M 15 20 C 14.449219 20 14 20.445313 14 21 L 14 41 C 14 41.554688 14.449219 42 15 42 C 15.550781 42 16 41.554688 16 41 L 16 34 L 21 34 C 23.757813 34 26 31.757813 26 29 L 26 25 C 26 22.242188 23.757813 20 21 20 Z M 16 22 L 21 22 C 22.652344 22 24 23.347656 24 25 L 24 29 C 24 30.652344 22.652344 32 21 32 L 16 32 Z M 42 38 L 44 38 L 44 44 L 42 44 Z M 38 41 L 40 41 L 40 44 L 38 44 Z M 46 42 L 48 42 L 48 44 L 46 44 Z "})})),w5=D(n.jsx("g",{children:n.jsx("path",{d:"M 21.65625 4 C 20.320313 4 19.0625 4.519531 18.121094 5.464844 L 9.464844 14.121094 C 8.519531 15.066406 8 16.320313 8 17.65625 L 8 57 C 8 58.652344 9.347656 60 11 60 L 51 60 C 52.652344 60 54 58.652344 54 57 L 54 7 C 54 5.347656 52.652344 4 51 4 Z M 22 6 L 51 6 C 51.550781 6 52 6.449219 52 7 L 52 57 C 52 57.550781 51.550781 58 51 58 L 11 58 C 10.449219 58 10 57.550781 10 57 L 10 18 L 19 18 C 20.652344 18 22 16.652344 22 15 Z M 20 6.5 L 20 15 C 20 15.550781 19.550781 16 19 16 L 10.5 16 C 10.613281 15.832031 10.738281 15.675781 10.878906 15.535156 L 19.535156 6.878906 C 19.679688 6.734375 19.835938 6.609375 20 6.5 Z M 21.140625 23.011719 C 21.015625 22.992188 20.878906 22.996094 20.746094 23.03125 C 20.210938 23.175781 19.894531 23.722656 20.03125 24.253906 L 25.03125 43.253906 C 25.148438 43.691406 25.539063 43.996094 25.984375 44 L 26 44 C 26.441406 44 26.832031 43.710938 26.957031 43.28125 L 31 29.546875 L 35.042969 43.28125 C 35.167969 43.707031 35.558594 44 36 44 L 36.015625 44 C 36.460938 43.992188 36.851563 43.6875 36.96875 43.253906 L 41.96875 24.253906 C 42.105469 23.722656 41.789063 23.175781 41.253906 23.03125 C 40.71875 22.890625 40.171875 23.210938 40.03125 23.746094 L 35.945313 39.273438 L 31.957031 25.71875 C 31.832031 25.292969 31.445313 25 31 25 C 30.554688 25 30.167969 25.292969 30.042969 25.71875 L 26.054688 39.277344 L 21.96875 23.746094 C 21.863281 23.347656 21.527344 23.066406 21.140625 23.011719 Z M 13 52 C 12.449219 52 12 52.445313 12 53 L 12 55 C 12 55.554688 12.449219 56 13 56 C 13.550781 56 14 55.554688 14 55 L 14 53 C 14 52.445313 13.550781 52 13 52 Z M 18 52 C 17.449219 52 17 52.445313 17 53 L 17 55 C 17 55.554688 17.449219 56 18 56 C 18.550781 56 19 55.554688 19 55 L 19 53 C 19 52.445313 18.550781 52 18 52 Z M 23 52 C 22.449219 52 22 52.445313 22 53 L 22 55 C 22 55.554688 22.449219 56 23 56 C 23.550781 56 24 55.554688 24 55 L 24 53 C 24 52.445313 23.550781 52 23 52 Z M 28 52 C 27.449219 52 27 52.445313 27 53 L 27 55 C 27 55.554688 27.449219 56 28 56 C 28.550781 56 29 55.554688 29 55 L 29 53 C 29 52.445313 28.550781 52 28 52 Z M 33 52 C 32.449219 52 32 52.445313 32 53 L 32 55 C 32 55.554688 32.449219 56 33 56 C 33.550781 56 34 55.554688 34 55 L 34 53 C 34 52.445313 33.550781 52 33 52 Z M 38 52 C 37.449219 52 37 52.445313 37 53 L 37 55 C 37 55.554688 37.449219 56 38 56 C 38.550781 56 39 55.554688 39 55 L 39 53 C 39 52.445313 38.550781 52 38 52 Z M 43 52 C 42.449219 52 42 52.445313 42 53 L 42 55 C 42 55.554688 42.449219 56 43 56 C 43.550781 56 44 55.554688 44 55 L 44 53 C 44 52.445313 43.550781 52 43 52 Z M 48 52 C 47.449219 52 47 52.445313 47 53 L 47 55 C 47 55.554688 47.449219 56 48 56 C 48.550781 56 49 55.554688 49 55 L 49 53 C 49 52.445313 48.550781 52 48 52 Z "})})),S5=D(n.jsx("g",{children:n.jsx("path",{d:"M 35.136719 2.386719 C 34.917969 2.378906 34.699219 2.390625 34.480469 2.429688 L 5.304688 7.578125 C 3.390625 7.917969 2 9.574219 2 11.515625 L 2 50.484375 C 2 52.429688 3.390625 54.085938 5.304688 54.421875 L 34.480469 59.570313 C 34.652344 59.601563 34.828125 59.613281 35 59.613281 C 35.703125 59.613281 36.382813 59.371094 36.925781 58.914063 C 37.609375 58.34375 38 57.503906 38 56.613281 L 38 52 L 57 52 C 58.652344 52 60 50.652344 60 49 L 60 13 C 60 11.347656 58.652344 10 57 10 L 38 10 L 38 5.382813 C 38 4.496094 37.609375 3.65625 36.925781 3.085938 C 36.417969 2.65625 35.789063 2.414063 35.136719 2.386719 Z M 35.105469 4.390625 C 35.359375 4.414063 35.542969 4.535156 35.640625 4.617188 C 35.777344 4.730469 36 4.980469 36 5.382813 L 36 56.613281 C 36 57.019531 35.777344 57.269531 35.640625 57.382813 C 35.507813 57.496094 35.226563 57.671875 34.828125 57.601563 L 5.652344 52.453125 C 4.695313 52.285156 4 51.457031 4 50.484375 L 4 11.515625 C 4 10.542969 4.695313 9.714844 5.652344 9.546875 L 34.824219 4.398438 C 34.925781 4.382813 35.019531 4.378906 35.105469 4.390625 Z M 38 12 L 57 12 C 57.550781 12 58 12.449219 58 13 L 58 49 C 58 49.550781 57.550781 50 57 50 L 38 50 L 38 44 L 41 44 C 41.550781 44 42 43.554688 42 43 C 42 42.445313 41.550781 42 41 42 L 38 42 L 38 38 L 41 38 C 41.550781 38 42 37.554688 42 37 C 42 36.445313 41.550781 36 41 36 L 38 36 L 38 32 L 41 32 C 41.550781 32 42 31.554688 42 31 C 42 30.445313 41.550781 30 41 30 L 38 30 L 38 26 L 41 26 C 41.550781 26 42 25.554688 42 25 C 42 24.445313 41.550781 24 41 24 L 38 24 L 38 20 L 41 20 C 41.550781 20 42 19.554688 42 19 C 42 18.445313 41.550781 18 41 18 L 38 18 Z M 45 18 C 44.449219 18 44 18.445313 44 19 C 44 19.554688 44.449219 20 45 20 L 51 20 C 51.550781 20 52 19.554688 52 19 C 52 18.445313 51.550781 18 51 18 Z M 12.824219 20.015625 C 12.695313 20.039063 12.570313 20.085938 12.453125 20.160156 C 11.992188 20.460938 11.859375 21.082031 12.160156 21.546875 L 18.308594 31 L 12.160156 40.453125 C 11.859375 40.917969 11.992188 41.539063 12.453125 41.839844 C 12.625 41.949219 12.8125 42 13 42 C 13.324219 42 13.648438 41.839844 13.839844 41.546875 L 19.5 32.835938 L 25.160156 41.546875 C 25.351563 41.839844 25.675781 42 26 42 C 26.1875 42 26.375 41.949219 26.546875 41.839844 C 27.007813 41.539063 27.140625 40.917969 26.839844 40.453125 L 20.691406 31 L 26.839844 21.546875 C 27.140625 21.082031 27.007813 20.460938 26.546875 20.160156 C 26.082031 19.859375 25.460938 19.992188 25.160156 20.453125 L 19.5 29.164063 L 13.839844 20.453125 C 13.613281 20.105469 13.207031 19.945313 12.824219 20.015625 Z M 45 24 C 44.449219 24 44 24.445313 44 25 C 44 25.554688 44.449219 26 45 26 L 51 26 C 51.550781 26 52 25.554688 52 25 C 52 24.445313 51.550781 24 51 24 Z M 45 30 C 44.449219 30 44 30.445313 44 31 C 44 31.554688 44.449219 32 45 32 L 51 32 C 51.550781 32 52 31.554688 52 31 C 52 30.445313 51.550781 30 51 30 Z M 45 36 C 44.449219 36 44 36.445313 44 37 C 44 37.554688 44.449219 38 45 38 L 51 38 C 51.550781 38 52 37.554688 52 37 C 52 36.445313 51.550781 36 51 36 Z M 45 42 C 44.449219 42 44 42.445313 44 43 C 44 43.554688 44.449219 44 45 44 L 51 44 C 51.550781 44 52 43.554688 52 43 C 52 42.445313 51.550781 42 51 42 Z "})})),M5=D(n.jsx("g",{children:n.jsx("path",{d:"M 3 8 C 1.347656 8 0 9.347656 0 11 L 0 52 C 0 54.207031 1.792969 56 4 56 L 58 56 C 60.207031 56 62 54.207031 62 52 L 62 21 C 62 19.347656 60.652344 18 59 18 L 56 18 L 56 17 C 56 15.347656 54.652344 14 53 14 L 27.707031 14 C 26.910156 14 26.164063 13.691406 25.597656 13.132813 L 21.875 9.445313 C 20.929688 8.515625 19.679688 8 18.355469 8 Z M 3 10 L 18.355469 10 C 19.152344 10 19.898438 10.308594 20.464844 10.867188 L 24.1875 14.554688 C 25.132813 15.484375 26.382813 16 27.707031 16 L 53 16 C 53.550781 16 54 16.449219 54 17 L 54 52 C 54 52.617188 54.222656 53.339844 54.632813 54 L 4 54 C 2.898438 54 2 53.101563 2 52 L 2 46 L 43 46 C 43.550781 46 44 45.550781 44 45 C 44 44.449219 43.550781 44 43 44 L 2 44 L 2 11 C 2 10.449219 2.449219 10 3 10 Z M 56 20 L 59 20 C 59.550781 20 60 20.449219 60 21 L 60 52 C 60 53.101563 59.101563 54 58 54 C 56.753906 54 56 52.609375 56 52 Z M 27 22 C 24.242188 22 22 24.242188 22 27 L 22 29 C 22 29.992188 22.300781 30.914063 22.800781 31.691406 C 20.058594 32.886719 17.882813 35.527344 17.28125 38.765625 C 17.179688 39.3125 17.539063 39.832031 18.082031 39.933594 C 18.625 40.035156 19.148438 39.675781 19.25 39.132813 C 19.785156 36.242188 21.863281 33.949219 24.371094 33.234375 C 25.136719 33.710938 26.03125 34 27 34 C 27.96875 34 28.863281 33.710938 29.628906 33.234375 C 32.136719 33.949219 34.214844 36.246094 34.75 39.136719 C 34.839844 39.617188 35.261719 39.953125 35.734375 39.953125 C 35.796875 39.953125 35.855469 39.949219 35.917969 39.9375 C 36.460938 39.835938 36.820313 39.3125 36.71875 38.769531 C 36.117188 35.53125 33.941406 32.886719 31.199219 31.691406 C 31.699219 30.914063 32 29.992188 32 29 L 32 27 C 32 24.242188 29.757813 22 27 22 Z M 27 24 C 28.652344 24 30 25.347656 30 27 L 30 29 C 30 30.652344 28.652344 32 27 32 C 25.347656 32 24 30.652344 24 29 L 24 27 C 24 25.347656 25.347656 24 27 24 Z M 47 44 C 46.449219 44 46 44.449219 46 45 C 46 45.550781 46.449219 46 47 46 L 51 46 C 51.550781 46 52 45.550781 52 45 C 52 44.449219 51.550781 44 51 44 Z M 5 48 C 4.449219 48 4 48.449219 4 49 L 4 51 C 4 51.550781 4.449219 52 5 52 C 5.550781 52 6 51.550781 6 51 L 6 49 C 6 48.449219 5.550781 48 5 48 Z M 10 48 C 9.449219 48 9 48.449219 9 49 L 9 51 C 9 51.550781 9.449219 52 10 52 C 10.550781 52 11 51.550781 11 51 L 11 49 C 11 48.449219 10.550781 48 10 48 Z M 15 48 C 14.449219 48 14 48.449219 14 49 L 14 51 C 14 51.550781 14.449219 52 15 52 C 15.550781 52 16 51.550781 16 51 L 16 49 C 16 48.449219 15.550781 48 15 48 Z M 20 48 C 19.449219 48 19 48.449219 19 49 L 19 51 C 19 51.550781 19.449219 52 20 52 C 20.550781 52 21 51.550781 21 51 L 21 49 C 21 48.449219 20.550781 48 20 48 Z M 25 48 C 24.449219 48 24 48.449219 24 49 L 24 51 C 24 51.550781 24.449219 52 25 52 C 25.550781 52 26 51.550781 26 51 L 26 49 C 26 48.449219 25.550781 48 25 48 Z M 30 48 C 29.449219 48 29 48.449219 29 49 L 29 51 C 29 51.550781 29.449219 52 30 52 C 30.550781 52 31 51.550781 31 51 L 31 49 C 31 48.449219 30.550781 48 30 48 Z M 35 48 C 34.449219 48 34 48.449219 34 49 L 34 51 C 34 51.550781 34.449219 52 35 52 C 35.550781 52 36 51.550781 36 51 L 36 49 C 36 48.449219 35.550781 48 35 48 Z M 40 48 C 39.449219 48 39 48.449219 39 49 L 39 51 C 39 51.550781 39.449219 52 40 52 C 40.550781 52 41 51.550781 41 51 L 41 49 C 41 48.449219 40.550781 48 40 48 Z M 45 48 C 44.449219 48 44 48.449219 44 49 L 44 51 C 44 51.550781 44.449219 52 45 52 C 45.550781 52 46 51.550781 46 51 L 46 49 C 46 48.449219 45.550781 48 45 48 Z M 50 48 C 49.449219 48 49 48.449219 49 49 L 49 51 C 49 51.550781 49.449219 52 50 52 C 50.550781 52 51 51.550781 51 51 L 51 49 C 51 48.449219 50.550781 48 50 48 Z "})}));function Dc({type:t,mime:e,className:s}){!t&&e&&(t=e.split("/")[0]);const r=ro[t]||ro.default;return n.jsx(r,{className:T(s,`${t}-file-color`),viewBox:"0 0 64 64"})}const ro={default:f5,audio:g5,video:x5,text:j5,pdf:b5,archive:y5,folder:v5,sharedFolder:M5,image:C5,powerPoint:k5,word:w5,spreadsheet:S5},N5=2*1024*1024;function L5({file:t,className:e,iconClassName:s,showImage:r=!0}){const{trans:i}=P(),{previewUrl:a}=Ft(t,{thumbnail:!0});if(t.file_size&&t.file_size>N5&&!t.thumbnail&&(r=!1),r&&t.type==="image"&&a){const o=i({message:":fileName thumbnail",values:{fileName:t.name}});return n.jsx("img",{className:T(e,"object-cover"),src:a,alt:o,draggable:!1})}return n.jsx(Dc,{className:s,type:t.type})}function T5({entries:t,onClose:e,showHeader:s=!0,className:r,headerActionsLeft:i,allowDownload:a=!0,...o}){const l=oh("(max-width: 1024px)"),[c,u]=Ki(o.activeIndex,o.defaultActiveIndex||0,o.onActiveIndexChange),h=t[c],m=j.useMemo(()=>({entries:t,activeIndex:c}),[t,c]),p=m5(h);if(!h)return e==null||e(),null;const f=t.length-1>c,x=()=>{u(c+1)},b=c>0,y=()=>{u(c-1)};return n.jsxs(ja.Provider,{value:m,children:[s&&n.jsx(A5,{actionsLeft:i,isMobile:l,onClose:e,onNext:f?x:void 0,onPrevious:b?y:void 0,allowDownload:a}),n.jsxs("div",{className:T("overflow-hidden relative flex-auto",r),children:[l&&n.jsx(N,{size:"lg",className:"text-muted absolute left-0 top-1/2 transform -translate-y-1/2 z-10",disabled:!b,onClick:y,children:n.jsx(oa,{})}),n.jsx(xs,{initial:!1,children:n.jsx(js.div,{className:"absolute inset-0 flex items-center justify-center",...gn,children:n.jsx(p,{className:"max-h-[calc(100%-30px)]",entry:h,allowDownload:a})},h.id)}),l&&n.jsx(N,{size:"lg",className:"text-muted absolute right-0 top-1/2 transform -translate-y-1/2 z-10",disabled:!f,onClick:x,children:n.jsx(br,{})})]})]})}function A5({onNext:t,onPrevious:e,onClose:s,isMobile:r,actionsLeft:i,allowDownload:a}){const{entries:o,activeIndex:l}=j.useContext(ja),c=o[l],{downloadUrl:u}=Ft(c),p=r?n.jsx(N,{onClick:()=>{u&&Qn(u)},children:n.jsx(ji,{})}):n.jsx(w,{startIcon:n.jsx(ji,{}),variant:"text",onClick:()=>{u&&Qn(u)},children:n.jsx(d,{message:"Download"})});return n.jsxs("div",{className:"flex items-center justify-between gap-20 bg-paper border-b flex-shrink-0 text-sm min-h-50 px-10 text-muted",children:[n.jsxs("div",{className:"flex items-center gap-4 w-1/3 justify-start",children:[i,a?p:void 0]}),n.jsxs("div",{className:"flex items-center gap-10 w-1/3 justify-center flex-nowrap text-main",children:[n.jsx(L5,{file:c,iconClassName:"w-16 h-16",showImage:!1}),n.jsx("div",{className:"whitespace-nowrap overflow-hidden overflow-ellipsis",children:c.name})]}),n.jsxs("div",{className:"w-1/3 flex items-center gap-10 justify-end whitespace-nowrap",children:[!r&&n.jsxs(j.Fragment,{children:[n.jsx(N,{disabled:!e,onClick:e,children:n.jsx(p5,{})}),n.jsx("div",{children:l+1}),n.jsx("div",{children:"/"}),n.jsx("div",{children:o.length}),n.jsx(N,{disabled:!t,onClick:t,children:n.jsx(Am,{})}),n.jsx("div",{className:"bg-divider w-1 h-24 mx-20"})]}),n.jsx(N,{radius:"rounded-none",onClick:s,children:n.jsx(it,{})})]})]})}function I5(t){return n.jsx(ne,{size:"fullscreenTakeover",background:"bg-alt",className:"flex flex-col",children:n.jsx(E5,{...t})})}function E5(t){const{close:e}=te();return n.jsx(T5,{onClose:e,...t})}const D5={key:"type",label:g("Type"),description:g("Type of the file"),defaultOperator:q.eq,control:{type:V.Select,defaultValue:"05",options:[{key:"02",label:g("Text"),value:"text"},{key:"03",label:g("Audio"),value:"audio"},{key:"04",label:g("Video"),value:"video"},{key:"05",label:g("Image"),value:"image"},{key:"06",label:g("PDF"),value:"pdf"},{key:"07",label:g("Spreadsheet"),value:"spreadsheet"},{key:"08",label:g("Word Document"),value:"word"},{key:"09",label:g("Photoshop"),value:"photoshop"},{key:"10",label:g("Archive"),value:"archive"},{key:"11",label:g("Folder"),value:"folder"}]}},O5=[D5,{key:"public",label:g("Visibility"),description:g("Whether file is publicly accessible"),defaultOperator:q.eq,control:{type:V.Select,defaultValue:"01",options:[{key:"01",label:g("Private"),value:!1},{key:"02",label:g("Public"),value:!0}]}},Be({description:g("Date file was uploaded")}),Ve({description:g("Date file was last changed")}),{key:"owner_id",label:g("Uploader"),description:g("User that this file was uploaded by"),defaultOperator:q.eq,control:{type:V.SelectModel,model:Pt}}],P5=[{key:"name",allowsSorting:!0,visibleInMode:"all",width:"flex-3 min-w-200",header:()=>n.jsx(d,{message:"Name"}),body:t=>n.jsxs(j.Fragment,{children:[n.jsx("div",{className:"overflow-x-hidden overflow-ellipsis",children:t.name}),n.jsx("div",{className:"text-muted text-xs overflow-x-hidden overflow-ellipsis",children:t.file_name})]})},{key:"owner_id",allowsSorting:!0,width:"flex-3 min-w-200",header:()=>n.jsx(d,{message:"Uploader"}),body:t=>{var s;const e=(s=t.users)==null?void 0:s[0];return e?n.jsx(mt,{image:e.avatar,label:e.display_name,description:e.email}):null}},{key:"type",width:"w-100 flex-shrink-0",allowsSorting:!0,header:()=>n.jsx(d,{message:"Type"}),body:t=>n.jsxs("div",{className:"flex items-center gap-12",children:[n.jsx(Dc,{type:t.type,className:"w-24 h-24 overflow-hidden"}),n.jsx("div",{className:"capitalize",children:t.type})]})},{key:"public",allowsSorting:!0,width:"w-60 flex-shrink-0",header:()=>n.jsx(d,{message:"Public"}),body:t=>t.public?n.jsx(Gn,{className:"icon-md text-positive"}):n.jsx(it,{className:"icon-md text-danger"})},{key:"file_size",allowsSorting:!0,maxWidth:"max-w-100",header:()=>n.jsx(d,{message:"File size"}),body:t=>n.jsx(Ec,{bytes:t.file_size})},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>n.jsx(d,{message:"Last updated"}),body:t=>n.jsx(he,{date:t.updated_at})},{key:"actions",header:()=>n.jsx(d,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-42 flex-shrink-0",visibleInMode:"all",body:t=>n.jsxs(z,{type:"modal",children:[n.jsx(N,{size:"md",className:"text-muted",children:n.jsx(t5,{})}),n.jsx(I5,{entries:[t]})]})}];function F5(){return n.jsx(De,{endpoint:"file-entries",title:n.jsx(d,{message:"Uploaded files and folders"}),columns:P5,filters:O5,selectedActions:n.jsx($e,{}),emptyStateMessage:n.jsx(ve,{image:s5,title:n.jsx(d,{message:"Nothing has been uploaded yet"}),filteringTitle:n.jsx(d,{message:"No matching files or folders"})})})}const z5=[{key:"ends_at",label:g("Status"),description:g("Whether subscription is active or cancelled"),defaultOperator:q.eq,control:{type:V.Select,defaultValue:"active",options:[{key:"active",label:g("Active"),value:{value:null,operator:q.eq}},{key:"cancelled",label:g("Cancelled"),value:{value:null,operator:q.ne}}]}},{control:{type:V.Select,defaultValue:"stripe",options:[{key:"stripe",label:g("Stripe"),value:"stripe"},{key:"paypal",label:g("PayPal"),value:"paypal"},{key:"none",label:g("None"),value:"none"}]},key:"gateway_name",label:g("Gateway"),description:g("With which payment provider was subscription created"),defaultOperator:q.eq},da({key:"renews_at",label:g("Renew date"),description:g("Date subscription will renew")}),Be({description:g("Date subscription was created")}),Ve({description:g("Date subscription was last updated")})],R5=""+new URL("subscriptions-7eacea42.svg",import.meta.url).href;function _5(t){const{trans:e}=P();return $(s=>B5(s),{onSuccess:()=>{H(e(g("Subscription updated"))),F.invalidateQueries(ee("billing/subscriptions"))},onError:s=>ge(s,t)})}function B5({id:t,...e}){return O.put(`billing/subscriptions/${t}`,e).then(s=>s.data)}function Oc({form:t,onSubmit:e,formId:s}){var o,l;const r=lh(),i=t.watch("product_id"),a=(o=r.data)==null?void 0:o.products.find(c=>c.id===i);return n.jsxs(ce,{id:s,form:t,onSubmit:e,children:[n.jsx(aa,{name:"user_id",className:"mb-20",modelType:Pt,label:n.jsx(d,{message:"User"}),openMenuOnFocus:!0}),n.jsx(G,{name:"product_id",selectionMode:"single",className:"mb-20",label:n.jsx(d,{message:"Plan"}),children:(l=r.data)==null?void 0:l.products.filter(c=>!c.free).map(c=>n.jsx(v,{value:c.id,children:n.jsx(d,{message:c.name})},c.id))}),!(a!=null&&a.free)&&n.jsx(G,{name:"price_id",selectionMode:"single",className:"mb-20",label:n.jsx(d,{message:"Price"}),children:a==null?void 0:a.prices.map(c=>n.jsx(v,{value:c.id,children:n.jsx(sa,{price:c})},c.id))}),n.jsx(C,{inputElementType:"textarea",rows:3,name:"description",label:n.jsx(d,{message:"Description"}),className:"mb-20"}),n.jsx(gi,{className:"mb-20",name:"renews_at",granularity:"day",label:n.jsx(d,{message:"Renews at"}),description:n.jsx(d,{message:"This will only change local records. User will continue to be billed on their original cycle on the payment gateway."})}),n.jsx(gi,{className:"mb-20",name:"ends_at",granularity:"day",label:n.jsx(d,{message:"Ends at"}),description:n.jsx(d,{message:"This will only change local records. User will continue to be billed on their original cycle on the payment gateway."})})]})}function V5({subscription:t}){const{close:e,formId:s}=te(),r=X({defaultValues:{id:t.id,product_id:t.product_id,price_id:t.price_id,description:t.description,renews_at:t.renews_at,ends_at:t.ends_at,user_id:t.user_id}}),i=_5(r);return n.jsxs(ne,{size:"md",children:[n.jsx(re,{children:n.jsx(d,{message:"Update subscription"})}),n.jsx(ie,{children:n.jsx(Oc,{formId:s,form:r,onSubmit:a=>{i.mutate(a,{onSuccess:()=>{e()}})}})}),n.jsxs(le,{children:[n.jsx(w,{onClick:()=>{e()},children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{form:s,disabled:i.isLoading,variant:"flat",color:"primary",type:"submit",children:n.jsx(d,{message:"Save"})})]})]})}const Pc="billing/subscriptions";function $5(t){const{trans:e}=P();return $(s=>H5(s),{onSuccess:()=>{H(e(g("Subscription created"))),F.invalidateQueries(ee(Pc))},onError:s=>ge(s,t)})}function H5(t){return O.post(Pc,t).then(e=>e.data)}function q5(){const{close:t,formId:e}=te(),s=X({}),r=$5(s);return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Add new subscription"})}),n.jsx(ie,{children:n.jsx(Oc,{formId:e,form:s,onSubmit:i=>{r.mutate(i,{onSuccess:()=>{t()}})}})}),n.jsxs(le,{children:[n.jsx(w,{onClick:()=>{t()},children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{form:e,disabled:r.isLoading,variant:"flat",color:"primary",type:"submit",children:n.jsx(d,{message:"Save"})})]})]})}const U5=D(n.jsx("path",{d:"M10 8.64 15.27 12 10 15.36V8.64M8 5v14l11-7L8 5z"}),"PlayArrowOutlined"),Mr="billing/subscriptions",W5=[{key:"usr_id",allowsSorting:!0,width:"flex-3 min-w-200",visibleInMode:"all",header:()=>n.jsx(d,{message:"Customer"}),body:t=>n.jsx(mt,{image:t.user.avatar,label:t.user.display_name,description:t.user.email})},{key:"status",width:"w-100 flex-shrink-0",header:()=>n.jsx(d,{message:"Status"}),body:t=>t.valid?n.jsx(fi,{size:"xs",color:"positive",radius:"rounded",className:"w-max",children:n.jsx(d,{message:"Active"})}):n.jsx(fi,{size:"xs",radius:"rounded",className:"w-max",children:n.jsx(d,{message:"Cancelled"})})},{key:"product_id",allowsSorting:!0,header:()=>n.jsx(d,{message:"Plan"}),body:t=>{var e;return(e=t.product)==null?void 0:e.name}},{key:"gateway",allowsSorting:!0,header:()=>n.jsx(d,{message:"Gateway"}),body:t=>n.jsx("span",{className:"capitalize",children:t.gateway_name})},{key:"renews_at",allowsSorting:!0,header:()=>n.jsx(d,{message:"Renews at"}),body:t=>n.jsx(he,{date:t.renews_at})},{key:"ends_at",allowsSorting:!0,header:()=>n.jsx(d,{message:"Ends at"}),body:t=>n.jsx(he,{date:t.ends_at})},{key:"created_at",allowsSorting:!0,header:()=>n.jsx(d,{message:"Created at"}),body:t=>n.jsx(he,{date:t.created_at})},{key:"actions",header:()=>n.jsx(d,{message:"Actions"}),hideHeader:!0,align:"end",visibleInMode:"all",width:"w-128 flex-shrink-0",body:t=>n.jsx(J5,{subscription:t})}];function Z5(){return n.jsx(De,{endpoint:Mr,title:n.jsx(d,{message:"Subscriptions"}),columns:W5,filters:z5,actions:n.jsx(K5,{}),enableSelection:!1,selectedActions:n.jsx($e,{}),queryParams:{with:"product"},emptyStateMessage:n.jsx(ve,{image:R5,title:n.jsx(d,{message:"No subscriptions have been created yet"}),filteringTitle:n.jsx(d,{message:"No matching subscriptions"})})})}function K5(){return n.jsx(n.Fragment,{children:n.jsxs(z,{type:"modal",children:[n.jsx(Ze,{children:n.jsx(d,{message:"Add new subscription"})}),n.jsx(q5,{})]})})}function J5({subscription:t}){return n.jsxs(j.Fragment,{children:[n.jsxs(z,{type:"modal",children:[n.jsx(N,{size:"md",className:"text-muted",children:n.jsx(Ee,{})}),n.jsx(V5,{subscription:t})]}),t.cancelled?n.jsx(Q5,{subscription:t}):n.jsx(G5,{subscription:t}),n.jsx(Y5,{subscription:t})]})}function G5({subscription:t}){const e=Wl(),s=()=>{e.mutate({subscriptionId:t.id},{onSuccess:()=>{F.invalidateQueries(ee(Mr))}})};return n.jsxs(z,{type:"modal",onClose:r=>{r&&s()},children:[n.jsx(We,{label:n.jsx(d,{message:"Cancel subscription"}),children:n.jsx(N,{size:"md",className:"text-muted",disabled:e.isLoading,children:n.jsx(Ph,{})})}),n.jsx(lt,{title:n.jsx(d,{message:"Cancel subscription"}),body:n.jsxs("div",{children:[n.jsx(d,{message:"Are you sure you want to cancel this subscription?"}),n.jsx("div",{className:"font-semibold text-sm mt-10",children:n.jsx(d,{message:"This will put user on grace period until their next scheduled renewal date. Subscription can be renewed until that date by user or from admin area."})})]}),confirm:n.jsx(d,{message:"Confirm"})})]})}function Q5({subscription:t}){const e=Im(),s=()=>{e.mutate({subscriptionId:t.id},{onSuccess:()=>{F.invalidateQueries(ee(Mr))}})};return n.jsxs(z,{type:"modal",onClose:r=>{r&&s()},children:[n.jsx(We,{label:n.jsx(d,{message:"Renew subscription"}),children:n.jsx(N,{size:"md",className:"text-muted",onClick:s,disabled:e.isLoading,children:n.jsx(U5,{})})}),n.jsx(lt,{title:n.jsx(d,{message:"Resume subscription"}),body:n.jsxs("div",{children:[n.jsx(d,{message:"Are you sure you want to resume this subscription?"}),n.jsx("div",{className:"font-semibold text-sm mt-10",children:n.jsx(d,{message:"This will put user on their original plan and billing cycle."})})]}),confirm:n.jsx(d,{message:"Confirm"})})]})}function Y5({subscription:t}){const e=Wl(),s=()=>{e.mutate({subscriptionId:t.id,delete:!0},{onSuccess:()=>{F.invalidateQueries(ee(Mr))}})};return n.jsxs(z,{type:"modal",onClose:r=>{r&&s()},children:[n.jsx(We,{label:n.jsx(d,{message:"Delete subscription"}),children:n.jsx(N,{size:"md",className:"text-muted",disabled:e.isLoading,children:n.jsx(it,{})})}),n.jsx(lt,{isDanger:!0,title:n.jsx(d,{message:"Delete subscription"}),body:n.jsxs("div",{children:[n.jsx(d,{message:"Are you sure you want to delete this subscription?"}),n.jsx("div",{className:"font-semibold text-sm mt-10",children:n.jsx(d,{message:"This will permanently delete the subscription and immediately cancel it on billing gateway. Subscription will not be renewable anymore."})})]}),confirm:n.jsx(d,{message:"Confirm"})})]})}const X5=D(n.jsx("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"}),"SyncOutlined");function e4(){const{trans:t}=P();return $(()=>t4(),{onSuccess:()=>{H(t(g("Plans synced")))},onError:e=>oe(e,g("Could not sync plans"))})}function t4(){return O.post("billing/products/sync").then(t=>t.data)}const s4=t=>`billing/products/${t}`;function n4(){const{trans:t}=P();return $(e=>r4(e),{onSuccess:()=>{H(t(g("Plan deleted"))),F.invalidateQueries(ee("billing/products"))},onError:e=>oe(e)})}function r4({productId:t}){return O.delete(s4(t)).then(e=>e.data)}const i4=[{key:"subscriptions",label:g("Subscriptions"),description:g("Whether plan has any active subscriptions"),defaultOperator:q.eq,control:{type:V.Select,defaultValue:"01",options:[{key:"01",label:g("Has active subscriptions"),value:{value:"*",operator:q.has}},{key:"02",label:g("Does not have active subscriptions"),value:{value:"*",operator:q.doesntHave}}]}},Be({description:g("Date plan was created")}),Ve({description:g("Date plan was last updated")})],a4=[{key:"name",allowsSorting:!0,visibleInMode:"all",header:()=>n.jsx(d,{message:"Name"}),body:t=>{const e=t.prices[0];return n.jsx(mt,{label:t.name,description:t.free?n.jsx(d,{message:"Free"}):n.jsx(sa,{price:e})})}},{key:"created_at",allowsSorting:!0,maxWidth:"max-w-100",header:()=>n.jsx(d,{message:"Created"}),body:t=>n.jsx(he,{date:t.created_at})},{key:"updated_at",allowsSorting:!0,maxWidth:"max-w-100",header:()=>n.jsx(d,{message:"Last updated"}),body:t=>n.jsx(he,{date:t.updated_at})},{key:"actions",header:()=>n.jsx(d,{message:"Actions"}),visibleInMode:"all",hideHeader:!0,align:"end",maxWidth:"max-w-84",body:t=>n.jsxs(j.Fragment,{children:[n.jsx(N,{size:"md",className:"text-muted",elementType:Y,to:`/admin/plans/${t.id}/edit`,children:n.jsx(Ee,{})}),n.jsx(l4,{product:t})]})}];function o4(){const t=xe();return n.jsx(De,{endpoint:"billing/products",title:n.jsx(d,{message:"Subscription plans"}),columns:a4,actions:n.jsx(c4,{}),enableSelection:!1,filters:i4,onRowAction:e=>{t(`/admin/plans/${e.id}/edit`)},emptyStateMessage:n.jsx(ve,{image:Ac,title:n.jsx(d,{message:"No plans have been created yet"}),filteringTitle:n.jsx(d,{message:"No matching plans"})})})}function l4({product:t}){const e=n4();return n.jsxs(z,{type:"modal",onClose:s=>{s&&e.mutate({productId:t.id})},children:[n.jsx(We,{label:n.jsx(d,{message:"Delete plan"}),children:n.jsx(N,{size:"md",className:"text-muted",disabled:e.isLoading,children:n.jsx(Sr,{})})}),n.jsx(lt,{title:n.jsx(d,{message:"Delete plan"}),body:n.jsx(d,{message:"Are you sure you want to delete this plan?"}),confirm:n.jsx(d,{message:"Delete"})})]})}function c4(){const t=e4();return n.jsxs(j.Fragment,{children:[n.jsx(We,{label:n.jsx(d,{message:"Sync plans with Stripe & PayPal"}),children:n.jsx(N,{color:"primary",variant:"outline",radius:"rounded",size:"sm",disabled:t.isLoading,onClick:()=>{t.mutate()},children:n.jsx(X5,{})})}),n.jsx(Ze,{elementType:Y,to:"/admin/plans/new",children:n.jsx(d,{message:"Add new plan"})})]})}const Fc=t=>`billing/products/${t}`;function d4(){const{productId:t}=_e();return Xt([Fc(t)],()=>u4(t))}function u4(t){return O.get(Fc(t)).then(e=>e.data)}const Si=[{key:"day1",label:g("Daily"),interval:"day",interval_count:1},{key:"week1",label:g("Weekly"),interval:"week",interval_count:1},{key:"month1",label:g("Monthly"),interval:"month",interval_count:1},{key:"month3",label:g("Every 3 months"),interval:"month",interval_count:3},{key:"month6",label:g("Every 6 months"),interval:"month",interval_count:6},{key:"year1",label:g("Yearly"),interval:"year",interval_count:1},{key:"custom",label:g("Custom"),interval:null,interval_count:null}];function h4({index:t,onRemovePrice:e}){const{trans:s}=P(),r=gt(["currencies"]),i=j.useMemo(()=>{var f;return(f=r.data)!=null&&f.currencies?Object.values(r.data.currencies):[]},[r.data]),{watch:a,getValues:o}=I(),l=!a("id"),c=a(`prices.${t}.id`)==null,u=a(`prices.${t}.subscriptions_count`)||0,[h,m]=j.useState(()=>{const f=o(`prices.${t}.interval`),x=o(`prices.${t}.interval_count`),b=Si.find(y=>y.key===`${f}${x}`);return b?b.key:"custom"}),p=l||c||!u;return n.jsxs(j.Fragment,{children:[!p&&n.jsx("p",{className:"text-muted text-sm max-w-500 mb-20",children:n.jsx(d,{message:"This price can't modified or deleted, because it has [one 1 subscriber|other :count subscribers]. You can instead add a new price.",values:{count:u}})}),n.jsx(C,{required:!0,disabled:!p,label:n.jsx(d,{message:"Amount"}),type:"number",min:.1,step:.01,name:`prices.${t}.amount`,className:"mb-20"}),n.jsx(G,{required:!0,disabled:!p,label:n.jsx(d,{message:"Currency"}),name:`prices.${t}.currency`,items:i,showSearchField:!0,searchPlaceholder:s(g("Search currencies")),selectionMode:"single",className:"mb-20",children:f=>n.jsx(v,{value:f.code,children:`${f.code}: ${f.name}`},f.code)}),n.jsx(m4,{disabled:!p,index:t,value:h,onValueChange:m}),h==="custom"&&n.jsx(p4,{disabled:!p,index:t}),n.jsx("div",{className:"text-right",children:n.jsx(w,{size:"xs",variant:"outline",color:"danger",disabled:!p,onClick:()=>{e()},children:n.jsx(d,{message:"Delete price"})})})]})}function m4({index:t,value:e,onValueChange:s,disabled:r}){const{setValue:i}=I();return n.jsx(Mn,{label:n.jsx(d,{message:"Billing period"}),disabled:r,className:"mb-20",selectionMode:"single",selectedValue:e,onSelectionChange:a=>{if(s(a),a!=="custom"){const o=Si.find(l=>l.key===a);o&&(i(`prices.${t}.interval`,o.interval),i(`prices.${t}.interval_count`,o.interval_count))}},children:Si.map(a=>n.jsx(v,{value:a.key,children:n.jsx(d,{...a.label})},a.key))})}function p4({index:t,disabled:e}){const{watch:s}=I(),r=s(`prices.${t}.interval`);let i;return r==="day"?i=365:r==="week"?i=52:i=12,n.jsxs("div",{className:"flex border rounded w-min",children:[n.jsx("div",{className:"px-18 flex items-center text-sm",children:n.jsx(d,{message:"Every"})}),n.jsx(C,{inputShadow:"shadow-none",inputBorder:"border-none",className:"border-l border-r w-80",name:`prices.${t}.interval_count`,type:"number",min:1,max:i,disabled:e,required:!0}),n.jsxs(G,{inputShadow:"shadow-none",inputBorder:"border-none",name:`prices.${t}.interval`,selectionMode:"single",disabled:e,children:[n.jsx(v,{value:"day",children:n.jsx(d,{message:"Days"})}),n.jsx(v,{value:"week",children:n.jsx(d,{message:"Weeks"})}),n.jsx(v,{value:"month",children:n.jsx(d,{message:"Months"})})]})]})}function zc(){return n.jsxs(j.Fragment,{children:[n.jsx(C,{name:"name",label:n.jsx(d,{message:"Name"}),className:"mb-20",required:!0,autoFocus:!0}),n.jsx(C,{name:"description",label:n.jsx(d,{message:"Description"}),className:"mb-20",inputElementType:"textarea",rows:4}),n.jsxs(G,{name:"position",selectionMode:"single",label:n.jsx(d,{message:"Position in pricing table"}),className:"mb-20",children:[n.jsx(v,{value:0,children:n.jsx(d,{message:"First"})}),n.jsx(v,{value:1,children:n.jsx(d,{message:"Second"})}),n.jsx(v,{value:2,children:n.jsx(d,{message:"Third"})}),n.jsx(v,{value:3,children:n.jsx(d,{message:"Fourth"})}),n.jsx(v,{value:4,children:n.jsx(d,{message:"Fifth"})})]}),n.jsx(un,{className:"mb-30",name:"available_space",label:n.jsx(d,{message:"Allowed storage space"}),description:n.jsx(d,{values:{a:t=>n.jsx(Y,{className:Qs,target:"_blank",to:"/admin/settings/uploading",children:t})},message:"Total storage space all user uploads are allowed to take up."})}),n.jsx(E,{name:"recommended",className:"mb-20",description:n.jsx(d,{message:"Plan will be displayed more prominently on pricing page."}),children:n.jsx(d,{message:"Recommend"})}),n.jsx(E,{name:"hidden",className:"mb-20",description:n.jsx(d,{message:"Plan will not be shown on pricing or upgrade pages."}),children:n.jsx(d,{message:"Hidden"})}),n.jsx(E,{name:"free",className:"mb-20",description:n.jsx(d,{message:"Will be assigned to all users, if they are not subscribed already."}),children:n.jsx(d,{message:"Free"})}),n.jsx(Mi,{children:n.jsx(d,{message:"Feature list"})}),n.jsx(f4,{}),n.jsx(g4,{}),n.jsx(Mi,{children:n.jsx(d,{message:"Permissions"})}),n.jsx(ha,{name:"permissions"})]})}function Mi({children:t}){return n.jsx("h2",{className:"mt-40 mb-20 text-base font-semibold",children:t})}function f4(){const{fields:t,append:e,remove:s}=Qe({name:"feature_list"});return n.jsxs("div",{children:[t.map((r,i)=>n.jsxs("div",{className:"flex gap-10 mb-10",children:[n.jsx(C,{name:`feature_list.${i}.value`,size:"sm",className:"flex-auto"}),n.jsx(N,{size:"sm",color:"primary",className:"flex-shrink-0",onClick:()=>{s(i)},children:n.jsx(it,{})})]},r.id)),n.jsx(w,{variant:"text",color:"primary",startIcon:n.jsx(at,{}),size:"xs",onClick:()=>{e({value:""})},children:n.jsx(d,{message:"Add another line"})})]})}function g4(){var a;const{watch:t,formState:{errors:e}}=I(),{fields:s,append:r,remove:i}=Qe({name:"prices",keyName:"key"});return t("free")?null:n.jsxs(j.Fragment,{children:[n.jsx(Mi,{children:n.jsx(d,{message:"Pricing"})}),((a=e.prices)==null?void 0:a.message)&&n.jsx("div",{className:"text-sm text-danger mb-20",children:e.prices.message}),n.jsx(ss,{variant:"outline",className:"mb-10",children:s.map((o,l)=>n.jsx(nt,{label:n.jsx(sa,{price:o}),children:n.jsx(h4,{index:l,onRemovePrice:()=>{i(l)}})},o.key))}),n.jsx(w,{variant:"text",color:"primary",startIcon:n.jsx(at,{}),size:"xs",onClick:()=>{r({currency:"USD",amount:1,interval_count:1,interval:"month"})},children:n.jsx(d,{message:"Add another price"})})]})}const Rc=t=>`billing/products/${t}`;function x4(t){const{trans:e}=P(),s=xe();return $(r=>j4(r),{onSuccess:r=>{H(e(g("Plan updated"))),F.invalidateQueries([Rc(r.product.id)]),F.invalidateQueries(ee("billing/products")),s("/admin/plans")},onError:r=>ge(r,t)})}function j4({id:t,...e}){const s={...e,feature_list:e.feature_list.map(r=>r.value)};return O.put(Rc(t),s).then(r=>r.data)}function b4(){const t=d4();return t.status!=="success"?n.jsx(es,{}):n.jsx(y4,{product:t.data.product})}function y4({product:t}){const e=X({defaultValues:{...t,feature_list:t.feature_list.map(r=>({value:r}))}}),s=x4(e);return n.jsx(ts,{form:e,onSubmit:r=>{s.mutate(r)},title:n.jsx(d,{message:"Edit “:name“ plan",values:{name:t.name}}),isLoading:s.isLoading,children:n.jsx(zc,{})})}const _c="billing/products";function v4(t){const{trans:e}=P(),s=xe();return $(r=>C4(r),{onSuccess:()=>{H(e(g("Plan created"))),F.invalidateQueries([_c]),F.invalidateQueries(ee("billing/products")),s("/admin/plans")},onError:r=>ge(r,t)})}function C4(t){const e={...t,feature_list:t.feature_list.map(s=>s.value)};return O.post(_c,e).then(s=>s.data)}function k4(){const t=X({defaultValues:{free:!1,recommended:!1}}),e=v4(t);return n.jsx(ts,{form:t,onSubmit:s=>{e.mutate(s)},title:n.jsx(d,{message:"Create new plan"}),isLoading:e.isLoading,children:n.jsx(zc,{})})}function w4(){return n.jsxs(He,{title:n.jsx(d,{message:"GDPR"}),description:n.jsx(d,{message:"Configure settings related to EU General Data Protection Regulation."}),children:[n.jsx(S4,{}),n.jsx(It,{}),n.jsx(M4,{})]})}function S4(){const{watch:t}=I(),e=t("client.cookie_notice.enable");return n.jsxs("div",{children:[n.jsx(E,{name:"client.cookie_notice.enable",className:"mb-20",description:n.jsx(d,{message:"Whether cookie notice should be shown automatically to users from EU until it is accepted."}),children:n.jsx(d,{message:"Enable cookie notice"})}),e&&n.jsxs(j.Fragment,{children:[n.jsxs("div",{className:"border-b pb-6 mb-20",children:[n.jsx("div",{className:"text-sm font-medium border-b pb-10 mb-20",children:n.jsx(d,{message:"Information button"})}),n.jsx(Ds,{hideRoleAndPermissionFields:!0,formPathPrefix:"client.cookie_notice.button"})]}),n.jsxs(G,{name:"client.cookie_notice.position",selectionMode:"single",label:n.jsx(d,{message:"Cookie notice position"}),className:"mb-20",children:[n.jsx(v,{value:"top",children:n.jsx(d,{message:"Top"})}),n.jsx(v,{value:"bottom",children:n.jsx(d,{message:"Bottom"})})]})]})]})}function M4(){const{fields:t,append:e,remove:s}=Qe({name:"client.registration.policies"});return n.jsxs(j.Fragment,{children:[n.jsx("div",{className:"mb-6 text-sm",children:n.jsx(d,{message:"Registration policies"})}),n.jsx("div",{className:"text-xs text-muted",children:n.jsx(d,{message:"Create policies that will be shown on registration page. User will be required to accept them by toggling a checkbox."})}),n.jsx(ss,{className:"mt-16",variant:"outline",children:t.map((r,i)=>n.jsx(nt,{label:r.label,chevronPosition:"left",endAppend:n.jsx(N,{radius:"rounded",variant:"text",color:"danger",size:"sm",onClick:()=>{s(i)},children:n.jsx(it,{})}),children:n.jsx(Ds,{hideRoleAndPermissionFields:!0,formPathPrefix:`client.register_policies.${i}`})},r.id))}),n.jsxs(z,{type:"modal",onClose:r=>{r&&e(r)},children:[n.jsx(w,{className:"mt-12",variant:"link",color:"primary",startIcon:n.jsx(at,{}),size:"xs",children:n.jsx(d,{message:"Add another policy"})}),n.jsx(bc,{title:n.jsx(d,{message:"Add policy"})})]})]})}const ba=""+new URL("playlist-9920c7a8.svg",import.meta.url).href,N4=[{key:"name",allowsSorting:!0,width:"flex-3",visibleInMode:"all",header:()=>n.jsx(d,{message:"Name"}),body:t=>t.config.connectToGenreViaUrl?t.name:n.jsx("a",{className:"hover:underline focus-visible:underline outline-none",href:`channel/${t.slug}`,target:"_blank",rel:"noreferrer",children:t.name})},{key:"content_type",allowsSorting:!1,header:()=>n.jsx(d,{message:"Content type"}),body:t=>n.jsx("span",{className:"capitalize",children:t.config.contentModel?n.jsx(d,{message:t.config.contentModel}):void 0})},{key:"layout",allowsSorting:!1,header:()=>n.jsx(d,{message:"Layout"}),body:t=>n.jsx("span",{className:"capitalize",children:t.config.layout?n.jsx(d,{message:t.config.layout}):void 0})},{key:"auto_update",allowsSorting:!1,header:()=>n.jsx(d,{message:"Auto update"}),body:t=>n.jsx("span",{className:"capitalize",children:t.config.autoUpdateMethod})},{key:"updated_at",allowsSorting:!0,maxWidth:"max-w-100",header:()=>n.jsx(d,{message:"Last updated"}),body:t=>t.updated_at?n.jsx(he,{date:t.updated_at}):""},{key:"actions",header:()=>n.jsx(d,{message:"Actions"}),hideHeader:!0,visibleInMode:"all",align:"end",width:"w-42 flex-shrink-0",body:t=>n.jsx(Y,{to:`${t.id}/edit`,className:"text-muted",children:n.jsx(N,{size:"md",children:n.jsx(Ee,{})})})}];function L4(){return n.jsx(De,{endpoint:"channel",title:n.jsx(d,{message:"Channels"}),headerContent:n.jsx(T4,{}),columns:N4,actions:n.jsx(A4,{}),selectedActions:n.jsx($e,{}),emptyStateMessage:n.jsx(ve,{image:ba,title:n.jsx(d,{message:"No channels have been created yet"}),filteringTitle:n.jsx(d,{message:"No matching channels"})})})}function T4(){return n.jsx(Fl,{title:n.jsx(d,{message:"Channels"}),body:n.jsx(d,{message:"Channels are used to display either all content of specific type or manually selected content. They can be shown as separate page or nested."})})}function A4(){return n.jsx(Ze,{elementType:Y,to:"new",children:n.jsx(d,{message:"Add new channel"})})}function Bc({host:t,value:e="",placeholder:s,onChange:r,className:i,inputRef:a,onInputBlur:o,showLinkIcon:l=!0,pattern:c,minLength:u,maxLength:h,hideButton:m,...p}){const{base_url:f}=fe(),x=p.prefix?`/${p.prefix}`:"",b=p.suffix?`/${p.suffix}`:"",[y,k]=j.useState(!1),[M,R]=j.useState(e);t=t||f,j.useEffect(()=>{R(e)},[e]);const Q=()=>{y?(k(!1),M&&(r==null||r(M))):k(!0)};let W="";return M?W=M:s&&(W=ch(s)),n.jsxs("div",{className:T("flex items-center",i),children:[l&&n.jsx(ga,{className:"icon-md text-muted"}),n.jsxs("div",{className:"text-primary ml-6 mr-14",children:[t,x,!y&&W&&n.jsxs(j.Fragment,{children:[n.jsx("span",{children:"/"}),n.jsx("span",{className:"font-medium",children:W})]}),y?null:b]}),y&&n.jsx(Qt,{pattern:c,minLength:u,maxLength:h,onKeyDown:pe=>{pe.key==="Enter"&&Q()},ref:a,"aria-label":"slug",autoFocus:!0,className:"mr-14",size:"2xs",value:M,onBlur:o,onChange:pe=>{R(pe.target.value)}}),!m&&n.jsx(w,{type:"button",color:"chip",variant:"outline",size:"2xs",onClick:()=>{Q()},children:y?n.jsx(d,{message:"Save"}):n.jsx(d,{message:"Edit"})})]})}function I4(){const{setValue:t}=I();return n.jsxs(G,{className:"my-24",selectionMode:"single",name:"config.contentType",label:n.jsx(d,{message:"Content"}),onSelectionChange:e=>{e!=="autoUpdate"?t("config.autoUpdateMethod",""):(t("config.autoUpdateMethod","spotifyTopTracks"),t("config.contentModel",Ys),t("config.connectToGenreViaUrl",!1)),e==="listAll"&&t("config.contentModel",Xs)},children:[n.jsx(v,{value:"listAll",children:n.jsx(d,{message:"List all content of specified type"})}),n.jsx(v,{value:"manual",children:n.jsx(d,{message:"Add content manually"})}),n.jsx(v,{value:"autoUpdate",children:n.jsx(d,{message:"Automatically update content with specified method"})})]})}function E4(){const{watch:t}=I(),e=t("config.contentModel");return e!=="track"?null:n.jsxs(G,{className:"my-24",selectionMode:"single",name:"config.layout",label:n.jsx(d,{message:"Layout"}),children:[n.jsx(v,{value:"grid",children:n.jsx(d,{message:"Grid"})}),n.jsx(v,{value:"trackTable",isDisabled:e!=="track",children:n.jsx(d,{message:"Track table"})}),n.jsx(v,{value:"trackList",isDisabled:e!=="track",children:n.jsx(d,{message:"Track list"})})]})}function D4(){const{watch:t}=I(),e=t("config.contentModel"),s=t("config.contentType"),r=t("config.contentOrder")==="popularity:desc";return n.jsxs(G,{className:"my-24",selectionMode:"single",name:"config.contentOrder",label:n.jsx(d,{message:"How to order content"}),description:r?n.jsx(d,{message:"Sorting will be based on 'Sort Method' option in <a>Settings page</a>.",values:{a:i=>n.jsx(Y,{className:Qs,target:"_blank",to:"/admin/settings/player",children:i})}}):null,children:[n.jsx(v,{value:"popularity:desc",isDisabled:e===Pt||e===El,children:n.jsx(d,{message:"Most popular first"})}),n.jsx(v,{value:"created_at:desc",children:n.jsx(d,{message:"Most recently added first"})}),n.jsx(v,{value:"release_date:desc",isDisabled:e!==kr,children:n.jsx(d,{message:"Most recent first (by release date)"})}),n.jsx(v,{value:"channelables.order:asc",isDisabled:s!=="manual",children:n.jsx(d,{message:"Manual (reorder below)"})})]})}function O4(){const{spotify_is_setup:t,lastfm_is_setup:e}=fe(),{watch:s,setValue:r}=I();return s("config.contentType")!=="autoUpdate"?null:n.jsxs("div",{className:"md:flex items-end my-24 gap-14",children:[n.jsxs(G,{className:"flex-auto",selectionMode:"single",name:"config.autoUpdateMethod",label:n.jsxs(j.Fragment,{children:[n.jsx(d,{message:"Auto update method"}),n.jsx(Fl,{body:n.jsxs(j.Fragment,{children:[n.jsx("div",{className:"mb-20",children:n.jsx(d,{message:"This option will update channel content every 24 hours from the selected 3rd party source."})}),n.jsx(Kt,{link:"https://support.vebto.com/help-center/articles/28/31/170/channels"})]})})]}),required:!0,onSelectionChange:i=>{i==="spotifyTopTracks"||i==="spotifyPlaylistTracks"?r("config.contentModel","track"):i==="spotifyNewAlbums"?r("config.contentModel","album"):i==="lastfmTopGenres"&&r("config.contentModel","genre")},children:[t&&n.jsx(v,{value:"spotifyTopTracks",children:n.jsx(d,{message:"Spotify: top tracks"})}),t&&n.jsx(v,{value:"spotifyNewAlbums",children:n.jsx(d,{message:"Spotify: new releases"})}),t&&n.jsx(v,{value:"spotifyPlaylistTracks",children:n.jsx(d,{message:"Spotify: playlist tracks"})}),e&&n.jsx(v,{value:"lastfmTopGenres",children:n.jsx(d,{message:"Last.fm: popular genres"})})]}),s("config.autoUpdateMethod")==="spotifyPlaylistTracks"&&n.jsx(C,{className:"flex-auto mt-24 md:mt-0",name:"config.autoUpdateValue",label:n.jsx(d,{message:"Playlist ID"})})]})}function P4(){const{watch:t,setValue:e}=I(),s=t("config.contentType")==="manual",r=t("config.contentType")==="autoUpdate";return n.jsxs(G,{disabled:r,className:"my-24",selectionMode:"single",name:"config.contentModel",label:n.jsx(d,{message:"Type of content"}),onSelectionChange:i=>{i==="channel"?e("config.contentOrder","channelables.order:asc"):e("config.contentOrder","created_at:desc"),i==="track"?e("config.layout","trackTable"):e("config.layout","grid")},children:[n.jsx(v,{value:Xs,children:n.jsx(d,{message:"Artist"})}),n.jsx(v,{value:kr,children:n.jsx(d,{message:"Album"})}),n.jsx(v,{value:Ys,children:n.jsx(d,{message:"Track"})}),n.jsx(v,{value:ra,children:n.jsx(d,{message:"Playlist"})}),n.jsx(v,{value:ca,children:n.jsx(d,{message:"Genre"})}),n.jsx(v,{value:Pt,children:n.jsx(d,{message:"User"})}),s&&n.jsx(v,{value:El,children:n.jsx(d,{message:"Channel"})})]})}const F4=[Xs,kr,Ys,ra,Pt,ca];function z4(t){const{trans:e}=P();return $(s=>R4(t,s),{onSuccess:()=>{H(e(g("Channel content updated")))},onError:s=>oe(s)})}function R4(t,e){return O.post(`channel/${t}/update-content`,{...e,normalizeContent:!0}).then(s=>s.data)}const _4=D(n.jsx("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),"RefreshOutlined"),B4=[{key:"dragHandle",width:"w-42 flex-shrink-0",header:()=>n.jsx(d,{message:"Drag handle"}),hideHeader:!0,body:()=>n.jsx(Pl,{className:"cursor-pointer text-muted hover:text"})},{key:"name",header:()=>n.jsx(d,{message:"Content item"}),visibleInMode:"all",body:t=>n.jsx(mt,{image:t.image,label:t.name,description:t.description})},{key:"type",header:()=>n.jsx(d,{message:"Content type"}),body:t=>n.jsx("span",{className:"capitalize",children:t.model_type})},{key:"actions",header:()=>n.jsx(d,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-42 flex-shrink-0",visibleInMode:"all",body:(t,{index:e})=>n.jsx(U4,{index:e})}];function V4(){const{watch:t,getValues:e}=I(),s=t("config.contentType"),r=Qe({name:"content.data"}),i=t("content"),a=B4.filter(o=>!(s!=="manual"&&(o.key==="actions"||o.key==="dragHandle")));return n.jsxs("div",{className:"mt-40 pt-40 border-t",children:[n.jsxs("div",{className:"mb-40",children:[n.jsx("h2",{className:"text-2xl mb-10",children:n.jsx(d,{message:"Channel content"})}),n.jsx(W4,{}),n.jsx(Z4,{}),s==="manual"?n.jsx($4,{onResultSelected:o=>{e("content.data").find(c=>c.id===o.id&&c.model_type===o.model_type)||r.prepend(o)}}):null]}),n.jsx(Rl,{className:"mt-24",columns:a,data:i.data,meta:r,renderRowAs:s==="manual"?H4:void 0,enableSelection:!1,hideHeaderRow:!0}),!r.fields.length&&s==="manual"?n.jsx(fr,{title:n.jsx(d,{message:"Channel is empty"}),description:n.jsx(d,{message:"No content is attached to this channel yet."}),image:n.jsx(gr,{src:ba})}):null]})}function $4({onResultSelected:t}){const{watch:e}=I(),s=e("config.contentModel"),{trans:r}=P(),[i,a]=j.useState(""),{isFetching:o,data:l}=Fh({query:i,types:!s||s==="*"?F4:[s],limit:5,normalize:!0,localOnly:!0});return n.jsx(dh,{isAsync:!0,placeholder:r(g("Search for content to add...")),isLoading:o,inputValue:i,onInputValueChange:a,clearInputOnItemSelection:!0,blurReferenceOnItemSelection:!0,selectionMode:"none",openMenuOnFocus:!0,floatingMaxHeight:670,startAdornment:n.jsx(pr,{}),hideEndAdornment:!0,children:Object.entries((l==null?void 0:l.results)||{}).map(([c,u])=>n.jsx(Qi,{label:n.jsx(d,{message:c}),children:u.map(h=>{const m=h,p=`${c}-${h.id}`;return n.jsx(v,{value:p,onSelected:()=>t(m),startIcon:n.jsx("img",{className:"w-34 h-34 rounded object-cover",src:m.image||Mm,alt:""}),description:m.description,textLabel:m.name,children:m.name},p)})},c))})}function H4({item:t,children:e,className:s,...r}){const i=zh(),{data:a,meta:o}=j.useContext(Vl),l=j.useRef(null),c=j.useRef(null),[u,h]=j.useState(null),m=o,{sortableProps:p}=la({ref:l,disabled:i??!1,item:t,items:a,type:"channelContentItem",preview:c,previewVariant:"line",onDropPositionChange:f=>{h(f)},onSortEnd:(f,x)=>{m.move(f,x)}});return n.jsxs("tr",{className:T(s,u==="before"&&"sort-preview-before",u==="after"&&"sort-preview-after"),ref:l,...Ks(p,r),children:[e,!t.isPlaceholder&&n.jsx(q4,{item:t,ref:c})]})}const q4=_.forwardRef(({item:t},e)=>n.jsx(Bl,{ref:e,children:()=>n.jsx("div",{className:"p-8 rounded shadow bg-chip text-base",children:t.name})}));function U4({index:t}){const{meta:e}=j.useContext(Vl),s=e;return n.jsx(N,{size:"md",className:"text-muted",onClick:()=>{s.remove(t)},children:n.jsx(it,{})})}function W4(){const{watch:t}=I(),e=t("config.contentType");return e==="manual"?null:n.jsxs("div",{className:"flex items-center gap-8 mt-4 mb-20",children:[n.jsx(Nl,{size:"xs"}),n.jsxs("div",{className:"text-xs text-muted",children:[e==="listAll"?n.jsx(d,{message:"This channel is listing all available content of specified type, and can't be edited manually."}):null,e==="autoUpdate"?n.jsx(d,{message:"This channel content is set to update automatically and can't be edited manually."}):null]})]})}function Z4(){const{slugOrId:t}=_e(),e=z4(t),{setValue:s,watch:r,getValues:i}=I();return r("config.contentType")!=="autoUpdate"?null:n.jsx(w,{size:"xs",variant:"outline",color:"primary",startIcon:n.jsx(_4,{}),onClick:()=>{e.mutate({autoUpdateMethod:i("config.autoUpdateMethod")},{onSuccess:a=>{a.channel.content&&s("content",a.channel.content)}})},disabled:e.isLoading||!r("config.autoUpdateMethod"),children:n.jsx(d,{message:"Update content now"})})}function Vc({disableSlugEditing:t}){return n.jsxs(j.Fragment,{children:[n.jsxs(yr,{isLazy:!0,children:[n.jsxs(vr,{children:[n.jsx(Tt,{children:n.jsx(d,{message:"Details"})}),n.jsx(Tt,{children:n.jsx(d,{message:"SEO"})})]}),n.jsxs(Cr,{className:"pt-20",children:[n.jsx(At,{children:n.jsx(K4,{disableSlugEditing:t})}),n.jsx(At,{children:n.jsx(G4,{})})]})]}),n.jsx(V4,{})]})}function K4({disableSlugEditing:t}){return n.jsxs(j.Fragment,{children:[n.jsx(C,{name:"name",label:n.jsx(d,{message:"Name"}),className:"mb-10",required:!0,autoFocus:!0}),n.jsx(Q4,{disableEditing:t}),n.jsx(I4,{}),n.jsx(O4,{}),n.jsx(P4,{}),n.jsx(D4,{}),n.jsx(E4,{}),n.jsx(E,{className:"mb-24",name:"config.hideTitle",description:n.jsx(d,{message:"Whether title should be shown when displaying this channel on the site."}),children:n.jsx(d,{message:"Hide title"})}),n.jsx(E,{name:"config.carouselWhenNested",description:n.jsx(d,{message:"Show this channel content in carousel instead of a grid, when it's nested under another channel."}),children:n.jsx(d,{message:"Switch to carousel"})}),n.jsx(J4,{})]})}function J4(){const{watch:t}=I();return t("config.contentType")==="autoUpdate"?null:n.jsx(E,{className:"mt-24",name:"config.connectToGenreViaUrl",description:n.jsx(d,{message:"Filter this channel contents by genre specified in the url."}),children:n.jsx(d,{message:"Filter by genre"})})}function G4(){return n.jsxs(j.Fragment,{children:[n.jsx(C,{name:"config.seoTitle",label:n.jsx(d,{message:"SEO title"}),className:"mb-24"}),n.jsx(C,{name:"config.seoDescription",label:n.jsx(d,{message:"SEO description"}),inputElementType:"textarea",rows:6})]})}function Q4({disableEditing:t}){const{watch:e,setValue:s}=I(),r=e("slug"),i=e("name");return n.jsx(Bc,{hideButton:t,placeholder:i,suffix:e("config.connectToGenreViaUrl")?"GENRE_SLUG":void 0,className:"text-sm",pattern:"[A-Za-z0-9_-]+",minLength:3,maxLength:20,value:r,onChange:a=>{s("slug",a)}})}const Y4=t=>`channel/${t}`;function X4(t){const{trans:e}=P(),s=xe();return $(r=>e2(r),{onSuccess:()=>{H(e(g("Channel updated"))),F.invalidateQueries(ee("channel")),s("/admin/channels")},onError:r=>ge(r,t)})}function e2({id:t,...e}){return O.put(Y4(t),e).then(s=>s.data)}function t2(){const t=Rh(void 0,{normalizeContent:!0,forAdmin:!0});return t.data?n.jsx(s2,{channel:t.data.channel}):n.jsx(na,{query:t})}function s2({channel:t}){const e=X({defaultValues:{...t}}),s=X4(e);return n.jsx(ts,{form:e,onSubmit:r=>{s.mutate(r)},title:n.jsx(d,{message:"Edit “:name“ channel",values:{name:t.name}}),isLoading:s.isLoading,children:n.jsx(Vc,{disableSlugEditing:t.config.lockSlug})})}function n2(t){const{trans:e}=P();return $(s=>r2(s),{onSuccess:()=>{H(e(g("Lyric updated"))),F.invalidateQueries(ee("lyrics")),F.invalidateQueries(ee("tracks"))},onError:s=>ge(s,t)})}function r2({id:t,...e}){return O.put(`lyrics/${t}`,e).then(s=>s.data)}function we(t){this.content=t}we.prototype={constructor:we,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,s){var r=s&&s!=t?this.remove(s):this,i=r.find(t),a=r.content.slice();return i==-1?a.push(s||t,e):(a[i+1]=e,s&&(a[i]=s)),new we(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var s=this.content.slice();return s.splice(e,2),new we(s)},addToStart:function(t,e){return new we([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var s=this.remove(t).content.slice();return s.push(t,e),new we(s)},addBefore:function(t,e,s){var r=this.remove(e),i=r.content.slice(),a=r.find(t);return i.splice(a==-1?i.length:a,0,e,s),new we(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=we.from(t),t.size?new we(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=we.from(t),t.size?new we(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=we.from(t);for(var s=0;s<t.content.length;s+=2)e=e.remove(t.content[s]);return e},toObject:function(){var t={};return this.forEach(function(e,s){t[e]=s}),t},get size(){return this.content.length>>1}};we.from=function(t){if(t instanceof we)return t;var e=[];if(t)for(var s in t)e.push(s,t[s]);return new we(e)};function $c(t,e,s){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:s;let i=t.child(r),a=e.child(r);if(i==a){s+=i.nodeSize;continue}if(!i.sameMarkup(a))return s;if(i.isText&&i.text!=a.text){for(let o=0;i.text[o]==a.text[o];o++)s++;return s}if(i.content.size||a.content.size){let o=$c(i.content,a.content,s+1);if(o!=null)return o}s+=i.nodeSize}}function Hc(t,e,s,r){for(let i=t.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:s,b:r};let o=t.child(--i),l=e.child(--a),c=o.nodeSize;if(o==l){s-=c,r-=c;continue}if(!o.sameMarkup(l))return{a:s,b:r};if(o.isText&&o.text!=l.text){let u=0,h=Math.min(o.text.length,l.text.length);for(;u<h&&o.text[o.text.length-u-1]==l.text[l.text.length-u-1];)u++,s--,r--;return{a:s,b:r}}if(o.content.size||l.content.size){let u=Hc(o.content,l.content,s-1,r-1);if(u)return u}s-=c,r-=c}}class S{constructor(e,s){if(this.content=e,this.size=s||0,s==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,s,r,i=0,a){for(let o=0,l=0;l<s;o++){let c=this.content[o],u=l+c.nodeSize;if(u>e&&r(c,i+l,a||null,o)!==!1&&c.content.size){let h=l+1;c.nodesBetween(Math.max(0,e-h),Math.min(c.content.size,s-h),r,i+h)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,s,r,i){let a="",o=!0;return this.nodesBetween(e,s,(l,c)=>{l.isText?(a+=l.text.slice(Math.max(e,c)-c,s-c),o=!r):l.isLeaf?(i?a+=typeof i=="function"?i(l):i:l.type.spec.leafText&&(a+=l.type.spec.leafText(l)),o=!r):!o&&l.isBlock&&(a+=r,o=!0)},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let s=this.lastChild,r=e.firstChild,i=this.content.slice(),a=0;for(s.isText&&s.sameMarkup(r)&&(i[i.length-1]=s.withText(s.text+r.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new S(i,this.size+e.size)}cut(e,s=this.size){if(e==0&&s==this.size)return this;let r=[],i=0;if(s>e)for(let a=0,o=0;o<s;a++){let l=this.content[a],c=o+l.nodeSize;c>e&&((o<e||c>s)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,s-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,s-o-1))),r.push(l),i+=l.nodeSize),o=c}return new S(r,i)}cutByIndex(e,s){return e==s?S.empty:e==0&&s==this.content.length?this:new S(this.content.slice(e,s))}replaceChild(e,s){let r=this.content[e];if(r==s)return this;let i=this.content.slice(),a=this.size+s.nodeSize-r.nodeSize;return i[e]=s,new S(i,a)}addToStart(e){return new S([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new S(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let s=0;s<this.content.length;s++)if(!this.content[s].eq(e.content[s]))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 s=this.content[e];if(!s)throw new RangeError("Index "+e+" out of range for "+this);return s}maybeChild(e){return this.content[e]||null}forEach(e){for(let s=0,r=0;s<this.content.length;s++){let i=this.content[s];e(i,r,s),r+=i.nodeSize}}findDiffStart(e,s=0){return $c(this,e,s)}findDiffEnd(e,s=this.size,r=e.size){return Hc(this,e,s,r)}findIndex(e,s=-1){if(e==0)return Vn(0,e);if(e==this.size)return Vn(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let a=this.child(r),o=i+a.nodeSize;if(o>=e)return o==e||s>0?Vn(r+1,o):Vn(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,s){if(!s)return S.empty;if(!Array.isArray(s))throw new RangeError("Invalid input for Fragment.fromJSON");return new S(s.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return S.empty;let s,r=0;for(let i=0;i<e.length;i++){let a=e[i];r+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(s||(s=e.slice(0,i)),s[s.length-1]=a.withText(s[s.length-1].text+a.text)):s&&s.push(a)}return new S(s||e,r)}static from(e){if(!e)return S.empty;if(e instanceof S)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new S([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}S.empty=new S([],0);const qr={index:0,offset:0};function Vn(t,e){return qr.index=t,qr.offset=e,qr}function Yn(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let s=Array.isArray(t);if(Array.isArray(e)!=s)return!1;if(s){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Yn(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Yn(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ae=class Ni{constructor(e,s){this.type=e,this.attrs=s}addToSet(e){let s,r=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))s||(s=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!r&&a.type.rank>this.type.rank&&(s||(s=e.slice(0,i)),s.push(this),r=!0),s&&s.push(a)}}return s||(s=e.slice()),r||s.push(this),s}removeFromSet(e){for(let s=0;s<e.length;s++)if(this.eq(e[s]))return e.slice(0,s).concat(e.slice(s+1));return e}isInSet(e){for(let s=0;s<e.length;s++)if(this.eq(e[s]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Yn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let s in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,s){if(!s)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[s.type];if(!r)throw new RangeError(`There is no mark type ${s.type} in this schema`);return r.create(s.attrs)}static sameSet(e,s){if(e==s)return!0;if(e.length!=s.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(s[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ni.none;if(e instanceof Ni)return[e];let s=e.slice();return s.sort((r,i)=>r.type.rank-i.type.rank),s}};ae.none=[];class Xn extends Error{}class L{constructor(e,s,r){this.content=e,this.openStart=s,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,s){let r=Uc(this.content,e+this.openStart,s);return r&&new L(r,this.openStart,this.openEnd)}removeBetween(e,s){return new L(qc(this.content,e+this.openStart,s+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,s){if(!s)return L.empty;let r=s.openStart||0,i=s.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new L(S.fromJSON(e,s.content),r,i)}static maxOpen(e,s=!0){let r=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(s||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(s||!a.type.spec.isolating);a=a.lastChild)i++;return new L(e,r,i)}}L.empty=new L(S.empty,0,0);function qc(t,e,s){let{index:r,offset:i}=t.findIndex(e),a=t.maybeChild(r),{index:o,offset:l}=t.findIndex(s);if(i==e||a.isText){if(l!=s&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(s))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(qc(a.content,e-i-1,s-i-1)))}function Uc(t,e,s,r){let{index:i,offset:a}=t.findIndex(e),o=t.maybeChild(i);if(a==e||o.isText)return r&&!r.canReplace(i,i,s)?null:t.cut(0,e).append(s).append(t.cut(e));let l=Uc(o.content,e-a-1,s);return l&&t.replaceChild(i,o.copy(l))}function i2(t,e,s){if(s.openStart>t.depth)throw new Xn("Inserted content deeper than insertion position");if(t.depth-s.openStart!=e.depth-s.openEnd)throw new Xn("Inconsistent open depths");return Wc(t,e,s,0)}function Wc(t,e,s,r){let i=t.index(r),a=t.node(r);if(i==e.index(r)&&r<t.depth-s.openStart){let o=Wc(t,e,s,r+1);return a.copy(a.content.replaceChild(i,o))}else if(s.content.size)if(!s.openStart&&!s.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,l=o.content;return ms(o,l.cut(0,t.parentOffset).append(s.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=a2(s,t);return ms(a,Kc(t,o,l,e,r))}else return ms(a,er(t,e,r))}function Zc(t,e){if(!e.type.compatibleContent(t.type))throw new Xn("Cannot join "+e.type.name+" onto "+t.type.name)}function Li(t,e,s){let r=t.node(s);return Zc(r,e.node(s)),r}function hs(t,e){let s=e.length-1;s>=0&&t.isText&&t.sameMarkup(e[s])?e[s]=t.withText(e[s].text+t.text):e.push(t)}function hn(t,e,s,r){let i=(e||t).node(s),a=0,o=e?e.index(s):i.childCount;t&&(a=t.index(s),t.depth>s?a++:t.textOffset&&(hs(t.nodeAfter,r),a++));for(let l=a;l<o;l++)hs(i.child(l),r);e&&e.depth==s&&e.textOffset&&hs(e.nodeBefore,r)}function ms(t,e){return t.type.checkContent(e),t.copy(e)}function Kc(t,e,s,r,i){let a=t.depth>i&&Li(t,e,i+1),o=r.depth>i&&Li(s,r,i+1),l=[];return hn(null,t,i,l),a&&o&&e.index(i)==s.index(i)?(Zc(a,o),hs(ms(a,Kc(t,e,s,r,i+1)),l)):(a&&hs(ms(a,er(t,e,i+1)),l),hn(e,s,i,l),o&&hs(ms(o,er(s,r,i+1)),l)),hn(r,null,i,l),new S(l)}function er(t,e,s){let r=[];if(hn(null,t,s,r),t.depth>s){let i=Li(t,e,s+1);hs(ms(i,er(t,e,s+1)),r)}return hn(e,null,s,r),new S(r)}function a2(t,e){let s=e.depth-t.openStart,i=e.node(s).copy(t.content);for(let a=s-1;a>=0;a--)i=e.node(a).copy(S.from(i));return{start:i.resolveNoCache(t.openStart+s),end:i.resolveNoCache(i.content.size-t.openEnd-s)}}class yn{constructor(e,s,r){this.pos=e,this.path=s,this.parentOffset=r,this.depth=s.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,s=this.index(this.depth);if(s==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(s);return r?e.child(s).cut(r):i}get nodeBefore(){let e=this.index(this.depth),s=this.pos-this.path[this.path.length-1];return s?this.parent.child(e).cut(0,s):e==0?null:this.parent.child(e-1)}posAtIndex(e,s){s=this.resolveDepth(s);let r=this.path[s*3],i=s==0?0:this.path[s*3-1]+1;for(let a=0;a<e;a++)i+=r.child(a).nodeSize;return i}marks(){let e=this.parent,s=this.index();if(e.content.size==0)return ae.none;if(this.textOffset)return e.child(s).marks;let r=e.maybeChild(s-1),i=e.maybeChild(s);if(!r){let l=r;r=i,i=l}let a=r.marks;for(var o=0;o<a.length;o++)a[o].type.spec.inclusive===!1&&(!i||!a[o].isInSet(i.marks))&&(a=a[o--].removeFromSet(a));return a}marksAcross(e){let s=this.parent.maybeChild(this.index());if(!s||!s.isInline)return null;let r=s.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<r.length;a++)r[a].type.spec.inclusive===!1&&(!i||!r[a].isInSet(i.marks))&&(r=r[a--].removeFromSet(r));return r}sharedDepth(e){for(let s=this.depth;s>0;s--)if(this.start(s)<=e&&this.end(s)>=e)return s;return 0}blockRange(e=this,s){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!s||s(this.node(r))))return new tr(this,e,r);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 s=1;s<=this.depth;s++)e+=(e?"/":"")+this.node(s).type.name+"_"+this.index(s-1);return e+":"+this.parentOffset}static resolve(e,s){if(!(s>=0&&s<=e.content.size))throw new RangeError("Position "+s+" out of range");let r=[],i=0,a=s;for(let o=e;;){let{index:l,offset:c}=o.content.findIndex(a),u=a-c;if(r.push(o,l,i+c),!u||(o=o.child(l),o.isText))break;a=u-1,i+=c+1}return new yn(s,r,a)}static resolveCached(e,s){for(let i=0;i<Ur.length;i++){let a=Ur[i];if(a.pos==s&&a.doc==e)return a}let r=Ur[Wr]=yn.resolve(e,s);return Wr=(Wr+1)%o2,r}}let Ur=[],Wr=0,o2=12;class tr{constructor(e,s,r){this.$from=e,this.$to=s,this.depth=r}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 l2=Object.create(null);let ps=class Ti{constructor(e,s,r,i=ae.none){this.type=e,this.attrs=s,this.marks=i,this.content=r||S.empty}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,s,r,i=0){this.content.nodesBetween(e,s,r,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,s,r,i){return this.content.textBetween(e,s,r,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,s,r){return this.type==e&&Yn(this.attrs,s||e.defaultAttrs||l2)&&ae.sameSet(this.marks,r||ae.none)}copy(e=null){return e==this.content?this:new Ti(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ti(this.type,this.attrs,this.content,e)}cut(e,s=this.content.size){return e==0&&s==this.content.size?this:this.copy(this.content.cut(e,s))}slice(e,s=this.content.size,r=!1){if(e==s)return L.empty;let i=this.resolve(e),a=this.resolve(s),o=r?0:i.sharedDepth(s),l=i.start(o),u=i.node(o).content.cut(i.pos-l,a.pos-l);return new L(u,i.depth-o,a.depth-o)}replace(e,s,r){return i2(this.resolve(e),this.resolve(s),r)}nodeAt(e){for(let s=this;;){let{index:r,offset:i}=s.content.findIndex(e);if(s=s.maybeChild(r),!s)return null;if(i==e||s.isText)return s;e-=i+1}}childAfter(e){let{index:s,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(s),index:s,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:s,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(s),index:s,offset:r};let i=this.content.child(s-1);return{node:i,index:s-1,offset:r-i.nodeSize}}resolve(e){return yn.resolveCached(this,e)}resolveNoCache(e){return yn.resolve(this,e)}rangeHasMark(e,s,r){let i=!1;return s>e&&this.nodesBetween(e,s,a=>(r.isInSet(a.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()+")"),Jc(this.marks,e)}contentMatchAt(e){let s=this.type.contentMatch.matchFragment(this.content,0,e);if(!s)throw new Error("Called contentMatchAt on a node with invalid content");return s}canReplace(e,s,r=S.empty,i=0,a=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,a),l=o&&o.matchFragment(this.content,s);if(!l||!l.validEnd)return!1;for(let c=i;c<a;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,s,r,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(r),o=a&&a.matchFragment(this.content,s);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);let e=ae.none;for(let s=0;s<this.marks.length;s++)e=this.marks[s].addToSet(e);if(!ae.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(s=>s.type.name)}`);this.content.forEach(s=>s.check())}toJSON(){let e={type:this.type.name};for(let s 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(s=>s.toJSON())),e}static fromJSON(e,s){if(!s)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(s.marks){if(!Array.isArray(s.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=s.marks.map(e.markFromJSON)}if(s.type=="text"){if(typeof s.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(s.text,r)}let i=S.fromJSON(e,s.content);return e.nodeType(s.type).create(s.attrs,i,r)}};ps.prototype.text=void 0;class sr extends ps{constructor(e,s,r,i){if(super(e,s,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Jc(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,s){return this.text.slice(e,s)}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,s=this.text.length){return e==0&&s==this.text.length?this:this.withText(this.text.slice(e,s))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Jc(t,e){for(let s=t.length-1;s>=0;s--)e=t[s].type.name+"("+e+")";return e}class bs{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,s){let r=new c2(e,s);if(r.next==null)return bs.empty;let i=Gc(r);r.next&&r.err("Unexpected trailing text");let a=g2(f2(i));return x2(a,r),a}matchType(e){for(let s=0;s<this.next.length;s++)if(this.next[s].type==e)return this.next[s].next;return null}matchFragment(e,s=0,r=e.childCount){let i=this;for(let a=s;i&&a<r;a++)i=i.matchType(e.child(a).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:s}=this.next[e];if(!(s.isText||s.hasRequiredAttrs()))return s}return null}compatible(e){for(let s=0;s<this.next.length;s++)for(let r=0;r<e.next.length;r++)if(this.next[s].type==e.next[r].type)return!0;return!1}fillBefore(e,s=!1,r=0){let i=[this];function a(o,l){let c=o.matchFragment(e,r);if(c&&(!s||c.validEnd))return S.from(l.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:h,next:m}=o.next[u];if(!(h.isText||h.hasRequiredAttrs())&&i.indexOf(m)==-1){i.push(m);let p=a(m,l.concat(h));if(p)return p}}return null}return a(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let s=this.computeWrapping(e);return this.wrapCache.push(e,s),s}computeWrapping(e){let s=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),a=i.match;if(a.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<a.next.length;o++){let{type:l,next:c}=a.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in s)&&(!i.type||c.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),s[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function s(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&s(r.next[i].next)}return s(this),e.map((r,i)=>{let a=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)a+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return a}).join(` `)}}bs.empty=new bs(!0);class c2{constructor(e,s){this.string=e,this.nodeTypes=s,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 Gc(t){let e=[];do e.push(d2(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function d2(t){let e=[];do e.push(u2(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function u2(t){let e=p2(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=h2(t,e);else break;return e}function io(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function h2(t,e){let s=io(t),r=s;return t.eat(",")&&(t.next!="}"?r=io(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:s,max:r,expr:e}}function m2(t,e){let s=t.nodeTypes,r=s[e];if(r)return[r];let i=[];for(let a in s){let o=s[a];o.groups.indexOf(e)>-1&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function p2(t){if(t.eat("(")){let e=Gc(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=m2(t,t.next).map(s=>(t.inline==null?t.inline=s.isInline:t.inline!=s.isInline&&t.err("Mixing inline and block content"),{type:"name",value:s}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function f2(t){let e=[[]];return i(a(t,0),s()),e;function s(){return e.push([])-1}function r(o,l,c){let u={term:c,to:l};return e[o].push(u),u}function i(o,l){o.forEach(c=>c.to=l)}function a(o,l){if(o.type=="choice")return o.exprs.reduce((c,u)=>c.concat(a(u,l)),[]);if(o.type=="seq")for(let c=0;;c++){let u=a(o.exprs[c],l);if(c==o.exprs.length-1)return u;i(u,l=s())}else if(o.type=="star"){let c=s();return r(l,c),i(a(o.expr,c),c),[r(c)]}else if(o.type=="plus"){let c=s();return i(a(o.expr,l),c),i(a(o.expr,c),c),[r(c)]}else{if(o.type=="opt")return[r(l)].concat(a(o.expr,l));if(o.type=="range"){let c=l;for(let u=0;u<o.min;u++){let h=s();i(a(o.expr,c),h),c=h}if(o.max==-1)i(a(o.expr,c),c);else for(let u=o.min;u<o.max;u++){let h=s();r(c,h),i(a(o.expr,c),h),c=h}return[r(c)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Qc(t,e){return e-t}function ao(t,e){let s=[];return r(e),s.sort(Qc);function r(i){let a=t[i];if(a.length==1&&!a[0].term)return r(a[0].to);s.push(i);for(let o=0;o<a.length;o++){let{term:l,to:c}=a[o];!l&&s.indexOf(c)==-1&&r(c)}}}function g2(t){let e=Object.create(null);return s(ao(t,0));function s(r){let i=[];r.forEach(o=>{t[o].forEach(({term:l,to:c})=>{if(!l)return;let u;for(let h=0;h<i.length;h++)i[h][0]==l&&(u=i[h][1]);ao(t,c).forEach(h=>{u||i.push([l,u=[]]),u.indexOf(h)==-1&&u.push(h)})})});let a=e[r.join(",")]=new bs(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(Qc);a.next.push({type:i[o][0],next:e[l.join(",")]||s(l)})}return a}}function x2(t,e){for(let s=0,r=[t];s<r.length;s++){let i=r[s],a=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:c,next:u}=i.next[l];o.push(c.name),a&&!(c.isText||c.hasRequiredAttrs())&&(a=!1),r.indexOf(u)==-1&&r.push(u)}a&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Yc(t){let e=Object.create(null);for(let s in t){let r=t[s];if(!r.hasDefault)return null;e[s]=r.default}return e}function Xc(t,e){let s=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let a=t[r];if(a.hasDefault)i=a.default;else throw new RangeError("No value supplied for attribute "+r)}s[r]=i}return s}function ed(t){let e=Object.create(null);if(t)for(let s in t)e[s]=new j2(t[s]);return e}let oo=class td{constructor(e,s,r){this.name=e,this.schema=s,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=ed(r.attrs),this.defaultAttrs=Yc(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==bs.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}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:Xc(this.attrs,e)}create(e=null,s,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ps(this,this.computeAttrs(e),S.from(s),ae.setFrom(r))}createChecked(e=null,s,r){return s=S.from(s),this.checkContent(s),new ps(this,this.computeAttrs(e),s,ae.setFrom(r))}createAndFill(e=null,s,r){if(e=this.computeAttrs(e),s=S.from(s),s.size){let o=this.contentMatch.fillBefore(s);if(!o)return null;s=o.append(s)}let i=this.contentMatch.matchFragment(s),a=i&&i.fillBefore(S.empty,!0);return a?new ps(this,e,s.append(a),ae.setFrom(r)):null}validContent(e){let s=this.contentMatch.matchFragment(e);if(!s||!s.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).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)}`)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let s=0;s<e.length;s++)if(!this.allowsMarkType(e[s].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let s;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?s&&s.push(e[r]):s||(s=e.slice(0,r));return s?s.length?s:ae.none:e}static compile(e,s){let r=Object.create(null);e.forEach((a,o)=>r[a]=new td(a,s,o));let i=s.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let a in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class j2{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class Nr{constructor(e,s,r,i){this.name=e,this.rank=s,this.schema=r,this.spec=i,this.attrs=ed(i.attrs),this.excluded=null;let a=Yc(this.attrs);this.instance=a?new ae(this,a):null}create(e=null){return!e&&this.instance?this.instance:new ae(this,Xc(this.attrs,e))}static compile(e,s){let r=Object.create(null),i=0;return e.forEach((a,o)=>r[a]=new Nr(a,i++,s,o)),r}removeFromSet(e){for(var s=0;s<e.length;s++)e[s].type==this&&(e=e.slice(0,s).concat(e.slice(s+1)),s--);return e}isInSet(e){for(let s=0;s<e.length;s++)if(e[s].type==this)return e[s]}excludes(e){return this.excluded.indexOf(e)>-1}}class b2{constructor(e){this.cached=Object.create(null);let s=this.spec={};for(let i in e)s[i]=e[i];s.nodes=we.from(e.nodes),s.marks=we.from(e.marks||{}),this.nodes=oo.compile(this.spec.nodes,this),this.marks=Nr.compile(this.spec.marks,this);let r=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 a=this.nodes[i],o=a.spec.content||"",l=a.spec.marks;a.contentMatch=r[o]||(r[o]=bs.parse(o,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.markSet=l=="_"?null:l?lo(this,l.split(" ")):l==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],o=a.spec.excludes;a.excluded=o==null?[a]:o==""?[]:lo(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,s=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof oo){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(s,r,i)}text(e,s){let r=this.nodes.text;return new sr(r,r.defaultAttrs,e,ae.setFrom(s))}mark(e,s){return typeof e=="string"&&(e=this.marks[e]),e.create(s)}nodeFromJSON(e){return ps.fromJSON(this,e)}markFromJSON(e){return ae.fromJSON(this,e)}nodeType(e){let s=this.nodes[e];if(!s)throw new RangeError("Unknown node type: "+e);return s}}function lo(t,e){let s=[];for(let r=0;r<e.length;r++){let i=e[r],a=t.marks[i],o=a;if(a)s.push(a);else for(let l in t.marks){let c=t.marks[l];(i=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(i)>-1)&&s.push(o=c)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return s}class _s{constructor(e,s){this.schema=e,this.rules=s,this.tags=[],this.styles=[],s.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,s={}){let r=new uo(this,s,!1);return r.addAll(e,s.from,s.to),r.finish()}parseSlice(e,s={}){let r=new uo(this,s,!0);return r.addAll(e,s.from,s.to),L.maxOpen(r.finish())}matchTag(e,s,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let a=this.tags[i];if(C2(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||s.matchesContext(a.context))){if(a.getAttrs){let o=a.getAttrs(e);if(o===!1)continue;a.attrs=o||void 0}return a}}}matchStyle(e,s,r,i){for(let a=i?this.styles.indexOf(i)+1:0;a<this.styles.length;a++){let o=this.styles[a],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=s))){if(o.getAttrs){let c=o.getAttrs(s);if(c===!1)continue;o.attrs=c||void 0}return o}}}static schemaRules(e){let s=[];function r(i){let a=i.priority==null?50:i.priority,o=0;for(;o<s.length;o++){let l=s[o];if((l.priority==null?50:l.priority)<a)break}s.splice(o,0,i)}for(let i in e.marks){let a=e.marks[i].spec.parseDOM;a&&a.forEach(o=>{r(o=ho(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let a=e.nodes[i].spec.parseDOM;a&&a.forEach(o=>{r(o=ho(o)),o.node||o.ignore||o.mark||(o.node=i)})}return s}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new _s(e,_s.schemaRules(e)))}}const sd={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},y2={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},nd={ol:!0,ul:!0},nr=1,rr=2,mn=4;function co(t,e,s){return e!=null?(e?nr:0)|(e==="full"?rr:0):t&&t.whitespace=="pre"?nr|rr:s&~mn}class $n{constructor(e,s,r,i,a,o,l){this.type=e,this.attrs=s,this.marks=r,this.pendingMarks=i,this.solid=a,this.options=l,this.content=[],this.activeMarks=ae.none,this.stashMarks=[],this.match=o||(l&mn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let s=this.type.contentMatch.fillBefore(S.from(e));if(s)this.match=this.type.contentMatch.matchFragment(s);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&nr)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let a=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let s=S.from(this.content);return!e&&this.match&&(s=s.append(this.match.fillBefore(S.empty,!0))),this.type?this.type.create(this.attrs,s,this.marks):s}popFromStashMark(e){for(let s=this.stashMarks.length-1;s>=0;s--)if(e.eq(this.stashMarks[s]))return this.stashMarks.splice(s,1)[0]}applyPending(e){for(let s=0,r=this.pendingMarks;s<r.length;s++){let i=r[s];(this.type?this.type.allowsMarkType(i.type):w2(i.type,e))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!sd.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class uo{constructor(e,s,r){this.parser=e,this.options=s,this.isOpen=r,this.open=0;let i=s.topNode,a,o=co(null,s.preserveWhitespace,0)|(r?mn:0);i?a=new $n(i.type,i.attrs,ae.none,ae.none,!0,s.topMatch||i.type.contentMatch,o):r?a=new $n(null,null,ae.none,ae.none,!0,null,o):a=new $n(e.schema.topNodeType,null,ae.none,ae.none,!0,null,o),this.nodes=[a],this.find=s.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){if(e.nodeType==3)this.addTextNode(e);else if(e.nodeType==1){let s=e.getAttribute("style");if(!s)this.addElement(e);else{let r=this.readStyles(k2(s));if(!r)return;let[i,a]=r,o=this.top;for(let l=0;l<a.length;l++)this.removePendingMark(a[l],o);for(let l=0;l<i.length;l++)this.addPendingMark(i[l]);this.addElement(e);for(let l=0;l<i.length;l++)this.removePendingMark(i[l],o);for(let l=0;l<a.length;l++)this.addPendingMark(a[l])}}}addTextNode(e){let s=e.nodeValue,r=this.top;if(r.options&rr||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(s)){if(r.options&nr)r.options&rr?s=s.replace(/\r\n?/g,` `):s=s.replace(/\r?\n|\r/g," ");else if(s=s.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(s)&&this.open==this.nodes.length-1){let i=r.content[r.content.length-1],a=e.previousSibling;(!i||a&&a.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(s=s.slice(1))}s&&this.insertNode(this.parser.schema.text(s)),this.findInText(e)}else this.findInside(e)}addElement(e,s){let r=e.nodeName.toLowerCase(),i;nd.hasOwnProperty(r)&&this.parser.normalizeLists&&v2(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,s));if(a?a.ignore:y2.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let o,l=this.top,c=this.needsBlock;if(sd.hasOwnProperty(r))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),o=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}this.addAll(e),o&&this.sync(l),this.needsBlock=c}else this.addElementByRule(e,a,a.consuming===!1?i:void 0)}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` `))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let s=ae.none,r=ae.none;e:for(let i=0;i<e.length;i+=2)for(let a=void 0;;){let o=this.parser.matchStyle(e[i],e[i+1],this,a);if(!o)continue e;if(o.ignore)return null;if(o.clearMark?this.top.pendingMarks.forEach(l=>{o.clearMark(l)&&(r=l.addToSet(r))}):s=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(s),o.consuming===!1)a=o;else break}return[s,r]}addElementByRule(e,s,r){let i,a,o;s.node?(a=this.parser.schema.nodes[s.node],a.isLeaf?this.insertNode(a.create(s.attrs))||this.leafFallback(e):i=this.enter(a,s.attrs||null,s.preserveWhitespace)):(o=this.parser.schema.marks[s.mark].create(s.attrs),this.addPendingMark(o));let l=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(s.getContent)this.findInside(e),s.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c));else{let c=e;typeof s.contentElement=="string"?c=e.querySelector(s.contentElement):typeof s.contentElement=="function"?c=s.contentElement(e):s.contentElement&&(c=s.contentElement),this.findAround(e,c,!0),this.addAll(c)}i&&this.sync(l)&&this.open--,o&&this.removePendingMark(o,l)}addAll(e,s,r){let i=s||0;for(let a=s?e.childNodes[s]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a);this.findAtPoint(e,i)}findPlace(e){let s,r;for(let i=this.open;i>=0;i--){let a=this.nodes[i],o=a.findWrapping(e);if(o&&(!s||s.length>o.length)&&(s=o,r=a,!o.length)||a.solid)break}if(!s)return!1;this.sync(r);for(let i=0;i<s.length;i++)this.enterInner(s[i],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&this.enterInner(s)}if(this.findPlace(e)){this.closeExtra();let s=this.top;s.applyPending(e.type),s.match&&(s.match=s.match.matchType(e.type));let r=s.activeMarks;for(let i=0;i<e.marks.length;i++)(!s.type||s.type.allowsMarkType(e.marks[i].type))&&(r=e.marks[i].addToSet(r));return s.content.push(e.mark(r)),!0}return!1}enter(e,s,r){let i=this.findPlace(e.create(s));return i&&this.enterInner(e,s,!0,r),i}enterInner(e,s=null,r=!1,i){this.closeExtra();let a=this.top;a.applyPending(e),a.match=a.match&&a.match.matchType(e);let o=co(e,i,a.options);a.options&mn&&a.content.length==0&&(o|=mn),this.nodes.push(new $n(e,s,a.activeMarks,a.pendingMarks,r,null,o)),this.open++}closeExtra(e=!1){let s=this.nodes.length-1;if(s>this.open){for(;s>this.open;s--)this.nodes[s-1].content.push(this.nodes[s].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 s=this.open;s>=0;s--)if(this.nodes[s]==e)return this.open=s,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let s=this.open;s>=0;s--){let r=this.nodes[s].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;s&&e++}return e}findAtPoint(e,s){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==s&&(this.find[r].pos=this.currentPos)}findInside(e){if(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)&&(this.find[s].pos=this.currentPos)}findAround(e,s,r){if(e!=s&&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)&&s.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let s=0;s<this.find.length;s++)this.find[s].node==e&&(this.find[s].pos=this.currentPos-(e.nodeValue.length-this.find[s].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let s=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(i?0:1),o=(l,c)=>{for(;l>=0;l--){let u=s[l];if(u==""){if(l==s.length-1||l==0)continue;for(;c>=a;c--)if(o(l-1,c))return!0;return!1}else{let h=c>0||c==0&&i?this.nodes[c].type:r&&c>=a?r.node(c-a).type:null;if(!h||h.name!=u&&h.groups.indexOf(u)==-1)return!1;c--}}return!0};return o(s.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let s=e.depth;s>=0;s--){let r=e.node(s).contentMatchAt(e.indexAfter(s)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let s in this.parser.schema.nodes){let r=this.parser.schema.nodes[s];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let s=S2(e,this.top.pendingMarks);s&&this.top.stashMarks.push(s),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,s){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let o=i.popFromStashMark(e);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==s)break}}}function v2(t){for(let e=t.firstChild,s=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&nd.hasOwnProperty(r)&&s?(s.appendChild(e),e=s):r=="li"?s=e:r&&(s=null)}}function C2(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function k2(t){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,s,r=[];for(;s=e.exec(t);)r.push(s[1],s[2].trim());return r}function ho(t){let e={};for(let s in t)e[s]=t[s];return e}function w2(t,e){let s=e.schema.nodes;for(let r in s){let i=s[r];if(!i.allowsMarkType(t))continue;let a=[],o=l=>{a.push(l);for(let c=0;c<l.edgeCount;c++){let{type:u,next:h}=l.edge(c);if(u==e||a.indexOf(h)<0&&o(h))return!0}};if(o(i.contentMatch))return!0}}function S2(t,e){for(let s=0;s<e.length;s++)if(t.eq(e[s]))return e[s]}class yt{constructor(e,s){this.nodes=e,this.marks=s}serializeFragment(e,s={},r){r||(r=Zr(s).createDocumentFragment());let i=r,a=[];return e.forEach(o=>{if(a.length||o.marks.length){let l=0,c=0;for(;l<a.length&&c<o.marks.length;){let u=o.marks[c];if(!this.marks[u.type.name]){c++;continue}if(!u.eq(a[l][0])||u.type.spec.spanning===!1)break;l++,c++}for(;l<a.length;)i=a.pop()[1];for(;c<o.marks.length;){let u=o.marks[c++],h=this.serializeMark(u,o.isInline,s);h&&(a.push([u,i]),i.appendChild(h.dom),i=h.contentDOM||h.dom)}}i.appendChild(this.serializeNodeInner(o,s))}),r}serializeNodeInner(e,s){let{dom:r,contentDOM:i}=yt.renderSpec(Zr(s),this.nodes[e.type.name](e));if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,s,i)}return r}serializeNode(e,s={}){let r=this.serializeNodeInner(e,s);for(let i=e.marks.length-1;i>=0;i--){let a=this.serializeMark(e.marks[i],e.isInline,s);a&&((a.contentDOM||a.dom).appendChild(r),r=a.dom)}return r}serializeMark(e,s,r={}){let i=this.marks[e.type.name];return i&&yt.renderSpec(Zr(r),i(e,s))}static renderSpec(e,s,r=null){if(typeof s=="string")return{dom:e.createTextNode(s)};if(s.nodeType!=null)return{dom:s};if(s.dom&&s.dom.nodeType!=null)return s;let i=s[0],a=i.indexOf(" ");a>0&&(r=i.slice(0,a),i=i.slice(a+1));let o,l=r?e.createElementNS(r,i):e.createElement(i),c=s[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let h in c)if(c[h]!=null){let m=h.indexOf(" ");m>0?l.setAttributeNS(h.slice(0,m),h.slice(m+1),c[h]):l.setAttribute(h,c[h])}}for(let h=u;h<s.length;h++){let m=s[h];if(m===0){if(h<s.length-1||h>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:p,contentDOM:f}=yt.renderSpec(e,m,r);if(l.appendChild(p),f){if(o)throw new RangeError("Multiple content holes");o=f}}}return{dom:l,contentDOM:o}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new yt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let s=mo(e.nodes);return s.text||(s.text=r=>r.text),s}static marksFromSchema(e){return mo(e.marks)}}function mo(t){let e={};for(let s in t){let r=t[s].spec.toDOM;r&&(e[s]=r)}return e}function Zr(t){return t.document||window.document}const rd=65535,id=Math.pow(2,16);function M2(t,e){return t+e*id}function po(t){return t&rd}function N2(t){return(t-(t&rd))/id}const ad=1,od=2,Zn=4,ld=8;class Ai{constructor(e,s,r){this.pos=e,this.delInfo=s,this.recover=r}get deleted(){return(this.delInfo&ld)>0}get deletedBefore(){return(this.delInfo&(ad|Zn))>0}get deletedAfter(){return(this.delInfo&(od|Zn))>0}get deletedAcross(){return(this.delInfo&Zn)>0}}class tt{constructor(e,s=!1){if(this.ranges=e,this.inverted=s,!e.length&&tt.empty)return tt.empty}recover(e){let s=0,r=po(e);if(!this.inverted)for(let i=0;i<r;i++)s+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+s+N2(e)}mapResult(e,s=1){return this._map(e,s,!1)}map(e,s=1){return this._map(e,s,!0)}_map(e,s,r){let i=0,a=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?i:0);if(c>e)break;let u=this.ranges[l+a],h=this.ranges[l+o],m=c+u;if(e<=m){let p=u?e==c?-1:e==m?1:s:s,f=c+i+(p<0?0:h);if(r)return f;let x=e==(s<0?c:m)?null:M2(l/3,e-c),b=e==c?od:e==m?ad:Zn;return(s<0?e!=c:e!=m)&&(b|=ld),new Ai(f,b,x)}i+=h-u}return r?e+i:new Ai(e+i,0,null)}touches(e,s){let r=0,i=po(s),a=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;let u=this.ranges[l+a],h=c+u;if(e<=h&&l==i*3)return!0;r+=this.ranges[l+o]-u}return!1}forEach(e){let s=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,a=0;i<this.ranges.length;i+=3){let o=this.ranges[i],l=o-(this.inverted?a:0),c=o+(this.inverted?0:a),u=this.ranges[i+s],h=this.ranges[i+r];e(l,l+u,c,c+h),a+=h-u}}invert(){return new tt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?tt.empty:new tt(e<0?[0,-e,0]:[0,0,e])}}tt.empty=new tt([]);class Os{constructor(e=[],s,r=0,i=e.length){this.maps=e,this.mirror=s,this.from=r,this.to=i}slice(e=0,s=this.maps.length){return new Os(this.maps,this.mirror,e,s)}copy(){return new Os(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,s){this.to=this.maps.push(e),s!=null&&this.setMirror(this.maps.length-1,s)}appendMapping(e){for(let s=0,r=this.maps.length;s<e.maps.length;s++){let i=e.getMirror(s);this.appendMap(e.maps[s],i!=null&&i<s?r+i:void 0)}}getMirror(e){if(this.mirror){for(let s=0;s<this.mirror.length;s++)if(this.mirror[s]==e)return this.mirror[s+(s%2?-1:1)]}}setMirror(e,s){this.mirror||(this.mirror=[]),this.mirror.push(e,s)}appendMappingInverted(e){for(let s=e.maps.length-1,r=this.maps.length+e.maps.length;s>=0;s--){let i=e.getMirror(s);this.appendMap(e.maps[s].invert(),i!=null&&i>s?r-i-1:void 0)}}invert(){let e=new Os;return e.appendMappingInverted(this),e}map(e,s=1){if(this.mirror)return this._map(e,s,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,s);return e}mapResult(e,s=1){return this._map(e,s,!1)}_map(e,s,r){let i=0;for(let a=this.from;a<this.to;a++){let o=this.maps[a],l=o.mapResult(e,s);if(l.recover!=null){let c=this.getMirror(a);if(c!=null&&c>a&&c<this.to){a=c,e=this.maps[c].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new Ai(e,i,null)}}const Kr=Object.create(null);class Ke{getMap(){return tt.empty}merge(e){return null}static fromJSON(e,s){if(!s||!s.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Kr[s.stepType];if(!r)throw new RangeError(`No step type ${s.stepType} defined`);return r.fromJSON(e,s)}static jsonID(e,s){if(e in Kr)throw new RangeError("Duplicate use of step JSON ID "+e);return Kr[e]=s,s.prototype.jsonID=e,s}}class ye{constructor(e,s){this.doc=e,this.failed=s}static ok(e){return new ye(e,null)}static fail(e){return new ye(null,e)}static fromReplace(e,s,r,i){try{return ye.ok(e.replace(s,r,i))}catch(a){if(a instanceof Xn)return ye.fail(a.message);throw a}}}function ya(t,e,s){let r=[];for(let i=0;i<t.childCount;i++){let a=t.child(i);a.content.size&&(a=a.copy(ya(a.content,e,a))),a.isInline&&(a=e(a,s,i)),r.push(a)}return S.fromArray(r)}class $t extends Ke{constructor(e,s,r){super(),this.from=e,this.to=s,this.mark=r}apply(e){let s=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),a=new L(ya(s.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),s.openStart,s.openEnd);return ye.fromReplace(e,this.from,this.to,a)}invert(){return new vt(this.from,this.to,this.mark)}map(e){let s=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return s.deleted&&r.deleted||s.pos>=r.pos?null:new $t(s.pos,r.pos,this.mark)}merge(e){return e instanceof $t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new $t(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,s){if(typeof s.from!="number"||typeof s.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new $t(s.from,s.to,e.markFromJSON(s.mark))}}Ke.jsonID("addMark",$t);class vt extends Ke{constructor(e,s,r){super(),this.from=e,this.to=s,this.mark=r}apply(e){let s=e.slice(this.from,this.to),r=new L(ya(s.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),s.openStart,s.openEnd);return ye.fromReplace(e,this.from,this.to,r)}invert(){return new $t(this.from,this.to,this.mark)}map(e){let s=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return s.deleted&&r.deleted||s.pos>=r.pos?null:new vt(s.pos,r.pos,this.mark)}merge(e){return e instanceof vt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new vt(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,s){if(typeof s.from!="number"||typeof s.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new vt(s.from,s.to,e.markFromJSON(s.mark))}}Ke.jsonID("removeMark",vt);class Ht extends Ke{constructor(e,s){super(),this.pos=e,this.mark=s}apply(e){let s=e.nodeAt(this.pos);if(!s)return ye.fail("No node at mark step's position");let r=s.type.create(s.attrs,null,this.mark.addToSet(s.marks));return ye.fromReplace(e,this.pos,this.pos+1,new L(S.from(r),0,s.isLeaf?0:1))}invert(e){let s=e.nodeAt(this.pos);if(s){let r=this.mark.addToSet(s.marks);if(r.length==s.marks.length){for(let i=0;i<s.marks.length;i++)if(!s.marks[i].isInSet(r))return new Ht(this.pos,s.marks[i]);return new Ht(this.pos,this.mark)}}return new Bs(this.pos,this.mark)}map(e){let s=e.mapResult(this.pos,1);return s.deletedAfter?null:new Ht(s.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,s){if(typeof s.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ht(s.pos,e.markFromJSON(s.mark))}}Ke.jsonID("addNodeMark",Ht);class Bs extends Ke{constructor(e,s){super(),this.pos=e,this.mark=s}apply(e){let s=e.nodeAt(this.pos);if(!s)return ye.fail("No node at mark step's position");let r=s.type.create(s.attrs,null,this.mark.removeFromSet(s.marks));return ye.fromReplace(e,this.pos,this.pos+1,new L(S.from(r),0,s.isLeaf?0:1))}invert(e){let s=e.nodeAt(this.pos);return!s||!this.mark.isInSet(s.marks)?this:new Ht(this.pos,this.mark)}map(e){let s=e.mapResult(this.pos,1);return s.deletedAfter?null:new Bs(s.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,s){if(typeof s.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Bs(s.pos,e.markFromJSON(s.mark))}}Ke.jsonID("removeNodeMark",Bs);class Te extends Ke{constructor(e,s,r,i=!1){super(),this.from=e,this.to=s,this.slice=r,this.structure=i}apply(e){return this.structure&&Ii(e,this.from,this.to)?ye.fail("Structure replace would overwrite content"):ye.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new tt([this.from,this.to-this.from,this.slice.size])}invert(e){return new Te(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let s=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return s.deletedAcross&&r.deletedAcross?null:new Te(s.pos,Math.max(s.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Te)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let s=this.slice.size+e.slice.size==0?L.empty:new L(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Te(this.from,this.to+(e.to-e.from),s,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let s=this.slice.size+e.slice.size==0?L.empty:new L(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Te(e.from,this.to,s,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,s){if(typeof s.from!="number"||typeof s.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Te(s.from,s.to,L.fromJSON(e,s.slice),!!s.structure)}}Ke.jsonID("replace",Te);class Ce extends Ke{constructor(e,s,r,i,a,o,l=!1){super(),this.from=e,this.to=s,this.gapFrom=r,this.gapTo=i,this.slice=a,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Ii(e,this.from,this.gapFrom)||Ii(e,this.gapTo,this.to)))return ye.fail("Structure gap-replace would overwrite content");let s=e.slice(this.gapFrom,this.gapTo);if(s.openStart||s.openEnd)return ye.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,s.content);return r?ye.fromReplace(e,this.from,this.to,r):ye.fail("Content does not fit in gap")}getMap(){return new tt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let s=this.gapTo-this.gapFrom;return new Ce(this.from,this.from+this.slice.size+s,this.from+this.insert,this.from+this.insert+s,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let s=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=e.map(this.gapFrom,-1),a=e.map(this.gapTo,1);return s.deletedAcross&&r.deletedAcross||i<s.pos||a>r.pos?null:new Ce(s.pos,r.pos,i,a,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,s){if(typeof s.from!="number"||typeof s.to!="number"||typeof s.gapFrom!="number"||typeof s.gapTo!="number"||typeof s.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ce(s.from,s.to,s.gapFrom,s.gapTo,L.fromJSON(e,s.slice),s.insert,!!s.structure)}}Ke.jsonID("replaceAround",Ce);function Ii(t,e,s){let r=t.resolve(e),i=s-e,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let o=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function L2(t,e,s,r){let i=[],a=[],o,l;t.doc.nodesBetween(e,s,(c,u,h)=>{if(!c.isInline)return;let m=c.marks;if(!r.isInSet(m)&&h.type.allowsMarkType(r.type)){let p=Math.max(u,e),f=Math.min(u+c.nodeSize,s),x=r.addToSet(m);for(let b=0;b<m.length;b++)m[b].isInSet(x)||(o&&o.to==p&&o.mark.eq(m[b])?o.to=f:i.push(o=new vt(p,f,m[b])));l&&l.to==p?l.to=f:a.push(l=new $t(p,f,r))}}),i.forEach(c=>t.step(c)),a.forEach(c=>t.step(c))}function T2(t,e,s,r){let i=[],a=0;t.doc.nodesBetween(e,s,(o,l)=>{if(!o.isInline)return;a++;let c=null;if(r instanceof Nr){let u=o.marks,h;for(;h=r.isInSet(u);)(c||(c=[])).push(h),u=h.removeFromSet(u)}else r?r.isInSet(o.marks)&&(c=[r]):c=o.marks;if(c&&c.length){let u=Math.min(l+o.nodeSize,s);for(let h=0;h<c.length;h++){let m=c[h],p;for(let f=0;f<i.length;f++){let x=i[f];x.step==a-1&&m.eq(i[f].style)&&(p=x)}p?(p.to=u,p.step=a):i.push({style:m,from:Math.max(l,e),to:u,step:a})}}}),i.forEach(o=>t.step(new vt(o.from,o.to,o.style)))}function A2(t,e,s,r=s.contentMatch){let i=t.doc.nodeAt(e),a=[],o=e+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=o+c.nodeSize,h=r.matchType(c.type);if(!h)a.push(new Te(o,u,L.empty));else{r=h;for(let m=0;m<c.marks.length;m++)s.allowsMarkType(c.marks[m].type)||t.step(new vt(o,u,c.marks[m]))}o=u}if(!r.validEnd){let l=r.fillBefore(S.empty,!0);t.replace(o,o,new L(l,0,0))}for(let l=a.length-1;l>=0;l--)t.step(a[l])}function I2(t,e,s){return(e==0||t.canReplace(e,t.childCount))&&(s==t.childCount||t.canReplace(0,s))}function tn(t){let s=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let i=t.$from.node(r),a=t.$from.index(r),o=t.$to.indexAfter(r);if(r<t.depth&&i.canReplace(a,o,s))return r;if(r==0||i.type.spec.isolating||!I2(i,a,o))break}return null}function E2(t,e,s){let{$from:r,$to:i,depth:a}=e,o=r.before(a+1),l=i.after(a+1),c=o,u=l,h=S.empty,m=0;for(let x=a,b=!1;x>s;x--)b||r.index(x)>0?(b=!0,h=S.from(r.node(x).copy(h)),m++):c--;let p=S.empty,f=0;for(let x=a,b=!1;x>s;x--)b||i.after(x+1)<i.end(x)?(b=!0,p=S.from(i.node(x).copy(p)),f++):u++;t.step(new Ce(c,u,o,l,new L(h.append(p),m,f),h.size-m,!0))}function va(t,e,s=null,r=t){let i=D2(t,e),a=i&&O2(r,e);return a?i.map(fo).concat({type:e,attrs:s}).concat(a.map(fo)):null}function fo(t){return{type:t,attrs:null}}function D2(t,e){let{parent:s,startIndex:r,endIndex:i}=t,a=s.contentMatchAt(r).findWrapping(e);if(!a)return null;let o=a.length?a[0]:e;return s.canReplaceWith(r,i,o)?a:null}function O2(t,e){let{parent:s,startIndex:r,endIndex:i}=t,a=s.child(r),o=e.contentMatch.findWrapping(a.type);if(!o)return null;let c=(o.length?o[o.length-1]:e).contentMatch;for(let u=r;c&&u<i;u++)c=c.matchType(s.child(u).type);return!c||!c.validEnd?null:o}function P2(t,e,s){let r=S.empty;for(let o=s.length-1;o>=0;o--){if(r.size){let l=s[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=S.from(s[o].type.create(s[o].attrs,r))}let i=e.start,a=e.end;t.step(new Ce(i,a,i,a,new L(r,0,0),s.length,!0))}function F2(t,e,s,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,s,(o,l)=>{if(o.isTextblock&&!o.hasMarkup(r,i)&&z2(t.doc,t.mapping.slice(a).map(l),r)){t.clearIncompatible(t.mapping.slice(a).map(l,1),r);let c=t.mapping.slice(a),u=c.map(l,1),h=c.map(l+o.nodeSize,1);return t.step(new Ce(u,h,u+1,h-1,new L(S.from(r.create(i,null,o.marks)),0,0),1,!0)),!1}})}function z2(t,e,s){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,s)}function R2(t,e,s,r,i){let a=t.doc.nodeAt(e);if(!a)throw new RangeError("No node at given position");s||(s=a.type);let o=s.create(r,null,i||a.marks);if(a.isLeaf)return t.replaceWith(e,e+a.nodeSize,o);if(!s.validContent(a.content))throw new RangeError("Invalid content for node type "+s.name);t.step(new Ce(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new L(S.from(o),0,0),1,!0))}function Ps(t,e,s=1,r){let i=t.resolve(e),a=i.depth-s,o=r&&r[r.length-1]||i.parent;if(a<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 u=i.depth-1,h=s-2;u>a;u--,h--){let m=i.node(u),p=i.index(u);if(m.type.spec.isolating)return!1;let f=m.content.cutByIndex(p,m.childCount),x=r&&r[h]||m;if(x!=m&&(f=f.replaceChild(0,x.type.create(x.attrs))),!m.canReplace(p+1,m.childCount)||!x.type.validContent(f))return!1}let l=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(l,l,c?c.type:i.node(a+1).type)}function _2(t,e,s=1,r){let i=t.doc.resolve(e),a=S.empty,o=S.empty;for(let l=i.depth,c=i.depth-s,u=s-1;l>c;l--,u--){a=S.from(i.node(l).copy(a));let h=r&&r[u];o=S.from(h?h.type.create(h.attrs,o):i.node(l).copy(o))}t.step(new Te(e,e,new L(a.append(o),s,s),!0))}function ns(t,e){let s=t.resolve(e),r=s.index();return cd(s.nodeBefore,s.nodeAfter)&&s.parent.canReplace(r,r+1)}function cd(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function dd(t,e,s=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let a,o,l=r.index(i);if(i==r.depth?(a=r.nodeBefore,o=r.nodeAfter):s>0?(a=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(a=r.node(i).maybeChild(l-1),o=r.node(i+1)),a&&!a.isTextblock&&cd(a,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=s<0?r.before(i):r.after(i)}}function B2(t,e,s){let r=new Te(e-s,e+s,L.empty,!0);t.step(r)}function V2(t,e,s){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),s))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let a=r.index(i);if(r.node(i).canReplaceWith(a,a,s))return r.before(i+1);if(a>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let a=r.indexAfter(i);if(r.node(i).canReplaceWith(a,a,s))return r.after(i+1);if(a<r.node(i).childCount)return null}return null}function ud(t,e,s){let r=t.resolve(e);if(!s.content.size)return e;let i=s.content;for(let a=0;a<s.openStart;a++)i=i.firstChild.content;for(let a=1;a<=(s.openStart==0&&s.size?2:1);a++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,c=r.index(o)+(l>0?1:0),u=r.node(o),h=!1;if(a==1)h=u.canReplace(c,c,i);else{let m=u.contentMatchAt(c).findWrapping(i.firstChild.type);h=m&&u.canReplaceWith(c,c,m[0])}if(h)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function Ca(t,e,s=e,r=L.empty){if(e==s&&!r.size)return null;let i=t.resolve(e),a=t.resolve(s);return hd(i,a,r)?new Te(e,s,r):new $2(i,a,r).fit()}function hd(t,e,s){return!s.openStart&&!s.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),s.content)}class $2{constructor(e,s,r){this.$from=e,this.$to=s,this.unplaced=r,this.frontier=[],this.placed=S.empty;for(let i=0;i<=e.depth;i++){let a=e.node(i);this.frontier.push({type:a.type,match:a.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=S.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),s=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let a=this.placed,o=r.depth,l=i.depth;for(;o&&l&&a.childCount==1;)a=a.firstChild.content,o--,l--;let c=new L(a,o,l);return e>-1?new Ce(r.pos,e,this.$to.pos,this.$to.end(),c,s):c.size||r.pos!=this.$to.pos?new Te(r.pos,i.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let s=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let a=s.firstChild;if(s.childCount>1&&(i=0),a.type.spec.isolating&&i<=r){e=r;break}s=a.content}for(let s=1;s<=2;s++)for(let r=s==1?e:this.unplaced.openStart;r>=0;r--){let i,a=null;r?(a=Jr(this.unplaced.content,r-1).firstChild,i=a.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:u}=this.frontier[l],h,m=null;if(s==1&&(o?u.matchType(o.type)||(m=u.fillBefore(S.from(o),!1)):a&&c.compatibleContent(a.type)))return{sliceDepth:r,frontierDepth:l,parent:a,inject:m};if(s==2&&o&&(h=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:a,wrap:h};if(a&&u.matchType(a.type))break}}}openMore(){let{content:e,openStart:s,openEnd:r}=this.unplaced,i=Jr(e,s);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new L(e,s+1,Math.max(r,i.size+s>=e.size-r?s+1:0)),!0)}dropNode(){let{content:e,openStart:s,openEnd:r}=this.unplaced,i=Jr(e,s);if(i.childCount<=1&&s>0){let a=e.size-s<=s+i.size;this.unplaced=new L(an(e,s-1,1),s-1,a?s-1:r)}else this.unplaced=new L(an(e,s,1),s,r)}placeNodes({sliceDepth:e,frontierDepth:s,parent:r,inject:i,wrap:a}){for(;this.depth>s;)this.closeFrontierNode();if(a)for(let b=0;b<a.length;b++)this.openFrontierNode(a[b]);let o=this.unplaced,l=r?r.content:o.content,c=o.openStart-e,u=0,h=[],{match:m,type:p}=this.frontier[s];if(i){for(let b=0;b<i.childCount;b++)h.push(i.child(b));m=m.matchFragment(i)}let f=l.size+e-(o.content.size-o.openEnd);for(;u<l.childCount;){let b=l.child(u),y=m.matchType(b.type);if(!y)break;u++,(u>1||c==0||b.content.size)&&(m=y,h.push(md(b.mark(p.allowedMarks(b.marks)),u==1?c:0,u==l.childCount?f:-1)))}let x=u==l.childCount;x||(f=-1),this.placed=on(this.placed,s,S.from(h)),this.frontier[s].match=m,x&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let b=0,y=l;b<f;b++){let k=y.lastChild;this.frontier.push({type:k.type,match:k.contentMatchAt(k.childCount)}),y=k.content}this.unplaced=x?e==0?L.empty:new L(an(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new L(an(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],s;if(!e.type.isTextblock||!Gr(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(s=this.findCloseLevel(this.$to))&&s.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let s=Math.min(this.depth,e.depth);s>=0;s--){let{match:r,type:i}=this.frontier[s],a=s<e.depth&&e.end(s+1)==e.pos+(e.depth-(s+1)),o=Gr(e,s,i,r,a);if(o){for(let l=s-1;l>=0;l--){let{match:c,type:u}=this.frontier[l],h=Gr(e,l,u,c,!0);if(!h||h.childCount)continue e}return{depth:s,fit:o,move:a?e.doc.resolve(e.after(s+1)):e}}}}close(e){let s=this.findCloseLevel(e);if(!s)return null;for(;this.depth>s.depth;)this.closeFrontierNode();s.fit.childCount&&(this.placed=on(this.placed,s.depth,s.fit)),e=s.move;for(let r=s.depth+1;r<=e.depth;r++){let i=e.node(r),a=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,a)}return e}openFrontierNode(e,s=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=on(this.placed,this.depth,S.from(e.create(s,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let s=this.frontier.pop().match.fillBefore(S.empty,!0);s.childCount&&(this.placed=on(this.placed,this.frontier.length,s))}}function an(t,e,s){return e==0?t.cutByIndex(s,t.childCount):t.replaceChild(0,t.firstChild.copy(an(t.firstChild.content,e-1,s)))}function on(t,e,s){return e==0?t.append(s):t.replaceChild(t.childCount-1,t.lastChild.copy(on(t.lastChild.content,e-1,s)))}function Jr(t,e){for(let s=0;s<e;s++)t=t.firstChild.content;return t}function md(t,e,s){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,md(r.firstChild,e-1,r.childCount==1?s-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),s<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(S.empty,!0)))),t.copy(r)}function Gr(t,e,s,r,i){let a=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==a.childCount&&!s.compatibleContent(a.type))return null;let l=r.fillBefore(a.content,!0,o);return l&&!H2(s,a.content,o)?l:null}function H2(t,e,s){for(let r=s;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function q2(t){return t.spec.defining||t.spec.definingForContent}function U2(t,e,s,r){if(!r.size)return t.deleteRange(e,s);let i=t.doc.resolve(e),a=t.doc.resolve(s);if(hd(i,a,r))return t.step(new Te(e,s,r));let o=fd(i,t.doc.resolve(s));o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let p=i.depth,f=i.pos-1;p>0;p--,f--){let x=i.node(p).type.spec;if(x.defining||x.definingAsContext||x.isolating)break;o.indexOf(p)>-1?l=p:i.before(p)==f&&o.splice(1,0,-p)}let c=o.indexOf(l),u=[],h=r.openStart;for(let p=r.content,f=0;;f++){let x=p.firstChild;if(u.push(x),f==r.openStart)break;p=x.content}for(let p=h-1;p>=0;p--){let f=u[p].type,x=q2(f);if(x&&i.node(c).type!=f)h=p;else if(x||!f.isTextblock)break}for(let p=r.openStart;p>=0;p--){let f=(p+h+1)%(r.openStart+1),x=u[f];if(x)for(let b=0;b<o.length;b++){let y=o[(b+c)%o.length],k=!0;y<0&&(k=!1,y=-y);let M=i.node(y-1),R=i.index(y-1);if(M.canReplaceWith(R,R,x.type,x.marks))return t.replace(i.before(y),k?a.after(y):s,new L(pd(r.content,0,r.openStart,f),f,r.openEnd))}}let m=t.steps.length;for(let p=o.length-1;p>=0&&(t.replace(e,s,r),!(t.steps.length>m));p--){let f=o[p];f<0||(e=i.before(f),s=a.after(f))}}function pd(t,e,s,r,i){if(e<s){let a=t.firstChild;t=t.replaceChild(0,a.copy(pd(a.content,e+1,s,r,a)))}if(e>r){let a=i.contentMatchAt(0),o=a.fillBefore(t).append(t);t=o.append(a.matchFragment(o).fillBefore(S.empty,!0))}return t}function W2(t,e,s,r){if(!r.isInline&&e==s&&t.doc.resolve(e).parent.content.size){let i=V2(t.doc,e,r.type);i!=null&&(e=s=i)}t.replaceRange(e,s,new L(S.from(r),0,0))}function Z2(t,e,s){let r=t.doc.resolve(e),i=t.doc.resolve(s),a=fd(r,i);for(let o=0;o<a.length;o++){let l=a[o],c=o==a.length-1;if(c&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),i.end(l));if(l>0&&(c||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return t.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&s>r.end(o)&&i.end(o)-s!=i.depth-o)return t.delete(r.before(o),s);t.delete(e,s)}function fd(t,e){let s=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let a=t.start(i);if(a<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(a==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==a-1)&&s.push(i)}return s}class Fs extends Ke{constructor(e,s,r){super(),this.pos=e,this.attr=s,this.value=r}apply(e){let s=e.nodeAt(this.pos);if(!s)return ye.fail("No node at attribute step's position");let r=Object.create(null);for(let a in s.attrs)r[a]=s.attrs[a];r[this.attr]=this.value;let i=s.type.create(r,null,s.marks);return ye.fromReplace(e,this.pos,this.pos+1,new L(S.from(i),0,s.isLeaf?0:1))}getMap(){return tt.empty}invert(e){return new Fs(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let s=e.mapResult(this.pos,1);return s.deletedAfter?null:new Fs(s.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,s){if(typeof s.pos!="number"||typeof s.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Fs(s.pos,s.attr,s.value)}}Ke.jsonID("attr",Fs);let Vs=class extends Error{};Vs=function t(e){let s=Error.call(this,e);return s.__proto__=t.prototype,s};Vs.prototype=Object.create(Error.prototype);Vs.prototype.constructor=Vs;Vs.prototype.name="TransformError";class gd{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Os}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let s=this.maybeStep(e);if(s.failed)throw new Vs(s.failed);return this}maybeStep(e){let s=e.apply(this.doc);return s.failed||this.addStep(e,s.doc),s}get docChanged(){return this.steps.length>0}addStep(e,s){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=s}replace(e,s=e,r=L.empty){let i=Ca(this.doc,e,s,r);return i&&this.step(i),this}replaceWith(e,s,r){return this.replace(e,s,new L(S.from(r),0,0))}delete(e,s){return this.replace(e,s,L.empty)}insert(e,s){return this.replaceWith(e,e,s)}replaceRange(e,s,r){return U2(this,e,s,r),this}replaceRangeWith(e,s,r){return W2(this,e,s,r),this}deleteRange(e,s){return Z2(this,e,s),this}lift(e,s){return E2(this,e,s),this}join(e,s=1){return B2(this,e,s),this}wrap(e,s){return P2(this,e,s),this}setBlockType(e,s=e,r,i=null){return F2(this,e,s,r,i),this}setNodeMarkup(e,s,r=null,i){return R2(this,e,s,r,i),this}setNodeAttribute(e,s,r){return this.step(new Fs(e,s,r)),this}addNodeMark(e,s){return this.step(new Ht(e,s)),this}removeNodeMark(e,s){if(!(s instanceof ae)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(s=s.isInSet(r.marks),!s)return this}return this.step(new Bs(e,s)),this}split(e,s=1,r){return _2(this,e,s,r),this}addMark(e,s,r){return L2(this,e,s,r),this}removeMark(e,s,r){return T2(this,e,s,r),this}clearIncompatible(e,s,r){return A2(this,e,s,r),this}}const Qr=Object.create(null);class K{constructor(e,s,r){this.$anchor=e,this.$head=s,this.ranges=r||[new K2(e.min(s),e.max(s))]}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 s=0;s<e.length;s++)if(e[s].$from.pos!=e[s].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,s=L.empty){let r=s.content.lastChild,i=null;for(let l=0;l<s.openEnd;l++)i=r,r=r.lastChild;let a=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:c,$to:u}=o[l],h=e.mapping.slice(a);e.replaceRange(h.map(c.pos),h.map(u.pos),l?L.empty:s),l==0&&jo(e,a,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,s){let r=e.steps.length,i=this.ranges;for(let a=0;a<i.length;a++){let{$from:o,$to:l}=i[a],c=e.mapping.slice(r),u=c.map(o.pos),h=c.map(l.pos);a?e.deleteRange(u,h):(e.replaceRangeWith(u,h,s),jo(e,r,s.isInline?-1:1))}}static findFrom(e,s,r=!1){let i=e.parent.inlineContent?new J(e):Ns(e.node(0),e.parent,e.pos,e.index(),s,r);if(i)return i;for(let a=e.depth-1;a>=0;a--){let o=s<0?Ns(e.node(0),e.node(a),e.before(a+1),e.index(a),s,r):Ns(e.node(0),e.node(a),e.after(a+1),e.index(a)+1,s,r);if(o)return o}return null}static near(e,s=1){return this.findFrom(e,s)||this.findFrom(e,-s)||new rt(e.node(0))}static atStart(e){return Ns(e,e,0,0,1)||new rt(e)}static atEnd(e){return Ns(e,e,e.content.size,e.childCount,-1)||new rt(e)}static fromJSON(e,s){if(!s||!s.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Qr[s.type];if(!r)throw new RangeError(`No selection type ${s.type} defined`);return r.fromJSON(e,s)}static jsonID(e,s){if(e in Qr)throw new RangeError("Duplicate use of selection JSON ID "+e);return Qr[e]=s,s.prototype.jsonID=e,s}getBookmark(){return J.between(this.$anchor,this.$head).getBookmark()}}K.prototype.visible=!0;class K2{constructor(e,s){this.$from=e,this.$to=s}}let go=!1;function xo(t){!go&&!t.parent.inlineContent&&(go=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class J extends K{constructor(e,s=e){xo(e),xo(s),super(e,s)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,s){let r=e.resolve(s.map(this.head));if(!r.parent.inlineContent)return K.near(r);let i=e.resolve(s.map(this.anchor));return new J(i.parent.inlineContent?i:r,r)}replace(e,s=L.empty){if(super.replace(e,s),s==L.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof J&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Lr(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,s){if(typeof s.anchor!="number"||typeof s.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new J(e.resolve(s.anchor),e.resolve(s.head))}static create(e,s,r=s){let i=e.resolve(s);return new this(i,r==s?i:e.resolve(r))}static between(e,s,r){let i=e.pos-s.pos;if((!r||i)&&(r=i>=0?1:-1),!s.parent.inlineContent){let a=K.findFrom(s,r,!0)||K.findFrom(s,-r,!0);if(a)s=a.$head;else return K.near(s,r)}return e.parent.inlineContent||(i==0?e=s:(e=(K.findFrom(e,-r,!0)||K.findFrom(e,r,!0)).$anchor,e.pos<s.pos!=i<0&&(e=s))),new J(e,s)}}K.jsonID("text",J);class Lr{constructor(e,s){this.anchor=e,this.head=s}map(e){return new Lr(e.map(this.anchor),e.map(this.head))}resolve(e){return J.between(e.resolve(this.anchor),e.resolve(this.head))}}class B extends K{constructor(e){let s=e.nodeAfter,r=e.node(0).resolve(e.pos+s.nodeSize);super(e,r),this.node=s}map(e,s){let{deleted:r,pos:i}=s.mapResult(this.anchor),a=e.resolve(i);return r?K.near(a):new B(a)}content(){return new L(S.from(this.node),0,0)}eq(e){return e instanceof B&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ka(this.anchor)}static fromJSON(e,s){if(typeof s.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new B(e.resolve(s.anchor))}static create(e,s){return new B(e.resolve(s))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}B.prototype.visible=!1;K.jsonID("node",B);class ka{constructor(e){this.anchor=e}map(e){let{deleted:s,pos:r}=e.mapResult(this.anchor);return s?new Lr(r,r):new ka(r)}resolve(e){let s=e.resolve(this.anchor),r=s.nodeAfter;return r&&B.isSelectable(r)?new B(s):K.near(s)}}class rt extends K{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,s=L.empty){if(s==L.empty){e.delete(0,e.doc.content.size);let r=K.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,s)}toJSON(){return{type:"all"}}static fromJSON(e){return new rt(e)}map(e){return new rt(e)}eq(e){return e instanceof rt}getBookmark(){return J2}}K.jsonID("all",rt);const J2={map(){return this},resolve(t){return new rt(t)}};function Ns(t,e,s,r,i,a=!1){if(e.inlineContent)return J.create(t,s);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let l=e.child(o);if(l.isAtom){if(!a&&B.isSelectable(l))return B.create(t,s-(i<0?l.nodeSize:0))}else{let c=Ns(t,l,s+i,i<0?l.childCount:0,i,a);if(c)return c}s+=l.nodeSize*i}return null}function jo(t,e,s){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Te||i instanceof Ce))return;let a=t.mapping.maps[r],o;a.forEach((l,c,u,h)=>{o==null&&(o=h)}),t.setSelection(K.near(t.doc.resolve(o),s))}const bo=1,Hn=2,yo=4;class G2 extends gd{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|bo)&~Hn,this.storedMarks=null,this}get selectionSet(){return(this.updated&bo)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Hn,this}ensureMarks(e){return ae.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&Hn)>0}addStep(e,s){super.addStep(e,s),this.updated=this.updated&~Hn,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,s=!0){let r=this.selection;return s&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ae.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,s,r){let i=this.doc.type.schema;if(s==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=s),r=r??s,!e)return this.deleteRange(s,r);let a=this.storedMarks;if(!a){let o=this.doc.resolve(s);a=r==s?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(s,r,i.text(e,a)),this.selection.empty||this.setSelection(K.near(this.selection.$to)),this}}setMeta(e,s){return this.meta[typeof e=="string"?e:e.key]=s,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|=yo,this}get scrolledIntoView(){return(this.updated&yo)>0}}function vo(t,e){return!e||!t?t:t.bind(e)}class ln{constructor(e,s,r){this.name=e,this.init=vo(s.init,r),this.apply=vo(s.apply,r)}}const Q2=[new ln("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ln("selection",{init(t,e){return t.selection||K.atStart(e.doc)},apply(t){return t.selection}}),new ln("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,s,r){return r.selection.$cursor?t.storedMarks:null}}),new ln("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Yr{constructor(e,s){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Q2.slice(),s&&s.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new ln(r.key,r.spec.state,r))})}}class Ts{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,s=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=s){let i=this.config.plugins[r];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 s=[e],r=this.applyInner(e),i=null;for(;;){let a=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let c=i?i[o].n:0,u=i?i[o].state:this,h=c<s.length&&l.spec.appendTransaction.call(l,c?s.slice(c):s,u,r);if(h&&r.filterTransaction(h,o)){if(h.setMeta("appendedTransaction",e),!i){i=[];for(let m=0;m<this.config.plugins.length;m++)i.push(m<o?{state:r,n:s.length}:{state:this,n:0})}s.push(h),r=r.applyInner(h),a=!0}i&&(i[o]={state:r,n:s.length})}}if(!a)return{state:r,transactions:s}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let s=new Ts(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let a=r[i];s[a.name]=a.apply(e,this[a.name],this,s)}return s}get tr(){return new G2(this)}static create(e){let s=new Yr(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ts(s);for(let i=0;i<s.fields.length;i++)r[s.fields[i].name]=s.fields[i].init(e,r);return r}reconfigure(e){let s=new Yr(this.schema,e.plugins),r=s.fields,i=new Ts(s);for(let a=0;a<r.length;a++){let o=r[a].name;i[o]=this.hasOwnProperty(o)?this[o]:r[a].init(e,i)}return i}toJSON(e){let s={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(s.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],a=i.spec.state;a&&a.toJSON&&(s[r]=a.toJSON.call(i,this[i.key]))}return s}static fromJSON(e,s,r){if(!s)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Yr(e.schema,e.plugins),a=new Ts(i);return i.fields.forEach(o=>{if(o.name=="doc")a.doc=ps.fromJSON(e.schema,s.doc);else if(o.name=="selection")a.selection=K.fromJSON(a.doc,s.selection);else if(o.name=="storedMarks")s.storedMarks&&(a.storedMarks=s.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let c=r[l],u=c.spec.state;if(c.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(s,l)){a[o.name]=u.fromJSON.call(c,e,s[l],a);return}}a[o.name]=o.init(e,a)}}),a}}function xd(t,e,s){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=xd(i,e,{})),s[r]=i}return s}class ct{constructor(e){this.spec=e,this.props={},e.props&&xd(e.props,this,this.props),this.key=e.key?e.key.key:jd("plugin")}getState(e){return e[this.key]}}const Xr=Object.create(null);function jd(t){return t in Xr?t+"$"+ ++Xr[t]:(Xr[t]=0,t+"$")}class rs{constructor(e="key"){this.key=jd(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Je=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},vn=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Co=null;const Lt=function(t,e,s){let r=Co||(Co=document.createRange());return r.setEnd(t,s??t.nodeValue.length),r.setStart(t,e||0),r},ys=function(t,e,s,r){return s&&(ko(t,e,s,r,-1)||ko(t,e,s,r,1))},Y2=/^(img|br|input|textarea|hr)$/i;function ko(t,e,s,r,i){for(;;){if(t==s&&e==r)return!0;if(e==(i<0?0:bt(t))){let a=t.parentNode;if(!a||a.nodeType!=1||e0(t)||Y2.test(t.nodeName)||t.contentEditable=="false")return!1;e=Je(t)+(i<0?0:1),t=a}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.contentEditable=="false")return!1;e=i<0?bt(t):0}else return!1}}function bt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function X2(t,e,s){for(let r=e==0,i=e==bt(t);r||i;){if(t==s)return!0;let a=Je(t);if(t=t.parentNode,!t)return!1;r=r&&a==0,i=i&&a==bt(t)}}function e0(t){let e;for(let s=t;s&&!(e=s.pmViewDesc);s=s.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Tr=function(t){return t.focusNode&&ys(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function ls(t,e){let s=document.createEvent("Event");return s.initEvent("keydown",!0,!0),s.keyCode=t,s.key=s.code=e,s}function t0(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}const Jt=typeof navigator<"u"?navigator:null,wo=typeof document<"u"?document:null,is=Jt&&Jt.userAgent||"",Ei=/Edge\/(\d+)/.exec(is),bd=/MSIE \d/.exec(is),Di=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(is),Ue=!!(bd||Di||Ei),Ut=bd?document.documentMode:Di?+Di[1]:Ei?+Ei[1]:0,pt=!Ue&&/gecko\/(\d+)/i.test(is);pt&&+(/Firefox\/(\d+)/.exec(is)||[0,0])[1];const Oi=!Ue&&/Chrome\/(\d+)/.exec(is),Pe=!!Oi,s0=Oi?+Oi[1]:0,Fe=!Ue&&!!Jt&&/Apple Computer/.test(Jt.vendor),$s=Fe&&(/Mobile\/\w+/.test(is)||!!Jt&&Jt.maxTouchPoints>2),et=$s||(Jt?/Mac/.test(Jt.platform):!1),dt=/Android \d/.test(is),Ar=!!wo&&"webkitFontSmoothing"in wo.documentElement.style,n0=Ar?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function r0(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Rt(t,e){return typeof t=="number"?t:t[e]}function i0(t){let e=t.getBoundingClientRect(),s=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*s,top:e.top,bottom:e.top+t.clientHeight*r}}function So(t,e,s){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,a=t.dom.ownerDocument;for(let o=s||t.dom;o;o=vn(o)){if(o.nodeType!=1)continue;let l=o,c=l==a.body,u=c?r0(a):i0(l),h=0,m=0;if(e.top<u.top+Rt(r,"top")?m=-(u.top-e.top+Rt(i,"top")):e.bottom>u.bottom-Rt(r,"bottom")&&(m=e.bottom-u.bottom+Rt(i,"bottom")),e.left<u.left+Rt(r,"left")?h=-(u.left-e.left+Rt(i,"left")):e.right>u.right-Rt(r,"right")&&(h=e.right-u.right+Rt(i,"right")),h||m)if(c)a.defaultView.scrollBy(h,m);else{let p=l.scrollLeft,f=l.scrollTop;m&&(l.scrollTop+=m),h&&(l.scrollLeft+=h);let x=l.scrollLeft-p,b=l.scrollTop-f;e={left:e.left-x,top:e.top-b,right:e.right-x,bottom:e.bottom-b}}if(c)break}}function a0(t){let e=t.dom.getBoundingClientRect(),s=Math.max(0,e.top),r,i;for(let a=(e.left+e.right)/2,o=s+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=t.root.elementFromPoint(a,o);if(!l||l==t.dom||!t.dom.contains(l))continue;let c=l.getBoundingClientRect();if(c.top>=s-20){r=l,i=c.top;break}}return{refDOM:r,refTop:i,stack:yd(t.dom)}}function yd(t){let e=[],s=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=s);r=vn(r));return e}function o0({refDOM:t,refTop:e,stack:s}){let r=t?t.getBoundingClientRect().top:0;vd(s,r==0?0:r-e)}function vd(t,e){for(let s=0;s<t.length;s++){let{dom:r,top:i,left:a}=t[s];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=a&&(r.scrollLeft=a)}}let Ms=null;function l0(t){if(t.setActive)return t.setActive();if(Ms)return t.focus(Ms);let e=yd(t);t.focus(Ms==null?{get preventScroll(){return Ms={preventScroll:!0},!0}}:void 0),Ms||(Ms=!1,vd(e,0))}function Cd(t,e){let s,r=2e8,i,a=0,o=e.top,l=e.top;for(let c=t.firstChild,u=0;c;c=c.nextSibling,u++){let h;if(c.nodeType==1)h=c.getClientRects();else if(c.nodeType==3)h=Lt(c).getClientRects();else continue;for(let m=0;m<h.length;m++){let p=h[m];if(p.top<=o&&p.bottom>=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let f=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(f<r){s=c,r=f,i=f&&s.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,c.nodeType==1&&f&&(a=u+(e.left>=(p.left+p.right)/2?1:0));continue}}!s&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(a=u+1)}}return s&&s.nodeType==3?c0(s,i):!s||r&&s.nodeType==1?{node:t,offset:a}:Cd(s,i)}function c0(t,e){let s=t.nodeValue.length,r=document.createRange();for(let i=0;i<s;i++){r.setEnd(t,i+1),r.setStart(t,i);let a=_t(r,1);if(a.top!=a.bottom&&wa(e,a))return{node:t,offset:i+(e.left>=(a.left+a.right)/2?1:0)}}return{node:t,offset:0}}function wa(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function d0(t,e){let s=t.parentNode;return s&&/^li$/i.test(s.nodeName)&&e.left<t.getBoundingClientRect().left?s:t}function u0(t,e,s){let{node:r,offset:i}=Cd(e,s),a=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();a=o.left!=o.right&&s.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,a)}function h0(t,e,s,r){let i=-1;for(let a=e,o=!1;a!=t.dom;){let l=t.docView.nearestDesc(a,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent&&!o||!l.contentDOM)){let c=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&!o&&(o=!0,c.left>r.left||c.top>r.top?i=l.posBefore:(c.right<r.left||c.bottom<r.top)&&(i=l.posAfter)),!l.contentDOM&&i<0)return(l.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?l.posBefore:l.posAfter}a=l.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,s,-1)}function kd(t,e,s){let r=t.childNodes.length;if(r&&s.top<s.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-s.top)/(s.bottom-s.top))-2)),a=i;;){let o=t.childNodes[a];if(o.nodeType==1){let l=o.getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(wa(e,u))return kd(o,e,u)}}if((a=(a+1)%r)==i)break}return t}function m0(t,e){let s=t.dom.ownerDocument,r,i=0;if(s.caretPositionFromPoint)try{let c=s.caretPositionFromPoint(e.left,e.top);c&&({offsetNode:r,offset:i}=c)}catch{}if(!r&&s.caretRangeFromPoint){let c=s.caretRangeFromPoint(e.left,e.top);c&&({startContainer:r,startOffset:i}=c)}let a=(t.root.elementFromPoint?t.root:s).elementFromPoint(e.left,e.top),o;if(!a||!t.dom.contains(a.nodeType!=1?a.parentNode:a)){let c=t.dom.getBoundingClientRect();if(!wa(e,c)||(a=kd(t.dom,e,c),!a))return null}if(Fe)for(let c=a;r&&c;c=vn(c))c.draggable&&(r=void 0);if(a=d0(a,e),r){if(pt&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let c=r.childNodes[i],u;c.nodeName=="IMG"&&(u=c.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&i++}r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?o=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(o=h0(t,r,i,e))}o==null&&(o=u0(t,a,e));let l=t.docView.nearestDesc(a,!0);return{pos:o,inside:l?l.posAtStart-l.border:-1}}function _t(t,e){let s=t.getClientRects();return s.length?s[e<0?0:s.length-1]:t.getBoundingClientRect()}const p0=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function wd(t,e,s){let{node:r,offset:i,atom:a}=t.docView.domFromPos(e,s<0?-1:1),o=Ar||pt;if(r.nodeType==3)if(o&&(p0.test(r.nodeValue)||(s<0?!i:i==r.nodeValue.length))){let c=_t(Lt(r,i,i),s);if(pt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let u=_t(Lt(r,i-1,i-1),-1);if(u.top==c.top){let h=_t(Lt(r,i,i+1),-1);if(h.top!=c.top)return rn(h,h.left<u.left)}}return c}else{let c=i,u=i,h=s<0?1:-1;return s<0&&!i?(u++,h=-1):s>=0&&i==r.nodeValue.length?(c--,h=1):s<0?c--:u++,rn(_t(Lt(r,c,u),1),h<0)}if(!t.state.doc.resolve(e-(a||0)).parent.inlineContent){if(a==null&&i&&(s<0||i==bt(r))){let c=r.childNodes[i-1];if(c.nodeType==1)return ei(c.getBoundingClientRect(),!1)}if(a==null&&i<bt(r)){let c=r.childNodes[i];if(c.nodeType==1)return ei(c.getBoundingClientRect(),!0)}return ei(r.getBoundingClientRect(),s>=0)}if(a==null&&i&&(s<0||i==bt(r))){let c=r.childNodes[i-1],u=c.nodeType==3?Lt(c,bt(c)-(o?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(u)return rn(_t(u,1),!1)}if(a==null&&i<bt(r)){let c=r.childNodes[i];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let u=c?c.nodeType==3?Lt(c,0,o?0:1):c.nodeType==1?c:null:null;if(u)return rn(_t(u,-1),!0)}return rn(_t(r.nodeType==3?Lt(r):r,-s),s>=0)}function rn(t,e){if(t.width==0)return t;let s=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:s,right:s}}function ei(t,e){if(t.height==0)return t;let s=e?t.top:t.bottom;return{top:s,bottom:s,left:t.left,right:t.right}}function Sd(t,e,s){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return s()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function f0(t,e,s){let r=e.selection,i=s=="up"?r.$from:r.$to;return Sd(t,e,()=>{let{node:a}=t.docView.domFromPos(i.pos,s=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(a,!0);if(!l)break;if(l.node.isBlock){a=l.contentDOM||l.dom;break}a=l.dom.parentNode}let o=wd(t,i.pos,1);for(let l=a.firstChild;l;l=l.nextSibling){let c;if(l.nodeType==1)c=l.getClientRects();else if(l.nodeType==3)c=Lt(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<c.length;u++){let h=c[u];if(h.bottom>h.top+1&&(s=="up"?o.top-h.top>(h.bottom-o.top)*2:h.bottom-o.bottom>(o.bottom-h.top)*2))return!1}}return!0})}const g0=/[\u0590-\u08ac]/;function x0(t,e,s){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,l=t.domSelection();return!g0.test(r.parent.textContent)||!l.modify?s=="left"||s=="backward"?a:o:Sd(t,e,()=>{let{focusNode:c,focusOffset:u,anchorNode:h,anchorOffset:m}=t.domSelectionRange(),p=l.caretBidiLevel;l.modify("move",s,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:x,focusOffset:b}=t.domSelectionRange(),y=x&&!f.contains(x.nodeType==1?x:x.parentNode)||c==x&&u==b;try{l.collapse(h,m),c&&(c!=h||u!=m)&&l.extend&&l.extend(c,u)}catch{}return p!=null&&(l.caretBidiLevel=p),y})}let Mo=null,No=null,Lo=!1;function j0(t,e,s){return Mo==e&&No==s?Lo:(Mo=e,No=s,Lo=s=="up"||s=="down"?f0(t,e,s):x0(t,e,s))}const ht=0,To=1,As=2,Mt=3;class Fn{constructor(e,s,r,i){this.parent=e,this.children=s,this.dom=r,this.contentDOM=i,this.dirty=ht,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,s,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let s=0;s<this.children.length;s++)e+=this.children[s].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 s=0,r=this.posAtStart;;s++){let i=this.children[s];if(i==e)return r;r+=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,s,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let a,o;if(e==this.contentDOM)a=e.childNodes[s-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;a=e.previousSibling}for(;a&&!((o=a.pmViewDesc)&&o.parent==this);)a=a.previousSibling;return a?this.posBeforeChild(o)+o.size:this.posAtStart}else{let a,o;if(e==this.contentDOM)a=e.childNodes[s];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;a=e.nextSibling}for(;a&&!((o=a.pmViewDesc)&&o.parent==this);)a=a.nextSibling;return a?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=s>Je(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(s==0)for(let a=e;;a=a.parentNode){if(a==this.dom){i=!1;break}if(a.previousSibling)break}if(i==null&&s==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){i=!0;break}if(a.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,s=!1){for(let r=!0,i=e;i;i=i.parentNode){let a=this.getDesc(i),o;if(a&&(!s||a.node))if(r&&(o=a.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return a}}getDesc(e){let s=e.pmViewDesc;for(let r=s;r;r=r.parent)if(r==this)return s}posFromDOM(e,s,r){for(let i=e;i;i=i.parentNode){let a=this.getDesc(i);if(a)return a.localPosFromDOM(e,s,r)}return-1}descAt(e){for(let s=0,r=0;s<this.children.length;s++){let i=this.children[s],a=r+i.size;if(r==e&&a!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(e<a)return i.descAt(e-r-i.border);r=a}}domFromPos(e,s){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let a=0;r<this.children.length;r++){let o=this.children[r],l=a+o.size;if(l>e||o instanceof Nd){i=e-a;break}a=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,s);for(let a;r&&!(a=this.children[r-1]).size&&a instanceof Md&&a.side>=0;r--);if(s<=0){let a,o=!0;for(;a=r?this.children[r-1]:null,!(!a||a.dom.parentNode==this.contentDOM);r--,o=!1);return a&&s&&o&&!a.border&&!a.domAtom?a.domFromPos(a.size,s):{node:this.contentDOM,offset:a?Je(a.dom)+1:0}}else{let a,o=!0;for(;a=r<this.children.length?this.children[r]:null,!(!a||a.dom.parentNode==this.contentDOM);r++,o=!1);return a&&o&&!a.border&&!a.domAtom?a.domFromPos(0,s):{node:this.contentDOM,offset:a?Je(a.dom):this.contentDOM.childNodes.length}}}parseRange(e,s,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:s,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,a=-1;for(let o=r,l=0;;l++){let c=this.children[l],u=o+c.size;if(i==-1&&e<=u){let h=o+c.border;if(e>=h&&s<=u-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,s,h);e=o;for(let m=l;m>0;m--){let p=this.children[m-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){i=Je(p.dom)+1;break}e-=p.size}i==-1&&(i=0)}if(i>-1&&(u>s||l==this.children.length-1)){s=u;for(let h=l+1;h<this.children.length;h++){let m=this.children[h];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(-1)){a=Je(m.dom);break}s+=m.size}a==-1&&(a=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:e,to:s,fromOffset:i,toOffset:a}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let s=this.children[e<0?0:this.children.length-1];return s.size==0||s.emptyChildAt(e)}domAfterPos(e){let{node:s,offset:r}=this.domFromPos(e,0);if(s.nodeType!=1||r==s.childNodes.length)throw new RangeError("No node after pos "+e);return s.childNodes[r]}setSelection(e,s,r,i=!1){let a=Math.min(e,s),o=Math.max(e,s);for(let p=0,f=0;p<this.children.length;p++){let x=this.children[p],b=f+x.size;if(a>f&&o<b)return x.setSelection(e-f-x.border,s-f-x.border,r,i);f=b}let l=this.domFromPos(e,e?-1:1),c=s==e?l:this.domFromPos(s,s?-1:1),u=r.getSelection(),h=!1;if((pt||Fe)&&e==s){let{node:p,offset:f}=l;if(p.nodeType==3){if(h=!!(f&&p.nodeValue[f-1]==` `),h&&f==p.nodeValue.length)for(let x=p,b;x;x=x.parentNode){if(b=x.nextSibling){b.nodeName=="BR"&&(l=c={node:b.parentNode,offset:Je(b)+1});break}let y=x.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let x=p.childNodes[f-1];h=x&&(x.nodeName=="BR"||x.contentEditable=="false")}}if(pt&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let p=u.focusNode.childNodes[u.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||h&&Fe)&&ys(l.node,l.offset,u.anchorNode,u.anchorOffset)&&ys(c.node,c.offset,u.focusNode,u.focusOffset))return;let m=!1;if((u.extend||e==s)&&!h){u.collapse(l.node,l.offset);try{e!=s&&u.extend(c.node,c.offset),m=!0}catch{}}if(!m){if(e>s){let f=l;l=c,c=f}let p=document.createRange();p.setEnd(c.node,c.offset),p.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,s){for(let r=0,i=0;i<this.children.length;i++){let a=this.children[i],o=r+a.size;if(r==o?e<=o&&s>=r:e<o&&s>r){let l=r+a.border,c=o-a.border;if(e>=l&&s<=c){this.dirty=e==r||s==o?As:To,e==l&&s==c&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=Mt:a.markDirty(e-l,s-l);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?As:Mt}r=o}this.dirty=As}markParentsDirty(){let e=1;for(let s=this.parent;s;s=s.parent,e++){let r=e==1?As:To;s.dirty<r&&(s.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}}class Md extends Fn{constructor(e,s,r,i){let a,o=s.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!a)return i;if(a.parent)return a.parent.posBeforeChild(a)})),!s.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=s,this.widget=s,a=this}matchesWidget(e){return this.dirty==ht&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let s=this.widget.spec.stopEvent;return s?s(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 side(){return this.widget.type.side}}class b0 extends Fn{constructor(e,s,r,i){super(e,[],s,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,s){return e!=this.textDOM?this.posAtStart+(s?this.size:0):this.posAtStart+s}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class vs extends Fn{constructor(e,s,r,i){super(e,[],r,i),this.mark=s}static create(e,s,r,i){let a=i.nodeViews[s.type.name],o=a&&a(s,i,r);return(!o||!o.dom)&&(o=yt.renderSpec(document,s.type.spec.toDOM(s,r))),new vs(e,s,o.dom,o.contentDOM||o.dom)}parseRule(){return this.dirty&Mt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM||void 0}}matchesMark(e){return this.dirty!=Mt&&this.mark.eq(e)}markDirty(e,s){if(super.markDirty(e,s),this.dirty!=ht){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=ht}}slice(e,s,r){let i=vs.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;s<o&&(a=zi(a,s,o,r)),e>0&&(a=zi(a,0,e,r));for(let l=0;l<a.length;l++)a[l].parent=i;return i.children=a,i}}class Cs extends Fn{constructor(e,s,r,i,a,o,l,c,u){super(e,[],a,o),this.node=s,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l,o&&this.updateChildren(c,u)}static create(e,s,r,i,a,o){let l=a.nodeViews[s.type.name],c,u=l&&l(s,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),h=u&&u.dom,m=u&&u.contentDOM;if(s.isText){if(!h)h=document.createTextNode(s.text);else if(h.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else h||({dom:h,contentDOM:m}=yt.renderSpec(document,s.type.spec.toDOM(s)));!m&&!s.isText&&h.nodeName!="BR"&&(h.hasAttribute("contenteditable")||(h.contentEditable="false"),s.type.spec.draggable&&(h.draggable=!0));let p=h;return h=Ad(h,r,s),u?c=new y0(e,s,r,i,h,m||null,p,u,a,o+1):s.isText?new Ir(e,s,r,i,h,p,a):new Cs(e,s,r,i,h,m||null,p,a,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 s=this.children.length-1;s>=0;s--){let r=this.children[s];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>S.empty)}return e}matchesNode(e,s,r){return this.dirty==ht&&e.eq(this.node)&&Fi(s,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,s){let r=this.node.inlineContent,i=s,a=e.composing?this.localCompositionInfo(e,s):null,o=a&&a.pos>-1?a:null,l=a&&a.pos<0,c=new C0(this,o&&o.node,e);S0(this.node,this.innerDeco,(u,h,m)=>{u.spec.marks?c.syncToMarks(u.spec.marks,r,e):u.type.side>=0&&!m&&c.syncToMarks(h==this.node.childCount?ae.none:this.node.child(h).marks,r,e),c.placeWidget(u,e,i)},(u,h,m,p)=>{c.syncToMarks(u.marks,r,e);let f;c.findNodeMatch(u,h,m,p)||l&&e.state.selection.from>i&&e.state.selection.to<i+u.nodeSize&&(f=c.findIndexWithChild(a.node))>-1&&c.updateNodeAt(u,h,m,f,e)||c.updateNextNode(u,h,m,e,p)||c.addNode(u,h,m,e,i),i+=u.nodeSize}),c.syncToMarks([],r,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==As)&&(o&&this.protectLocalComposition(e,o),Ld(this.contentDOM,this.children,e),$s&&M0(this.dom))}localCompositionInfo(e,s){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof J)||r<s||i>s+this.node.content.size)return null;let a=e.domSelectionRange(),o=N0(a.focusNode,a.focusOffset);if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let l=o.nodeValue,c=L0(this.node.content,l,r-s,i-s);return c<0?null:{node:o,pos:c,text:l}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:s,pos:r,text:i}){if(this.getDesc(s))return;let a=s;for(;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&(a.pmViewDesc=void 0)}let o=new b0(this,a,s,i);e.input.compositionNodes.push(o),this.children=zi(this.children,r,r+i.length,e,o)}update(e,s,r,i){return this.dirty==Mt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,s,r,i),!0)}updateInner(e,s,r,i){this.updateOuterDeco(s),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=ht}updateOuterDeco(e){if(Fi(e,this.outerDeco))return;let s=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Td(this.dom,this.nodeDOM,Pi(this.outerDeco,this.node,s),Pi(e,this.node,s)),this.dom!=r&&(r.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.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function Ao(t,e,s,r,i){return Ad(r,e,t),new Cs(void 0,t,e,s,r,r,r,i,0)}class Ir extends Cs{constructor(e,s,r,i,a,o,l){super(e,s,r,i,a,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,s,r,i){return this.dirty==Mt||this.dirty!=ht&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(s),(this.dirty!=ht||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=ht,!0)}inParent(){let e=this.parent.contentDOM;for(let s=this.nodeDOM;s;s=s.parentNode)if(s==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,s,r){return e==this.nodeDOM?this.posAtStart+Math.min(s,this.node.text.length):super.localPosFromDOM(e,s,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,s,r){let i=this.node.cut(e,s),a=document.createTextNode(i.text);return new Ir(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,s){super.markDirty(e,s),this.dom!=this.nodeDOM&&(e==0||s==this.nodeDOM.nodeValue.length)&&(this.dirty=Mt)}get domAtom(){return!1}}class Nd extends Fn{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ht&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class y0 extends Cs{constructor(e,s,r,i,a,o,l,c,u,h){super(e,s,r,i,a,o,l,u,h),this.spec=c}update(e,s,r,i){if(this.dirty==Mt)return!1;if(this.spec.update){let a=this.spec.update(e,s,r);return a&&this.updateInner(e,s,r,i),a}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,s,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,s,r,i){this.spec.setSelection?this.spec.setSelection(e,s,r):super.setSelection(e,s,r,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 Ld(t,e,s){let r=t.firstChild,i=!1;for(let a=0;a<e.length;a++){let o=e[a],l=o.dom;if(l.parentNode==t){for(;l!=r;)r=Io(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(l,r);if(o instanceof vs){let c=r?r.previousSibling:t.lastChild;Ld(o.contentDOM,o.children,s),r=c?c.nextSibling:t.firstChild}}for(;r;)r=Io(r),i=!0;i&&s.trackWrites==t&&(s.trackWrites=null)}const pn=function(t){t&&(this.nodeName=t)};pn.prototype=Object.create(null);const ds=[new pn];function Pi(t,e,s){if(t.length==0)return ds;let r=s?ds[0]:new pn,i=[r];for(let a=0;a<t.length;a++){let o=t[a].type.attrs;if(o){o.nodeName&&i.push(r=new pn(o.nodeName));for(let l in o){let c=o[l];c!=null&&(s&&i.length==1&&i.push(r=new pn(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+c:l=="style"?r.style=(r.style?r.style+";":"")+c:l!="nodeName"&&(r[l]=c))}}}return i}function Td(t,e,s,r){if(s==ds&&r==ds)return e;let i=e;for(let a=0;a<r.length;a++){let o=r[a],l=s[a];if(a){let c;l&&l.nodeName==o.nodeName&&i!=t&&(c=i.parentNode)&&c.nodeName.toLowerCase()==o.nodeName||(c=document.createElement(o.nodeName),c.pmIsDeco=!0,c.appendChild(i),l=ds[0]),i=c}v0(i,l||ds[0],o)}return i}function v0(t,e,s){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in s)&&t.removeAttribute(r);for(let r in s)r!="class"&&r!="style"&&r!="nodeName"&&s[r]!=e[r]&&t.setAttribute(r,s[r]);if(e.class!=s.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=s.class?s.class.split(" ").filter(Boolean):[];for(let a=0;a<r.length;a++)i.indexOf(r[a])==-1&&t.classList.remove(r[a]);for(let a=0;a<i.length;a++)r.indexOf(i[a])==-1&&t.classList.add(i[a]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=s.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}s.style&&(t.style.cssText+=s.style)}}function Ad(t,e,s){return Td(t,t,ds,Pi(e,s,t.nodeType!=1))}function Fi(t,e){if(t.length!=e.length)return!1;for(let s=0;s<t.length;s++)if(!t[s].type.eq(e[s].type))return!1;return!0}function Io(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class C0{constructor(e,s,r){this.lock=s,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=k0(e.node.content,e)}destroyBetween(e,s){if(e!=s){for(let r=e;r<s;r++)this.top.children[r].destroy();this.top.children.splice(e,s-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,s,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=ht,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let c=this.index;c<Math.min(this.index+3,this.top.children.length);c++){let u=this.top.children[c];if(u.matchesMark(e[a])&&!this.isLocked(u.dom)){l=c;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let c=vs.create(this.top,e[a],s,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,a++}}findNodeMatch(e,s,r,i){let a=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,s,r))a=this.top.children.indexOf(o,this.index);else for(let l=this.index,c=Math.min(this.top.children.length,l+5);l<c;l++){let u=this.top.children[l];if(u.matchesNode(e,s,r)&&!this.preMatch.matched.has(u)){a=l;break}}return a<0?!1:(this.destroyBetween(this.index,a),this.index++,!0)}updateNodeAt(e,s,r,i,a){let o=this.top.children[i];return o.dirty==Mt&&o.dom==o.contentDOM&&(o.dirty=As),o.update(e,s,r,a)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let s=e.parentNode;if(!s)return-1;if(s==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=s}}updateNextNode(e,s,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let l=this.top.children[o];if(l instanceof Cs){let c=this.preMatch.matched.get(l);if(c!=null&&c!=a)return!1;let u=l.dom;if(!(this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Mt&&Fi(s,l.outerDeco)))&&l.update(e,s,r,i))return this.destroyBetween(this.index,o),l.dom!=u&&(this.changed=!0),this.index++,!0;break}}return!1}addNode(e,s,r,i,a){this.top.children.splice(this.index++,0,Cs.create(this.top,e,s,r,i,a)),this.changed=!0}placeWidget(e,s,r){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 a=new Md(this.top,e,s,r);this.top.children.splice(this.index++,0,a),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],s=this.top;for(;e instanceof vs;)s=e,e=s.children[s.children.length-1];(!e||!(e instanceof Ir)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Fe||Pe)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",s),this.addHackNode("BR",this.top))}addHackNode(e,s){if(s==this.top&&this.index<s.children.length&&s.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new Nd(this.top,[],r,null);s!=this.top?s.children.push(i):s.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 k0(t,e){let s=e,r=s.children.length,i=t.childCount,a=new Map,o=[];e:for(;i>0;){let l;for(;;)if(r){let u=s.children[r-1];if(u instanceof vs)s=u,r=u.children.length;else{l=u,r--;break}}else{if(s==e)break e;r=s.parent.children.indexOf(s),s=s.parent}let c=l.node;if(c){if(c!=t.child(i-1))break;--i,a.set(l,i),o.push(l)}}return{index:i,matched:a,matches:o.reverse()}}function w0(t,e){return t.type.side-e.type.side}function S0(t,e,s,r){let i=e.locals(t),a=0;if(i.length==0){for(let u=0;u<t.childCount;u++){let h=t.child(u);r(h,i,e.forChild(a,h),u),a+=h.nodeSize}return}let o=0,l=[],c=null;for(let u=0;;){if(o<i.length&&i[o].to==a){let x=i[o++],b;for(;o<i.length&&i[o].to==a;)(b||(b=[x])).push(i[o++]);if(b){b.sort(w0);for(let y=0;y<b.length;y++)s(b[y],u,!!c)}else s(x,u,!!c)}let h,m;if(c)m=-1,h=c,c=null;else if(u<t.childCount)m=u,h=t.child(u++);else break;for(let x=0;x<l.length;x++)l[x].to<=a&&l.splice(x--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)l.push(i[o++]);let p=a+h.nodeSize;if(h.isText){let x=p;o<i.length&&i[o].from<x&&(x=i[o].from);for(let b=0;b<l.length;b++)l[b].to<x&&(x=l[b].to);x<p&&(c=h.cut(x-a),h=h.cut(0,x-a),p=x,m=-1)}let f=h.isInline&&!h.isLeaf?l.filter(x=>!x.inline):l.slice();r(h,f,e.forChild(a,h),m),a=p}}function M0(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function N0(t,e){for(;;){if(t.nodeType==3)return t;if(t.nodeType==1&&e>0){if(t.childNodes.length>e&&t.childNodes[e].nodeType==3)return t.childNodes[e];t=t.childNodes[e-1],e=bt(t)}else if(t.nodeType==1&&e<t.childNodes.length)t=t.childNodes[e],e=0;else return null}}function L0(t,e,s,r){for(let i=0,a=0;i<t.childCount&&a<=r;){let o=t.child(i++),l=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<t.childCount;){let u=t.child(i++);if(a+=u.nodeSize,!u.isText)break;c+=u.text}if(a>=s){let u=l<r?c.lastIndexOf(e,r-l-1):-1;if(u>=0&&u+e.length+l>=s)return l+u;if(s==r&&c.length>=r+e.length-l&&c.slice(r-l,r-l+e.length)==e)return r}}return-1}function zi(t,e,s,r,i){let a=[];for(let o=0,l=0;o<t.length;o++){let c=t[o],u=l,h=l+=c.size;u>=s||h<=e?a.push(c):(u<e&&a.push(c.slice(0,e-u,r)),i&&(a.push(i),i=void 0),h>s&&a.push(c.slice(s-u,c.size,r)))}return a}function Sa(t,e=null){let s=t.domSelectionRange(),r=t.state.doc;if(!s.focusNode)return null;let i=t.docView.nearestDesc(s.focusNode),a=i&&i.size==0,o=t.docView.posFromDOM(s.focusNode,s.focusOffset,1);if(o<0)return null;let l=r.resolve(o),c,u;if(Tr(s)){for(c=l;i&&!i.node;)i=i.parent;let h=i.node;if(i&&h.isAtom&&B.isSelectable(h)&&i.parent&&!(h.isInline&&X2(s.focusNode,s.focusOffset,i.dom))){let m=i.posBefore;u=new B(o==m?l:r.resolve(m))}}else{let h=t.docView.posFromDOM(s.anchorNode,s.anchorOffset,1);if(h<0)return null;c=r.resolve(h)}if(!u){let h=e=="pointer"||t.state.selection.head<l.pos&&!a?1:-1;u=Ma(t,c,l,h)}return u}function Id(t){return t.editable?t.hasFocus():Dd(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Et(t,e=!1){let s=t.state.selection;if(Ed(t,s),!!Id(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Pe){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&ys(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)A0(t);else{let{anchor:r,head:i}=s,a,o;Eo&&!(s instanceof J)&&(s.$from.parent.inlineContent||(a=Do(t,s.from)),!s.empty&&!s.$from.parent.inlineContent&&(o=Do(t,s.to))),t.docView.setSelection(r,i,t.root,e),Eo&&(a&&Oo(a),o&&Oo(o)),s.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&T0(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Eo=Fe||Pe&&s0<63;function Do(t,e){let{node:s,offset:r}=t.docView.domFromPos(e,0),i=r<s.childNodes.length?s.childNodes[r]:null,a=r?s.childNodes[r-1]:null;if(Fe&&i&&i.contentEditable=="false")return ti(i);if((!i||i.contentEditable=="false")&&(!a||a.contentEditable=="false")){if(i)return ti(i);if(a)return ti(a)}}function ti(t){return t.contentEditable="true",Fe&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Oo(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function T0(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let s=t.domSelectionRange(),r=s.anchorNode,i=s.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(s.anchorNode!=r||s.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Id(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function A0(t){let e=t.domSelection(),s=document.createRange(),r=t.cursorWrapper.dom,i=r.nodeName=="IMG";i?s.setEnd(r.parentNode,Je(r)+1):s.setEnd(r,0),s.collapse(!1),e.removeAllRanges(),e.addRange(s),!i&&!t.state.selection.visible&&Ue&&Ut<=11&&(r.disabled=!0,r.disabled=!1)}function Ed(t,e){if(e instanceof B){let s=t.docView.descAt(e.from);s!=t.lastSelectedViewDesc&&(Po(t),s&&s.selectNode(),t.lastSelectedViewDesc=s)}else Po(t)}function Po(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Ma(t,e,s,r){return t.someProp("createSelectionBetween",i=>i(t,e,s))||J.between(e,s,r)}function Fo(t){return t.editable&&!t.hasFocus()?!1:Dd(t)}function Dd(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function I0(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),s=t.domSelectionRange();return ys(e.node,e.offset,s.anchorNode,s.anchorOffset)}function Ri(t,e){let{$anchor:s,$head:r}=t.selection,i=e>0?s.max(r):s.min(r),a=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return a&&K.findFrom(a,e)}function cs(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function zo(t,e,s){let r=t.state.selection;if(r instanceof J){if(!r.empty||s.indexOf("s")>-1)return!1;if(t.endOfTextblock(e>0?"right":"left")){let i=Ri(t.state,e);return i&&i instanceof B?cs(t,i):!1}else if(!(et&&s.indexOf("m")>-1)){let i=r.$head,a=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!a||a.isText)return!1;let l=e<0?i.pos-a.nodeSize:i.pos;return a.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?B.isSelectable(a)?cs(t,new B(e<0?t.state.doc.resolve(i.pos-a.nodeSize):i)):Ar?cs(t,new J(t.state.doc.resolve(e<0?l:l+a.nodeSize))):!1:!1}}else{if(r instanceof B&&r.node.isInline)return cs(t,new J(e>0?r.$to:r.$from));{let i=Ri(t.state,e);return i?cs(t,i):!1}}}function ir(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function fn(t){let e=t.pmViewDesc;return e&&e.size==0&&(t.nextSibling||t.nodeName!="BR")}function si(t){let e=t.domSelectionRange(),s=e.focusNode,r=e.focusOffset;if(!s)return;let i,a,o=!1;for(pt&&s.nodeType==1&&r<ir(s)&&fn(s.childNodes[r])&&(o=!0);;)if(r>0){if(s.nodeType!=1)break;{let l=s.childNodes[r-1];if(fn(l))i=s,a=--r;else if(l.nodeType==3)s=l,r=s.nodeValue.length;else break}}else{if(Od(s))break;{let l=s.previousSibling;for(;l&&fn(l);)i=s.parentNode,a=Je(l),l=l.previousSibling;if(l)s=l,r=ir(s);else{if(s=s.parentNode,s==t.dom)break;r=0}}}o?_i(t,s,r):i&&_i(t,i,a)}function ni(t){let e=t.domSelectionRange(),s=e.focusNode,r=e.focusOffset;if(!s)return;let i=ir(s),a,o;for(;;)if(r<i){if(s.nodeType!=1)break;let l=s.childNodes[r];if(fn(l))a=s,o=++r;else break}else{if(Od(s))break;{let l=s.nextSibling;for(;l&&fn(l);)a=l.parentNode,o=Je(l)+1,l=l.nextSibling;if(l)s=l,r=0,i=ir(s);else{if(s=s.parentNode,s==t.dom)break;r=i=0}}}a&&_i(t,a,o)}function Od(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function _i(t,e,s){let r=t.domSelection();if(Tr(r)){let a=document.createRange();a.setEnd(e,s),a.setStart(e,s),r.removeAllRanges(),r.addRange(a)}else r.extend&&r.extend(e,s);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Et(t)},50)}function Ro(t,e,s){let r=t.state.selection;if(r instanceof J&&!r.empty||s.indexOf("s")>-1||et&&s.indexOf("m")>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Ri(t.state,e);if(o&&o instanceof B)return cs(t,o)}if(!i.parent.inlineContent){let o=e<0?i:a,l=r instanceof rt?K.near(o,e):K.findFrom(o,e);return l?cs(t,l):!1}return!1}function _o(t,e){if(!(t.state.selection instanceof J))return!0;let{$head:s,$anchor:r,empty:i}=t.state.selection;if(!s.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let a=!s.textOffset&&(e<0?s.nodeBefore:s.nodeAfter);if(a&&!a.isText){let o=t.state.tr;return e<0?o.delete(s.pos-a.nodeSize,s.pos):o.delete(s.pos,s.pos+a.nodeSize),t.dispatch(o),!0}return!1}function Bo(t,e,s){t.domObserver.stop(),e.contentEditable=s,t.domObserver.start()}function E0(t){if(!Fe||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:s}=t.domSelectionRange();if(e&&e.nodeType==1&&s==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Bo(t,r,"true"),setTimeout(()=>Bo(t,r,"false"),20)}return!1}function D0(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function O0(t,e){let s=e.keyCode,r=D0(e);return s==8||et&&s==72&&r=="c"?_o(t,-1)||si(t):s==46||et&&s==68&&r=="c"?_o(t,1)||ni(t):s==13||s==27?!0:s==37||et&&s==66&&r=="c"?zo(t,-1,r)||si(t):s==39||et&&s==70&&r=="c"?zo(t,1,r)||ni(t):s==38||et&&s==80&&r=="c"?Ro(t,-1,r)||si(t):s==40||et&&s==78&&r=="c"?E0(t)||Ro(t,1,r)||ni(t):r==(et?"m":"c")&&(s==66||s==73||s==89||s==90)}function Pd(t,e){t.someProp("transformCopied",f=>{e=f(e,t)});let s=[],{content:r,openStart:i,openEnd:a}=e;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let f=r.firstChild;s.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=t.someProp("clipboardSerializer")||yt.fromSchema(t.state.schema),l=Vd(),c=l.createElement("div");c.appendChild(o.serializeFragment(r,{document:l}));let u=c.firstChild,h,m=0;for(;u&&u.nodeType==1&&(h=Bd[u.nodeName.toLowerCase()]);){for(let f=h.length-1;f>=0;f--){let x=l.createElement(h[f]);for(;c.firstChild;)x.appendChild(c.firstChild);c.appendChild(x),m++}u=c.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${a}${m?` -${m}`:""} ${JSON.stringify(s)}`);let p=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,` `);return{dom:c,text:p}}function Fd(t,e,s,r,i){let a=i.parent.type.spec.code,o,l;if(!s&&!e)return null;let c=e&&(r||a||!s);if(c){if(t.someProp("transformPastedText",p=>{e=p(e,a||r,t)}),a)return e?new L(S.from(t.state.schema.text(e.replace(/\r\n?/g,` `))),0,0):L.empty;let m=t.someProp("clipboardTextParser",p=>p(e,i,r,t));if(m)l=m;else{let p=i.marks(),{schema:f}=t.state,x=yt.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(b=>{let y=o.appendChild(document.createElement("p"));b&&y.appendChild(x.serializeNode(f.text(b,p)))})}}else t.someProp("transformPastedHTML",m=>{s=m(s,t)}),o=z0(s),Ar&&R0(o);let u=o&&o.querySelector("[data-pm-slice]"),h=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let m=+h[3];m>0;m--){let p=o.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;o=p}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||_s.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||h),context:i,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!P0.test(p.parentNode.nodeName)?{ignore:!0}:null}})),h)l=_0(Vo(l,+h[1],+h[2]),h[4]);else if(l=L.maxOpen(F0(l.content,i),!0),l.openStart||l.openEnd){let m=0,p=0;for(let f=l.content.firstChild;m<l.openStart&&!f.type.spec.isolating;m++,f=f.firstChild);for(let f=l.content.lastChild;p<l.openEnd&&!f.type.spec.isolating;p++,f=f.lastChild);l=Vo(l,m,p)}return t.someProp("transformPasted",m=>{l=m(l,t)}),l}const P0=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function F0(t,e){if(t.childCount<2)return t;for(let s=e.depth;s>=0;s--){let i=e.node(s).contentMatchAt(e.index(s)),a,o=[];if(t.forEach(l=>{if(!o)return;let c=i.findWrapping(l.type),u;if(!c)return o=null;if(u=o.length&&a.length&&Rd(c,a,l,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=_d(o[o.length-1],a.length));let h=zd(l,c);o.push(h),i=i.matchType(h.type),a=c}}),o)return S.from(o)}return t}function zd(t,e,s=0){for(let r=e.length-1;r>=s;r--)t=e[r].create(null,S.from(t));return t}function Rd(t,e,s,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let a=Rd(t,e,s,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?s.type:t[i+1]))return r.copy(r.content.append(S.from(zd(s,t,i+1))))}}function _d(t,e){if(e==0)return t;let s=t.content.replaceChild(t.childCount-1,_d(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(S.empty,!0);return t.copy(s.append(r))}function Bi(t,e,s,r,i,a){let o=e<0?t.firstChild:t.lastChild,l=o.content;return i<r-1&&(l=Bi(l,e,s,r,i+1,a)),i>=s&&(l=e<0?o.contentMatchAt(0).fillBefore(l,t.childCount>1||a<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(S.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function Vo(t,e,s){return e<t.openStart&&(t=new L(Bi(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),s<t.openEnd&&(t=new L(Bi(t.content,1,s,t.openEnd,0,0),t.openStart,s)),t}const Bd={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 $o=null;function Vd(){return $o||($o=document.implementation.createHTMLDocument("title"))}function z0(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let s=Vd().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Bd[r[1].toLowerCase()])&&(t=i.map(a=>"<"+a+">").join("")+t+i.map(a=>"</"+a+">").reverse().join("")),s.innerHTML=t,i)for(let a=0;a<i.length;a++)s=s.querySelector(i[a])||s;return s}function R0(t){let e=t.querySelectorAll(Pe?"span:not([class]):not([style])":"span.Apple-converted-space");for(let s=0;s<e.length;s++){let r=e[s];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function _0(t,e){if(!t.size)return t;let s=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:a,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let c=s.nodes[r[l]];if(!c||c.hasRequiredAttrs())break;i=S.from(c.create(r[l+1],i)),a++,o++}return new L(i,a,o)}const ze={},Re={},B0={touchstart:!0,touchmove:!0};class V0{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function $0(t){for(let e in ze){let s=ze[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{q0(t,r)&&!Na(t,r)&&(t.editable||!(r.type in Re))&&s(t,r)},B0[e]?{passive:!0}:void 0)}Fe&&t.dom.addEventListener("input",()=>null),Vi(t)}function qt(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function H0(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Vi(t){t.someProp("handleDOMEvents",e=>{for(let s in e)t.input.eventHandlers[s]||t.dom.addEventListener(s,t.input.eventHandlers[s]=r=>Na(t,r))})}function Na(t,e){return t.someProp("handleDOMEvents",s=>{let r=s[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function q0(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let s=e.target;s!=t.dom;s=s.parentNode)if(!s||s.nodeType==11||s.pmViewDesc&&s.pmViewDesc.stopEvent(e))return!1;return!0}function U0(t,e){!Na(t,e)&&ze[e.type]&&(t.editable||!(e.type in Re))&&ze[e.type](t,e)}Re.keydown=(t,e)=>{let s=e;if(t.input.shiftKey=s.keyCode==16||s.shiftKey,!Hd(t,s)&&(t.input.lastKeyCode=s.keyCode,t.input.lastKeyCodeTime=Date.now(),!(dt&&Pe&&s.keyCode==13)))if(s.keyCode!=229&&t.domObserver.forceFlush(),$s&&s.keyCode==13&&!s.ctrlKey&&!s.altKey&&!s.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,ls(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,s))||O0(t,s)?s.preventDefault():qt(t,"key")};Re.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Re.keypress=(t,e)=>{let s=e;if(Hd(t,s)||!s.charCode||s.ctrlKey&&!s.altKey||et&&s.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,s))){s.preventDefault();return}let r=t.state.selection;if(!(r instanceof J)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(s.charCode);!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",a=>a(t,r.$from.pos,r.$to.pos,i))&&t.dispatch(t.state.tr.insertText(i).scrollIntoView()),s.preventDefault()}};function Er(t){return{left:t.clientX,top:t.clientY}}function W0(t,e){let s=e.x-t.clientX,r=e.y-t.clientY;return s*s+r*r<100}function La(t,e,s,r,i){if(r==-1)return!1;let a=t.state.doc.resolve(r);for(let o=a.depth+1;o>0;o--)if(t.someProp(e,l=>o>a.depth?l(t,s,a.nodeAfter,a.before(o),i,!0):l(t,s,a.node(o),a.before(o),i,!1)))return!0;return!1}function zs(t,e,s){t.focused||t.focus();let r=t.state.tr.setSelection(e);s=="pointer"&&r.setMeta("pointer",!0),t.dispatch(r)}function Z0(t,e){if(e==-1)return!1;let s=t.state.doc.resolve(e),r=s.nodeAfter;return r&&r.isAtom&&B.isSelectable(r)?(zs(t,new B(s),"pointer"),!0):!1}function K0(t,e){if(e==-1)return!1;let s=t.state.selection,r,i;s instanceof B&&(r=s.node);let a=t.state.doc.resolve(e);for(let o=a.depth+1;o>0;o--){let l=o>a.depth?a.nodeAfter:a.node(o);if(B.isSelectable(l)){r&&s.$from.depth>0&&o>=s.$from.depth&&a.before(s.$from.depth+1)==s.$from.pos?i=a.before(s.$from.depth):i=a.before(o);break}}return i!=null?(zs(t,B.create(t.state.doc,i),"pointer"),!0):!1}function J0(t,e,s,r,i){return La(t,"handleClickOn",e,s,r)||t.someProp("handleClick",a=>a(t,e,r))||(i?K0(t,s):Z0(t,s))}function G0(t,e,s,r){return La(t,"handleDoubleClickOn",e,s,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function Q0(t,e,s,r){return La(t,"handleTripleClickOn",e,s,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||Y0(t,s,r)}function Y0(t,e,s){if(s.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(zs(t,J.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(e);for(let a=i.depth+1;a>0;a--){let o=a>i.depth?i.nodeAfter:i.node(a),l=i.before(a);if(o.inlineContent)zs(t,J.create(r,l+1,l+1+o.content.size),"pointer");else if(B.isSelectable(o))zs(t,B.create(r,l),"pointer");else continue;return!0}}function Ta(t){return ar(t)}const $d=et?"metaKey":"ctrlKey";ze.mousedown=(t,e)=>{let s=e;t.input.shiftKey=s.shiftKey;let r=Ta(t),i=Date.now(),a="singleClick";i-t.input.lastClick.time<500&&W0(s,t.input.lastClick)&&!s[$d]&&(t.input.lastClick.type=="singleClick"?a="doubleClick":t.input.lastClick.type=="doubleClick"&&(a="tripleClick")),t.input.lastClick={time:i,x:s.clientX,y:s.clientY,type:a};let o=t.posAtCoords(Er(s));o&&(a=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new X0(t,o,s,!!r)):(a=="doubleClick"?G0:Q0)(t,o.pos,o.inside,s)?s.preventDefault():qt(t,"pointer"))};class X0{constructor(e,s,r,i){this.view=e,this.pos=s,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[$d],this.allowDefault=r.shiftKey;let a,o;if(s.inside>-1)a=e.state.doc.nodeAt(s.inside),o=s.inside;else{let h=e.state.doc.resolve(s.pos);a=h.parent,o=h.depth?h.before():0}const l=i?null:r.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c?c.dom:null;let{selection:u}=e.state;(r.button==0&&a.type.spec.draggable&&a.type.spec.selectable!==!1||u instanceof B&&u.from<=o&&u.to>o)&&(this.mightDrag={node:a,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&pt&&!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)),qt(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(()=>Et(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let s=this.pos;this.view.state.doc!=this.startDoc&&(s=this.view.posAtCoords(Er(e))),this.updateAllowDefault(e),this.allowDefault||!s?qt(this.view,"pointer"):J0(this.view,s.pos,s.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Fe&&this.mightDrag&&!this.mightDrag.node.isAtom||Pe&&!this.view.state.selection.visible&&Math.min(Math.abs(s.pos-this.view.state.selection.from),Math.abs(s.pos-this.view.state.selection.to))<=2)?(zs(this.view,K.near(this.view.state.doc.resolve(s.pos)),"pointer"),e.preventDefault()):qt(this.view,"pointer")}move(e){this.updateAllowDefault(e),qt(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)}}ze.touchstart=t=>{t.input.lastTouch=Date.now(),Ta(t),qt(t,"pointer")};ze.touchmove=t=>{t.input.lastTouch=Date.now(),qt(t,"pointer")};ze.contextmenu=t=>Ta(t);function Hd(t,e){return t.composing?!0:Fe&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const ej=dt?5e3:-1;Re.compositionstart=Re.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,s=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!s.textOffset&&s.parentOffset&&s.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||s.marks(),ar(t,!0),t.markCursor=null;else if(ar(t),pt&&e.selection.empty&&s.parentOffset&&!s.textOffset&&s.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,a=r.focusOffset;i&&i.nodeType==1&&a!=0;){let o=a<0?i.lastChild:i.childNodes[a-1];if(!o)break;if(o.nodeType==3){t.domSelection().collapse(o,o.nodeValue.length);break}else i=o,a=-1}}t.input.composing=!0}qd(t,ej)};Re.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,qd(t,20))};function qd(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ar(t),e))}function Ud(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=tj());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function tj(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ar(t,e=!1){if(!(dt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Ud(t),e||t.docView&&t.docView.dirty){let s=Sa(t);return s&&!s.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(s)):t.updateState(t.state),!0}return!1}}function sj(t,e){if(!t.dom.parentNode)return;let s=t.dom.parentNode.appendChild(document.createElement("div"));s.appendChild(e),s.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{s.parentNode&&s.parentNode.removeChild(s),t.focus()},50)}const Hs=Ue&&Ut<15||$s&&n0<604;ze.copy=Re.cut=(t,e)=>{let s=e,r=t.state.selection,i=s.type=="cut";if(r.empty)return;let a=Hs?null:s.clipboardData,o=r.content(),{dom:l,text:c}=Pd(t,o);a?(s.preventDefault(),a.clearData(),a.setData("text/html",l.innerHTML),a.setData("text/plain",c)):sj(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function nj(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function rj(t,e){if(!t.dom.parentNode)return;let s=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(s?"textarea":"div"));s||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),s?Cn(t,r.value,null,t.input.shiftKey,e):Cn(t,r.textContent,r.innerHTML,t.input.shiftKey,e)},50)}function Cn(t,e,s,r,i){let a=Fd(t,e,s,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,i,a||L.empty)))return!0;if(!a)return!1;let o=nj(a),l=o?t.state.tr.replaceSelectionWith(o,t.input.shiftKey):t.state.tr.replaceSelection(a);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}Re.paste=(t,e)=>{let s=e;if(t.composing&&!dt)return;let r=Hs?null:s.clipboardData;r&&Cn(t,r.getData("text/plain"),r.getData("text/html"),t.input.shiftKey,s)?s.preventDefault():rj(t,s)};class ij{constructor(e,s){this.slice=e,this.move=s}}const Wd=et?"altKey":"ctrlKey";ze.dragstart=(t,e)=>{let s=e,r=t.input.mouseDown;if(r&&r.done(),!s.dataTransfer)return;let i=t.state.selection,a=i.empty?null:t.posAtCoords(Er(s));if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof B?i.to-1:i.to))){if(r&&r.mightDrag)t.dispatch(t.state.tr.setSelection(B.create(t.state.doc,r.mightDrag.pos)));else if(s.target&&s.target.nodeType==1){let u=t.docView.nearestDesc(s.target,!0);u&&u.node.type.spec.draggable&&u!=t.docView&&t.dispatch(t.state.tr.setSelection(B.create(t.state.doc,u.posBefore)))}}let o=t.state.selection.content(),{dom:l,text:c}=Pd(t,o);s.dataTransfer.clearData(),s.dataTransfer.setData(Hs?"Text":"text/html",l.innerHTML),s.dataTransfer.effectAllowed="copyMove",Hs||s.dataTransfer.setData("text/plain",c),t.dragging=new ij(o,!s[Wd])};ze.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Re.dragover=Re.dragenter=(t,e)=>e.preventDefault();Re.drop=(t,e)=>{let s=e,r=t.dragging;if(t.dragging=null,!s.dataTransfer)return;let i=t.posAtCoords(Er(s));if(!i)return;let a=t.state.doc.resolve(i.pos),o=r&&r.slice;o?t.someProp("transformPasted",x=>{o=x(o,t)}):o=Fd(t,s.dataTransfer.getData(Hs?"Text":"text/plain"),Hs?null:s.dataTransfer.getData("text/html"),!1,a);let l=!!(r&&!s[Wd]);if(t.someProp("handleDrop",x=>x(t,s,o||L.empty,l))){s.preventDefault();return}if(!o)return;s.preventDefault();let c=o?ud(t.state.doc,a.pos,o):a.pos;c==null&&(c=a.pos);let u=t.state.tr;l&&u.deleteSelection();let h=u.mapping.map(c),m=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,p=u.doc;if(m?u.replaceRangeWith(h,h,o.content.firstChild):u.replaceRange(h,h,o),u.doc.eq(p))return;let f=u.doc.resolve(h);if(m&&B.isSelectable(o.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(o.content.firstChild))u.setSelection(new B(f));else{let x=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((b,y,k,M)=>x=M),u.setSelection(Ma(t,f,u.doc.resolve(x)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))};ze.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Et(t)},20))};ze.blur=(t,e)=>{let s=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),s.relatedTarget&&t.dom.contains(s.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};ze.beforeinput=(t,e)=>{if(Pe&&dt&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",a=>a(t,ls(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Re)ze[t]=Re[t];function kn(t,e){if(t==e)return!0;for(let s in t)if(t[s]!==e[s])return!1;for(let s in e)if(!(s in t))return!1;return!0}class Aa{constructor(e,s){this.toDOM=e,this.spec=s||fs,this.side=this.spec.side||0}map(e,s,r,i){let{pos:a,deleted:o}=e.mapResult(s.from+i,this.side<0?-1:1);return o?null:new st(a-r,a-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Aa&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&kn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Wt{constructor(e,s){this.attrs=e,this.spec=s||fs}map(e,s,r,i){let a=e.map(s.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(s.to+i,this.spec.inclusiveEnd?1:-1)-r;return a>=o?null:new st(a,o,this)}valid(e,s){return s.from<s.to}eq(e){return this==e||e instanceof Wt&&kn(this.attrs,e.attrs)&&kn(this.spec,e.spec)}static is(e){return e.type instanceof Wt}destroy(){}}class Ia{constructor(e,s){this.attrs=e,this.spec=s||fs}map(e,s,r,i){let a=e.mapResult(s.from+i,1);if(a.deleted)return null;let o=e.mapResult(s.to+i,-1);return o.deleted||o.pos<=a.pos?null:new st(a.pos-r,o.pos-r,this)}valid(e,s){let{index:r,offset:i}=e.content.findIndex(s.from),a;return i==s.from&&!(a=e.child(r)).isText&&i+a.nodeSize==s.to}eq(e){return this==e||e instanceof Ia&&kn(this.attrs,e.attrs)&&kn(this.spec,e.spec)}destroy(){}}class st{constructor(e,s,r){this.from=e,this.to=s,this.type=r}copy(e,s){return new st(e,s,this.type)}eq(e,s=0){return this.type.eq(e.type)&&this.from+s==e.from&&this.to+s==e.to}map(e,s,r){return this.type.map(e,this,s,r)}static widget(e,s,r){return new st(e,e,new Aa(s,r))}static inline(e,s,r,i){return new st(e,s,new Wt(r,i))}static node(e,s,r,i){return new st(e,s,new Ia(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Wt}}const Ls=[],fs={};class be{constructor(e,s){this.local=e.length?e:Ls,this.children=s.length?s:Ls}static create(e,s){return s.length?or(s,e,0,fs):Le}find(e,s,r){let i=[];return this.findInner(e??0,s??1e9,i,0,r),i}findInner(e,s,r,i,a){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=s&&l.to>=e&&(!a||a(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<s&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,s-l,r,i+l,a)}}map(e,s,r){return this==Le||e.maps.length==0?this:this.mapInner(e,s,0,0,r||fs)}mapInner(e,s,r,i,a){let o;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,r,i);c&&c.type.valid(s,c)?(o||(o=[])).push(c):a.onRemove&&a.onRemove(this.local[l].spec)}return this.children.length?aj(this.children,o||[],e,s,r,i,a):o?new be(o.sort(gs),Ls):Le}add(e,s){return s.length?this==Le?be.create(e,s):this.addInner(e,s,0):this}addInner(e,s,r){let i,a=0;e.forEach((l,c)=>{let u=c+r,h;if(h=Kd(s,l,u)){for(i||(i=this.children.slice());a<i.length&&i[a]<c;)a+=3;i[a]==c?i[a+2]=i[a+2].addInner(l,h,u+1):i.splice(a,0,c,c+l.nodeSize,or(h,l,u+1,fs)),a+=3}});let o=Zd(a?Jd(s):s,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new be(o.length?this.local.concat(o).sort(gs):this.local,i||this.children)}remove(e){return e.length==0||this==Le?this:this.removeInner(e,0)}removeInner(e,s){let r=this.children,i=this.local;for(let a=0;a<r.length;a+=3){let o,l=r[a]+s,c=r[a+1]+s;for(let h=0,m;h<e.length;h++)(m=e[h])&&m.from>l&&m.to<c&&(e[h]=null,(o||(o=[])).push(m));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[a+2].removeInner(o,l+1);u!=Le?r[a+2]=u:(r.splice(a,3),a-=3)}if(i.length){for(let a=0,o;a<e.length;a++)if(o=e[a])for(let l=0;l<i.length;l++)i[l].eq(o,s)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new be(i,r):Le}forChild(e,s){if(this==Le)return this;if(s.isLeaf)return be.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let a=e+1,o=a+s.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<o&&c.to>a&&c.type instanceof Wt){let u=Math.max(a,c.from)-a,h=Math.min(o,c.to)-a;u<h&&(i||(i=[])).push(c.copy(u,h))}}if(i){let l=new be(i.sort(gs),Ls);return r?new Vt([l,r]):l}return r||Le}eq(e){if(this==e)return!0;if(!(e instanceof be)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let s=0;s<this.local.length;s++)if(!this.local[s].eq(e.local[s]))return!1;for(let s=0;s<this.children.length;s+=3)if(this.children[s]!=e.children[s]||this.children[s+1]!=e.children[s+1]||!this.children[s+2].eq(e.children[s+2]))return!1;return!0}locals(e){return Ea(this.localsInner(e))}localsInner(e){if(this==Le)return Ls;if(e.inlineContent||!this.local.some(Wt.is))return this.local;let s=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Wt||s.push(this.local[r]);return s}}be.empty=new be([],[]);be.removeOverlap=Ea;const Le=be.empty;class Vt{constructor(e){this.members=e}map(e,s){const r=this.members.map(i=>i.map(e,s,fs));return Vt.from(r)}forChild(e,s){if(s.isLeaf)return be.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(e,s);a!=Le&&(a instanceof Vt?r=r.concat(a.members):r.push(a))}return Vt.from(r)}eq(e){if(!(e instanceof Vt)||e.members.length!=this.members.length)return!1;for(let s=0;s<this.members.length;s++)if(!this.members[s].eq(e.members[s]))return!1;return!0}locals(e){let s,r=!0;for(let i=0;i<this.members.length;i++){let a=this.members[i].localsInner(e);if(a.length)if(!s)s=a;else{r&&(s=s.slice(),r=!1);for(let o=0;o<a.length;o++)s.push(a[o])}}return s?Ea(r?s:s.sort(gs)):Ls}static from(e){switch(e.length){case 0:return Le;case 1:return e[0];default:return new Vt(e.every(s=>s instanceof be)?e:e.reduce((s,r)=>s.concat(r instanceof be?r:r.members),[]))}}}function aj(t,e,s,r,i,a,o){let l=t.slice();for(let u=0,h=a;u<s.maps.length;u++){let m=0;s.maps[u].forEach((p,f,x,b)=>{let y=b-x-(f-p);for(let k=0;k<l.length;k+=3){let M=l[k+1];if(M<0||p>M+h-m)continue;let R=l[k]+h-m;f>=R?l[k+1]=p<=R?-2:-1:x>=i&&y&&(l[k]+=y,l[k+1]+=y)}m+=y}),h=s.maps[u].map(h,-1)}let c=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){c=!0,l[u+1]=-1;continue}let h=s.map(t[u]+a),m=h-i;if(m<0||m>=r.content.size){c=!0;continue}let p=s.map(t[u+1]+a,-1),f=p-i,{index:x,offset:b}=r.content.findIndex(m),y=r.maybeChild(x);if(y&&b==m&&b+y.nodeSize==f){let k=l[u+2].mapInner(s,y,h+1,t[u]+a+1,o);k!=Le?(l[u]=m,l[u+1]=f,l[u+2]=k):(l[u+1]=-2,c=!0)}else c=!0}if(c){let u=oj(l,t,e,s,i,a,o),h=or(u,r,0,o);e=h.local;for(let m=0;m<l.length;m+=3)l[m+1]<0&&(l.splice(m,3),m-=3);for(let m=0,p=0;m<h.children.length;m+=3){let f=h.children[m];for(;p<l.length&&l[p]<f;)p+=3;l.splice(p,0,h.children[m],h.children[m+1],h.children[m+2])}}return new be(e.sort(gs),l)}function Zd(t,e){if(!e||!t.length)return t;let s=[];for(let r=0;r<t.length;r++){let i=t[r];s.push(new st(i.from+e,i.to+e,i.type))}return s}function oj(t,e,s,r,i,a,o){function l(c,u){for(let h=0;h<c.local.length;h++){let m=c.local[h].map(r,i,u);m?s.push(m):o.onRemove&&o.onRemove(c.local[h].spec)}for(let h=0;h<c.children.length;h+=3)l(c.children[h+2],c.children[h]+u+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&l(t[c+2],e[c]+a+1);return s}function Kd(t,e,s){if(e.isLeaf)return null;let r=s+e.nodeSize,i=null;for(let a=0,o;a<t.length;a++)(o=t[a])&&o.from>s&&o.to<r&&((i||(i=[])).push(o),t[a]=null);return i}function Jd(t){let e=[];for(let s=0;s<t.length;s++)t[s]!=null&&e.push(t[s]);return e}function or(t,e,s,r){let i=[],a=!1;e.forEach((l,c)=>{let u=Kd(t,l,c+s);if(u){a=!0;let h=or(u,l,s+c+1,r);h!=Le&&i.push(c,c+l.nodeSize,h)}});let o=Zd(a?Jd(t):t,-s).sort(gs);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||i.length?new be(o,i):Le}function gs(t,e){return t.from-e.from||t.to-e.to}function Ea(t){let e=t;for(let s=0;s<e.length-1;s++){let r=e[s];if(r.from!=r.to)for(let i=s+1;i<e.length;i++){let a=e[i];if(a.from==r.from){a.to!=r.to&&(e==t&&(e=t.slice()),e[i]=a.copy(a.from,r.to),Ho(e,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(e==t&&(e=t.slice()),e[s]=r.copy(r.from,a.from),Ho(e,i,r.copy(a.from,r.to)));break}}}return e}function Ho(t,e,s){for(;e<t.length&&gs(s,t[e])>0;)e++;t.splice(e,0,s)}function ri(t){let e=[];return t.someProp("decorations",s=>{let r=s(t.state);r&&r!=Le&&e.push(r)}),t.cursorWrapper&&e.push(be.create(t.state.doc,[t.cursorWrapper.deco])),Vt.from(e)}const lj={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},cj=Ue&&Ut<=11;class dj{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 uj{constructor(e,s){this.view=e,this.handleDOMChange=s,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new dj,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Ue&&Ut<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),cj&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.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,lj)),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 s=0;s<e.length;s++)this.queue.push(e[s]);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(Fo(this.view)){if(this.suppressingSelectionUpdates)return Et(this.view);if(Ue&&Ut<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ys(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 s=new Set,r;for(let a=e.focusNode;a;a=vn(a))s.add(a);for(let a=e.anchorNode;a;a=vn(a))if(s.has(a)){r=a;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let s=this.observer?this.observer.takeRecords():[];this.queue.length&&(s=this.queue.concat(s),this.queue.length=0);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Fo(e)&&!this.ignoreSelectionChange(r),a=-1,o=-1,l=!1,c=[];if(e.editable)for(let h=0;h<s.length;h++){let m=this.registerMutation(s[h],c);m&&(a=a<0?m.from:Math.min(m.from,a),o=o<0?m.to:Math.max(m.to,o),m.typeOver&&(l=!0))}if(pt&&c.length>1){let h=c.filter(m=>m.nodeName=="BR");if(h.length==2){let m=h[0],p=h[1];m.parentNode&&m.parentNode.parentNode==p.parentNode?p.remove():m.remove()}}let u=null;a<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Tr(r)&&(u=Sa(e))&&u.eq(K.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Et(e),this.currentSelection.set(r),e.scrollToSelection()):(a>-1||i)&&(a>-1&&(e.docView.markDirty(a,o),hj(e)),this.handleDOMChange(a,o,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Et(e),this.currentSelection.set(r))}registerMutation(e,s){if(s.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let h=0;h<e.addedNodes.length;h++)s.push(e.addedNodes[h]);if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,a=e.nextSibling;if(Ue&&Ut<=11&&e.addedNodes.length)for(let h=0;h<e.addedNodes.length;h++){let{previousSibling:m,nextSibling:p}=e.addedNodes[h];(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(i=m),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(a=p)}let o=i&&i.parentNode==e.target?Je(i)+1:0,l=r.localPosFromDOM(e.target,o,-1),c=a&&a.parentNode==e.target?Je(a):e.target.childNodes.length,u=r.localPosFromDOM(e.target,c,1);return{from:l,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}}let qo=new WeakMap,Uo=!1;function hj(t){if(!qo.has(t)&&(qo.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=pt,Uo)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."),Uo=!0}}function mj(t){let e;function s(c){c.preventDefault(),c.stopImmediatePropagation(),e=c.getTargetRanges()[0]}t.dom.addEventListener("beforeinput",s,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",s,!0);let r=e.startContainer,i=e.startOffset,a=e.endContainer,o=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return ys(l.node,l.offset,a,o)&&([r,i,a,o]=[a,o,r,i]),{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}}function pj(t,e,s){let{node:r,fromOffset:i,toOffset:a,from:o,to:l}=t.docView.parseRange(e,s),c=t.domSelectionRange(),u,h=c.anchorNode;if(h&&t.dom.contains(h.nodeType==1?h:h.parentNode)&&(u=[{node:h,offset:c.anchorOffset}],Tr(c)||u.push({node:c.focusNode,offset:c.focusOffset})),Pe&&t.input.lastKeyCode===8)for(let y=a;y>i;y--){let k=r.childNodes[y-1],M=k.pmViewDesc;if(k.nodeName=="BR"&&!M){a=y;break}if(!M||M.size)break}let m=t.state.doc,p=t.someProp("domParser")||_s.fromSchema(t.state.schema),f=m.resolve(o),x=null,b=p.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:a,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:fj,context:f});if(u&&u[0].pos!=null){let y=u[0].pos,k=u[1]&&u[1].pos;k==null&&(k=y),x={anchor:y+o,head:k+o}}return{doc:b,sel:x,from:o,to:l}}function fj(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Fe&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let s=document.createElement("div");return s.appendChild(document.createElement("li")),{skip:s}}else if(t.parentNode.lastChild==t||Fe&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const gj=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function xj(t,e,s,r,i){if(e<0){let U=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,qe=Sa(t,U);if(qe&&!t.state.selection.eq(qe)){if(Pe&&dt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",Ye=>Ye(t,ls(13,"Enter"))))return;let zt=t.state.tr.setSelection(qe);U=="pointer"?zt.setMeta("pointer",!0):U=="key"&&zt.scrollIntoView(),t.dispatch(zt)}return}let a=t.state.doc.resolve(e),o=a.sharedDepth(s);e=a.before(o+1),s=t.state.doc.resolve(s).after(o+1);let l=t.state.selection,c=pj(t,e,s),u=t.state.doc,h=u.slice(c.from,c.to),m,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(m=t.state.selection.to,p="end"):(m=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let f=yj(h.content,c.doc.content,c.from,m,p);if(($s&&t.input.lastIOSEnter>Date.now()-225||dt)&&i.some(U=>U.nodeType==1&&!gj.test(U.nodeName))&&(!f||f.endA>=f.endB)&&t.someProp("handleKeyDown",U=>U(t,ls(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!f)if(r&&l instanceof J&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))f={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let U=Wo(t,t.state.doc,c.sel);U&&!U.eq(t.state.selection)&&t.dispatch(t.state.tr.setSelection(U))}return}if(Pe&&t.cursorWrapper&&c.sel&&c.sel.anchor==t.cursorWrapper.deco.from&&c.sel.head==c.sel.anchor){let U=f.endB-f.start;c.sel={anchor:c.sel.anchor+U,head:c.sel.anchor+U}}t.input.domChangeCount++,t.state.selection.from<t.state.selection.to&&f.start==f.endB&&t.state.selection instanceof J&&(f.start>t.state.selection.from&&f.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?f.start=t.state.selection.from:f.endA<t.state.selection.to&&f.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(f.endB+=t.state.selection.to-f.endA,f.endA=t.state.selection.to)),Ue&&Ut<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>c.from&&c.doc.textBetween(f.start-c.from-1,f.start-c.from+1)==" "&&(f.start--,f.endA--,f.endB--);let x=c.doc.resolveNoCache(f.start-c.from),b=c.doc.resolveNoCache(f.endB-c.from),y=u.resolve(f.start),k=x.sameParent(b)&&x.parent.inlineContent&&y.end()>=f.endA,M;if(($s&&t.input.lastIOSEnter>Date.now()-225&&(!k||i.some(U=>U.nodeName=="DIV"||U.nodeName=="P"))||!k&&x.pos<c.doc.content.size&&(M=K.findFrom(c.doc.resolve(x.pos+1),1,!0))&&M.head==b.pos)&&t.someProp("handleKeyDown",U=>U(t,ls(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>f.start&&bj(u,f.start,f.endA,x,b)&&t.someProp("handleKeyDown",U=>U(t,ls(8,"Backspace")))){dt&&Pe&&t.domObserver.suppressSelectionUpdates();return}Pe&&dt&&f.endB==f.start&&(t.input.lastAndroidDelete=Date.now()),dt&&!k&&x.start()!=b.start()&&b.parentOffset==0&&x.depth==b.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==f.endA&&(f.endB-=2,b=c.doc.resolveNoCache(f.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(U){return U(t,ls(13,"Enter"))})},20));let R=f.start,Q=f.endA,W,pe,de;if(k){if(x.pos==b.pos)Ue&&Ut<=11&&x.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Et(t),20)),W=t.state.tr.delete(R,Q),pe=u.resolve(f.start).marksAcross(u.resolve(f.endA));else if(f.endA==f.endB&&(de=jj(x.parent.content.cut(x.parentOffset,b.parentOffset),y.parent.content.cut(y.parentOffset,f.endA-y.start()))))W=t.state.tr,de.type=="add"?W.addMark(R,Q,de.mark):W.removeMark(R,Q,de.mark);else if(x.parent.child(x.index()).isText&&x.index()==b.index()-(b.textOffset?0:1)){let U=x.parent.textBetween(x.parentOffset,b.parentOffset);if(t.someProp("handleTextInput",qe=>qe(t,R,Q,U)))return;W=t.state.tr.insertText(U,R,Q)}}if(W||(W=t.state.tr.replace(R,Q,c.doc.slice(f.start-c.from,f.endB-c.from))),c.sel){let U=Wo(t,W.doc,c.sel);U&&!(Pe&&dt&&t.composing&&U.empty&&(f.start!=f.endB||t.input.lastAndroidDelete<Date.now()-100)&&(U.head==R||U.head==W.mapping.map(Q)-1)||Ue&&U.empty&&U.head==R)&&W.setSelection(U)}pe&&W.ensureMarks(pe),t.dispatch(W.scrollIntoView())}function Wo(t,e,s){return Math.max(s.anchor,s.head)>e.content.size?null:Ma(t,e.resolve(s.anchor),e.resolve(s.head))}function jj(t,e){let s=t.firstChild.marks,r=e.firstChild.marks,i=s,a=r,o,l,c;for(let h=0;h<r.length;h++)i=r[h].removeFromSet(i);for(let h=0;h<s.length;h++)a=s[h].removeFromSet(a);if(i.length==1&&a.length==0)l=i[0],o="add",c=h=>h.mark(l.addToSet(h.marks));else if(i.length==0&&a.length==1)l=a[0],o="remove",c=h=>h.mark(l.removeFromSet(h.marks));else return null;let u=[];for(let h=0;h<e.childCount;h++)u.push(c(e.child(h)));if(S.from(u).eq(t))return{mark:l,type:o}}function bj(t,e,s,r,i){if(!r.parent.isTextblock||s-e<=i.pos-r.pos||ii(r,!0,!1)<i.pos)return!1;let a=t.resolve(e);if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=t.resolve(ii(a,!0,!0));return!o.parent.isTextblock||o.pos>s||ii(o,!0,!1)<s?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function ii(t,e,s){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(s){let a=t.node(r).maybeChild(t.indexAfter(r));for(;a&&!a.isLeaf;)a=a.firstChild,i++}return i}function yj(t,e,s,r,i){let a=t.findDiffStart(e,s);if(a==null)return null;let{a:o,b:l}=t.findDiffEnd(e,s+t.size,s+e.size);if(i=="end"){let c=Math.max(0,a-Math.min(o,l));r-=o+c-a}if(o<a&&t.size<e.size){let c=r<=a&&r>=o?a-r:0;a-=c,l=a+(l-o),o=a}else if(l<a){let c=r<=a&&r>=l?a-r:0;a-=c,o=a+(o-l),l=a}return{start:a,endA:o,endB:l}}class vj{constructor(e,s){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 V0,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=s,this.state=s.state,this.directPlugins=s.plugins||[],this.directPlugins.forEach(Qo),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=Jo(this),Ko(this),this.nodeViews=Go(this),this.docView=Ao(this.state.doc,Zo(this),ri(this),this.dom,this),this.domObserver=new uj(this,(r,i,a,o)=>xj(this,r,i,a,o)),this.domObserver.start(),$0(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 s in e)this._props[s]=e[s];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Vi(this);let s=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Qo),this.directPlugins=e.plugins),this.updateStateInner(e.state,s)}setProps(e){let s={};for(let r in this._props)s[r]=this._props[r];s.state=this.state;for(let r in e)s[r]=e[r];this.update(s)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,s){let r=this.state,i=!1,a=!1;e.storedMarks&&this.composing&&(Ud(this),a=!0),this.state=e;let o=r.plugins!=e.plugins||this._props.plugins!=s.plugins;if(o||this._props.plugins!=s.plugins||this._props.nodeViews!=s.nodeViews){let p=Go(this);kj(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(o||s.handleDOMEvents!=this._props.handleDOMEvents)&&Vi(this),this.editable=Jo(this),Ko(this);let l=ri(this),c=Zo(this),u=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",h=i||!this.docView.matchesNode(e.doc,c,l);(h||!e.selection.eq(r.selection))&&(a=!0);let m=u=="preserve"&&a&&this.dom.style.overflowAnchor==null&&a0(this);if(a){this.domObserver.stop();let p=h&&(Ue||Pe)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&Cj(r.selection,e.selection);if(h){let f=Pe?this.trackWrites=this.domSelectionRange().focusNode:null;(i||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=Ao(e.doc,c,l,this.dom,this)),f&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&I0(this))?Et(this,p):(Ed(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():m&&o0(m)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",s=>s(this)))if(this.state.selection instanceof B){let s=this.docView.domAfterPos(this.state.selection.from);s.nodeType==1&&So(this,s.getBoundingClientRect(),e)}else So(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 s=0;s<this.directPlugins.length;s++){let r=this.directPlugins[s];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let s=0;s<this.state.plugins.length;s++){let r=this.state.plugins[s];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let s=0;s<this.pluginViews.length;s++){let r=this.pluginViews[s];r.update&&r.update(this,e)}}someProp(e,s){let r=this._props&&this._props[e],i;if(r!=null&&(i=s?s(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(i=s?s(l):l))return i}let a=this.state.plugins;if(a)for(let o=0;o<a.length;o++){let l=a[o].props[e];if(l!=null&&(i=s?s(l):l))return i}}hasFocus(){if(Ue){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&&l0(this.dom),Et(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let s=this.dom.parentNode;s;s=s.parentNode)if(s.nodeType==9||s.nodeType==11&&s.host)return s.getSelection||(Object.getPrototypeOf(s).getSelection=()=>s.ownerDocument.getSelection()),this._root=s}return e||document}posAtCoords(e){return m0(this,e)}coordsAtPos(e,s=1){return wd(this,e,s)}domAtPos(e,s=0){return this.docView.domFromPos(e,s)}nodeDOM(e){let s=this.docView.descAt(e);return s?s.nodeDOM:null}posAtDOM(e,s,r=-1){let i=this.docView.posFromDOM(e,s,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,s){return j0(this,s||this.state,e)}pasteHTML(e,s){return Cn(this,"",e,!1,s||new ClipboardEvent("paste"))}pasteText(e,s){return Cn(this,e,null,!0,s||new ClipboardEvent("paste"))}destroy(){this.docView&&(H0(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ri(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return this.docView==null}dispatchEvent(e){return U0(this,e)}dispatch(e){let s=this._props.dispatchTransaction;s?s.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return Fe&&this.root.nodeType===11&&t0(this.dom.ownerDocument)==this.dom?mj(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function Zo(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),e.translate="no",t.someProp("attributes",s=>{if(typeof s=="function"&&(s=s(t.state)),s)for(let r in s)r=="class"&&(e.class+=" "+s[r]),r=="style"?e.style=(e.style?e.style+";":"")+s[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(s[r]))}),[st.node(0,t.state.doc.content.size,e)]}function Ko(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:st.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Jo(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Cj(t,e){let s=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(s)!=e.$anchor.start(s)}function Go(t){let e=Object.create(null);function s(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",s),t.someProp("markViews",s),e}function kj(t,e){let s=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;s++}for(let i in e)r++;return s!=r}function Qo(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Gt={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:"'"},lr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Yo=typeof navigator<"u"&&/Chrome\/(\d+)/.exec(navigator.userAgent),wj=typeof navigator<"u"&&/Mac/.test(navigator.platform),Sj=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Mj=wj||Yo&&+Yo[1]<57;for(var Se=0;Se<10;Se++)Gt[48+Se]=Gt[96+Se]=String(Se);for(var Se=1;Se<=24;Se++)Gt[Se+111]="F"+Se;for(var Se=65;Se<=90;Se++)Gt[Se]=String.fromCharCode(Se+32),lr[Se]=String.fromCharCode(Se);for(var ai in Gt)lr.hasOwnProperty(ai)||(lr[ai]=Gt[ai]);function Nj(t){var e=Mj&&(t.ctrlKey||t.altKey||t.metaKey)||Sj&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",s=!e&&t.key||(t.shiftKey?lr:Gt)[t.keyCode]||t.key||"Unidentified";return s=="Esc"&&(s="Escape"),s=="Del"&&(s="Delete"),s=="Left"&&(s="ArrowLeft"),s=="Up"&&(s="ArrowUp"),s=="Right"&&(s="ArrowRight"),s=="Down"&&(s="ArrowDown"),s}const Lj=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Tj(t){let e=t.split(/-(?!$)/),s=e[e.length-1];s=="Space"&&(s=" ");let r,i,a,o;for(let l=0;l<e.length-1;l++){let c=e[l];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))a=!0;else if(/^mod$/i.test(c))Lj?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(s="Alt-"+s),i&&(s="Ctrl-"+s),o&&(s="Meta-"+s),a&&(s="Shift-"+s),s}function Aj(t){let e=Object.create(null);for(let s in t)e[Tj(s)]=t[s];return e}function oi(t,e,s=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),s&&e.shiftKey&&(t="Shift-"+t),t}function Ij(t){return new ct({props:{handleKeyDown:Gd(t)}})}function Gd(t){let e=Aj(t);return function(s,r){let i=Nj(r),a,o=e[oi(i,r)];if(o&&o(s.state,s.dispatch,s))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[oi(i,r,!1)];if(l&&l(s.state,s.dispatch,s))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(a=Gt[r.keyCode])&&a!=i){let l=e[oi(a,r)];if(l&&l(s.state,s.dispatch,s))return!0}}return!1}}const Ej=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Dj(t,e){let{$cursor:s}=t.selection;return!s||(e?!e.endOfTextblock("backward",t):s.parentOffset>0)?null:s}const Oj=(t,e,s)=>{let r=Dj(t,s);if(!r)return!1;let i=Qd(r);if(!i){let o=r.blockRange(),l=o&&tn(o);return l==null?!1:(e&&e(t.tr.lift(o,l).scrollIntoView()),!0)}let a=i.nodeBefore;if(!a.type.spec.isolating&&eu(t,i,e))return!0;if(r.parent.content.size==0&&(qs(a,"end")||B.isSelectable(a))){let o=Ca(t.doc,r.before(),r.after(),L.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(qs(a,"end")?K.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):B.create(l.doc,i.pos-a.nodeSize)),e(l.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1};function qs(t,e,s=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(s&&r.childCount!=1)return!1}return!1}const Pj=(t,e,s)=>{let{$head:r,empty:i}=t.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(s?!s.endOfTextblock("backward",t):r.parentOffset>0)return!1;a=Qd(r)}let o=a&&a.nodeBefore;return!o||!B.isSelectable(o)?!1:(e&&e(t.tr.setSelection(B.create(t.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function Qd(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Fj(t,e){let{$cursor:s}=t.selection;return!s||(e?!e.endOfTextblock("forward",t):s.parentOffset<s.parent.content.size)?null:s}const zj=(t,e,s)=>{let r=Fj(t,s);if(!r)return!1;let i=Yd(r);if(!i)return!1;let a=i.nodeAfter;if(eu(t,i,e))return!0;if(r.parent.content.size==0&&(qs(a,"start")||B.isSelectable(a))){let o=Ca(t.doc,r.before(),r.after(),L.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(qs(a,"start")?K.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):B.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},Rj=(t,e,s)=>{let{$head:r,empty:i}=t.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(s?!s.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;a=Yd(r)}let o=a&&a.nodeAfter;return!o||!B.isSelectable(o)?!1:(e&&e(t.tr.setSelection(B.create(t.doc,a.pos)).scrollIntoView()),!0)};function Yd(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let s=t.node(e);if(t.index(e)+1<s.childCount)return t.doc.resolve(t.after(e+1));if(s.type.spec.isolating)break}return null}const _j=(t,e)=>{let s=t.selection,r=s instanceof B,i;if(r){if(s.node.isTextblock||!ns(t.doc,s.from))return!1;i=s.from}else if(i=dd(t.doc,s.from,-1),i==null)return!1;if(e){let a=t.tr.join(i);r&&a.setSelection(B.create(a.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(a.scrollIntoView())}return!0},Bj=(t,e)=>{let s=t.selection,r;if(s instanceof B){if(s.node.isTextblock||!ns(t.doc,s.to))return!1;r=s.to}else if(r=dd(t.doc,s.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Vj=(t,e)=>{let{$from:s,$to:r}=t.selection,i=s.blockRange(r),a=i&&tn(i);return a==null?!1:(e&&e(t.tr.lift(i,a).scrollIntoView()),!0)},$j=(t,e)=>{let{$head:s,$anchor:r}=t.selection;return!s.parent.type.spec.code||!s.sameParent(r)?!1:(e&&e(t.tr.insertText(` `).scrollIntoView()),!0)};function Xd(t){for(let e=0;e<t.edgeCount;e++){let{type:s}=t.edge(e);if(s.isTextblock&&!s.hasRequiredAttrs())return s}return null}const Hj=(t,e)=>{let{$head:s,$anchor:r}=t.selection;if(!s.parent.type.spec.code||!s.sameParent(r))return!1;let i=s.node(-1),a=s.indexAfter(-1),o=Xd(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(e){let l=s.after(),c=t.tr.replaceWith(l,l,o.createAndFill());c.setSelection(K.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},qj=(t,e)=>{let s=t.selection,{$from:r,$to:i}=s;if(s instanceof rt||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=Xd(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=t.tr.insert(o,a.createAndFill());l.setSelection(J.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},Uj=(t,e)=>{let{$cursor:s}=t.selection;if(!s||s.parent.content.size)return!1;if(s.depth>1&&s.after()!=s.end(-1)){let a=s.before();if(Ps(t.doc,a))return e&&e(t.tr.split(a).scrollIntoView()),!0}let r=s.blockRange(),i=r&&tn(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},Wj=(t,e)=>{let{$from:s,to:r}=t.selection,i,a=s.sharedDepth(r);return a==0?!1:(i=s.before(a),e&&e(t.tr.setSelection(B.create(t.doc,i))),!0)};function Zj(t,e,s){let r=e.nodeBefore,i=e.nodeAfter,a=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(a-1,a)?(s&&s(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(a,a+1)||!(i.isTextblock||ns(t.doc,e.pos))?!1:(s&&s(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function eu(t,e,s){let r=e.nodeBefore,i=e.nodeAfter,a,o;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(Zj(t,e,s))return!0;let l=e.parent.canReplace(e.index(),e.index()+1);if(l&&(a=(o=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&o.matchType(a[0]||i.type).validEnd){if(s){let m=e.pos+i.nodeSize,p=S.empty;for(let b=a.length-1;b>=0;b--)p=S.from(a[b].create(null,p));p=S.from(r.copy(p));let f=t.tr.step(new Ce(e.pos-1,m,e.pos,m,new L(p,1,0),a.length,!0)),x=m+2*a.length;ns(f.doc,x)&&f.join(x),s(f.scrollIntoView())}return!0}let c=K.findFrom(e,1),u=c&&c.$from.blockRange(c.$to),h=u&&tn(u);if(h!=null&&h>=e.depth)return s&&s(t.tr.lift(u,h).scrollIntoView()),!0;if(l&&qs(i,"start",!0)&&qs(r,"end")){let m=r,p=[];for(;p.push(m),!m.isTextblock;)m=m.lastChild;let f=i,x=1;for(;!f.isTextblock;f=f.firstChild)x++;if(m.canReplace(m.childCount,m.childCount,f.content)){if(s){let b=S.empty;for(let k=p.length-1;k>=0;k--)b=S.from(p[k].copy(b));let y=t.tr.step(new Ce(e.pos-p.length,e.pos+i.nodeSize,e.pos+x,e.pos+i.nodeSize-x,new L(b,p.length,0),0,!0));s(y.scrollIntoView())}return!0}}return!1}function tu(t){return function(e,s){let r=e.selection,i=t<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(s&&s(e.tr.setSelection(J.create(e.doc,t<0?i.start(a):i.end(a)))),!0):!1}}const Kj=tu(-1),Jj=tu(1);function Gj(t,e=null){return function(s,r){let{$from:i,$to:a}=s.selection,o=i.blockRange(a),l=o&&va(o,t,e);return l?(r&&r(s.tr.wrap(o,l).scrollIntoView()),!0):!1}}function Xo(t,e=null){return function(s,r){let i=!1;for(let a=0;a<s.selection.ranges.length&&!i;a++){let{$from:{pos:o},$to:{pos:l}}=s.selection.ranges[a];s.doc.nodesBetween(o,l,(c,u)=>{if(i)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)i=!0;else{let h=s.doc.resolve(u),m=h.index();i=h.parent.canReplaceWith(m,m+1,t)}})}if(!i)return!1;if(r){let a=s.tr;for(let o=0;o<s.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:c}}=s.selection.ranges[o];a.setBlockType(l,c,t,e)}r(a.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Qj(t,e=null){return function(s,r){let{$from:i,$to:a}=s.selection,o=i.blockRange(a),l=!1,c=o;if(!o)return!1;if(o.depth>=2&&i.node(o.depth-1).type.compatibleContent(t)&&o.startIndex==0){if(i.index(o.depth-1)==0)return!1;let h=s.doc.resolve(o.start-2);c=new tr(h,h,o.depth),o.endIndex<o.parent.childCount&&(o=new tr(i,s.doc.resolve(a.end(o.depth)),o.depth)),l=!0}let u=va(c,t,e,o);return u?(r&&r(Yj(s.tr,o,u,l,t).scrollIntoView()),!0):!1}}function Yj(t,e,s,r,i){let a=S.empty;for(let h=s.length-1;h>=0;h--)a=S.from(s[h].type.create(s[h].attrs,a));t.step(new Ce(e.start-(r?2:0),e.end,e.start,e.end,new L(a,0,0),s.length,!0));let o=0;for(let h=0;h<s.length;h++)s[h].type==i&&(o=h+1);let l=s.length-o,c=e.start+s.length-(r?2:0),u=e.parent;for(let h=e.startIndex,m=e.endIndex,p=!0;h<m;h++,p=!1)!p&&Ps(t.doc,c,l)&&(t.split(c,l),c+=2*l),c+=u.child(h).nodeSize;return t}function Xj(t){return function(e,s){let{$from:r,$to:i}=e.selection,a=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return a?s?r.node(a.depth-1).type==t?eb(e,s,t,a):tb(e,s,a):!0:!1}}function eb(t,e,s,r){let i=t.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new Ce(a-1,o,a,o,new L(S.from(s.create(null,r.parent.copy())),1,0),1,!0)),r=new tr(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const l=tn(r);if(l==null)return!1;i.lift(r,l);let c=i.mapping.map(a,-1)-1;return ns(i.doc,c)&&i.join(c),e(i.scrollIntoView()),!0}function tb(t,e,s){let r=t.tr,i=s.parent;for(let f=s.end,x=s.endIndex-1,b=s.startIndex;x>b;x--)f-=i.child(x).nodeSize,r.delete(f-1,f+1);let a=r.doc.resolve(s.start),o=a.nodeAfter;if(r.mapping.map(s.end)!=s.start+a.nodeAfter.nodeSize)return!1;let l=s.startIndex==0,c=s.endIndex==i.childCount,u=a.node(-1),h=a.index(-1);if(!u.canReplace(h+(l?0:1),h+1,o.content.append(c?S.empty:S.from(i))))return!1;let m=a.pos,p=m+o.nodeSize;return r.step(new Ce(m-(l?1:0),p+(c?1:0),m+1,p-1,new L((l?S.empty:S.from(i.copy(S.empty))).append(c?S.empty:S.from(i.copy(S.empty))),l?0:1,c?0:1),l?0:1)),e(r.scrollIntoView()),!0}function sb(t){return function(e,s){let{$from:r,$to:i}=e.selection,a=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==t);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let l=a.parent,c=l.child(o-1);if(c.type!=t)return!1;if(s){let u=c.lastChild&&c.lastChild.type==l.type,h=S.from(u?t.create():null),m=new L(S.from(t.create(null,S.from(l.type.create(null,h)))),u?3:1,0),p=a.start,f=a.end;s(e.tr.step(new Ce(p-(u?3:1),f,p,f,m,1,!0)).scrollIntoView())}return!0}}function Dr(t){const{state:e,transaction:s}=t;let{selection:r}=s,{doc:i}=s,{storedMarks:a}=s;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),filterTransaction:e.filterTransaction,plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=s.selection,i=s.doc,a=s.storedMarks,s}}}class Or{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:s,state:r}=this,{view:i}=s,{tr:a}=r,o=this.buildProps(a);return Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...h)=>{const m=c(...h)(o);return!a.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(a),m}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,s=!0){const{rawCommands:r,editor:i,state:a}=this,{view:o}=i,l=[],c=!!e,u=e||a.tr,h=()=>(!c&&s&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(u),l.every(p=>p===!0)),m={...Object.fromEntries(Object.entries(r).map(([p,f])=>[p,(...b)=>{const y=this.buildProps(u,s),k=f(...b)(y);return l.push(k),m}])),run:h};return m}createCan(e){const{rawCommands:s,state:r}=this,i=!1,a=e||r.tr,o=this.buildProps(a,i);return{...Object.fromEntries(Object.entries(s).map(([c,u])=>[c,(...h)=>u(...h)({...o,dispatch:void 0})])),chain:()=>this.createChain(a,i)}}buildProps(e,s=!0){const{rawCommands:r,editor:i,state:a}=this,{view:o}=i;a.storedMarks&&e.setStoredMarks(a.storedMarks);const l={tr:e,editor:i,view:o,state:Dr({state:a,transaction:e}),dispatch:s?()=>{}:void 0,chain:()=>this.createChain(e),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([c,u])=>[c,(...h)=>u(...h)(l)]))}};return l}}class nb{constructor(){this.callbacks={}}on(e,s){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(s),this}emit(e,...s){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,s)),this}off(e,s){const r=this.callbacks[e];return r&&(s?this.callbacks[e]=r.filter(i=>i!==s):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}}function A(t,e,s){return t.config[e]===void 0&&t.parent?A(t.parent,e,s):typeof t.config[e]=="function"?t.config[e].bind({...s,parent:t.parent?A(t.parent,e,s):null}):t.config[e]}function Pr(t){const e=t.filter(i=>i.type==="extension"),s=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:s,markExtensions:r}}function su(t){const e=[],{nodeExtensions:s,markExtensions:r}=Pr(t),i=[...s,...r],a={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage},c=A(o,"addGlobalAttributes",l);if(!c)return;c().forEach(h=>{h.types.forEach(m=>{Object.entries(h.attributes).forEach(([p,f])=>{e.push({type:m,name:p,attribute:{...a,...f}})})})})}),i.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage},c=A(o,"addAttributes",l);if(!c)return;const u=c();Object.entries(u).forEach(([h,m])=>{const p={...a,...m};m!=null&&m.isRequired&&(m==null?void 0:m.default)===void 0&&delete p.default,e.push({type:o.name,name:h,attribute:p})})}),e}function ke(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function me(...t){return t.filter(e=>!!e).reduce((e,s)=>{const r={...e};return Object.entries(s).forEach(([i,a])=>{if(!r[i]){r[i]=a;return}i==="class"?r[i]=[r[i],a].join(" "):i==="style"?r[i]=[r[i],a].join("; "):r[i]=a}),r},{})}function $i(t,e){return e.filter(s=>s.attribute.rendered).map(s=>s.attribute.renderHTML?s.attribute.renderHTML(t.attrs)||{}:{[s.name]:t.attrs[s.name]}).reduce((s,r)=>me(s,r),{})}function nu(t){return typeof t=="function"}function Z(t,e=void 0,...s){return nu(t)?e?t.bind(e)(...s):t(...s):t}function rb(t={}){return Object.keys(t).length===0&&t.constructor===Object}function ib(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function el(t,e){return t.style?t:{...t,getAttrs:s=>{const r=t.getAttrs?t.getAttrs(s):t.attrs;if(r===!1)return!1;const i=e.reduce((a,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(s):ib(s.getAttribute(o.name));return l==null?a:{...a,[o.name]:l}},{});return{...r,...i}}}}function tl(t){return Object.fromEntries(Object.entries(t).filter(([e,s])=>e==="attrs"&&rb(s)?!1:s!=null))}function ab(t){var e;const s=su(t),{nodeExtensions:r,markExtensions:i}=Pr(t),a=(e=r.find(c=>A(c,"topNode")))===null||e===void 0?void 0:e.name,o=Object.fromEntries(r.map(c=>{const u=s.filter(y=>y.type===c.name),h={name:c.name,options:c.options,storage:c.storage},m=t.reduce((y,k)=>{const M=A(k,"extendNodeSchema",h);return{...y,...M?M(c):{}}},{}),p=tl({...m,content:Z(A(c,"content",h)),marks:Z(A(c,"marks",h)),group:Z(A(c,"group",h)),inline:Z(A(c,"inline",h)),atom:Z(A(c,"atom",h)),selectable:Z(A(c,"selectable",h)),draggable:Z(A(c,"draggable",h)),code:Z(A(c,"code",h)),defining:Z(A(c,"defining",h)),isolating:Z(A(c,"isolating",h)),attrs:Object.fromEntries(u.map(y=>{var k;return[y.name,{default:(k=y==null?void 0:y.attribute)===null||k===void 0?void 0:k.default}]}))}),f=Z(A(c,"parseHTML",h));f&&(p.parseDOM=f.map(y=>el(y,u)));const x=A(c,"renderHTML",h);x&&(p.toDOM=y=>x({node:y,HTMLAttributes:$i(y,u)}));const b=A(c,"renderText",h);return b&&(p.toText=b),[c.name,p]})),l=Object.fromEntries(i.map(c=>{const u=s.filter(b=>b.type===c.name),h={name:c.name,options:c.options,storage:c.storage},m=t.reduce((b,y)=>{const k=A(y,"extendMarkSchema",h);return{...b,...k?k(c):{}}},{}),p=tl({...m,inclusive:Z(A(c,"inclusive",h)),excludes:Z(A(c,"excludes",h)),group:Z(A(c,"group",h)),spanning:Z(A(c,"spanning",h)),code:Z(A(c,"code",h)),attrs:Object.fromEntries(u.map(b=>{var y;return[b.name,{default:(y=b==null?void 0:b.attribute)===null||y===void 0?void 0:y.default}]}))}),f=Z(A(c,"parseHTML",h));f&&(p.parseDOM=f.map(b=>el(b,u)));const x=A(c,"renderHTML",h);return x&&(p.toDOM=b=>x({mark:b,HTMLAttributes:$i(b,u)})),[c.name,p]}));return new b2({topNode:a,nodes:o,marks:l})}function li(t,e){return e.nodes[t]||e.marks[t]||null}function sl(t,e){return Array.isArray(e)?e.some(s=>(typeof s=="string"?s:s.name)===t.name):e}const ob=(t,e=500)=>{let s="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,a,o,l)=>{var c,u;const h=((u=(c=i.type.spec).toText)===null||u===void 0?void 0:u.call(c,{node:i,pos:a,parent:o,index:l}))||i.textContent||"%leaf%";s+=h.slice(0,Math.max(0,r-a))}),s};function Da(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Fr{constructor(e){this.find=e.find,this.handler=e.handler}}const lb=(t,e)=>{if(Da(e))return e.exec(t);const s=e(t);if(!s)return null;const r=[s.text];return r.index=s.index,r.input=t,r.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(s.replaceWith)),r};function ci(t){var e;const{editor:s,from:r,to:i,text:a,rules:o,plugin:l}=t,{view:c}=s;if(c.composing)return!1;const u=c.state.doc.resolve(r);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(p=>p.type.spec.code))return!1;let h=!1;const m=ob(u)+a;return o.forEach(p=>{if(h)return;const f=lb(m,p.find);if(!f)return;const x=c.state.tr,b=Dr({state:c.state,transaction:x}),y={from:r-(f[0].length-a.length),to:i},{commands:k,chain:M,can:R}=new Or({editor:s,state:b});p.handler({state:b,range:y,match:f,commands:k,chain:M,can:R})===null||!x.steps.length||(x.setMeta(l,{transform:x,from:r,to:i,text:a}),c.dispatch(x),h=!0)}),h}function cb(t){const{editor:e,rules:s}=t,r=new ct({state:{init(){return null},apply(i,a){const o=i.getMeta(r);return o||(i.selectionSet||i.docChanged?null:a)}},props:{handleTextInput(i,a,o,l){return ci({editor:e,from:a,to:o,text:l,rules:s,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:a}=i.state.selection;a&&ci({editor:e,from:a.pos,to:a.pos,text:"",rules:s,plugin:r})}),!1)},handleKeyDown(i,a){if(a.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?ci({editor:e,from:o.pos,to:o.pos,text:` `,rules:s,plugin:r}):!1}},isInputRules:!0});return r}function db(t){return typeof t=="number"}class ub{constructor(e){this.find=e.find,this.handler=e.handler}}const hb=(t,e)=>{if(Da(e))return[...t.matchAll(e)];const s=e(t);return s?s.map(r=>{const i=[r.text];return i.index=r.index,i.input=t,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function mb(t){const{editor:e,state:s,from:r,to:i,rule:a}=t,{commands:o,chain:l,can:c}=new Or({editor:e,state:s}),u=[];return s.doc.nodesBetween(r,i,(m,p)=>{if(!m.isTextblock||m.type.spec.code)return;const f=Math.max(r,p),x=Math.min(i,p+m.content.size),b=m.textBetween(f-p,x-p,void 0,"");hb(b,a.find).forEach(k=>{if(k.index===void 0)return;const M=f+k.index+1,R=M+k[0].length,Q={from:s.tr.mapping.map(M),to:s.tr.mapping.map(R)},W=a.handler({state:s,range:Q,match:k,commands:o,chain:l,can:c});u.push(W)})}),u.every(m=>m!==null)}function pb(t){const{editor:e,rules:s}=t;let r=null,i=!1,a=!1;return s.map(l=>new ct({view(c){const u=h=>{var m;r=!((m=c.dom.parentElement)===null||m===void 0)&&m.contains(h.target)?c.dom.parentElement:null};return window.addEventListener("dragstart",u),{destroy(){window.removeEventListener("dragstart",u)}}},props:{handleDOMEvents:{drop:c=>(a=r===c.dom.parentElement,!1),paste:(c,u)=>{var h;const m=(h=u.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return i=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(c,u,h)=>{const m=c[0],p=m.getMeta("uiEvent")==="paste"&&!i,f=m.getMeta("uiEvent")==="drop"&&!a;if(!p&&!f)return;const x=u.doc.content.findDiffStart(h.doc.content),b=u.doc.content.findDiffEnd(h.doc.content);if(!db(x)||!b||x===b.b)return;const y=h.tr,k=Dr({state:h,transaction:y});if(!(!mb({editor:e,state:k,from:Math.max(x-1,0),to:b.b-1,rule:l})||!y.steps.length))return y}}))}function fb(t){const e=t.filter((s,r)=>t.indexOf(s)!==r);return[...new Set(e)]}class Is{constructor(e,s){this.splittableMarks=[],this.editor=s,this.extensions=Is.resolve(e),this.schema=ab(this.extensions),this.extensions.forEach(r=>{var i;this.editor.extensionStorage[r.name]=r.storage;const a={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:li(r.name,this.schema)};r.type==="mark"&&(!((i=Z(A(r,"keepOnSplit",a)))!==null&&i!==void 0)||i)&&this.splittableMarks.push(r.name);const o=A(r,"onBeforeCreate",a);o&&this.editor.on("beforeCreate",o);const l=A(r,"onCreate",a);l&&this.editor.on("create",l);const c=A(r,"onUpdate",a);c&&this.editor.on("update",c);const u=A(r,"onSelectionUpdate",a);u&&this.editor.on("selectionUpdate",u);const h=A(r,"onTransaction",a);h&&this.editor.on("transaction",h);const m=A(r,"onFocus",a);m&&this.editor.on("focus",m);const p=A(r,"onBlur",a);p&&this.editor.on("blur",p);const f=A(r,"onDestroy",a);f&&this.editor.on("destroy",f)})}static resolve(e){const s=Is.sort(Is.flatten(e)),r=fb(s.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),s}static flatten(e){return e.map(s=>{const r={name:s.name,options:s.options,storage:s.storage},i=A(s,"addExtensions",r);return i?[s,...this.flatten(i())]:s}).flat(10)}static sort(e){return e.sort((r,i)=>{const a=A(r,"priority")||100,o=A(i,"priority")||100;return a>o?-1:a<o?1:0})}get commands(){return this.extensions.reduce((e,s)=>{const r={name:s.name,options:s.options,storage:s.storage,editor:this.editor,type:li(s.name,this.schema)},i=A(s,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,s=Is.sort([...this.extensions].reverse()),r=[],i=[],a=s.map(o=>{const l={name:o.name,options:o.options,storage:o.storage,editor:e,type:li(o.name,this.schema)},c=[],u=A(o,"addKeyboardShortcuts",l);let h={};if(o.type==="mark"&&o.config.exitable&&(h.ArrowRight=()=>ot.handleExit({editor:e,mark:o})),u){const b=Object.fromEntries(Object.entries(u()).map(([y,k])=>[y,()=>k({editor:e})]));h={...h,...b}}const m=Ij(h);c.push(m);const p=A(o,"addInputRules",l);sl(o,e.options.enableInputRules)&&p&&r.push(...p());const f=A(o,"addPasteRules",l);sl(o,e.options.enablePasteRules)&&f&&i.push(...f());const x=A(o,"addProseMirrorPlugins",l);if(x){const b=x();c.push(...b)}return c}).flat();return[cb({editor:e,rules:r}),...pb({editor:e,rules:i}),...a]}get attributes(){return su(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:s}=Pr(this.extensions);return Object.fromEntries(s.filter(r=>!!A(r,"addNodeView")).map(r=>{const i=this.attributes.filter(c=>c.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:e,type:ke(r.name,this.schema)},o=A(r,"addNodeView",a);if(!o)return[];const l=(c,u,h,m)=>{const p=$i(c,i);return o()({editor:e,node:c,getPos:h,decorations:m,HTMLAttributes:p,extension:r})};return[r.name,l]}))}}function gb(t){return Object.prototype.toString.call(t).slice(8,-1)}function di(t){return gb(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function zr(t,e){const s={...t};return di(t)&&di(e)&&Object.keys(e).forEach(r=>{di(e[r])?r in t?s[r]=zr(t[r],e[r]):Object.assign(s,{[r]:e[r]}):Object.assign(s,{[r]:e[r]})}),s}class Ae{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&&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=Z(A(this,"addOptions",{name:this.name}))),this.storage=Z(A(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ae(e)}configure(e={}){const s=this.extend();return s.options=zr(this.options,e),s.storage=Z(A(s,"addStorage",{name:s.name,options:s.options})),s}extend(e={}){const s=new Ae(e);return s.parent=this,this.child=s,s.name=e.name?e.name:s.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${s.name}".`),s.options=Z(A(s,"addOptions",{name:s.name})),s.storage=Z(A(s,"addStorage",{name:s.name,options:s.options})),s}}function ru(t,e,s){const{from:r,to:i}=e,{blockSeparator:a=` `,textSerializers:o={}}=s||{};let l="",c=!0;return t.nodesBetween(r,i,(u,h,m,p)=>{var f;const x=o==null?void 0:o[u.type.name];x?(u.isBlock&&!c&&(l+=a,c=!0),m&&(l+=x({node:u,pos:h,parent:m,index:p,range:e}))):u.isText?(l+=(f=u==null?void 0:u.text)===null||f===void 0?void 0:f.slice(Math.max(r,h)-h,i-h),c=!1):u.isBlock&&!c&&(l+=a,c=!0)}),l}function iu(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,s])=>[e,s.spec.toText]))}const xb=Ae.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new ct({key:new rs("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:s}=t,{doc:r,selection:i}=e,{ranges:a}=i,o=Math.min(...a.map(h=>h.$from.pos)),l=Math.max(...a.map(h=>h.$to.pos)),c=iu(s);return ru(r,{from:o,to:l},{textSerializers:c})}}})]}}),jb=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var s;t.isDestroyed||(e.dom.blur(),(s=window==null?void 0:window.getSelection())===null||s===void 0||s.removeAllRanges())}),!0),bb=(t=!1)=>({commands:e})=>e.setContent("",t),yb=()=>({state:t,tr:e,dispatch:s})=>{const{selection:r}=e,{ranges:i}=r;return s&&i.forEach(({$from:a,$to:o})=>{t.doc.nodesBetween(a.pos,o.pos,(l,c)=>{if(l.type.isText)return;const{doc:u,mapping:h}=e,m=u.resolve(h.map(c)),p=u.resolve(h.map(c+l.nodeSize)),f=m.blockRange(p);if(!f)return;const x=tn(f);if(l.type.isTextblock){const{defaultType:b}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(f.start,b)}(x||x===0)&&e.lift(f,x)})}),!0},vb=t=>e=>t(e),Cb=()=>({state:t,dispatch:e})=>qj(t,e),kb=()=>({tr:t,dispatch:e})=>{const{selection:s}=t,r=s.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let a=i.depth;a>0;a-=1)if(i.node(a).type===r.type){if(e){const l=i.before(a),c=i.after(a);t.delete(l,c).scrollIntoView()}return!0}return!1},wb=t=>({tr:e,state:s,dispatch:r})=>{const i=ke(t,s.schema),a=e.selection.$anchor;for(let o=a.depth;o>0;o-=1)if(a.node(o).type===i){if(r){const c=a.before(o),u=a.after(o);e.delete(c,u).scrollIntoView()}return!0}return!1},Sb=t=>({tr:e,dispatch:s})=>{const{from:r,to:i}=t;return s&&e.delete(r,i),!0},Mb=()=>({state:t,dispatch:e})=>Ej(t,e),Nb=()=>({commands:t})=>t.keyboardShortcut("Enter"),Lb=()=>({state:t,dispatch:e})=>Hj(t,e);function cr(t,e,s={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>s.strict?e[i]===t[i]:Da(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function Hi(t,e,s={}){return t.find(r=>r.type===e&&cr(r.attrs,s))}function Tb(t,e,s={}){return!!Hi(t,e,s)}function Oa(t,e,s={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(t.parentOffset===r.offset&&r.offset!==0&&(r=t.parent.childBefore(t.parentOffset)),!r.node)return;const i=Hi([...r.node.marks],e,s);if(!i)return;let a=r.index,o=t.start()+r.offset,l=a+1,c=o+r.node.nodeSize;for(Hi([...r.node.marks],e,s);a>0&&i.isInSet(t.parent.child(a-1).marks);)a-=1,o-=t.parent.child(a).nodeSize;for(;l<t.parent.childCount&&Tb([...t.parent.child(l).marks],e,s);)c+=t.parent.child(l).nodeSize,l+=1;return{from:o,to:c}}function as(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const Ab=(t,e={})=>({tr:s,state:r,dispatch:i})=>{const a=as(t,r.schema),{doc:o,selection:l}=s,{$from:c,from:u,to:h}=l;if(i){const m=Oa(c,a,e);if(m&&m.from<=u&&m.to>=h){const p=J.create(o,m.from,m.to);s.setSelection(p)}}return!0},Ib=t=>e=>{const s=typeof t=="function"?t(e):t;for(let r=0;r<s.length;r+=1)if(s[r](e))return!0;return!1};function au(t){return t instanceof J}function us(t=0,e=0,s=0){return Math.min(Math.max(t,e),s)}function ou(t,e=null){if(!e)return null;const s=K.atStart(t),r=K.atEnd(t);if(e==="start"||e===!0)return s;if(e==="end")return r;const i=s.from,a=r.to;return e==="all"?J.create(t,us(0,i,a),us(t.content.size,i,a)):J.create(t,us(e,i,a),us(e,i,a))}function Pa(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const Eb=(t=null,e={})=>({editor:s,view:r,tr:i,dispatch:a})=>{e={scrollIntoView:!0,...e};const o=()=>{Pa()&&r.dom.focus(),requestAnimationFrame(()=>{s.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&s.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(a&&t===null&&!au(s.state.selection))return o(),!0;const l=ou(i.doc,t)||s.state.selection,c=s.state.selection.eq(l);return a&&(c||i.setSelection(l),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Db=(t,e)=>s=>t.every((r,i)=>e(r,{...s,index:i})),Ob=(t,e)=>({tr:s,commands:r})=>r.insertContentAt({from:s.selection.from,to:s.selection.to},t,e);function nl(t){const e=`<body>${t}</body>`;return new window.DOMParser().parseFromString(e,"text/html").body}function dr(t,e,s){if(s={slice:!0,parseOptions:{},...s},typeof t=="object"&&t!==null)try{return Array.isArray(t)&&t.length>0?S.fromArray(t.map(r=>e.nodeFromJSON(r))):e.nodeFromJSON(t)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",r),dr("",e,s)}if(typeof t=="string"){const r=_s.fromSchema(e);return s.slice?r.parseSlice(nl(t),s.parseOptions).content:r.parse(nl(t),s.parseOptions)}return dr("",e,s)}function Pb(t,e,s){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Te||i instanceof Ce))return;const a=t.mapping.maps[r];let o=0;a.forEach((l,c,u,h)=>{o===0&&(o=h)}),t.setSelection(K.near(t.doc.resolve(o),s))}const Fb=t=>t.toString().startsWith("<"),zb=(t,e,s)=>({tr:r,dispatch:i,editor:a})=>{if(i){s={parseOptions:{},updateSelection:!0,...s};const o=dr(e,a.schema,{parseOptions:{preserveWhitespace:"full",...s.parseOptions}});if(o.toString()==="<>")return!0;let{from:l,to:c}=typeof t=="number"?{from:t,to:t}:t,u=!0,h=!0;if((Fb(o)?o:[o]).forEach(p=>{p.check(),u=u?p.isText&&p.marks.length===0:!1,h=h?p.isBlock:!1}),l===c&&h){const{parent:p}=r.doc.resolve(l);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(l-=1,c+=1)}u?Array.isArray(e)?r.insertText(e.map(p=>p.text||"").join(""),l,c):typeof e=="object"&&e&&e.text?r.insertText(e.text,l,c):r.insertText(e,l,c):r.replaceWith(l,c,o),s.updateSelection&&Pb(r,r.steps.length-1,-1)}return!0},Rb=()=>({state:t,dispatch:e})=>_j(t,e),_b=()=>({state:t,dispatch:e})=>Bj(t,e),Bb=()=>({state:t,dispatch:e})=>Oj(t,e),Vb=()=>({state:t,dispatch:e})=>zj(t,e);function lu(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function $b(t){const e=t.split(/-(?!$)/);let s=e[e.length-1];s==="Space"&&(s=" ");let r,i,a,o;for(let l=0;l<e.length-1;l+=1){const c=e[l];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))a=!0;else if(/^mod$/i.test(c))Pa()||lu()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(s=`Alt-${s}`),i&&(s=`Ctrl-${s}`),o&&(s=`Meta-${s}`),a&&(s=`Shift-${s}`),s}const Hb=t=>({editor:e,view:s,tr:r,dispatch:i})=>{const a=$b(t).split(/-(?!$)/),o=a.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{s.someProp("handleKeyDown",u=>u(s,l))});return c==null||c.steps.forEach(u=>{const h=u.map(r.mapping);h&&i&&r.maybeStep(h)}),!0};function wn(t,e,s={}){const{from:r,to:i,empty:a}=t.selection,o=e?ke(e,t.schema):null,l=[];t.doc.nodesBetween(r,i,(m,p)=>{if(m.isText)return;const f=Math.max(r,p),x=Math.min(i,p+m.nodeSize);l.push({node:m,from:f,to:x})});const c=i-r,u=l.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>cr(m.node.attrs,s,{strict:!1}));return a?!!u.length:u.reduce((m,p)=>m+p.to-p.from,0)>=c}const qb=(t,e={})=>({state:s,dispatch:r})=>{const i=ke(t,s.schema);return wn(s,i,e)?Vj(s,r):!1},Ub=()=>({state:t,dispatch:e})=>Uj(t,e),Wb=t=>({state:e,dispatch:s})=>{const r=ke(t,e.schema);return Xj(r)(e,s)},Zb=()=>({state:t,dispatch:e})=>$j(t,e);function Rr(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function rl(t,e){const s=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(s.includes(i)||(r[i]=t[i]),r),{})}const Kb=(t,e)=>({tr:s,state:r,dispatch:i})=>{let a=null,o=null;const l=Rr(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(a=ke(t,r.schema)),l==="mark"&&(o=as(t,r.schema)),i&&s.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,h)=>{a&&a===u.type&&s.setNodeMarkup(h,void 0,rl(u.attrs,e)),o&&u.marks.length&&u.marks.forEach(m=>{o===m.type&&s.addMark(h,h+u.nodeSize,o.create(rl(m.attrs,e)))})})}),!0):!1},Jb=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Gb=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),Qb=()=>({state:t,dispatch:e})=>Pj(t,e),Yb=()=>({state:t,dispatch:e})=>Rj(t,e),Xb=()=>({state:t,dispatch:e})=>Wj(t,e),e3=()=>({state:t,dispatch:e})=>Jj(t,e),t3=()=>({state:t,dispatch:e})=>Kj(t,e);function cu(t,e,s={}){return dr(t,e,{slice:!1,parseOptions:s})}const s3=(t,e=!1,s={})=>({tr:r,editor:i,dispatch:a})=>{const{doc:o}=r,l=cu(t,i.schema,s);return a&&r.replaceWith(0,o.content.size,l).setMeta("preventUpdate",!e),!0};function H6(t,e){const s=new gd(t);return e.forEach(r=>{r.steps.forEach(i=>{s.step(i)})}),s}function n3(t){for(let e=0;e<t.edgeCount;e+=1){const{type:s}=t.edge(e);if(s.isTextblock&&!s.hasRequiredAttrs())return s}return null}function q6(t,e){const s=[];return t.descendants((r,i)=>{e(r)&&s.push({node:r,pos:i})}),s}function U6(t,e,s){const r=[];return t.nodesBetween(e.from,e.to,(i,a)=>{s(i)&&r.push({node:i,pos:a})}),r}function r3(t,e){for(let s=t.depth;s>0;s-=1){const r=t.node(s);if(e(r))return{pos:s>0?t.before(s):0,start:t.start(s),depth:s,node:r}}}function Fa(t){return e=>r3(e.$from,t)}function i3(t,e){const s=yt.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(s),i.innerHTML}function a3(t,e){const s={from:0,to:t.content.size};return ru(t,s,e)}function zn(t,e){const s=as(e,t.schema),{from:r,to:i,empty:a}=t.selection,o=[];a?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,c=>{o.push(...c.marks)});const l=o.find(c=>c.type.name===s.name);return l?{...l.attrs}:{}}function o3(t,e){const s=ke(e,t.schema),{from:r,to:i}=t.selection,a=[];t.doc.nodesBetween(r,i,l=>{a.push(l)});const o=a.reverse().find(l=>l.type.name===s.name);return o?{...o.attrs}:{}}function l3(t,e){const s=Rr(typeof e=="string"?e:e.name,t.schema);return s==="node"?o3(t,e):s==="mark"?zn(t,e):{}}function c3(t,e=JSON.stringify){const s={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(s,i)?!1:s[i]=!0})}function d3(t){const e=c3(t);return e.length===1?e:e.filter((s,r)=>!e.filter((a,o)=>o!==r).some(a=>s.oldRange.from>=a.oldRange.from&&s.oldRange.to<=a.oldRange.to&&s.newRange.from>=a.newRange.from&&s.newRange.to<=a.newRange.to))}function W6(t){const{mapping:e,steps:s}=t,r=[];return e.maps.forEach((i,a)=>{const o=[];if(i.ranges.length)i.forEach((l,c)=>{o.push({from:l,to:c})});else{const{from:l,to:c}=s[a];if(l===void 0||c===void 0)return;o.push({from:l,to:c})}o.forEach(({from:l,to:c})=>{const u=e.slice(a).map(l,-1),h=e.slice(a).map(c),m=e.invert().map(u,-1),p=e.invert().map(h);r.push({oldRange:{from:m,to:p},newRange:{from:u,to:h}})})}),d3(r)}function du(t,e,s){const r=[];return t===e?s.resolve(t).marks().forEach(i=>{const a=s.resolve(t-1),o=Oa(a,i.type);o&&r.push({mark:i,...o})}):s.nodesBetween(t,e,(i,a)=>{r.push(...i.marks.map(o=>({from:a,to:a+i.nodeSize,mark:o})))}),r}function Kn(t,e,s){return Object.fromEntries(Object.entries(s).filter(([r])=>{const i=t.find(a=>a.type===e&&a.name===r);return i?i.attribute.keepOnSplit:!1}))}function qi(t,e,s={}){const{empty:r,ranges:i}=t.selection,a=e?as(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>a?a.name===m.type.name:!0).find(m=>cr(m.attrs,s,{strict:!1}));let o=0;const l=[];if(i.forEach(({$from:m,$to:p})=>{const f=m.pos,x=p.pos;t.doc.nodesBetween(f,x,(b,y)=>{if(!b.isText&&!b.marks.length)return;const k=Math.max(f,y),M=Math.min(x,y+b.nodeSize),R=M-k;o+=R,l.push(...b.marks.map(Q=>({mark:Q,from:k,to:M})))})}),o===0)return!1;const c=l.filter(m=>a?a.name===m.mark.type.name:!0).filter(m=>cr(m.mark.attrs,s,{strict:!1})).reduce((m,p)=>m+p.to-p.from,0),u=l.filter(m=>a?m.mark.type!==a&&m.mark.type.excludes(a):!0).reduce((m,p)=>m+p.to-p.from,0);return(c>0?c+u:c)>=o}function u3(t,e,s={}){if(!e)return wn(t,null,s)||qi(t,null,s);const r=Rr(e,t.schema);return r==="node"?wn(t,e,s):r==="mark"?qi(t,e,s):!1}function il(t,e){const{nodeExtensions:s}=Pr(e),r=s.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},a=Z(A(r,"group",i));return typeof a!="string"?!1:a.split(" ").includes("list")}function h3(t){var e;const s=(e=t.type.createAndFill())===null||e===void 0?void 0:e.toJSON(),r=t.toJSON();return JSON.stringify(s)===JSON.stringify(r)}function m3(t,e,s){var r;const{selection:i}=e;let a=null;if(au(i)&&(a=i.$cursor),a){const l=(r=t.storedMarks)!==null&&r!==void 0?r:a.marks();return!!s.isInSet(l)||!l.some(c=>c.type.excludes(s))}const{ranges:o}=i;return o.some(({$from:l,$to:c})=>{let u=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(s):!1;return t.doc.nodesBetween(l.pos,c.pos,(h,m,p)=>{if(u)return!1;if(h.isInline){const f=!p||p.type.allowsMarkType(s),x=!!s.isInSet(h.marks)||!h.marks.some(b=>b.type.excludes(s));u=f&&x}return!u}),u})}const p3=(t,e={})=>({tr:s,state:r,dispatch:i})=>{const{selection:a}=s,{empty:o,ranges:l}=a,c=as(t,r.schema);if(i)if(o){const u=zn(r,c);s.addStoredMark(c.create({...u,...e}))}else l.forEach(u=>{const h=u.$from.pos,m=u.$to.pos;r.doc.nodesBetween(h,m,(p,f)=>{const x=Math.max(f,h),b=Math.min(f+p.nodeSize,m);p.marks.find(k=>k.type===c)?p.marks.forEach(k=>{c===k.type&&s.addMark(x,b,c.create({...k.attrs,...e}))}):s.addMark(x,b,c.create(e))})});return m3(r,s,c)},f3=(t,e)=>({tr:s})=>(s.setMeta(t,e),!0),g3=(t,e={})=>({state:s,dispatch:r,chain:i})=>{const a=ke(t,s.schema);return a.isTextblock?i().command(({commands:o})=>Xo(a,e)(s)?!0:o.clearNodes()).command(({state:o})=>Xo(a,e)(o,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},x3=t=>({tr:e,dispatch:s})=>{if(s){const{doc:r}=e,i=us(t,0,r.content.size),a=B.create(r,i);e.setSelection(a)}return!0},j3=t=>({tr:e,dispatch:s})=>{if(s){const{doc:r}=e,{from:i,to:a}=typeof t=="number"?{from:t,to:t}:t,o=J.atStart(r).from,l=J.atEnd(r).to,c=us(i,o,l),u=us(a,o,l),h=J.create(r,c,u);e.setSelection(h)}return!0},b3=t=>({state:e,dispatch:s})=>{const r=ke(t,e.schema);return sb(r)(e,s)};function al(t,e){const s=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(s){const r=s.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}const y3=({keepMarks:t=!0}={})=>({tr:e,state:s,dispatch:r,editor:i})=>{const{selection:a,doc:o}=e,{$from:l,$to:c}=a,u=i.extensionManager.attributes,h=Kn(u,l.node().type.name,l.node().attrs);if(a instanceof B&&a.node.isBlock)return!l.parentOffset||!Ps(o,l.pos)?!1:(r&&(t&&al(s,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(r){const m=c.parentOffset===c.parent.content.size;a instanceof J&&e.deleteSelection();const p=l.depth===0?void 0:n3(l.node(-1).contentMatchAt(l.indexAfter(-1)));let f=m&&p?[{type:p,attrs:h}]:void 0,x=Ps(e.doc,e.mapping.map(l.pos),1,f);if(!f&&!x&&Ps(e.doc,e.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(x=!0,f=p?[{type:p,attrs:h}]:void 0),x&&(e.split(e.mapping.map(l.pos),1,f),p&&!m&&!l.parentOffset&&l.parent.type!==p)){const b=e.mapping.map(l.before()),y=e.doc.resolve(b);l.node(-1).canReplaceWith(y.index(),y.index()+1,p)&&e.setNodeMarkup(e.mapping.map(l.before()),p)}t&&al(s,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},v3=t=>({tr:e,state:s,dispatch:r,editor:i})=>{var a;const o=ke(t,s.schema),{$from:l,$to:c}=s.selection,u=s.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const h=l.node(-1);if(h.type!==o)return!1;const m=i.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==o||l.index(-2)!==l.node(-2).childCount-1)return!1;if(r){let y=S.empty;const k=l.index(-1)?1:l.index(-2)?2:3;for(let de=l.depth-k;de>=l.depth-3;de-=1)y=S.from(l.node(de).copy(y));const M=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,R=Kn(m,l.node().type.name,l.node().attrs),Q=((a=o.contentMatch.defaultType)===null||a===void 0?void 0:a.createAndFill(R))||void 0;y=y.append(S.from(o.createAndFill(null,Q)||void 0));const W=l.before(l.depth-(k-1));e.replace(W,l.after(-M),new L(y,4-k,0));let pe=-1;e.doc.nodesBetween(W,e.doc.content.size,(de,U)=>{if(pe>-1)return!1;de.isTextblock&&de.content.size===0&&(pe=U+1)}),pe>-1&&e.setSelection(J.near(e.doc.resolve(pe))),e.scrollIntoView()}return!0}const p=c.pos===l.end()?h.contentMatchAt(0).defaultType:null,f=Kn(m,h.type.name,h.attrs),x=Kn(m,l.node().type.name,l.node().attrs);e.delete(l.pos,c.pos);const b=p?[{type:o,attrs:f},{type:p,attrs:x}]:[{type:o,attrs:f}];if(!Ps(e.doc,l.pos,2))return!1;if(r){const{selection:y,storedMarks:k}=s,{splittableMarks:M}=i.extensionManager,R=k||y.$to.parentOffset&&y.$from.marks();if(e.split(l.pos,2,b).scrollIntoView(),!R||!r)return!0;const Q=R.filter(W=>M.includes(W.type.name));e.ensureMarks(Q)}return!0},ui=(t,e)=>{const s=Fa(o=>o.type===e)(t.selection);if(!s)return!0;const r=t.doc.resolve(Math.max(0,s.pos-1)).before(s.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return s.node.type===(i==null?void 0:i.type)&&ns(t.doc,s.pos)&&t.join(s.pos),!0},hi=(t,e)=>{const s=Fa(o=>o.type===e)(t.selection);if(!s)return!0;const r=t.doc.resolve(s.start).after(s.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return s.node.type===(i==null?void 0:i.type)&&ns(t.doc,r)&&t.join(r),!0},C3=(t,e,s)=>({editor:r,tr:i,state:a,dispatch:o,chain:l,commands:c,can:u})=>{const{extensions:h,splittableMarks:m}=r.extensionManager,p=ke(t,a.schema),f=ke(e,a.schema),{selection:x,storedMarks:b}=a,{$from:y,$to:k}=x,M=y.blockRange(k),R=b||x.$to.parentOffset&&x.$from.marks();if(!M)return!1;const Q=Fa(W=>il(W.type.name,h))(x);if(M.depth>=1&&Q&&M.depth-Q.depth<=1){if(Q.node.type===p)return c.liftListItem(f);if(il(Q.node.type.name,h)&&p.validContent(Q.node.content)&&o)return l().command(()=>(i.setNodeMarkup(Q.pos,p),!0)).command(()=>ui(i,p)).command(()=>hi(i,p)).run()}return!s||!R||!o?l().command(()=>u().wrapInList(p)?!0:c.clearNodes()).wrapInList(p).command(()=>ui(i,p)).command(()=>hi(i,p)).run():l().command(()=>{const W=u().wrapInList(p),pe=R.filter(de=>m.includes(de.type.name));return i.ensureMarks(pe),W?!0:c.clearNodes()}).wrapInList(p).command(()=>ui(i,p)).command(()=>hi(i,p)).run()},k3=(t,e={},s={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:a=!1}=s,o=as(t,r.schema);return qi(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,e)},w3=(t,e,s={})=>({state:r,commands:i})=>{const a=ke(t,r.schema),o=ke(e,r.schema);return wn(r,a,s)?i.setNode(o):i.setNode(a,s)},S3=(t,e={})=>({state:s,commands:r})=>{const i=ke(t,s.schema);return wn(s,i,e)?r.lift(i):r.wrapIn(i,e)},M3=()=>({state:t,dispatch:e})=>{const s=t.plugins;for(let r=0;r<s.length;r+=1){const i=s[r];let a;if(i.spec.isInputRules&&(a=i.getState(t))){if(e){const o=t.tr,l=a.transform;for(let c=l.steps.length-1;c>=0;c-=1)o.step(l.steps[c].invert(l.docs[c]));if(a.text){const c=o.doc.resolve(a.from).marks();o.replaceWith(a.from,a.to,t.schema.text(a.text,c))}else o.delete(a.from,a.to)}return!0}}return!1},N3=()=>({tr:t,dispatch:e})=>{const{selection:s}=t,{empty:r,ranges:i}=s;return r||e&&i.forEach(a=>{t.removeMark(a.$from.pos,a.$to.pos)}),!0},L3=(t,e={})=>({tr:s,state:r,dispatch:i})=>{var a;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=s,c=as(t,r.schema),{$from:u,empty:h,ranges:m}=l;if(!i)return!0;if(h&&o){let{from:p,to:f}=l;const x=(a=u.marks().find(y=>y.type===c))===null||a===void 0?void 0:a.attrs,b=Oa(u,c,x);b&&(p=b.from,f=b.to),s.removeMark(p,f,c)}else m.forEach(p=>{s.removeMark(p.$from.pos,p.$to.pos,c)});return s.removeStoredMark(c),!0},T3=(t,e={})=>({tr:s,state:r,dispatch:i})=>{let a=null,o=null;const l=Rr(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(a=ke(t,r.schema)),l==="mark"&&(o=as(t,r.schema)),i&&s.selection.ranges.forEach(c=>{const u=c.$from.pos,h=c.$to.pos;r.doc.nodesBetween(u,h,(m,p)=>{a&&a===m.type&&s.setNodeMarkup(p,void 0,{...m.attrs,...e}),o&&m.marks.length&&m.marks.forEach(f=>{if(o===f.type){const x=Math.max(p,u),b=Math.min(p+m.nodeSize,h);s.addMark(x,b,o.create({...f.attrs,...e}))}})})}),!0):!1},A3=(t,e={})=>({state:s,dispatch:r})=>{const i=ke(t,s.schema);return Gj(i,e)(s,r)},I3=(t,e={})=>({state:s,dispatch:r})=>{const i=ke(t,s.schema);return Qj(i,e)(s,r)};var E3=Object.freeze({__proto__:null,blur:jb,clearContent:bb,clearNodes:yb,command:vb,createParagraphNear:Cb,deleteCurrentNode:kb,deleteNode:wb,deleteRange:Sb,deleteSelection:Mb,enter:Nb,exitCode:Lb,extendMarkRange:Ab,first:Ib,focus:Eb,forEach:Db,insertContent:Ob,insertContentAt:zb,joinUp:Rb,joinDown:_b,joinBackward:Bb,joinForward:Vb,keyboardShortcut:Hb,lift:qb,liftEmptyBlock:Ub,liftListItem:Wb,newlineInCode:Zb,resetAttributes:Kb,scrollIntoView:Jb,selectAll:Gb,selectNodeBackward:Qb,selectNodeForward:Yb,selectParentNode:Xb,selectTextblockEnd:e3,selectTextblockStart:t3,setContent:s3,setMark:p3,setMeta:f3,setNode:g3,setNodeSelection:x3,setTextSelection:j3,sinkListItem:b3,splitBlock:y3,splitListItem:v3,toggleList:C3,toggleMark:k3,toggleNode:w3,toggleWrap:S3,undoInputRule:M3,unsetAllMarks:N3,unsetMark:L3,updateAttributes:T3,wrapIn:A3,wrapInList:I3});const D3=Ae.create({name:"commands",addCommands(){return{...E3}}}),O3=Ae.create({name:"editable",addProseMirrorPlugins(){return[new ct({key:new rs("editable"),props:{editable:()=>this.editor.options.editable}})]}}),P3=Ae.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ct({key:new rs("focusEvents"),props:{handleDOMEvents:{focus:(e,s)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:s}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,s)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:s}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),F3=Ae.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:c,doc:u}=l,{empty:h,$anchor:m}=c,{pos:p,parent:f}=m,x=K.atStart(u).from===p;return!h||!x||!f.type.isTextblock||f.textContent.length?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},a={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Pa()||lu()?a:i},addProseMirrorPlugins(){return[new ct({key:new rs("clearDocument"),appendTransaction:(t,e,s)=>{if(!(t.some(x=>x.docChanged)&&!e.doc.eq(s.doc)))return;const{empty:i,from:a,to:o}=e.selection,l=K.atStart(e.doc).from,c=K.atEnd(e.doc).to,u=a===l&&o===c,h=s.doc.textBetween(0,s.doc.content.size," "," ").length===0;if(i||!u||!h)return;const m=s.tr,p=Dr({state:s,transaction:m}),{commands:f}=new Or({editor:this.editor,state:p});if(f.clearNodes(),!!m.steps.length)return m}})]}}),z3=Ae.create({name:"tabindex",addProseMirrorPlugins(){return[new ct({key:new rs("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});var R3=Object.freeze({__proto__:null,ClipboardTextSerializer:xb,Commands:D3,Editable:O3,FocusEvents:P3,Keymap:F3,Tabindex:z3});const _3=`.ProseMirror { position: relative; } .ProseMirror { word-wrap: break-word; white-space: pre-wrap; white-space: break-spaces; -webkit-font-variant-ligatures: none; font-variant-ligatures: none; font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ } .ProseMirror [contenteditable="false"] { white-space: normal; } .ProseMirror [contenteditable="false"] [contenteditable="true"] { white-space: pre-wrap; } .ProseMirror pre { white-space: pre-wrap; } img.ProseMirror-separator { display: inline !important; border: none !important; margin: 0 !important; width: 1px !important; height: 1px !important; } .ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; margin: 0; } .ProseMirror-gapcursor:after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid black; animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; } @keyframes ProseMirror-cursor-blink { to { visibility: hidden; } } .ProseMirror-hideselection *::selection { background: transparent; } .ProseMirror-hideselection *::-moz-selection { background: transparent; } .ProseMirror-hideselection * { caret-color: transparent; } .ProseMirror-focused .ProseMirror-gapcursor { display: block; } .tippy-box[data-animation=fade][data-state=hidden] { opacity: 0 }`;function B3(t,e){const s=document.querySelector("style[data-tiptap-style]");if(s!==null)return s;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute("data-tiptap-style",""),r.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(r),r}let V3=class extends nb{constructor(e={}){super(),this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>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.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),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},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=B3(_3,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,s=!0){this.setOptions({editable:e}),s&&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,s){const r=nu(s)?s(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});this.view.updateState(i)}unregisterPlugin(e){if(this.isDestroyed)return;const s=typeof e=="string"?`${e}$`:e.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(i=>!i.key.startsWith(s))});this.view.updateState(r)}createExtensionManager(){const s=[...this.options.enableCoreExtensions?Object.values(R3):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r==null?void 0:r.type));this.extensionManager=new Is(s,this)}createCommandManager(){this.commandManager=new Or({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){const e=cu(this.options.content,this.schema,this.options.parseOptions),s=ou(e,this.options.autofocus);this.view=new vj(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:Ts.create({doc:e,selection:s||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const s=this.capturedTransaction;return this.capturedTransaction=null,s}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(o)});return}const s=this.state.apply(e),r=!this.state.selection.eq(s.selection);this.view.updateState(s),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),a=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),a&&this.emit("blur",{editor:this,event:a.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return l3(this.state,e)}isActive(e,s){const r=typeof e=="string"?e:null,i=typeof e=="string"?s:e;return u3(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return i3(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:s=` `,textSerializers:r={}}=e||{};return a3(this.state.doc,{blockSeparator:s,textSerializers:{...iu(this.schema),...r}})}get isEmpty(){return h3(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(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}};function Us(t){return new Fr({find:t.find,handler:({state:e,range:s,match:r})=>{const i=Z(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:a}=e,o=r[r.length-1],l=r[0];let c=s.to;if(o){const u=l.search(/\S/),h=s.from+l.indexOf(o),m=h+o.length;if(du(s.from,s.to,e.doc).filter(f=>f.mark.type.excluded.find(b=>b===t.type&&b!==f.mark.type)).filter(f=>f.to>h).length)return null;m<s.to&&a.delete(m,s.to),h>s.from&&a.delete(s.from+u,h),c=s.from+u+o.length,a.addMark(s.from+u,c,t.type.create(i||{})),a.removeStoredMark(t.type)}}})}function $3(t){return new Fr({find:t.find,handler:({state:e,range:s,match:r})=>{const i=Z(t.getAttributes,void 0,r)||{},{tr:a}=e,o=s.from;let l=s.to;if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>l?u=l:l=u+r[1].length;const h=r[0][r[0].length-1];a.insertText(h,o+r[0].length-1),a.replaceWith(u,l,t.type.create(i))}else r[0]&&a.replaceWith(o,l,t.type.create(i))}})}function Ui(t){return new Fr({find:t.find,handler:({state:e,range:s,match:r})=>{const i=e.doc.resolve(s.from),a=Z(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(s.from,s.to).setBlockType(s.from,s.from,t.type,a)}})}function Sn(t){return new Fr({find:t.find,handler:({state:e,range:s,match:r,chain:i})=>{const a=Z(t.getAttributes,void 0,r)||{},o=e.tr.delete(s.from,s.to),c=o.doc.resolve(s.from).blockRange(),u=c&&va(c,t.type,a);if(!u)return null;if(o.wrap(c,u),t.keepMarks&&t.editor){const{selection:m,storedMarks:p}=e,{splittableMarks:f}=t.editor.extensionManager,x=p||m.$to.parentOffset&&m.$from.marks();if(x){const b=x.filter(y=>f.includes(y.type.name));o.ensureMarks(b)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(m,a).run()}const h=o.doc.resolve(s.from-1).nodeBefore;h&&h.type===t.type&&ns(o.doc,s.from-1)&&(!t.joinPredicate||t.joinPredicate(r,h))&&o.join(s.from-1)}})}class ot{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&&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=Z(A(this,"addOptions",{name:this.name}))),this.storage=Z(A(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ot(e)}configure(e={}){const s=this.extend();return s.options=zr(this.options,e),s.storage=Z(A(s,"addStorage",{name:s.name,options:s.options})),s}extend(e={}){const s=new ot(e);return s.parent=this,this.child=s,s.name=e.name?e.name:s.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${s.name}".`),s.options=Z(A(s,"addOptions",{name:s.name})),s.storage=Z(A(s,"addStorage",{name:s.name,options:s.options})),s}static handleExit({editor:e,mark:s}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(u=>(u==null?void 0:u.type.name)===s.name))return!1;const c=o.find(u=>(u==null?void 0:u.type.name)===s.name);return c&&r.removeStoredMark(c),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}class Ie{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&&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=Z(A(this,"addOptions",{name:this.name}))),this.storage=Z(A(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ie(e)}configure(e={}){const s=this.extend();return s.options=zr(this.options,e),s.storage=Z(A(s,"addStorage",{name:s.name,options:s.options})),s}extend(e={}){const s=new Ie(e);return s.parent=this,this.child=s,s.name=e.name?e.name:s.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${s.name}".`),s.options=Z(A(s,"addOptions",{name:s.name})),s.storage=Z(A(s,"addStorage",{name:s.name,options:s.options})),s}}function Ws(t){return new ub({find:t.find,handler:({state:e,range:s,match:r})=>{const i=Z(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:a}=e,o=r[r.length-1],l=r[0];let c=s.to;if(o){const u=l.search(/\S/),h=s.from+l.indexOf(o),m=h+o.length;if(du(s.from,s.to,e.doc).filter(f=>f.mark.type.excluded.find(b=>b===t.type&&b!==f.mark.type)).filter(f=>f.to>h).length)return null;m<s.to&&a.delete(m,s.to),h>s.from&&a.delete(s.from+u,h),c=s.from+u+o.length,a.addMark(s.from+u,c,t.type.create(i||{})),a.removeStoredMark(t.type)}}})}class H3 extends V3{constructor(){super(...arguments),this.contentComponent=null}}const q3=({renderers:t})=>_.createElement(_.Fragment,null,Object.entries(t).map(([e,s])=>hh.createPortal(s.reactElement,s.element,e)));class U3 extends _.Component{constructor(e){super(e),this.editorContentRef=_.createRef(),this.initialized=!1,this.state={renderers:{}}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const{editor:e}=this.props;if(e&&e.options.element){if(e.contentComponent)return;const s=this.editorContentRef.current;s.append(...e.options.element.childNodes),e.setOptions({element:s}),e.contentComponent=this,e.createNodeViews(),this.initialized=!0}}maybeFlushSync(e){this.initialized?queueMicrotask(()=>{uh.flushSync(e)}):e()}setRenderer(e,s){this.maybeFlushSync(()=>{this.setState(({renderers:r})=>({renderers:{...r,[e]:s}}))})}removeRenderer(e){this.maybeFlushSync(()=>{this.setState(({renderers:s})=>{const r={...s};return delete r[e],{renderers:r}})})}componentWillUnmount(){const{editor:e}=this.props;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null,!e.options.element.firstChild))return;const s=document.createElement("div");s.append(...e.options.element.childNodes),e.setOptions({element:s})}render(){const{editor:e,...s}=this.props;return _.createElement(_.Fragment,null,_.createElement("div",{ref:this.editorContentRef,...s}),_.createElement(q3,{renderers:this.state.renderers}))}}const za=_.memo(U3),W3=j.createContext({onDragStart:void 0}),Z3=()=>j.useContext(W3);_.forwardRef((t,e)=>{const{onDragStart:s}=Z3(),r=t.as||"div";return _.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:s,style:{whiteSpace:"normal",...t.style}})});function K3(){const[,t]=j.useState(0);return()=>t(e=>e+1)}const J3=(t={},e=[])=>{const[s,r]=j.useState(null),i=K3();return j.useEffect(()=>{let a=!0;const o=new H3(t);return r(o),o.on("transaction",()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{a&&i()})})}),()=>{o.destroy(),a=!1}},e),s},G3=/^\s*>\s$/,Q3=Ie.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",me(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Sn({find:G3,type:this.type})]}}),Y3=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/,X3=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g,ey=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/,ty=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/g,sy=ot.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",me(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Us({find:Y3,type:this.type}),Us({find:ey,type:this.type})]},addPasteRules(){return[Ws({find:X3,type:this.type}),Ws({find:ty,type:this.type})]}}),ny=Ie.create({name:"listItem",addOptions(){return{HTMLAttributes:{}}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",me(this.options.HTMLAttributes,t),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)}}}),ol=ot.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",me(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const s=zn(t,this.type);return Object.entries(s).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),ll=/^\s*([-+*])\s$/,ry=Ie.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",me(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ny.name,this.editor.getAttributes(ol.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Sn({find:ll,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Sn({find:ll,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ol.name),editor:this.editor})),[t]}}),iy=/(?:^|\s)((?:`)((?:[^`]+))(?:`))$/,ay=/(?:^|\s)((?:`)((?:[^`]+))(?:`))/g,oy=ot.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",me(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Us({find:iy,type:this.type})]},addPasteRules(){return[Ws({find:ay,type:this.type})]}}),ly=/^```([a-z]+)?[\s\n]$/,cy=/^~~~([a-z]+)?[\s\n]$/,dy=Ie.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:t=>{var e;const{languageClassPrefix:s}=this.options,a=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(s)).map(o=>o.replace(s,""))[0];return a||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",me(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,s=e.pos===1;return!t||e.parent.type.name!==this.name?!1:s||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:s}=e,{$from:r,empty:i}=s;if(!i||r.parent.type!==this.type)return!1;const a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` `);return!a||!o?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:s,doc:r}=e,{$from:i,empty:a}=s;if(!a||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0||r.nodeAt(l)?!1:t.commands.exitCode()}}},addInputRules(){return[Ui({find:ly,type:this.type,getAttributes:t=>({language:t[1]})}),Ui({find:cy,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new ct({key:new rs("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const s=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,a=i==null?void 0:i.mode;if(!s||!a)return!1;const{tr:o}=t.state;return o.replaceSelectionWith(this.type.create({language:a})),o.setSelection(J.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.insertText(s.replace(/\r\n?/g,` `)),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),uy=Ie.create({name:"doc",topNode:!0,content:"block+"});function hy(t={}){return new ct({view(e){return new my(e,t)}})}class my{constructor(e,s){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=s.width||1,this.color=s.color||"black",this.class=s.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let i=a=>{this[r](a)};return e.dom.addEventListener(r,i),{name:r,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:s})=>this.editorView.dom.removeEventListener(e,s))}update(e,s){this.cursorPos!=null&&s.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),s=!e.parent.inlineContent,r;if(s){let l=e.nodeBefore,c=e.nodeAfter;if(l||c){let u=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(u){let h=u.getBoundingClientRect(),m=l?h.bottom:h.top;l&&c&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:h.left,right:h.right,top:m-this.width/2,bottom:m+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none; background-color: "+this.color),this.element.classList.toggle("prosemirror-dropcursor-block",s),this.element.classList.toggle("prosemirror-dropcursor-inline",!s);let a,o;if(!i||i==document.body&&getComputedStyle(i).position=="static")a=-pageXOffset,o=-pageYOffset;else{let l=i.getBoundingClientRect();a=l.left-i.scrollLeft,o=l.top-i.scrollTop}this.element.style.left=r.left-a+"px",this.element.style.top=r.top-o+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let s=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=s&&s.inside>=0&&this.editorView.state.doc.nodeAt(s.inside),i=r&&r.type.spec.disableDropCursor,a=typeof i=="function"?i(this.editorView,s,e):i;if(s&&!a){let o=s.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=ud(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const py=Ae.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[hy(this.options)]}});class ue extends K{constructor(e){super(e,e)}map(e,s){let r=e.resolve(s.map(this.head));return ue.valid(r)?new ue(r):K.near(r)}content(){return L.empty}eq(e){return e instanceof ue&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,s){if(typeof s.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ue(e.resolve(s.pos))}getBookmark(){return new Ra(this.anchor)}static valid(e){let s=e.parent;if(s.isTextblock||!fy(e)||!gy(e))return!1;let r=s.type.spec.allowGapCursor;if(r!=null)return r;let i=s.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,s,r=!1){e:for(;;){if(!r&&ue.valid(e))return e;let i=e.pos,a=null;for(let o=e.depth;;o--){let l=e.node(o);if(s>0?e.indexAfter(o)<l.childCount:e.index(o)>0){a=l.child(s>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=s;let c=e.doc.resolve(i);if(ue.valid(c))return c}for(;;){let o=s>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!B.isSelectable(a)){e=e.doc.resolve(i+a.nodeSize*s),r=!1;continue e}break}a=o,i+=s;let l=e.doc.resolve(i);if(ue.valid(l))return l}return null}}}ue.prototype.visible=!1;ue.findFrom=ue.findGapCursorFrom;K.jsonID("gapcursor",ue);class Ra{constructor(e){this.pos=e}map(e){return new Ra(e.map(this.pos))}resolve(e){let s=e.resolve(this.pos);return ue.valid(s)?new ue(s):K.near(s)}}function fy(t){for(let e=t.depth;e>=0;e--){let s=t.index(e),r=t.node(e);if(s==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(s-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function gy(t){for(let e=t.depth;e>=0;e--){let s=t.indexAfter(e),r=t.node(e);if(s==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(s);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function xy(){return new ct({props:{decorations:vy,createSelectionBetween(t,e,s){return e.pos==s.pos&&ue.valid(s)?new ue(s):null},handleClick:by,handleKeyDown:jy,handleDOMEvents:{beforeinput:yy}}})}const jy=Gd({ArrowLeft:qn("horiz",-1),ArrowRight:qn("horiz",1),ArrowUp:qn("vert",-1),ArrowDown:qn("vert",1)});function qn(t,e){const s=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,a){let o=r.selection,l=e>0?o.$to:o.$from,c=o.empty;if(o instanceof J){if(!a.endOfTextblock(s)||l.depth==0)return!1;c=!1,l=r.doc.resolve(e>0?l.after():l.before())}let u=ue.findGapCursorFrom(l,e,c);return u?(i&&i(r.tr.setSelection(new ue(u))),!0):!1}}function by(t,e,s){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ue.valid(r))return!1;let i=t.posAtCoords({left:s.clientX,top:s.clientY});return i&&i.inside>-1&&B.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ue(r))),!0)}function yy(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ue))return!1;let{$from:s}=t.state.selection,r=s.parent.contentMatchAt(s.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=S.empty;for(let o=r.length-1;o>=0;o--)i=S.from(r[o].createAndFill(null,i));let a=t.state.tr.replace(s.pos,s.pos,new L(i,0,0));return a.setSelection(J.near(a.doc.resolve(s.pos+1))),t.dispatch(a),!1}function vy(t){if(!(t.selection instanceof ue))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",be.create(t.doc,[st.widget(t.selection.head,e,{key:"gapcursor"})])}const Cy=Ae.create({name:"gapCursor",addProseMirrorPlugins(){return[xy()]},extendNodeSchema(t){var e;const s={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Z(A(t,"allowGapCursor",s)))!==null&&e!==void 0?e:null}}}),ky=Ie.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",me(this.options.HTMLAttributes,t)]},renderText(){return` `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:s,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:a}=s;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,c=a||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:h})=>{if(h&&c&&o){const m=c.filter(p=>l.includes(p.type.name));u.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),wy=Ie.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(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,me(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Ui({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var ur=200,Ne=function(){};Ne.prototype.append=function(e){return e.length?(e=Ne.from(e),!this.length&&e||e.length<ur&&this.leafAppend(e)||this.length<ur&&e.leafPrepend(this)||this.appendInner(e)):this};Ne.prototype.prepend=function(e){return e.length?Ne.from(e).append(this):this};Ne.prototype.appendInner=function(e){return new Sy(this,e)};Ne.prototype.slice=function(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.length),e>=s?Ne.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,s))};Ne.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ne.prototype.forEach=function(e,s,r){s===void 0&&(s=0),r===void 0&&(r=this.length),s<=r?this.forEachInner(e,s,r,0):this.forEachInvertedInner(e,s,r,0)};Ne.prototype.map=function(e,s,r){s===void 0&&(s=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(a,o){return i.push(e(a,o))},s,r),i};Ne.from=function(e){return e instanceof Ne?e:e&&e.length?new uu(e):Ne.empty};var uu=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var s={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,a){return i==0&&a==this.length?this:new e(this.values.slice(i,a))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,a,o,l){for(var c=a;c<o;c++)if(i(this.values[c],l+c)===!1)return!1},e.prototype.forEachInvertedInner=function(i,a,o,l){for(var c=a-1;c>=o;c--)if(i(this.values[c],l+c)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=ur)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=ur)return new e(i.flatten().concat(this.values))},s.length.get=function(){return this.values.length},s.depth.get=function(){return 0},Object.defineProperties(e.prototype,s),e}(Ne);Ne.empty=new uu([]);var Sy=function(t){function e(s,r){t.call(this),this.left=s,this.right=r,this.length=s.length+r.length,this.depth=Math.max(s.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,a,o){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(a,l),o)===!1||a>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,a)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,a,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(a,l)-l,o+l)===!1||a<l&&this.left.forEachInvertedInner(r,Math.min(i,l),a,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var a=this.left.length;return i<=a?this.left.slice(r,i):r>=a?this.right.slice(r-a,i-a):this.left.slice(r,a).append(this.right.slice(0,i-a))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Ne),hu=Ne;const My=500;class ut{constructor(e,s){this.items=e,this.eventCount=s}popEvent(e,s){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;s&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=e.tr,l,c,u=[],h=[];return this.items.forEach((m,p)=>{if(!m.step){i||(i=this.remapping(r,p+1),a=i.maps.length),a--,h.push(m);return}if(i){h.push(new jt(m.map));let f=m.step.map(i.slice(a)),x;f&&o.maybeStep(f).doc&&(x=o.mapping.maps[o.mapping.maps.length-1],u.push(new jt(x,void 0,void 0,u.length+h.length))),a--,x&&i.appendMap(x,a)}else o.maybeStep(m.step);if(m.selection)return l=i?m.selection.map(i.slice(a)):m.selection,c=new ut(this.items.slice(0,r).append(h.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:l}}addTransform(e,s,r,i){let a=[],o=this.eventCount,l=this.items,c=!i&&l.length?l.get(l.length-1):null;for(let h=0;h<e.steps.length;h++){let m=e.steps[h].invert(e.docs[h]),p=new jt(e.mapping.maps[h],m,s),f;(f=c&&c.merge(p))&&(p=f,h?a.pop():l=l.slice(0,l.length-1)),a.push(p),s&&(o++,s=void 0),i||(c=p)}let u=o-r.depth;return u>Ly&&(l=Ny(l,u),o-=u),new ut(l.append(a),o)}remapping(e,s){let r=new Os;return this.items.forEach((i,a)=>{let o=i.mirrorOffset!=null&&a-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,s),r}addMaps(e){return this.eventCount==0?this:new ut(this.items.append(e.map(s=>new jt(s))),this.eventCount)}rebased(e,s){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-s),a=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(p=>{p.selection&&l--},i);let c=s;this.items.forEach(p=>{let f=a.getMirror(--c);if(f==null)return;o=Math.min(o,f);let x=a.maps[f];if(p.step){let b=e.steps[f].invert(e.docs[f]),y=p.selection&&p.selection.map(a.slice(c+1,f));y&&l++,r.push(new jt(x,b,y))}else r.push(new jt(x))},i);let u=[];for(let p=s;p<o;p++)u.push(new jt(a.maps[p]));let h=this.items.slice(0,i).append(u).append(r),m=new ut(h,l);return m.emptyItemCount()>My&&(m=m.compress(this.items.length-r.length)),m}emptyItemCount(){let e=0;return this.items.forEach(s=>{s.step||e++}),e}compress(e=this.items.length){let s=this.remapping(0,e),r=s.maps.length,i=[],a=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&a++;else if(o.step){let c=o.step.map(s.slice(r)),u=c&&c.getMap();if(r--,u&&s.appendMap(u,r),c){let h=o.selection&&o.selection.map(s.slice(r));h&&a++;let m=new jt(u.invert(),c,h),p,f=i.length-1;(p=i.length&&i[f].merge(m))?i[f]=p:i.push(m)}}else o.map&&r--},this.items.length,0),new ut(hu.from(i.reverse()),a)}}ut.empty=new ut(hu.empty,0);function Ny(t,e){let s;return t.forEach((r,i)=>{if(r.selection&&e--==0)return s=i,!1}),t.slice(s)}class jt{constructor(e,s,r,i){this.map=e,this.step=s,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let s=e.step.merge(this.step);if(s)return new jt(s.getMap().invert(),s,this.selection)}}}class Bt{constructor(e,s,r,i){this.done=e,this.undone=s,this.prevRanges=r,this.prevTime=i}}const Ly=20;function Ty(t,e,s,r){let i=s.getMeta(Zt),a;if(i)return i.historyState;s.getMeta(Iy)&&(t=new Bt(t.done,t.undone,null,0));let o=s.getMeta("appendedTransaction");if(s.steps.length==0)return t;if(o&&o.getMeta(Zt))return o.getMeta(Zt).redo?new Bt(t.done.addTransform(s,void 0,r,Jn(e)),t.undone,cl(s.mapping.maps[s.steps.length-1]),t.prevTime):new Bt(t.done,t.undone.addTransform(s,void 0,r,Jn(e)),null,t.prevTime);if(s.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.prevTime==0||!o&&(t.prevTime<(s.time||0)-r.newGroupDelay||!Ay(s,t.prevRanges)),c=o?mi(t.prevRanges,s.mapping):cl(s.mapping.maps[s.steps.length-1]);return new Bt(t.done.addTransform(s,l?e.selection.getBookmark():void 0,r,Jn(e)),ut.empty,c,s.time)}else return(a=s.getMeta("rebased"))?new Bt(t.done.rebased(s,a),t.undone.rebased(s,a),mi(t.prevRanges,s.mapping),t.prevTime):new Bt(t.done.addMaps(s.mapping.maps),t.undone.addMaps(s.mapping.maps),mi(t.prevRanges,s.mapping),t.prevTime)}function Ay(t,e){if(!e)return!1;if(!t.docChanged)return!0;let s=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let a=0;a<e.length;a+=2)r<=e[a+1]&&i>=e[a]&&(s=!0)}),s}function cl(t){let e=[];return t.forEach((s,r,i,a)=>e.push(i,a)),e}function mi(t,e){if(!t)return null;let s=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),a=e.map(t[r+1],-1);i<=a&&s.push(i,a)}return s}function mu(t,e,s,r){let i=Jn(e),a=Zt.get(e).spec.config,o=(r?t.undone:t.done).popEvent(e,i);if(!o)return;let l=o.selection.resolve(o.transform.doc),c=(r?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),a,i),u=new Bt(r?c:o.remaining,r?o.remaining:c,null,0);s(o.transform.setSelection(l).setMeta(Zt,{redo:r,historyState:u}).scrollIntoView())}let pi=!1,dl=null;function Jn(t){let e=t.plugins;if(dl!=e){pi=!1,dl=e;for(let s=0;s<e.length;s++)if(e[s].spec.historyPreserveItems){pi=!0;break}}return pi}const Zt=new rs("history"),Iy=new rs("closeHistory");function Ey(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ct({key:Zt,state:{init(){return new Bt(ut.empty,ut.empty,null,0)},apply(e,s,r){return Ty(s,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,s){let r=s.inputType,i=r=="historyUndo"?pu:r=="historyRedo"?fu:null;return i?(s.preventDefault(),i(e.state,e.dispatch)):!1}}}})}const pu=(t,e)=>{let s=Zt.getState(t);return!s||s.done.eventCount==0?!1:(e&&mu(s,t,e,!1),!0)},fu=(t,e)=>{let s=Zt.getState(t);return!s||s.undone.eventCount==0?!1:(e&&mu(s,t,e,!0),!0)},Dy=Ae.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>pu(t,e),redo:()=>({state:t,dispatch:e})=>fu(t,e)}},addProseMirrorPlugins(){return[Ey(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Oy=Ie.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",me(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t})=>t().insertContent({type:this.name}).command(({tr:e,dispatch:s})=>{var r;if(s){const{$to:i}=e.selection,a=i.end();if(i.nodeAfter)e.setSelection(J.create(e.doc,i.pos));else{const o=(r=i.parent.type.contentMatch.defaultType)===null||r===void 0?void 0:r.create();o&&(e.insert(a,o),e.setSelection(J.create(e.doc,a)))}e.scrollIntoView()}return!0}).run()}},addInputRules(){return[$3({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Py=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,Fy=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,zy=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,Ry=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,_y=ot.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",me(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Us({find:Py,type:this.type}),Us({find:zy,type:this.type})]},addPasteRules(){return[Ws({find:Fy,type:this.type}),Ws({find:Ry,type:this.type})]}}),By=Ie.create({name:"listItem",addOptions(){return{HTMLAttributes:{}}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",me(this.options.HTMLAttributes,t),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)}}}),Vy=Ie.create({name:"listItem",addOptions(){return{HTMLAttributes:{}}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",me(this.options.HTMLAttributes,t),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)}}}),ul=ot.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",me(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const s=zn(t,this.type);return Object.entries(s).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),hl=/^(\d+)\.\s$/,$y=Ie.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...s}=t;return e===1?["ol",me(this.options.HTMLAttributes,s),0]:["ol",me(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Vy.name,this.editor.getAttributes(ul.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Sn({find:hl,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Sn({find:hl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ul.name),editor:this.editor})),[t]}}),Hy=Ie.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",me(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),qy=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/,Uy=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g,Wy=ot.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",me(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-x":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Us({find:qy,type:this.type})]},addPasteRules(){return[Ws({find:Uy,type:this.type})]}}),Zy=Ie.create({name:"text",group:"inline"}),Ky=Ae.create({name:"starterKit",addExtensions(){var t,e,s,r,i,a,o,l,c,u,h,m,p,f,x,b,y,k;const M=[];return this.options.blockquote!==!1&&M.push(Q3.configure((t=this.options)===null||t===void 0?void 0:t.blockquote)),this.options.bold!==!1&&M.push(sy.configure((e=this.options)===null||e===void 0?void 0:e.bold)),this.options.bulletList!==!1&&M.push(ry.configure((s=this.options)===null||s===void 0?void 0:s.bulletList)),this.options.code!==!1&&M.push(oy.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&M.push(dy.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&M.push(uy.configure((a=this.options)===null||a===void 0?void 0:a.document)),this.options.dropcursor!==!1&&M.push(py.configure((o=this.options)===null||o===void 0?void 0:o.dropcursor)),this.options.gapcursor!==!1&&M.push(Cy.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&M.push(ky.configure((c=this.options)===null||c===void 0?void 0:c.hardBreak)),this.options.heading!==!1&&M.push(wy.configure((u=this.options)===null||u===void 0?void 0:u.heading)),this.options.history!==!1&&M.push(Dy.configure((h=this.options)===null||h===void 0?void 0:h.history)),this.options.horizontalRule!==!1&&M.push(Oy.configure((m=this.options)===null||m===void 0?void 0:m.horizontalRule)),this.options.italic!==!1&&M.push(_y.configure((p=this.options)===null||p===void 0?void 0:p.italic)),this.options.listItem!==!1&&M.push(By.configure((f=this.options)===null||f===void 0?void 0:f.listItem)),this.options.orderedList!==!1&&M.push($y.configure((x=this.options)===null||x===void 0?void 0:x.orderedList)),this.options.paragraph!==!1&&M.push(Hy.configure((b=this.options)===null||b===void 0?void 0:b.paragraph)),this.options.strike!==!1&&M.push(Wy.configure((y=this.options)===null||y===void 0?void 0:y.strike)),this.options.text!==!1&&M.push(Zy.configure((k=this.options)===null||k===void 0?void 0:k.text)),M}}),Jy=ot.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",me(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Gy=ot.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",me(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const s=zn(t,this.type);return Object.entries(s).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Qy=Ae.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return(e=t.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),Yy=Ae.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>t.style.backgroundColor.replace(/['"]+/g,""),renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),Xy=Ae.create({name:"indent",addOptions:()=>({types:["listItem","paragraph"],minLevel:0,maxLevel:6}),addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{renderHTML:t=>(t==null?void 0:t.indent)>this.options.minLevel?{"data-indent":t.indent}:null,parseHTML:t=>{const e=Number(t.getAttribute("data-indent"));return e&&e>this.options.minLevel?e:null}}}}]},addCommands(){const t=(r,i,a)=>{var l;const o=(l=r==null?void 0:r.doc)==null?void 0:l.nodeAt(i);if(o){const c=(o.attrs.indent||0)+a,{minLevel:u,maxLevel:h}=this.options,m=c<u?u:c>h?h:c;if(m!==o.attrs.indent){const{indent:p,...f}=o.attrs,x=m>u?{...f,indent:m}:f;return r.setNodeMarkup(i,o.type,x,o.marks)}}return r},e=(r,i)=>{const{doc:a,selection:o}=r;if(a&&o&&(o instanceof J||o instanceof rt)){const{from:l,to:c}=o;a.nodesBetween(l,c,(u,h)=>this.options.types.includes(u.type.name)?(r=t(r,h,i),!1):!0)}return r},s=r=>()=>({tr:i,state:a,dispatch:o})=>{const{selection:l}=a;return i=i.setSelection(l),i=e(i,r),i.docChanged?(o==null||o(i),!0):!1};return{indent:s(1),outdent:s(-1)}},addKeyboardShortcuts(){return{Tab:({editor:t})=>t.state.selection.to>t.state.selection.from?this.editor.commands.indent():!1,"Shift-Tab":({editor:t})=>t.state.selection.to>t.state.selection.from?this.editor.commands.outdent():!1}}}),ev=D(n.jsx("path",{d:"M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z"}),"FormatBoldOutlined"),tv=D(n.jsx("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8z"}),"FormatItalicOutlined"),sv=D(n.jsx("path",{d:"M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z"}),"FormatUnderlinedOutlined");function gu({editor:t,size:e}){return n.jsxs("span",{className:T("flex-shrink-0 whitespace-nowrap"),children:[n.jsx(N,{size:e,radius:"rounded",color:t.isActive("bold")?"primary":null,onClick:()=>{t.commands.focus(),t.commands.toggleBold()},children:n.jsx(ev,{})}),n.jsx(N,{size:e,radius:"rounded",color:t.isActive("italic")?"primary":null,onClick:()=>{t.commands.focus(),t.commands.toggleItalic()},children:n.jsx(tv,{})}),n.jsx(N,{size:e,radius:"rounded",color:t.isActive("underline")?"primary":null,onClick:()=>{t.commands.focus(),t.commands.toggleUnderline()},children:n.jsx(sv,{})})]})}function Ct(){return n.jsx("div",{className:"self-stretch mx-4 w-1 bg-divider flex-shrink-0"})}const nv=D(n.jsx("path",{d:"M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"}),"FormatAlignLeftOutlined"),rv=D(n.jsx("path",{d:"M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"}),"FormatAlignCenterOutlined"),iv=D(n.jsx("path",{d:"M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"}),"FormatAlignRightOutlined"),av=D(n.jsx("path",{d:"M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zm0-6v2h18V3H3z"}),"FormatAlignJustifyOutlined"),Un={left:{icon:nv,label:g("Align left")},center:{icon:rv,label:g("Align center")},right:{icon:iv,label:g("Align right")},justify:{icon:av,label:g("Justify")}};function xu({editor:t,size:e}){const s=Object.keys(Un).find(i=>t.isActive({textAlign:i}))||"left",r=s?Un[s].icon:Un.left.icon;return n.jsxs(Ln,{floatingWidth:"auto",selectionMode:"single",selectedValue:s,onSelectionChange:i=>{t.commands.focus(),t.commands.setTextAlign(i)},children:[n.jsx(N,{size:e,color:s?"primary":null,radius:"rounded",className:T("flex-shrink-0"),children:n.jsx(r,{})}),n.jsx(Tn,{children:Object.entries(Un).map(([i,a])=>{const o=a.icon;return n.jsx(v,{value:i,startIcon:n.jsx(o,{size:"md"}),capitalizeFirst:!0,children:n.jsx(d,{message:a.label.message})},i)})})]})}const ov=D(n.jsx("path",{d:"M11 17h10v-2H11v2zm-8-5 4 4V8l-4 4zm0 9h18v-2H3v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"}),"FormatIndentDecreaseOutlined"),lv=D(n.jsx("path",{d:"M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"}),"FormatIndentIncreaseOutlined");function ju({editor:t,size:e}){return n.jsxs("span",{className:T("flex-shrink-0","whitespace-nowrap"),children:[n.jsx(N,{size:e,radius:"rounded",onClick:()=>{t.commands.focus(),t.commands.outdent()},children:n.jsx(ov,{})}),n.jsx(N,{size:e,radius:"rounded",onClick:()=>{t.commands.focus(),t.commands.indent()},children:n.jsx(lv,{})})]})}const cv=D(n.jsx("path",{d:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"}),"FormatListBulletedOutlined"),dv=D(n.jsx("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"}),"FormatListNumberedOutlined");function bu({editor:t,size:e}){const s=t.isActive("bulletList"),r=t.isActive("orderedList");return n.jsxs("span",{className:T("flex-shrink-0","whitespace-nowrap"),children:[n.jsx(N,{size:e,radius:"rounded",color:s?"primary":null,onClick:()=>{t.commands.focus(),t.commands.toggleBulletList()},children:n.jsx(cv,{})}),n.jsx(N,{size:e,radius:"rounded",color:r?"primary":null,onClick:()=>{t.commands.focus(),t.commands.toggleOrderedList()},children:n.jsx(dv,{})})]})}const uv=D(n.jsx("path",{d:"M2 20h20v4H2v-4zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5L5.49 17zm4.42-5.61 2.03-5.79h.12l2.03 5.79H9.91z"}),"FormatColorTextOutlined"),hv=D(n.jsx("path",{d:"M16.56 8.94 7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10 10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5zM2 20h20v4H2v-4z"}),"FormatColorFillOutlined");function yu({editor:t,size:e}){const[s,r]=j.useState(!1),i=t.getAttributes("textStyle").color,a=t.getAttributes("textStyle").backgroundColor;return n.jsxs(j.Fragment,{children:[n.jsxs("span",{className:T("flex-shrink-0 whitespace-nowrap"),children:[n.jsx(N,{size:e,radius:"rounded",color:i?"primary":null,onClick:()=>{r("text")},children:n.jsx(uv,{})}),n.jsx(N,{size:e,radius:"rounded",color:a?"primary":null,onClick:()=>{r("bg")},children:n.jsx(hv,{})})]}),n.jsx(z,{currentValue:s==="text"?"#000000":"#FFFFFF",type:"modal",isOpen:!!s,onClose:o=>{o&&(s==="text"?t.commands.setColor(o):t.commands.setBackgroundColor(o)),r(!1)},children:n.jsx(fa,{defaultValue:s==="text"?"#000000":"#FFFFFF"})})]})}const mv=D(n.jsx("path",{d:"M20 8V5H6.39l3 3h1.83l-.55 1.28 2.09 2.1L14.21 8zM3.41 4.86 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21l1.41-1.41z"}),"FormatClearOutlined");function vu({editor:t,size:e}){return n.jsx(N,{className:T("flex-shrink-0"),size:e,radius:"rounded",onClick:()=>{t.chain().focus().clearNodes().unsetAllMarks().run()},children:n.jsx(mv,{})})}function Cu({form:t,onSubmit:e,formId:s}){const r=J3({extensions:[Ky.configure({codeBlock:!1}),Jy,Gy,Qy,Yy,Xy],onFocus:()=>{},content:t.getValues("text")});return n.jsxs(ce,{id:s,form:t,onSubmit:i=>{e({...i,text:(r==null?void 0:r.getHTML())||""})},children:[n.jsx(aa,{className:"mb-24",label:n.jsx(d,{message:"Track"}),name:"track_id",modelType:Ys,queryParams:{with:"artists,album"}}),r&&n.jsx("div",{className:"border rounded",children:n.jsxs(ks,{children:[n.jsx(pv,{editor:r}),n.jsx("div",{className:"p-14",children:n.jsx(za,{editor:r})})]})})]})}function pv({editor:t}){return n.jsxs("div",{className:"flex items-center px-4 h-42 text-muted border-b overflow-hidden",children:[n.jsx(gu,{editor:t,size:"sm"}),n.jsx(Ct,{}),n.jsx(xu,{editor:t,size:"sm"}),n.jsx(ju,{editor:t,size:"sm"}),n.jsx(Ct,{}),n.jsx(bu,{editor:t,size:"sm"}),n.jsx(Ct,{}),n.jsx(yu,{editor:t,size:"sm"}),n.jsx(Ct,{}),n.jsx(vu,{editor:t,size:"sm"})]})}function ku({lyric:t}){const{close:e,formId:s}=te(),r=X({defaultValues:{id:t.id,track_id:t.track_id,text:t.text}}),i=n2(r);return n.jsxs(ne,{size:"xl",children:[n.jsx(re,{children:n.jsx(d,{message:"Update lyric"})}),n.jsx(ie,{children:n.jsx(Cu,{formId:s,form:r,onSubmit:a=>{i.mutate(a,{onSuccess:()=>{e()}})}})}),n.jsxs(le,{children:[n.jsx(w,{onClick:()=>e(),children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{form:s,disabled:i.isLoading,variant:"flat",color:"primary",type:"submit",children:n.jsx(d,{message:"Update"})})]})]})}function fv(t){const{trans:e}=P();return $(s=>gv(s),{onSuccess:()=>{H(e(g("Lyric created"))),F.invalidateQueries(ee("lyrics")),F.invalidateQueries(ee("tracks"))},onError:s=>ge(s,t)})}function gv(t){return O.post("lyrics",t).then(e=>e.data)}function wu({trackId:t}){const{close:e,formId:s}=te(),r=X({defaultValues:{track_id:t}}),i=fv(r);return n.jsxs(ne,{size:"xl",children:[n.jsx(re,{children:n.jsx(d,{message:"Create new lyric"})}),n.jsx(ie,{children:n.jsx(Cu,{formId:s,form:r,onSubmit:a=>{i.mutate(a,{onSuccess:()=>e()})}})}),n.jsxs(le,{children:[n.jsx(w,{onClick:()=>e(),children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{form:s,disabled:i.isLoading,variant:"flat",color:"primary",type:"submit",children:n.jsx(d,{message:"Create"})})]})]})}const xv=D(n.jsx("path",{d:"M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H5V6h14v12zM7 15h3c.55 0 1-.45 1-1v-1H9.5v.5h-2v-3h2v.5H11v-1c0-.55-.45-1-1-1H7c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1zm7 0h3c.55 0 1-.45 1-1v-1h-1.5v.5h-2v-3h2v.5H18v-1c0-.55-.45-1-1-1h-3c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1z"}),"ClosedCaptionOutlined"),_a=D(n.jsx("path",{d:"M5 9.2h3V19H5V9.2zM10.6 5h2.8v14h-2.8V5zm5.6 8H19v6h-2.8v-6z"}),"BarChartOutlined"),jv=[{key:"name",allowsSorting:!0,header:()=>n.jsx(d,{message:"Track"}),width:"flex-3 min-w-200",visibleInMode:"all",body:t=>n.jsxs("div",{className:"flex items-center gap-12",children:[n.jsx($l,{track:t,className:"flex-shrink-0",size:"w-34 h-34 rounded"}),n.jsx(Hl,{track:t,target:"_blank"})]})},{key:"artist",allowsSorting:!1,header:()=>n.jsx(d,{message:"Artist"}),width:"flex-2",body:t=>{var e;return(e=t.artists)!=null&&e[0]?n.jsxs("div",{className:"flex items-center gap-12",children:[n.jsx(An,{artist:t.artists[0],className:"flex-shrink-0 rounded",size:"w-34 h-34"}),n.jsx(In,{artist:t.artists[0]})]}):null}},{key:"duration",minWidth:"min-w-76",allowsSorting:!0,header:()=>n.jsx(d,{message:"Duration"}),body:t=>t.duration?n.jsx(Nm,{ms:t.duration}):null},{key:"plays",allowsSorting:!0,minWidth:"min-w-70",header:()=>n.jsx(d,{message:"Plays"}),body:t=>t.plays?n.jsx(kt,{value:t.plays}):null},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>n.jsx(d,{message:"Last updated"}),body:t=>t.updated_at?n.jsx(he,{date:t.updated_at}):""},{key:"actions",header:()=>n.jsx(d,{message:"Actions"}),hideHeader:!0,align:"end",visibleInMode:"all",width:"w-128 flex-shrink-0",body:t=>n.jsxs("div",{className:"text-muted",children:[n.jsx(N,{size:"md",elementType:Y,to:`${t.id}/insights`,children:n.jsx(_a,{})}),n.jsxs(z,{type:"modal",children:[n.jsx(N,{size:"md",children:n.jsx(xv,{})}),t.lyric?n.jsx(ku,{lyric:t.lyric}):n.jsx(wu,{trackId:t.id})]}),n.jsx(N,{size:"md",elementType:Y,to:`${t.id}/edit`,children:n.jsx(Ee,{})})]})}],bv=[{key:"image",label:g("Artwork"),description:g("Whether track has any artwork uploaded"),defaultOperator:q.eq,control:{type:V.Select,defaultValue:"02",options:[{key:"01",label:g("Has artwork"),value:!1},{key:"02",label:g("Does not have artwork"),value:!0}]}},{key:"album_id",label:g("Album"),description:g("Whether track is part of an album"),defaultOperator:q.eq,control:{type:V.Select,defaultValue:"01",options:[{key:"01",label:g("Part of an album"),value:{operator:q.ne,value:null}},{key:"02",label:g("Single"),value:{operator:q.eq,value:null}}]}},{key:"plays",label:g("Plays count"),description:g("Number of times this track was played"),defaultOperator:q.gte,operators:Rs,control:{type:V.Input,inputType:"number",defaultValue:100}},Be({description:g("Date artist was created")}),Ve({description:g("Date artist was last updated")}),{defaultOperator:q.has,key:"artists",label:g("Artist"),description:g("Artist this track belongs to"),control:{type:V.SelectModel,model:Xs}}];function yv(){const{trans:t}=P();return $(e=>vv(e),{onSuccess:()=>{H(t(g("Track imported"))),F.invalidateQueries(ee("tracks"))},onError:e=>oe(e)})}function vv(t){return O.post("import-media/single-item",{modelType:Ys,spotifyId:t.spotifyId,importLyrics:t.importLyrics}).then(e=>e.data)}function Cv(){const t=X({defaultValues:{importLyrics:!0}}),{formId:e,close:s}=te(),r=yv();return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Import track"})}),n.jsx(ie,{children:n.jsxs(ce,{id:e,form:t,onSubmit:i=>{r.mutate(i,{onSuccess:a=>{s(a.track)}})},children:[n.jsx(C,{autoFocus:!0,required:!0,name:"spotifyId",minLength:22,maxLength:22,label:n.jsx(d,{message:"Spotify ID"}),className:"mb-24",description:n.jsx(d,{message:"This will also import all artists that collaborated on this track and album this track belongs to."})}),n.jsx(E,{name:"importLyrics",className:"mb-24",children:n.jsx(d,{message:"Import lyrics"})})]})}),n.jsxs(le,{children:[n.jsx(w,{onClick:()=>s(),children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{form:e,variant:"flat",color:"primary",type:"submit",disabled:r.isLoading,children:n.jsx(d,{message:"Import"})})]})]})}const _r=D(n.jsx("path",{d:"M5 4h14v2H5zm0 10h4v6h6v-6h4l-7-7-7 7zm8-2v6h-2v-6H9.83L12 9.83 14.17 12H13z"}),"PublishOutlined");function kv(){return n.jsx(De,{endpoint:"tracks",title:n.jsx(d,{message:"Tracks"}),filters:bv,columns:jv,queryParams:{with:"artists,lyric"},actions:n.jsx(wv,{}),selectedActions:n.jsx($e,{}),emptyStateMessage:n.jsx(ve,{image:jr,title:n.jsx(d,{message:"No tracks have been created yet"}),filteringTitle:n.jsx(d,{message:"No matching tracks"})})})}function wv(){const{spotify_is_setup:t}=fe(),e=xe();return n.jsxs(j.Fragment,{children:[t&&n.jsxs(z,{type:"modal",onClose:s=>{s&&e(`/admin/tracks/${s.id}/edit`)},children:[n.jsx(We,{label:n.jsx(d,{message:"Import by spotify ID"}),children:n.jsx(N,{variant:"outline",color:"primary",radius:"rounded",className:"flex-shrink-0",size:"sm",children:n.jsx(_r,{})})}),n.jsx(Cv,{})]}),n.jsx(Ze,{elementType:Y,to:"new",children:n.jsx(d,{message:"Add new track"})})]})}const Su="channel";function Sv(t){const{trans:e}=P(),s=xe();return $(r=>Mv(r),{onSuccess:r=>{H(e(g("Channel created"))),F.invalidateQueries(ee(Su)),s(`/admin/channels/${r.channel.id}/edit`,{replace:!0})},onError:r=>ge(r,t)})}function Mv(t){return O.post(Su,t).then(e=>e.data)}function Nv(){const t=X({defaultValues:{content:_h.pagination,config:{contentType:"listAll",contentModel:Ys,contentOrder:"created_at:desc",layout:"trackTable",carouselWhenNested:!0}}}),e=Sv(t);return n.jsx(ts,{form:t,onSubmit:s=>{e.mutate(s)},title:n.jsx(d,{message:"Add new channel"}),isLoading:e.isLoading,children:n.jsx(Vc,{})})}const Lv=[{key:"name",allowsSorting:!0,header:()=>n.jsx(d,{message:"Album"}),width:"flex-3",visibleInMode:"all",body:t=>n.jsxs("div",{className:"flex items-center gap-12",children:[n.jsx(Lm,{album:t,className:"flex-shrink-0",size:"w-34 h-34 rounded"}),n.jsx(ql,{album:t,target:"_blank"})]})},{key:"artist",allowsSorting:!1,header:()=>n.jsx(d,{message:"Artist"}),width:"flex-2",body:t=>{var e;return(e=t.artists)!=null&&e[0]?n.jsxs("div",{className:"flex items-center gap-12",children:[n.jsx(An,{artist:t.artists[0],className:"flex-shrink-0 rounded",size:"w-34 h-34"}),n.jsx(In,{artist:t.artists[0]})]}):null}},{key:"release_date",allowsSorting:!0,minWidth:"min-w-100",header:()=>n.jsx(d,{message:"Release date"}),body:t=>t.release_date?n.jsx(he,{date:t.release_date}):null},{key:"track_count",allowsSorting:!1,minWidth:"min-w-70",header:()=>n.jsx(d,{message:"Track count"}),body:t=>t.tracks_count?n.jsx(kt,{value:t.tracks_count}):null},{key:"plays",allowsSorting:!0,header:()=>n.jsx(d,{message:"Plays"}),minWidth:"min-w-70",body:t=>t.plays?n.jsx(kt,{value:t.plays}):null},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>n.jsx(d,{message:"Last updated"}),body:t=>t.updated_at?n.jsx(he,{date:t.updated_at}):""},{key:"actions",header:()=>n.jsx(d,{message:"Actions"}),hideHeader:!0,visibleInMode:"all",align:"end",width:"w-84 flex-shrink-0",body:t=>n.jsxs("div",{className:"text-muted",children:[n.jsx(N,{size:"md",elementType:Y,to:`${t.id}/insights`,children:n.jsx(_a,{})}),n.jsx(N,{size:"md",elementType:Y,to:`${t.id}/edit`,children:n.jsx(Ee,{})})]})}],Tv=[{key:"image",label:g("Artwork"),description:g("Whether album has any artwork uploaded"),defaultOperator:q.eq,control:{type:V.Select,defaultValue:"02",options:[{key:"01",label:g("Has artwork"),value:!1},{key:"02",label:g("Does not have artwork"),value:!0}]}},{key:"plays",label:g("Plays count"),description:g("Number of times this album was played"),defaultOperator:q.gte,operators:Rs,control:{type:V.Input,inputType:"number",defaultValue:100}},Be({description:g("Date album was created")}),Ve({description:g("Date album was last updated")}),{defaultOperator:q.has,key:"artists",label:g("Artist"),description:g("Artist this album belongs to"),control:{type:V.SelectModel,model:Xs}}];function Av(){const{trans:t}=P();return $(e=>Iv(e),{onSuccess:()=>{H(t(g("Album imported"))),F.invalidateQueries(ee("albums"))},onError:e=>oe(e)})}function Iv(t){return O.post("import-media/single-item",{modelType:kr,spotifyId:t.spotifyId}).then(e=>e.data)}function Ev(){const t=X(),{formId:e,close:s}=te(),r=Av();return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Import album"})}),n.jsx(ie,{children:n.jsx(ce,{id:e,form:t,onSubmit:i=>{r.mutate(i,{onSuccess:a=>{s(a.album)}})},children:n.jsx(C,{autoFocus:!0,required:!0,name:"spotifyId",minLength:22,maxLength:22,label:n.jsx(d,{message:"Spotify ID"}),description:n.jsx(d,{message:"This will also import all artists that collaborated on this album and any tracks that it contains."})})})}),n.jsxs(le,{children:[n.jsx(w,{onClick:()=>s(),children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{form:e,variant:"flat",color:"primary",type:"submit",disabled:r.isLoading,children:n.jsx(d,{message:"Import"})})]})]})}function Dv(){return n.jsx(De,{endpoint:"albums",title:n.jsx(d,{message:"Albums"}),filters:Tv,columns:Lv,queryParams:{withCount:"tracks"},actions:n.jsx(Ov,{}),selectedActions:n.jsx($e,{}),emptyStateMessage:n.jsx(ve,{image:jr,title:n.jsx(d,{message:"No albums have been created yet"}),filteringTitle:n.jsx(d,{message:"No matching albums"})})})}function Ov(){const{spotify_is_setup:t}=fe(),e=xe();return n.jsxs(j.Fragment,{children:[t&&n.jsxs(z,{type:"modal",onClose:s=>{s&&e(`/admin/albums/${s.id}/edit`)},children:[n.jsx(We,{label:n.jsx(d,{message:"Import by spotify ID"}),children:n.jsx(N,{variant:"outline",color:"primary",radius:"rounded",className:"flex-shrink-0",size:"sm",children:n.jsx(_r,{})})}),n.jsx(Ev,{})]}),n.jsx(Ze,{elementType:Y,to:"new",children:n.jsx(d,{message:"Add new album"})})]})}const Pv=""+new URL("accept-request-f8a4048f.svg",import.meta.url).href,Fv=[{key:"type",label:g("Type"),description:g("Type of the request"),defaultOperator:q.eq,control:{type:V.Select,defaultValue:"become-artist",options:[{key:"become-artist",label:g("Become artist"),value:"become-artist"},{key:"verify-artist",label:g("Verify artist"),value:"verify-artist"},{key:"claim-artist",label:g("Claim artist"),value:"claim-artist"}]}},{key:"status",label:g("Status"),description:g("Status of the request"),defaultOperator:q.eq,control:{type:V.Select,defaultValue:"pending",options:[{key:"pending",label:g("Pending"),value:"pending"},{key:"approved",label:g("Approved"),value:"approved"},{key:"denied",label:g("Denied"),value:"denied"}]}},{key:"user_id",label:g("Requester"),description:g("User that submitted the request"),defaultOperator:q.eq,control:{type:V.SelectModel,model:Pt}},Be({description:g("Date request was created")}),Ve({description:g("Date request was last updated")})];function Wi({type:t}){return n.jsx("span",{className:"capitalize",children:n.jsx(d,{message:t.replace("-"," ")})})}const zv=[{key:"type",allowsSorting:!0,minWidth:"min-w-100",header:()=>n.jsx(d,{message:"Type"}),body:t=>n.jsx(Wi,{type:t.type})},{key:"status",allowsSorting:!0,visibleInMode:"all",minWidth:"min-w-100",header:()=>n.jsx(d,{message:"Status"}),body:t=>n.jsxs("div",{className:"flex items-center gap-8",children:[n.jsx("div",{className:T("w-10 h-10 rounded-full flex-shrink-0",t.status==="approved"&&"bg-positive",t.status==="pending"&&"bg-warning",t.status==="denied"&&"bg-danger")}),n.jsx("div",{className:"capitalize",children:n.jsx(d,{message:t.status})})]})},{key:"user",allowsSorting:!0,visibleInMode:"all",width:"flex-3",header:()=>n.jsx(d,{message:"User"}),body:t=>t.user?n.jsx(mt,{image:t.user.avatar,label:t.user.display_name,description:t.user.email}):null},{key:"artist",allowsSorting:!0,width:"flex-3",header:()=>n.jsx(d,{message:"Artist"}),body:t=>t.artist?n.jsxs("div",{className:"flex items-center gap-12 w-max",children:[n.jsx(An,{artist:t.artist,className:"flex-shrink-0 rounded",size:"w-34 h-34"}),n.jsx(In,{artist:t.artist})]}):t.artist_name},{key:"created_at",allowsSorting:!0,width:"w-100",header:()=>n.jsx(d,{message:"Requested at"}),body:t=>t.created_at?n.jsx(he,{date:t.created_at}):""},{key:"actions",header:()=>n.jsx(d,{message:"Actions"}),hideHeader:!0,align:"end",visibleInMode:"all",width:"w-60 flex-shrink-0",body:t=>n.jsx(w,{elementType:Y,to:`${t.id}`,color:"primary",variant:"outline",size:"xs",children:n.jsx(d,{message:"View"})})}];function Rv(){return n.jsx(De,{endpoint:"backstage-request",title:n.jsx(d,{message:"Backstage requests"}),filters:Fv,columns:zv,selectedActions:n.jsx($e,{}),emptyStateMessage:n.jsx(ve,{image:Pv,title:n.jsx(d,{message:"No requests have been submitted yet"}),filteringTitle:n.jsx(d,{message:"No matching requests"})})})}function _v(){const t=ft();return $(e=>Bv(e),{onSuccess:()=>{H(g("Request approved")),t("/admin/backstage-requests"),F.invalidateQueries(ee("backstage-request"))},onError:e=>oe(e)})}function Bv({requestId:t,...e}){return O.post(`backstage-request/${t}/approve`,e).then(s=>s.data)}function Vv({request:t}){const{trans:e}=P(),{close:s,formId:r}=te(),i=X(),a=_v();return n.jsxs(ne,{size:"lg",children:[n.jsx(re,{children:n.jsx(d,{message:"Approve request"})}),n.jsx(ie,{children:n.jsxs(ce,{form:i,id:r,onSubmit:o=>{a.mutate({...o,requestId:t.id})},children:[n.jsx("div",{className:"mb-14",children:n.jsx(d,{message:"Are you sure you want to approve this request?"})}),n.jsx("div",{className:"font-bold",children:n.jsx(d,{message:"This will create a new artist profile and assign it to ':user', as well as give them artist role on the site.",values:{user:t.user.display_name}})}),n.jsx(E,{name:"markArtistAsVerified",className:"my-24",children:n.jsx(d,{message:"Also mark this artist as verified"})}),n.jsx(C,{label:n.jsx(d,{message:"Notes (optional)"}),name:"notes",placeholder:e(g("Add any extra notes that should be sent to use via notification email")),inputElementType:"textarea",rows:6})]})}),n.jsxs(le,{children:[n.jsx(w,{onClick:()=>s(),children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{variant:"flat",color:"primary",type:"submit",form:r,disabled:a.isLoading,children:n.jsx(d,{message:"Approve"})})]})]})}function $v(){const t=ft();return $(({requestId:e})=>Hv(e),{onSuccess:()=>{H(g("Request deleted")),t("/admin/backstage-requests"),F.invalidateQueries(ee("backstage-request"))},onError:e=>oe(e)})}function Hv(t){return O.delete(`backstage-request/${t}`).then(e=>e.data)}function qv(){const t=ft();return $(e=>Uv(e),{onSuccess:()=>{H(g("Request denied")),t("/admin/backstage-requests"),F.invalidateQueries(ee("backstage-request"))},onError:e=>oe(e)})}function Uv({requestId:t,...e}){return O.post(`backstage-request/${t}/deny`,e).then(s=>s.data)}function Wv({request:t}){const{trans:e}=P(),{close:s,formId:r}=te(),i=X(),a=qv();return n.jsxs(ne,{size:"lg",children:[n.jsx(re,{children:n.jsx(d,{message:"Deny request"})}),n.jsx(ie,{children:n.jsxs(ce,{form:i,id:r,onSubmit:o=>{a.mutate({...o,requestId:t.id})},children:[n.jsx("div",{className:"mb-14",children:n.jsx(d,{message:"Are you sure you want to deny this request?"})}),n.jsx("div",{className:"font-bold mb-24",children:n.jsx(d,{message:"This will mark request as denied and notify ':user'.",values:{user:t.user.display_name}})}),n.jsx(C,{label:n.jsx(d,{message:"Notes (optional)"}),name:"notes",placeholder:e(g("Add any extra notes that should be sent to use via notification email")),inputElementType:"textarea",rows:6})]})}),n.jsxs(le,{children:[n.jsx(w,{onClick:()=>s(),children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{variant:"flat",color:"danger",type:"submit",form:r,disabled:a.isLoading,children:n.jsx(d,{message:"Deny"})})]})]})}function Zv({request:t}){return n.jsxs("div",{className:"flex items-center gap-14",children:[n.jsx(w,{elementType:Y,to:"..",relative:"path",variant:"outline",className:"mr-auto hidden md:inline-flex",children:n.jsx(d,{message:"Go back"})}),t.status==="pending"&&n.jsxs(j.Fragment,{children:[n.jsxs(z,{type:"modal",children:[n.jsx(w,{variant:"flat",color:"primary",children:n.jsx(d,{message:"Approve"})}),n.jsx(Vv,{request:t})]}),n.jsxs(z,{type:"modal",children:[n.jsx(w,{variant:"outline",children:n.jsx(d,{message:"Deny"})}),n.jsx(Wv,{request:t})]})]}),n.jsx(Kv,{request:t})]})}function Kv({request:t}){const e=$v();return n.jsxs(z,{type:"modal",onClose:s=>{s&&e.mutate({requestId:t.id})},children:[n.jsx(w,{disabled:e.isLoading,variant:"outline",children:n.jsx(d,{message:"Delete"})}),n.jsx(lt,{isDanger:!0,title:n.jsx(d,{message:"Delete request"}),body:n.jsx(d,{message:"Are you sure you want to delete this request?"}),confirm:n.jsx(d,{message:"Delete"})})]})}function Jv(){const t=sm();return t.data?n.jsxs("div",{className:"container mx-auto p-24",children:[n.jsx(Zv,{request:t.data.request}),n.jsx(Gv,{request:t.data.request}),n.jsx(Qv,{request:t.data.request})]}):n.jsx(na,{query:t})}function Gv({request:t}){var e;return n.jsxs("div",{className:"mt-60",children:[n.jsx("div",{className:"text-2xl mb-14 mt-24",children:n.jsx(d,{message:"Request details"})}),n.jsxs("div",{children:[n.jsx(Nt,{name:n.jsx(d,{message:"Image"}),value:t.data.image?n.jsx("img",{src:t.data.image||((e=t.artist)==null?void 0:e.image_small),className:"rounded",alt:""}):null}),n.jsx(Nt,{name:n.jsx(d,{message:"Type"}),value:n.jsx(Wi,{type:t.type})}),n.jsx(Nt,{name:n.jsx(d,{message:"Requester"}),value:n.jsxs("div",{className:"flex items-center gap-8",children:[n.jsx(Ul,{user:t.user}),t.user.display_name]})}),t.artist&&n.jsx(Nt,{name:n.jsx(d,{message:"Artist"}),value:n.jsxs("div",{className:"flex items-center gap-12 w-max",children:[n.jsx(An,{artist:t.artist,className:"flex-shrink-0 rounded",size:"w-32 h-32"}),n.jsx(In,{artist:t.artist})]})}),n.jsx(Nt,{name:n.jsx(d,{message:"Requested artist name"}),value:n.jsx(Wi,{type:t.artist_name})}),n.jsx(Nt,{name:n.jsx(d,{message:"Requested role"}),value:t.data.role?n.jsx(d,{message:t.data.role}):void 0}),n.jsx(Nt,{name:n.jsx(d,{message:"First name"}),value:t.data.first_name}),n.jsx(Nt,{name:n.jsx(d,{message:"Last name"}),value:t.data.last_name}),n.jsx(Nt,{name:n.jsx(d,{message:"Company"}),value:t.data.company})]})]})}function Nt({name:t,value:e}){return n.jsxs("div",{className:"md:flex items-center gap-24 border-b py-12 md:py-18 text-sm",children:[n.jsx("div",{className:"min-w-200 mb-8 md:mb-0",children:t}),n.jsx("div",{children:e})]})}function Qv({request:t}){return n.jsxs("div",{className:"mt-60",children:[n.jsx("div",{className:"text-2xl mb-14 mt-24",children:n.jsx(d,{message:"Attached verification"})}),n.jsxs("div",{children:[t.data.passport_scan_entry&&n.jsx(Mu,{icon:n.jsx(nm,{}),title:n.jsx(d,{message:"Passport scan"}),description:`${t.data.passport_scan_entry.name} (${ta(t.data.passport_scan_entry.file_size)})`,action:n.jsxs(z,{type:"modal",children:[n.jsx(w,{variant:"outline",color:"primary",size:"xs",children:n.jsx(d,{message:"View"})}),n.jsx(Il,{image:t.data.passport_scan_entry.url})]})}),n.jsx(ml,{request:t,service:"twitter"}),n.jsx(ml,{request:t,service:"facebook"})]})]})}function ml({service:t,request:e}){const s=e.user.social_profiles.find(r=>r.service_name===t);return s?n.jsx(Mu,{icon:t==="twitter"?n.jsx(mh,{className:"text-twitter"}):n.jsx(ph,{className:"text-facebook"}),title:n.jsx("span",{className:"capitalize",children:n.jsx(d,{message:":service account",values:{service:t}})}),action:n.jsx(w,{elementType:"a",className:Qs,variant:"outline",color:"primary",size:"xs",href:t==="twitter"?`https://twitter.com/@${s.username}`:`https://facebook.com/${s.username}`,target:"_blank",children:n.jsx(d,{message:"View"})}),description:s.username}):null}function Mu({icon:t,title:e,description:s,action:r}){return n.jsxs("div",{className:"flex items-center gap-8 border rounded px-14 py-8 mb-8",children:[n.jsx("div",{className:"flex-shrink-0 text-muted",children:j.cloneElement(t,{size:"lg"})}),n.jsxs("div",{className:"mr-auto whitespace-nowrap overflow-hidden",children:[n.jsx("div",{className:"text-xs text-muted overflow-hidden overflow-ellipsis",children:e}),n.jsx("div",{className:"text-sm overflow-hidden overflow-ellipsis",children:s})]}),r]})}const Yv=[Be({description:g("Date genre was created")}),Ve({description:g("Date genre was last updated")})];function Xv(t){const{trans:e}=P();return $(s=>e8(s),{onSuccess:()=>{H(e(g("Genre updated"))),F.invalidateQueries(ee("genres"))},onError:s=>ge(s,t)})}function e8({id:t,...e}){return O.put(`genres/${t}`,e).then(s=>s.data)}function Nu({form:t,onSubmit:e,formId:s}){return n.jsxs(ce,{id:s,form:t,onSubmit:e,children:[n.jsx(ks,{children:n.jsx(Yt,{name:"image",diskPrefix:"genre_media",variant:"input",label:n.jsx(d,{message:"Image"}),className:"mb-24"})}),n.jsx(C,{name:"name",label:n.jsx(d,{message:"Name"}),description:n.jsx(d,{message:"Unique genre identifier."}),className:"mb-24",required:!0,autoFocus:!0}),n.jsx(C,{name:"display_name",label:n.jsx(d,{message:"Display name"}),description:n.jsx(d,{message:"User friendly genre name."})})]})}function t8(){const{trans:t}=P();return $(e=>s8(e),{onSuccess:()=>{H(t(g("Artists imported"))),F.invalidateQueries(ee("genres"))},onError:e=>oe(e)})}function s8(t){return O.post("import-media/single-item",{modelType:ca,genreId:t.genre.id}).then(e=>e.data)}function n8({genre:t}){const{spotify_is_setup:e}=fe(),{close:s,formId:r}=te(),i=X({defaultValues:{id:t.id,name:t.name,display_name:t.display_name,image:t.image}}),a=Xv(i),o=t8();return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Update “:name“ genre",values:{name:t.name}})}),n.jsx(ie,{children:n.jsx(Nu,{formId:r,form:i,onSubmit:l=>{a.mutate(l,{onSuccess:()=>{s()}})}})}),n.jsxs(le,{startAction:e&&n.jsx(w,{variant:"outline",onClick:()=>o.mutate({genre:t},{onSuccess:()=>s()}),disabled:o.isLoading,children:n.jsx(d,{message:"Import artists"})}),children:[n.jsx(w,{onClick:()=>s(),children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{form:r,disabled:a.isLoading,variant:"flat",color:"primary",type:"submit",children:n.jsx(d,{message:"Save"})})]})]})}function r8(t){const{trans:e}=P();return $(s=>i8(s),{onSuccess:()=>{H(e(g("Genre created"))),F.invalidateQueries(ee("genres"))},onError:s=>ge(s,t)})}function i8(t){return O.post("genres",t).then(e=>e.data)}function a8(){const{close:t,formId:e}=te(),s=X(),r=r8(s);return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Create new genre"})}),n.jsx(ie,{children:n.jsx(Nu,{formId:e,form:s,onSubmit:i=>{r.mutate(i,{onSuccess:()=>t()})}})}),n.jsxs(le,{children:[n.jsx(w,{onClick:()=>t(),children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{form:e,disabled:r.isLoading,variant:"flat",color:"primary",type:"submit",children:n.jsx(d,{message:"Create"})})]})]})}const o8=[{key:"name",allowsSorting:!0,visibleInMode:"all",width:"flex-3 min-w-200",header:()=>n.jsx(d,{message:"Genre"}),body:t=>n.jsx(mt,{image:t.image,label:n.jsx(Bh,{genre:t})})},{key:"display_name",allowsSorting:!0,header:()=>n.jsx(d,{message:"Display name"}),body:t=>t.display_name||t.name},{key:"artists_count",allowsSorting:!0,header:()=>n.jsx(d,{message:"Number of artists"}),body:t=>t.artists_count},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>n.jsx(d,{message:"Last updated"}),body:t=>n.jsx(he,{date:t.updated_at})},{key:"actions",header:()=>n.jsx(d,{message:"Actions"}),hideHeader:!0,align:"end",visibleInMode:"all",width:"w-42 flex-shrink-0",body:t=>n.jsxs(z,{type:"modal",children:[n.jsx(N,{size:"md",className:"text-muted",children:n.jsx(Ee,{})}),n.jsx(n8,{genre:t})]})}];function l8(){return n.jsx(De,{endpoint:"genres",title:n.jsx(d,{message:"Genres"}),columns:o8,filters:Yv,queryParams:{withCount:"artists"},actions:n.jsx(c8,{}),selectedActions:n.jsx($e,{}),emptyStateMessage:n.jsx(ve,{image:jr,title:n.jsx(d,{message:"No genres have been created yet"}),filteringTitle:n.jsx(d,{message:"No matching genres"})})})}function c8(){return n.jsx(j.Fragment,{children:n.jsxs(z,{type:"modal",children:[n.jsx(Ze,{children:n.jsx(d,{message:"Add new genre"})}),n.jsx(a8,{})]})})}const d8=[{key:"public",label:g("Visibility"),description:g("Whether playlist is publicly viewable"),defaultOperator:q.eq,control:{type:V.Select,defaultValue:"01",options:[{key:"01",label:g("Private"),value:!1},{key:"02",label:g("Public"),value:!0}]}},{key:"collaborative",label:g("Collaborative"),description:g("Whether playlist is marked as collaborative"),defaultOperator:q.eq,control:{type:V.BooleanToggle,defaultValue:!0}},{key:"plays",label:g("Play count"),description:g("Number of times this playlist was played"),defaultOperator:q.gte,operators:Rs,control:{type:V.Input,defaultValue:100,inputType:"number"}},{key:"views",label:g("View count"),description:g("Number of times this playlist page was viewed"),defaultOperator:q.gte,operators:Rs,control:{type:V.Input,inputType:"number",defaultValue:100}},Be({description:g("Date playlist was created")}),Ve({description:g("Date playlist was last updated")})];function u8(){const{trans:t}=P();return $(e=>h8(e),{onSuccess:()=>{H(t(g("Playlist imported"))),F.invalidateQueries(ee("playlists"))},onError:e=>oe(e)})}function h8(t){return O.post("import-media/single-item",{modelType:ra,spotifyId:t.spotifyId}).then(e=>e.data)}function m8(){const t=X(),{formId:e,close:s}=te(),r=u8();return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Import playlist"})}),n.jsx(ie,{children:n.jsx(ce,{id:e,form:t,onSubmit:i=>{r.mutate(i,{onSuccess:a=>{s(a.playlist)}})},children:n.jsx(C,{autoFocus:!0,required:!0,name:"spotifyId",minLength:22,maxLength:22,label:n.jsx(d,{message:"Spotify ID"}),description:n.jsx(d,{message:"Only public playlists can be imported."})})})}),n.jsxs(le,{children:[n.jsx(w,{onClick:()=>s(),children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{form:e,variant:"flat",color:"primary",type:"submit",disabled:r.isLoading,children:n.jsx(d,{message:"Import"})})]})]})}const p8=[{key:"name",allowsSorting:!0,width:"flex-3 min-w-200",visibleInMode:"all",header:()=>n.jsx(d,{message:"Playlist"}),body:t=>n.jsx(mt,{image:t.image,label:n.jsx($h,{playlist:t})})},{key:"owner",header:()=>n.jsx(d,{message:"Owner"}),width:"flex-2",body:t=>{var e;return t.owner?n.jsx(mt,{image:(e=t.owner)==null?void 0:e.avatar,label:n.jsx(fh,{user:t.owner}),description:t.owner.email}):null}},{key:"public",allowsSorting:!0,maxWidth:"max-w-100",header:()=>n.jsx(d,{message:"Public"}),body:t=>t.public?n.jsx(Gn,{className:"icon-md text-positive"}):n.jsx(it,{className:"icon-md text-danger"})},{key:"collaborative",allowsSorting:!0,maxWidth:"max-w-100",header:()=>n.jsx(d,{message:"Collaborative"}),body:t=>t.collaborative?n.jsx(Gn,{className:"icon-md text-positive"}):n.jsx(it,{className:"icon-md text-danger"})},{key:"views",maxWidth:"max-w-100",allowsSorting:!0,header:()=>n.jsx(d,{message:"Views"}),body:t=>n.jsx(kt,{value:t.views})},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>n.jsx(d,{message:"Last updated"}),body:t=>n.jsx(he,{date:t.updated_at})},{key:"actions",header:()=>n.jsx(d,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-42 flex-shrink-0",visibleInMode:"all",body:t=>n.jsxs(z,{type:"modal",onClose:e=>{e&&Zi()},children:[n.jsx(N,{size:"md",className:"text-muted",children:n.jsx(Ee,{})}),n.jsx(Hh,{playlist:t})]})}];function f8(){return n.jsx(De,{endpoint:"playlists",title:n.jsx(d,{message:"Playlists"}),columns:p8,filters:d8,queryParams:{with:"owner"},actions:n.jsx(g8,{}),selectedActions:n.jsx($e,{}),emptyStateMessage:n.jsx(ve,{image:ba,title:n.jsx(d,{message:"No playlists have been created yet"}),filteringTitle:n.jsx(d,{message:"No matching playlists"})})})}function g8(){const{spotify_is_setup:t}=fe();return n.jsxs(j.Fragment,{children:[t&&n.jsxs(z,{type:"modal",onClose:e=>{e&&Zi()},children:[n.jsx(We,{label:n.jsx(d,{message:"Import by spotify ID"}),children:n.jsx(N,{variant:"outline",color:"primary",radius:"rounded",className:"flex-shrink-0",size:"sm",children:n.jsx(_r,{})})}),n.jsx(m8,{})]}),n.jsxs(z,{type:"modal",onClose:e=>{e&&Zi()},children:[n.jsx(Ze,{children:n.jsx(d,{message:"Add new playlist"})}),n.jsx(Vh,{})]})]})}function Zi(){F.invalidateQueries(ee("playlists"))}const x8=""+new URL("source-code-51e91771.svg",import.meta.url).href,j8=[Be({description:g("Date lyric was created")}),Ve({description:g("Date lyric was last updated")})],b8=[{key:"track_id",allowsSorting:!0,header:()=>n.jsx(d,{message:"Track"}),width:"flex-3 min-w-200",visibleInMode:"all",body:t=>t.track?n.jsxs("div",{className:"flex items-center gap-12",children:[n.jsx($l,{track:t.track,className:"flex-shrink-0 rounded",size:"w-34 h-34"}),n.jsx(Hl,{track:t.track,target:"_blank"})]}):null},{key:"album",width:"flex-2",header:()=>n.jsx(d,{message:"Album"}),body:t=>{var e;return(e=t.track)!=null&&e.album?n.jsx(ql,{album:t.track.album}):null}},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>n.jsx(d,{message:"Last updated"}),body:t=>n.jsx(he,{date:t.updated_at})},{key:"actions",header:()=>n.jsx(d,{message:"Actions"}),hideHeader:!0,align:"end",visibleInMode:"all",width:"w-42 flex-shrink-0",body:t=>n.jsxs(z,{type:"modal",children:[n.jsx(N,{size:"md",className:"text-muted",children:n.jsx(Ee,{})}),n.jsx(ku,{lyric:t})]})}];function y8(){return n.jsx(De,{endpoint:"lyrics",title:n.jsx(d,{message:"Lyrics"}),columns:b8,filters:j8,queryParams:{with:"track.album.artists"},actions:n.jsx(v8,{}),selectedActions:n.jsx($e,{}),emptyStateMessage:n.jsx(ve,{image:x8,title:n.jsx(d,{message:"No lyrics have been created yet"}),filteringTitle:n.jsx(d,{message:"No matching lyrics"})})})}function v8(){return n.jsx(j.Fragment,{children:n.jsxs(z,{type:"modal",children:[n.jsx(Ze,{children:n.jsx(d,{message:"Add new lyric"})}),n.jsx(wu,{})]})})}const C8=[{key:"name",allowsSorting:!0,header:()=>n.jsx(d,{message:"Artist"}),width:"flex-3",visibleInMode:"all",body:t=>n.jsxs("div",{className:"flex items-center gap-12 w-max",children:[n.jsx(An,{artist:t,className:"flex-shrink-0",size:"w-34 h-34 rounded"}),n.jsx(In,{artist:t,target:"_blank"})]})},{key:"albums_count",allowsSorting:!0,header:()=>n.jsx(d,{message:"Album count"}),body:t=>t.albums_count?n.jsx(kt,{value:t.albums_count}):null},{key:"plays",allowsSorting:!0,header:()=>n.jsx(d,{message:"Total plays"}),body:t=>t.plays?n.jsx(kt,{value:t.plays}):null},{key:"views",allowsSorting:!0,header:()=>n.jsx(d,{message:"Page views"}),body:t=>t.views?n.jsx(kt,{value:t.views}):null},{key:"updated_at",allowsSorting:!0,maxWidth:"max-w-100",header:()=>n.jsx(d,{message:"Last updated"}),body:t=>t.updated_at?n.jsx(he,{date:t.updated_at}):""},{key:"actions",header:()=>n.jsx(d,{message:"Actions"}),hideHeader:!0,visibleInMode:"all",align:"end",width:"w-84 flex-shrink-0",body:t=>n.jsxs("div",{className:"text-muted",children:[n.jsx(N,{size:"md",elementType:Y,to:`${t.id}/insights`,children:n.jsx(_a,{})}),n.jsx(N,{size:"md",elementType:Y,to:`${t.id}/edit`,children:n.jsx(Ee,{})})]})}],k8=[{key:"verified",label:g("Status"),description:g("Whether artist is verified"),defaultOperator:q.eq,control:{type:V.Select,defaultValue:"01",options:[{key:"01",label:g("Verified"),value:!0},{key:"02",label:g("Not verified"),value:!1}]}},{key:"plays",label:g("Plays count"),description:g("Number of times artist tracks have been played"),defaultOperator:q.gte,operators:Rs,control:{type:V.Input,inputType:"number",defaultValue:100}},{key:"views",label:g("Views count"),description:g("Number of times artist page have been viewed"),defaultOperator:q.gte,operators:Rs,control:{type:V.Input,inputType:"number",defaultValue:100}},Be({description:g("Date artist was created")}),Ve({description:g("Date artist was last updated")})];function w8(){const{trans:t}=P();return $(e=>S8(e),{onSuccess:()=>{H(t(g("Artist imported"))),F.invalidateQueries(ee("artists"))},onError:e=>oe(e)})}function S8(t){return O.post("import-media/single-item",{modelType:Xs,spotifyId:t.spotifyId,importSimilarArtists:t.importSimilarArtists,importAlbums:t.importAlbums}).then(e=>e.data)}function M8(){const t=X({defaultValues:{importAlbums:!0,importSimilarArtists:!0}}),{formId:e,close:s}=te(),r=w8();return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Import artist"})}),n.jsx(ie,{children:n.jsxs(ce,{id:e,form:t,onSubmit:i=>{r.mutate(i,{onSuccess:a=>{s(a.artist)}})},children:[n.jsx(C,{autoFocus:!0,required:!0,name:"spotifyId",minLength:22,maxLength:22,label:n.jsx(d,{message:"Spotify ID"}),className:"mb-24"}),n.jsx(E,{name:"importAlbums",className:"mb-24",children:n.jsx(d,{message:"Import albums"})}),n.jsx(E,{name:"importSimilarArtists",children:n.jsx(d,{message:"Import similar artists"})})]})}),n.jsxs(le,{children:[n.jsx(w,{onClick:()=>s(),children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{form:e,variant:"flat",color:"primary",type:"submit",disabled:r.isLoading,children:n.jsx(d,{message:"Import"})})]})]})}function N8(){return n.jsx(De,{endpoint:"artists",title:n.jsx(d,{message:"Artists"}),filters:k8,columns:C8,actions:n.jsx(L8,{}),selectedActions:n.jsx($e,{}),emptyStateMessage:n.jsx(ve,{image:jr,title:n.jsx(d,{message:"No artists have been created yet"}),filteringTitle:n.jsx(d,{message:"No matching artists"})})})}function L8(){const{spotify_is_setup:t}=fe(),e=xe();return n.jsxs(j.Fragment,{children:[t&&n.jsxs(z,{type:"modal",onClose:s=>{s&&e(`/admin/artists/${s.id}/edit`)},children:[n.jsx(We,{label:n.jsx(d,{message:"Import by spotify ID"}),children:n.jsx(N,{variant:"outline",color:"primary",radius:"rounded",className:"flex-shrink-0",size:"sm",children:n.jsx(_r,{})})}),n.jsx(M8,{})]}),n.jsx(Ze,{elementType:Y,to:"new",children:n.jsx(d,{message:"Add new artist"})})]})}const Lu="artists";function T8(t){const{trans:e}=P();return $(s=>A8(s),{onSuccess:()=>{H(e(g("Artist created"))),F.invalidateQueries(ee(Lu))},onError:s=>ge(s,t)})}function A8(t){return O.post(Lu,t).then(e=>e.data)}function I8({wrapInContainer:t,showExternalFields:e}){const s=xe(),r=X(),i=T8(r);return n.jsx(ts,{form:r,onSubmit:a=>{i.mutate(a,{onSuccess:o=>{s(`../${o.artist.id}/edit`,{relative:"path",replace:!0})}})},title:n.jsx(d,{message:"Add new artist"}),isLoading:i.isLoading,disableSaveWhenNotDirty:!0,wrapInContainer:t,children:n.jsx(rm,{showExternalFields:e})})}function Tu({commentIds:t,variant:e="outline",size:s="xs"}){const r=qh();return n.jsxs(z,{type:"modal",onClose:i=>{i&&r.mutate({commentIds:t},{onSuccess:()=>{F.invalidateQueries(["comment"])}})},children:[n.jsx(w,{variant:e,size:s,color:"danger",className:"mr-10",disabled:r.isLoading,children:n.jsx(d,{message:"Delete"})}),n.jsx(lt,{isDanger:!0,title:n.jsx(d,{message:"Delete [one comment|other :count comments]",values:{count:t.length}}),body:t.length>1?n.jsx(d,{message:"Are you sure you want to delete selected comments?"}):n.jsx(d,{message:"Are you sure you want to delete this comment?"}),confirm:n.jsx(d,{message:"Delete"})})]})}function E8(){return $(t=>D8(t),{onSuccess:()=>{H(g("Comment updated")),F.invalidateQueries(["comment"])},onError:t=>oe(t)})}function D8({commentId:t,content:e}){return O.put(`comment/${t}`,{content:e}).then(s=>s.data)}function O8(){return $(t=>P8(t),{onSuccess:(t,e)=>{H(g("Restored [one 1 comment|other :count comments]",{values:{count:e.commentIds.length}}))},onError:t=>oe(t)})}function P8({commentIds:t}){return O.post("comment/restore",{commentIds:t}).then(e=>e.data)}function F8({commentIds:t,variant:e="outline",size:s="xs"}){const r=O8();return n.jsx(w,{variant:e,size:s,className:"mr-10",disabled:r.isLoading,color:"primary",onClick:()=>{r.mutate({commentIds:t},{onSuccess:()=>{F.invalidateQueries(["comment"])}})},children:n.jsx(d,{message:"Restore"})})}function z8({comment:t,isSelected:e,onToggle:s}){const[r,i]=j.useState(!1);return n.jsxs("div",{className:T("p-14 border-b",t.deleted&&"bg-danger/6"),children:[t.commentable&&n.jsx(R8,{isSelected:e,onToggle:s,commentable:t.commentable}),n.jsxs("div",{className:"flex items-start gap-10 pt-14 md:pl-20",children:[n.jsx(Ul,{className:"flex-shrink-0",user:t.user,size:"md"}),n.jsxs("div",{className:"flex-auto",children:[n.jsx(_8,{comment:t}),r?n.jsx(B8,{comment:t,onClose:a=>{i(!1),a&&F.invalidateQueries(["comment"])}}):n.jsxs(j.Fragment,{children:[n.jsx("div",{className:"text-sm my-14",children:t.content}),n.jsxs("div",{children:[t.deleted?n.jsx(F8,{commentIds:[t.id]}):n.jsx(Tu,{commentIds:[t.id]}),n.jsx(w,{variant:"outline",size:"xs",onClick:()=>{i(!0)},children:n.jsx(d,{message:"Edit"})})]})]})]})]})]})}function R8({isSelected:t,onToggle:e,commentable:s}){return n.jsxs("div",{className:"flex items-center",children:[n.jsx("div",{className:"mr-14",children:n.jsx(Ji,{checked:t,onChange:()=>e()})}),s.image&&n.jsx("img",{className:"w-20 h-20 rounded overflow-hidden object-cover mr-6",src:s.image,alt:""}),n.jsx("div",{className:"text-sm mr-4",children:s.name}),n.jsxs("div",{className:"text-muted text-xs",children:["(",s.model_type,")"]})]})}function _8({comment:t}){return n.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[n.jsx("div",{children:t.user&&n.jsx(pl,{user:t.user,show:"display_name"})}),n.jsx("div",{children:"•"}),n.jsx("time",{children:n.jsx(gh,{date:t.created_at})}),t.user&&n.jsx("div",{className:"ml-auto hidden md:block",children:n.jsx(pl,{user:t.user,show:"email"})})]})}function B8({comment:t,onClose:e}){const[s,r]=j.useState(t.content),i=E8();return n.jsxs("form",{onSubmit:a=>{a.preventDefault(),i.mutate({commentId:t.id,content:s},{onSuccess:()=>e(!0)})},children:[n.jsx(Qt,{autoFocus:!0,inputElementType:"textarea",className:"my-14",rows:2,value:s,onChange:a=>r(a.target.value)}),n.jsx(w,{size:"xs",variant:"outline",color:"primary",type:"submit",className:"mr-6",disabled:i.isLoading,children:n.jsx(d,{message:"Save edit"})}),n.jsx(w,{size:"xs",variant:"outline",className:"mr-6",onClick:a=>e(!1),disabled:i.isLoading,children:n.jsx(d,{message:"Cancel"})})]})}function pl({user:t,show:e}){const{auth:s}=j.useContext(Ot);return s.getUserProfileLink?n.jsx(Y,{to:s.getUserProfileLink(t),className:Qs,target:"_blank",children:t[e]}):n.jsx("div",{className:"text-muted",children:t[e]})}const V8=""+new URL("public-discussion-7f74dab5.svg",import.meta.url).href,$8=[{key:"deleted",label:g("Status"),description:g("Whether comment is active or deleted"),defaultOperator:q.eq,control:{type:V.Select,defaultValue:"01",options:[{key:"01",label:g("Active"),value:!1},{key:"02",label:g("Deleted"),value:!0}]}},{key:"user_id",label:g("User"),description:g("User comment was created by"),defaultOperator:q.eq,control:{type:V.SelectModel,model:Pt}},Be({description:g("Date comment was created")}),Ve({description:g("Date comment was last updated")})];function H8({hideTitle:t,commentable:e}){var p;const s=j.useMemo(()=>$8.filter(f=>f.key!=="commentable_id"||!e),[e]),{encodedFilters:r}=Dn(s),[i,a]=j.useState({perPage:15}),[o,l]=j.useState([]),c=Ol("comment",{...i,with:"commentable",filters:r,commentable_type:e==null?void 0:e.model_type,commentable_id:e==null?void 0:e.id},{onSuccess:()=>{l([])}}),u=j.useCallback(f=>{const x=[...o];if(!x.includes(f))x.push(f);else{const b=x.indexOf(f);x.splice(b,1)}l(x)},[o,l]),h=!!(i.query||i.filters||r),m=(p=c.data)==null?void 0:p.pagination;return n.jsxs("div",{className:T(!t&&"p-12 md:p-24"),children:[n.jsxs("div",{className:T("mb-16"),children:[n.jsx(Js,{children:n.jsx(d,{message:"Comments"})}),!t&&n.jsx("h1",{className:"text-3xl font-light",children:n.jsx(d,{message:"Comments"})})]}),n.jsxs("div",{children:[n.jsx(xs,{initial:!1,mode:"wait",children:o.length?n.jsx(ac,{selectedItemsCount:o.length,actions:n.jsx(Tu,{size:"sm",variant:"flat",commentIds:o})},"selected"):n.jsx(sc,{filters:s,searchValue:i.query,onSearchChange:f=>a({...i,query:f})},"default")}),n.jsx(ic,{className:"mb-14",filters:s}),c.isLoading?n.jsx(es,{className:"min-h-200"}):n.jsx("div",{className:"border-x border-t rounded",children:m==null?void 0:m.data.map(f=>n.jsx(z8,{comment:f,isSelected:o.includes(f.id),onToggle:()=>u(f.id)},f.id))}),(c.isFetched||c.isPreviousData)&&!(m!=null&&m.data.length)?n.jsx(ve,{className:"pt-50",isFiltering:h,image:V8,title:n.jsx(d,{message:"No comments have been created yet"}),filteringTitle:n.jsx(d,{message:"No matching comments"})}):void 0,n.jsx(Jl,{className:"mt-10",query:c,onPageChange:f=>a({...i,page:f}),onPerPageChange:f=>a({...i,perPage:f})})]})]})}function q8({children:t,color:e,variant:s,radius:r,size:i,className:a,value:o,onChange:l,multiple:c,disabled:u}){const h=f=>o===void 0?!1:c?o.includes(f):f===o,m=f=>{const x=[...o],b=o.indexOf(f);return b>-1?x.splice(b,1):x.push(f),x},p=_.Children.map(t,(f,x)=>{if(_.isValidElement(f)){const b=h(f.props.value),y=b?"primary":e;return _.cloneElement(f,{color:b?"primary":e,variant:s,size:i,radius:null,disabled:f.props.disabled||u,...f.props,onClick:k=>{f.props.onClick&&f.props.onClick(k),l&&(c?l==null||l(m(f.props.value)):l==null||l(f.props.value))},className:T(f.props.className,b?"z-20":"z-10",U8(x,t,r,y))})}});return n.jsx("div",{className:T(r,"inline-flex isolate",a),children:p})}function U8(t,e,s,r){return t===0?T(s,"rounded-tr-none rounded-br-none",!r&&"border-r-transparent disabled:border-r-transparent"):t===e.length-1?T(s,"rounded-tl-none rounded-bl-none -ml-1"):T("rounded-none -ml-1",!r&&"border-r-transparent disabled:border-r-transparent")}const W8=D(n.jsx("path",{d:"m16 18 2.29-2.29-4.88-4.88-4 4L2 7.41 3.41 6l6 6 4-4 6.3 6.29L22 12v6h-6z"}),"TrendingDownOutlined");function Z8({data:t,direction:e="vertical",individualBarColors:s=!1,className:r,...i}){const{localeCode:a}=xh(),o=j.useMemo(()=>{const u=im(t,{localeCode:a});return u.datasets=u.datasets.map((h,m)=>({...h,backgroundColor:s?_n.map(p=>p[1]):_n[m][1],borderColor:s?_n.map(p=>p[0]):_n[m][0],borderWidth:2})),u},[t,a,s]),l=e==="horizontal",c=j.useMemo(()=>({indexAxis:l?"y":"x",parsing:{xAxisKey:l?"value":"label",yAxisKey:l?"label":"value"}}),[l]);return n.jsx(am,{type:"bar",className:T(r,"min-w-500"),data:o,options:c,...i})}const Au="gap-12 md:gap-24 mb-12 md:mb-24",fl=`flex flex-col md:flex-row md:items-center overflow-x-auto ${Au}`;function K8({report:t,isLoading:e}){const s=t==null?void 0:t.pageViews.total;return n.jsxs(j.Fragment,{children:[n.jsxs("div",{className:fl,children:[n.jsx(om,{isLoading:e,className:"flex-auto",data:t==null?void 0:t.pageViews,title:n.jsx(d,{message:"Pageviews"}),description:s?n.jsx(d,{message:":count total views",values:{count:n.jsx(kt,{value:s})}}):null}),n.jsx(lm,{isLoading:e,data:t==null?void 0:t.devices,title:n.jsx(d,{message:"Top devices"})})]}),n.jsxs("div",{className:fl,children:[n.jsx(Z8,{isLoading:e,data:t==null?void 0:t.browsers,className:"flex-auto md:w-1/3",direction:"horizontal",individualBarColors:!0,hideLegend:!0,title:n.jsx(d,{message:"Top browsers"})}),n.jsx(cm,{isLoading:e,className:"flex-auto",data:t==null?void 0:t.locations,title:n.jsx(d,{message:"Top locations"})})]})]})}const J8=D(n.jsx("path",{d:"m22 12-4-4v3H3v2h15v3l4-4z"}),"TrendingFlatOutlined");function G8({report:t,dateRange:e}){return Dl,e.start,e.end,n.jsx("div",{className:`flex items-center flex-shrink-0 overflow-x-auto h-[97px] ${Au}`,children:t==null?void 0:t.map(s=>n.jsx(Q8,{datum:s},s.name))})}function Q8({datum:t,label:e}){const s=Gi(t.icon);return n.jsxs("div",{className:"flex items-center flex-auto rounded border p-20 gap-18 h-full whitespace-nowrap",children:[n.jsx("div",{className:"bg-primary-light/20 rounded-lg p-10 flex-shrink-0",children:n.jsx(s,{size:"lg",className:"text-primary"})}),n.jsxs("div",{className:"flex-auto",children:[n.jsxs("div",{className:"flex items-center gap-20 justify-between",children:[n.jsx("div",{className:"text-main text-lg font-bold",children:t.type==="fileSize"?n.jsx(Ec,{bytes:t.currentValue}):n.jsx(kt,{value:t.currentValue})}),e&&n.jsx("div",{className:"text-xs text-muted ml-auto",children:e})]}),n.jsxs("div",{className:"flex items-center gap-20 justify-between",children:[n.jsx("h2",{className:"text-muted text-sm",children:t.name}),t.percentageChange!=null&&n.jsx("div",{className:"flex items-center gap-10",children:n.jsx(Y8,{percentage:t.percentageChange})})]})]})]},t.name)}function Y8({percentage:t}){let e;return t>0?e=n.jsx(Uh,{size:"md",className:"text-positive"}):t===0?e=n.jsx(J8,{className:"text-muted"}):e=n.jsx(W8,{className:"text-danger"}),n.jsxs(j.Fragment,{children:[e,n.jsxs("div",{className:"text-sm font-semibold text-muted",children:[t,"%"]})]})}const Iu="admin/reports";function Eu(t={}){return Xt([Iu,t],()=>X8(t),{keepPreviousData:!0})}function X8({types:t,dateRange:e}){const s={};return t&&(s.types=t.join(",")),e&&(s.startDate=e.start.toAbsoluteString(),s.endDate=e.end.toAbsoluteString(),s.timezone=e.start.timeZone),O.get(Iu,{params:s}).then(r=>r.data)}function e6(){const[t,e]=j.useState(()=>ia[2].getRangeValue()),r=_e()["*"]||"plays",i=r==="visitors"?n.jsx(d,{message:"Visitors report"}):n.jsx(d,{message:"Plays report"});return n.jsxs("div",{className:"min-h-full p-12 md:p-24 overflow-x-hidden",children:[n.jsxs("div",{className:"md:flex items-center justify-between gap-24 mb-24",children:[n.jsx(Js,{children:i}),n.jsx("h1",{className:"mb-24 md:mb-0 text-3xl font-light",children:i}),n.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between gap-10 md:gap-24",children:[n.jsxs(q8,{variant:"outline",radius:"rounded",value:r,children:[n.jsx(w,{value:"plays",elementType:Y,to:"plays",children:n.jsx(d,{message:"Plays"})}),n.jsx(w,{value:"visitors",elementType:Y,to:"visitors",children:n.jsx(d,{message:"Visitors"})})]}),n.jsx(dm,{value:t,onChange:e})]})]}),n.jsx(t6,{dateRange:t}),n.jsx(hr,{context:{dateRange:t,setDateRange:e}})]})}function t6({dateRange:t}){const{data:e}=Eu({types:["header"],dateRange:t});return n.jsx(G8,{report:e==null?void 0:e.headerReport,dateRange:t})}function gl(){const{dateRange:t}=Ll();return n.jsx(um,{dateRange:t,model:"track_play=0",showTracks:!0,showArtistsAndAlbums:!0})}function s6(){const{dateRange:t}=Ll(),{data:e,isLoading:s,isPreviousData:r}=Eu({types:["visitors"],dateRange:t});return n.jsx(K8,{isLoading:s||r,report:e==null?void 0:e.visitorsReport})}const n6=[{path:"/",element:n.jsx(e6,{}),children:[{index:!0,element:n.jsx(gl,{})},{path:"plays",element:n.jsx(gl,{})},{path:"visitors",element:n.jsx(s6,{})}]},{path:"channels",element:n.jsx(L4,{})},{path:"channels/new",element:n.jsx(Nv,{})},{path:"channels/:slugOrId/edit",element:n.jsx(t2,{})},{path:"tracks",element:n.jsx(kv,{})},{path:"tracks/new",element:n.jsx(hm,{})},{path:"tracks/:trackId/edit",element:n.jsx(mm,{})},{path:"tracks/:trackId/insights",element:n.jsx(pm,{isNested:!0})},{path:"albums",element:n.jsx(Dv,{})},{path:"albums/new",element:n.jsx(fm,{})},{path:"albums/:albumId/edit",element:n.jsx(gm,{})},{path:"albums/:albumId/insights",element:n.jsx(xm,{isNested:!0})},{path:"artists",element:n.jsx(N8,{})},{path:"artists/new",element:n.jsx(I8,{showExternalFields:!0})},{path:"artists/:artistId/edit",element:n.jsx(jm,{showExternalFields:!0})},{path:"artists/:artistId/insights",element:n.jsx(bm,{isNested:!0})},{path:"upload",element:n.jsx(ym,{backstageLayout:!1})},{path:"backstage-requests",element:n.jsx(Rv,{})},{path:"backstage-requests/:requestId",element:n.jsx(Jv,{})},{path:"genres",element:n.jsx(l8,{})},{path:"playlists",element:n.jsx(f8,{})},{path:"lyrics",element:n.jsx(y8,{})},{path:"comments",element:n.jsx(H8,{})}];function r6(t){const{pageId:e}=_e(),s=`${t||"custom-pages"}/${e}`;return $(r=>i6(r,s),{onError:r=>oe(r),onSuccess:async()=>{await F.invalidateQueries(["custom-pages"]),await F.invalidateQueries(ee(s)),H(g("Page updated"))}})}function i6(t,e){return O.put(`${e}`,t).then(s=>s.data)}function Du(){const[t,e]=j.useState(!1),{trans:s}=P(),i=I().watch("title"),a=s({message:"Title"});return t?n.jsx(C,{placeholder:a,autoFocus:!0,className:"mb-30",onBlur:()=>{e(!1)},name:"title",required:!0}):n.jsxs("h1",{tabIndex:0,onClick:()=>{e(!0)},onFocus:()=>{e(!0)},className:T("hover:bg-primary/focus rounded cursor-pointer",!i&&"text-muted"),children:[i||a,n.jsx(Ee,{className:"icon-sm mx-8 mt-8 align-top text-muted"})]})}const a6=D(n.jsx("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"}),"UndoOutlined"),o6=D(n.jsx("path",{d:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"}),"RedoOutlined");function l6({editor:t}){return n.jsxs("span",{children:[n.jsx(N,{size:"md",radius:"rounded",disabled:!t.can().undo(),onClick:()=>{t.commands.focus(),t.commands.undo()},children:n.jsx(a6,{})}),n.jsx(N,{size:"md",radius:"rounded",disabled:!t.can().redo(),onClick:()=>{t.commands.focus(),t.commands.redo()},children:n.jsx(o6,{})})]})}const Ou=D(n.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"}),"CodeOutlined");function c6({editor:t}){return n.jsxs(z,{type:"modal",onClose:e=>{e!=null&&(t==null||t.commands.setContent(e))},children:[n.jsx(w,{variant:"text",startIcon:n.jsx(Ou,{}),children:n.jsx(d,{message:"Source code"})}),n.jsx(yc,{title:n.jsx(d,{message:"Source code"}),defaultValue:t.getHTML()})]})}function d6({editor:t,size:e}){return n.jsxs(z,{type:"modal",children:[n.jsx(N,{size:e,radius:"rounded",className:T("flex-shrink-0"),children:n.jsx(ga,{})}),n.jsx(u6,{editor:t})]})}function u6({editor:t}){const e=t.getAttributes("link").href,s=t.state.doc.textBetween(t.state.selection.from,t.state.selection.to,""),r=X({defaultValues:{href:e,text:s}}),{formId:i,close:a}=te();return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Insert link"})}),n.jsx(ie,{children:n.jsxs(ce,{form:r,id:i,onSubmit:o=>{t.state.selection.empty&&o.text?t.commands.insertContent(`<a href="${o.href}" target="${o.target}">${o.text}</a>`):t.state.selection.empty||(o.href?t.chain().focus().extendMarkRange("link").setLink({href:o.href,target:o.target}).run():t.chain().focus().extendMarkRange("link").unsetLink().run()),a()},children:[n.jsx(C,{name:"href",label:n.jsx(d,{message:"URL"}),autoFocus:!0,type:"url",className:"mb-20"}),n.jsx(C,{name:"text",label:n.jsx(d,{message:"Text to display"}),className:"mb-20"}),n.jsxs(G,{selectionMode:"single",name:"target",label:n.jsx(d,{message:"Open link in..."}),children:[n.jsx(v,{value:"_self",children:n.jsx(d,{message:"Current window"})}),n.jsx(v,{value:"_blank",children:n.jsx(d,{message:"New window"})})]})]})}),n.jsxs(le,{children:[n.jsx(w,{onClick:a,variant:"text",children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{type:"submit",form:i,variant:"flat",color:"primary",children:n.jsx(d,{message:"Save"})})]})]})}const h6=2097152;function m6({editor:t,size:e}){const{selectAndUploadFile:s}=jh(),r=()=>{s({showToastOnRestrictionFail:!0,restrictions:{allowedFileTypes:[bh.image],maxFileSize:h6},metadata:{diskPrefix:"page_media",disk:yh.public},onSuccess:i=>{t.commands.focus(),t.commands.setImage({src:i.url})}})};return n.jsx(N,{size:e,radius:"rounded",onClick:r,className:T("flex-shrink-0"),children:n.jsx(Wh,{})})}const p6=D(n.jsx("path",{fillRule:"evenodd",d:"M4 11h16v2H4z"}),"HorizontalRuleOutlined"),f6=D([n.jsx("circle",{cx:"12",cy:"19",r:"2"},"0"),n.jsx("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHighOutlined"),g6=D(n.jsx("path",{d:"M16 4H4c-1.1 0-2 .9-2 2v12.01c0 1.1.9 1.99 2 1.99h16c1.1 0 2-.9 2-2v-8l-6-6zM4 18.01V6h11v5h5v7.01H4z"}),"NoteOutlined"),x6=D([n.jsx("path",{d:"M9.5 7.5v9l7-4.5z"},"0"),n.jsx("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14.01H4V5.99h16v12.02z"},"1")],"SmartDisplayOutlined");function j6({editor:t,size:e}){const[s,r]=j.useState(!1);return n.jsxs(n.Fragment,{children:[n.jsxs(Ln,{onItemSelected:i=>{i==="hr"?(t.commands.focus(),t.commands.setHorizontalRule()):i==="embed"?r("embed"):(t.commands.focus(),t.commands.addInfo({type:i}))},children:[n.jsx(N,{variant:"text",size:e,radius:"rounded",className:T("flex-shrink-0"),children:n.jsx(Al,{})}),n.jsxs(Tn,{children:[n.jsx(v,{value:"hr",startIcon:n.jsx(p6,{}),children:n.jsx(d,{message:"Horizontal rule"})}),n.jsx(v,{value:"embed",startIcon:n.jsx(x6,{}),children:n.jsx(d,{message:"Embed"})}),n.jsx(v,{value:"important",startIcon:n.jsx(f6,{}),children:n.jsx(d,{message:"Important"})}),n.jsx(v,{value:"warning",startIcon:n.jsx(Nl,{}),children:n.jsx(d,{message:"Warning"})}),n.jsx(v,{value:"success",startIcon:n.jsx(g6,{}),children:n.jsx(d,{message:"Note"})})]})]}),n.jsx(z,{type:"modal",isOpen:!!s,onClose:()=>{r(!1)},children:n.jsx(b6,{editor:t})})]})}function b6({editor:t}){const e=t.getAttributes("embed").src,s=X({defaultValues:{src:e}}),{formId:r,close:i}=te();return n.jsxs(ne,{children:[n.jsx(re,{children:n.jsx(d,{message:"Insert link"})}),n.jsx(ie,{children:n.jsx(ce,{form:s,id:r,onSubmit:a=>{t.commands.setEmbed(a),i()},children:n.jsx(C,{name:"src",label:n.jsx(d,{message:"Embed URL"}),autoFocus:!0,type:"url",required:!0})})}),n.jsxs(le,{children:[n.jsx(w,{onClick:i,variant:"text",children:n.jsx(d,{message:"Cancel"})}),n.jsx(w,{type:"submit",form:r,disabled:!s.formState.isValid,variant:"flat",color:"primary",children:n.jsx(d,{message:"Add"})})]})]})}function xt({children:t,modifier:e,separator:s="+"}){const r=vh()?n.jsx("span",{className:"text-base align-middle",children:"⌘"}):"Ctrl";return n.jsxs("kbd",{className:"text-xs text-muted",children:[e&&n.jsxs(n.Fragment,{children:[r,s]}),t]})}function y6({editor:t,size:e}){return n.jsxs(Ln,{floatingMinWidth:"w-256",onItemSelected:s=>{t.commands.focus(),typeof s=="string"&&s.startsWith("h")?t.commands.toggleHeading({level:parseInt(s.replace("h",""))}):s==="code"?t.commands.toggleCode():s==="strike"?t.commands.toggleStrike():s==="super"?t.commands.toggleSuperscript():s==="sub"?t.commands.toggleSubscript():s==="blockquote"?t.commands.toggleBlockquote():s==="paragraph"&&t.commands.setParagraph()},children:[n.jsx(w,{className:T("flex-shrink-0"),variant:"text",size:e,endIcon:n.jsx(mr,{}),children:n.jsx(d,{message:"Format"})}),n.jsxs(Tn,{children:[n.jsx(v,{value:"h1",endSection:n.jsx(xt,{modifier:!0,children:"Alt+1"}),children:n.jsx(d,{message:"Heading :number",values:{number:1}})}),n.jsx(v,{value:"h2",endSection:n.jsx(xt,{modifier:!0,children:"Alt+2"}),children:n.jsx(d,{message:"Heading :number",values:{number:2}})}),n.jsx(v,{value:"h3",endSection:n.jsx(xt,{modifier:!0,children:"Alt+3"}),children:n.jsx(d,{message:"Heading :number",values:{number:3}})}),n.jsx(v,{value:"h4",endSection:n.jsx(xt,{modifier:!0,children:"Alt+4"}),children:n.jsx(d,{message:"Heading :number",values:{number:4}})}),n.jsx(v,{value:"code",endSection:n.jsx(xt,{modifier:!0,children:"E"}),children:n.jsx(d,{message:"Code"})}),n.jsx(v,{value:"strike",endSection:n.jsx(xt,{modifier:!0,children:"Shift+X"}),children:n.jsx(d,{message:"Strikethrough"})}),n.jsx(v,{value:"super",endSection:n.jsx(xt,{modifier:!0,separator:" ",children:"."}),children:n.jsx(d,{message:"Superscript"})}),n.jsx(v,{value:"sub",endSection:n.jsx(xt,{modifier:!0,separator:" ",children:","}),children:n.jsx(d,{message:"Subscript"})}),n.jsx(v,{value:"blockquote",endSection:n.jsx(xt,{modifier:!0,children:"Shift+B"}),children:n.jsx(d,{message:"Blockquote"})}),n.jsx(v,{value:"paragraph",endSection:n.jsx(xt,{modifier:!0,children:"Alt+0"}),children:n.jsx(d,{message:"Paragraph"})})]})]})}function v6({editor:t,size:e}){const s=t.getAttributes("codeBlock").language||"";return n.jsxs(Ln,{selectionMode:"single",selectedValue:s,onSelectionChange:r=>{t.commands.toggleCodeBlock({language:r})},children:[n.jsx(N,{className:T("flex-shrink-0"),size:e,color:s?"primary":null,radius:"rounded",children:n.jsx(Ou,{})}),n.jsxs(Tn,{children:[n.jsx(v,{value:"html",children:"HTML"}),n.jsx(v,{value:"javascript",children:"JavaScript"}),n.jsx(v,{value:"css",children:"CSS"}),n.jsx(v,{value:"php",children:"PHP"}),n.jsx(v,{value:"shell",children:"Shell"}),n.jsx(v,{value:"bash",children:"Bash"}),n.jsx(v,{value:"ruby",children:"Ruby"}),n.jsx(v,{value:"python",children:"Python"}),n.jsx(v,{value:"java",children:"Java"}),n.jsx(v,{value:"c++",children:"C++"})]})]})}const C6=D(n.jsx("path",{d:"M12 5.83 15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z"}),"UnfoldMoreOutlined"),k6=D(n.jsx("path",{d:"M7.41 18.59 8.83 20 12 16.83 15.17 20l1.41-1.41L12 14l-4.59 4.59zm9.18-13.18L15.17 4 12 7.17 8.83 4 7.41 5.41 12 10l4.59-4.59z"}),"UnfoldLessOutlined"),xl="flex items-center justify-center px-4 h-42 text-muted border-b overflow-hidden";function w6({editor:t,size:e="md"}){const s=Ge(),[r,i]=j.useState(!1);return n.jsxs("div",{className:T(r?"h-84":"h-42"),children:[n.jsxs("div",{className:T(xl,"relative z-20"),children:[n.jsx(y6,{editor:t,size:e}),n.jsx(Ct,{}),n.jsx(gu,{editor:t,size:e}),n.jsx(Ct,{}),n.jsx(xu,{editor:t,size:e}),n.jsx(ju,{editor:t,size:e}),n.jsx(Ct,{}),s?n.jsx(N,{className:"flex-shrink-0",color:r?"primary":null,size:e,radius:"rounded",onClick:()=>{i(!r)},children:r?n.jsx(k6,{}):n.jsx(C6,{})}):n.jsx(jl,{editor:t,size:e})]}),n.jsx(xs,{children:r&&n.jsx(js.div,{className:T(xl,"absolute w-full h-full flex"),initial:{y:"-100%"},animate:{y:0},exit:{y:"-100%"},children:n.jsx(jl,{editor:t,size:e})})})]})}function jl({editor:t,size:e="md"}){return n.jsxs(j.Fragment,{children:[n.jsx(bu,{editor:t,size:e}),n.jsx(Ct,{}),n.jsx(d6,{editor:t,size:e}),n.jsx(m6,{editor:t,size:e}),n.jsx(j6,{editor:t,size:e}),n.jsx(Ct,{}),n.jsx(yu,{editor:t,size:e}),n.jsx(Ct,{}),n.jsx(v6,{editor:t,size:e}),n.jsx(vu,{editor:t,size:e})]})}function Pu({editor:t,allowSlugEditing:e=!0,onSave:s,isLoading:r,backLink:i}){const{isSticky:a,sentinelRef:o}=vm(),l=Ge();return n.jsxs(j.Fragment,{children:[n.jsx("div",{ref:o}),n.jsxs("div",{className:T("sticky top-0 z-10 mb-20 bg-paper",a&&"shadow"),children:[n.jsxs("div",{className:"px-20 py-10 flex items-center justify-between sm:justify-start gap-20 border-b text-muted",children:[!l&&n.jsxs(j.Fragment,{children:[n.jsx(w,{variant:"text",size:"sm",elementType:Y,to:i,relative:"path",startIcon:n.jsx(Cm,{}),children:n.jsx(d,{message:"Back"})}),n.jsx("div",{className:"mr-auto",children:e&&n.jsx(M6,{name:"slug",showLinkIcon:!1,prefix:"pages"})})]}),t&&n.jsx(l6,{editor:t}),!l&&n.jsx(c6,{editor:t}),n.jsx(S6,{onSave:()=>{s(t.getHTML())},isLoading:r})]}),n.jsx(w6,{editor:t,size:"sm"})]})]})}function S6({onSave:t,isLoading:e}){const r=I().watch("title");return n.jsx(w,{variant:"flat",size:"sm",color:"primary",className:"min-w-90",disabled:e||!r,onClick:()=>t(),children:n.jsx(d,{message:"Save"})})}function M6({name:t,...e}){const{field:{onChange:s,onBlur:r,value:i="",ref:a}}=Zs({name:t}),o=j.useRef(!1),{watch:l,setValue:c}=I();return j.useEffect(()=>{const u=l((h,{name:m})=>{m==="title"&&!o.current&&c("slug",h.title)});return()=>u.unsubscribe()},[l,c]),n.jsx(Bc,{className:T(!i&&"invisible"),onChange:u=>{o.current=!0,s(u)},onInputBlur:r,value:i,inputRef:a,...e})}const N6=_.lazy(()=>Nn(()=>import("./article-body-editor-7f09a01c.js"),["./article-body-editor-7f09a01c.js","./linkify.es-861b0b2d.js","./main-1406e08c.js","./main-f52edbcd.css","./format-3b5f6f65.js","./TrendingUp-bcf21998.js","./play-arrow-filled-8e87b0ae.js","./backstage-track-insights-d08cc66a.js","./Edit-4fa321e0.js","./use-resume-subscription-b3c8abe5.js","./MoreHoriz-16b2a1fa.js","./article-body-editor-b603c7db.css"],import.meta.url));function L6(){const t=Ch();return t.data?n.jsxs(j.Fragment,{children:[n.jsx(kh,{query:t}),n.jsx(T6,{page:t.data.page})]}):n.jsx("div",{className:"relative w-full h-full",children:n.jsx(na,{query:t})})}function T6({page:t}){const e=xe(),s=r6(),r=X({defaultValues:{title:t.title,slug:t.slug,body:t.body}}),i=a=>{s.mutate({...r.getValues(),body:a},{onSuccess:()=>e("../..",{relative:"path"})})};return n.jsx(j.Suspense,{fallback:n.jsx(es,{}),children:n.jsx(N6,{initialContent:t.body,children:a=>n.jsx(ks,{children:n.jsxs(Tl,{...r,children:[n.jsx(Pu,{editor:a,backLink:"../..",isLoading:s.isLoading,onSave:i}),n.jsx("div",{className:"mx-20",children:n.jsxs("div",{className:"prose dark:prose-invert mx-auto flex-auto",children:[n.jsx(Du,{}),n.jsx(za,{editor:a})]})})]})})})})}function A6(t){const e=t||"custom-pages";return $(s=>I6(s,e),{onError:s=>oe(s),onSuccess:async()=>{await F.invalidateQueries(["custom-pages"]),await F.invalidateQueries(ee(e)),H(g("Page created"))}})}function I6(t,e){return O.post(`${e}`,t).then(s=>s.data)}const E6=_.lazy(()=>Nn(()=>import("./article-body-editor-7f09a01c.js"),["./article-body-editor-7f09a01c.js","./linkify.es-861b0b2d.js","./main-1406e08c.js","./main-f52edbcd.css","./format-3b5f6f65.js","./TrendingUp-bcf21998.js","./play-arrow-filled-8e87b0ae.js","./backstage-track-insights-d08cc66a.js","./Edit-4fa321e0.js","./use-resume-subscription-b3c8abe5.js","./MoreHoriz-16b2a1fa.js","./article-body-editor-b603c7db.css"],import.meta.url));function D6(){const t=xe(),e=A6(),s=X(),r=i=>{e.mutate({...s.getValues(),body:i},{onSuccess:()=>t("../",{relative:"path"})})};return n.jsx(j.Suspense,{fallback:n.jsx(es,{}),children:n.jsx(E6,{children:i=>n.jsx(ks,{children:n.jsxs(Tl,{...s,children:[n.jsx(Pu,{editor:i,isLoading:e.isLoading,onSave:r,backLink:"../"}),n.jsx("div",{className:"mx-20",children:n.jsxs("div",{className:"prose dark:prose-invert mx-auto flex-auto",children:[n.jsx(Du,{}),n.jsx(za,{editor:i})]})})]})})})})}const O6=_.lazy(()=>Nn(()=>import("./admin-report-page-1f28ac16.js"),["./admin-report-page-1f28ac16.js","./main-1406e08c.js","./main-f52edbcd.css","./backstage-track-insights-d08cc66a.js","./play-arrow-filled-8e87b0ae.js","./Edit-4fa321e0.js","./TrendingUp-bcf21998.js","./use-resume-subscription-b3c8abe5.js","./MoreHoriz-16b2a1fa.js"],import.meta.url)),P6=[{path:"appearance",element:n.jsx(je,{permission:"appearance.update",children:n.jsx(wf,{})}),children:[{index:!0,element:n.jsx(b1,{})},{path:"general",element:n.jsx(Bf,{})},{path:"seo-settings",element:n.jsx(Uf,{})},{path:"custom-code",element:n.jsx(Kf,{})},{path:"themes",element:n.jsx(qf,{})},{path:"themes/:themeIndex",element:n.jsx(Cg,{})},{path:"menus",element:n.jsx(Lf,{})},{path:"menus/:menuIndex",element:n.jsx(Ef,{})},{path:"menus/:menuIndex/items/:menuItemIndex",element:n.jsx(zf,{})},...Object.values(xc.sections).flatMap(t=>t.routes||[])]},{path:"/",element:n.jsx(Pm,{}),children:[...n6,{path:"/",element:n.jsx(_.Suspense,{fallback:n.jsx(es,{}),children:n.jsx(O6,{})})},{path:"users",element:n.jsx(je,{permission:"users.update",children:n.jsx(vp,{})})},{path:"users/new",element:n.jsx(je,{permission:"users.update",children:n.jsx(Yx,{})})},{path:"users/:userId/edit",element:n.jsx(je,{permission:"users.update",children:n.jsx(Kx,{})})},{path:"roles",element:n.jsx(je,{permission:"roles.update",children:n.jsx(C1,{})})},{path:"roles/new",element:n.jsx(je,{permission:"roles.update",children:n.jsx(q1,{})})},{path:"roles/:roleId/edit",element:n.jsx(je,{permission:"roles.update",children:n.jsx(_1,{})})},{path:"subscriptions",element:n.jsx(je,{permission:"subscriptions.update",children:n.jsx(Z5,{})})},{path:"plans",element:n.jsx(je,{permission:"plans.update",children:n.jsx(o4,{})})},{path:"plans/new",element:n.jsx(je,{permission:"plans.update",children:n.jsx(k4,{})})},{path:"plans/:productId/edit",element:n.jsx(je,{permission:"plans.update",children:n.jsx(b4,{})})},{path:"custom-pages",element:n.jsx(je,{permission:"custom_pages.update",children:n.jsx(Yf,{})})},{path:"custom-pages/new",element:n.jsx(je,{permission:"custom_pages.update",children:n.jsx(D6,{})})},{path:"custom-pages/:pageId/edit",element:n.jsx(je,{permission:"custom_pages.update",children:n.jsx(L6,{})})},{path:"tags",element:n.jsx(je,{permission:"tags.update",children:n.jsx(X1,{})})},{path:"localizations",element:n.jsx(je,{permission:"localizations.update",children:n.jsx(c1,{})})},{path:"localizations/:localeId/translate",element:n.jsx(h1,{})},{path:"files",element:n.jsx(je,{permission:"files.update",children:n.jsx(F5,{})})},{path:"ads",element:n.jsx(je,{permission:"settings.update",children:n.jsx(g1,{})})},{path:"settings",element:n.jsx(je,{permission:"settings.update",children:n.jsx(tg,{})}),children:[{index:!0,element:n.jsx(wl,{to:"general",replace:!0})},{path:"general",element:n.jsx(ug,{})},{path:"subscriptions",element:n.jsx(Ug,{})},{path:"localization",element:n.jsx(Kg,{})},{path:"authentication",element:n.jsx(Jg,{})},{path:"uploading",element:n.jsx(hx,{})},{path:"mail",element:n.jsx(Lx,{})},{path:"cache",element:n.jsx(Ex,{})},{path:"analytics",element:n.jsx(qx,{})},{path:"logging",element:n.jsx(Px,{})},{path:"queue",element:n.jsx(zx,{})},{path:"recaptcha",element:n.jsx(Bx,{})},{path:"gdpr",element:n.jsx(w4,{})},...qg]}]},{path:"*",element:n.jsx(Sh,{})}];function F6(){return wh(P6)}const K6=Object.freeze(Object.defineProperty({__proto__:null,default:F6},Symbol.toStringTag,{value:"Module"}));export{cc as $,G8 as A,Yy as B,dy as C,st as D,Ae as E,ji as F,mv as G,hv as H,Xy as I,uv as J,ov as K,lv as L,ot as M,Ie as N,tv as O,ct as P,cv as Q,dv as R,Ky as S,Gy as T,Jy as U,K8 as V,sv as W,p6 as X,ga as Y,Dm as Z,g6 as _,Ws as a,U5 as a0,f6 as a1,_r as a2,o6 as a3,_4 as a4,yg as a5,x6 as a6,X5 as a7,Xx as a8,W8 as a9,J8 as aa,xg as ab,a6 as ac,k6 as ad,C6 as ae,t5 as af,Br as ag,K6 as ah,rs as b,H6 as c,du as d,l3 as e,U6 as f,W6 as g,q6 as h,be as i,J3 as j,Qy as k,_a as l,me as m,$3 as n,p5 as o,xv as p,Ou as q,Sr as r,Af as s,Wm as t,Eu as u,rv as v,av as w,nv as x,iv as y,ev as z}; //# sourceMappingURL=admin-routes-ee547daf.js.map
Save
Cancel